diff options
author | Peter Mikus <pmikus@cisco.com> | 2017-09-22 14:59:40 +0200 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2017-10-12 08:39:16 +0000 |
commit | 9a261ea61549fc6a5c23369d2e236b002dc35038 (patch) | |
tree | 8004f366007d3ee0210bbf099b71491bb412fe88 /resources/libraries/python/InterfaceUtil.py | |
parent | f2573eccd38609fbc3d44f1fb9c706d08e50d49c (diff) |
CSIT-748 vnf-agent integration
CSIT-773 Implement RF keywords for k8s
- Implementation of Test Suite Setup for Ligato vnf-agent testing
- Implementation of KubernetesUtil for controlling kubectl
- Yaml templates for L2XC topology with 1cswitch and 1cnf
- Yaml templates for L2BD topology with 1cswitch and 1cnf
- ligato bootstrap script for creating vnf-agent image
Change-Id: Iebefde0eb984a27a0afcdf29fe549ca4edf8a61e
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries/python/InterfaceUtil.py')
-rw-r--r-- | resources/libraries/python/InterfaceUtil.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index 71d36c1c9d..795bb52933 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -450,6 +450,47 @@ class InterfaceUtil(object): interface_dump_json) @staticmethod + def update_nic_interface_names(node): + """Update interface names based on nic type and PCI address. + + This method updates interface names in the same format as VPP does. + + :param node: Node dictionary. + :type node: dict + """ + for ifc in node['interfaces'].values(): + if_pci = ifc['pci_address'].replace('.', ':').split(':') + bus = '{:x}'.format(int(if_pci[1], 16)) + dev = '{:x}'.format(int(if_pci[2], 16)) + fun = '{:x}'.format(int(if_pci[3], 16)) + loc = '{bus}/{dev}/{fun}'.format(bus=bus, dev=dev, fun=fun) + if ifc['model'] == 'Intel-XL710': + ifc['name'] = 'FortyGigabitEthernet{loc}'.format(loc=loc) + elif ifc['model'] == 'Intel-X710': + ifc['name'] = 'TenGigabitEthernet{loc}'.format(loc=loc) + elif ifc['model'] == 'Intel-X520-DA2': + ifc['name'] = 'TenGigabitEthernet{loc}'.format(loc=loc) + elif ifc['model'] == 'Cisco-VIC-1385': + ifc['name'] = 'FortyGigabitEthernet{loc}'.format(loc=loc) + elif ifc['model'] == 'Cisco-VIC-1227': + ifc['name'] = 'TenGigabitEthernet{loc}'.format(loc=loc) + else: + ifc['name'] = 'UnknownEthernet{loc}'.format(loc=loc) + + @staticmethod + def update_nic_interface_names_on_all_duts(nodes): + """Update interface names based on nic type and PCI address on all DUTs. + + This method updates interface names in the same format as VPP does. + + :param nodes: Topology nodes. + :type nodes: dict + """ + for node in nodes.values(): + if node['type'] == NodeType.DUT: + InterfaceUtil.update_nic_interface_names(node) + + @staticmethod def update_tg_interface_data_on_node(node): """Update interface name for TG/linux node in DICT__nodes. |