From f82637a701aa4ba22d3b4aab53cf607fd3d9d651 Mon Sep 17 00:00:00 2001 From: Praveen Chaudhary Date: Fri, 8 May 2020 16:12:40 -0700 Subject: [PATCH] [tests/libyang-python-tests]: Changing yang models to generic and removing reference to sonic. Changes: 1.) To avoid confusion, Changing yang models to generic and removing reference to sonic 2.) Additing Relative path whenever needed. --- ...onic_config_data.json => config_data.json} | 42 ++--- .../config_data_merge.json | 154 +++++++++++++++ .../{test-sonic-acl.yang => test-acl.yang} | 28 ++- .../{test-sonic-head.yang => test-head.yang} | 14 +- ...nic-interface.yang => test-interface.yang} | 18 +- .../{test-sonic-port.yang => test-port.yang} | 18 +- ...portchannel.yang => test-portchannel.yang} | 22 +-- .../{test-sonic-vlan.yang => test-vlan.yang} | 30 +-- .../sonic_config_data_merge.json | 177 ------------------ .../libyang-python-tests/test_SonicYang.json | 177 +++++++++--------- .../libyang-python-tests/test_sonic_yang.py | 6 +- 11 files changed, 300 insertions(+), 386 deletions(-) rename src/sonic-yang-mgmt/tests/libyang-python-tests/{sonic_config_data.json => config_data.json} (87%) create mode 100644 src/sonic-yang-mgmt/tests/libyang-python-tests/config_data_merge.json rename src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/{test-sonic-acl.yang => test-acl.yang} (87%) rename src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/{test-sonic-head.yang => test-head.yang} (83%) rename src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/{test-sonic-interface.yang => test-interface.yang} (74%) rename src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/{test-sonic-port.yang => test-port.yang} (74%) rename src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/{test-sonic-portchannel.yang => test-portchannel.yang} (69%) rename src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/{test-sonic-vlan.yang => test-vlan.yang} (79%) delete mode 100644 src/sonic-yang-mgmt/tests/libyang-python-tests/sonic_config_data_merge.json diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/sonic_config_data.json b/src/sonic-yang-mgmt/tests/libyang-python-tests/config_data.json similarity index 87% rename from src/sonic-yang-mgmt/tests/libyang-python-tests/sonic_config_data.json rename to src/sonic-yang-mgmt/tests/libyang-python-tests/config_data.json index 35857fd6609c..8a4eaed176d2 100644 --- a/src/sonic-yang-mgmt/tests/libyang-python-tests/sonic_config_data.json +++ b/src/sonic-yang-mgmt/tests/libyang-python-tests/config_data.json @@ -1,6 +1,6 @@ { - "test-sonic-vlan:sonic-vlan": { - "test-sonic-vlan:VLAN_INTERFACE": { + "test-vlan:vlan": { + "test-vlan:VLAN_INTERFACE": { "VLAN_INTERFACE_LIST": [{ "vlanid": 111, "ip-prefix": "2000:f500:45:6709::1/64", @@ -40,7 +40,7 @@ ] }, - "test-sonic-vlan:VLAN": { + "test-vlan:VLAN": { "VLAN_LIST": [{ "vlanid": 111, "description": "server_vlan", @@ -48,18 +48,7 @@ "10.1.7.116" ], "mtu": "9216", - "admin_status": "up", - "members": [ - "Ethernet8", - "Ethernet3", - "Ethernet0", - "Ethernet1", - "Ethernet6", - "Ethernet4", - "Ethernet5", - "Ethernet9", - "Ethernet2" - ] + "admin_status": "up" }, { "vlanid": 555, @@ -68,17 +57,12 @@ "10.1.7.116" ], "mtu": "9216", - "admin_status": "up", - "members": [ - "Ethernet9", - "Ethernet2", - "Ethernet8" - ] + "admin_status": "up" } ] }, - "test-sonic-vlan:VLAN_MEMBER": { + "test-vlan:VLAN_MEMBER": { "VLAN_MEMBER_LIST": [{ "vlanid": 111, "port": "Ethernet0", @@ -117,8 +101,8 @@ ] } }, - "test-sonic-port:sonic-port": { - "test-sonic-port:PORT": { + "test-port:port": { + "test-port:PORT": { "PORT_LIST": [{ "port_name": "Ethernet0", "alias": "eth0", @@ -203,8 +187,8 @@ } }, - "test-sonic-acl:sonic-acl": { - "test-sonic-acl:ACL_RULE": { + "test-acl:acl": { + "test-acl:ACL_RULE": { "ACL_RULE_LIST": [{ "ACL_TABLE_NAME": "PACL-V4", "RULE_NAME": "Rule_20", @@ -237,7 +221,7 @@ ] }, - "test-sonic-acl:ACL_TABLE": { + "test-acl:ACL_TABLE": { "ACL_TABLE_LIST": [{ "ACL_TABLE_NAME": "PACL-V6", "policy_desc": "Filter IPv6", @@ -256,8 +240,8 @@ } }, - "test-sonic-interface:sonic-interface": { - "test-sonic-interface:INTERFACE": { + "test-interface:interface": { + "test-interface:INTERFACE": { "INTERFACE_LIST": [{ "interface": "Ethernet8", "ip-prefix": "10.1.1.65/26", diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/config_data_merge.json b/src/sonic-yang-mgmt/tests/libyang-python-tests/config_data_merge.json new file mode 100644 index 000000000000..73838a157c4a --- /dev/null +++ b/src/sonic-yang-mgmt/tests/libyang-python-tests/config_data_merge.json @@ -0,0 +1,154 @@ +{ + "test-vlan:vlan": { + "test-vlan:VLAN_INTERFACE": { + "VLAN_INTERFACE_LIST": [{ + "vlanid": 111, + "ip-prefix": "2000:f500:45:6709::1/64", + "scope": "global", + "family": "IPv6" + }, + { + "vlanid": 111, + "ip-prefix": "10.1.1.64/26", + "scope": "global", + "family": "IPv4" + }, + { + "vlanid": 200, + "ip-prefix": "2000:f500:45:6708::1/64", + "scope": "global", + "family": "IPv6" + }, + { + "vlanid": 200, + "ip-prefix": "2000:f500:45:6709::1/64", + "scope": "global", + "family": "IPv6" + } + ] + }, + + "test-vlan:VLAN": { + "VLAN_LIST": [{ + "vlanid": 200, + "description": "server_vlan", + "dhcp_servers": [ + "10.1.72.116" + ], + "mtu": "9216", + "admin_status": "up" + }, + { + "vlanid": 111, + "description": "server_vlan", + "dhcp_servers": [ + "10.1.72.116" + ], + "mtu": "9216", + "admin_status": "up" + } + ] + }, + + "test-vlan:VLAN_MEMBER": { + "VLAN_MEMBER_LIST": [{ + "vlanid": 200, + "port": "Ethernet0", + "tagging_mode": "tagged" + }] + } + }, + "test-port:port": { + "test-port:PORT": { + "PORT_LIST": [{ + "port_name": "Ethernet0", + "alias": "eth0", + "description": "Ethernet0", + "speed": 25000, + "mtu": 9000, + "admin_status": "up" + }, + { + "port_name": "Ethernet1", + "alias": "eth1", + "description": "Ethernet1", + "speed": 25000, + "mtu": 9000, + "admin_status": "up" + }, + { + "port_name": "Ethernet2", + "alias": "eth2", + "description": "Ethernet2", + "speed": 25000, + "mtu": 9000, + "admin_status": "up" + }, + { + "port_name": "Ethernet3", + "alias": "eth2", + "description": "Ethernet3", + "speed": 25000, + "mtu": 9000, + "admin_status": "up" + }, + { + "port_name": "Ethernet4", + "alias": "eth4", + "description": "Ethernet4", + "speed": 25000, + "mtu": 9000, + "admin_status": "up" + }, + { + "port_name": "Ethernet5", + "alias": "eth5", + "description": "Ethernet5", + "speed": 25000, + "mtu": 9000, + "admin_status": "up" + }, + { + "port_name": "Ethernet6", + "alias": "eth6", + "description": "Ethernet6", + "speed": 25000, + "mtu": 9000, + "admin_status": "up" + }, + { + "port_name": "Ethernet7", + "alias": "eth7", + "description": "Ethernet7", + "speed": 25000, + "mtu": 9000, + "admin_status": "up" + }, + { + "port_name": "Ethernet8", + "alias": "eth8", + "description": "Ethernet8", + "speed": 25000, + "mtu": 9000, + "admin_status": "up" + }, + { + "port_name": "Ethernet9", + "alias": "eth9", + "description": "Ethernet9", + "speed": 25000, + "mtu": 9000, + "admin_status": "up" + }, + { + "port_name": "Ethernet10", + "alias": "eth10", + "description": "Ethernet10", + "speed": 25000, + "mtu": 9000, + "admin_status": "up" + } + ] + } + } +} diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-acl.yang b/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-acl.yang similarity index 87% rename from src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-acl.yang rename to src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-acl.yang index 79f2cdded177..0d7d93a1429a 100644 --- a/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-acl.yang +++ b/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-acl.yang @@ -1,8 +1,8 @@ -module test-sonic-acl { +module test-acl { yang-version 1.1; - namespace "http://github.com/Azure/sonic-acl"; + namespace "http://github.com/Azure/acl"; prefix acl; import ietf-yang-types { @@ -13,32 +13,26 @@ module test-sonic-acl { prefix inet; } - import test-sonic-head { + import test-head { prefix head; revision-date 2019-07-01; } - import test-sonic-port { + import test-port { prefix port; revision-date 2019-07-01; } - import test-sonic-portchannel { + import test-portchannel { prefix lag; revision-date 2019-07-01; } - organization "Linkedin Corporation"; - - contact "lnos_coders@linkedin.com"; - - description "ACL YANG Module for SONiC OS"; - revision 2019-07-01 { description "First Revision"; } - container sonic-acl { + container acl { container ACL_RULE { @@ -50,7 +44,7 @@ module test-sonic-acl { leaf ACL_TABLE_NAME { type leafref { - path "/acl:sonic-acl/acl:ACL_TABLE/acl:ACL_TABLE_LIST/acl:ACL_TABLE_NAME"; + path "/acl:acl/acl:ACL_TABLE/acl:ACL_TABLE_LIST/acl:ACL_TABLE_NAME"; } } @@ -257,10 +251,10 @@ module test-sonic-acl { /* union of leafref is allowed in YANG 1.1 */ type union { type leafref { - path /port:sonic-port/port:PORT/port:PORT_LIST/port:port_name; + path /port:port/port:PORT/port:PORT_LIST/port:port_name; } type leafref { - path /lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:portchannel_name; + path /lag:portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:portchannel_name; } } } @@ -269,6 +263,6 @@ module test-sonic-acl { } /* end of container ACL_TABLE */ } - /* end of container sonic-acl */ + /* end of container acl */ } -/* end of module sonic-acl */ +/* end of module acl */ diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-head.yang b/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-head.yang similarity index 83% rename from src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-head.yang rename to src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-head.yang index 547ac8ac1cb3..cdb45a3d0d15 100644 --- a/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-head.yang +++ b/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-head.yang @@ -1,18 +1,12 @@ -module test-sonic-head { +module test-head { - namespace "http://sonic-head"; - prefix sonic-head; + namespace "http://head"; + prefix head; - organization "Linkedin Corporation"; - - contact "lnos_coders@linkedin.com"; - - description "Head yang Module for SONiC OS"; - revision 2019-07-01 { description "First Revision"; } - + typedef ip-family { type enumeration { enum IPv4; diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-interface.yang b/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-interface.yang similarity index 74% rename from src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-interface.yang rename to src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-interface.yang index fd573b17707d..2f453ac6e278 100644 --- a/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-interface.yang +++ b/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-interface.yang @@ -1,6 +1,6 @@ -module test-sonic-interface { +module test-interface { - namespace "http://github.com/Azure/sonic-interface"; + namespace "http://github.com/Azure/interface"; prefix intf; import ietf-yang-types { @@ -11,27 +11,21 @@ module test-sonic-interface { prefix inet; } - import test-sonic-head { + import test-head { prefix head; revision-date 2019-07-01; } - import test-sonic-port { + import test-port { prefix port; revision-date 2019-07-01; } - organization "Linkedin Corporation"; - - contact "lnos_coders@linkedin.com"; - - description "INTERFACE yang Module for SONiC OS"; - revision 2019-07-01 { description "First Revision"; } - container sonic-interface { + container interface { container INTERFACE { description "INTERFACE part of config_db.json"; @@ -42,7 +36,7 @@ module test-sonic-interface { leaf interface { type leafref { - path /port:sonic-port/port:PORT/port:PORT_LIST/port:port_name; + path /port:port/port:PORT/port:PORT_LIST/port:port_name; } } diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-port.yang b/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-port.yang similarity index 74% rename from src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-port.yang rename to src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-port.yang index 494205ce4d92..5e2bf68f7914 100644 --- a/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-port.yang +++ b/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-port.yang @@ -1,6 +1,6 @@ -module test-sonic-port{ +module test-port{ - namespace "http://github.com/Azure/sonic-port"; + namespace "http://github.com/Azure/port"; prefix port; import ietf-yang-types { @@ -11,22 +11,16 @@ module test-sonic-port{ prefix inet; } - import test-sonic-head { + import test-head { prefix head; revision-date 2019-07-01; } - organization "Linkedin Corporation"; - - contact "lnos_coders@linkedin.com"; - - description "PORT yang Module for SONiC OS"; - revision 2019-07-01 { description "First Revision"; } - container sonic-port{ + container port{ container PORT { description "PORT part of config_db.json"; @@ -79,6 +73,6 @@ module test-sonic-port{ } /* end of container PORT */ - } /* end of container sonic-port */ + } /* end of container port */ -} /* end of module sonic-port */ +} /* end of module port */ diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-portchannel.yang b/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-portchannel.yang similarity index 69% rename from src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-portchannel.yang rename to src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-portchannel.yang index 9b664c8289f0..2081383aeda8 100644 --- a/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-portchannel.yang +++ b/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-portchannel.yang @@ -1,6 +1,6 @@ -module test-sonic-portchannel { +module test-portchannel { - namespace "http://github.com/Azure/sonic-portchannel"; + namespace "http://github.com/Azure/portchannel"; prefix lag; import ietf-yang-types { @@ -11,27 +11,21 @@ module test-sonic-portchannel { prefix inet; } - import test-sonic-head { + import test-head { prefix head; revision-date 2019-07-01; } - import test-sonic-port { + import test-port { prefix port; revision-date 2019-07-01; } - organization "Linkedin Corporation"; - - contact "lnos_coders@linkedin.com"; - - description "PORTCHANNEL yang Module for SONiC OS"; - revision 2019-07-01 { description "First Revision"; } - container sonic-portchannel { + container portchannel { container PORTCHANNEL { description "PORTCHANNEL part of config_db.json"; @@ -50,7 +44,7 @@ module test-sonic-portchannel { leaf-list members { /* leaf-list members are unique by default */ type leafref { - path /port:sonic-port/port:PORT/port:PORT_LIST/port:port_name; + path /port:port/port:PORT/port:PORT_LIST/port:port_name; } } @@ -80,6 +74,6 @@ module test-sonic-portchannel { } /* end of container PORTCHANNEL */ - } /* end of container sonic-portchannel */ + } /* end of container portchannel */ -} /* end of module sonic-port */ +} /* end of module port */ diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-vlan.yang b/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-vlan.yang similarity index 79% rename from src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-vlan.yang rename to src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-vlan.yang index 227c3c6dbe6b..2ca80607b410 100644 --- a/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-sonic-vlan.yang +++ b/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/test-vlan.yang @@ -1,6 +1,6 @@ -module test-sonic-vlan { +module test-vlan { - namespace "http://github.com/Azure/sonic-vlan"; + namespace "http://github.com/Azure/vlan"; prefix vlan; import ietf-yang-types { @@ -11,27 +11,21 @@ module test-sonic-vlan { prefix inet; } - import test-sonic-head { + import test-head { prefix head; revision-date 2019-07-01; } - import test-sonic-port { + import test-port { prefix port; revision-date 2019-07-01; } - organization "Linkedin Corporation"; - - contact "lnos_coders@linkedin.com"; - - description "VLAN yang Module for SONiC OS"; - revision 2019-07-01 { description "First Revision"; } - container sonic-vlan { + container vlan { container VLAN_INTERFACE { description "VLAN_INTERFACE part of config_db.json"; @@ -109,14 +103,6 @@ module test-sonic-vlan { mandatory true; type head:admin_status; } - - leaf-list members { - /* leaf-list members are unique by default */ - - type leafref { - path /port:sonic-port/port:PORT/port:PORT_LIST/port:port_name; - } - } } /* end of VLAN_LIST */ } @@ -140,7 +126,7 @@ module test-sonic-vlan { /* key elements are mandatory by default */ mandatory true; type leafref { - path /port:sonic-port/port:PORT/port:PORT_LIST/port:port_name; + path /port:port/port:PORT/port:PORT_LIST/port:port_name; } } @@ -153,6 +139,6 @@ module test-sonic-vlan { } /* end of container VLAN_MEMBER */ } - /* end of container sonic-vlan */ + /* end of container vlan */ } -/* end of module sonic-vlan */ +/* end of module vlan */ diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/sonic_config_data_merge.json b/src/sonic-yang-mgmt/tests/libyang-python-tests/sonic_config_data_merge.json deleted file mode 100644 index ae668566d9a3..000000000000 --- a/src/sonic-yang-mgmt/tests/libyang-python-tests/sonic_config_data_merge.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - "test-sonic-vlan:sonic-vlan": { - "test-sonic-vlan:VLAN_INTERFACE": { - "VLAN_INTERFACE_LIST": [{ - "vlanid": 111, - "ip-prefix": "2000:f500:45:6709::1/64", - "scope": "global", - "family": "IPv6" - }, - { - "vlanid": 111, - "ip-prefix": "10.1.1.64/26", - "scope": "global", - "family": "IPv4" - }, - { - "vlanid": 200, - "ip-prefix": "2000:f500:45:6708::1/64", - "scope": "global", - "family": "IPv6" - }, - { - "vlanid": 200, - "ip-prefix": "2000:f500:45:6709::1/64", - "scope": "global", - "family": "IPv6" - } - ] - }, - - "test-sonic-vlan:VLAN": { - "VLAN_LIST": [{ - "vlanid": 200, - "description": "server_vlan", - "dhcp_servers": [ - "10.1.72.116" - ], - "mtu": "9216", - "admin_status": "up", - "members": [ - "Ethernet8", - "Ethernet3", - "Ethernet0", - "Ethernet1", - "Ethernet6", - "Ethernet4", - "Ethernet5", - "Ethernet9", - "Ethernet2" - ] - }, - { - "vlanid": 111, - "description": "server_vlan", - "dhcp_servers": [ - "10.1.72.116" - ], - "mtu": "9216", - "admin_status": "up", - "members": [ - "Ethernet8", - "Ethernet3", - "Ethernet0", - "Ethernet1", - "Ethernet6", - "Ethernet4", - "Ethernet5", - "Ethernet9", - "Ethernet2" - ] - } - ] - }, - - "test-sonic-vlan:VLAN_MEMBER": { - "VLAN_MEMBER_LIST": [{ - "vlanid": 200, - "port": "Ethernet0", - "tagging_mode": "tagged" - } - ] - } - }, - "test-sonic-port:sonic-port": { - "test-sonic-port:PORT": { - "PORT_LIST": [{ - "port_name": "Ethernet0", - "alias": "eth0", - "description": "Ethernet0", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "port_name": "Ethernet1", - "alias": "eth1", - "description": "Ethernet1", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "port_name": "Ethernet2", - "alias": "eth2", - "description": "Ethernet2", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "port_name": "Ethernet3", - "alias": "eth2", - "description": "Ethernet3", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "port_name": "Ethernet4", - "alias": "eth4", - "description": "Ethernet4", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "port_name": "Ethernet5", - "alias": "eth5", - "description": "Ethernet5", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "port_name": "Ethernet6", - "alias": "eth6", - "description": "Ethernet6", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "port_name": "Ethernet7", - "alias": "eth7", - "description": "Ethernet7", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "port_name": "Ethernet8", - "alias": "eth8", - "description": "Ethernet8", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "port_name": "Ethernet9", - "alias": "eth9", - "description": "Ethernet9", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "port_name": "Ethernet10", - "alias": "eth10", - "description": "Ethernet10", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - } - ] - } - } -} diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/test_SonicYang.json b/src/sonic-yang-mgmt/tests/libyang-python-tests/test_SonicYang.json index 5369cd3aaac4..f3e0c46f76b2 100644 --- a/src/sonic-yang-mgmt/tests/libyang-python-tests/test_SonicYang.json +++ b/src/sonic-yang-mgmt/tests/libyang-python-tests/test_SonicYang.json @@ -1,147 +1,144 @@ { - "yang_dir":"/sonic/src/sonic-yang-mgmt/tests/libyang-python-tests/sample-yang-models/", - "data_file":"/sonic/src/sonic-yang-mgmt/tests/libyang-python-tests/sonic_config_data.json", - "data_merge_file":"/sonic/src/sonic-yang-mgmt/tests/libyang-python-tests/sonic_config_data_merge.json", + "yang_dir":"./tests/libyang-python-tests/sample-yang-models/", + "data_file":"./tests/libyang-python-tests/config_data.json", + "data_merge_file":"./tests/libyang-python-tests/config_data_merge.json", "modules":[ - {"file":"test-sonic-head.yang", "module":"test-sonic-head"}, - {"file":"test-sonic-port.yang", "module":"test-sonic-port"}, - {"file":"test-sonic-acl.yang", "module":"test-sonic-acl"}, - {"file":"test-sonic-interface.yang", "module":"test-sonic-interface"}, - {"file":"test-sonic-portchannel.yang", "module":"test-sonic-portchannel"}, - {"file":"test-sonic-vlan.yang", "module":"test-sonic-vlan"} + {"file":"test-head.yang", "module":"test-head"}, + {"file":"test-port.yang", "module":"test-port"}, + {"file":"test-acl.yang", "module":"test-acl"}, + {"file":"test-interface.yang", "module":"test-interface"}, + {"file":"test-portchannel.yang", "module":"test-portchannel"}, + {"file":"test-vlan.yang", "module":"test-vlan"} ], "merged_nodes":[ - {"xpath":"/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet10']/speed", "value":"25000"}, - {"xpath":"/test-sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='200'][ip-prefix='2000:f500:45:6708::/64']/family", + {"xpath":"/test-port:port/PORT/PORT_LIST[port_name='Ethernet10']/speed", "value":"25000"}, + {"xpath":"/test-vlan:vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='200'][ip-prefix='2000:f500:45:6708::/64']/family", "value":"IPv6"} ], "new_nodes":[ - {"xpath":"/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet12']/alias", "value":"Ethernet10_alias"}, - {"xpath":"/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet12']/speed", "value":"5000"}, - {"xpath":"/test-sonic-acl:sonic-acl/ACL_RULE/ACL_RULE_LIST[ACL_TABLE_NAME='PACL-test'][RULE_NAME='rule_20']/RULE_NAME", + {"xpath":"/test-port:port/PORT/PORT_LIST[port_name='Ethernet12']/alias", "value":"Ethernet10_alias"}, + {"xpath":"/test-port:port/PORT/PORT_LIST[port_name='Ethernet12']/speed", "value":"5000"}, + {"xpath":"/test-acl:acl/ACL_RULE/ACL_RULE_LIST[ACL_TABLE_NAME='PACL-test'][RULE_NAME='rule_20']/RULE_NAME", "value":"rule_20"} ], "data_nodes":[ - {"xpath":"/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet9']/alias", "valid":"True"}, - {"xpath":"/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet20']/alias", "valid":"False"}, - {"xpath":"/test-sonic-vlan:sonic-vlan/VLAN_INTERFACE", "valid":"True"}, - {"xpath":"/test-sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST", "valid":"False"}, - {"xpath":"/test-sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='2000:f500:45:6709::/64']", "valid":"True"} + {"xpath":"/test-port:port/PORT/PORT_LIST[port_name='Ethernet9']/alias", "valid":"True"}, + {"xpath":"/test-port:port/PORT/PORT_LIST[port_name='Ethernet20']/alias", "valid":"False"}, + {"xpath":"/test-vlan:vlan/VLAN_INTERFACE", "valid":"True"}, + {"xpath":"/test-vlan:vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST", "valid":"False"}, + {"xpath":"/test-vlan:vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='2000:f500:45:6709::/64']", "valid":"True"} ], "set_nodes":[ - {"xpath":"/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet10']/speed", "value":"10000"}, - {"xpath":"/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet9']/mtu", "value":"1500"}, - {"xpath":"/test-sonic-vlan:sonic-vlan/VLAN/VLAN_LIST[vlanid='111']/description", "value":"server_vlan111"} + {"xpath":"/test-port:port/PORT/PORT_LIST[port_name='Ethernet10']/speed", "value":"10000"}, + {"xpath":"/test-port:port/PORT/PORT_LIST[port_name='Ethernet9']/mtu", "value":"1500"}, + {"xpath":"/test-vlan:vlan/VLAN/VLAN_LIST[vlanid='111']/description", "value":"server_vlan111"} ], "node_values":[ - {"xpath":"/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet9']/speed", "value":"25000"}, - {"xpath":"/test-sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='2000:f500:45:6709::/64']/family", + {"xpath":"/test-port:port/PORT/PORT_LIST[port_name='Ethernet9']/speed", "value":"25000"}, + {"xpath":"/test-vlan:vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='2000:f500:45:6709::/64']/family", "value":"IPv6"} ], "schema_nodes":[ - {"xpath":"/test-sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']/family", - "value":"/test-sonic-vlan:sonic-vlan/test-sonic-vlan:VLAN_INTERFACE/test-sonic-vlan:VLAN_INTERFACE_LIST/test-sonic-vlan:family"}, - {"xpath":"/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet9']/speed", - "value":"/test-sonic-port:sonic-port/test-sonic-port:PORT/test-sonic-port:PORT_LIST/test-sonic-port:speed"} + {"xpath":"/test-vlan:vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']/family", + "value":"/test-vlan:vlan/test-vlan:VLAN_INTERFACE/test-vlan:VLAN_INTERFACE_LIST/test-vlan:family"}, + {"xpath":"/test-port:port/PORT/PORT_LIST[port_name='Ethernet9']/speed", + "value":"/test-port:port/test-port:PORT/test-port:PORT_LIST/test-port:speed"} ], "delete_nodes":[ - {"xpath":"/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet10']/speed", "valid":"False"}, - {"xpath":"/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet9']/mtu", "valid":"True"}, - {"xpath":"/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet20']/mtu", "valid":"False"} + {"xpath":"/test-port:port/PORT/PORT_LIST[port_name='Ethernet10']/speed", "valid":"False"}, + {"xpath":"/test-port:port/PORT/PORT_LIST[port_name='Ethernet9']/mtu", "valid":"True"}, + {"xpath":"/test-port:port/PORT/PORT_LIST[port_name='Ethernet20']/mtu", "valid":"False"} ], "dependencies":[ - {"xpath":"/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet8']/port_name", + {"xpath":"/test-port:port/PORT/PORT_LIST[port_name='Ethernet8']/port_name", "dependencies": - ["/test-sonic-vlan:sonic-vlan/VLAN/VLAN_LIST[vlanid='111']/members[.='Ethernet8']", - "/test-sonic-vlan:sonic-vlan/VLAN/VLAN_LIST[vlanid='555']/members[.='Ethernet8']", - "/test-sonic-acl:sonic-acl/ACL_TABLE/ACL_TABLE_LIST[ACL_TABLE_NAME='PACL-V6']/ports[.='Ethernet8']", - "/test-sonic-interface:sonic-interface/INTERFACE/INTERFACE_LIST[interface='Ethernet8'][ip-prefix='10.1.1.64/26']/interface", - "/test-sonic-interface:sonic-interface/INTERFACE/INTERFACE_LIST[interface='Ethernet8'][ip-prefix='2000:f500:40:a749::/126']/interface"]} + ["/test-acl:acl/ACL_TABLE/ACL_TABLE_LIST[ACL_TABLE_NAME='PACL-V6']/ports[.='Ethernet8']", + "/test-interface:interface/INTERFACE/INTERFACE_LIST[interface='Ethernet8'][ip-prefix='10.1.1.64/26']/interface", + "/test-interface:interface/INTERFACE/INTERFACE_LIST[interface='Ethernet8'][ip-prefix='2000:f500:40:a749::/126']/interface"]} ], "schema_dependencies":[ - {"xpath":"/test-sonic-port:sonic-port/test-sonic-port:PORT/test-sonic-port:PORT_LIST/test-sonic-port:port_name", + {"xpath":"/test-port:port/test-port:PORT/test-port:PORT_LIST/test-port:port_name", "schema_dependencies": - ["/test-sonic-acl:sonic-acl/test-sonic-acl:ACL_TABLE/test-sonic-acl:ACL_TABLE_LIST/test-sonic-acl:ports", - "/test-sonic-portchannel:sonic-portchannel/test-sonic-portchannel:PORTCHANNEL/test-sonic-portchannel:PORTCHANNEL_LIST/test-sonic-portchannel:members", - "/test-sonic-interface:sonic-interface/test-sonic-interface:INTERFACE/test-sonic-interface:INTERFACE_LIST/test-sonic-interface:interface", - "/test-sonic-vlan:sonic-vlan/test-sonic-vlan:VLAN/test-sonic-vlan:VLAN_LIST/test-sonic-vlan:members", - "/test-sonic-vlan:sonic-vlan/test-sonic-vlan:VLAN_MEMBER/test-sonic-vlan:VLAN_MEMBER_LIST/test-sonic-vlan:port"]} + ["/test-acl:acl/test-acl:ACL_TABLE/test-acl:ACL_TABLE_LIST/test-acl:ports", + "/test-portchannel:portchannel/test-portchannel:PORTCHANNEL/test-portchannel:PORTCHANNEL_LIST/test-portchannel:members", + "/test-interface:interface/test-interface:INTERFACE/test-interface:INTERFACE_LIST/test-interface:interface", + "/test-vlan:vlan/test-vlan:VLAN_MEMBER/test-vlan:VLAN_MEMBER_LIST/test-vlan:port"]} ], "members":[ - {"xpath":"/test-sonic-port:sonic-port/PORT/PORT_LIST", + {"xpath":"/test-port:port/PORT/PORT_LIST", "members": - ["/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet0']", - "/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet1']", - "/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet2']", - "/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet3']", - "/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet4']", - "/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet5']", - "/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet6']", - "/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet7']", - "/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet8']", - "/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet9']", - "/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet10']", - "/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet12']"]} + ["/test-port:port/PORT/PORT_LIST[port_name='Ethernet0']", + "/test-port:port/PORT/PORT_LIST[port_name='Ethernet1']", + "/test-port:port/PORT/PORT_LIST[port_name='Ethernet2']", + "/test-port:port/PORT/PORT_LIST[port_name='Ethernet3']", + "/test-port:port/PORT/PORT_LIST[port_name='Ethernet4']", + "/test-port:port/PORT/PORT_LIST[port_name='Ethernet5']", + "/test-port:port/PORT/PORT_LIST[port_name='Ethernet6']", + "/test-port:port/PORT/PORT_LIST[port_name='Ethernet7']", + "/test-port:port/PORT/PORT_LIST[port_name='Ethernet8']", + "/test-port:port/PORT/PORT_LIST[port_name='Ethernet9']", + "/test-port:port/PORT/PORT_LIST[port_name='Ethernet10']", + "/test-port:port/PORT/PORT_LIST[port_name='Ethernet12']"]} ], "parents":[ - {"xpath":"/test-sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='2000:f500:45:6709::/64']/family", - "parent":"/test-sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='2000:f500:45:6709::/64']"}, - {"xpath":"/test-sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']/scope", - "parent":"/test-sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']"}, - {"xpath":"/test-sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']/vlanid", - "parent":"/test-sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']"}, - {"xpath":"/test-sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']/ip-prefix", - "parent":"/test-sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']"}, - {"xpath":"/test-sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']/family", - "parent":"/test-sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']"}, - {"xpath":"/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet9']/speed", - "parent":"/test-sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet9']"} + {"xpath":"/test-vlan:vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='2000:f500:45:6709::/64']/family", + "parent":"/test-vlan:vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='2000:f500:45:6709::/64']"}, + {"xpath":"/test-vlan:vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']/scope", + "parent":"/test-vlan:vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']"}, + {"xpath":"/test-vlan:vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']/vlanid", + "parent":"/test-vlan:vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']"}, + {"xpath":"/test-vlan:vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']/ip-prefix", + "parent":"/test-vlan:vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']"}, + {"xpath":"/test-vlan:vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']/family", + "parent":"/test-vlan:vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='10.1.1.64/26']"}, + {"xpath":"/test-port:port/PORT/PORT_LIST[port_name='Ethernet9']/speed", + "parent":"/test-port:port/PORT/PORT_LIST[port_name='Ethernet9']"} ], "prefix":[ - {"module_name":"test-sonic-head", "module_prefix":"sonic-head"}, - {"module_name":"test-sonic-port", "module_prefix":"port"}, - {"module_name":"test-sonic-acl", "module_prefix":"acl"}, - {"module_name":"test-sonic-interface", "module_prefix":"intf"}, - {"module_name":"test-sonic-portchannel", "module_prefix":"lag"}, - {"module_name":"test-sonic-vlan", "module_prefix":"vlan"} + {"module_name":"test-head", "module_prefix":"head"}, + {"module_name":"test-port", "module_prefix":"port"}, + {"module_name":"test-acl", "module_prefix":"acl"}, + {"module_name":"test-interface", "module_prefix":"intf"}, + {"module_name":"test-portchannel", "module_prefix":"lag"}, + {"module_name":"test-vlan", "module_prefix":"vlan"} ], "data_type":[ - {"xpath":"/test-sonic-port:sonic-port/test-sonic-port:PORT/test-sonic-port:PORT_LIST/test-sonic-port:port_name", "data_type":"LY_TYPE_STRING"}, - {"xpath":"/test-sonic-vlan:sonic-vlan/test-sonic-vlan:VLAN_INTERFACE/test-sonic-vlan:VLAN_INTERFACE_LIST/test-sonic-vlan:vlanid", "data_type":"LY_TYPE_LEAFREF"} + {"xpath":"/test-port:port/test-port:PORT/test-port:PORT_LIST/test-port:port_name", "data_type":"LY_TYPE_STRING"}, + {"xpath":"/test-vlan:vlan/test-vlan:VLAN_INTERFACE/test-vlan:VLAN_INTERFACE_LIST/test-vlan:vlanid", "data_type":"LY_TYPE_LEAFREF"} ], "leafref_type":[ - {"xpath":"/test-sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='2000:f500:45:6709::/64']/vlanid", "data_type":"LY_TYPE_UINT16"}, - {"xpath":"/test-sonic-interface:sonic-interface/INTERFACE/INTERFACE_LIST[interface='Ethernet8'][ip-prefix='2000:f500:40:a749::/126']/interface", "data_type":"LY_TYPE_STRING"}, - {"xpath":"/test-sonic-vlan:sonic-vlan/VLAN_MEMBER/VLAN_MEMBER_LIST[vlanid='111'][port='Ethernet0']/port", "data_type":"LY_TYPE_STRING"}, - {"xpath":"/test-sonic-vlan:sonic-vlan/VLAN_MEMBER/VLAN_MEMBER_LIST[vlanid='111'][port='Ethernet0']/vlanid", "data_type":"LY_TYPE_UINT16"} + {"xpath":"/test-vlan:vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='111'][ip-prefix='2000:f500:45:6709::/64']/vlanid", "data_type":"LY_TYPE_UINT16"}, + {"xpath":"/test-interface:interface/INTERFACE/INTERFACE_LIST[interface='Ethernet8'][ip-prefix='2000:f500:40:a749::/126']/interface", "data_type":"LY_TYPE_STRING"}, + {"xpath":"/test-vlan:vlan/VLAN_MEMBER/VLAN_MEMBER_LIST[vlanid='111'][port='Ethernet0']/port", "data_type":"LY_TYPE_STRING"}, + {"xpath":"/test-vlan:vlan/VLAN_MEMBER/VLAN_MEMBER_LIST[vlanid='111'][port='Ethernet0']/vlanid", "data_type":"LY_TYPE_UINT16"} ], "leafref_type_schema":[ - {"xpath":"/test-sonic-vlan:sonic-vlan/test-sonic-vlan:VLAN_INTERFACE/test-sonic-vlan:VLAN_INTERFACE_LIST/test-sonic-vlan:vlanid", + {"xpath":"/test-vlan:vlan/test-vlan:VLAN_INTERFACE/test-vlan:VLAN_INTERFACE_LIST/test-vlan:vlanid", "data_type":"LY_TYPE_UINT16"}, - {"xpath":"/test-sonic-interface:sonic-interface/test-sonic-interface:INTERFACE/test-sonic-interface:INTERFACE_LIST/test-sonic-interface:interface", + {"xpath":"/test-interface:interface/test-interface:INTERFACE/test-interface:INTERFACE_LIST/test-interface:interface", "data_type":"LY_TYPE_STRING"}, - {"xpath":"/test-sonic-vlan:sonic-vlan/test-sonic-vlan:VLAN_MEMBER/test-sonic-vlan:VLAN_MEMBER_LIST/test-sonic-vlan:port", + {"xpath":"/test-vlan:vlan/test-vlan:VLAN_MEMBER/test-vlan:VLAN_MEMBER_LIST/test-vlan:port", "data_type":"LY_TYPE_STRING"}, - {"xpath":"/test-sonic-vlan:sonic-vlan/test-sonic-vlan:VLAN_MEMBER/test-sonic-vlan:VLAN_MEMBER_LIST/test-sonic-vlan:vlanid", + {"xpath":"/test-vlan:vlan/test-vlan:VLAN_MEMBER/test-vlan:VLAN_MEMBER_LIST/test-vlan:vlanid", "data_type":"LY_TYPE_UINT16"} ], "leafref_path":[ - {"xpath":"/test-sonic-vlan:sonic-vlan/test-sonic-vlan:VLAN_INTERFACE/test-sonic-vlan:VLAN_INTERFACE_LIST/test-sonic-vlan:vlanid", + {"xpath":"/test-vlan:vlan/test-vlan:VLAN_INTERFACE/test-vlan:VLAN_INTERFACE_LIST/test-vlan:vlanid", "leafref_path":"../../../VLAN/VLAN_LIST/vlanid"}, - {"xpath":"/test-sonic-interface:sonic-interface/test-sonic-interface:INTERFACE/test-sonic-interface:INTERFACE_LIST/test-sonic-interface:interface", - "leafref_path":"/test-sonic-port:sonic-port/test-sonic-port:PORT/test-sonic-port:PORT_LIST/test-sonic-port:port_name"}, - {"xpath":"/test-sonic-vlan:sonic-vlan/test-sonic-vlan:VLAN_MEMBER/test-sonic-vlan:VLAN_MEMBER_LIST/test-sonic-vlan:port", - "leafref_path":"/test-sonic-port:sonic-port/test-sonic-port:PORT/test-sonic-port:PORT_LIST/test-sonic-port:port_name"}, - {"xpath":"/test-sonic-vlan:sonic-vlan/test-sonic-vlan:VLAN_MEMBER/test-sonic-vlan:VLAN_MEMBER_LIST/test-sonic-vlan:vlanid", + {"xpath":"/test-interface:interface/test-interface:INTERFACE/test-interface:INTERFACE_LIST/test-interface:interface", + "leafref_path":"/test-port:port/test-port:PORT/test-port:PORT_LIST/test-port:port_name"}, + {"xpath":"/test-vlan:vlan/test-vlan:VLAN_MEMBER/test-vlan:VLAN_MEMBER_LIST/test-vlan:port", + "leafref_path":"/test-port:port/test-port:PORT/test-port:PORT_LIST/test-port:port_name"}, + {"xpath":"/test-vlan:vlan/test-vlan:VLAN_MEMBER/test-vlan:VLAN_MEMBER_LIST/test-vlan:vlanid", "leafref_path":"../../../VLAN/VLAN_LIST/vlanid"} ] } diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py b/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py index 035833e7ca64..8c35893432d6 100644 --- a/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py +++ b/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py @@ -21,7 +21,7 @@ class Test_SonicYang(object): @pytest.fixture(autouse=True, scope='class') def data(self): - test_file = "/sonic/src/sonic-yang-mgmt/tests/libyang-python-tests/test_SonicYang.json" + test_file = "./tests/libyang-python-tests/test_SonicYang.json" data = self.jsonTestParser(test_file) return data @@ -265,8 +265,8 @@ def test_xlate_rev_xlate(self): # In this test, xlation and revXlation is tested with latest Sonic # YANG model. - yang_dir = "/sonic/src/sonic-yang-models/yang-models/" - yang_test_file = "/sonic/src/sonic-yang-models/tests/yang_model_tests/yangTest.json" + yang_dir = "../sonic-yang-models/yang-models/" + yang_test_file = "../sonic-yang-models/tests/yang_model_tests/yangTest.json" jIn = self.readIjsonInput(yang_test_file, 'SAMPLE_CONFIG_DB_JSON') # load yang models syc = sy.sonic_yang(yang_dir)