ef84aa21b0cf7cd1f254948bfa582f48ce6d00ad
[csit.git] / tests / vpp / func / ip4 / eth2p-ethip4-ip4base-copblklistbase-func.robot
1 # Copyright (c) 2019 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.Cop
16 | Library | resources.libraries.python.Trace
17 | ...
18 | Resource | resources/libraries/robot/ip/ip4.robot
19 | Resource | resources/libraries/robot/l2/l2_xconnect.robot
20 | Resource | resources/libraries/robot/shared/default.robot
21 | Resource | resources/libraries/robot/shared/interfaces.robot
22 | Resource | resources/libraries/robot/shared/traffic.robot
23 | Resource | resources/libraries/robot/shared/testing_path.robot
24 | ...
25 | Force Tags | HW_ENV | VM_ENV | 3_NODE_SINGLE_LINK_TOPO
26 | ...
27 | Test Setup | Set up functional test
28 | ...
29 | Test Teardown | Tear down functional test
30 | ...
31 | Documentation | *COP Security IPv4 Blacklist Tests*
32 | ...
33 | ... | *[Top] Network Topologies:* TG-DUT1-DUT2-TG 3-node circular topology
34 | ... | with single links between nodes.
35 | ... | *[Enc] Packet Encapsulations:* Eth-IPv4-ICMPv4 on all links.
36 | ... | *[Cfg] DUT configuration:* DUT1 is configured with IPv4 routing and
37 | ... | static routes. COP security black-lists are applied on DUT1 ingress
38 | ... | interface from TG. DUT2 is configured with L2XC.
39 | ... | *[Ver] TG verification:* Test ICMPv4 Echo Request packets are sent in
40 | ... | one direction by TG on link to DUT1; on receive TG verifies packets for
41 | ... | correctness and drops as applicable.
42 | ... | *[Ref] Applicable standard specifications:*
43
44 *** Variables ***
45 | ${tg_node}= | ${nodes['TG']}
46 | ${dut1_node}= | ${nodes['DUT1']}
47 | ${dut2_node}= | ${nodes['DUT2']}
48
49 | ${dut1_if1_ip}= | 192.168.1.1
50 | ${dut1_if2_ip}= | 192.168.2.1
51 | ${dut1_if1_ip_GW}= | 192.168.1.2
52 | ${dut1_if2_ip_GW}= | 192.168.2.2
53
54 | ${test_dst_ip}= | 32.0.0.1
55 | ${test_src_ip}= | 16.0.0.1
56
57 | ${cop_dut_ip}= | 16.0.0.0
58
59 | ${ip_prefix}= | 24
60
61 | ${fib_table_number}= | 1
62
63 *** Test Cases ***
64 | TC01: DUT drops IPv4 pkts with COP blacklist set with IPv4 src-addr
65 | | [Documentation]
66 | | ... | [Top] TG-DUT1-DUT2-TG. [Enc] Eth-IPv4-ICMPv4. [Cfg] On DUT1 \
67 | | ... | configure interface IPv4 addresses and routes in the main
68 | | ... | routing domain, add COP blacklist on interface to TG with IPv4
69 | | ... | src-addr matching packets generated by TG; on DUT2 configure L2
70 | | ... | xconnect. [Ver] Make TG send ICMPv4 Echo Req on its interface to
71 | | ... | DUT1; verify no ICMPv4 Echo Req pkts are received. [Ref]
72 | | Given Configure path in 3-node circular topology
73 | | ... | ${tg_node} | ${dut1_node} | ${dut2_node} | ${tg_node}
74 | | And Set interfaces in 3-node circular topology up
75 | | And Configure L2XC
76 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_tg}
77 | | And VPP Interface Set IP Address
78 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip} | ${ip_prefix}
79 | | And VPP Interface Set IP Address
80 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip} | ${ip_prefix}
81 | | And VPP Add IP Neighbor
82 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip_GW} | ${tg_to_dut1_mac}
83 | | And VPP Add IP Neighbor
84 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip_GW} | ${tg_to_dut2_mac}
85 | | And Vpp Route Add | ${dut1_node} | ${test_dst_ip} | ${ip_prefix}
86 | | ... | gateway=${dut1_if2_ip_GW} | interface=${dut1_to_dut2}
87 | | And Add fib table | ${dut1_node} | ${fib_table_number}
88 | | When COP Add whitelist Entry
89 | | ... | ${dut1_node} | ${dut1_to_tg} | ip4 | ${fib_table_number}
90 | | And COP interface enable or disable | ${dut1_node} | ${dut1_to_tg} | enable
91 | | Then Packet transmission from port to port should fail | ${tg_node}
92 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
93 | | ... | ${dut1_to_tg_mac} | ${tg_to_dut2} | ${dut1_to_dut2_mac}
94 | | ... | ${tg_to_dut2_mac}