Skip to content
New issue

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

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

Already on GitHub? # to your account

[setup.py]: Build infrastructure files for sonic_yang_mgmt Package. #6

Merged
merged 3 commits into from
Nov 5, 2019

Conversation

praveen-li
Copy link
Collaborator

@praveen-li praveen-li commented Oct 28, 2019

- 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

Adding Latest logs with 1.0.73:

 11 ----------------------------------------------------------------------
 12 Ran 0 tests in 0.000s
 13
 14 OK
 15 running bdist_wheel
 16 running build
 17 running build_py
 18 Selecting previously unselected package libyang.
 19 (Reading database ... 160945 files and directories currently installed.)
 20 Preparing to unpack .../libyang_1.0.73_amd64.deb ...
 21 Unpacking libyang (1.0.73) ...
 22 Setting up libyang (1.0.73) ...
 23 Processing triggers for libc-bin (2.24-11+deb9u4) ...
 24 Processing triggers for man-db (2.7.6.1-2) ...
 25 Selecting previously unselected package libyang-cpp.
 26 (Reading database ... 160962 files and directories currently installed.)
 27 Preparing to unpack .../libyang-cpp_1.0.73_amd64.deb ...
 28 Unpacking libyang-cpp (1.0.73) ...
 29 Setting up libyang-cpp (1.0.73) ...
 30 Processing triggers for libc-bin (2.24-11+deb9u4) ...
 31 (Reading database ... 160967 files and directories currently installed.)
 32 Preparing to unpack .../python2-yang_1.0.73_amd64.deb ...
 33 Unpacking python2-yang (1.0.73) over (0.16.105-1) ...
 34 Setting up python2-yang (1.0.73) ...
 35 INFO:YANG-TEST:module: sonic-vlan is loaded successfully
 36 ERROR:YANG-TEST:Could not get module: sonic-head
 37 INFO:YANG-TEST:module: sonic-portchannel is loaded successfully
 38 INFO:YANG-TEST:module: sonic-acl is loaded successfully
 39 ERROR:YANG-TEST:Could not get module: sonic-port
 40 INFO:YANG-TEST:module: sonic-interface is loaded successfully
 41 INFO:YANG-TEST:

- Description for the changelog

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

Adding sonic_yang_mgmt package build with Sonic build infrastructure.
Build steps including testing for yang models.[]:
@zhenggen-xu zhenggen-xu merged commit 7a373c8 into zhenggen-xu:sonic-cfg-mgmt Nov 5, 2019
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
#### 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 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
zhenggen-xu pushed a commit that referenced this pull request May 24, 2024
Why I did it
Advance dhcpmon to a3c5381 in 202305 branch.

a3c5381 - (HEAD, origin/master, origin/HEAD, master) Merge pull request src: Add libnl3 build.sh script #11 from jcaiMR/dev/jcai_fix_err_log (11 days ago) [StormLiangMS]
c5ef7e7 - Change common_libs dependencies from buster to bullseye (Updating docker-orchagent/syncd Dockerfile and start.sh #9)
824a144 - replace atoi with strtol (Rename hostname #6) (10 weeks ago) [Mai Bui]
32c0c3f - Fix libswsscommon package installation for non-amd64 (README.md leaves out docker-database #7) (10 weeks ago) [Saikrishna Arcot]
Work item tracking
Microsoft ADO (25048723):
How I did it
How to verify it
Run test_dhcp_relay.py, no failure
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants