Skip to content

Commit

Permalink
Do not get internal interfaces when getting all interfaces
Browse files Browse the repository at this point in the history
This is a regression from 2024.08
  • Loading branch information
mattiaswal committed Oct 1, 2024
1 parent 808a04f commit 6dae6b6
Show file tree
Hide file tree
Showing 2 changed files with 624 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/statd/python/yanger/yanger.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ def iface_is_dsa(iface_in):
return False
return True

def iface_is_internal(iface_in):
return iface_in.get("group") != "internal"

def get_vpd_vendor_extensions(data):
vendor_extensions = []
Expand Down Expand Up @@ -587,7 +589,6 @@ def get_brport_multicast(ifname):

return multicast


def add_ip_link(ifname, iface_out):
"""Fetch interface link information from kernel"""
data = run_json_cmd(['ip', '-s', '-d', '-j', 'link', 'show', 'dev', ifname],
Expand Down Expand Up @@ -937,9 +938,10 @@ def main():
iface_data = get_iface_data(args.param)
yang_data['ietf-interfaces:interfaces']['interface'].append(iface_data)
else:
ifnames = os.listdir('/sys/class/net/')
for ifname in ifnames:
iface_data = get_iface_data(ifname)
ifaces = run_json_cmd(['ip', '-j', 'link', 'show'],
"ip-link-show.json")
for iface in [x for x in ifaces if not iface_is_internal(x)]:
iface_data = get_iface_data(iface["ifname"])
yang_data['ietf-interfaces:interfaces']['interface'].append(iface_data)

elif args.model == 'ietf-routing':
Expand Down
Loading

0 comments on commit 6dae6b6

Please sign in to comment.