X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FSFC%2FSFCTest.py;h=ec08efd17cd4d702ddfcbcdcf7d94acc217df30c;hp=456457f9f6c55efa031bfe188bc45b8b90974252;hb=050ece3a87fbbad7d04e69ed951c48118edf0a89;hpb=a097c8748051f82e36b3cc3049bf3e596c2252a4 diff --git a/resources/libraries/python/SFC/SFCTest.py b/resources/libraries/python/SFC/SFCTest.py index 456457f9f6..ec08efd17c 100644 --- a/resources/libraries/python/SFC/SFCTest.py +++ b/resources/libraries/python/SFC/SFCTest.py @@ -24,24 +24,30 @@ class SFCTest(object): """Configure and Start the NSH SFC functional tests.""" @staticmethod - def config_and_start_SFC_test(dut_node, dut_port, adj_mac, testtype): + def config_and_start_SFC_test(dut_node, dut_if1, dut_if2, if1_adj_mac, + if2_adj_mac, testtype): """ Start the SFC functional on the dut_node. :param dut_node: Will execute the SFC on this node. - :param dut_port: The ingress interface on the DUT. - :param adj_mac: The adjacency interface MAC. + :param dut_if1: The first ingress interface on the DUT. + :param dut_if2: The last egress interface on the DUT. + :param if1_adj_mac: The interface 1 adjacency MAC. + :param if2_adj_mac: The interface 2 adjacency MAC. :param testtype: The SFC functional test type. (Classifier, Proxy Inbound, Proxy Outbound, SFF). :type dut_node: dict - :type dut_port: str - :type adj_mac: str + :type dut_if1: str + :type dut_if2: str + :type if1_adj_mac: str + :type if2_adj_mac: str :type testtype: str :returns: none :raises RuntimeError: If the script execute fails. """ - vpp_intf_name = Topology.get_interface_name(dut_node, dut_port) + vpp_intf_name1 = Topology.get_interface_name(dut_node, dut_if1) + vpp_intf_name2 = Topology.get_interface_name(dut_node, dut_if2) ssh = SSH() ssh.connect(dut_node) @@ -55,39 +61,11 @@ class SFCTest(object): else: exec_shell = "set_sfc_sff.sh" - cmd = 'cd {0}/nsh_sfc_tests/sfc_scripts/ && sudo ./{1} {2} ' \ - '{3} {4}'.format(con.REMOTE_FW_DIR, exec_shell, vpp_intf_name, - adj_mac, dut_port) + cmd = 'cd {0}/tests/nsh_sfc/sfc_scripts/ && sudo ./{1} {2} ' \ + '{3} {4} {5}'.format(con.REMOTE_FW_DIR, exec_shell, vpp_intf_name1, + vpp_intf_name2, if1_adj_mac, if2_adj_mac) (ret_code, _, _) = ssh.exec_command(cmd, timeout=600) if ret_code != 0: raise RuntimeError('Failed to execute SFC setup script ' \ '{0} at node {1}'.format(exec_shell, dut_node['host'])) - - @staticmethod - def start_the_tcpdump_on_the_node(from_node, from_port, filter_ip): - """ - Start the tcpdump on the frome_node. - - :param from_node: Will execute the tcpdump on this node. - :param from_port: Will capture the packets on this interface. - :param filter_ip: filter the dest ip. - :type from_node: dict - :type from_port: str - :type filter_ip: str - :returns: none - :raises RuntimeError: If the script "start_tcpdump.sh" fails. - """ - - interface_name = Topology.get_interface_name(from_node, from_port) - - ssh = SSH() - ssh.connect(from_node) - - cmd = 'cd {0}/nsh_sfc_tests/sfc_scripts/ && sudo ./start_tcpdump.sh ' \ - '{1} {2}'.format(con.REMOTE_FW_DIR, interface_name, filter_ip) - - (ret_code, _, _) = ssh.exec_command(cmd, timeout=600) - if ret_code != 0: - raise RuntimeError('Failed to exec start_tcpdump.sh at node {0}'. - format(from_node['host']))