diff --git a/src/device/service/drivers/openconfig/templates/NetworkInstances.py b/src/device/service/drivers/openconfig/templates/NetworkInstances.py index c00995b3aa4060363113f5743e2687ca6d1e7fd9..9de16d0e973c5d5c7d2e3b4a0dc750f14637cfbf 100644 --- a/src/device/service/drivers/openconfig/templates/NetworkInstances.py +++ b/src/device/service/drivers/openconfig/templates/NetworkInstances.py @@ -23,6 +23,8 @@ XPATH_NETWORK_INSTANCES = "//ocni:network-instances/ocni:network-instance" XPATH_NI_PROTOCOLS = ".//ocni:protocols/ocni:protocol" XPATH_NI_TABLE_CONNECTS = ".//ocni:table-connections/ocni:table-connection" +XPATH_NI_INTERFACE = ".//ocni:interfaces/ocni:interface" + XPATH_NI_IIP_AP = ".//ocni:inter-instance-policies/ocni:apply-policy" XPATH_NI_IIP_AP_IMPORT = ".//ocni:config/ocni:import-policy" XPATH_NI_IIP_AP_EXPORT = ".//ocni:config/ocni:export-policy" @@ -136,6 +138,21 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: table_connection['address_family']) response.append((resource_key, table_connection)) + for xml_interface in xml_network_instance.xpath(XPATH_NI_INTERFACE, namespaces=NAMESPACES): + LOGGER.info('xml_interfaces = {:s}'.format(str(ET.tostring(xml_interface)))) + + interface = {} + name_iface = xml_interface.find('ocni:config/ocni:interface', namespaces=NAMESPACES) + if name_iface is None or name_iface.text is None: continue + add_value_from_tag(interface, 'name_iface', name_iface) + + name_subiface = xml_interface.find('ocni:config/ocni:subinterface', namespaces=NAMESPACES) + add_value_from_tag(interface, 'name_subiface', name_subiface) + + resource_key = '/network_instance[{:s}]/interface[{:s}]'.format( + network_instance['name'], interface['name_iface']) + response.append((resource_key, interface)) + for xml_iip_ap in xml_network_instance.xpath(XPATH_NI_IIP_AP, namespaces=NAMESPACES): #LOGGER.info('xml_iip_ap = {:s}'.format(str(ET.tostring(xml_iip_ap))))