From 5643f06bfc723355fab65df7d5583a81b2b6cb48 Mon Sep 17 00:00:00 2001 From: gifrerenom <lluis.gifre@cttc.es> Date: Tue, 23 Apr 2024 10:41:48 +0000 Subject: [PATCH] Device component - OpenConfig driver: - Disabled IPInfusion custom fields in table connections - Corrected interface handling messages --- .../templates/VPN/Interfaces_multivendor.py | 4 ++- .../VPN/Network_instance_multivendor.py | 25 +++---------------- .../table_connections/edit_config.xml | 4 ++- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/device/service/drivers/openconfig/templates/VPN/Interfaces_multivendor.py b/src/device/service/drivers/openconfig/templates/VPN/Interfaces_multivendor.py index 0efa2e8f2..ab57ce3bd 100644 --- a/src/device/service/drivers/openconfig/templates/VPN/Interfaces_multivendor.py +++ b/src/device/service/drivers/openconfig/templates/VPN/Interfaces_multivendor.py @@ -65,8 +65,10 @@ def create_If_SubIf(data,vendor, DEL): with tag('single-tagged'): with tag('config'): with tag('vlan-id'):text(data['vlan_id']) - if "l3ipvlan" in data['type']: + if "l3ipvlan" in data['type'] and 'address_ip' in data: with tag('ipv4', xmlns="http://openconfig.net/yang/interfaces/ip"): + if 'mtu' in data: + with tag('mtu'):text(data['mtu']) with tag('addresses'): with tag('address'): with tag('ip'):text(data['address_ip']) diff --git a/src/device/service/drivers/openconfig/templates/VPN/Network_instance_multivendor.py b/src/device/service/drivers/openconfig/templates/VPN/Network_instance_multivendor.py index 1f7015694..8d59cf5ac 100644 --- a/src/device/service/drivers/openconfig/templates/VPN/Network_instance_multivendor.py +++ b/src/device/service/drivers/openconfig/templates/VPN/Network_instance_multivendor.py @@ -196,7 +196,7 @@ def associate_If_to_NI(parameters, DEL): with tag('name'):text(parameters['name']) with tag('config'): with tag('name'):text(parameters['name']) - with tag('type', 'xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types"'):text('oc-ni-types:L3VRF') + with tag('type', 'xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types"'):text('oc-ni-types:',parameters['type']) with tag('interfaces'): with tag('interface'): with tag('id'):text(parameters['id']) @@ -204,25 +204,7 @@ def associate_If_to_NI(parameters, DEL): with tag('id') :text(parameters['id']) with tag('interface') :text(parameters['interface']) with tag('subinterface'):text(parameters['subinterface']) - with tag('interfaces', 'xmlns="http://openconfig.net/yang/interfaces"'): - with tag('interface'): - with tag('name'):text(parameters['interface']) - with tag('config'): - with tag('name'):text(parameters['interface']) - with tag('subinterfaces'): - with tag('subinterface'): - with tag('index'): text(parameters['subinterface']) - with tag('config'): - with tag('index'): text(parameters['subinterface']) - with tag('ipv4', 'xmlns="http://openconfig.net/yang/interfaces/ip"'): - with tag('config'): - with tag('mtu'): text('1500') - with tag('addresses'): - with tag('address'): - with tag('ip'):text(parameters['address_ip']) - with tag('config'): - with tag('ip'):text(parameters['address_ip']) - with tag('prefix-length'):text(parameters['address_prefix']) + result = indent( doc.getvalue(), @@ -365,7 +347,8 @@ def create_table_conns(parameters,DEL): with tag('src-protocol','xmlns:oc-pol-types="http://openconfig.net/yang/policy-types"'): text('oc-pol-types:',parameters['src_protocol']) with tag('dst-protocol','xmlns:oc-pol-types="http://openconfig.net/yang/policy-types"'): text('oc-pol-types:',parameters['dst_protocol']) with tag('address-family', 'xmlns:oc-types="http://openconfig.net/yang/openconfig-types"'):text('oc-types:',parameters['address_family']) - with tag('dst-instance', 'xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-oc-ni-augments"'):text('65000') + # for OCNOS: check if needed + #with tag('dst-instance', 'xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-oc-ni-augments"'):text('65000') if len(parameters['default_import_policy']) != 0: with tag('default-import-policy'):text(parameters['default_import_policy']) result = indent( diff --git a/src/device/service/drivers/openconfig/templates/network_instance/table_connections/edit_config.xml b/src/device/service/drivers/openconfig/templates/network_instance/table_connections/edit_config.xml index bd1dac1b3..35c535c6b 100644 --- a/src/device/service/drivers/openconfig/templates/network_instance/table_connections/edit_config.xml +++ b/src/device/service/drivers/openconfig/templates/network_instance/table_connections/edit_config.xml @@ -11,7 +11,9 @@ <src-protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:{{src_protocol}}</src-protocol> <dst-protocol xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:{{dst_protocol}}</dst-protocol> <address-family xmlns:oc-types="http://openconfig.net/yang/openconfig-types">oc-types:{{address_family}}</address-family> - <dst-instance xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-oc-ni-augments">{{as}}</dst-instance> + {% if False %} + <dst-instance xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-oc-ni-augments">{{as}}</dst-instance> + {% endif %} {% if default_import_policy is defined %}<default-import-policy>{{default_import_policy}}</default-import-policy>{% endif %} </config> {% endif %} -- GitLab