From f2a1b9ea0dc141a3a871df1c42ed1626b981edbd Mon Sep 17 00:00:00 2001 From: gifrerenom <lluis.gifre@cttc.es> Date: Fri, 7 Oct 2022 18:00:47 +0000 Subject: [PATCH] Device component: OpenConfig Driver: - added default endpoint type in case it cannot be retrieved from the remote device - corrected network_instance/edit_config.xml template; wrong XML format --- .../drivers/openconfig/templates/EndPoints.py | 1 + .../network_instance/edit_config.xml | 26 +++++++++---------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/device/service/drivers/openconfig/templates/EndPoints.py b/src/device/service/drivers/openconfig/templates/EndPoints.py index 718a02d19..9bd2e75ac 100644 --- a/src/device/service/drivers/openconfig/templates/EndPoints.py +++ b/src/device/service/drivers/openconfig/templates/EndPoints.py @@ -44,6 +44,7 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: component_type = xml_component.find( 'ocpp:port/ocpp:breakout-mode/ocpp:state/ocpp:channel-speed', namespaces=NAMESPACES) add_value_from_tag(endpoint, 'type', component_type) + if 'type' not in endpoint: endpoint['type'] = '-' sample_types = { ORM_KpiSampleTypeEnum.BYTES_RECEIVED.value : XPATH_IFACE_COUNTER.format(endpoint['uuid'], 'in-octets' ), 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 17b07df72..6b6b733da 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,29 +5,30 @@ <config> <name>{{name}}</name> <type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:{{type}}</type> - {% if type=='L3VRF' %} {% if description is defined %}<description>{{description}}</description>{% endif %} + <enabled>true</enabled> + {% if type=='L3VRF' %} {% if router_id is defined %}<router-id>{{router_id}}</router-id>{% endif %} <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> - <label-allocation-mode xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:INSTANCE_LABEL</label-allocation-mode> - </config> - </encapsulation> {% endif %} {% if type=='L2VSI' %} - {% if description is defined %}<description>{{description}}</description>{% endif %} - <enabled>true</enabled> <mtu>1500</mtu> + {% endif %} </config> + {% if type=='L3VRF' or type=='L2VSI' %} <encapsulation> <config> + {% if type=='L3VRF' %} <encapsulation-type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:MPLS</encapsulation-type> + <label-allocation-mode xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:INSTANCE_LABEL</label-allocation-mode> + {% endif %} + {% if type=='L2VSI' %} + <encapsulation-type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:MPLS</encapsulation-type> + {% endif %} </config> </encapsulation> + {% endif %} + {% if type=='L2VSI' %} <fdb> <config> <mac-learning>true</mac-learning> @@ -35,8 +36,7 @@ <mac-aging-time>300</mac-aging-time> </config> </fdb> - {% endif %} - + {% endif %} {% endif %} </network-instance> </network-instances> -- GitLab