Skip to content

Commit

Permalink
[sonic-yang-models]: fix unit test failure (sonic-net#7436)
Browse files Browse the repository at this point in the history
https://github.com/mbj4668/pyang/blob/master/pyang/repository.py#L93 throws an exception with pip 21.1

add ietf yang model explicitly to the build process fix the test failure.

tests/test_sonic_yang_models.py .F [ 66%]
tests/yang_model_tests/test_yang_model.py . [100%]
Failed: pyang -f tree ./yang-models/*.yang > ./yang-models/sonic_yang_tree
----------------------------- Captured stderr call -----------------------------
./yang-models/sonic-acl.yang:8: error: module "ietf-inet-types" not found in search path
./yang-models/sonic-device_metadata.yang:8: error: module "ietf-yang-types" not found in search path

Signed-off-by: Guohan Lu <[email protected]>
  • Loading branch information
lguohan authored and raphaelt-nvidia committed May 13, 2021
1 parent 226760d commit f8f0548
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/sonic-yang-models/tests/test_sonic_yang_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ def test_content(response):
def test_generate_yang_tree():

# Generate YANG Tree, see no error in it.
pyang_tree_cmd = "pyang -f tree ./yang-models/*.yang > ./yang-models/sonic_yang_tree"
pyang_tree_cmd = "pyang -Vf tree -p /usr/local/share/yang/modules/ietf ./yang-models/*.yang > ./yang-models/sonic_yang_tree"
if (system(pyang_tree_cmd)):
print("Failed: {}".format(pyang_tree_cmd))
system("pyang --version")
system("env")
system("ls -l /usr/local/share/yang/modules/ietf/")
exit(1)
else:
print("Passed: {}".format(pyang_tree_cmd))
Expand Down

0 comments on commit f8f0548

Please sign in to comment.