eb8be688d9e6b73c2f0ee19257f4e760acfa906e
[csit.git] / tests / func / cop_base / eth2p-ethip4-ip4base-copwhlistbase-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.Trace
16 | Library | resources.libraries.python.Cop
17 | Resource | resources/libraries/robot/default.robot
18 | Resource | resources/libraries/robot/interfaces.robot
19 | Resource | resources/libraries/robot/ipv4.robot
20 | Resource | resources/libraries/robot/traffic.robot
21 | Resource | resources/libraries/robot/testing_path.robot
22 | Resource | resources/libraries/robot/l2_xconnect.robot
23 | Variables  | resources/libraries/python/IPv4NodeAddress.py | ${nodes}
24 | Force Tags | HW_ENV | VM_ENV | 3_NODE_SINGLE_LINK_TOPO
25 | Test Setup | Func Test Setup
26 | Test Teardown | Func Test Teardown
27 | Documentation | *COP Security IPv4 Whitelist Tests*
28 | ...
29 | ... | *[Top] Network Topologies:* TG-DUT1-DUT2-TG 3-node circular topology
30 | ... | with single links between nodes.
31 | ... | *[Enc] Packet Encapsulations:* Eth-IPv4-ICMPv4 on all links.
32 | ... | *[Cfg] DUT configuration:* DUT1 is configured with IPv4 routing and
33 | ... | static routes. COP security white-lists are applied on DUT1 ingress
34 | ... | interface from TG. DUT2 is configured with L2XC.
35 | ... | *[Ver] TG verification:* Test ICMPv4 Echo Request packets are sent in
36 | ... | one direction by TG on link to DUT1; on receive TG verifies packets for
37 | ... | correctness and drops as applicable.
38 | ... | *[Ref] Applicable standard specifications:*
39
40 *** Variables ***
41 | ${tg_node}= | ${nodes['TG']}
42 | ${dut1_node}= | ${nodes['DUT1']}
43 | ${dut2_node}= | ${nodes['DUT2']}
44
45 | ${dut1_if1_ip}= | 192.168.1.1
46 | ${dut1_if2_ip}= | 192.168.2.1
47 | ${dut1_if1_ip_GW}= | 192.168.1.2
48 | ${dut1_if2_ip_GW}= | 192.168.2.2
49
50 | ${test_dst_ip}= | 32.0.0.1
51 | ${test_src_ip}= | 16.0.0.1
52
53 | ${cop_dut_ip}= | 16.0.0.0
54
55 | ${ip_prefix}= | 24
56 | ${nodes_ipv4_addresses}= | ${nodes_ipv4_addr}
57
58 | ${fib_table_number}= | 1
59
60 *** Test Cases ***
61 | TC01: DUT permits IPv4 pkts with COP whitelist set with IPv4 src-addr
62 | | [Documentation]
63 | | ... | [Top] TG-DUT1-DUT2-TG. [Enc] Eth-IPv4-ICMPv4. [Cfg] On DUT1 \
64 | | ... | configure interface IPv4 addresses and routes in the main
65 | | ... | routing domain, add COP whitelist on interface to TG with IPv4
66 | | ... | src-addr matching packets generated by TG; on DUT2 configure L2
67 | | ... | xconnect. [Ver] Make TG send ICMPv4 Echo Req on its interface to
68 | | ... | DUT1; verify received ICMPv4 Echo Req pkts are correct. [Ref]
69 | | Given Path for 3-node testing is set
70 | | ... | ${tg_node} | ${dut1_node} | ${dut2_node} | ${tg_node}
71 | | And Interfaces in 3-node path are up
72 | | And L2 setup xconnect on DUT
73 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_tg}
74 | | And Set Interface Address
75 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip} | ${ip_prefix}
76 | | And Set Interface Address
77 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip} | ${ip_prefix}
78 | | And Add Arp On Dut
79 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip_GW} | ${tg_to_dut1_mac}
80 | | And Add Arp On Dut
81 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip_GW} | ${tg_to_dut2_mac}
82 | | And Vpp Route Add | ${dut1_node}
83 | | ... | ${test_dst_ip} | ${ip_prefix} | ${dut1_if2_ip_GW} | ${dut1_to_dut2}
84 | | And Add fib table | ${dut1_node}
85 | | ... | ${cop_dut_ip} | ${ip_prefix} | ${fib_table_number} | local
86 | | When COP Add whitelist Entry
87 | | ... | ${dut1_node} | ${dut1_to_tg} | ip4 | ${fib_table_number}
88 | | And COP interface enable or disable | ${dut1_node} | ${dut1_to_tg} | enable
89 | | Then Send Packet And Check Headers | ${tg_node}
90 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
91 | | ... | ${dut1_to_tg_mac} | ${tg_to_dut2} | ${dut1_to_dut2_mac}
92 | | ... | ${tg_to_dut2_mac}