Change the bootstrap script file and test the CI-management. 21/7321/7
authorFangyin Hu <fangyinx.hu@intel.com>
Tue, 27 Jun 2017 03:34:56 +0000 (20:34 -0700)
committerPeter Mikus <pmikus@cisco.com>
Wed, 5 Jul 2017 05:54:29 +0000 (05:54 +0000)
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>
18 files changed:
bootstrap-nsh_sfc-functional-virl.sh
resources/libraries/python/SFC/SFCTest.py
resources/libraries/python/SFC/SetupSFCTest.py
resources/libraries/python/SFC/VerifyPacket.py
resources/libraries/robot/nsh_sfc/default.robot
resources/traffic_scripts/send_tcp_for_classifier_test.py
resources/traffic_scripts/send_vxlan_for_proxy_test.py
resources/traffic_scripts/send_vxlangpe_nsh_for_proxy_test.py
resources/traffic_scripts/send_vxlangpe_nsh_for_sff_test.py
tests/nsh_sfc/func/classifier/eth2p-ethip4-sfc-classifier-func.robot [new file with mode: 0644]
tests/nsh_sfc/func/proxy/eth2p-ethip4-nsh-proxy-inbound-func.robot
tests/nsh_sfc/func/proxy/eth2p-ethip4-nsh-proxy-outbound-func.robot
tests/nsh_sfc/func/sff/eth2p-ethip4-sfc-sff-func.robot
tests/nsh_sfc/sfc_scripts/set_nsh_proxy_inbound.sh
tests/nsh_sfc/sfc_scripts/set_nsh_proxy_outbound.sh
tests/nsh_sfc/sfc_scripts/set_sfc_classifier.sh [new file with mode: 0755]
tests/nsh_sfc/sfc_scripts/set_sfc_sff.sh
tests/nsh_sfc/sfc_scripts/start_tcpdump.sh [deleted file]

index f749429..034ea9b 100755 (executable)
@@ -17,6 +17,8 @@ set -x
 cat /etc/hostname
 cat /etc/hosts
 
 cat /etc/hostname
 cat /etc/hosts
 
+ARCHIVE_ARTIFACTS=(log.html output.xml report.html)
+
 export DEBIAN_FRONTEND=noninteractive
 sudo apt-get -y update
 sudo apt-get -y install libpython2.7-dev python-virtualenv
 export DEBIAN_FRONTEND=noninteractive
 sudo apt-get -y update
 sudo apt-get -y install libpython2.7-dev python-virtualenv
@@ -238,3 +240,9 @@ PYTHONPATH=`pwd` pybot -L TRACE -W 136\
     --exclude PERFTEST \
     --exclude SKIP_PATCH \
     tests/
     --exclude PERFTEST \
     --exclude SKIP_PATCH \
     tests/
