Loading src/device/service/drivers/openconfig/templates/Interfaces.py +5 −6 Original line number Diff line number Diff line Loading @@ -31,10 +31,6 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: interface = {} interface_name = xml_interface.find('oci:name', namespaces=NAMESPACES) if interface_name is None or interface_name.text is None: continue add_value_from_tag(interface, 'name', interface_name) #interface_type = xml_interface.find('oci:config/oci:type', namespaces=NAMESPACES) #add_value_from_tag(interface, 'type', interface_type) Loading @@ -42,8 +38,11 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: interface_type = xml_interface.find('oci:config/oci:type', namespaces=NAMESPACES) elif xml_interface.find('oci:state/oci:type', namespaces=NAMESPACES) is not None: interface_type = xml_interface.find('oci:state/oci:type', namespaces=NAMESPACES) else: interface_type = '' else: continue interface_name = xml_interface.find('oci:name', namespaces=NAMESPACES) if interface_name is None or interface_name.text is None: continue add_value_from_tag(interface, 'name', interface_name) # Get the type of interface according to the vendor's type if 'ianaift:' in interface_type.text: Loading src/device/service/drivers/openconfig/templates/Inventory.py +3 −4 Original line number Diff line number Diff line Loading @@ -54,7 +54,6 @@ XPATH_PORTS = "//ocp:components/ocp:component" def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: response = [] LOGGER.debug("InventoryPrueba") parent_types = {} for xml_component in xml_data.xpath(XPATH_PORTS, namespaces=NAMESPACES): LOGGER.info('xml_component inventario = {:s}'.format(str(ET.tostring(xml_component)))) Loading @@ -78,8 +77,8 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: add_value_from_tag(inventory['attributes'], 'location', component_location) component_type = xml_component.find('ocp:state/ocp:type', namespaces=NAMESPACES) if component_type is not None: component_type.text = component_type.text.replace('oc-platform-types:','') if component_type is None: continue add_value_from_tag(inventory, 'class', component_type) if inventory['class'] == 'CPU' or inventory['class'] == 'STORAGE': continue Loading src/device/service/drivers/openconfig/templates/RoutingPolicy.py +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: #LOGGER.info('xml_policy_definition = {:s}'.format(str(ET.tostring(xml_policy_definition)))) policy_definition = {} statement_name = '' policy_name = xml_policy_definition.find('ocrp:name', namespaces=NAMESPACES) if policy_name is None or policy_name.text is None: continue add_value_from_tag(policy_definition, 'policy_name', policy_name) Loading Loading
src/device/service/drivers/openconfig/templates/Interfaces.py +5 −6 Original line number Diff line number Diff line Loading @@ -31,10 +31,6 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: interface = {} interface_name = xml_interface.find('oci:name', namespaces=NAMESPACES) if interface_name is None or interface_name.text is None: continue add_value_from_tag(interface, 'name', interface_name) #interface_type = xml_interface.find('oci:config/oci:type', namespaces=NAMESPACES) #add_value_from_tag(interface, 'type', interface_type) Loading @@ -42,8 +38,11 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: interface_type = xml_interface.find('oci:config/oci:type', namespaces=NAMESPACES) elif xml_interface.find('oci:state/oci:type', namespaces=NAMESPACES) is not None: interface_type = xml_interface.find('oci:state/oci:type', namespaces=NAMESPACES) else: interface_type = '' else: continue interface_name = xml_interface.find('oci:name', namespaces=NAMESPACES) if interface_name is None or interface_name.text is None: continue add_value_from_tag(interface, 'name', interface_name) # Get the type of interface according to the vendor's type if 'ianaift:' in interface_type.text: Loading
src/device/service/drivers/openconfig/templates/Inventory.py +3 −4 Original line number Diff line number Diff line Loading @@ -54,7 +54,6 @@ XPATH_PORTS = "//ocp:components/ocp:component" def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: response = [] LOGGER.debug("InventoryPrueba") parent_types = {} for xml_component in xml_data.xpath(XPATH_PORTS, namespaces=NAMESPACES): LOGGER.info('xml_component inventario = {:s}'.format(str(ET.tostring(xml_component)))) Loading @@ -78,8 +77,8 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: add_value_from_tag(inventory['attributes'], 'location', component_location) component_type = xml_component.find('ocp:state/ocp:type', namespaces=NAMESPACES) if component_type is not None: component_type.text = component_type.text.replace('oc-platform-types:','') if component_type is None: continue add_value_from_tag(inventory, 'class', component_type) if inventory['class'] == 'CPU' or inventory['class'] == 'STORAGE': continue Loading
src/device/service/drivers/openconfig/templates/RoutingPolicy.py +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: #LOGGER.info('xml_policy_definition = {:s}'.format(str(ET.tostring(xml_policy_definition)))) policy_definition = {} statement_name = '' policy_name = xml_policy_definition.find('ocrp:name', namespaces=NAMESPACES) if policy_name is None or policy_name.text is None: continue add_value_from_tag(policy_definition, 'policy_name', policy_name) Loading