aboutsummaryrefslogtreecommitdiffstats
path: root/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py
diff options
context:
space:
mode:
authorBalaji Venkatraman <balajiv@cisco.com>2020-01-14 06:57:10 -0800
committerJan Gelety <jgelety@cisco.com>2020-01-16 15:40:21 +0100
commitf7519a18b92febfdb211a03a8ce60cbe216f9c72 (patch)
tree83bc40faa60663673082c88f9c6327bae516f52c /resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py
parente8e433bca76e6b7b065637d54cba9069278f6ab3 (diff)
Python3: Migration of files under traffic-profiles/trex
Change-Id: Iae16225d3d3daa4e1e9b177228fb89efe4aa5405 Signed-off-by: Balaji Venkatraman <balajiv@cisco.com>
Diffstat (limited to 'resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py')
-rwxr-xr-xresources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py238
1 files changed, 183 insertions, 55 deletions
diff --git a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py
index 29548a3e62..9209aed8b9 100755
--- a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py
+++ b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2019 Cisco and/or its affiliates.
+# Copyright (c) 2020 Cisco 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:
@@ -46,17 +46,19 @@ from profile_trex_stateless_base_class import TrafficStreamsBaseClass
# RFC 7348 - Virtual eXtensible Local Area Network (VXLAN):
# A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks
# http://tools.ietf.org/html/rfc7348
-_VXLAN_FLAGS = list('R'*24 + "RRRIRRRRR")
+_VXLAN_FLAGS = list(u"R"*24 + u"RRRIRRRRR")
class VXLAN(Packet):
- name = 'VXLAN'
- fields_desc = [FlagsField('flags', 0x08000000, 32, _VXLAN_FLAGS),
- ThreeBytesField('vni', 0),
- XByteField('reserved', 0x00)]
+ name=u"VXLAN"
+ fields_desc = [
+ FlagsField(u"flags", 0x08000000, 32, _VXLAN_FLAGS),
+ ThreeBytesField(u"vni", 0),
+ XByteField(u"reserved", 0x00)
+ ]
def mysummary(self):
- return self.sprintf("VXLAN (vni=%VXLAN.vni%)")
+ return self.sprintf(u"VXLAN (vni=%VXLAN.vni%)")
bind_layers(UDP, VXLAN, dport=4789)
@@ -85,62 +87,188 @@ class TrafficStreams(TrafficStreamsBaseClass):
# Direction 0 --> 1
base_pkt_a = (
Ether()/
- Dot1Q(vlan=100) /
- IP(src='172.17.0.2', dst='172.16.0.1')/
- UDP(sport=1024, dport=4789)/
- VXLAN(vni=0)/
- Ether(src='00:aa:aa:00:00:00', dst='00:bb:bb:00:00:00')/
- IP(src='10.0.0.2', dst='10.0.0.1', proto=61))
+ Dot1Q(
+ vlan=100
+ ) /
+ IP(
+ src=u"172.17.0.2",
+ dst=u"172.16.0.1"
+ )/
+ UDP(
+ sport=1024,
+ dport=4789
+ )/
+ VXLAN(
+ vni=0
+ )/
+ Ether(
+ src=u"00:aa:aa:00:00:00",
+ dst=u"00:bb:bb:00:00:00"
+ )/
+ IP(
+ src=u"10.0.0.2",
+ dst=u"10.0.0.1",
+ proto=61
+ )
+ )
# Direction 1 --> 0
base_pkt_b = (
Ether()/
- Dot1Q(vlan=200) /
- IP(src='172.27.0.2', dst='172.26.0.1')/
- UDP(sport=1024, dport=4789)/
- VXLAN(vni=0)/
- Ether(src='00:bb:bb:00:00:00', dst='00:aa:aa:00:00:00')/
- IP(src='10.0.0.1', dst='10.0.0.2', proto=61))
+ Dot1Q(
+ vlan=200
+ ) /
+ IP(
+ src=u"172.27.0.2",
+ dst=u"172.26.0.1"
+ )/
+ UDP(
+ sport=1024,
+ dport=4789
+ )/
+ VXLAN(
+ vni=0
+ )/
+ Ether(
+ src=u"00:bb:bb:00:00:00",
+ dst=u"00:aa:aa:00:00:00"
+ )/
+ IP(
+ src=u"10.0.0.1",
+ dst=u"10.0.0.2",
+ proto=61
+ )
+ )
# Direction 0 --> 1
- vm1 = STLScVmRaw([
- STLVmFlowVar(name='nf_id', size=1, op='inc',
- min_value=0, max_value=self.nf_chains - 1),
- STLVmFlowVar(name='in_mac', size=2, op='inc',
- min_value=0, max_value=255),
- STLVmFlowVar(name='in_ip', size=1, op='inc',
- min_value=0, max_value=255),
- STLVmFlowVar(name='src_port', size=2, op='random',
- min_value=1024, max_value=65535),
- STLVmWrFlowVar(fv_name='nf_id', pkt_offset=32),
- STLVmWrFlowVar(fv_name='src_port', pkt_offset='UDP.sport'),
- STLVmWrFlowVar(fv_name='nf_id', pkt_offset=52),
- STLVmWrFlowVar(fv_name='in_mac', pkt_offset=58),
- STLVmWrFlowVar(fv_name='in_mac', pkt_offset=64),
- STLVmWrFlowVar(fv_name='in_ip', pkt_offset=82),
- STLVmWrFlowVar(fv_name='in_ip', pkt_offset=86),
- STLVmFixIpv4(offset = 'IP')
- ])
+ vm1 = STLScVmRaw(
+ [
+ STLVmFlowVar(
+ name=u"nf_id",
+ size=1,
+ op=u"inc",
+ min_value=0,
+ max_value=self.nf_chains - 1
+ ),
+ STLVmFlowVar(
+ name=u"in_mac",
+ size=2,
+ op=u"inc",
+ min_value=0,
+ max_value=255
+ ),
+ STLVmFlowVar(
+ name=u"in_ip",
+ size=1,
+ op=u"inc",
+ min_value=0,
+ max_value=255
+ ),
+ STLVmFlowVar(
+ name=u"src_port",
+ size=2,
+ op=u"random",
+ min_value=1024,
+ max_value=65535
+ ),
+ STLVmWrFlowVar(
+ fv_name=u"nf_id",
+ pkt_offset=32
+ ),
+ STLVmWrFlowVar(
+ fv_name=u"src_port",
+ pkt_offset=u"UDP.sport"
+ ),
+ STLVmWrFlowVar(
+ fv_name=u"nf_id",
+ pkt_offset=52
+ ),
+ STLVmWrFlowVar(
+ fv_name=u"in_mac",
+ pkt_offset=58
+ ),
+ STLVmWrFlowVar(
+ fv_name=u"in_mac",
+ pkt_offset=64
+ ),
+ STLVmWrFlowVar(
+ fv_name=u"in_ip",
+ pkt_offset=82
+ ),
+ STLVmWrFlowVar(
+ fv_name=u"in_ip",
+ pkt_offset=86
+ ),
+ STLVmFixIpv4(
+ offset=u"IP"
+ )
+ ]
+ )
# Direction 1 --> 0
- vm2 = STLScVmRaw([
- STLVmFlowVar(name='nf_id', size=1, op='inc',
- min_value=0, max_value=self.nf_chains - 1),
- STLVmFlowVar(name='in_mac', size=2, op='inc',
- min_value=0, max_value=255),
- STLVmFlowVar(name='in_ip', size=1, op='inc',
- min_value=0, max_value=255),
- STLVmFlowVar(name='src_port', size=2, op='random',
- min_value=1024, max_value=65535),
- STLVmWrFlowVar(fv_name='nf_id', pkt_offset=32),
- STLVmWrFlowVar(fv_name='src_port', pkt_offset='UDP.sport'),
- STLVmWrFlowVar(fv_name='nf_id', pkt_offset=52),
- STLVmWrFlowVar(fv_name='in_mac', pkt_offset=58),
- STLVmWrFlowVar(fv_name='in_mac', pkt_offset=64),
- STLVmWrFlowVar(fv_name='in_ip', pkt_offset=82),
- STLVmWrFlowVar(fv_name='in_ip', pkt_offset=86),
- STLVmFixIpv4(offset = 'IP')
- ])
+ vm2 = STLScVmRaw(
+ [
+ STLVmFlowVar(
+ name=u"nf_id",
+ size=1,
+ op=u"inc",
+ min_value=0,
+ max_value=self.nf_chains - 1
+ ),
+ STLVmFlowVar(
+ name=u"in_mac",
+ size=2,
+ op=u"inc",
+ min_value=0,
+ max_value=255
+ ),
+ STLVmFlowVar(
+ name=u"in_ip",
+ size=1,
+ op=u"inc",
+ min_value=0,
+ max_value=255
+ ),
+ STLVmFlowVar(
+ name=u"src_port",
+ size=2,
+ op=u"random",
+ min_value=1024,
+ max_value=65535
+ ),
+ STLVmWrFlowVar(
+ fv_name=u"nf_id",
+ pkt_offset=32
+ ),
+ STLVmWrFlowVar(
+ fv_name=u"src_port",
+ pkt_offset=u"UDP.sport"
+ ),
+ STLVmWrFlowVar(
+ fv_name=u"nf_id",
+ pkt_offset=52
+ ),
+ STLVmWrFlowVar(
+ fv_name=u"in_mac",
+ pkt_offset=58
+ ),
+ STLVmWrFlowVar(
+ fv_name=u"in_mac",
+ pkt_offset=64
+ ),
+ STLVmWrFlowVar(
+ fv_name=u"in_ip",
+ pkt_offset=82
+ ),
+ STLVmWrFlowVar(
+ fv_name=u"in_ip",
+ pkt_offset=86
+ ),
+ STLVmFixIpv4(
+ offset=u"IP"
+ )
+ ]
+ )
return base_pkt_a, base_pkt_b, vm1, vm2