Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build sonic yang v1 #5

Closed

Conversation

praveen-li
Copy link
Collaborator

- What I did
[setup.py]: Build infrastructure files for sonic_yang_mgmt Package.

Adding sonic_yang_mgmt package build with Sonic build infrastructure.
Build steps including testing for yang models.

- How I did it
Added Python wheel package build infrastruture.

- How to verify it
Testes build, install and uninstall steps:

Build Logs and testing:
———————————————————————————————————

/sonic/src/sonic-yang-mgmt /sonic
running test
running egg_info
writing sonic_yang_mgmt.egg-info/PKG-INFO
writing top-level names to sonic_yang_mgmt.egg-info/top_level.txt
writing dependency_links to sonic_yang_mgmt.egg-info/dependency_links.txt
reading manifest file 'sonic_yang_mgmt.egg-info/SOURCES.txt'
writing manifest file 'sonic_yang_mgmt.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
running bdist_wheel
running build
running build_py
(Reading database ... 160945 files and directories currently installed.)
Preparing to unpack .../libyang0.16_0.16.105-1_amd64.deb ...
Unpacking libyang0.16 (0.16.105-1) over (0.16.105-1) ...
Setting up libyang0.16 (0.16.105-1) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
(Reading database ... 160945 files and directories currently installed.)
Preparing to unpack .../libyang-cpp0.16_0.16.105-1_amd64.deb ...
Unpacking libyang-cpp0.16 (0.16.105-1) over (0.16.105-1) ...
Setting up libyang-cpp0.16 (0.16.105-1) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
(Reading database ... 160945 files and directories currently installed.)
Preparing to unpack .../python2-yang_0.16.105-1_amd64.deb ...
Unpacking python2-yang (0.16.105-1) over (0.16.105-1) ...
Setting up python2-yang (0.16.105-1) ...
INFO:YANG-TEST:module: sonic-vlan is loaded successfully
ERROR:YANG-TEST:Could not get module: sonic-head
INFO:YANG-TEST:module: sonic-portchannel is loaded successfully
INFO:YANG-TEST:module: sonic-acl is loaded successfully
ERROR:YANG-TEST:Could not get module: sonic-port
INFO:YANG-TEST:module: sonic-interface is loaded successfully
INFO:YANG-TEST:
------------------- Test 1: Configure a member port in VLAN_MEMBER table which does not exist.---------------------
libyang[0]: Invalid JSON data (missing top level begin-object).
INFO:YANG-TEST:Configure a member port in VLAN_MEMBER table which does not exist. Failed <<<<<<<<<<[*** bug in yangModelTest.py, I will fix it with another PR ***]

INFO:YANG-TEST:
------------------- Test 2: Configure non-existing ACL_TABLE in ACL_RULE.---------------------
libyang[0]: Leafref "/sonic-acl:sonic-acl/sonic-acl:ACL_TABLE/sonic-acl:ACL_TABLE_LIST/sonic-acl:ACL_TABLE_NAME" of value "NOT-EXIST" points to a non-existing leaf. (path: /sonic-acl:sonic-acl/ACL_RULE/ACL_RULE_LIST[ACL_TABLE_NAME='NOT-EXIST'][RULE_NAME='Rule_20']/ACL_TABLE_NAME)
INFO:YANG-TEST:Configure non-existing ACL_TABLE in ACL_RULE. Passed

INFO:YANG-TEST:
------------------- Test 3: Configure IP_TYPE as ARP and ICMPV6_CODE in ACL_RULE.---------------------
libyang[0]: When condition "boolean(IP_TYPE[.='ANY' or .='IP' or .='IPV6' or .='IPV6ANY'])" not satisfied. (path: /sonic-acl:sonic-acl/ACL_RULE/ACL_RULE_LIST[ACL_TABLE_NAME='NO-NSW-PACL-V4'][RULE_NAME='Rule_40']/ICMPV6_CODE)
INFO:YANG-TEST:Configure IP_TYPE as ARP and ICMPV6_CODE in ACL_RULE. Passed

