[sonic-yang] Backlinks are none when there is 0 backlinks (#8187)

Backlinks are none when there is 0 backlinks. without this change backlinks.number() 
throws an exception when backlinks==None.
This commit is contained in:
Mohamed Ghoneim 2021-07-16 07:40:27 -07:00 committed by GitHub
parent 604becdd5c
commit 62d3c245b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -526,7 +526,7 @@ class SonicYang(SonicYangExtMixin):
schema_node = ly.Schema_Node_Leaf(data_node.schema())
backlinks = schema_node.backlinks()
if backlinks.number() > 0:
if backlinks is not None and backlinks.number() > 0:
for link in backlinks.schema():
node_set = node.find_path(link.path())
for data_set in node_set.data():

View File

@ -59,10 +59,12 @@
"dependencies":[
{"xpath":"/test-port:port/PORT/PORT_LIST[port_name='Ethernet8']/port_name",
"dependencies":
["/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"]}
"dependencies":
["/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"]},
{"xpath":"/test-port:port/PORT/PORT_LIST[port_name='Ethernet8']/alias",
"dependencies":[]}
],
"schema_dependencies":[
{"xpath":"/test-port:port/test-port:PORT/test-port:PORT_LIST/test-port:port_name",