Skip to content

Commit

Permalink
[sonic-yang-models]: fix unit test failure
Browse files Browse the repository at this point in the history
it is not quite understood why the unit test suddenly failed as below.
but 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 committed Apr 27, 2021
1 parent 5f435f2 commit 69f26e5
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 69f26e5

Please sign in to comment.