aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/SFC
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries/python/SFC')
-rw-r--r--resources/libraries/python/SFC/SFCTest.py52
-rw-r--r--resources/libraries/python/SFC/SetupSFCTest.py2
-rw-r--r--resources/libraries/python/SFC/VerifyPacket.py21
3 files changed, 22 insertions, 53 deletions
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']))
diff --git a/resources/libraries/python/SFC/SetupSFCTest.py b/resources/libraries/python/SFC/SetupSFCTest.py
index d481202837..a1d99c5cc6 100644
--- a/resources/libraries/python/SFC/SetupSFCTest.py
+++ b/resources/libraries/python/SFC/SetupSFCTest.py
@@ -139,7 +139,7 @@ def install_sfc_test(node):
ssh.connect(node)
(ret_code, _, stderr) = ssh.exec_command(
- 'cd {0}/nsh_sfc_tests/sfc_scripts/ && ./install_sfc.sh {1} {2}'
+ 'cd {0}/tests/nsh_sfc/sfc_scripts/ && ./install_sfc.sh {1} {2}'
.format(con.REMOTE_FW_DIR, if_name_list[0], if_name_list[1]), \
timeout=600)
diff --git a/resources/libraries/python/SFC/VerifyPacket.py b/resources/libraries/python/SFC/VerifyPacket.py
index 66bd09899d..fd72bb296b 100644
--- a/resources/libraries/python/SFC/VerifyPacket.py
+++ b/resources/libraries/python/SFC/VerifyPacket.py
@@ -20,7 +20,6 @@ import ipaddress
from scapy.layers.inet import IP, UDP
from scapy.all import Raw
-from scapy.utils import rdpcap
from resources.libraries.python.constants import Constants as con
from resources.libraries.python.SFC.SFCConstants import SFCConstants as sfccon
from resources.libraries.python.SFC.TunnelProtocol import VxLAN, VxLANGPE, NSH
@@ -157,31 +156,23 @@ class VerifyPacket(object):
@staticmethod
- def check_the_nsh_sfc_packet(frame_size, test_type):
+ def check_the_nsh_sfc_packet(ether, frame_size, test_type):
"""
verify the NSH SFC functional test loopback packet field
is correct.
- :param frame_size: the origin frame size.
- :param test_type: the test type.
+ :param ether: The Ethernet packet data.
+ :param frame_size: The origin frame size.
+ :param test_type: The test type.
(Classifier, Proxy Inbound, Proxy Outbound, SFF).
+
+ :type ether: scapy.Ether
:type frame_size: Integer
:type test_type: str
:returns: none
:raises RuntimeError: If the packet field verify fails.
"""
- rx_pcapfile = '{0}/nsh_sfc_tests/sfc_scripts/temp_packet.pcap' \
- .format(con.REMOTE_FW_DIR)
-
- logger.trace('read pcap file:{0}'.format(rx_pcapfile))
-
- packets = rdpcap(rx_pcapfile)
- if len(packets) < 1:
- raise RuntimeError("No packet is received!")
-
- ether = packets[0]
-
origin_size = int(frame_size)
if test_type == "Classifier":
expect_pkt_len = origin_size + 74 - 4