Add library for set path variables for testing.
[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 | ...
32 | ... | Test suite uses 3-node topology TG - DUT1 - DUT2 - TG
33 | ... | with one link between nodes where DUT2 has xconnect.
34 | ... | Test packets are sent only in one direction with COP set either as
35 | ... | whitelist or blacklist. Subsequently, packet's IP src/dst and
36 | ... | MAC addresses are checked.
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 | VPP permits packets based on IPv6 src addr
64 | | [Documentation] | COP Whitelist test with basic setup.
65 | | Given Path for 3-node testing is set
66 | | ... | ${tg_node} | ${dut1_node} | ${dut2_node} | ${tg_node}
67 | | And Interfaces in 3-node path are up
68 | | And L2 setup xconnect on DUT
69 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_tg}
70 | | And VPP Set IF IPv6 Addr
71 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip} | ${ip_prefix}
72 | | And VPP Set IF IPv6 Addr
73 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip} | ${ip_prefix}
74 | | And VPP Set IF IPv6 Addr
75 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_if1_ip} | ${ip_prefix}
76 | | And VPP Set IF IPv6 Addr
77 | | ... | ${dut2_node} | ${dut2_to_tg} | ${dut2_if2_ip} | ${ip_prefix}
78 | | And Add IP Neighbor
79 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip_GW} | ${tg_to_dut1_mac}
80 | | And Add IP Neighbor
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 Vpp All Ra Suppress Link Layer | ${nodes}
85 | | And Add fib table | ${dut1_node} | ${cop_dut_ip} | ${ip_prefix} |
86 | | ... | ${fib_table_number} | local
87 | | When COP Add whitelist Entry | ${dut1_node} | ${dut1_to_tg} | ip6 |
88 | | ... | ${fib_table_number}
89 | | And COP interface enable or disable | ${dut1_node} | ${dut1_to_tg} | enable
90 | | Then Send Packet And Check Headers | ${tg_node}
91 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
92 | | ... | ${dut1_to_tg_mac} | ${tg_to_dut2} | ${dut1_to_dut2_mac}
93 | | ... | ${tg_to_dut2_mac}
94
95
96 | VPP drops packets based on IPv6 src addr
97 | | [Documentation] | COP blacklist test with basic setup.
98 | | Given Path for 3-node testing is set
99 | | ... | ${tg_node} | ${dut1_node} | ${dut2_node} | ${tg_node}
100 | | And Interfaces in 3-node path are up
101 | | And L2 setup xconnect on DUT
102 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_tg}
103 | | And VPP Set IF IPv6 Addr
104 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip} | ${ip_prefix}
105 | | And VPP Set IF IPv6 Addr
106 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip} | ${ip_prefix}
107 | | And VPP Set IF IPv6 Addr
108 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_if1_ip} | ${ip_prefix}
109 | | And VPP Set IF IPv6 Addr
110 | | ... | ${dut2_node} | ${dut2_to_tg} | ${dut2_if2_ip} | ${ip_prefix}
111 | | And Add IP Neighbor
112 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip_GW} | ${tg_to_dut1_mac}
113 | | And Add IP Neighbor
114 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip_GW} | ${tg_to_dut2_mac}
115 | | And Vpp Route Add | ${dut1_node}
116 | | ... | ${test_dst_ip} | ${ip_prefix} | ${dut1_if2_ip_GW} | ${dut1_to_dut2}
117 | | And Vpp All Ra Suppress Link Layer | ${nodes}
118 | | And Add fib table | ${dut1_node}
119 | | ... | ${cop_dut_ip} | ${ip_prefix} | ${fib_table_number} | drop
120 | | When COP Add whitelist Entry
121 | | ... | ${dut1_node} | ${dut1_to_tg} | ip6 | ${fib_table_number}
122 | | And COP interface enable or disable | ${dut1_node} | ${dut1_to_tg} | enable
123 | | Then Send packet from Port to Port should failed | ${tg_node}
124 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
125 | | ... | ${dut1_to_tg_mac} | ${tg_to_dut2} | ${dut1_to_dut2_mac}
126 | | ... | ${tg_to_dut2_mac}