aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries
diff options
context:
space:
mode:
authorFangyin Hu <fangyinx.hu@intel.com>2017-06-26 20:34:56 -0700
committerPeter Mikus <pmikus@cisco.com>2017-07-05 05:54:29 +0000
commit050ece3a87fbbad7d04e69ed951c48118edf0a89 (patch)
tree66ed8e4ede224e60e277cb366844f3edb1079539 /resources/libraries
parenta097c8748051f82e36b3cc3049bf3e596c2252a4 (diff)
Change the bootstrap script file and test the CI-management.
Debug the NSH SFC functional test. Change the test cases and not use the tcpdump. Delete the unused code. Change the directory structure. Change-Id: I52486b9ba4b02e305f702ffc8cdb84e941cb18ff Signed-off-by: Fangyin Hu <fangyinx.hu@intel.com>
Diffstat (limited to 'resources/libraries')
-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
-rw-r--r--resources/libraries/robot/nsh_sfc/default.robot48
4 files changed, 53 insertions, 70 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
diff --git a/resources/libraries/robot/nsh_sfc/default.robot b/resources/libraries/robot/nsh_sfc/default.robot
index fc70523cdd..64d31a9897 100644
--- a/resources/libraries/robot/nsh_sfc/default.robot
+++ b/resources/libraries/robot/nsh_sfc/default.robot
@@ -24,18 +24,34 @@
| | ... | on the DUT node.
| | ${testtype}= | Convert to String | ${type}
| | Append Nodes | ${nodes['TG']} | ${nodes['DUT1']}
-| | Compute Path
-| | ${src_port} | ${src_node}= | First Interface
-| | ${dst_port} | ${dst_node}= | Last Interface
-| | Set Suite Variable | ${src_node}
-| | Set Suite Variable | ${src_port}
-| | Set Suite Variable | ${dst_node}
-| | Set Suite Variable | ${dst_port}
-| | Set Interface State | ${src_node} | ${src_port} | 'up'
-| | Set Interface Ethernet MTU | ${src_node} | ${src_port} | 9000
-| | ${adj_mac}= | Get interface mac | ${src_node} | ${src_port}
-| | Config and Start SFC test | ${dst_node} | ${dst_port}
-| | ... | ${adj_mac} | ${testtype}
+| | ... | ${nodes['TG']}
+| | Compute Path | always_same_link=${FALSE}
+| | ${tg_to_dut_if1} | ${tg_node}= | First Interface
+| | ${tg_to_dut_if2} | ${tg_node}= | Last Interface
+| | ${dut_to_tg_if1} | ${dut_node}= | First Ingress Interface
+| | ${dut_to_tg_if2} | ${dut_node}= | Last Egress Interface
+| | ${tg_to_dut_if1_mac}= | Get interface mac | ${tg_node} | ${tg_to_dut_if1}
+| | ${tg_to_dut_if2_mac}= | Get interface mac | ${tg_node} | ${tg_to_dut_if2}
+| | ${dut_to_tg_if1_mac}= | Get interface mac | ${dut_node} | ${dut_to_tg_if1}
+| | ${dut_to_tg_if2_mac}= | Get interface mac | ${dut_node} | ${dut_to_tg_if2}
+| | Set Suite Variable | ${tg_to_dut_if1}
+| | Set Suite Variable | ${tg_to_dut_if2}
+| | Set Suite Variable | ${dut_to_tg_if1}
+| | Set Suite Variable | ${dut_to_tg_if2}
+| | Set Suite Variable | ${tg_to_dut_if1_mac}
+| | Set Suite Variable | ${tg_to_dut_if2_mac}
+| | Set Suite Variable | ${dut_to_tg_if1_mac}
+| | Set Suite Variable | ${dut_to_tg_if2_mac}
+| | Set Suite Variable | ${tg_node}
+| | Set Suite Variable | ${dut_node}
+| | Set Interface State | ${tg_node} | ${tg_to_dut_if1} | 'up'
+| | Set Interface State | ${tg_node} | ${tg_to_dut_if2} | 'up'
+| | Set Interface Ethernet MTU | ${tg_node} | ${tg_to_dut_if1} | 9000
+| | Set Interface Ethernet MTU | ${tg_node} | ${tg_to_dut_if2} | 9000
+| | Config and Start SFC test | ${dut_node} | ${dut_to_tg_if1}
+| | ... | ${dut_to_tg_if2} | ${tg_to_dut_if1_mac} | ${tg_to_dut_if2_mac}
+| | ... | ${testtype}
+
| Node "${from_node}" interface "${from_port}" send "${size}" Bytes packet to node "${to_node}" interface "${to_port}" for "${type}" test
| | [Documentation] | At the first start the tcpdump on the TG node,
@@ -43,17 +59,15 @@
| | ... | DUT node, DUT node will receive the packet on the ingress interface
| | ... | DUT will loopback packet to the TG after processed. TG will use
| | ... | the tcpdump to capture the packet and check the packet is correct.
-| | ${filter_dst_ip}= | Set Variable | 192.168.50.71
-| | Start the tcpdump on the Node | ${from_node} | ${from_port} | ${filter_dst_ip}
| | ${src_ip}= | Set Variable If | "${type}" == "Classifier" | 10.10.12.101 | 192.168.50.72
| | ${dst_ip}= | Set Variable If | "${type}" == "Classifier" | 10.10.12.100 | 192.168.50.76
| | ${src_mac}= | Get interface mac | ${from_node} | ${from_port}
| | ${dst_mac}= | Get interface mac | ${to_node} | ${to_port}
-| | ${from_port_name}= | Get interface name | ${from_node} | ${from_port}
-| | ${to_port_name}= | Get interface name | ${to_node} | ${to_port}
+| | ${tx_port_name}= | Get interface name | ${from_node} | ${from_port}
+| | ${rx_port_name}= | Get interface name | ${from_node} | ${tg_to_dut_if2}
| | ${timeout}= | Set Variable | 10
| | ${frame_size}= | Convert To Integer | ${size}
-| | ${args}= | Traffic Script Gen Arg | ${from_port_name} | ${from_port_name}
+| | ${args}= | Traffic Script Gen Arg | ${rx_port_name} | ${tx_port_name}
| | | ... | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip}
| | ${args}= | Catenate | ${args} | --framesize ${frame_size}
| | | ... | --timeout ${timeout} | --testtype "${type}"