From 4580bbff8b079ccb088de2c0e2fe695414ca725c Mon Sep 17 00:00:00 2001 From: gifrerenom <lluis.gifre@cttc.es> Date: Tue, 23 Apr 2024 09:41:32 +0000 Subject: [PATCH] Device component - OpenConfig driver: - Fixes in per-vendor specificities - Renamed sequence_id to statement_name --- .../openconfig/templates/VPN/Interfaces_multivendor.py | 3 +-- .../templates/VPN/Network_instance_multivendor.py | 9 +++------ .../drivers/openconfig/templates/VPN/Routing_policy.py | 5 ++--- .../policy_definition/statement/edit_config.xml | 4 ++-- 4 files changed, 8 insertions(+), 13 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 453096e19..0efa2e8f2 100644 --- a/src/device/service/drivers/openconfig/templates/VPN/Interfaces_multivendor.py +++ b/src/device/service/drivers/openconfig/templates/VPN/Interfaces_multivendor.py @@ -54,8 +54,7 @@ def create_If_SubIf(data,vendor, DEL): with tag('enabled'):text('true') with tag('subinterfaces'): with tag('subinterface'): - # if vendor == 'ADVA': - if True: + if vendor is None or vendor == 'ADVA': with tag('index'): text('0') with tag('config'): with tag('index'): text('0') 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 8e6a9144e..1f7015694 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 @@ -66,12 +66,10 @@ def create_NI(parameters,vendor,DEL): with tag('name'):text(parameters['name']) if "router_id" in parameters: with tag('router-id'):text(parameters['router_id']) - # if vendor == "ADVA": - if True: + if vendor is None or vendor == 'ADVA': with tag('type', 'xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types"'):text('oc-ni-types:',parameters['type']) with tag('route-distinguisher'):text(parameters['route_distinguisher']) - # if vendor == "ADVA": - if True: + if vendor is None or vendor == 'ADVA': with tag('encapsulation'): with tag('config'): with tag('encapsulation-type', 'xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types"') :text('oc-ni-types:MPLS') @@ -149,8 +147,7 @@ def add_protocol_NI(parameters,vendor, DEL): with tag('neighbor-address'): text(neighbor['ip_address']) with tag('enabled'): text('true') with tag('peer-as'): text(parameters['as']) - # if vendor == "ADVA": - if True: + if vendor is None or vendor == 'ADVA': with tag('tables'): with tag('table'): with tag('protocol', 'xmlns:oc-pol-types="http://openconfig.net/yang/policy-types"'):text('oc-pol-types:',parameters['identifier']) diff --git a/src/device/service/drivers/openconfig/templates/VPN/Routing_policy.py b/src/device/service/drivers/openconfig/templates/VPN/Routing_policy.py index b144eb5ba..69fdd2cc5 100644 --- a/src/device/service/drivers/openconfig/templates/VPN/Routing_policy.py +++ b/src/device/service/drivers/openconfig/templates/VPN/Routing_policy.py @@ -40,7 +40,6 @@ def create_rp_statement(data, DEL): RP_statement_name = data['statement_name'] RP_policy_result = data['policy_result'] RP_ext_comm_set_name = data['ext_community_set_name'] - RP_sequence_id = data['sequence_id'] with tag('routing-policy', xmlns="http://openconfig.net/yang/routing-policy"): @@ -56,9 +55,9 @@ def create_rp_statement(data, DEL): with tag('name'):text(RP_policy_name) with tag('statements'): with tag('statement'): - with tag('name'):text(RP_sequence_id) + with tag('name'):text(RP_statement_name) with tag('config'): - with tag('name'):text(RP_sequence_id) + with tag('name'):text(RP_statement_name) with tag('conditions'): with tag('config'): with tag('install-protocol-eq', **{'xmlns:openconfig-policy-types': 'http://openconfig.net/yang/policy-types'}):text('openconfig-policy-types:DIRECTLY_CONNECTED') diff --git a/src/device/service/drivers/openconfig/templates/routing_policy/policy_definition/statement/edit_config.xml b/src/device/service/drivers/openconfig/templates/routing_policy/policy_definition/statement/edit_config.xml index 1bf1cf322..eda2d99c9 100644 --- a/src/device/service/drivers/openconfig/templates/routing_policy/policy_definition/statement/edit_config.xml +++ b/src/device/service/drivers/openconfig/templates/routing_policy/policy_definition/statement/edit_config.xml @@ -8,9 +8,9 @@ </config> <statements> <statement> - <name>{{sequence_id}}</name> + <name>{{statement_name}}</name> <config> - <name>{{sequence_id}}</name> + <name>{{statement_name}}</name> </config> <conditions> <config> -- GitLab