2e3d11cb3a1f218d82ecfd0a9b030623cba9fbcc
[csit.git] / tests / suites / ipv4 / ipv4_iacl_untagged.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 | Resource | resources/libraries/robot/default.robot
16 | Resource | resources/libraries/robot/counters.robot
17 | Resource | resources/libraries/robot/interfaces.robot
18 | Resource | resources/libraries/robot/ipv4.robot
19 | Resource | resources/libraries/robot/iacl.robot
20 | Resource | resources/libraries/robot/l2_xconnect.robot
21 | Resource | resources/libraries/robot/traffic.robot
22 | Library | resources.libraries.python.Classify.Classify
23 | Library | resources.libraries.python.Trace
24
25 | Force Tags | HW_ENV | VM_ENV | 3_NODE_SINGLE_LINK_TOPO
26 | Suite Setup | Run Keywords | Setup all TGs before traffic script
27 | ...         | AND          | Update All Interface Data On All Nodes | ${nodes}
28 | Test Setup | Setup all DUTs before test
29 | Test Teardown | Show packet trace on all DUTs | ${nodes}
30
31 *** Variables ***
32 | ${dut1_if1_ip}= | 192.168.1.1
33 | ${dut1_if2_ip}= | 192.168.2.1
34 | ${dut1_if2_ip_GW}= | 192.168.2.2
35 | ${test_dst_ip}= | 32.0.0.1
36 | ${test_src_ip}= | 16.0.0.1
37 | ${prefix_length}= | 24
38
39 *** Test Cases ***
40 | VPP drops packets based on IPv4 source addresses
41 | | [Documentation] | Create classify table on VPP, add source IP address
42 | | ...             | of traffic into table and setup 'deny' traffic
43 | | ...             | and check if traffic is dropped.
44 | | Given Node path computed for 3-node topology
45 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
46 | | And Interfaces in path are up
47 | | And IPv4 Addresses set on the node interfaces
48 | | ... | ${dut1_node} | ${dut1_if1} | ${dut1_if1_ip} | ${dut1_if2}
49 | | ... | ${dut1_if2_ip} | ${prefix_length}
50 | | ${table_index} | ${skip_n} | ${match_n}= | When Vpp Create Classify Table
51 | | ... | ${dut1_node} | ip4 | src
52 | | And Vpp Configure Classify Session
53 | | ... | ${dut1_node} | deny | ${table_index} | ${skip_n} | ${match_n}
54 | | ... | ip4 | src | ${test_src_ip}
55 | | And Vpp Enable Input Acl Interface
56 | | ... | ${dut1_node} | ${dut1_if1} | ip4 | ${table_index}
57 | | And Add Arp On Dut
58 | | ... | ${dut1_node} | ${dut1_if2} | ${dut1_if2_ip_GW} | ${tg_if2_mac}
59 | | And Vpp Route Add
60 | | ... | ${dut1_node} | ${test_dst_ip} | ${prefix_length} | ${dut1_if2_ip_GW}
61 | | ... | ${dut1_if2}
62 | | And L2 setup xconnect on DUT | ${dut2_node} | ${dut2_if1} | ${dut2_if2}
63 | | Then Send packet from Port to Port should failed | ${tg_node} |
64 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_if1} | ${tg_if1_mac} |
65 | | ... | ${dut1_if1_mac} | ${tg_if2} | ${dut1_if2_mac} | ${tg_if2_mac}
66
67 | VPP drops packets based on IPv4 destination addresses
68 | | [Documentation] | Create classify table on VPP, add destination IP address
69 | | ...             | of traffic into table and setup 'deny' traffic
70 | | ...             | and check if traffic is dropped.
71 | | Given Node path computed for 3-node topology
72 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
73 | | And Interfaces in path are up
74 | | And IPv4 Addresses set on the node interfaces
75 | | ... | ${dut1_node} | ${dut1_if1} | ${dut1_if1_ip} | ${dut1_if2}
76 | | ... | ${dut1_if2_ip} | ${prefix_length}
77 | | ${table_index} | ${skip_n} | ${match_n}= | When Vpp Create Classify Table
78 | | ... | ${dut1_node} | ip4 | dst
79 | | And Vpp Configure Classify Session
80 | | ... | ${dut1_node} | deny | ${table_index} | ${skip_n} | ${match_n}
81 | | ... | ip4 | dst | ${test_dst_ip}
82 | | And Vpp Enable Input Acl Interface
83 | | ... | ${dut1_node} | ${dut1_if1} | ip4 | ${table_index}
84 | | And Add Arp On Dut
85 | | ... | ${dut1_node} | ${dut1_if2} | ${dut1_if2_ip_GW} | ${tg_if2_mac}
86 | | And Vpp Route Add
87 | | ... | ${dut1_node} | ${test_dst_ip} | ${prefix_length} | ${dut1_if2_ip_GW}
88 | | ... | ${dut1_if2}
89 | | And L2 setup xconnect on DUT | ${dut2_node} | ${dut2_if1} | ${dut2_if2}
90 | | Then Send packet from Port to Port should failed | ${tg_node} |
91 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_if1} | ${tg_if1_mac} |
92 | | ... | ${dut1_if1_mac} | ${tg_if2} | ${dut1_if2_mac} | ${tg_if2_mac}
93
94
95 | VPP drops packets based on IPv4 src-addr and dst-addr
96 | | [Documentation] | Create classify table on VPP, add source and destination
97 | | ...             | IP address of traffic into table and setup 'deny' traffic
98 | | ...             | and check if traffic is dropped.
99 | | Given Node path computed for 3-node topology
100 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
101 | | And Interfaces in path are up
102 | | And IPv4 Addresses set on the node interfaces
103 | | ... | ${dut1_node} | ${dut1_if1} | ${dut1_if1_ip} | ${dut1_if2}
104 | | ... | ${dut1_if2_ip} | ${prefix_length}
105 | | ${table_index_1} | ${skip_n_1} | ${match_n_1}=
106 | | ... | When Vpp Create Classify Table | ${dut1_node} | ip4 | src
107 | | ${table_index_2} | ${skip_n_2} | ${match_n_2}=
108 | | ... | When Vpp Create Classify Table | ${dut1_node} | ip4 | dst
109 | | And Vpp Configure Classify Session
110 | | ... | ${dut1_node} | deny | ${table_index_1} | ${skip_n_1} | ${match_n_2}
111 | | ... | ip4 | src | ${test_src_ip}
112 | | And Vpp Configure Classify Session
113 | | ... | ${dut1_node} | deny | ${table_index_2} | ${skip_n_2} | ${match_n_2}
114 | | ... | ip4 | dst | ${test_dst_ip}
115 | | And Vpp Enable Input Acl Interface
116 | | ... | ${dut1_node} | ${dut1_if1} | ip4 | ${table_index_1}
117 | | And Vpp Enable Input Acl Interface
118 | | ... | ${dut1_node} | ${dut1_if1} | ip4 | ${table_index_2}
119 | | And Add Arp On Dut
120 | | ... | ${dut1_node} | ${dut1_if2} | ${dut1_if2_ip_GW} | ${tg_if2_mac}
121 | | And Vpp Route Add
122 | | ... | ${dut1_node} | ${test_dst_ip} | ${prefix_length} | ${dut1_if2_ip_GW}
123 | | ... | ${dut1_if2}
124 | | And L2 setup xconnect on DUT | ${dut2_node} | ${dut2_if1} | ${dut2_if2}
125 | | Then Send packet from Port to Port should failed | ${tg_node} |
126 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_if1} | ${tg_if1_mac} |
127 | | ... | ${dut1_if1_mac} | ${tg_if2} | ${dut1_if2_mac} | ${tg_if2_mac}