aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/robot/lb/load_balancer.robot
blob: a254acd0f8e0745893e6c9f687411ffa5f4c9c5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# Copyright (c) 2019 Intel and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

*** Settings ***
| Library | Collections
| Library | String

| Library | resources.libraries.python.InterfaceUtil
| Library | resources.libraries.python.IPUtil
| Library | resources.libraries.python.topology.Topology
| Library | resources.libraries.python.LoadBalancerUtil
| Library | resources.libraries.python.NodePath
|
| Resource | resources/libraries/robot/shared/interfaces.robot
|
| Documentation | LoadBalancer suite keywords - configuration

*** Keywords ***
| Initialize loadbalancer maglev
| | [Documentation]
| | ... | Set UP state on VPP interfaces in path on nodes in 2-node
| | ... | circular topology. Get the interface MAC addresses and setup ARP on
| | ... | all VPP interfaces. Setup IPv4 addresses with /24 prefix on DUT-TG
| | ... | links.
| |
| | Set interfaces in path up
| |
| | ${fib_table}= | Set Variable | ${0}
| | Add Fib Table | ${dut1} | ${fib_table}
| | Assign Interface To Fib Table | ${dut1} | ${dut1_if1} | ${fib_table}
| | Assign Interface To Fib Table | ${dut1} | ${dut1_if2} | ${fib_table}
| |
| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1}
| | ... | 192.168.50.72 | 24
| | VPP Interface Set IP Address | ${dut1} | ${dut1_if2}
| | ... | 192.168.60.73 | 24
| |
| | Add Ip Neighbors | ${dut1} | ${dut1_if2} | 192.168.60 | ${tg_if2_mac}
| |
| | Vpp Route Add | ${dut1} | 192.168.60.0 | 24 | interface=${dut1_if2}
| |
| | Vpp Lb Conf | ${dut1} | ip4_src_addr=192.168.60.73 | buckets_per_core=${128}
| | Vpp Lb Add Del Vip | ${dut1} | vip_addr=90.1.2.1 | encap=${0}
| | ... | new_len=${1024}
| | Add Lb As Addresses | ${dut1} | 90.1.2.1 | 192.168.60

| Initialize loadbalancer l3dsr
| | [Documentation]
| | ... | Set UP state on VPP interfaces in path on nodes in 2-node
| | ... | circular topology. Get the interface MAC addresses and setup ARP on
| | ... | all VPP interfaces. Setup IPv4 addresses with /24 prefix on DUT-TG
| | ... | links.
| |
| | Set interfaces in path up
| |
| | ${fib_table}= | Set Variable | ${0}
| | Add Fib Table | ${dut1} | ${fib_table}
| | Assign Interface To Fib Table | ${dut1} | ${dut1_if1} | ${fib_table}
| | Assign Interface To Fib Table | ${dut1} | ${dut1_if2} | ${fib_table}
| |
| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1}
| | ... | 192.168.50.72 | 24
| | VPP Interface Set IP Address | ${dut1} | ${dut1_if2}
| | ... | 192.168.60.73 | 24
| |
| | Add Ip Neighbors | ${dut1} | ${dut1_if2} | 192.168.60 | ${tg_if2_mac}
| |
| | Vpp Route Add | ${dut1} | 192.168.60.0 | 24 | interface=${dut1_if2}
| |
| | Vpp Lb Conf | ${dut1} | ip4_src_addr=192.168.60.73 | buckets_per_core=${128}
| | Vpp Lb Add Del Vip | ${dut1} | vip_addr=90.1.2.1 | encap=${2} | dscp=${7}
| | ... | new_len=${1024}
| | Add Lb As Addresses | ${dut1} | 90.1.2.1 | 192.168.60

