Resolve "(CTTC) Incorrect endpoint lookup in NBI ETSI BWM plugin"

Closes #110 (closed)

Merge request reports

Loading
+25 −0
Changes for scripts/run_tests_locally-device-openconfig-ocnos.sh: 25 added lines, 0 removed lines.
Original line number Diff line number Diff line
#!/bin/bash
# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


PROJECTDIR=`pwd`

cd $PROJECTDIR/src
RCFILE=$PROJECTDIR/coverage/.coveragerc

# Run unitary tests and analyze coverage of code at same time
# helpful pytest flags: --log-level=INFO -o log_cli=true --verbose --maxfail=1 --durations=0
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO -o log_cli=true --verbose \
    device/tests/test_unitary_openconfig_ocnos.py
+4 −2
Changes for src/device/service/drivers/openconfig/templates/VPN/Interfaces_multivendor.py: 4 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ def create_If_SubIf(data,vendor, DEL):
                    with tag('enabled'):text('true')    
                with tag('subinterfaces'):
                    with tag('subinterface'):
                        if vendor == 'ADVA':
                        if vendor is None or vendor == 'ADVA':
                            with tag('index'): text('0')
                        with tag('config'):
                            with tag('index'): text('0')
@@ -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'])
+28 −6
Changes for src/device/service/drivers/openconfig/templates/VPN/Network_instance_multivendor.py: 28 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -64,10 +64,12 @@ def create_NI(parameters,vendor,DEL):
                elif "L3VRF" in parameters['type']: 
                    with tag('config'):
                        with tag('name'):text(parameters['name'])
                        if vendor == "ADVA": 
                        if "router_id" in parameters: 
                            with tag('router-id'):text(parameters['router_id'])
                        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 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')
@@ -123,14 +125,29 @@ def add_protocol_NI(parameters,vendor, DEL):
                        with tag('config'):
                            with tag('identifier', 'xmlns:oc-pol-types="http://openconfig.net/yang/policy-types"'):text('oc-pol-types:',parameters['identifier'])
                            with tag('name')      :text(parameters['protocol_name'])
                            with tag('enabled'): text('true')
                        if "BGP" in parameters['identifier']:
                            with tag('bgp'):
                                with tag('name'): text(parameters['as'])
                                with tag('global'):
                                    with tag('config'):
                                        with tag('as')       :text(parameters['as'])
                                        if "router-id" in parameters: 
                                            with tag('router-id'):text(parameters['router-id'])
                if vendor == "ADVA": 
                                        if "router_id" in parameters: 
                                            with tag('router-id'):text(parameters['router_id'])
                                if 'neighbors' in parameters:
                                    with tag('neighbors'):
                                        for neighbor in parameters['neighbors']:
                                            with tag('neighbor'):
                                                with tag('neighbor-address'): text(neighbor['ip_address'])
                                                with tag('afi-safis'):
                                                    with tag('afi-safi', 'xmlns:oc-bgp-types="http://openconfig.net/yang/bgp-types"'):
                                                        with tag('afi-safi-name'): text('oc-bgp-types:IPV4_UNICAST')
                                                        with tag('enabled'): text('true')
                                                with tag('config'):
                                                    with tag('neighbor-address'): text(neighbor['ip_address'])
                                                    with tag('enabled'): text('true')
                                                    with tag('peer-as'): text(parameters['as'])
                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'])
@@ -177,6 +194,9 @@ def associate_If_to_NI(parameters, DEL):
        else:
            with tag('network-instance'):
                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:',parameters['type'])
                with tag('interfaces'):
                    with tag('interface'):
                        with tag('id'):text(parameters['id'])
@@ -315,7 +335,7 @@ def create_table_conns(parameters,DEL):
                    with tag('table-connection','xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="delete"'):
                      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['dst_protocol'])     
                      with tag('address-family', 'xmlns:oc-types="http://openconfig.net/yang/openconfig-types"'):text('oc-types:',parameters['address_family'])     
            else:
                with tag('table-connections'):
                    with tag('table-connection'):
@@ -326,6 +346,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'])    
                        # 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(
+4 −4
Changes for src/device/service/drivers/openconfig/templates/VPN/Routing_policy.py: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -133,14 +133,14 @@ data_2 = {'ext_community_member' : '65001:101',
            'ext_community_set_name'    : 'set_srv_101_a'}

print('\nRouting Policy Statement - CREATE\n')
print(rp_statement(data_1, False))
print(create_rp_statement(data_1, False))
print('\nRouting Policy Statement - DELETE\n')
print(rp_statement(data_1, True))
print(create_rp_statement(data_1, True))

print('\nRouting Policy Defined Set - CREATE\n')
print(rp_defined_set(data_2, False))
print(create_rp_def(data_2, False))
print('\nRouting Policy Defined Set - DELETE\n')
print(rp_defined_set(data_2, True))
print(create_rp_def(data_2, True))
'''

'''
+15 −13
Changes for src/device/service/drivers/openconfig/templates/interface/subinterface/edit_config.xml: 15 added lines, 13 removed lines.
Original line number Diff line number Diff line
<interfaces xmlns="http://openconfig.net/yang/interfaces" 
            xmlns:oc-ip="http://openconfig.net/yang/interfaces/ip" >
<interfaces xmlns="http://openconfig.net/yang/interfaces">
    <interface{% if operation is defined %} xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="{{operation}}"{% endif %}>
        <name>{{name}}</name>
        {% if operation is defined and operation != 'delete' %}
@@ -31,17 +30,20 @@
                </vlan>
                {% endif %}
                {% if address_ip is defined %}
                <oc-ip:ipv4>
                    <oc-ip:addresses>
                        <oc-ip:address>
                            <oc-ip:ip>{{address_ip}}</oc-ip:ip>
                            <oc-ip:config>
                                <oc-ip:ip>{{address_ip}}</oc-ip:ip>
                                <oc-ip:prefix-length>{{address_prefix}}</oc-ip:prefix-length>
                            </oc-ip:config>
                        </oc-ip:address>
                    </oc-ip:addresses>
                </oc-ip:ipv4>
                <ipv4 xmlns="http://openconfig.net/yang/interfaces/ip">
                    <config>
                        {% if mtu is defined %}<mtu>{{mtu}}</mtu>{% endif%}
                    </config>
                    <addresses>
                        <address>
                            <ip>{{address_ip}}</ip>
                            <config>
                                <ip>{{address_ip}}</ip>
                                <prefix-length>{{address_prefix}}</prefix-length>
                            </config>
                        </address>
                    </addresses>
                </ipv4>
                {% endif %}
            </subinterface>
        </subinterfaces>
Loading
Loading