diff --git a/src/device/service/drivers/openconfig/templates/Interfaces.py b/src/device/service/drivers/openconfig/templates/Interfaces.py index da1bbd4837000cfcaf9d7cfc1165550addf46b4b..3f5b104f2de01137c2424e776dc60b8416088de6 100644 --- a/src/device/service/drivers/openconfig/templates/Interfaces.py +++ b/src/device/service/drivers/openconfig/templates/Interfaces.py @@ -37,6 +37,10 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: #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) + interface_type.text = interface_type.text.replace('ianaift:','') + 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, cast=int) @@ -50,6 +54,8 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: add_value_from_tag(subinterface, 'name', interface_name) add_value_from_tag(subinterface, 'mtu', interface_mtu) + add_value_from_tag(subinterface, 'type', interface_type) + subinterface_index = xml_subinterface.find('oci:index', namespaces=NAMESPACES) if subinterface_index is None or subinterface_index.text is None: continue 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 f172c167672cf660c89393cf333fa3e9241655fb..63a4f4f6cafb09a8723d9c311ec00a09f1e8c971 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,8 @@ <name>{{name}}</name> <config> <name>{{name}}</name> - <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:l3ipvlan</type> - <mtu>{{mtu}}</mtu> + <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:{{type}}</type> + {% if mtu is defined %}<mtu>{{mtu}}</mtu>{% endif%} <enabled>true</enabled> </config> <subinterfaces> @@ -24,6 +24,7 @@ </single-tagged> </match> </vlan> + {% if address_ip is defined %} <oc-ip:ipv4> <oc-ip:addresses> <oc-ip:address> @@ -35,7 +36,7 @@ </oc-ip:address> </oc-ip:addresses> </oc-ip:ipv4> - + {% endif%} </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 74424cea948dc01c2bcf68538aafe674a9d336c5..1944778c6fc4fcee96e79f3ce93ce044869226e5 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,6 +5,7 @@ <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 %} {% if router_id is defined %}<router-id>{{router_id}}</router-id>{% endif %} <route-distinguisher>{{route_distinguisher}}</route-distinguisher> @@ -16,6 +17,26 @@ <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>false</enabled> + <mtu>1500</mtu> + </config> + <encapsulation> + <config> + <encapsulation-type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:MPLS</encapsulation-type> + </config> + </encapsulation> + <fdb> + <config> + <mac-learning>true</mac-learning> + <maximum-entries>1000</maximum-entries> + <mac-aging-time>300</mac-aging-time> + </config> + </fdb> + {% endif %} + {% endif %} </network-instance> </network-instances>