| Initialize loadbalancer nat4
| | [Documentation]
| | ... | Set UP state on VPP interfaces in path on nodes in 2-node
| | ... | circular topology. Get the interface MAC addresses and setup ARP on
| | ... | all VPP interfaces. Setup IPv4 addresses with /24 prefix on DUT-TG
| | ... | links.
| |
| | Set interfaces in path up
| |
| | ${fib_table}= | Set Variable | ${0}
| | Add Fib Table | ${dut1} | ${fib_table}
| | Assign Interface To Fib Table | ${dut1} | ${dut1_if1} | ${fib_table}
| | Assign Interface To Fib Table | ${dut1} | ${dut1_if2} | ${fib_table}
| |
| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1}
| | ... | 192.168.50.72 | 24
| | VPP Interface Set IP Address | ${dut1} | ${dut1_if2}
| | ... | 192.168.60.73 | 24
| |
| | Add Ip Neighbors | ${dut1} | ${dut1_if1} | 192.168.50 | ${tg_if1_mac}
| | Add Ip Neighbors | ${dut1} | ${dut1_if2} | 192.168.60 | ${tg_if2_mac}
| |
| | Vpp Route Add | ${dut1} | 192.168.50.0 | 24 | interface=${dut1_if1}
| | Vpp Route Add | ${dut1} | 192.168.60.0 | 24 | interface=${dut1_if2}
| |
| | Vpp Lb Conf | ${dut1} | ip4_src_addr=192.168.60.73 | buckets_per_core=${128}
| | Vpp Lb Add Del Vip | ${dut1} | vip_addr=90.1.2.1 | encap=${3}
| | ... | protocol=${17} | port=${20000} | target_port=${3307} | new_len=${1024}
| | Add Lb As Addresses
| | ... | ${dut1} | 90.1.2.1 | 192.168.60 | protocol=${17} | port=${20000}
| | Vpp Lb Add Del Intf Nat4 | ${dut1} | interface=${dut1_if2}

| Add Ip Neighbors
| | [Documentation] | Add IP neighbors to physical interface on DUT.
| |
| | ... | *Arguments:*
| | ... | - node - VPP node. Type: dictionary
| | ... | - interface - Interface key. Type: string
| | ... | - ip_addr - IP address of the interface. Type: string
| | ... | - mac_addr - MAC address of the interface. Type: string
| |
| | ... | *Example:*
| | ... | \| Add Ip Neighbors \| ${dut1} \| ${dut1_if1} \| 192.168.50 \
| | ... | \| ${tg_if1_mac}
| |
| | [Arguments] | ${node} | ${interface} | ${ip_addr} | ${mac_addr}
| |
| | FOR | ${number} | IN RANGE | 74 | 80
| | | VPP Add IP Neighbor
| | | ... | ${node} | ${interface} | ${ip_addr}.${number} | ${mac_addr}
| | END

| Add Lb As Addresses
| | [Documentation] | Add Lb As Addresses on Vpp node.
| |
| | ... | *Arguments:*
| | ... | - node - VPP node. Type: dictionary
| | ... | - vip_addr - IPv4 address to be used as source for IPv4 traffic.
| | ... | Type: string
| | ... | - as_addr - The application server address. Type: string
| | ... | - protocol - tcp or udp. Type: integer
| | ... | - port - destination port. Type: integer
| | ... | - is_del - 1 if the VIP should be removed otherwise 0. Type: integer
| | ... | - is_flush - 1 if the sessions related to this AS should be flushed
| | ... | otherwise 0. Type: integer
| |
| | ... | *Example:*
| | ... | \| Add Lb As Addresses \| ${dut1} \| 90.1.2.1 \| 192.168.60 \
| | ... | \| protocol=${17} \| port=${20000} \|
| |
| | [Arguments] | ${node} | ${vip_addr} | ${as_addr} | ${protocol}=${255}
| | ... | ${port}=${0} | ${is_del}=${0} | ${is_flush}=${0}
| |
| | FOR | ${number} | IN RANGE | 74 | 80
| | | VPP Lb Add Del As
| | | ... | ${node} | vip_addr=${vip_addr} | protocol=${protocol}
| | | ... | port=${port} | as_addr=${as_addr}.${number}
| | END