From f88a3d9178dfbd73d0479f9aa2f5224e0c89ca1f Mon Sep 17 00:00:00 2001 From: Vratko Polak Date: Wed, 17 Jul 2019 12:40:49 +0200 Subject: Use PapiSocketProvider for most PAPI calls Ticket: CSIT-1541 Ticket: VPP-1722 Ticket: CSIT-1546 + Increase timeout to hide x520 slownes of show hardware detail. - Install sshpass and update ssh client in virl bootstrap. + Added TODOs to remove when CSIT-1546 is fixed. + Enable default socksvr on any startup conf. + Improve OptionString init and repr. - The non-socket executor still kept for stats. + Remove everything unrelated to stats from non-socket executor. - Remove some debug-loooking calls to avoid failures. TODO: Introduce proper parsing to the affected keywords. + Reduce logging from PAPI code to level INFO. - Needs https://gerrit.fd.io/r/20660 to fully work. + Change default values for LocalExecution.run() + Return code check enabled by default. Code is more readable when rc!=0 is allowed explicitly, and the test code will now detect unexpected failures. + Logging disabled by default. Output XML is large already. Important logging can be enabled explicitly. + Restore alphabetical order in common.sh functions. Change-Id: I05882cb6b620ad14638f7404b5ad38c7a5de9e6c Signed-off-by: Vratko Polak --- resources/libraries/python/InterfaceUtil.py | 46 ++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'resources/libraries/python/InterfaceUtil.py') diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index 0b1f06f9bf..6de17d10d9 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -24,7 +24,7 @@ from resources.libraries.python.Constants import Constants from resources.libraries.python.CpuUtils import CpuUtils from resources.libraries.python.DUTSetup import DUTSetup from resources.libraries.python.L2Util import L2Util -from resources.libraries.python.PapiExecutor import PapiExecutor +from resources.libraries.python.PapiExecutor import PapiSocketExecutor from resources.libraries.python.parsers.JsonParser import JsonParser from resources.libraries.python.ssh import SSH, exec_cmd_no_error from resources.libraries.python.topology import NodeType, Topology @@ -138,7 +138,7 @@ class InterfaceUtil(object): host=node['host']) args = dict(sw_if_index=sw_if_index, admin_up_down=admin_up_down) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: papi_exec.add(cmd, **args).get_reply(err_msg) elif node['type'] == NodeType.TG or node['type'] == NodeType.VM: cmd = 'ip link set {ifc} {state}'.format( @@ -210,7 +210,7 @@ class InterfaceUtil(object): args = dict(sw_if_index=sw_if_index, mtu=int(mtu)) try: - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: papi_exec.add(cmd, **args).get_reply(err_msg) except AssertionError as err: # TODO: Make failure tolerance optional. @@ -321,7 +321,7 @@ class InterfaceUtil(object): name_filter='') err_msg = 'Failed to get interface dump on host {host}'.format( host=node['host']) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: details = papi_exec.add(cmd, **args).get_details(err_msg) def process_if_dump(if_dump): @@ -729,7 +729,7 @@ class InterfaceUtil(object): vlan_id=int(vlan)) err_msg = 'Failed to create VLAN sub-interface on host {host}'.format( host=node['host']) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: sw_if_index = papi_exec.add(cmd, **args).get_sw_if_index(err_msg) if_key = Topology.add_new_port(node, 'vlan_subif') @@ -771,7 +771,7 @@ class InterfaceUtil(object): vni=int(vni)) err_msg = 'Failed to create VXLAN tunnel interface on host {host}'.\ format(host=node['host']) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: sw_if_index = papi_exec.add(cmd, **args).get_sw_if_index(err_msg) if_key = Topology.add_new_port(node, 'vxlan_tunnel') @@ -805,7 +805,7 @@ class InterfaceUtil(object): args = dict(sw_if_index=sw_if_index) err_msg = 'Failed to get VXLAN dump on host {host}'.format( host=node['host']) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: details = papi_exec.add(cmd, **args).get_details(err_msg) def process_vxlan_dump(vxlan_dump): @@ -853,7 +853,7 @@ class InterfaceUtil(object): cmd = 'sw_interface_vhost_user_dump' err_msg = 'Failed to get vhost-user dump on host {host}'.format( host=node['host']) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: details = papi_exec.add(cmd).get_details(err_msg) def process_vhost_dump(vhost_dump): @@ -896,7 +896,7 @@ class InterfaceUtil(object): cmd = 'sw_interface_tap_v2_dump' err_msg = 'Failed to get TAP dump on host {host}'.format( host=node['host']) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: details = papi_exec.add(cmd).get_details(err_msg) def process_tap_dump(tap_dump): @@ -972,7 +972,7 @@ class InterfaceUtil(object): inner_vlan_id=int(inner_vlan_id) if inner_vlan_id else 0) err_msg = 'Failed to create sub-interface on host {host}'.format( host=node['host']) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: sw_if_index = papi_exec.add(cmd, **args).get_sw_if_index(err_msg) if_key = Topology.add_new_port(node, 'subinterface') @@ -1007,7 +1007,7 @@ class InterfaceUtil(object): tunnel=tunnel) err_msg = 'Failed to create GRE tunnel interface on host {host}'.format( host=node['host']) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: sw_if_index = papi_exec.add(cmd, **args).get_sw_if_index(err_msg) if_key = Topology.add_new_port(node, 'gre_tunnel') @@ -1032,7 +1032,7 @@ class InterfaceUtil(object): args = dict(mac_address=0) err_msg = 'Failed to create loopback interface on host {host}'.format( host=node['host']) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: sw_if_index = papi_exec.add(cmd, **args).get_sw_if_index(err_msg) if_key = Topology.add_new_port(node, 'loopback') @@ -1071,7 +1071,7 @@ class InterfaceUtil(object): lb=load_balance.upper())).value) err_msg = 'Failed to create bond interface on host {host}'.format( host=node['host']) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: sw_if_index = papi_exec.add(cmd, **args).get_sw_if_index(err_msg) InterfaceUtil.add_eth_interface(node, sw_if_index=sw_if_index, @@ -1128,7 +1128,7 @@ class InterfaceUtil(object): txq_size=0) err_msg = 'Failed to create AVF interface on host {host}'.format( host=node['host']) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: sw_if_index = papi_exec.add(cmd, **args).get_sw_if_index(err_msg) InterfaceUtil.add_eth_interface(node, sw_if_index=sw_if_index, @@ -1160,7 +1160,7 @@ class InterfaceUtil(object): 'interface {bond} on host {host}'.format(ifc=interface, bond=bond_if, host=node['host']) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: papi_exec.add(cmd, **args).get_reply(err_msg) @staticmethod @@ -1177,7 +1177,7 @@ class InterfaceUtil(object): host=node['host']) data = ('Bond data on node {host}:\n'.format(host=node['host'])) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: details = papi_exec.add(cmd).get_details(err_msg) for bond in details: @@ -1220,7 +1220,7 @@ class InterfaceUtil(object): err_msg = 'Failed to get slave dump on host {host}'.format( host=node['host']) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: details = papi_exec.add(cmd, **args).get_details(err_msg) def process_slave_dump(slave_dump): @@ -1281,7 +1281,7 @@ class InterfaceUtil(object): is_add=1) err_msg = 'Failed to enable input acl on interface {ifc}'.format( ifc=interface) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: papi_exec.add(cmd, **args).get_reply(err_msg) @staticmethod @@ -1306,7 +1306,7 @@ class InterfaceUtil(object): args = dict(sw_if_index=sw_if_index) err_msg = 'Failed to get classify table name by interface {ifc}'.format( ifc=interface) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: reply = papi_exec.add(cmd, **args).get_reply(err_msg) return reply @@ -1350,7 +1350,7 @@ class InterfaceUtil(object): args = dict(sw_if_index=sw_if_index) err_msg = 'Failed to get VXLAN-GPE dump on host {host}'.format( host=node['host']) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: details = papi_exec.add(cmd, **args).get_details(err_msg) def process_vxlan_gpe_dump(vxlan_dump): @@ -1405,7 +1405,7 @@ class InterfaceUtil(object): vrf_id=int(table_id)) err_msg = 'Failed to assign interface {ifc} to FIB table'.format( ifc=interface) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: papi_exec.add(cmd, **args).get_reply(err_msg) @staticmethod @@ -1563,7 +1563,7 @@ class InterfaceUtil(object): cmd = 'sw_interface_rx_placement_dump' err_msg = "Failed to run '{cmd}' PAPI command on host {host}!".format( cmd=cmd, host=node['host']) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: for ifc in node['interfaces'].values(): if ifc['vpp_sw_index'] is not None: papi_exec.add(cmd, sw_if_index=ifc['vpp_sw_index']) @@ -1591,7 +1591,7 @@ class InterfaceUtil(object): "{host}!".format(host=node['host']) args = dict(sw_if_index=sw_if_index, queue_id=queue_id, worker_id=worker_id) - with PapiExecutor(node) as papi_exec: + with PapiSocketExecutor(node) as papi_exec: papi_exec.add(cmd, **args).get_reply(err_msg) @staticmethod -- cgit 1.2.3-korg