INFO:YANG-TEST:
------------------- Test 4: Configure IP_TYPE as ipv4any and SRC_IPV6 in ACL_RULE.---------------------
libyang[0]: When condition "boolean(IP_TYPE[.='ANY' or .='IP' or .='IPV6' or .='IPV6ANY'])" not satisfied. (path: /sonic-acl:sonic-acl/ACL_RULE/ACL_RULE_LIST[ACL_TABLE_NAME='NO-NSW-PACL-V4'][RULE_NAME='Rule_20']/SRC_IPV6)
INFO:YANG-TEST:Configure IP_TYPE as ipv4any and SRC_IPV6 in ACL_RULE. Passed

INFO:YANG-TEST:
------------------- Test 5: Configure l4_src_port_range as 99999-99999 in ACL_RULE---------------------
libyang[0]: Value "99999-99999" does not satisfy the constraint "([0-9]{1,4}|[0-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-2][0-9]{2}|[6][5][3][0-5]{2}|[6][5][3][6][0-5])-([0-9]{1,4}|[0-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-2][0-9]{2}|[6][5][3][0-5]{2}|[6][5][3][6][0-5])" (range, length, or pattern). (path: /sonic-acl:sonic-acl/ACL_RULE/ACL_RULE_LIST[ACL_TABLE_NAME='NO-NSW-PACL-V6'][RULE_NAME='Rule_20']/L4_SRC_PORT_RANGE)
INFO:YANG-TEST:Configure l4_src_port_range as 99999-99999 in ACL_RULE Passed

INFO:YANG-TEST:
------------------- Test 6: Configure empty string as ip-prefix in INTERFACE table.---------------------
libyang[0]: Invalid value "" in "ip-prefix" element. (path: /sonic-interface:sonic-interface/INTERFACE/INTERFACE_LIST[interface='Ethernet8'][ip-prefix='']/ip-prefix)
INFO:YANG-TEST:Configure empty string as ip-prefix in INTERFACE table. Passed

INFO:YANG-TEST:
------------------- Test 7: Configure Wrong family with ip-prefix for VLAN_Interface Table---------------------
libyang[0]: Must condition "(contains(../ip-prefix, ':') and current()='IPv6') or                               (contains(../ip-prefix, '.') and current()='IPv4')" not satisfied. (path: /sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='100'][ip-prefix='2a04:5555:66:7777::1/64']/family)
INFO:YANG-TEST:Configure Wrong family with ip-prefix for VLAN_Interface Table Passed