+
+# Archive artifacts
+mkdir archive
+for i in ${ARCHIVE_ARTIFACTS[@]}; do
+    cp $( readlink -f ${i} | tr '\n' ' ' ) archive/
+done
index 456457f..ec08efd 100644 (file)
@@ -24,24 +24,30 @@ class SFCTest(object):
     """Configure and Start the NSH SFC functional tests."""
 
     @staticmethod
     """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.
         """
         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
         :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.
         """
 
         :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)
 
         ssh = SSH()
         ssh.connect(dut_node)
@@ -55,39 +61,11 @@ class SFCTest(object):
         else:
             exec_shell = "set_sfc_sff.sh"
 
         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']))
 
         (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']))
index d481202..a1d99c5 100644 (file)
@@ -139,7 +139,7 @@ def install_sfc_test(node):
     ssh.connect(node)
 
     (ret_code, _, stderr) = ssh.exec_command(
     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)
 
         .format(con.REMOTE_FW_DIR, if_name_list[0], if_name_list[1]), \
         timeout=600)
 
index 66bd098..fd72bb2 100644 (file)
@@ -20,7 +20,6 @@ import ipaddress
 
 from scapy.layers.inet import IP, UDP
 from scapy.all import Raw
 
 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
 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
 
 
     @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.
 
         """
         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).
                          (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.
         """
 
         :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
         origin_size = int(frame_size)
         if test_type == "Classifier":
             expect_pkt_len = origin_size + 74 - 4
index fc70523..64d31a9 100644 (file)
 | | ... | on the DUT node.
 | | ${testtype}= | Convert to String | ${type}
 | | Append Nodes | ${nodes['TG']} | ${nodes['DUT1']}
 | | ... | 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,
 
 | 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,
 | | ... | 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.
 | | ... | 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}
 | | ${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}
 | | ${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}"
 | |          | ...      | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip}
 | | ${args}= | Catenate | ${args} | --framesize ${frame_size}
 | |          | ...      | --timeout ${timeout} | --testtype "${type}"
index f08816e..5d8d387 100755 (executable)
@@ -22,11 +22,11 @@ import time
 from scapy.layers.inet import IP, UDP, TCP
 from scapy.layers.inet6 import IPv6
 from scapy.all import Ether, Packet, Raw
 from scapy.layers.inet import IP, UDP, TCP
 from scapy.layers.inet6 import IPv6
 from scapy.all import Ether, Packet, Raw
-from scapy.all import sendp
 
 from resources.libraries.python.SFC.VerifyPacket import *
 from resources.libraries.python.SFC.SFCConstants import SFCConstants as sfccon
 from resources.libraries.python.TrafficScriptArg import TrafficScriptArg
 
 from resources.libraries.python.SFC.VerifyPacket import *
 from resources.libraries.python.SFC.SFCConstants import SFCConstants as sfccon
 from resources.libraries.python.TrafficScriptArg import TrafficScriptArg
+from resources.libraries.python.PacketVerifier import RxQueue, TxQueue
 
 from robot.api import logger
 
 
 from robot.api import logger
 
@@ -49,6 +49,10 @@ def main():
     frame_size = int(args.get_arg('framesize'))
     test_type = args.get_arg('testtype')
 
     frame_size = int(args.get_arg('framesize'))
     test_type = args.get_arg('testtype')
 
+    rxq = RxQueue(rx_if)
+    txq = TxQueue(tx_if)
+    sent_packets = []
+
     protocol = TCP
     source_port = sfccon.DEF_SRC_PORT
     destination_port = sfccon.DEF_DST_PORT
     protocol = TCP
     source_port = sfccon.DEF_SRC_PORT
     destination_port = sfccon.DEF_DST_PORT
@@ -71,12 +75,17 @@ def main():
 
     pkt_raw = pkt_header / Raw(load=pad_data)
 
 
     pkt_raw = pkt_header / Raw(load=pad_data)
 
-    sendp(pkt_raw, iface=tx_if, count=3)
+    # Send created packet on one interface and receive on the other
+    sent_packets.append(pkt_raw)
+    txq.send(pkt_raw)
+
+    ether = rxq.recv(timeout)
 
 
-    time.sleep(timeout)
+    if ether is None:
+        raise RuntimeError("No packet is received!")
 
     # let us begin to check the NSH SFC loopback  packet
 
     # let us begin to check the NSH SFC loopback  packet
-    VerifyPacket.check_the_nsh_sfc_packet(frame_size, test_type)
+    VerifyPacket.check_the_nsh_sfc_packet(ether, frame_size, test_type)
 
     # we check all the fields about the loopback packet, this test will pass
     sys.exit(0)
 
     # we check all the fields about the loopback packet, this test will pass
     sys.exit(0)
index 4087c7f..c356e19 100755 (executable)
@@ -21,11 +21,11 @@ import time
 from scapy.layers.inet import IP, UDP, TCP
 from scapy.layers.inet6 import IPv6
 from scapy.all import Ether, Packet, Raw
 from scapy.layers.inet import IP, UDP, TCP
 from scapy.layers.inet6 import IPv6
 from scapy.all import Ether, Packet, Raw
-from scapy.all import sendp
 
 from resources.libraries.python.SFC.VerifyPacket import *
 from resources.libraries.python.SFC.SFCConstants import SFCConstants as sfccon
 from resources.libraries.python.TrafficScriptArg import TrafficScriptArg
 
 from resources.libraries.python.SFC.VerifyPacket import *
 from resources.libraries.python.SFC.SFCConstants import SFCConstants as sfccon
 from resources.libraries.python.TrafficScriptArg import TrafficScriptArg
+from resources.libraries.python.PacketVerifier import RxQueue, TxQueue
 
 from robot.api import logger
 
 
 from robot.api import logger
 
@@ -48,6 +48,10 @@ def main():
     frame_size = int(args.get_arg('framesize'))
     test_type = args.get_arg('testtype')
 
     frame_size = int(args.get_arg('framesize'))
     test_type = args.get_arg('testtype')
 
+    rxq = RxQueue(rx_if)
+    txq = TxQueue(tx_if)
+    sent_packets = []
+
     protocol = TCP
     source_port = sfccon.DEF_SRC_PORT
     destination_port = sfccon.DEF_DST_PORT
     protocol = TCP
     source_port = sfccon.DEF_SRC_PORT
     destination_port = sfccon.DEF_DST_PORT
@@ -79,12 +83,17 @@ def main():
 
     pkt_raw = pkt_header / Raw(load=pad_data)
 
 
     pkt_raw = pkt_header / Raw(load=pad_data)
 
-    sendp(pkt_raw, iface=tx_if, count=3)
+    # Send created packet on one interface and receive on the other
+    sent_packets.append(pkt_raw)
+    txq.send(pkt_raw)
+
+    ether = rxq.recv(2)
 
 
-    time.sleep(timeout)
+    if ether is None:
+        raise RuntimeError("No packet is received!")
 
     # let us begin to check the proxy outbound packet
 
     # let us begin to check the proxy outbound packet
-    VerifyPacket.check_the_nsh_sfc_packet(frame_size, test_type)
+    VerifyPacket.check_the_nsh_sfc_packet(ether, frame_size, test_type)
 
     # we check all the fields about the proxy outbound, this test will pass
     sys.exit(0)
 
     # we check all the fields about the proxy outbound, this test will pass
     sys.exit(0)
index ea1f9b1..d998d7c 100755 (executable)
@@ -21,11 +21,11 @@ import time
 from scapy.layers.inet import IP, UDP, TCP
 from scapy.layers.inet6 import IPv6
 from scapy.all import Ether, Packet, Raw
 from scapy.layers.inet import IP, UDP, TCP
 from scapy.layers.inet6 import IPv6
 from scapy.all import Ether, Packet, Raw
-from scapy.all import sendp
 
 from resources.libraries.python.SFC.VerifyPacket import *
 from resources.libraries.python.SFC.SFCConstants import SFCConstants as sfccon
 from resources.libraries.python.TrafficScriptArg import TrafficScriptArg
 
 from resources.libraries.python.SFC.VerifyPacket import *
 from resources.libraries.python.SFC.SFCConstants import SFCConstants as sfccon
 from resources.libraries.python.TrafficScriptArg import TrafficScriptArg
+from resources.libraries.python.PacketVerifier import RxQueue, TxQueue
 
 from robot.api import logger
 
 
 from robot.api import logger
 
@@ -48,6 +48,10 @@ def main():
     frame_size = int(args.get_arg('framesize'))
     test_type = args.get_arg('testtype')
 
     frame_size = int(args.get_arg('framesize'))
     test_type = args.get_arg('testtype')
 
+    rxq = RxQueue(rx_if)
+    txq = TxQueue(tx_if)
+    sent_packets = []
+
     protocol = TCP
     source_port = sfccon.DEF_SRC_PORT
     destination_port = sfccon.DEF_DST_PORT
     protocol = TCP
     source_port = sfccon.DEF_SRC_PORT
     destination_port = sfccon.DEF_DST_PORT
@@ -81,12 +85,17 @@ def main():
 
     pkt_raw = pkt_header / Raw(load=pad_data)
 
 
     pkt_raw = pkt_header / Raw(load=pad_data)
 
-    sendp(pkt_raw, iface=tx_if, count=3)
+    # Send created packet on one interface and receive on the other
+    sent_packets.append(pkt_raw)
+    txq.send(pkt_raw)
+
+    ether = rxq.recv(2)
 
 
-    time.sleep(timeout)
+    if ether is None:
+        raise RuntimeError("No packet is received!")
 
     # let us begin to check the proxy inbound packet
 
     # let us begin to check the proxy inbound packet
-    VerifyPacket.check_the_nsh_sfc_packet(frame_size, test_type)
+    VerifyPacket.check_the_nsh_sfc_packet(ether, frame_size, test_type)
 
     # we check all the fields about the proxy inbound, this test will pass
     sys.exit(0)
 
     # we check all the fields about the proxy inbound, this test will pass
     sys.exit(0)
index b82e2a8..55c06f0 100755 (executable)
@@ -21,11 +21,11 @@ import time
 from scapy.layers.inet import IP, UDP, TCP
 from scapy.layers.inet6 import IPv6
 from scapy.all import Ether, Packet, Raw
 from scapy.layers.inet import IP, UDP, TCP
 from scapy.layers.inet6 import IPv6
 from scapy.all import Ether, Packet, Raw
-from scapy.all import sendp
 
 from resources.libraries.python.SFC.VerifyPacket import *
 from resources.libraries.python.SFC.SFCConstants import SFCConstants as sfccon
 from resources.libraries.python.TrafficScriptArg import TrafficScriptArg
 
 from resources.libraries.python.SFC.VerifyPacket import *
 from resources.libraries.python.SFC.SFCConstants import SFCConstants as sfccon
 from resources.libraries.python.TrafficScriptArg import TrafficScriptArg
+from resources.libraries.python.PacketVerifier import RxQueue, TxQueue
 
 from robot.api import logger
 
 
 from robot.api import logger
 
@@ -48,6 +48,10 @@ def main():
     frame_size = int(args.get_arg('framesize'))
     test_type = args.get_arg('testtype')
 
     frame_size = int(args.get_arg('framesize'))
     test_type = args.get_arg('testtype')
 
+    rxq = RxQueue(rx_if)
+    txq = TxQueue(tx_if)
+    sent_packets = []
+
     protocol = TCP
     source_port = sfccon.DEF_SRC_PORT
     destination_port = sfccon.DEF_DST_PORT
     protocol = TCP
     source_port = sfccon.DEF_SRC_PORT
     destination_port = sfccon.DEF_DST_PORT
@@ -81,12 +85,17 @@ def main():
 
     pkt_raw = pkt_header / Raw(load=pad_data)
 
 
     pkt_raw = pkt_header / Raw(load=pad_data)
 
-    sendp(pkt_raw, iface=tx_if, count=3)
+    # Send created packet on one interface and receive on the other
+    sent_packets.append(pkt_raw)
+    txq.send(pkt_raw)
+
+    ether = rxq.recv(2)
 
 
-    time.sleep(timeout)
+    if ether is None:
+        raise RuntimeError("No packet is received!")
 
     # let us begin to check the sfc sff packet
 
     # let us begin to check the sfc sff packet
-    VerifyPacket.check_the_nsh_sfc_packet(frame_size, test_type)
+    VerifyPacket.check_the_nsh_sfc_packet(ether, frame_size, test_type)
 
     # we check all the fields about the sfc sff, this test will pass
     sys.exit(0)
 
     # we check all the fields about the sfc sff, this test will pass
     sys.exit(0)
diff --git a/tests/nsh_sfc/func/classifier/eth2p-ethip4-sfc-classifier-func.robot b/tests/nsh_sfc/func/classifier/eth2p-ethip4-sfc-classifier-func.robot
new file mode 100644 (file)
index 0000000..5bf5934
--- /dev/null
@@ -0,0 +1,91 @@
+# Copyright (c) 2017 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+| Library | resources.libraries.python.NodePath
+| Library | resources.libraries.python.Trace
+| Resource | resources/libraries/robot/shared/default.robot
+| Resource | resources/libraries/robot/nsh_sfc/default.robot
+| Resource | resources/libraries/robot/shared/interfaces.robot
+| Resource | resources/libraries/robot/ip/ip4.robot
+| Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | FUNCTEST
+| Suite Setup | Run Keywords
+| ... | Configure all DUTs before test | AND
+| ... | Configure all TGs for traffic script | AND
+| ... | Update All Interface Data On All Nodes | ${nodes} | AND
+| ... | Setup DUT nodes for 'Classifier' functional testing
+| Test Setup | Run Keywords | Save VPP PIDs | AND
+| ... | Reset VAT History On All DUTs | ${nodes} | AND
+| ... | Clear interface counters on all vpp nodes in topology | ${nodes}
+| Test Teardown | Run Keywords
+| ... | Show packet trace on all DUTs | ${nodes} | AND
+| ... | Show VAT History On All DUTs | ${nodes} | AND
+| ... | Verify VPP PID in Teardown
+| Documentation | *NSH SFC Classifier test cases*
+| ...
+| ... | Test the SFC Classifier functional. DUT run the VPP with NSH SFC Plugin
+| ... | TG send a TCP packet to the DUT, if the packet match the SFC Classifier
+| ... | rules, the SFC Classifier will encapsulate this packet to a VxLAN-GPE
+| ... | and NSH packet, then the DUT will loopback the packet to the TG.
+| ... | The TG will capture this encapsulation packet and check the packet
+| ... | field is correct.
+
+*** Test Cases ***
+| TC01: NSH SFC Classifier functional test with 72B frame size
+| | [Documentation]
+| | ... | Make TG send 72 Bytes TCP packet to DUT ingress interface. Make TG\
+| | ... | verify SFC Classifier encapsulation functional is correct.
+| | ${frame_size}= | Set Variable | ${72}
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Classifier" test
+
+| TC02: NSH SFC Classifier functional test with 128B frame size
+| | [Documentation]
+| | ... | Make TG send 128 Bytes TCP packet to DUT ingress interface. Make TG\
+| | ... | verify SFC Classifier encapsulation functional is correct.
+| | ${frame_size}= | Set Variable | ${128}
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Classifier" test
+
+| TC03: NSH SFC Classifier functional test with 256B frame size
+| | [Documentation]
+| | ... | Make TG send 256 Bytes TCP packet to DUT ingress interface. Make TG\
+| | ... | verify SFC Classifier encapsulation functional is correct.
+| | ${frame_size}= | Set Variable | ${256}
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Classifier" test
+
+| TC04: NSH SFC Classifier functional test with 512B frame size
+| | [Documentation]
+| | ... | Make TG send 512 Bytes TCP packet to DUT ingress interface. Make TG\
+| | ... | verify SFC Classifier encapsulation functional is correct.
+| | ${frame_size}= | Set Variable | ${512}
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Classifier" test
+
+| TC05: NSH SFC Classifier functional test with 1024B frame size
+| | [Documentation]
+| | ... | Make TG send 1024 Bytes TCP packet to DUT ingress interface. Make TG\
+| | ... | verify SFC Classifier encapsulation functional is correct.
+| | ${frame_size}= | Set Variable | ${1024}
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Classifier" test
+
+| TC06: NSH SFC Classifier functional test with 1280B frame size
+| | [Documentation]
+| | ... | Make TG send 1280 Bytes TCP packet to DUT ingress interface. Make TG\
+| | ... | verify SFC Classifier encapsulation functional is correct.
+| | ${frame_size}= | Set Variable | ${1280}
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Classifier" test
+
+| TC07: NSH SFC Classifier functional test with 1518B frame size
+| | [Documentation]
+| | ... | Make TG send 1518 Bytes TCP packet to DUT ingress interface. Make TG\
+| | ... | verify SFC Classifier encapsulation functional is correct.
+| | ${frame_size}= | Set Variable | ${1518}
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Classifier" test
index a85b539..fd34690 100644 (file)
 | | ... | Make TG send 152 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Inbound functional is correct.
 | | ${frame_size}= | Set Variable | ${152}
 | | ... | Make TG send 152 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Inbound functional is correct.
 | | ${frame_size}= | Set Variable | ${152}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "Proxy Inbound" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Proxy Inbound" test
 
 | TC02: NSH SFC Proxy Inbound functional test with 256B frame size
 | | [Documentation]
 | | ... | Make TG send 256 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Inbound functional is correct.
 | | ${frame_size}= | Set Variable | ${256}
 
 | TC02: NSH SFC Proxy Inbound functional test with 256B frame size
 | | [Documentation]
 | | ... | Make TG send 256 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Inbound functional is correct.
 | | ${frame_size}= | Set Variable | ${256}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "Proxy Inbound" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Proxy Inbound" test
 
 | TC03: NSH SFC Proxy Inbound functional test with 512B frame size
 | | [Documentation]
 | | ... | Make TG send 512 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Inbound functional is correct.
 | | ${frame_size}= | Set Variable | ${512}
 
 | TC03: NSH SFC Proxy Inbound functional test with 512B frame size
 | | [Documentation]
 | | ... | Make TG send 512 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Inbound functional is correct.
 | | ${frame_size}= | Set Variable | ${512}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "Proxy Inbound" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Proxy Inbound" test
 
 | TC04: NSH SFC Proxy Inbound functional test with 1024B frame size
 | | [Documentation]
 | | ... | Make TG send 1024 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Inbound functional is correct.
 | | ${frame_size}= | Set Variable | ${1024}
 
 | TC04: NSH SFC Proxy Inbound functional test with 1024B frame size
 | | [Documentation]
 | | ... | Make TG send 1024 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Inbound functional is correct.
 | | ${frame_size}= | Set Variable | ${1024}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "Proxy Inbound" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Proxy Inbound" test
 
 | TC05: NSH SFC Proxy Inbound functional test with 1280B frame size
 | | [Documentation]
 | | ... | Make TG send 1280 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Inbound functional is correct.
 | | ${frame_size}= | Set Variable | ${1280}
 
 | TC05: NSH SFC Proxy Inbound functional test with 1280B frame size
 | | [Documentation]
 | | ... | Make TG send 1280 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Inbound functional is correct.
 | | ${frame_size}= | Set Variable | ${1280}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "Proxy Inbound" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Proxy Inbound" test
 
 | TC06: NSH SFC Proxy Inbound functional test with 1518B frame size
 | | [Documentation]
 | | ... | Make TG send 1518 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Inbound functional is correct.
 | | ${frame_size}= | Set Variable | ${1518}
 
 | TC06: NSH SFC Proxy Inbound functional test with 1518B frame size
 | | [Documentation]
 | | ... | Make TG send 1518 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Inbound functional is correct.
 | | ${frame_size}= | Set Variable | ${1518}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "Proxy Inbound" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Proxy Inbound" test
index 005272b..b5f167a 100644 (file)
 | | ... | Make TG send 128 Bytes VxLAN packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Outbound functional is correct.
 | | ${frame_size}= | Set Variable | ${128}
 | | ... | Make TG send 128 Bytes VxLAN packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Outbound functional is correct.
 | | ${frame_size}= | Set Variable | ${128}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "Proxy Outbound" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Proxy Outbound" test
 
 | TC02: NSH SFC Proxy Outbound functional test with 256B frame size
 | | [Documentation]
 | | ... | Make TG send 256 Bytes VxLAN packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Outbound functional is correct.
 | | ${frame_size}= | Set Variable | ${256}
 
 | TC02: NSH SFC Proxy Outbound functional test with 256B frame size
 | | [Documentation]
 | | ... | Make TG send 256 Bytes VxLAN packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Outbound functional is correct.
 | | ${frame_size}= | Set Variable | ${256}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "Proxy Outbound" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Proxy Outbound" test
 
 | TC03: NSH SFC Proxy Outbound functional test with 512B frame size
 | | [Documentation]
 | | ... | Make TG send 512 Bytes VxLAN packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Outbound functional is correct.
 | | ${frame_size}= | Set Variable | ${512}
 
 | TC03: NSH SFC Proxy Outbound functional test with 512B frame size
 | | [Documentation]
 | | ... | Make TG send 512 Bytes VxLAN packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Outbound functional is correct.
 | | ${frame_size}= | Set Variable | ${512}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "Proxy Outbound" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Proxy Outbound" test
 
 | TC04: NSH SFC Proxy Outbound functional test with 1024B frame size
 | | [Documentation]
 | | ... | Make TG send 1024 Bytes VxLAN packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Outbound functional is correct.
 | | ${frame_size}= | Set Variable | ${1024}
 
 | TC04: NSH SFC Proxy Outbound functional test with 1024B frame size
 | | [Documentation]
 | | ... | Make TG send 1024 Bytes VxLAN packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Outbound functional is correct.
 | | ${frame_size}= | Set Variable | ${1024}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "Proxy Outbound" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Proxy Outbound" test
 
 | TC05: NSH SFC Proxy Outbound functional test with 1280B frame size
 | | [Documentation]
 | | ... | Make TG send 1280 Bytes VxLAN packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Outbound functional is correct.
 | | ${frame_size}= | Set Variable | ${1280}
 
 | TC05: NSH SFC Proxy Outbound functional test with 1280B frame size
 | | [Documentation]
 | | ... | Make TG send 1280 Bytes VxLAN packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Outbound functional is correct.
 | | ${frame_size}= | Set Variable | ${1280}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "Proxy Outbound" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Proxy Outbound" test
 
 | TC06: NSH SFC Proxy Outbound functional test with 1518B frame size
 | | [Documentation]
 | | ... | Make TG send 1518 Bytes VxLAN packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Outbound functional is correct.
 | | ${frame_size}= | Set Variable | ${1518}
 
 | TC06: NSH SFC Proxy Outbound functional test with 1518B frame size
 | | [Documentation]
 | | ... | Make TG send 1518 Bytes VxLAN packet to DUT ingress interface.\
 | | ... | Make TG verify SFC Proxy Outbound functional is correct.
 | | ${frame_size}= | Set Variable | ${1518}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "Proxy Outbound" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "Proxy Outbound" test
index 1356c8c..77a1d0e 100644 (file)
 | | ... | Make TG send 152 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC SFF functional is correct.
 | | ${frame_size}= | Set Variable | ${152}
 | | ... | Make TG send 152 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC SFF functional is correct.
 | | ${frame_size}= | Set Variable | ${152}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "SFF" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "SFF" test
 
 | TC02: NSH SFC SFF functional test with 256B frame size
 | | [Documentation]
 | | ... | Make TG send 256 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC SFF functional is correct.
 | | ${frame_size}= | Set Variable | ${256}
 
 | TC02: NSH SFC SFF functional test with 256B frame size
 | | [Documentation]
 | | ... | Make TG send 256 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC SFF functional is correct.
 | | ${frame_size}= | Set Variable | ${256}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "SFF" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "SFF" test
 
 | TC03: NSH SFC SFF functional test with 512B frame size
 | | [Documentation]
 | | ... | Make TG send 512 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC SFF functional is correct.
 | | ${frame_size}= | Set Variable | ${512}
 
 | TC03: NSH SFC SFF functional test with 512B frame size
 | | [Documentation]
 | | ... | Make TG send 512 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC SFF functional is correct.
 | | ${frame_size}= | Set Variable | ${512}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "SFF" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "SFF" test
 
 | TC04: NSH SFC SFF functional test with 1024B frame size
 | | [Documentation]
 | | ... | Make TG send 1024 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC SFF functional is correct.
 | | ${frame_size}= | Set Variable | ${1024}
 
 | TC04: NSH SFC SFF functional test with 1024B frame size
 | | [Documentation]
 | | ... | Make TG send 1024 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC SFF functional is correct.
 | | ${frame_size}= | Set Variable | ${1024}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "SFF" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "SFF" test
 
 | TC05: NSH SFC SFF functional test with 1280B frame size
 | | [Documentation]
 | | ... | Make TG send 1280 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC SFF functional is correct.
 | | ${frame_size}= | Set Variable | ${1280}
 
 | TC05: NSH SFC SFF functional test with 1280B frame size
 | | [Documentation]
 | | ... | Make TG send 1280 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC SFF functional is correct.
 | | ${frame_size}= | Set Variable | ${1280}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "SFF" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "SFF" test
 
 | TC06: NSH SFC SFF functional test with 1518B frame size
 | | [Documentation]
 | | ... | Make TG send 1518 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC SFF functional is correct.
 | | ${frame_size}= | Set Variable | ${1518}
 
 | TC06: NSH SFC SFF functional test with 1518B frame size
 | | [Documentation]
 | | ... | Make TG send 1518 Bytes VxLAN-GPE+NSH packet to DUT ingress interface.\
 | | ... | Make TG verify SFC SFF functional is correct.
 | | ${frame_size}= | Set Variable | ${1518}
-| | Node "${src_node}" interface "${src_port}" send "${frame_size}" Bytes packet to node "${dst_node}" interface "${dst_port}" for "SFF" test
+| | Node "${tg_node}" interface "${tg_to_dut_if1}" send "${frame_size}" Bytes packet to node "${dut_node}" interface "${dut_to_tg_if1}" for "SFF" test
index 453de3f..9d7ee72 100755 (executable)
@@ -2,18 +2,23 @@
 
 set -x
 
 
 set -x
 
+vpp_interface1=$1
+vpp_interface2=$2
+vpp_intf1_adj_mac=$3
+vpp_intf2_adj_mac=$4
+
 sudo service vpp restart
 sleep 5
 
 sudo service vpp restart
 sleep 5
 
-sudo vppctl set int state $1 up
+sudo vppctl set int state ${vpp_interface1} up
 sleep 10
 sleep 10
-sudo vppctl set int ip table $1 0
-sudo vppctl set int ip address $1 192.168.50.76/24
+sudo vppctl set int ip table ${vpp_interface1} 0
+sudo vppctl set int ip address ${vpp_interface1} 192.168.50.76/24
 
 sudo vppctl create vxlan-gpe tunnel local 192.168.50.76 remote 192.168.50.72 vni 9 next-nsh encap-vrf-id 0 decap-vrf-id 0
 sudo vppctl set int l2 bridge vxlan_gpe_tunnel0 1 1
 
 
 sudo vppctl create vxlan-gpe tunnel local 192.168.50.76 remote 192.168.50.72 vni 9 next-nsh encap-vrf-id 0 decap-vrf-id 0
 sudo vppctl set int l2 bridge vxlan_gpe_tunnel0 1 1
 
-sudo vppctl create vxlan tunnel src 192.168.50.76 dst 192.168.50.71 vni 1 encap-vrf-id 0 decap-next node nsh-proxy
+sudo vppctl create vxlan tunnel src 192.168.60.76 dst 192.168.60.71 vni 1 encap-vrf-id 0 decap-next node nsh-proxy
 sudo vppctl set int l2 bridge vxlan_tunnel0 1 1
 
 sudo vppctl create nsh entry nsp 185 nsi 255 md-type 1 c1 3232248395 c2 9 c3 3232248392 c4 50336437 next-ethernet
 sudo vppctl set int l2 bridge vxlan_tunnel0 1 1
 
 sudo vppctl create nsh entry nsp 185 nsi 255 md-type 1 c1 3232248395 c2 9 c3 3232248392 c4 50336437 next-ethernet
@@ -26,7 +31,13 @@ sudo vppctl create nsh map nsp 185 nsi 255 mapped-nsp 185 mapped-nsi 255 nsh_act
 sudo vppctl create nsh map nsp 185 nsi 254 mapped-nsp 185 mapped-nsi 254 nsh_action push encap-vxlan-gpe-intf ${vxlan_gpe_index}
 
 sudo vppctl ip route add 192.168.50.72/24 via 192.168.50.76
 sudo vppctl create nsh map nsp 185 nsi 254 mapped-nsp 185 mapped-nsi 254 nsh_action push encap-vxlan-gpe-intf ${vxlan_gpe_index}
 
 sudo vppctl ip route add 192.168.50.72/24 via 192.168.50.76
-sudo vppctl set ip arp $1 192.168.50.71 $2
-sudo vppctl set ip arp $1 192.168.50.72 $2
+
+sudo vppctl set int state ${vpp_interface2} up
+sleep 10
+sudo vppctl set int ip table ${vpp_interface2} 0
+sudo vppctl set int ip address ${vpp_interface2} 192.168.60.76/24
+
+sudo vppctl ip route add 192.168.60.71/24 via 192.168.60.76
+sudo vppctl set ip arp ${vpp_interface2} 192.168.60.71 ${vpp_intf2_adj_mac}
 
 sudo vppctl trace add dpdk-input 100
 
 sudo vppctl trace add dpdk-input 100
index 304ed30..3aaf0e9 100755 (executable)
@@ -2,15 +2,20 @@
 
 set -x
 
 
 set -x
 
+vpp_interface1=$1
+vpp_interface2=$2
+vpp_intf1_adj_mac=$3
+vpp_intf2_adj_mac=$4
+
 sudo service vpp restart
 sleep 5
 
 sudo service vpp restart
 sleep 5
 
-sudo vppctl set int state $1 up
+sudo vppctl set int state ${vpp_interface1} up
 sleep 10
 sleep 10
-sudo vppctl set int ip table $1 0
-sudo vppctl set int ip address $1 192.168.50.76/24
+sudo vppctl set int ip table ${vpp_interface1} 0
+sudo vppctl set int ip address ${vpp_interface1} 192.168.50.76/24
 
 
-sudo vppctl create vxlan-gpe tunnel local 192.168.50.76 remote 192.168.50.71 vni 9 next-nsh encap-vrf-id 0 decap-vrf-id 0
+sudo vppctl create vxlan-gpe tunnel local 192.168.60.76 remote 192.168.60.71 vni 9 next-nsh encap-vrf-id 0 decap-vrf-id 0
 sudo vppctl set int l2 bridge vxlan_gpe_tunnel0 1 1
 
 sudo vppctl create vxlan tunnel src 192.168.50.76 dst 192.168.50.72 vni 1 encap-vrf-id 0 decap-next node nsh-proxy
 sudo vppctl set int l2 bridge vxlan_gpe_tunnel0 1 1
 
 sudo vppctl create vxlan tunnel src 192.168.50.76 dst 192.168.50.72 vni 1 encap-vrf-id 0 decap-next node nsh-proxy
@@ -26,7 +31,13 @@ sudo vppctl create nsh map nsp 185 nsi 255 mapped-nsp 185 mapped-nsi 255 nsh_act
 sudo vppctl create nsh map nsp 185 nsi 254 mapped-nsp 185 mapped-nsi 254 nsh_action push encap-vxlan-gpe-intf ${vxlan_gpe_index}
 
 sudo vppctl ip route add 192.168.50.72/24 via 192.168.50.76
 sudo vppctl create nsh map nsp 185 nsi 254 mapped-nsp 185 mapped-nsi 254 nsh_action push encap-vxlan-gpe-intf ${vxlan_gpe_index}
 
 sudo vppctl ip route add 192.168.50.72/24 via 192.168.50.76
-sudo vppctl set ip arp $1 192.168.50.71 $2
-sudo vppctl set ip arp $1 192.168.50.72 $2
+
+sudo vppctl set int state ${vpp_interface2} up
+sleep 10
+sudo vppctl set int ip table ${vpp_interface2} 0
+sudo vppctl set int ip address ${vpp_interface2} 192.168.60.76/24
+
+sudo vppctl ip route add 192.168.60.71/24 via 192.168.60.76
+sudo vppctl set ip arp ${vpp_interface2} 192.168.60.71 ${vpp_intf2_adj_mac}
 
 sudo vppctl trace add dpdk-input 100
 
 sudo vppctl trace add dpdk-input 100
diff --git a/tests/nsh_sfc/sfc_scripts/set_sfc_classifier.sh b/tests/nsh_sfc/sfc_scripts/set_sfc_classifier.sh
new file mode 100755 (executable)
index 0000000..ae5f54b
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+set -x
+
+vpp_interface1=$1
+vpp_interface2=$2
+vpp_intf1_adj_mac=$3
+vpp_intf2_adj_mac=$4
+
+sudo service vpp restart
+sleep 5
+
+sudo vppctl set int state ${vpp_interface1} up
+sleep 10
+sudo vppctl set int ip table ${vpp_interface1} 0
+sudo vppctl set int ip address ${vpp_interface1} 192.168.50.76/24
+
+sudo vppctl classify table mask l3 ip4 proto
+sudo vppctl classify session l2-input-hit-next input-node nsh-classifier table-index 0 match l3 ip4 proto 6 opaque-index 47615
+sudo vppctl set int l2 bridge ${vpp_interface1} 1 1
+sudo vppctl set interface l2 input classify intfc ${vpp_interface1} ip4-table 0
+
+sudo vppctl create vxlan-gpe tunnel local 192.168.60.76 remote 192.168.60.71 vni 9 next-nsh encap-vrf-id 0 decap-vrf-id 0
+sudo vppctl set int l2 bridge vxlan_gpe_tunnel0 1 1
+sleep 2
+sw_index0=`sudo vppctl sh int | grep "vxlan_gpe_tunnel0" | awk '{print $2}'`
+sudo vppctl create nsh entry nsp 185 nsi 255 md-type 1 c1 3232248395 c2 9 c3 3232248392 c4 50336437 next-ethernet
+sudo vppctl create nsh map nsp 185 nsi 255 mapped-nsp 185 mapped-nsi 255 nsh_action push encap-vxlan-gpe-intf ${sw_index0}
+
+sudo vppctl ip route add 10.10.12.00/24 via 192.168.50.76
+
+sudo vppctl set int state ${vpp_interface2} up
+sleep 10
+sudo vppctl set int ip table ${vpp_interface2} 0
+sudo vppctl set int ip address ${vpp_interface2} 192.168.60.76/24
+
+sudo vppctl ip route add 192.168.60.71/24 via 192.168.60.76
+sudo vppctl set ip arp ${vpp_interface2} 192.168.60.71 ${vpp_intf2_adj_mac}
+
+sudo vppctl trace add dpdk-input 100
index 03e2f0a..1832676 100755 (executable)
@@ -2,15 +2,20 @@
 
 set -x
 
 
 set -x
 
+vpp_interface1=$1
+vpp_interface2=$2
+vpp_intf1_adj_mac=$3
+vpp_intf2_adj_mac=$4
+
 sudo service vpp restart
 sleep 5
 
 sudo service vpp restart
 sleep 5
 
-sudo vppctl set int state $1 up
+sudo vppctl set int state ${vpp_interface1} up
 sleep 10
 sleep 10
-sudo vppctl set int ip table $1 7
-sudo vppctl set int ip address $1 192.168.50.76/24
+sudo vppctl set int ip table ${vpp_interface1} 7
+sudo vppctl set int ip address ${vpp_interface1} 192.168.50.76/24
 
 
-sudo vppctl create vxlan-gpe tunnel local 192.168.50.76 remote 192.168.50.71 vni 9 next-nsh encap-vrf-id 7 decap-vrf-id 7
+sudo vppctl create vxlan-gpe tunnel local 192.168.60.76 remote 192.168.60.71 vni 9 next-nsh encap-vrf-id 7 decap-vrf-id 7
 sudo vppctl set int l2 bridge vxlan_gpe_tunnel0 1 1
 
 sudo vppctl create vxlan-gpe tunnel local 192.168.50.76 remote 192.168.50.72 vni 10 next-nsh encap-vrf-id 7 decap-vrf-id 7
 sudo vppctl set int l2 bridge vxlan_gpe_tunnel0 1 1
 
 sudo vppctl create vxlan-gpe tunnel local 192.168.50.76 remote 192.168.50.72 vni 10 next-nsh encap-vrf-id 7 decap-vrf-id 7
@@ -24,9 +29,14 @@ vxlan_gpe_index0=`sudo vppctl sh int | grep "vxlan_gpe_tunnel0" | awk '{print $2
 vxlan_gpe_index1=`sudo vppctl sh int | grep "vxlan_gpe_tunnel1" | awk '{print $2}'`
 sudo vppctl create nsh map nsp 185 nsi 255 mapped-nsp 185 mapped-nsi 254 nsh_action swap encap-vxlan-gpe-intf ${vxlan_gpe_index0}
 
 vxlan_gpe_index1=`sudo vppctl sh int | grep "vxlan_gpe_tunnel1" | awk '{print $2}'`
 sudo vppctl create nsh map nsp 185 nsi 255 mapped-nsp 185 mapped-nsi 254 nsh_action swap encap-vxlan-gpe-intf ${vxlan_gpe_index0}
 
-sudo vppctl ip route add 192.168.50.71/32 via 192.168.50.76 $1
-sudo vppctl ip route add 192.168.50.72/32 via 192.168.50.76 $1
-sudo vppctl set ip arp fib-id 7 $1 192.168.50.71 $2
-sudo vppctl set ip arp fib-id 7 $1 192.168.50.72 $2
+sudo vppctl ip route add 192.168.50.72/32 via 192.168.50.76 ${vpp_interface1}
+
+sudo vppctl set int state ${vpp_interface2} up
+sleep 10
+sudo vppctl set int ip table ${vpp_interface2} 7
+sudo vppctl set int ip address ${vpp_interface2} 192.168.60.76/24
+
+sudo vppctl ip route add 192.168.60.71/32 via 192.168.60.76 ${vpp_interface2}
+sudo vppctl set ip arp fib-id 7 ${vpp_interface2} 192.168.60.71 ${vpp_intf2_adj_mac}
 
 sudo vppctl trace add dpdk-input 100
 
 sudo vppctl trace add dpdk-input 100
diff --git a/tests/nsh_sfc/sfc_scripts/start_tcpdump.sh b/tests/nsh_sfc/sfc_scripts/start_tcpdump.sh
deleted file mode 100755 (executable)
index 46f8217..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-ROOTDIR=/tmp/openvpp-testing
-PWDDIR=$(pwd)
-
-cd ${ROOTDIR}/nsh_sfc_tests/sfc_scripts/
-sudo rm -f temp_packet.pcap
-
-sudo /usr/sbin/tcpdump -i $1 -c 1 -w temp_packet.pcap dst host $2 &
-
-if [ ! $? -eq 0 ]; then
-    echo "Start the tcpdump failed!!!"
-    exit 1
-fi
-
-cd ${PWDDIR}