aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
authorJan Gelety <jgelety@cisco.com>2016-08-29 11:02:37 +0200
committerJan Gelety <jgelety@cisco.com>2016-09-12 15:07:07 +0000
commitb4224131bb93d12c953739bb31b87165a375cba2 (patch)
treeba55c9dc800dfbf864279b58d58b556e49cfeb0b /resources
parenta2dccaa0fe388b685a787fe10902a5fb01c873da (diff)
CSIT-383: IPSEC IPv4 negative test cases
- use integrity and/or encryption key(s) different from integrity and encryption keys stored on VPP node to create tx packet on TG Change-Id: I38bf7e1dd6f488e605bad991c7a7f4d1ff226e8c Signed-off-by: Jan Gelety <jgelety@cisco.com> (cherry picked from commit cdfe60613521e492157153bbe097fdc05193a593)
Diffstat (limited to 'resources')
-rw-r--r--resources/libraries/python/IPsecUtil.py14
-rw-r--r--resources/libraries/python/TrafficScriptExecutor.py2
-rw-r--r--resources/libraries/robot/default.robot7
-rwxr-xr-xresources/traffic_scripts/ipsec.py4
4 files changed, 16 insertions, 11 deletions
diff --git a/resources/libraries/python/IPsecUtil.py b/resources/libraries/python/IPsecUtil.py
index 6cbd48fba3..e033e04b48 100644
--- a/resources/libraries/python/IPsecUtil.py
+++ b/resources/libraries/python/IPsecUtil.py
@@ -227,10 +227,9 @@ class IPsecUtil(object):
"""
ckey = crypto_key.encode('hex')
ikey = integ_key.encode('hex')
- tunnel = ''
- if tunnel_src is not None and tunnel_dst is not None:
- tunnel = 'tunnel_src {0} tunnel_dst {1}'.format(tunnel_src,
- tunnel_dst)
+ tunnel = 'tunnel_src {0} tunnel_dst {1}'.format(tunnel_src, tunnel_dst)\
+ if tunnel_src is not None and tunnel_dst is not None else ''
+
out = VatExecutor.cmd_from_template(node,
"ipsec/ipsec_sad_add_entry.vat",
sad_id=sad_id, spi=spi,
@@ -267,10 +266,9 @@ class IPsecUtil(object):
:type spd_id: int
:type interface: str or int
"""
- if isinstance(interface, basestring):
- sw_if_index = Topology.get_interface_sw_index(node, interface)
- else:
- sw_if_index = interface
+ sw_if_index = Topology.get_interface_sw_index(node, interface)\
+ if isinstance(interface, basestring) else interface
+
out = VatExecutor.cmd_from_template(node,
"ipsec/ipsec_interface_add_spd.vat",
spd_id=spd_id, sw_if_id=sw_if_index)
diff --git a/resources/libraries/python/TrafficScriptExecutor.py b/resources/libraries/python/TrafficScriptExecutor.py
index a362f45066..33b3d6d520 100644
--- a/resources/libraries/python/TrafficScriptExecutor.py
+++ b/resources/libraries/python/TrafficScriptExecutor.py
@@ -81,6 +81,8 @@ class TrafficScriptExecutor(object):
raise RuntimeError("TCP/UDP Rx timeout")
elif "Error occurred: ARP reply timeout" in stdout:
raise RuntimeError("ARP reply timeout")
+ elif "RuntimeError: ESP packet Rx timeout" in stderr:
+ raise RuntimeError("ESP packet Rx timeout")
else:
raise RuntimeError("Traffic script execution failed")
diff --git a/resources/libraries/robot/default.robot b/resources/libraries/robot/default.robot
index 742906e94a..714bf3a251 100644
--- a/resources/libraries/robot/default.robot
+++ b/resources/libraries/robot/default.robot
@@ -18,6 +18,7 @@
| Library | resources.libraries.python.DUTSetup
| Library | resources.libraries.python.TGSetup
| Library | resources/libraries/python/VppConfigGenerator.py
+| Library | resources/libraries/python/VppCounters.py
| Library | Collections
*** Keywords ***
@@ -35,6 +36,12 @@
| | :FOR | ${dut} | IN | @{duts}
| | | Vpp show version verbose | ${nodes['${dut}']}
+| Show Vpp Errors on All DUTs
+| | [Documentation] | Show VPP errors verbose on all DUTs
+| | ${duts}= | Get Matches | ${nodes} | DUT*
+| | :FOR | ${dut} | IN | @{duts}
+| | | Vpp Show Errors | ${nodes['${dut}']}
+
| Show vpp trace dump on all DUTs
| | [Documentation] | Save API trace and dump output on all DUTs
| | ${duts}= | Get Matches | ${nodes} | DUT*
diff --git a/resources/traffic_scripts/ipsec.py b/resources/traffic_scripts/ipsec.py
index ff869ed2a0..13d44b8a51 100755
--- a/resources/traffic_scripts/ipsec.py
+++ b/resources/traffic_scripts/ipsec.py
@@ -174,8 +174,6 @@ def main():
sent_packets = []
- ip_pkt = None
-
if is_ipv4:
ip_pkt = IP(src=src_ip, dst=dst_ip) / \
ICMP()
@@ -195,7 +193,7 @@ def main():
pkt_recv = rxq.recv(2, sent_packets)
if pkt_recv is None:
- raise RuntimeError('Rx timeout')
+ raise RuntimeError('ESP packet Rx timeout')
if is_ipv4:
check_ipv4(pkt_recv, src_tun, dst_ip, src_ip, sa_in)