-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtrex.yaml
306 lines (268 loc) · 9.34 KB
/
trex.yaml
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
apiVersion: v1
kind: ConfigMap
metadata:
name: trex-info-for-config
data:
PORT_BANDWIDTH_GB: "25"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: trex-config-template
data:
trex_cfg.yaml : |
- port_limit: 2
version: 2
interfaces: ["${PCIDEVICE_OPENSHIFT_IO_DPDK_NIC_1}","${PCIDEVICE_OPENSHIFT_IO_DPDK_NIC_2}"]
port_bandwidth_gb: ${PORT_BANDWIDTH_GB}
port_info:
- ip: 10.10.10.2
default_gw: 10.10.10.1
- ip: 10.10.20.2
default_gw: 10.10.20.1
platform:
master_thread_id: $MASTER
latency_thread_id: $LATENCY
dual_if:
- socket: ${SOCKET}
threads: [${CPU}]
---
apiVersion: v1
kind: ConfigMap
metadata:
name: trex-tests
data:
testpmd.py : |
from trex_stl_lib.api import *
from testpmd_addr import *
# Wild local MACs
mac_localport0='50:00:00:00:00:01'
mac_localport1='50:00:00:00:00:02'
class STLS1(object):
def __init__ (self):
self.fsize =64; # the size of the packet
self.number = 0
def create_stream (self, direction = 0):
size = self.fsize - 4; # HW will add 4 bytes ethernet FCS
dport = 1026 + self.number
self.number = self.number + 1
if direction == 0:
base_pkt = Ether(dst=mac_telco0,src=mac_localport0)/IP(src="16.0.0.1",dst=ip_telco0)/UDP(dport=15,sport=1026)
else:
base_pkt = Ether(dst=mac_telco1,src=mac_localport1)/IP(src="16.1.0.1",dst=ip_telco1)/UDP(dport=16,sport=1026)
#pad = max(0, size - len(base_pkt)) * 'x'
pad = (60 - len(base_pkt)) * 'x'
return STLStream(
packet =
STLPktBuilder(
pkt = base_pkt / pad
),
mode = STLTXCont())
def create_stats_stream (self, rate_pps = 1000, pgid = 7, direction = 0):
size = self.fsize - 4; # HW will add 4 bytes ethernet FCS
if direction == 0:
base_pkt = Ether(dst=mac_telco0,src=mac_localport0)/IP(src="17.0.0.1",dst=ip_telco0)/UDP(dport=dport,sport=1026)
else:
base_pkt = Ether(dst=mac_telco1,src=mac_localport1)/IP(src="17.1.0.1",dst=ip_telco1)/UDP(dport=dport,sport=1026)
pad = max(0, size - len(base_pkt)) * 'x'
return STLStream(
packet =
STLPktBuilder(
pkt = base_pkt / pad
),
mode = STLTXCont(pps = rate_pps),
flow_stats = STLFlowLatencyStats(pg_id = pgid))
#flow_stats = STLFlowStats(pg_id = pgid))
def get_streams (self, direction = 0, **kwargs):
# create multiple streams, one stream per core...
s = []
for i in range(14):
s.append(self.create_stream(direction = direction))
#if direction == 0:
# s.append(self.create_stats_stream(rate_pps=1000, pgid=10, direction = direction))
#else:
# s.append(self.create_stats_stream(rate_pps=1000, pgid=11, direction = direction))
return s
# dynamic load - used for trex console or simulator
def register():
return STLS1()
testpmd_addr.py: |
# wild second XL710 mac
mac_telco0 = '60:00:00:00:00:01'
# we don’t care of the IP in this phase
ip_telco0 = '10.0.0.1'
# wild first XL710 mac
mac_telco1 = '60:00:00:00:00:02'
ip_telco1 = '10.1.1.1'
vpp.py : |
from trex_stl_lib.api import *
from vpp_addr import *
# Wild local MACs
mac_localport0='50:00:00:00:00:01'
mac_localport1='50:00:00:00:00:02'
class STLS1(object):
def __init__ (self):
self.fsize =64; # the size of the packet
self.number = 0
def create_stream (self, direction = 0):
size = self.fsize - 4; # HW will add 4 bytes ethernet FCS
dport = 1026 + self.number
self.number = self.number + 1
if direction == 0:
base_pkt = Ether(dst=mac_telco0,src=mac_localport0)/IP(src="17.0.0.1",dst="18.0.0.1")/UDP(dport=dport,
sport=1026)
else:
base_pkt = Ether(dst=mac_telco1,src=mac_localport1)/IP(src="18.0.0.2",dst="17.0.0.2")/UDP(dport=dport,
sport=1026)
# pad = max(0, size - len(base_pkt)) * 'x'
pad = (60 - len(base_pkt)) * 'x'
return STLStream(
packet =
STLPktBuilder(
pkt = base_pkt / pad
),
mode = STLTXCont())
def get_streams (self, direction = 0, **kwargs):
# create multiple streams, one stream per core...
s = []
for i in range(14):
s.append(self.create_stream(direction = direction))
return s
# dynamic load - used for trex console or simulator
def register():
return STLS1()
vpp_addr.py: |
mac_telco0 = '60:00:00:00:00:03'
mac_telco1 = '60:00:00:00:00:04'
ovs.py: |
from trex_stl_lib.api import *
from ovs_addr import *
# Wild local MACs
mac_localport0='50:00:00:00:00:01'
mac_localport1='50:00:00:00:00:02'
class STLS1(object):
def __init__ (self):
self.fsize =64; # the size of the packet
self.number = 0
def create_stream (self, direction = 0):
size = self.fsize - 4; # HW will add 4 bytes ethernet FCS
dport = 1026 + self.number
self.number = self.number + 1
if direction == 0:
base_pkt = Ether(dst=mac_telco0,src=mac_localport0)/IP(src="17.0.0.1",dst="18.0.0.1")/UDP(dport=dport,
sport=1026)
else:
base_pkt = Ether(dst=mac_telco1,src=mac_localport1)/IP(src="18.0.0.2",dst="17.0.0.2")/UDP(dport=dport,
sport=1026)
# pad = max(0, size - len(base_pkt)) * 'x'
pad = (60 - len(base_pkt)) * 'x'
return STLStream(
packet =
STLPktBuilder(
pkt = base_pkt / pad
),
mode = STLTXCont())
def get_streams (self, direction = 0, **kwargs):
# create multiple streams, one stream per core...
s = []
for i in range(14):
s.append(self.create_stream(direction = direction))
return s
# dynamic load - used for trex console or simulator
def register():
return STLS1()
ovs_addr.py: |
mac_telco0 = '70:00:00:00:00:03'
mac_telco1 = '70:00:00:00:00:04'
---
apiVersion: v1
kind: Pod
metadata:
annotations:
k8s.v1.cni.cncf.io/networks: '[
{
"name": "dpdk-network-1",
"mac": "50:00:00:00:00:01",
"namespace": "seba"
},
{
"name": "dpdk-network-1",
"mac": "50:00:00:00:00:02",
"namespace": "seba"
}
]'
cpu-load-balancing.crio.io: "disable"
cpu-quota.crio.io: "disable"
irq-load-balancing.crio.io: "disable"
labels:
app: trex
name: trex
namespace: seba
spec:
runtimeClassName: performance-performance
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- dpdk
topologyKey: kubernetes.io/hostname
containers:
- command:
- /bin/bash
- -c
- sleep INF
#- /opt/scripts/create-trex-config.sh && ./t-rex-64 --no-ofed-check --no-hw-flow-stat -i -c 14
image: quay.io/schseba/trex:latest
imagePullPolicy: Always
name: trex
envFrom:
- configMapRef:
name: trex-info-for-config
resources:
limits:
cpu: "16"
hugepages-1Gi: 8Gi
memory: 1Gi
requests:
cpu: "16"
hugepages-1Gi: 8Gi
memory: 1Gi
securityContext:
# privileged: true
capabilities:
add:
- IPC_LOCK
- SYS_RESOURCE
- NET_RAW
- NET_ADMIN
runAsUser: 0
volumeMounts:
- name: trex-config-template
mountPath: /opt/templates/
- name: trex-tests
mountPath: /opt/tests/
- mountPath: /mnt/huge
name: hugepages
- name: modules
mountPath: /lib/modules
terminationGracePeriodSeconds: 5
volumes:
- name: modules
hostPath:
path: /lib/modules
- configMap:
name: trex-info-for-config
name: trex-info-for-config
- name: trex-config-template
configMap:
name: trex-config-template
- name: trex-tests
configMap:
name: trex-tests
- emptyDir:
medium: HugePages
name: hugepages