a48ae01475cc16fcbad582bb359fc5dfff831228
[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.topology.Topology
16 | Library | resources.libraries.python.NodePath
17 | Library | resources.libraries.python.Trace
18 | Resource | resources/libraries/robot/default.robot
19 | Resource | resources/libraries/robot/interfaces.robot
20 | Resource | resources/libraries/robot/ipv6.robot
21 | Resource | resources/libraries/robot/ipv4.robot
22 | Resource | resources/libraries/robot/traffic.robot
23 | Resource | resources/libraries/robot/cop.robot
24 | Resource | resources/libraries/robot/l2_xconnect.robot
25 | Variables  | resources/libraries/python/IPv6NodesAddr.py | ${nodes}
26 | Force Tags | HW_ENV | VM_ENV | 3_NODE_SINGLE_LINK_TOPO
27 | Suite Setup | Run Keywords | Setup all DUTs before test
28 | ...         | AND          | Setup all TGs before traffic script
29 | ...         | AND          | Update All Interface Data On All Nodes | ${nodes}
30 | Test Setup | Clear interface counters on all vpp nodes in topology | ${nodes}
31 | Test Teardown | Show packet trace on all DUTs | ${nodes}
32 | Documentation | *COP Blacklist and Whitelist Tests*
33 | ...
34 | ... | Test suite uses 3-node topology TG - DUT1 - DUT2 - TG
35 | ... | with one link between nodes where DUT2 has xconnect.
36 | ... | Test packets are sent only in one direction with COP set either as
37 | ... | whitelist or blacklist. Subsequently, packet's IP src/dst and
38 | ... | MAC addresses are checked.
39
40 *** Variables ***
41 | ${tg_node}= | ${nodes['TG']}
42 | ${dut1_node}= | ${nodes['DUT1']}
43 | ${dut2_node}= | ${nodes['DUT2']}
44
45 | ${dut1_if1_ip}= | 3ffe:62::1
46 | ${dut1_if2_ip}= | 3ffe:63::1
47 | ${dut1_if1_ip_GW}= | 3ffe:62::2
48 | ${dut1_if2_ip_GW}= | 3ffe:63::2
49
50 | ${dut2_if1_ip}= | 3ffe:72::1
51 | ${dut2_if2_ip}= | 3ffe:73::1
52
53 | ${test_dst_ip}= | 3ffe:64::1
54 | ${test_src_ip}= | 3ffe:61::1
55
56 | ${cop_dut_ip}= | 3ffe:61::
57
58 | ${ip_prefix}= | 64
59
60 | ${nodes_ipv6_addresses}= | ${nodes_ipv6_addr}
61
62 | ${fib_table_number}= | 1
63
64 *** Test Cases ***
65 | VPP permits packets based on IPv6 src addr
66 | | [Documentation] | COP Whitelist test with basic setup.
67 | | Given Setup Nodes And Variables | ${tg_node} | ${dut1_node} | ${dut2_node}
68 | | And L2 setup xconnect on DUT | ${dut2_node} | ${dut2_if1} | ${dut2_if2}
69 | | And VPP Set IF IPv6 Addr
70 | | ... | ${dut1_node} | ${dut1_if1} | ${dut1_if1_ip} | ${ip_prefix}
71 | | And VPP Set IF IPv6 Addr
72 | | ... | ${dut1_node} | ${dut1_if2} | ${dut1_if2_ip} | ${ip_prefix}
73 | | And VPP Set IF IPv6 Addr
74 | | ... | ${dut2_node} | ${dut2_if1} | ${dut2_if1_ip} | ${ip_prefix}
75 | | And VPP Set IF IPv6 Addr
76 | | ... | ${dut2_node} | ${dut2_if2} | ${dut2_if2_ip} | ${ip_prefix}
77 | | And Add Arp On Dut
78 | | ... | ${dut1_node} | ${dut1_if1} | ${dut1_if1_ip_GW} | ${tg_if1_mac}
79 | | And Add Arp On Dut
80 | | ... | ${dut1_node} | ${dut1_if2} | ${dut1_if2_ip_GW} | ${tg_if2_mac}
81 | | And Vpp Route Add | ${dut1_node}
82 | | ... | ${test_dst_ip} | ${ip_prefix} | ${dut1_if2_ip_GW} | ${dut1_if2}
83 | | And Vpp All Ra Suppress Link Layer | ${nodes}
84 | | And Add fib table | ${dut1_node} | ${cop_dut_ip} | ${ip_prefix} |
85 | | ... | ${fib_table_number} | local
86 | | When COP Add whitelist Entry | ${dut1_node} | ${dut1_if1} | ip6 |
87 | | ... | ${fib_table_number}
88 | | And COP interface enable or disable | ${dut1_node} | ${dut1_if1} | enable
89 | | Then Send Packet And Check Headers | ${tg_node} |
90 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_if1} | ${tg_if1_mac} |
91 | | ... | ${dut1_if1_mac} | ${tg_if2} | ${dut1_if2_mac} | ${tg_if2_mac}
92
93
94 | VPP drops packets based on IPv6 src addr
95 | | [Documentation] | COP blacklist test with basic setup.
96 | | Given Setup Nodes And Variables | ${tg_node} | ${dut1_node} | ${dut2_node}
97 | | And L2 setup xconnect on DUT | ${dut2_node} | ${dut2_if1} | ${dut2_if2}
98 | | And VPP Set IF IPv6 Addr
99 | | ... | ${dut1_node} | ${dut1_if1} | ${dut1_if1_ip} | ${ip_prefix}
100 | | And VPP Set IF IPv6 Addr
101 | | ... | ${dut1_node} | ${dut1_if2} | ${dut1_if2_ip} | ${ip_prefix}
102 | | And VPP Set IF IPv6 Addr
103 | | ... | ${dut2_node} | ${dut2_if1} | ${dut2_if1_ip} | ${ip_prefix}
104 | | And VPP Set IF IPv6 Addr
105 | | ... | ${dut2_node} | ${dut2_if2} | ${dut2_if2_ip} | ${ip_prefix}
106 | | And Add Arp On Dut
107 | | ... | ${dut1_node} | ${dut1_if1} | ${dut1_if1_ip_GW} | ${tg_if1_mac}
108 | | And Add Arp On Dut
109 | | ... | ${dut1_node} | ${dut1_if2} | ${dut1_if2_ip_GW} | ${tg_if2_mac}
110 | | And Vpp Route Add | ${dut1_node}
111 | | ... | ${test_dst_ip} | ${ip_prefix} | ${dut1_if2_ip_GW} | ${dut1_if2}
112 | | And Vpp All Ra Suppress Link Layer | ${nodes}
113 | | And Add fib table | ${dut1_node}
114 | | ... | ${cop_dut_ip} | ${ip_prefix} | ${fib_table_number} | drop
115 | | When COP Add whitelist Entry
116 | | ... | ${dut1_node} | ${dut1_if1} | ip6 | ${fib_table_number}
117 | | And COP interface enable or disable | ${dut1_node} | ${dut1_if1} | enable
118 | | Then Send packet from Port to Port should failed | ${tg_node} |
119 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_if1} | ${tg_if1_mac} |
120 | | ... | ${dut1_if1_mac} | ${tg_if2} | ${dut1_if2_mac} | ${tg_if2_mac}