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:
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
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 | 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*
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.
39 | ${tg_node}= | ${nodes['TG']}
40 | ${dut1_node}= | ${nodes['DUT1']}
41 | ${dut2_node}= | ${nodes['DUT2']}
43 | ${dut1_if1_ip}= | 192.168.1.1
44 | ${dut1_if2_ip}= | 192.168.2.1
45 | ${dut1_if1_ip_GW}= | 192.168.1.2
46 | ${dut1_if2_ip_GW}= | 192.168.2.2
48 | ${test_dst_ip}= | 32.0.0.1
49 | ${test_src_ip}= | 16.0.0.1
51 | ${cop_dut_ip}= | 16.0.0.0
54 | ${nodes_ipv4_addresses}= | ${nodes_ipv4_addr}
56 | ${fib_table_number}= | 1
59 | VPP permits packets based on IPv4 src addr
60 | | [Documentation] | COP Whitelist test with basic setup.
61 | | Given Path for 3-node testing is set
62 | | ... | ${tg_node} | ${dut1_node} | ${dut2_node} | ${tg_node}
63 | | And Interfaces in 3-node path are up
64 | | And L2 setup xconnect on DUT
65 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_tg}
66 | | And Set Interface Address
67 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip} | ${ip_prefix}
68 | | And Set Interface Address
69 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip} | ${ip_prefix}
70 | | And Add Arp On Dut
71 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip_GW} | ${tg_to_dut1_mac}
72 | | And Add Arp On Dut
73 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip_GW} | ${tg_to_dut2_mac}
74 | | And Vpp Route Add | ${dut1_node}
75 | | ... | ${test_dst_ip} | ${ip_prefix} | ${dut1_if2_ip_GW} | ${dut1_to_dut2}
76 | | And Add fib table | ${dut1_node}
77 | | ... | ${cop_dut_ip} | ${ip_prefix} | ${fib_table_number} | local
78 | | When COP Add whitelist Entry
79 | | ... | ${dut1_node} | ${dut1_to_tg} | ip4 | ${fib_table_number}
80 | | And COP interface enable or disable | ${dut1_node} | ${dut1_to_tg} | enable
81 | | Then Send Packet And Check Headers | ${tg_node}
82 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
83 | | ... | ${dut1_to_tg_mac} | ${tg_to_dut2} | ${dut1_to_dut2_mac}
84 | | ... | ${tg_to_dut2_mac}
87 | VPP drops packets based on IPv4 src addr
88 | | [Documentation] | COP blacklist test with basic setup.
89 | | Given Path for 3-node testing is set
90 | | ... | ${tg_node} | ${dut1_node} | ${dut2_node} | ${tg_node}
91 | | And Interfaces in 3-node path are up
92 | | And L2 setup xconnect on DUT
93 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_tg}
94 | | And Set Interface Address
95 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip} | ${ip_prefix}
96 | | And Set Interface Address
97 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip} | ${ip_prefix}
98 | | And Add Arp On Dut
99 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip_GW} | ${tg_to_dut1_mac}
100 | | And Add Arp On Dut
101 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip_GW} | ${tg_to_dut2_mac}
102 | | And Vpp Route Add | ${dut1_node}
103 | | ... | ${test_dst_ip} | ${ip_prefix} | ${dut1_if2_ip_GW} | ${dut1_to_dut2}
104 | | And Add fib table | ${dut1_node}
105 | | ... | ${cop_dut_ip} | ${ip_prefix} | ${fib_table_number} | drop
106 | | When COP Add whitelist Entry
107 | | ... | ${dut1_node} | ${dut1_to_tg} | ip4 | ${fib_table_number}
108 | | And COP interface enable or disable | ${dut1_node} | ${dut1_to_tg} | enable
109 | | Then Send packet from Port to Port should failed | ${tg_node}
110 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
111 | | ... | ${dut1_to_tg_mac} | ${tg_to_dut2} | ${dut1_to_dut2_mac}
112 | | ... | ${tg_to_dut2_mac}