diff --git a/src/statd/python/yanger/yanger.py b/src/statd/python/yanger/yanger.py index cc7d1217..5b67d1cf 100755 --- a/src/statd/python/yanger/yanger.py +++ b/src/statd/python/yanger/yanger.py @@ -899,6 +899,10 @@ def _add_interface(ifname, ip_link_data, ip_addr_data, yang_ifaces): if not ip_link_data or not ip_addr_data: return + # Skip internal interfaces. + if 'group' in ip_link_data and ip_link_data['group'] == "internal": + return + yang_ifaces.append(get_iface_data(ifname, ip_link_data, ip_addr_data)) def add_interface(ifname, yang_ifaces): diff --git a/test/case/cli/system-output/ethtool-dsa0.txt b/test/case/cli/system-output/ethtool-dsa0.txt new file mode 100644 index 00000000..6fb392ba --- /dev/null +++ b/test/case/cli/system-output/ethtool-dsa0.txt @@ -0,0 +1,32 @@ +Settings for dsa0: + Supported ports: [ MII ] + Supported link modes: 10000baseT/Full + 10000baseKX4/Full + 10000baseKR/Full + 10000baseCR/Full + 10000baseSR/Full + 10000baseLR/Full + 10000baseLRM/Full + 10000baseER/Full + Supported pause frame use: Symmetric Receive-only + Supports auto-negotiation: Yes + Supported FEC modes: Not reported + Advertised link modes: 10000baseT/Full + 10000baseKX4/Full + 10000baseKR/Full + 10000baseCR/Full + 10000baseSR/Full + 10000baseLR/Full + 10000baseLRM/Full + 10000baseER/Full + Advertised pause frame use: Symmetric Receive-only + Advertised auto-negotiation: Yes + Advertised FEC modes: Not reported + Speed: 10000Mb/s + Duplex: Full + Auto-negotiation: on + Port: MII + PHYAD: 0 + Transceiver: internal +netlink error: Operation not permitted + Link detected: yes diff --git a/test/case/cli/system-output/ethtool-groups-dsa0.json b/test/case/cli/system-output/ethtool-groups-dsa0.json new file mode 100644 index 00000000..55cd2636 --- /dev/null +++ b/test/case/cli/system-output/ethtool-groups-dsa0.json @@ -0,0 +1,7 @@ +[ { + "ifname": "dsa0", + "eth-phy": {}, + "eth-mac": {}, + "eth-ctrl": {}, + "rmon": {} +} ] diff --git a/test/case/cli/system-output/ip-addr-show.json b/test/case/cli/system-output/ip-addr-show.json index 5ff305f0..04ad3de7 100644 --- a/test/case/cli/system-output/ip-addr-show.json +++ b/test/case/cli/system-output/ip-addr-show.json @@ -1,4 +1,56 @@ [ + { + "ifindex": 2, + "ifname": "dsa0", + "flags": [ + "BROADCAST", + "MULTICAST", + "UP", + "LOWER_UP" + ], + "mtu": 1504, + "qdisc": "mq", + "operstate": "UP", + "group": "internal", + "txqlen": 2048, + "link_type": "ether", + "address": "02:00:de:ad:02:20", + "broadcast": "ff:ff:ff:ff:ff:ff", + "promiscuity": 0, + "allmulti": 0, + "min_mtu": 68, + "max_mtu": 9888, + "num_tx_queues": 8, + "num_rx_queues": 4, + "gso_max_size": 65536, + "gso_max_segs": 300, + "tso_max_size": 65536, + "tso_max_segs": 300, + "gro_max_size": 65536, + "gso_ipv4_max_size": 65536, + "gro_ipv4_max_size": 65536, + "parentbus": "platform", + "parentdev": "f2000000.ethernet", + "addr_info": [], + "stats64": { + "rx": { + "bytes": 1756811, + "packets": 6777, + "errors": 0, + "dropped": 0, + "over_errors": 0, + "multicast": 0 + }, + "tx": { + "bytes": 1849127, + "packets": 7157, + "errors": 0, + "dropped": 0, + "carrier_errors": 0, + "collisions": 0 + } + } + }, { "ifindex": 7, "ifname": "br0", diff --git a/test/case/cli/system-output/ip-link-show.json b/test/case/cli/system-output/ip-link-show.json index 7222f724..3d7b2dee 100644 --- a/test/case/cli/system-output/ip-link-show.json +++ b/test/case/cli/system-output/ip-link-show.json @@ -1,4 +1,57 @@ [ + { + "ifindex": 2, + "ifname": "dsa0", + "flags": [ + "BROADCAST", + "MULTICAST", + "UP", + "LOWER_UP" + ], + "mtu": 1504, + "qdisc": "mq", + "operstate": "UP", + "linkmode": "DEFAULT", + "group": "internal", + "txqlen": 2048, + "link_type": "ether", + "address": "02:00:de:ad:02:20", + "broadcast": "ff:ff:ff:ff:ff:ff", + "promiscuity": 0, + "allmulti": 0, + "min_mtu": 68, + "max_mtu": 9888, + "inet6_addr_gen_mode": "eui64", + "num_tx_queues": 8, + "num_rx_queues": 4, + "gso_max_size": 65536, + "gso_max_segs": 300, + "tso_max_size": 65536, + "tso_max_segs": 300, + "gro_max_size": 65536, + "gso_ipv4_max_size": 65536, + "gro_ipv4_max_size": 65536, + "parentbus": "platform", + "parentdev": "f2000000.ethernet", + "stats64": { + "rx": { + "bytes": 1751876, + "packets": 6757, + "errors": 0, + "dropped": 0, + "over_errors": 0, + "multicast": 0 + }, + "tx": { + "bytes": 1843945, + "packets": 7136, + "errors": 0, + "dropped": 0, + "carrier_errors": 0, + "collisions": 0 + } + } + }, { "ifindex": 7, "ifname": "br0",