Skip to content

Commit

Permalink
[sonic-yang] Backlinks are none when there is 0 backlinks (#8187)
Browse files Browse the repository at this point in the history
Backlinks are none when there is 0 backlinks. without this change backlinks.number() 
throws an exception when backlinks==None.
  • Loading branch information
ghooo authored Jul 16, 2021
1 parent 604becd commit 62d3c24
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/sonic-yang-mgmt/sonic_yang.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def find_data_dependencies(self, data_xpath):

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():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 62d3c24

Please sign in to comment.