Improve pf layer
[csit.git] / resources / libraries / robot / features / gbp.robot
1 # Copyright (c) 2020 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.GBP
16 |
17 | Documentation | GBP keywords.
18
19 *** Keywords ***
20 | Initialize GBP routing domains on node
21 | | [Documentation]
22 | | ... | Initialize GBP routing domains on node.
23 | |
24 | | ... | *Arguments:*
25 | | ... | - dut - DUT node. Type: string
26 | | ... | - count - Number of baseline interface variables. Type: integer
27 | |
28 | | ... | *Example:*
29 | |
30 | | ... | \| Initialize GBP routing domains on node \| DUT1 \| 1 \|
31 | |
32 | | [Arguments] | ${dut} | ${count}=${1}
33 | |
34 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
35 | | | ${hexa_id}= | Convert To Hex | ${id} | length=2 | lowercase=yes
36 | | | ${dut_lo}= | VPP Create Loopback | ${nodes['${dut}']}
37 | | | ... | mac=ba:dc:00:ff:ee:${hexa_id}
38 | | | Set Interface State
39 | | | ... | ${nodes['${dut}']} | ${dut_lo} | up
40 | | | Add Fib Table
41 | | | ... | ${nodes['${dut}']} | ${id}
42 | | | GBP Route Domain Add
43 | | | ... | ${nodes['${dut}']} | rd_id=${id}
44 | | | Assign Interface To Fib Table
45 | | | ... | ${nodes['${dut}']} | ${dut_lo} | ${id}
46 | | | Create L2 BD
47 | | | ... | ${nodes['${dut}']} | ${id} | arp_term=${1}
48 | | | GBP Bridge Domain Add
49 | | | ... | ${nodes['${dut}']} | ${dut_lo} | bd_id=${id}
50 | | | GBP Endpoint Group Add
51 | | | ... | ${nodes['${dut}']} | ${100} | bd_id=${id} | rd_id=${id}
52 | | | VPP Interface Set IP Address
53 | | | ... | ${nodes['${dut}']} | ${dut_lo} | 1.1.1.1 | 24
54 | | | GBP Subnet Add Del
55 | | | ... | ${nodes['${dut}']} | 1.1.1.0 | 24 | ${100} | rd_id=${id}
56 | | | GBP Ext Itf Add Del
57 | | | ... | ${nodes['${dut}']} | ${dut_lo} | bd_id=${id} | rd_id=${id}
58 | | | GBP Endpoint Add
59 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}1_${id}}[0]
60 | | | ... | 1.1.1.100 | ${TG_pf1_mac}[0] | ${100}
61 | | | GBP Endpoint Add
62 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}2_${id}}[0]
63 | | | ... | 1.1.1.200 | ${TG_pf2_mac}[0] | ${100}
64 | | | VPP Route Add
65 | | | ... | ${nodes['${dut}']} | 10.10.10.0 | 24 | gateway=1.1.1.100
66 | | | ... | interface=${dut_lo} | vrf=${1}
67 | | | VPP Route Add
68 | | | ... | ${nodes['${dut}']} | 20.20.20.0 | 24 | gateway=1.1.1.200
69 | | | ... | interface=${dut_lo} | vrf=${1}
70 | | | GBP Subnet Add Del
71 | | | ... | ${nodes['${dut}']} | 10.10.10.0 | 24 | ${200} | rd_id=${id}
72 | | | GBP Subnet Add Del
73 | | | ... | ${nodes['${dut}']} | 20.20.20.0 | 24 | ${300} | rd_id=${id}
74 | | | Add Replace Acl Multi Entries
75 | | | ... | ${nodes['${dut}']}
76 | | | ... | rules="ipv4 permit src 0.0.0.0/0 dst 0.0.0.0/0 proto 61"
77 | | | ... | tag="gbp-permit-200-300"
78 | | | GBP Contract Add Del
79 | | | ... | ${nodes['${dut}']} | ${200} | ${300} | acl_index=${0}
80 | | | GBP Contract Add Del
81 | | | ... | ${nodes['${dut}']} | ${300} | ${200} | acl_index=${0}
82 | | END
83
84 | Initialize GBP routing domains
85 | | [Documentation]
86 | | ... | Initialize GBP routing domains on all DUTs.
87 | |
88 | | ... | *Arguments:*
89 | | ... | - count - Number of GBP routing domains. Type: integer
90 | |
91 | | ... | *Example:*
92 | |
93 | | ... | \| Initialize GBP routing domains \| 1 \|
94 | |
95 | | [Arguments] | ${count}=${1}
96 | |
97 | | FOR | ${dut} | IN | @{duts}
98 | | | Initialize GBP routing domains on node | ${dut} | count=${count}
99 | | END
100 | | Set interfaces in path up