diff --git a/src/device/service/drivers/openconfig/templates/Interfaces.py b/src/device/service/drivers/openconfig/templates/Interfaces.py index 0bbd70d04a3c093dcdbad4966be3030dbc8ba0fb..04d03398a726978173c1b789859e9bffea8b32a9 100644 --- a/src/device/service/drivers/openconfig/templates/Interfaces.py +++ b/src/device/service/drivers/openconfig/templates/Interfaces.py @@ -20,14 +20,22 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: 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) + #interface_type = xml_interface.find('oci:config/oci:type', namespaces=NAMESPACES) + #add_value_from_tag(interface, 'type', interface_type) + + interface_mtu = xml_interface.find('oci:config/oci:mtu', namespaces=NAMESPACES) + add_value_from_tag(interface, 'mtu',interface_mtu) + + interface_description = xml_interface.find('oci:config/oci:description', namespaces=NAMESPACES) + add_value_from_tag(interface, 'description', interface_description) for xml_subinterface in xml_interface.xpath(XPATH_SUBINTERFACES, namespaces=NAMESPACES): LOGGER.info('xml_subinterface = {:s}'.format(str(ET.tostring(xml_subinterface)))) subinterface = {} + add_value_from_tag(subinterface, 'name', interface_name) + subinterface_index = xml_subinterface.find('oci:index', namespaces=NAMESPACES) if subinterface_index is None or subinterface_index.text is None: continue add_value_from_tag(subinterface, 'index', subinterface_index) @@ -35,25 +43,25 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: vlan_id = xml_subinterface.find('ocv:vlan/ocv:config/ocv:vlan-id', namespaces=NAMESPACES) add_value_from_tag(subinterface, 'vlan_id', vlan_id, cast=int) - ipv4_addresses = [] - for xml_ipv4_address in xml_subinterface.xpath(XPATH_IPV4ADDRESSES, namespaces=NAMESPACES): - LOGGER.info('xml_ipv4_address = {:s}'.format(str(ET.tostring(xml_ipv4_address)))) - - ipv4_address = {} - - origin = xml_ipv4_address.find('ociip:state/ociip:origin', namespaces=NAMESPACES) - add_value_from_tag(ipv4_address, 'origin', origin) - - address = xml_ipv4_address.find('ociip:state/ociip:ip', namespaces=NAMESPACES) - add_value_from_tag(ipv4_address, 'ip', address) - - prefix = xml_ipv4_address.find('ociip:state/ociip:prefix-length', namespaces=NAMESPACES) - add_value_from_tag(ipv4_address, 'prefix_length', prefix) - - if len(ipv4_address) == 0: continue - ipv4_addresses.append(ipv4_address) - - add_value_from_collection(subinterface, 'ipv4_addresses', ipv4_addresses) + #ipv4_addresses = [] + #for xml_ipv4_address in xml_subinterface.xpath(XPATH_IPV4ADDRESSES, namespaces=NAMESPACES): + # LOGGER.info('xml_ipv4_address = {:s}'.format(str(ET.tostring(xml_ipv4_address)))) + # + # ipv4_address = {} + # + # origin = xml_ipv4_address.find('ociip:state/ociip:origin', namespaces=NAMESPACES) + # add_value_from_tag(ipv4_address, 'origin', origin) + # + # address = xml_ipv4_address.find('ociip:state/ociip:ip', namespaces=NAMESPACES) + # add_value_from_tag(ipv4_address, 'ip', address) + # + # prefix = xml_ipv4_address.find('ociip:state/ociip:prefix-length', namespaces=NAMESPACES) + # add_value_from_tag(ipv4_address, 'prefix_length', prefix) + # + # if len(ipv4_address) == 0: continue + # ipv4_addresses.append(ipv4_address) + # + #add_value_from_collection(subinterface, 'ipv4_addresses', ipv4_addresses) if len(subinterface) == 0: continue resource_key = 'interface[{:s}]/subinterface[{:s}]'.format(interface['name'], subinterface['index']) diff --git a/src/device/service/drivers/openconfig/templates/NetworkInstances.py b/src/device/service/drivers/openconfig/templates/NetworkInstances.py index 06bf5cd0f38aaf8c61f2919c25891e15f9ac4343..b842a16a97d4e917781381e45b7481feaca196bd 100644 --- a/src/device/service/drivers/openconfig/templates/NetworkInstances.py +++ b/src/device/service/drivers/openconfig/templates/NetworkInstances.py @@ -27,8 +27,8 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: ni_route_dist = xml_network_instance.find('ocni:config/ocni:route-distinguisher', namespaces=NAMESPACES) add_value_from_tag(network_instance, 'route_distinguisher', ni_route_dist) - ni_address_families = [] - add_value_from_collection(network_instance, 'address_families', ni_address_families) + #ni_address_families = [] + #add_value_from_collection(network_instance, 'address_families', ni_address_families) if len(network_instance) == 0: continue response.append(('network_instance[{:s}]'.format(network_instance['name']), network_instance)) diff --git a/src/device/service/drivers/openconfig/templates/interface/subinterface/edit_config.xml b/src/device/service/drivers/openconfig/templates/interface/subinterface/edit_config.xml index bdc698eeffd626076f6f62e576fe6ef916361412..6c1d2b06d157901943690ccefa057b913c5f81bb 100644 --- a/src/device/service/drivers/openconfig/templates/interface/subinterface/edit_config.xml +++ b/src/device/service/drivers/openconfig/templates/interface/subinterface/edit_config.xml @@ -4,8 +4,10 @@ {% if operation is not defined or operation != 'delete' %} <config> <name>{{name}}</name> + {% if 1==0 %} <description>{{description}}</description> <mtu>{{mtu}}</mtu> + {% endif %} </config> {% endif %} <subinterfaces> @@ -16,6 +18,11 @@ <index>{{index}}</index> </config> {% endif %} + <vlan xmlns="http://openconfig.net/yang/vlan"> + <config> + <vlan-id>{{index}}</vlan-id> + </config> + </vlan> </subinterface> </subinterfaces> </interface> diff --git a/src/device/service/drivers/openconfig/templates/network_instance/edit_config.xml b/src/device/service/drivers/openconfig/templates/network_instance/edit_config.xml index fab1fdc61f0b6add9c915e914f830270d9875a0a..6aa2f0735d75b4c5574d82e95c4fd073519f233f 100644 --- a/src/device/service/drivers/openconfig/templates/network_instance/edit_config.xml +++ b/src/device/service/drivers/openconfig/templates/network_instance/edit_config.xml @@ -5,12 +5,24 @@ <config> <name>{{name}}</name> <type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:{{type}}</type> + + {% if 1==0 %} {% for address_family in address_families %} <enabled-address-families xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:{{address_family}}</enabled-address-families> {% endfor %} + {% else %} + <description>PhiTst_1</description> + {% endif %} + <router-id>{{router_id}}</router-id> <route-distinguisher>{{route_distinguisher}}</route-distinguisher> + <enabled>true</enabled> </config> + <encapsulation> + <config> + <encapsulation-type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:MPLS</encapsulation-type> + </config> + </encapsulation> {% endif %} </network-instance> </network-instances> diff --git a/src/device/service/drivers/openconfig/templates/network_instance/interface/edit_config.xml b/src/device/service/drivers/openconfig/templates/network_instance/interface/edit_config.xml index 51f2d4318fbdd2d6da120851a72a6edafe173c73..d678d1668a1b5caa3407183d12de87a95e5bff95 100644 --- a/src/device/service/drivers/openconfig/templates/network_instance/interface/edit_config.xml +++ b/src/device/service/drivers/openconfig/templates/network_instance/interface/edit_config.xml @@ -7,7 +7,12 @@ {% if operation is not defined or operation != 'delete' %} <config> <id>{{id}}</id> + {% if 1==0 %} <interface>{{id}}</interface> + {% else %} + <interface>13/1/2</interface> + <subinterface>1</subinterface> + {% endif %} </config> {% endif %} </interface> diff --git a/src/device/tests/.gitignore b/src/device/tests/.gitignore index 5cb8b444d357c5e39eb31759d67b92fca7beabb2..ddc03384a08a4eadd96a7068a701e60d67727898 100644 --- a/src/device/tests/.gitignore +++ b/src/device/tests/.gitignore @@ -1,3 +1,4 @@ # Add here your files containing confidential testbed details such as IP addresses, ports, usernames, passwords, etc. Device_OpenConfig_Infinera.py +Device_OpenConfig_Infinera_TID.py Device_Transport_Api_CTTC.py