054e376789a65e48875e08223966f90a34d20368
[csit.git] / tests / suites / cop / cop_whitelist_blacklist_IPv6.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/ipv6.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/IPv6NodesAddr.py | ${nodes}
24 | Force Tags | HW_ENV | VM_ENV | 3_NODE_SINGLE_LINK_TOPO
25 | Suite Setup | Run Keywords | Setup all DUTs before test
26 | ...         | AND          | Setup all TGs before traffic script
27 | ...         | AND          | Update All Interface Data On All Nodes | ${nodes}
28 | Test Setup | Clear interface counters on all vpp nodes in topology | ${nodes}
29 | Test Teardown | Show packet trace on all DUTs | ${nodes}
30 | Documentation | *COP Security IPv6 Blacklist and Whitelist Tests*
31 | ...
32 | ... | *[Top] Network Topologies:* TG-DUT1-DUT2-TG 3-node circular topology
33 | ... | with single links between nodes.
34 | ... | *[Enc] Packet Encapsulations:* Eth-IPv6-ICMPv6 on all links.
35 | ... | *[Cfg] DUT configuration:* DUT1 is configured with IPv6 routing and
36 | ... | static routes. COP security white-lists are applied on DUT1 ingress
37 | ... | interface from TG. DUT2 is configured with L2XC.
38 | ... | *[Ver] TG verification:* Test ICMPv6 Echo Request packets are sent in
39 | ... | one direction by TG on link to DUT1; on receive TG verifies packets for
40 | ... | correctness and drops as applicable.
41 | ... | *[Ref] Applicable standard specifications:*
42
43 *** Variables ***
44 | ${tg_node}= | ${nodes['TG']}
45 | ${dut1_node}= | ${nodes['DUT1']}
46 | ${dut2_node}= | ${nodes['DUT2']}
47
48 | ${dut1_if1_ip}= | 3ffe:62::1
49 | ${dut1_if2_ip}= | 3ffe:63::1
50 | ${dut1_if1_ip_GW}= | 3ffe:62::2
51 | ${dut1_if2_ip_GW}= | 3ffe:63::2
52
53 | ${dut2_if1_ip}= | 3ffe:72::1
54 | ${dut2_if2_ip}= | 3ffe:73::1
55
56 | ${test_dst_ip}= | 3ffe:64::1
57 | ${test_src_ip}= | 3ffe:61::1
58
59 | ${cop_dut_ip}= | 3ffe:61::
60
61 | ${ip_prefix}= | 64
62
63 | ${nodes_ipv6_addresses}= | ${nodes_ipv6_addr}
64
65 | ${fib_table_number}= | 1
66
67 *** Test Cases ***
68 | TC01: DUT permits IPv6 pkts with COP whitelist set with IPv6 src-addr
69 | | [Documentation]
70 | | ... | [Top] TG-DUT1-DUT2-TG. [Enc] Eth-IPv6-ICMPv6. [Cfg] On DUT1 \
71 | | ... | configure interface IPv6 addresses and routes in the main
72 | | ... | routing domain, add COP whitelist on interface to TG with IPv6
73 | | ... | src-addr matching packets generated by TG; on DUT2 configure L2
74 | | ... | xconnect. [Ver] Make TG send ICMPv6 Echo Req on its interface to
75 | | ... | DUT1; verify received ICMPv6 Echo Req pkts are correct. [Ref]
76 | | Given Path for 3-node testing is set
77 | | ... | ${tg_node} | ${dut1_node} | ${dut2_node} | ${tg_node}
78 | | And Interfaces in 3-node path are up
79 | | And L2 setup xconnect on DUT
80 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_tg}
81 | | And VPP Set IF IPv6 Addr
82 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip} | ${ip_prefix}
83 | | And VPP Set IF IPv6 Addr
84 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip} | ${ip_prefix}
85 | | And VPP Set IF IPv6 Addr
86 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_if1_ip} | ${ip_prefix}
87 | | And VPP Set IF IPv6 Addr
88 | | ... | ${dut2_node} | ${dut2_to_tg} | ${dut2_if2_ip} | ${ip_prefix}
89 | | And Add IP Neighbor
90 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip_GW} | ${tg_to_dut1_mac}
91 | | And Add IP Neighbor
92 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip_GW} | ${tg_to_dut2_mac}
93 | | And Vpp Route Add | ${dut1_node}
94 | | ... | ${test_dst_ip} | ${ip_prefix} | ${dut1_if2_ip_GW} | ${dut1_to_dut2}
95 | | And Vpp All Ra Suppress Link Layer | ${nodes}
96 | | And Add fib table | ${dut1_node} | ${cop_dut_ip} | ${ip_prefix} |
97 | | ... | ${fib_table_number} | local
98 | | When COP Add whitelist Entry | ${dut1_node} | ${dut1_to_tg} | ip6 |
99 | | ... | ${fib_table_number}
100 | | And COP interface enable or disable | ${dut1_node} | ${dut1_to_tg} | enable
101 | | Then Send Packet And Check Headers | ${tg_node}
102 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
103 | | ... | ${dut1_to_tg_mac} | ${tg_to_dut2} | ${dut1_to_dut2_mac}
104 | | ... | ${tg_to_dut2_mac}
105
106 | TC02: DUT drops IPv6 pkts with COP blacklist set with IPv6 src-addr
107 | | [Documentation]
108 | | ... | [Top] TG-DUT1-DUT2-TG. [Enc] Eth-IPv6-ICMPv6. [Cfg] On DUT1 \
109 | | ... | configure interface IPv6 addresses and routes in the main
110 | | ... | routing domain, add COP blacklist on interface to TG with IPv6
111 | | ... | src-addr matching packets generated by TG; on DUT2 configure L2
112 | | ... | xconnect. [Ver] Make TG send ICMPv6 Echo Req on its interface to
113 | | ... | DUT1; verify no ICMPv6 Echo Req pkts are received. [Ref]
114 | | Given Path for 3-node testing is set
115 | | ... | ${tg_node} | ${dut1_node} | ${dut2_node} | ${tg_node}
116 | | And Interfaces in 3-node path are up
117 | | And L2 setup xconnect on DUT
118 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_tg}
119 | | And VPP Set IF IPv6 Addr
120 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip} | ${ip_prefix}
121 | | And VPP Set IF IPv6 Addr
122 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip} | ${ip_prefix}
123 | | And VPP Set IF IPv6 Addr
124 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_if1_ip} | ${ip_prefix}
125 | | And VPP Set IF IPv6 Addr
126 | | ... | ${dut2_node} | ${dut2_to_tg} | ${dut2_if2_ip} | ${ip_prefix}
127 | | And Add IP Neighbor
128 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip_GW} | ${tg_to_dut1_mac}
129 | | And Add IP Neighbor
130 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip_GW} | ${tg_to_dut2_mac}
131 | | And Vpp Route Add | ${dut1_node}
132 | | ... | ${test_dst_ip} | ${ip_prefix} | ${dut1_if2_ip_GW} | ${dut1_to_dut2}
133 | | And Vpp All Ra Suppress Link Layer | ${nodes}
134 | | And Add fib table | ${dut1_node}
135 | | ... | ${cop_dut_ip} | ${ip_prefix} | ${fib_table_number} | drop
136 | | When COP Add whitelist Entry
137 | | ... | ${dut1_node} | ${dut1_to_tg} | ip6 | ${fib_table_number}
138 | | And COP interface enable or disable | ${dut1_node} | ${dut1_to_tg} | enable
139 | | Then Send packet from Port to Port should failed | ${tg_node}
140 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
141 | | ... | ${dut1_to_tg_mac} | ${tg_to_dut2} | ${dut1_to_dut2_mac}
142 | | ... | ${tg_to_dut2_mac}