INFO:YANG-TEST:
------------------- Test 8: Configure IP_TYPE as ARP and DST_IPV6 in ACL_RULE.---------------------
libyang[0]: When condition "boolean(IP_TYPE[.='ANY' or .='IP' or .='IPV6' or .='IPV6ANY'])" not satisfied. (path: /sonic-acl:sonic-acl/ACL_RULE/ACL_RULE_LIST[ACL_TABLE_NAME='NO-NS
W-PACL-V6'][RULE_NAME='Rule_20']/DST_IPV6)
INFO:YANG-TEST:Configure IP_TYPE as ARP and DST_IPV6 in ACL_RULE. Passed

INFO:YANG-TEST:
------------------- Test 9: Configure INNER_ETHER_TYPE as 0x080C in ACL_RULE.---------------------
libyang[0]: Value "0x080C" does not satisfy the constraint "(0x88CC|0x8100|0x8915|0x0806|0x0800|0x86DD|0x8847)" (range, length, or pattern). (path: /sonic-acl:sonic-acl/ACL_RULE/ACL_RULE_LIST[ACL_TABLE_NAME='NO-NSW-PACL-V4'][RULE_NAME='Rule_40']/INNER_ETHER_TYPE)
INFO:YANG-TEST:Configure INNER_ETHER_TYPE as 0x080C in ACL_RULE. Passed

INFO:YANG-TEST:
------------------- Test 10: Add dhcp_server which is not in correct ip-prefix format.---------------------
libyang[0]: Invalid value "10.186.72.566" in "dhcp_servers" element. (path: /sonic-vlan:sonic-vlan/VLAN/VLAN_LIST/dhcp_servers[.='10.186.72.566'])
INFO:YANG-TEST:Add dhcp_server which is not in correct ip-prefix format. Passed

INFO:YANG-TEST:
------------------- Test 11: Configure undefined acl_table_type in ACL_TABLE table.---------------------
libyang[0]: Invalid value "LAYER3V4" in "type" element. (path: /sonic-acl:sonic-acl/ACL_TABLE/ACL_TABLE_LIST[ACL_TABLE_NAME='NO-NSW-PACL-V6']/type)
INFO:YANG-TEST:Configure undefined acl_table_type in ACL_TABLE table. Passed

INFO:YANG-TEST:
------------------- Test 12: Configure undefined packet_action in ACL_RULE table.---------------------
libyang[0]: Invalid value "SEND" in "PACKET_ACTION" element. (path: /sonic-acl:sonic-acl/ACL_RULE/ACL_RULE_LIST/PACKET_ACTION)
INFO:YANG-TEST:Configure undefined packet_action in ACL_RULE table. Passed

INFO:YANG-TEST:
------------------- Test 13: Configure wrong value for tagging_mode.---------------------
libyang[0]: Invalid value "non-tagged" in "tagging_mode" element. (path: /sonic-vlan:sonic-vlan/VLAN_MEMBER/VLAN_MEMBER_LIST/tagging_mode)
INFO:YANG-TEST:Configure wrong value for tagging_mode. Passed

INFO:YANG-TEST:
------------------- Test 14: Configure vlan-id in VLAN_MEMBER table which does not exist in VLAN  table.---------------------
libyang[0]: Leafref "../../../VLAN/VLAN_LIST/vlanid" of value "200" points to a non-existing leaf. (path: /sonic-vlan:sonic-vlan/VLAN_MEMBER/VLAN_MEMBER_LIST[vlanid='200'][port='Ethernet0']/vlanid)
libyang[0]: Leafref "../../../VLAN/VLAN_LIST/vlanid" of value "200" points to a non-existing leaf. (path: /sonic-vlan:sonic-vlan/VLAN_MEMBER/VLAN_MEMBER_LIST[vlanid='200'][port='Ethernet0']/vlanid)
INFO:YANG-TEST:Configure vlan-id in VLAN_MEMBER table which does not exist in VLAN  table. Passed

INFO:YANG-TEST:All Test Passed
../../target/debs/stretch/libyang0.16_0.16.105-1_amd64.deb installtion failed
../../target/debs/stretch/libyang-cpp0.16_0.16.105-1_amd64.deb installtion failed
../../target/debs/stretch/python2-yang_0.16.105-1_amd64.deb installtion failed
YANG Tests passed

creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/tests
copying tests/__init__.py -> build/lib.linux-x86_64-2.7/tests
copying tests/test_sonic_yang_mgmt.py -> build/lib.linux-x86_64-2.7/tests
running egg_info
writing sonic_yang_mgmt.egg-info/PKG-INFO
writing top-level names to sonic_yang_mgmt.egg-info/top_level.txt
writing dependency_links to sonic_yang_mgmt.egg-info/dependency_links.txt
reading manifest file 'sonic_yang_mgmt.egg-info/SOURCES.txt'
writing manifest file 'sonic_yang_mgmt.egg-info/SOURCES.txt'
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/tests
copying build/lib.linux-x86_64-2.7/tests/__init__.py -> build/bdist.linux-x86_64/wheel/tests
copying build/lib.linux-x86_64-2.7/tests/test_sonic_yang_mgmt.py -> build/bdist.linux-x86_64/wheel/tests
running install_data
creating build/bdist.linux-x86_64/wheel/sonic_yang_mgmt-1.0.data
creating build/bdist.linux-x86_64/wheel/sonic_yang_mgmt-1.0.data/data
creating build/bdist.linux-x86_64/wheel/sonic_yang_mgmt-1.0.data/data/yang-models
copying ./yang-models/sonic-head.yang -> build/bdist.linux-x86_64/wheel/sonic_yang_mgmt-1.0.data/data/yang-models
copying ./yang-models/sonic-acl.yang -> build/bdist.linux-x86_64/wheel/sonic_yang_mgmt-1.0.data/data/yang-models
copying ./yang-models/sonic-interface.yang -> build/bdist.linux-x86_64/wheel/sonic_yang_mgmt-1.0.data/data/yang-models
copying ./yang-models/sonic-port.yang -> build/bdist.linux-x86_64/wheel/sonic_yang_mgmt-1.0.data/data/yang-models
copying ./yang-models/sonic-portchannel.yang -> build/bdist.linux-x86_64/wheel/sonic_yang_mgmt-1.0.data/data/yang-models
copying ./yang-models/sonic-vlan.yang -> build/bdist.linux-x86_64/wheel/sonic_yang_mgmt-1.0.data/data/yang-models
running install_egg_info
Copying sonic_yang_mgmt.egg-info to build/bdist.linux-x86_64/wheel/sonic_yang_mgmt-1.0-py2.7.egg-info
running install_scripts
creating build/bdist.linux-x86_64/wheel/sonic_yang_mgmt-1.0.dist-info/WHEEL
/sonic

Install and uninstall logs on sonic-switch:
———————————————————————————————————

admin@lnos-x1-a-asw02:~$ sudo pip install sonic_yang_mgmt-1.0-py2-none-any.whl
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Processing ./sonic_yang_mgmt-1.0-py2-none-any.whl
Installing collected packages: sonic-yang-mgmt
Successfully installed sonic-yang-mgmt-1.0

admin@lnos-x1-a-asw02:~$ ls -l /usr/local/yang-models/  [***all file size matches with build machine]
total 28
-rw-r--r-- 1 root staff 4959 Oct 28 19:14 sonic-acl.yang
-rw-r--r-- 1 root staff 1386 Oct 28 19:14 sonic-head.yang
-rw-r--r-- 1 root staff 1427 Oct 28 19:14 sonic-interface.yang
-rw-r--r-- 1 root staff 1440 Oct 28 19:14 sonic-portchannel.yang
-rw-r--r-- 1 root staff 1212 Oct 28 19:14 sonic-port.yang
-rw-r--r-- 1 root staff 2804 Oct 28 19:14 sonic-vlan.yang


admin@lnos-x1-a-asw02:~$ sudo pip uninstall  sonic_yang_mgmt
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Uninstalling sonic-yang-mgmt-1.0:
  Would remove:
    /usr/local/lib/python2.7/dist-packages/sonic_yang_mgmt-1.0.dist-info/*
    /usr/local/lib/python2.7/dist-packages/tests/*
    /usr/local/yang-models/sonic-acl.yang
    /usr/local/yang-models/sonic-head.yang
    /usr/local/yang-models/sonic-interface.yang
    /usr/local/yang-models/sonic-port.yang
    /usr/local/yang-models/sonic-portchannel.yang
    /usr/local/yang-models/sonic-vlan.yang
Proceed (y/n)? y
  Successfully uninstalled sonic-yang-mgmt-1.0
admin@lnos-x1-a-asw02:~$

On build machine:

pchaudha@server05:/home/pchaudha/srcCode/sonic_config_mgmt/src/sonic-yang-mgmt$ ls -l yang-models/
total 36
-rw-rw-r-- 1 pchaudha pchaudha 4959 Oct 28 12:12 sonic-acl.yang
-rw-rw-r-- 1 pchaudha pchaudha 1386 Oct  2 21:06 sonic-head.yang
-rw-rw-r-- 1 pchaudha pchaudha 1427 Oct  2 21:06 sonic-interface.yang
-rw-rw-r-- 1 pchaudha pchaudha 1440 Oct  2 21:06 sonic-portchannel.yang
-rw-rw-r-- 1 pchaudha pchaudha 1212 Oct  2 21:06 sonic-port.yang
-rw-rw-r-- 1 pchaudha pchaudha 2804 Oct  2 21:06 sonic-vlan.yang
-rw-rw-r-- 1 pchaudha pchaudha 4379 Oct  2 21:06 Sonic Yang Tree

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

Praveen Chaudhary added 3 commits October 2, 2019 21:10
@praveen-li praveen-li closed this Oct 28, 2019
@praveen-li praveen-li deleted the build_sonic_yang_v1 branch October 28, 2019 20:46
zhenggen-xu added a commit that referenced this pull request Nov 18, 2020
Signed-off-by: Zhenggen Xu <zxu@linkedin.com>

 * src/sonic-platform-common 6a35046...c40f3b9 (1):
   > sfputilbase.py: fix the Python crash upon IO failures (#5)
zhenggen-xu pushed a commit that referenced this pull request Dec 15, 2020
This update brings in the following commits.

86c1108 Enable arm architecture to build in addition to amd64 (#37)
4acb2c3 fix bugs and enhance Transformer (#35)
49e5a22 ygot related enhancements and fixes (#34)
51224de Fix ietf yang search path for cvl schema builds (#32)
3c6cdb3 CVL Changes #8: 'must' and 'when' expression evaluation (#31)
dabf231 CVL Changes #7: 'leafref' evaluation (#28)
6f9535f CVL Changes #6: Customized Xpath Engine integration (#27)
5e2466b DB-Layer fixes/enhancements (#26)
9a27302 CVL Changes #4: Implementation of new CVL APIs (#22)
dbf1093 Translib support for authorization, yang versioning and Delete flag (#21)
80f369e CVL Changes #5: YParser enhancement (#23)
904ce18 CVL Changes #3: Multi-db instance support (#20)
9d24a34 CVL Changes #2:  YValidator infra changes for evaluating xpath expression (#19)
f3fc40f CVL Changes #1: Initial CVL code reorganization and common infra changes (#18)
4922601 Bulk and RPC API support in translib (#16)
1d730df RFC7895 yang module library implementation (#15)
praveen-li pushed a commit to praveen-li/sonic-buildimage that referenced this pull request Aug 9, 2022
…enggen-xu#5)

Also add out of tree pca9548 mux driver to use platform data to mapping i2c bus with front panel port.

Signed-off-by: Jakkapan Jangmuang <jjangmua@celestica.com>

Co-authored-by: Saikrishna Arcot <sarcot@microsoft.com>
praveen-li pushed a commit to praveen-li/sonic-buildimage that referenced this pull request Aug 9, 2022
#### What I did 

[sonic-linkmgrd][master] submodule update

6c6151b Fix unstable unit tests (state change handler wasn't invoked) (zhenggen-xu#8)
2f7dc0a support code diff coverage (zhenggen-xu#5)
83f0002 Force mux state switch to standby if triggered from Cli (zhenggen-xu#6)

signed-off-by: Jing Zhang zhangjing@microsoft.com
praveen-li pushed a commit to praveen-li/sonic-buildimage that referenced this pull request Oct 17, 2022
praveen-li pushed a commit to praveen-li/sonic-buildimage that referenced this pull request Dec 23, 2022
6c6151b Fix unstable unit tests (state change handler wasn't invoked) (zhenggen-xu#8)
2f7dc0a support code diff coverage (zhenggen-xu#5)
83f0002 Force mux state switch to standby if triggered from Cli (zhenggen-xu#6)

signed-off-by: Jing Zhang zhangjing@microsoft.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant