CSIT-424: HC Test: JSON comparison function rework
[csit.git] / resources / libraries / robot / vrf.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/interfaces.robot
16 | Library | resources.libraries.python.Routing
17 | Library | resources.libraries.python.InterfaceUtil
18 | Library | resources.libraries.python.IPv6Util
19
20 *** Keywords ***
21 | Setup VRF on DUT
22 | | [Documentation]
23 | | ... | The keyword sets a FIB table on a DUT, assigns two interfaces to it,\
24 | | ... | adds two ARP items and a route, see example.
25 | | ...
26 | | ... | *Arguments*
27 | | ... | - node - DUT node. Type: dictionary
28 | | ... | - table - FIB table ID. Type: integer
29 | | ... | - route_interface - Destination interface to be assigned to FIB.\
30 | | ... | Type: string
31 | | ... | - route_gateway_ip - Route gateway IP address. Type: string
32 | | ... | - route_gateway_mac - Route gateway MAC address. Type string
33 | | ... | - route_dst_ip - Route destination IP. Type: string
34 | | ... | - vrf_src_if - Source interface to be assigned to FIB. Type: string
35 | | ... | - src_if_ip - IP address of the source interface. Type: string
36 | | ... | - src_if_mac - MAC address of the source interface. Type: string
37 | | ... | - prefix_len - Prefix length. Type: int
38 | | ...
39 | | ... | *Example:*
40 | | ... | Three-node topology:
41 | | ... | TG_if1 - DUT1_if1-DUT1_if2 - DUT2_if1-DUT2_if2 - TG_if2
42 | | ... | Create one VRF on each DUT:
43 | | ... | \| Setup VRF on DUT \| ${dut1_node} \| ${dut1_fib_table} \
44 | | ... | \| ${dut1_to_dut2} \| ${dut2_to_dut1_ip4} \| ${dut2_to_dut1_mac} \
45 | | ... | \| ${tg2_ip4} \| ${dut1_to_tg} \| ${tg1_ip4} \| ${tg_to_dut1_mac} \
46 | | ... | \| 24 \|
47 | | ... | \| Setup VRF on DUT \| ${dut2_node} \| ${dut2_fib_table} \
48 | | ... | \| ${dut2_to_dut1} \| ${dut1_to_dut2_ip4} \| ${dut1_to_dut2_mac} \
49 | | ... | \| ${tg1_ip4} \| ${dut2_to_tg} \| ${tg2_ip4} \| ${tg_to_dut2_mac} \
50 | | ... | \| 24 \|
51 | | ...
52 | | [Arguments]
53 | | ... | ${node} | ${table} | ${route_interface} | ${route_gateway_ip}
54 | | ... | ${route_gateway_mac} | ${route_dst_ip} | ${vrf_src_if} | ${src_if_ip}
55 | | ... | ${src_if_mac} | ${prefix_len}
56 | | ...
57 | | ${route_interface_idx}= | Get Interface SW Index
58 | | ... | ${node} | ${route_interface}
59 | | ...
60 | | Add fib table | ${node}
61 | | ... | ${route_dst_ip} | ${prefix_len} | ${table}
62 | | ... | via ${route_gateway_ip} sw_if_index ${route_interface_idx} multipath
63 | | ...
64 | | Assign Interface To Fib Table
65 | | ... | ${node} | ${route_interface} | ${table}
66 | | Assign Interface To Fib Table
67 | | ... | ${node} | ${vrf_src_if} | ${table}
68 | | ...
69 | | Add IP Neighbor | ${node} | ${vrf_src_if}
70 | | ... | ${src_if_ip} | ${src_if_mac} | vrf=${table}
71 | | Add IP Neighbor | ${node} | ${route_interface}
72 | | ... | ${route_gateway_ip} | ${route_gateway_mac} | vrf=${table}
73 | | ...
74 | | Vpp Route Add | ${node} | ${route_dst_ip} | ${prefix_len}
75 | | ... | ${route_gateway_ip} | ${route_interface} | vrf=${table}