Convert functional tests to statefull QemuUtils
[csit.git] / tests / vpp / func / crypto / default / eth2p-ethip6ipsectptlispgpe-ip4base-func.robot
1 # Copyright (c) 2016 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 *** Settings ***
15 | Library | resources.libraries.python.topology.Topology
16 | Library | resources.libraries.python.NodePath
17 | Library | resources.libraries.python.Trace
18 | Library | resources.libraries.python.IPUtil
19 | Library | resources.libraries.python.L2Util
20 | Library | resources.libraries.python.LispUtil
21 | Library | resources.libraries.python.IPsecUtil
22 | Library | resources.libraries.python.VatJsonUtil
23 | Library | resources.libraries.python.IPv6Setup
24 | Library | String
25 | Resource | resources/libraries/robot/shared/traffic.robot
26 | Resource | resources/libraries/robot/shared/default.robot
27 | Resource | resources/libraries/robot/shared/interfaces.robot
28 | Resource | resources/libraries/robot/shared/testing_path.robot
29 | Resource | resources/libraries/robot/ip/ip6.robot
30 | Resource | resources/libraries/robot/crypto/ipsec.robot
31 | Resource | resources/libraries/robot/overlay/lispgpe.robot
32 | Resource | resources/libraries/robot/l2/l2_bridge_domain.robot
33 # Import configuration and test data:
34 | Variables | resources/test_data/lisp/ipv4_lispgpe_ipv6/ipv4_lispgpe_ipsec_ipv6.py
35 | ...
36 | Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | LISP | SKIP_VPP_PATCH
37 | ...
38 | Test Setup | Set up functional test
39 | ...
40 | Test Teardown | Tear down functional test
41 | ...
42 | Documentation | *IPv6 - ip4-ipsec-lispgpe-ip6 - main fib, virt2lisp, phy2lisp*
43 | ...
44 | ... | *[Top] Network Topologies:* TG-DUT1-DUT2-TG 3-node circular topology\
45 | ... | with single links between nodes.
46 | ... | *[Enc] Packet Encapsulations:* Eth-IPv6-LISPGPE-IPSec-IPv4-ICMP,\
47 | ... | Eth-IPv6-IPSec-LISPGPE-IPv4-ICMP
48 | ... | *[Cfg] DUT configuration:* Each DUT is configured with LISP and IPsec.\
49 | ... | IPsec is in transport mode. Tests cases are for IPsec configured both\
50 | ... | on RLOC interface or lisp_gpe0 interface.
51 | ... | *[Ver] TG verification:* Packet is send from TG(if1) across the DUT1 to\
52 | ... | DUT2 where it is forwarded to TG(if2).
53 | ... | *[Ref] Applicable standard specifications:* RFC6830, RFC4303.
54
55 *** Test Cases ***
56 | TC01: DUT1 and DUT2 route IPv4 bidirectionally over LISP GPE tunnel using IPsec (transport) on RLOC Int.
57 | | [Documentation]
58 | | ... | [Top] TG-DUT1-DUT2-TG.
59 | | ... | [Enc] Eth-IPv6-LISPGPE-IPSec-IPv4-ICMP on DUT1-DUT2, Eth-IPv4-ICMP\
60 | | ... | on TG-DUTn.
61 | | ... | [Cfg] Configure IPv6 LISP static adjacencies on DUT1 and DUT2 with\
62 | | ... | IPsec in between DUTS.
63 | | ... | [Ver] Make TG send ICMPv6 Echo Req between its interfaces across\
64 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv4 headers on\
65 | | ... | received packets are correct.
66 | | ... | [Ref] RFC6830, RFC4303.
67 | | ...
68 | | ${encr_alg}= | Crypto Alg AES CBC 128
69 | | ${auth_alg}= | Integ Alg SHA1 96
70 | | Given Setup Topology And Lisp
71 | | And Generate keys for IPSec | ${encr_alg} | ${auth_alg}
72 | | When Configure manual keyed connection for IPSec
73 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${encr_alg} | ${encr_key}
74 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
75 | | ... | ${dut1_to_dut2_ip6} | ${dut2_to_dut1_ip6}
76 | | And Configure manual keyed connection for IPSec
77 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${encr_alg} | ${encr_key}
78 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
79 | | ... | ${dut2_to_dut1_ip6} | ${dut1_to_dut2_ip6}
80 | | Then Send packet and verify headers
81 | | ... | ${tg_node} | ${tg1_ip4} | ${tg2_ip4}
82 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dut1_to_tg_mac}
83 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
84 | | And Send packet and verify headers
85 | | ... | ${tg_node} | ${tg2_ip4} | ${tg1_ip4}
86 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
87 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
88
89 | TC02: DUT1 and DUT2 route IPv4 bidirectionally over LISP GPE tunnel using IPsec (transport) on lisp_gpe0 Int.
90 | | [Documentation]
91 | | ... | [Top] TG-DUT1-DUT2-TG.
92 | | ... | [Enc] Eth-IPv6-IPSec-LISPGPE-IPv4-ICMPv4 on DUT1-DUT2, Eth-IPv4-ICMP\
93 | | ... | on TG-DUTn.
94 | | ... | [Cfg] Configure IPv6 LISP static adjacencies on DUT1 and DUT2 with\
95 | | ... | IPsec in between DUTS.
96 | | ... | [Ver] Make TG send ICMPv6 Echo Req between its interfaces across\
97 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv4 headers on\
98 | | ... | received packets are correct.
99 | | ... | [Ref] RFC6830, RFC4303.
100 | | ...
101 | | ${encr_alg}= | Crypto Alg AES CBC 128
102 | | ${auth_alg}= | Integ Alg SHA1 96
103 | | Given Setup Topology And Lisp
104 | | And Generate keys for IPSec | ${encr_alg} | ${auth_alg}
105 | | ${lisp_if_idx}= | resources.libraries.python.InterfaceUtil.get sw if index
106 | | ... | ${dut1_node} | ${lisp_gpe_int}
107 | | When Configure manual keyed connection for IPSec
108 | | ... | ${dut1_node} | ${lisp_if_idx} | ${encr_alg} | ${encr_key}
109 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
110 | | ... | ${dut1_to_dut2_ip6} | ${dut2_to_dut1_ip6}
111 | | And Configure manual keyed connection for IPSec
112 | | ... | ${dut2_node} | ${lisp_if_idx} | ${encr_alg} | ${encr_key}
113 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
114 | | ... | ${dut2_to_dut1_ip6} | ${dut1_to_dut2_ip6}
115 | | Then Send packet and verify headers
116 | | ... | ${tg_node} | ${tg1_ip4} | ${tg2_ip4}
117 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dut1_to_tg_mac}
118 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
119 | | And Send packet and verify headers
120 | | ... | ${tg_node} | ${tg2_ip4} | ${tg1_ip4}
121 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
122 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
123
124 *** Keywords ***
125 | Setup Topology And Lisp
126 | | [Documentation] | Setup IPs and neighbors for interfaces on DUT1 and DUT2\
127 | | ... | and then setup LISP.
128 | | Configure path in 3-node circular topology
129 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
130 | | Set interfaces in 3-node circular topology up
131 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip6}
132 | | ... | ${prefix6}
133 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip6}
134 | | ... | ${prefix6}
135 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_tg} | ${dut1_to_tg_ip4}
136 | | ... | ${prefix4}
137 | | Vpp Set If IPv6 Addr | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_dut1_ip6}
138 | | ... | ${prefix6}
139 | | Vpp Set If IPv6 Addr | ${dut2_node} | ${dut2_to_tg} | ${dut2_to_tg_ip4}
140 | | ... | ${prefix4}
141 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_tg} | ${tg2_ip4}
142 | | ... | ${tg_to_dut2_mac}
143 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_dut2} | ${dut2_to_dut1_ip6}
144 | | ... | ${dut2_to_dut1_mac}
145 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_dut1} | ${dut1_to_dut2_ip6}
146 | | ... | ${dut1_to_dut2_mac}
147 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg1_ip4}
148 | | ... | ${tg_to_dut1_mac}
149 | | Vpp All RA Suppress Link Layer | ${nodes}
150 | | Configure LISP GPE topology in 3-node circular topology
151 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
152 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
153 | | ... | ${duts_locator_set} | ${dut1_ip4_eid} | ${dut2_ip4_eid}
154 | | ... | ${dut1_to_dut2_ip_static_adjacency}
155 | | ... | ${dut2_to_dut1_ip_static_adjacency}