Commit 491db311 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Device component - gNMI OpenConfig Driver:

- Code cleanup
parent 7112ec28
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ class InterfaceHandler(_Handler):
        address_prefix = get_int (resource_value, 'address_prefix') # 24
        mtu            = get_int (resource_value, 'mtu'           ) # 1500


        yang_ifs : libyang.DContainer = yang_handler.get_data_path('/openconfig-interfaces:interfaces')
        yang_if_path = 'interface[name="{:s}"]'.format(if_name)
        yang_if : libyang.DContainer = yang_ifs.create_path(yang_if_path)
@@ -87,10 +86,6 @@ class InterfaceHandler(_Handler):
            yang_ipv4_addr.create_path('config/ip',            address_ip)
            yang_ipv4_addr.create_path('config/prefix-length', address_prefix)

        LOGGER.info('YangHandler Data:')
        for path, dnode in yang_handler.get_data_paths().items():
            LOGGER.info('|-> {:s}: {:s}'.format(str(path), json.dumps(dnode.print_dict())))

        str_path = '/interfaces/interface[name={:s}]'.format(if_name)
        str_data = yang_if.print_mem('json')
        json_data = json.loads(str_data)
+3 −5
Original line number Diff line number Diff line
@@ -36,15 +36,13 @@ class NetworkInstanceInterfaceHandler(_Handler):

        if IS_CEOS: ni_if_id = if_name

        if delete:
        PATH_TMPL = '/network-instances/network-instance[name={:s}]/interfaces/interface[id={:s}]'
        str_path = PATH_TMPL.format(ni_name, ni_if_id)

        if delete:
            str_data = json.dumps({})
            return str_path, str_data

        str_path = '/network-instances/network-instance[name={:s}]/interfaces/interface[id={:s}]'.format(
            ni_name, ni_if_id
        )
        #str_data = json.dumps({
        #    'id': if_id,
        #    'config': {'id': if_id, 'interface': if_name, 'subinterface': sif_index},