diff options
Diffstat (limited to 'resources/libraries/python/topology.py')
-rw-r--r-- | resources/libraries/python/topology.py | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/resources/libraries/python/topology.py b/resources/libraries/python/topology.py index e2c069fc98..75542ad070 100644 --- a/resources/libraries/python/topology.py +++ b/resources/libraries/python/topology.py @@ -257,6 +257,7 @@ class Topology(object): format(ifc, if_mac)) ifc['name'] = interface_dict["interface_name"] ifc['vpp_sw_index'] = interface_dict["sw_if_index"] + ifc['mtu'] = interface_dict["mtu"] def update_vpp_interface_data_on_node(self, node): """Update vpp generated interface data for a given node in DICT__nodes @@ -347,14 +348,31 @@ class Topology(object): """ for port in node['interfaces'].values(): port_name = port.get('name') - if port_name is None: - continue if port_name == interface: return port.get('vpp_sw_index') return None @staticmethod + def get_interface_mtu(node, interface): + """Get interface MTU. + + Returns physical layer MTU (max. size of Ethernet frame). + :param node: Node to get interface MTU on. + :param interface: Interface name. + :type node: dict + :type interface: str + :return: MTU or None if not found. + :rtype: int + """ + for port in node['interfaces'].values(): + port_name = port.get('name') + if port_name == interface: + return port.get('mtu') + + return None + + @staticmethod def get_interface_mac_by_port_key(node, port_key): """Get MAC address for the interface based on port key. @@ -382,8 +400,6 @@ class Topology(object): """ for port in node['interfaces'].values(): port_name = port.get('name') - if port_name is None: - continue if port_name == interface: return port.get('mac_address') |