From 050ece3a87fbbad7d04e69ed951c48118edf0a89 Mon Sep 17 00:00:00 2001 From: Fangyin Hu Date: Mon, 26 Jun 2017 20:34:56 -0700 Subject: 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 --- .../traffic_scripts/send_tcp_for_classifier_test.py | 17 +++++++++++++---- resources/traffic_scripts/send_vxlan_for_proxy_test.py | 17 +++++++++++++---- .../traffic_scripts/send_vxlangpe_nsh_for_proxy_test.py | 17 +++++++++++++---- .../traffic_scripts/send_vxlangpe_nsh_for_sff_test.py | 17 +++++++++++++---- 4 files changed, 52 insertions(+), 16 deletions(-) (limited to 'resources/traffic_scripts') diff --git a/resources/traffic_scripts/send_tcp_for_classifier_test.py b/resources/traffic_scripts/send_tcp_for_classifier_test.py index f08816eaae..5d8d387767 100755 --- a/resources/traffic_scripts/send_tcp_for_classifier_test.py +++ b/resources/traffic_scripts/send_tcp_for_classifier_test.py @@ -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.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.PacketVerifier import RxQueue, TxQueue from robot.api import logger @@ -49,6 +49,10 @@ def main(): 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 @@ -71,12 +75,17 @@ def main(): 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 - 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) diff --git a/resources/traffic_scripts/send_vxlan_for_proxy_test.py b/resources/traffic_scripts/send_vxlan_for_proxy_test.py index 4087c7f6d8..c356e1977e 100755 --- a/resources/traffic_scripts/send_vxlan_for_proxy_test.py +++ b/resources/traffic_scripts/send_vxlan_for_proxy_test.py @@ -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.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.PacketVerifier import RxQueue, TxQueue from robot.api import logger @@ -48,6 +48,10 @@ def main(): 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 @@ -79,12 +83,17 @@ def main(): 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 - 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) diff --git a/resources/traffic_scripts/send_vxlangpe_nsh_for_proxy_test.py b/resources/traffic_scripts/send_vxlangpe_nsh_for_proxy_test.py index ea1f9b15a7..d998d7c6a0 100755 --- a/resources/traffic_scripts/send_vxlangpe_nsh_for_proxy_test.py +++ b/resources/traffic_scripts/send_vxlangpe_nsh_for_proxy_test.py @@ -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.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.PacketVerifier import RxQueue, TxQueue from robot.api import logger @@ -48,6 +48,10 @@ def main(): 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 @@ -81,12 +85,17 @@ def main(): 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 - 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) diff --git a/resources/traffic_scripts/send_vxlangpe_nsh_for_sff_test.py b/resources/traffic_scripts/send_vxlangpe_nsh_for_sff_test.py index b82e2a8938..55c06f0691 100755 --- a/resources/traffic_scripts/send_vxlangpe_nsh_for_sff_test.py +++ b/resources/traffic_scripts/send_vxlangpe_nsh_for_sff_test.py @@ -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.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.PacketVerifier import RxQueue, TxQueue from robot.api import logger @@ -48,6 +48,10 @@ def main(): 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 @@ -81,12 +85,17 @@ def main(): 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 - 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) -- cgit 1.2.3-korg