Suite: cop.
[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 Blacklist and Whitelist Tests*
31 | ... | COP tests use 3-node topology TG - DUT1 - DUT2 - TG with one
32 | ... | link between nodes. DUT1 is configured with COP whitelist or
33 | ... | blacklist on link to TG, DUT2 is configured with L2
34 | ... | xconnect. Test packets are sent in one direction by TG on
35 | ... | link to DUT1 and received on TG link to DUT2.  On receive TG
36 | ... | verifies packet IP src-addr, dst-addr and MAC addresses.
37
38 *** Variables ***
39 | ${tg_node}= | ${nodes['TG']}
40 | ${dut1_node}= | ${nodes['DUT1']}
41 | ${dut2_node}= | ${nodes['DUT2']}
42
43 | ${dut1_if1_ip}= | 3ffe:62::1
44 | ${dut1_if2_ip}= | 3ffe:63::1
45 | ${dut1_if1_ip_GW}= | 3ffe:62::2
46 | ${dut1_if2_ip_GW}= | 3ffe:63::2
47
48 | ${dut2_if1_ip}= | 3ffe:72::1
49 | ${dut2_if2_ip}= | 3ffe:73::1
50
51 | ${test_dst_ip}= | 3ffe:64::1
52 | ${test_src_ip}= | 3ffe:61::1
53
54 | ${cop_dut_ip}= | 3ffe:61::
55
56 | ${ip_prefix}= | 64
57
58 | ${nodes_ipv6_addresses}= | ${nodes_ipv6_addr}
59
60 | ${fib_table_number}= | 1
61
62 *** Test Cases ***
63 | TC03: DUT permits IPv6 pkts with COP whitelist set with IPv6 src-addr
64 | | [Documentation] | Eth-IPv6-ICMPv6 on links TG-DUT1, TG-DUT2, DUT1-DUT2: On
65 | | ...             | DUT1 configure interface IPv6 addresses and routes in the
66 | | ...             | main routing domain. Add COP whitelist with IPv6 src-addr
67 | | ...             | matching packets generated by TG. On DUT2 configure L2
68 | | ...             | xconnect. Make TG send ICMPv6 Echo Req on its interface to
69 | | ...             | DUT1. Make TG verify received ICMPv6 Echo Replies are
70 | | ...             | correct.
71 | | Given Path for 3-node testing is set
72 | | ... | ${tg_node} | ${dut1_node} | ${dut2_node} | ${tg_node}
73 | | And Interfaces in 3-node path are up
74 | | And L2 setup xconnect on DUT
75 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_tg}
76 | | And VPP Set IF IPv6 Addr
77 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip} | ${ip_prefix}
78 | | And VPP Set IF IPv6 Addr
79 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip} | ${ip_prefix}
80 | | And VPP Set IF IPv6 Addr
81 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_if1_ip} | ${ip_prefix}
82 | | And VPP Set IF IPv6 Addr
83 | | ... | ${dut2_node} | ${dut2_to_tg} | ${dut2_if2_ip} | ${ip_prefix}
84 | | And Add IP Neighbor
85 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip_GW} | ${tg_to_dut1_mac}
86 | | And Add IP Neighbor
87 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip_GW} | ${tg_to_dut2_mac}
88 | | And Vpp Route Add | ${dut1_node}
89 | | ... | ${test_dst_ip} | ${ip_prefix} | ${dut1_if2_ip_GW} | ${dut1_to_dut2}
90 | | And Vpp All Ra Suppress Link Layer | ${nodes}
91 | | And Add fib table | ${dut1_node} | ${cop_dut_ip} | ${ip_prefix} |
92 | | ... | ${fib_table_number} | local
93 | | When COP Add whitelist Entry | ${dut1_node} | ${dut1_to_tg} | ip6 |
94 | | ... | ${fib_table_number}
95 | | And COP interface enable or disable | ${dut1_node} | ${dut1_to_tg} | enable
96 | | Then Send Packet And Check Headers | ${tg_node}
97 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
98 | | ... | ${dut1_to_tg_mac} | ${tg_to_dut2} | ${dut1_to_dut2_mac}
99 | | ... | ${tg_to_dut2_mac}
100
101 | TC04: DUT drops IPv6 pkts with COP blacklist set with IPv6 src-addr
102 | | [Documentation] | Eth-IPv6-ICMPv6 on links TG-DUT1, TG-DUT2, DUT1-DUT2: On
103 | | ...             | DUT1 configure interface IPv6 addresses and routes in the
104 | | ...             | main routing domain. Add COP blacklist with IPv6 src-addr
105 | | ...             | matching packets generated by TG. On DUT2 configure L2
106 | | ...             | xconnect. Make TG send ICMPv6 Echo Req on its interface to
107 | | ...             | DUT1. Make TG verify blacklisted ICMPv6 Echo Replies are
108 | | ...             | dropped.
109 | | Given Path for 3-node testing is set
110 | | ... | ${tg_node} | ${dut1_node} | ${dut2_node} | ${tg_node}
111 | | And Interfaces in 3-node path are up
112 | | And L2 setup xconnect on DUT
113 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_tg}
114 | | And VPP Set IF IPv6 Addr
115 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip} | ${ip_prefix}
116 | | And VPP Set IF IPv6 Addr
117 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip} | ${ip_prefix}
118 | | And VPP Set IF IPv6 Addr
119 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_if1_ip} | ${ip_prefix}
120 | | And VPP Set IF IPv6 Addr
121 | | ... | ${dut2_node} | ${dut2_to_tg} | ${dut2_if2_ip} | ${ip_prefix}
122 | | And Add IP Neighbor
123 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip_GW} | ${tg_to_dut1_mac}
124 | | And Add IP Neighbor
125 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip_GW} | ${tg_to_dut2_mac}
126 | | And Vpp Route Add | ${dut1_node}
127 | | ... | ${test_dst_ip} | ${ip_prefix} | ${dut1_if2_ip_GW} | ${dut1_to_dut2}
128 | | And Vpp All Ra Suppress Link Layer | ${nodes}
129 | | And Add fib table | ${dut1_node}
130 | | ... | ${cop_dut_ip} | ${ip_prefix} | ${fib_table_number} | drop
131 | | When COP Add whitelist Entry
132 | | ... | ${dut1_node} | ${dut1_to_tg} | ip6 | ${fib_table_number}
133 | | And COP interface enable or disable | ${dut1_node} | ${dut1_to_tg} | enable
134 | | Then Send packet from Port to Port should failed | ${tg_node}
135 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
136 | | ... | ${dut1_to_tg_mac} | ${tg_to_dut2} | ${dut1_to_dut2_mac}
137 | | ... | ${tg_to_dut2_mac}