1 # Copyright (c) 2021 Intel 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 | Collections
18 | Library | resources.libraries.python.InterfaceUtil
19 | Library | resources.libraries.python.IPUtil
20 | Library | resources.libraries.python.topology.Topology
21 | Library | resources.libraries.python.LoadBalancerUtil
22 | Library | resources.libraries.python.NodePath
24 | Resource | resources/libraries/robot/shared/interfaces.robot
26 | Documentation | LoadBalancer suite keywords - configuration
29 | Initialize loadbalancer maglev
31 | | ... | Set UP state on VPP interfaces in path on nodes in 2-node
32 | | ... | circular topology. Get the interface MAC addresses and setup ARP on
33 | | ... | all VPP interfaces. Setup IPv4 addresses with /24 prefix on DUT-TG
36 | | Set interfaces in path up
38 | | ${fib_table}= | Set Variable | ${0}
39 | | Add Fib Table | ${dut1} | ${fib_table}
40 | | Assign Interface To Fib Table
41 | | ... | ${dut1} | ${DUT1_${int}1}[0] | ${fib_table}
42 | | Assign Interface To Fib Table
43 | | ... | ${dut1} | ${DUT1_${int}2}[0] | ${fib_table}
44 | | VPP Interface Set IP Address
45 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 192.168.50.72 | 24
46 | | VPP Interface Set IP Address
47 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 192.168.60.73 | 24
49 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 192.168.60 | ${TG_pf2_mac}[0]
51 | | ... | ${dut1} | 192.168.60.0 | 24 | interface=${DUT1_${int}2}[0]
53 | | ... | ${dut1} | ip4_src_addr=192.168.60.73 | buckets_per_core=${128}
54 | | Vpp Lb Add Del Vip
55 | | ... | ${dut1} | vip_addr=90.1.2.1 | encap=${0} | new_len=${1024}
56 | | Add Lb As Addresses
57 | | ... | ${dut1} | 90.1.2.1 | 192.168.60
59 | Initialize loadbalancer l3dsr
61 | | ... | Set UP state on VPP interfaces in path on nodes in 2-node
62 | | ... | circular topology. Get the interface MAC addresses and setup ARP on
63 | | ... | all VPP interfaces. Setup IPv4 addresses with /24 prefix on DUT-TG
66 | | Set interfaces in path up
68 | | ${fib_table}= | Set Variable | ${0}
69 | | Add Fib Table | ${dut1} | ${fib_table}
70 | | Assign Interface To Fib Table
71 | | ... | ${dut1} | ${DUT1_${int}1}[0] | ${fib_table}
72 | | Assign Interface To Fib Table
73 | | ... | ${dut1} | ${DUT1_${int}2}[0] | ${fib_table}
74 | | VPP Interface Set IP Address
75 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 192.168.50.72 | 24
76 | | VPP Interface Set IP Address
77 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 192.168.60.73 | 24
79 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 192.168.60 | ${TG_pf2_mac}[0]
81 | | ... | ${dut1} | 192.168.60.0 | 24 | interface=${DUT1_${int}2}[0]
83 | | ... | ${dut1} | ip4_src_addr=192.168.60.73 | buckets_per_core=${128}
84 | | Vpp Lb Add Del Vip
85 | | ... | ${dut1} | vip_addr=90.1.2.1 | encap=${2} | dscp=${7} | new_len=${1024}
86 | | Add Lb As Addresses
87 | | ... | ${dut1} | 90.1.2.1 | 192.168.60
89 | Initialize loadbalancer nat4
91 | | ... | Set UP state on VPP interfaces in path on nodes in 2-node
92 | | ... | circular topology. Get the interface MAC addresses and setup ARP on
93 | | ... | all VPP interfaces. Setup IPv4 addresses with /24 prefix on DUT-TG
96 | | Set interfaces in path up
98 | | ${fib_table}= | Set Variable | ${0}
99 | | Add Fib Table | ${dut1} | ${fib_table}
100 | | Assign Interface To Fib Table
101 | | ... | ${dut1} | ${DUT1_${int}1}[0] | ${fib_table}
102 | | Assign Interface To Fib Table
103 | | ... | ${dut1} | ${DUT1_${int}2}[0] | ${fib_table}
104 | | VPP Interface Set IP Address
105 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 192.168.50.72 | 24
106 | | VPP Interface Set IP Address
107 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 192.168.60.73 | 24
109 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 192.168.50 | ${TG_pf1_mac}[0]
111 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 192.168.60 | ${TG_pf2_mac}[0]
113 | | ... | ${dut1} | 192.168.50.0 | 24 | interface=${DUT1_${int}1}[0]
115 | | ... | ${dut1} | 192.168.60.0 | 24 | interface=${DUT1_${int}2}[0]
117 | | ... | ${dut1} | ip4_src_addr=192.168.60.73 | buckets_per_core=${128}
118 | | Vpp Lb Add Del Vip
119 | | ... | ${dut1} | vip_addr=90.1.2.1 | encap=${3}
120 | | ... | protocol=${17} | port=${20000} | target_port=${3307} | new_len=${1024}
121 | | Add Lb As Addresses
122 | | ... | ${dut1} | 90.1.2.1 | 192.168.60 | protocol=${17} | port=${20000}
123 | | Vpp Lb Add Del Intf Nat4
124 | | ... | ${dut1} | interface=${DUT1_${int}2}[0]
127 | | [Documentation] | Add IP neighbors to physical interface on DUT.
129 | | ... | *Arguments:*
130 | | ... | - node - VPP node. Type: dictionary
131 | | ... | - interface - Interface key. Type: string
132 | | ... | - ip_addr - IP address of the interface. Type: string
133 | | ... | - mac_addr - MAC address of the interface. Type: string
136 | | ... | \| Add Ip Neighbors \| ${dut1} \| ${dut1_if1} \| 192.168.50 \
137 | | ... | \| ${tg_if1_mac}
139 | | [Arguments] | ${node} | ${interface} | ${ip_addr} | ${mac_addr}
141 | | FOR | ${number} | IN RANGE | 74 | 80
142 | | | VPP Add IP Neighbor
143 | | | ... | ${node} | ${interface} | ${ip_addr}.${number} | ${mac_addr}
146 | Add Lb As Addresses
147 | | [Documentation] | Add Lb As Addresses on Vpp node.
149 | | ... | *Arguments:*
150 | | ... | - node - VPP node. Type: dictionary
151 | | ... | - vip_addr - IPv4 address to be used as source for IPv4 traffic.
152 | | ... | Type: string
153 | | ... | - as_addr - The application server address. Type: string
154 | | ... | - protocol - tcp or udp. Type: integer
155 | | ... | - port - destination port. Type: integer
156 | | ... | - is_del - 1 if the VIP should be removed otherwise 0. Type: integer
157 | | ... | - is_flush - 1 if the sessions related to this AS should be flushed
158 | | ... | otherwise 0. Type: integer
161 | | ... | \| Add Lb As Addresses \| ${dut1} \| 90.1.2.1 \| 192.168.60 \
162 | | ... | \| protocol=${17} \| port=${20000} \|
164 | | [Arguments] | ${node} | ${vip_addr} | ${as_addr} | ${protocol}=${255}
165 | | ... | ${port}=${0} | ${is_del}=${0} | ${is_flush}=${0}
167 | | FOR | ${number} | IN RANGE | 74 | 80
168 | | | VPP Lb Add Del As
169 | | | ... | ${node} | vip_addr=${vip_addr} | protocol=${protocol}
170 | | | ... | port=${port} | as_addr=${as_addr}.${number}