Loading src/device/service/drivers/openconfig/templates/Interfaces.py +10 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ LOGGER = logging.getLogger(__name__) XPATH_INTERFACES = "//oci:interfaces/oci:interface" XPATH_SUBINTERFACES = ".//oci:subinterfaces/oci:subinterface" XPATH_IPV4ADDRESSES = ".//ociip:ipv4/ociip:addresses/ociip:address" XPATH_IPV4ADDRESSES = ".//ociip:ipv6/ociip:addresses/ociip:address" def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: response = [] Loading Loading @@ -97,6 +98,15 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: #add_value_from_collection(subinterface, 'ipv4_addresses', ipv4_addresses) for xml_ipv6_address in xml_subinterface.xpath(XPATH_IPV6ADDRESSES, namespaces=NAMESPACES): #LOGGER.info('xml_ipv6_address = {:s}'.format(str(ET.tostring(xml_ipv6_address)))) address = xml_ipv6_address.find('ociip:state/ociip:ip', namespaces=NAMESPACES) add_value_from_tag(subinterface, 'address_ipv6', address) prefix = xml_ipv6_address.find('ociip:state/ociip:prefix-length', namespaces=NAMESPACES) add_value_from_tag(subinterface, 'address_prefix_v6', prefix, cast=int) if len(subinterface) == 0: continue resource_key = '/interface[{:s}]/subinterface[{:s}]'.format(interface['name'], str(subinterface['index'])) response.append((resource_key, subinterface)) Loading Loading
src/device/service/drivers/openconfig/templates/Interfaces.py +10 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ LOGGER = logging.getLogger(__name__) XPATH_INTERFACES = "//oci:interfaces/oci:interface" XPATH_SUBINTERFACES = ".//oci:subinterfaces/oci:subinterface" XPATH_IPV4ADDRESSES = ".//ociip:ipv4/ociip:addresses/ociip:address" XPATH_IPV4ADDRESSES = ".//ociip:ipv6/ociip:addresses/ociip:address" def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: response = [] Loading Loading @@ -97,6 +98,15 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: #add_value_from_collection(subinterface, 'ipv4_addresses', ipv4_addresses) for xml_ipv6_address in xml_subinterface.xpath(XPATH_IPV6ADDRESSES, namespaces=NAMESPACES): #LOGGER.info('xml_ipv6_address = {:s}'.format(str(ET.tostring(xml_ipv6_address)))) address = xml_ipv6_address.find('ociip:state/ociip:ip', namespaces=NAMESPACES) add_value_from_tag(subinterface, 'address_ipv6', address) prefix = xml_ipv6_address.find('ociip:state/ociip:prefix-length', namespaces=NAMESPACES) add_value_from_tag(subinterface, 'address_prefix_v6', prefix, cast=int) if len(subinterface) == 0: continue resource_key = '/interface[{:s}]/subinterface[{:s}]'.format(interface['name'], str(subinterface['index'])) response.append((resource_key, subinterface)) Loading