Convert functional tests to statefull QemuUtils
[csit.git] / tests / vpp / func / crypto / default / eth2p-ethip6ipsectptlispgpe-ip6base-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.VPPUtil
22 | Library | resources.libraries.python.IPsecUtil
23 | Library | resources.libraries.python.VatJsonUtil
24 | Library | resources.libraries.python.IPv6Setup
25 | Library | String
26 | Resource | resources/libraries/robot/shared/traffic.robot
27 | Resource | resources/libraries/robot/shared/default.robot
28 | Resource | resources/libraries/robot/shared/interfaces.robot
29 | Resource | resources/libraries/robot/shared/testing_path.robot
30 | Resource | resources/libraries/robot/ip/ip6.robot
31 | Resource | resources/libraries/robot/crypto/ipsec.robot
32 | Resource | resources/libraries/robot/overlay/lispgpe.robot
33 | Resource | resources/libraries/robot/l2/l2_bridge_domain.robot
34 # Import configuration and test data:
35 | Variables | resources/test_data/lisp/ipv6_lispgpe_ipv6/ipv6_lispgpe_ipsec_ipv6.py
36 | ...
37 | Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | LISP | SKIP_VPP_PATCH
38 | ...
39 | Test Setup | Run Keywords | Set up functional test
40 | ...        | AND          | Vpp All Ra Suppress Link Layer | ${nodes}
41 | ...
42 | Test Teardown | Tear down functional test
43 | ...
44 | Documentation | *IPv6 - ip6-ipsec-lispgpe-ip6 - main fib,
45 | ... | vrf (gpe_vni-to-vrf), phy2lisp, virt2lisp*
46 | ...
47 | ... | *[Top] Network Topologies:* TG-DUT1-DUT2-TG 3-node circular topology\
48 | ... | with single links between nodes.
49 | ... | *[Enc] Packet Encapsulations:* Eth-IPv6-IPSec-LISPGPE-IPv6-ICMPv6,\
50 | ... | *[Cfg] DUT configuration:* Each DUT is configured with LISP and IPsec.\
51 | ... | IPsec is in transport mode. Tests cases are for IPsec configured both\
52 | ... | on RLOC interface or lisp_gpe0 interface.
53 | ... | *[Ver] TG verification:* Packet is send from TG(if1) across the DUT1\
54 | ... | to DUT2 where it is forwarded to TG(if2).
55 | ... | *[Ref] Applicable standard specifications:* RFC6830, RFC4303.
56
57 *** Variables ***
58 | ${dut2_spi}= | ${1000}
59 | ${dut1_spi}= | ${1001}
60
61 | ${ESP_PROTO}= | ${50}
62
63 | ${bid}= | 10
64
65 *** Test Cases ***
66 | TC01: DUT1 and DUT2 route IPv6 bidirectionally over LISP GPE tunnel using IPsec (transport) on RLOC Int.
67 | | [Documentation]
68 | | ... | [Top] TG-DUT1-DUT2-TG.
69 | | ... | [Enc] Eth-IPv6-IPSec-LISPGPE-IPv6-ICMPv6 on DUT1-DUT2,\
70 | | ... | Eth-IPv6-ICMPv6 on TG-DUTn.
71 | | ... | [Cfg] Configure IPv6 LISP static adjacencies on DUT1 and DUT2 with\
72 | | ... | IPsec in between DUTS.
73 | | ... | [Ver] Case: ip6-lispgpe-ipsec-ip6 - main fib, phys2lisp\
74 | | ... | Make TG send ICMPv6 Echo Req between its interfaces across\
75 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv6 headers on\
76 | | ... | received packets are correct.
77 | | ... | [Ref] RFC6830, RFC4303.
78 | | ...
79 | | ${encr_alg}= | Crypto Alg AES CBC 128
80 | | ${auth_alg}= | Integ Alg SHA1 96
81 | | Given Setup Topology
82 | | And Configure LISP GPE topology in 3-node circular topology
83 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
84 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
85 | | ... | ${duts_locator_set} | ${dut1_ip6_eid} | ${dut2_ip6_eid}
86 | | ... | ${dut1_to_dut2_ip6_static_adjacency}
87 | | ... | ${dut2_to_dut1_ip6_static_adjacency}
88 | | And Generate keys for IPSec | ${encr_alg} | ${auth_alg}
89 | | When Configure manual keyed connection for IPSec
90 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${encr_alg} | ${encr_key}
91 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
92 | | ... | ${dut1_to_dut2_ip6} | ${dut2_to_dut1_ip6}
93 | | And Configure manual keyed connection for IPSec
94 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${encr_alg} | ${encr_key}
95 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
96 | | ... | ${dut2_to_dut1_ip6} | ${dut1_to_dut2_ip6}
97 | | Then Send packet and verify headers
98 | | ... | ${tg_node} | ${tg1_ip6} | ${tg2_ip6}
99 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dut1_to_tg_mac}
100 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
101 | | And Send packet and verify headers
102 | | ... | ${tg_node} | ${tg2_ip6} | ${tg1_ip6}
103 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
104 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
105
106 | TC02: DUT1 and DUT2 route IPv6 bidirectionally over LISP GPE tunnel using IPsec (transport) lisp_gpe0 Int.
107 | | [Documentation]
108 | | ... | [Top] TG-DUT1-DUT2-TG.
109 | | ... | [Enc] Eth-IPv6-IPSec-LISPGPE-IPv6-ICMPv6 on DUT1-DUT2,\
110 | | ... | Eth-IPv6-ICMPv6 on TG-DUTn.
111 | | ... | [Cfg] Configure IPv6 LISP static adjacencies on DUT1 and DUT2 with\
112 | | ... | IPsec in between DUTS.
113 | | ... | [Ver] Case: ip6-ipsec-lispgpe-ip6 - main fib, phys2lisp\
114 | | ... | Make TG send ICMPv6 Echo Req between its interfaces across\
115 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv6 headers on\
116 | | ... | received packets are correct.
117 | | ... | [Ref] RFC6830, RFC4303.
118 | | ...
119 | | ${encr_alg}= | Crypto Alg AES CBC 128
120 | | ${auth_alg}= | Integ Alg SHA1 96
121 | | Given Setup Topology
122 | | And Configure LISP GPE topology in 3-node circular topology
123 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
124 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
125 | | ... | ${duts_locator_set} | ${dut1_ip6_eid} | ${dut2_ip6_eid}
126 | | ... | ${dut1_to_dut2_ip6_static_adjacency}
127 | | ... | ${dut2_to_dut1_ip6_static_adjacency}
128 | | ${lisp_if_idx}= | resources.libraries.python.InterfaceUtil.get sw if index
129 | | ... | ${dut1_node} | lisp_gpe0
130 | | And Generate keys for IPSec | ${encr_alg} | ${auth_alg}
131 | | When Configure manual keyed connection for IPSec
132 | | ... | ${dut1_node} | ${lisp_if_idx} | ${encr_alg} | ${encr_key}
133 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi} | ${tg1_ip6}
134 | | ... | ${tg2_ip6}
135 | | And Configure manual keyed connection for IPSec
136 | | ... | ${dut2_node} | ${lisp_if_idx} | ${encr_alg} | ${encr_key}
137 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi} | ${tg2_ip6}
138 | | ... | ${tg1_ip6}
139 | | Then Send packet and verify headers
140 | | ... | ${tg_node} | ${tg1_ip6} | ${tg2_ip6}
141 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dut1_to_tg_mac}
142 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
143 | | And Send packet and verify headers
144 | | ... | ${tg_node} | ${tg2_ip6} | ${tg1_ip6}
145 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
146 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
147
148 *** Keywords ***
149 | Setup Topology
150 | | Configure path in 3-node circular topology
151 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
152 | | Set interfaces in 3-node circular topology up
153 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip6}
154 | | ... | ${prefix6}
155 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip6}
156 | | ... | ${prefix6}
157 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_tg} | ${dut1_to_tg_ip6}
158 | | ... | ${prefix6}
159 | | Vpp Set If IPv6 Addr | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_dut1_ip6}
160 | | ... | ${prefix6}
161 | | Vpp Set If IPv6 Addr | ${dut2_node} | ${dut2_to_tg} | ${dut2_to_tg_ip6}
162 | | ... | ${prefix6}
163 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg1_ip6}
164 | | ... | ${tg_to_dut1_mac}
165 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_tg} | ${tg2_ip6}
166 | | ... | ${tg_to_dut2_mac}
167 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_dut2} | ${dut2_to_dut1_ip6}
168 | | ... | ${dut2_to_dut1_mac}
169 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_dut1} | ${dut1_to_dut2_ip6}
170 | | ... | ${dut1_to_dut2_mac}
171 | | Vpp All RA Suppress Link Layer | ${nodes}