diff options
author | Peter Mikus <pmikus@cisco.com> | 2019-06-13 15:01:34 +0000 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2019-07-24 11:22:46 +0000 |
commit | c58cba70baa74588619018a2e8b461592bff1bf4 (patch) | |
tree | 64a1c247b5b49163ff0bb753e13980301f4154e7 /resources | |
parent | 7da0581190efdf16026f84899ba33f33e5240f46 (diff) |
NF_density dot1qip4udpvxlan
+ NF_density compatible
+ Baseline VM tests compatible
+ Scalability NxM
- 3n variant is missing in VXLAN and DOT1Q due to requests to have it
asymmetrical - TODO
Change-Id: Ia817d7be00622b594b451bc07756240d1a379e04
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources')
12 files changed, 1375 insertions, 166 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index 6de17d10d9..279f9a0e25 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -711,18 +711,18 @@ class InterfaceUtil(object): """Create VLAN sub-interface on node. :param node: Node to add VLAN subinterface on. - :param interface: Interface name on which create VLAN subinterface. + :param interface: Interface name or index on which create VLAN + subinterface. :param vlan: VLAN ID of the subinterface to be created. :type node: dict - :type interface: str + :type interface: str on int :type vlan: int :returns: Name and index of created subinterface. :rtype: tuple :raises RuntimeError: if it is unable to create VLAN subinterface on the - node. + node or interface cannot be converted. """ - iface_key = Topology.get_interface_by_name(node, interface) - sw_if_index = Topology.get_interface_sw_index(node, iface_key) + sw_if_index = InterfaceUtil.get_interface_index(node, interface) cmd = 'create_vlan_subif' args = dict(sw_if_index=sw_if_index, @@ -782,6 +782,33 @@ class InterfaceUtil(object): return sw_if_index @staticmethod + def set_vxlan_bypass(node, interface=None): + """Add the 'ip4-vxlan-bypass' graph node for a given interface. + + By adding the IPv4 vxlan-bypass graph node to an interface, the node + checks for and validate input vxlan packet and bypass ip4-lookup, + ip4-local, ip4-udp-lookup nodes to speedup vxlan packet forwarding. + This node will cause extra overhead to for non-vxlan packets which is + kept at a minimum. + + :param node: Node where to set VXLAN bypass. + :param interface: Numeric index or name string of a specific interface. + :type node: dict + :type interface: int or str + :raises RuntimeError: if it failed to set VXLAN bypass on interface. + """ + sw_if_index = InterfaceUtil.get_interface_index(node, interface) + + cmd = 'sw_interface_set_vxlan_bypass' + args = dict(is_ipv6=0, + sw_if_index=sw_if_index, + enable=1) + err_msg = 'Failed to set VXLAN bypass on interface on host {host}'.\ + format(host=node['host']) + with PapiSocketExecutor(node) as papi_exec: + papi_exec.add(cmd, **args).get_replies(err_msg) + + @staticmethod def vxlan_dump(node, interface=None): """Get VxLAN data for the given interface. diff --git a/resources/libraries/python/autogen/Regenerator.py b/resources/libraries/python/autogen/Regenerator.py index ee387e1c4f..89acff73ae 100644 --- a/resources/libraries/python/autogen/Regenerator.py +++ b/resources/libraries/python/autogen/Regenerator.py @@ -73,7 +73,8 @@ class Regenerator(object): protocol_to_min_frame_size = { "ip4": 64, "ip6": 78, - "vxlan+ip4": 114 # What is the real minimum for latency stream? + "ethip4vxlan": 114, # What is the real minimum for latency stream? + "dot1qip4vxlan": 118 } min_frame_size_values = protocol_to_min_frame_size.values() diff --git a/resources/libraries/robot/performance/performance_configuration.robot b/resources/libraries/robot/performance/performance_configuration.robot index a000fa2fd7..b04f9d9f34 100644 --- a/resources/libraries/robot/performance/performance_configuration.robot +++ b/resources/libraries/robot/performance/performance_configuration.robot @@ -1619,8 +1619,8 @@ | | ... | | ... | *Note:* | | ... | Socket paths for VM are defined in following format: -| | ... | - /tmp/sock-\${VM_ID}-1 -| | ... | - /tmp/sock-\${VM_ID}-2 +| | ... | - /var/run/vpp/sock-\${VM_ID}-1 +| | ... | - /var/run/vpp/sock-\${VM_ID}-2 | | ... | | ... | *Example:* | | ... @@ -1629,24 +1629,27 @@ | | ... | | [Arguments] | ${dut} | ${nf_chain}=${1} | ${nf_nodes}=${1} | | ... -| | ${bd_id2}= | Evaluate | ${nf_nodes}+1 -| | Add interface to bridge domain | ${nodes['${dut}']} -| | ... | ${${dut}_if1} | ${1} -| | Add interface to bridge domain | ${nodes['${dut}']} -| | ... | ${${dut}_if2} | ${bd_id2} -| | :FOR | ${nf_node} | IN RANGE | 1 | ${nf_nodes}+1 +| | ${bd_id1}= | Evaluate | ${nf_nodes} * (${nf_chain} - 1) + ${nf_chain} +| | ${bd_id2}= | Evaluate | ${nf_nodes} * ${nf_chain} + ${nf_chain} +| | ${dut_str}= | Convert To Lowercase | ${dut} +| | Add interface to bridge domain +| | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${nf_chain}_1} +| | ... | ${bd_id1} +| | Add interface to bridge domain +| | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${nf_chain}_2} +| | ... | ${bd_id2} +| | :FOR | ${nf_node} | IN RANGE | 1 | ${nf_nodes} + 1 | | | ${qemu_id}= | Evaluate | (${nf_chain} - ${1}) * ${nf_nodes} + ${nf_node} -| | | ${sock1}= | Set Variable | /var/run/vpp/sock-${qemu_id}-1 -| | | ${sock2}= | Set Variable | /var/run/vpp/sock-${qemu_id}-2 -| | | Configure vhost interfaces for L2BD forwarding | ${nodes['${dut}']} -| | | ... | ${sock1} | ${sock2} -| | | ... | ${dut}-vhost-${qemu_id}-if1 -| | | ... | ${dut}-vhost-${qemu_id}-if2 -| | | ${bd_id2}= | Evaluate | ${nf_node}+1 -| | | Add interface to bridge domain | ${nodes['${dut}']} -| | | ... | ${${dut}-vhost-${qemu_id}-if1} | ${nf_node} -| | | Add interface to bridge domain | ${nodes['${dut}']} -| | | ... | ${${dut}-vhost-${qemu_id}-if2} | ${bd_id2} +| | | Configure vhost interfaces for L2BD forwarding +| | | ... | ${nodes['${dut}']} +| | | ... | /var/run/vpp/sock-${qemu_id}-1 | /var/run/vpp/sock-${qemu_id}-2 +| | | ... | ${dut}-vhost-${qemu_id}-if1 | ${dut}-vhost-${qemu_id}-if2 +| | | ${bd_id1}= | Evaluate | ${qemu_id} + (${nf_chain} - 1) +| | | ${bd_id2}= | Evaluate | ${bd_id1} + 1 +| | | Add interface to bridge domain +| | | ... | ${nodes['${dut}']} | ${${dut}-vhost-${qemu_id}-if1} | ${bd_id1} +| | | Add interface to bridge domain +| | | ... | ${nodes['${dut}']} | ${${dut}-vhost-${qemu_id}-if2} | ${bd_id2} | Initialize L2 bridge domains with Vhost-User | | [Documentation] @@ -1665,10 +1668,9 @@ | | ... | | [Arguments] | ${nf_chain}=${1} | ${nf_nodes}=${1} | | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} -| | | Initialize L2 bridge domains with Vhost-User on node | ${dut} -| | | ... | nf_chain=${nf_chain} | nf_nodes=${nf_nodes} +| | | Initialize L2 bridge domains with Vhost-User on node +| | | ... | ${dut} | nf_chain=${nf_chain} | nf_nodes=${nf_nodes} | Initialize L2 bridge domains for multiple chains with Vhost-User | | [Documentation] @@ -1676,6 +1678,7 @@ | | ... | with defined number of VNF nodes on all defined VPP nodes. Add each | | ... | Vhost-User interface into L2 bridge domains with learning enabled | | ... | with physical inteface or Vhost-User interface of another VM. +| | ... | Put all interfaces in path up. | | ... | | ... | *Arguments:* | | ... | - nf_chains - Number of chains of NFs. Type: integer @@ -1688,9 +1691,10 @@ | | ... | | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | | ... -| | :FOR | ${nf_chain} | IN RANGE | 1 | ${nf_chains}+1 -| | | Initialize L2 bridge domains with Vhost-User | nf_chain=${nf_chain} -| | | ... | nf_nodes=${nf_nodes} +| | Set interfaces in path up +| | :FOR | ${nf_chain} | IN RANGE | 1 | ${nf_chains} + 1 +| | | Initialize L2 bridge domains with Vhost-User +| | | ... | nf_chain=${nf_chain} | nf_nodes=${nf_nodes} | Initialize L2 bridge domain with VXLANoIPv4 in 3-node circular topology | | [Documentation] @@ -2058,6 +2062,17 @@ | | Add interface to bridge domain | ${dut2} | ${vhost_if2} | ${bd_id2} | | Add interface to bridge domain | ${dut2} | ${dut2_if2} | ${bd_id2} +| Add VLAN strip offload switch off +| | [Documentation] +| | ... | Add VLAN Strip Offload switch off on all PCI devices. +| | ... +| | :FOR | ${dut} | IN | @{duts} +| | | ${dut_str}= | Convert To Lowercase | ${dut} +| | | Run keyword | ${dut}.Add DPDK Dev Parameter | ${${dut_str}_if1_pci} +| | | ... | vlan-strip-offload | off +| | | Run keyword | ${dut}.Add DPDK Dev Parameter | ${${dut_str}_if2_pci} +| | | ... | vlan-strip-offload | off + | Add VLAN strip offload switch off between DUTs in 3-node single link topology | | [Documentation] | | ... | Add VLAN Strip Offload switch off on PCI devices between DUTs to VPP @@ -2897,7 +2912,7 @@ | | | ${acl} = | Run Keyword If | '${acl}' == '${EMPTY}' | | | ... | Set Variable | ipv4 ${acl_action} src ${subnet} | | | ... | ELSE -| | | ... | Catenate | SEPARATOR=, | ${acl} +| | | ... | Catenate | SEPARATOR=", " | ${acl} | | | ... | ipv4 ${acl_action} src ${subnet} | | Add Replace Acl Multi Entries | ${dut} | rules=${acl} | | @{acl_list} = | Create List | ${0} diff --git a/resources/libraries/robot/shared/interfaces.robot b/resources/libraries/robot/shared/interfaces.robot index 5b6ebc743d..a3b4223c48 100644 --- a/resources/libraries/robot/shared/interfaces.robot +++ b/resources/libraries/robot/shared/interfaces.robot @@ -44,3 +44,219 @@ | | [Return] | ${vhost_dump} | | ... | | ${vhost_dump}= | Vhost User Dump | ${dut_node} + +| Initialize layer interface on node +| | [Documentation] +| | ... | Baseline interfaces variables to be created. +| | ... +| | ... | *Arguments:* +| | ... | - dut - DUT node. Type: string +| | ... | - count - Number of baseline interface variables. Type: integer +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Initialize layer interface on node \| DUT1 \| 1 \| +| | ... +| | [Arguments] | ${dut} | ${count}=${1} +| | ... +| | ${dut_str}= | Convert To Lowercase | ${dut} +| | :FOR | ${id} | IN RANGE | 1 | ${count} + 1 +| | | Set Test Variable | ${${dut_str}_if_${id}_1} | ${${dut_str}_if1} +| | | Set Test Variable | ${${dut_str}_if_${id}_2} | ${${dut_str}_if2} + +| Initialize layer interface +| | [Documentation] +| | ... | Physical interfaces variables to be created on all DUTs. +| | ... +| | ... | *Arguments:* +| | ... | - count - Number of untagged interfaces variables. Type: integer +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Initialize layer interface \| 1 \| +| | ... +| | [Arguments] | ${count}=${1} +| | ... +| | :FOR | ${dut} | IN | @{duts} +| | | Initialize layer interface on node | ${dut} | count=${count} +| | Set Test Variable | ${prev_layer} | if +| | Set interfaces in path up + +| Initialize layer bonding on node +| | [Documentation] +| | ... | Bonded interface and variables to be created on across east and +| | ... | west DUT's node interfaces. +| | ... +| | ... | *Arguments:* +| | ... | - dut - DUT node. Type: string +| | ... | - bond_mode - Link bonding mode. Type: string +| | ... | - lb_mode - Load balance mode. Type: string +| | ... | - count - Number of bond interface variables. Type: integer +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Initialize layer bonding on node \| DUT1 \| xor \| l34 \| 1 \| +| | ... +| | [Arguments] | ${dut} | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1} +| | ... +| | ${dut_str}= | Convert To Lowercase | ${dut} +| | ${if_index}= | VPP Create Bond Interface +| | ... | ${nodes['${dut}']} | ${bond_mode} | load_balance=${lb_mode} +| | ... | mac=00:00:00:01:01:01 +| | Set Interface State | ${nodes['${dut}']} | ${if_index} | up +| | VPP Enslave Physical Interface +| | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_1_1} | ${if_index} +| | VPP Enslave Physical Interface +| | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_1_2} | ${if_index} +| | :FOR | ${id} | IN RANGE | 1 | ${count} + 1 +| | | Set Test Variable | ${${dut_str}_bond_${id}_1} | ${if_index} +| | | Set Test Variable | ${${dut_str}_bond_${id}_2} | ${if_index} + +| Initialize layer bonding +| | [Documentation] +| | ... | Bonded interfaces and variables to be created on all DUT's interfaces. +| | ... +| | ... | *Arguments:* +| | ... | - bond_mode - Link bonding mode. Type: string +| | ... | - lb_mode - Load balance mode. Type: string +| | ... | - count - Number of bond interface variables. Type: integer +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Initialize layer bonding \| xor \| l34 \| 1 \| +| | ... +| | [Arguments] | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1} +| | ... +| | :FOR | ${dut} | IN | @{duts} +| | | Initialize layer bonding on node +| | | ... | ${dut} | bond_mode=${bond_mode} | lb_mode=${lb_mode} +| | | ... | count=${count} +| | Set Test Variable | ${prev_layer} | bond + +| Initialize layer dot1q on node +| | [Documentation] +| | ... | Dot1q interfaces and variables to be created on all DUT's node +| | ... | interfaces. +| | ... +| | ... | *Arguments:* +| | ... | - dut - DUT node. Type: string +| | ... | - count - Number of tagged interfaces. Type: integer +| | ... | - create - Whether to create vlan subinterface for each chain. +| | ... | Type: boolean +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Initialize layer dot1q on node \| DUT1 \| 1 \| True \| +| | ... +| | [Arguments] | ${dut} | ${count}=${1} | ${create}=${True} +| | ... +| | ${dut_str}= | Convert To Lowercase | ${dut} +| | :FOR | ${id} | IN RANGE | 1 | ${count} + 1 +| | | ${vlan_west}= | Evaluate | 100 + ${id} - 1 +| | | ${vlan_east}= | Evaluate | 200 + ${id} - 1 +| | | ${if1_name} | ${if1_index}= | Run Keyword Unless +| | | ... | ${create} and ${id} > ${1} +| | | ... | Create Vlan Subinterface +| | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_1} +| | | ... | ${vlan_west} +| | | ${if2_name} | ${if2_index}= | Run Keyword Unless +| | | ... | ${create} and ${id} > ${1} +| | | ... | Create Vlan Subinterface +| | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_2} +| | | ... | ${vlan_east} +| | | Run Keyword Unless | ${create} and ${id} > ${1} +| | | ... | Set Interface State | ${nodes['${dut}']} | ${if1_index} | up +| | | Run Keyword Unless | ${create} and ${id} > ${1} +| | | ... | Set Interface State | ${nodes['${dut}']} | ${if2_index} | up +| | | Set Test Variable | ${${dut_str}_dot1q_${id}_1} | ${if1_index} +| | | Set Test Variable | ${${dut_str}_dot1q_${id}_2} | ${if2_index} + +| Initialize layer dot1q +| | [Documentation] +| | ... | Dot1q interfaces and variables to be created on all DUT's interfaces. +| | ... +| | ... | *Arguments:* +| | ... | - count - Number of tagged interfaces. Type: integer +| | ... | - create - Whether to create vlan for each chain. Type: boolean +| | ... +| | ... | \| Initialize layer dot1q \| 1 \| True \| +| | ... +| | [Arguments] | ${count}=${1} | ${create}=${True} +| | ... +| | :FOR | ${dut} | IN | @{duts} +| | | Initialize layer dot1q on node | ${dut} | count=${count} +| | | ... | create=${create} +| | Set Test Variable | ${prev_layer} | dot1q + +| Initialize layer ip4vxlan on node +| | [Documentation] +| | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting +| | ... | physical and vxlan interfaces on each DUT. All interfaces are brought +| | ... | up. IPv4 addresses with prefix /24 are configured on interfaces +| | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces. +| | ... +| | ... | *Arguments:* +| | ... | - dut - DUT node. Type: string +| | ... | - count - Number of vxlan interfaces. Type: integer +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Initialize layer ip4vxlan on node \| DUT1 \| 1 \| +| | ... +| | [Arguments] | ${dut} | ${count}=${1} +| | ... +| | ${dut_str}= | Convert To Lowercase | ${dut} +| | Configure IP addresses on interfaces +| | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_1_1} +| | ... | 172.16.0.1 | 24 +| | Configure IP addresses on interfaces +| | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_1_2} +| | ... | 172.26.0.1 | 24 +| | :FOR | ${id} | IN RANGE | 1 | ${count} + 1 +| | | ${subnet}= | Evaluate | ${id} - 1 +| | | ${vni}= | Evaluate | ${id} - 1 +| | | ${ip4vxlan_1}= | Create VXLAN interface +| | | ... | ${nodes['${dut}']} | ${vni} | 172.16.0.1 | 172.17.${subnet}.2 +| | | ${ip4vxlan_2}= | Create VXLAN interface +| | | ... | ${nodes['${dut}']} | ${vni} | 172.26.0.1 | 172.27.${subnet}.2 +| | | ${prev_mac}= | Set Variable If | '${dut}' == 'DUT1' +| | | ... | ${tg_if1_mac} | ${dut1_if2_mac} +| | | ${next_mac}= | Set Variable If | '${dut}' == 'DUT1' and ${duts_count} == 2 +| | | ... | ${dut2_if1_mac} | ${tg_if2_mac} +| | | VPP Add IP Neighbor +| | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_1} +| | | ... | 172.16.${subnet}.2 | ${prev_mac} +| | | VPP Add IP Neighbor +| | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_2} +| | | ... | 172.26.${subnet}.2 | ${next_mac} +| | | VPP Route Add +| | | ... | ${nodes['${dut}']} | 172.17.${subnet}.0 | 24 +| | | ... | gateway=172.16.${subnet}.2 +| | | ... | interface=${${dut_str}_${prev_layer}_${id}_1} +| | | VPP Route Add +| | | ... | ${nodes['${dut}']} | 172.27.${subnet}.0 | 24 +| | | ... | gateway=172.26.${subnet}.2 +| | | ... | interface=${${dut_str}_${prev_layer}_${id}_2} +| | | Set VXLAN Bypass +| | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_1} +| | | Set VXLAN Bypass +| | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_2} +| | | Set Test Variable +| | | ... | ${${dut_str}_ip4vxlan_${id}_1} | ${ip4vxlan_1} +| | | Set Test Variable +| | | ... | ${${dut_str}_ip4vxlan_${id}_2} | ${ip4vxlan_2} + +| Initialize layer ip4vxlan +| | [Documentation] +| | ... | VXLAN interfaces and variables to be created on all DUT's interfaces. +| | ... +| | ... | *Arguments:* +| | ... | - count - Number of vxlan interfaces. Type: integer +| | ... +| | ... | \| Initialize layer ip4vxlan \| 1 \| +| | ... +| | [Arguments] | ${count}=${1} +| | ... +| | :FOR | ${dut} | IN | @{duts} +| | | Initialize layer ip4vxlan on node | ${dut} | count=${count} +| | Set Test Variable | ${prev_layer} | ip4vxlan diff --git a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src10udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src10udpsrcrnd.py new file mode 100755 index 0000000000..854e327966 --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src10udpsrcrnd.py @@ -0,0 +1,156 @@ +# Copyright (c) 2019 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: +# +# 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. + +"""Stream profile for T-rex traffic generator. + +Stream profile: + - Two streams sent in directions 0 --> 1 and 1 --> 0 at the same time. + - Packet: ETH / DOT1Q / IP / VXLAN / ETH / IP + - Direction 0 --> 1: + - VLAN range: 100 + - Source IP address: 172.17.[0..9].2 + - Destination IP address: 172.16.0.1 + - Source UDP port: random([1024..65535]) + - Destination UDP port: 4789 + - VXLAN VNI: [0..9] + - Payload source MAC address: 00:aa:aa:00:00:[00..ff] + - Payload source IP address: 10.0.[0..255].2 + - Payload destination MAC address: 00:bb:bb:00:00:[00..ff] + - Payload destination IP address: 10.0.[0..255].1 + - Direction 1 --> 0: + - VLAN range: 200 + - Source IP address: 172.27.[0..9].2 + - Destination IP address: 172.26.0.1 + - Source UDP port: random([1024..65535]) + - Destination UDP port: 4789 + - VXLAN VNI: [0..9] + - Payload source MAC address: 00:bb:bb:00:00:[00..ff] + - Payload source IP address: 10.0.[0..255].1 + - Payload destination MAC address: 00:aa:aa:00:00:[00..ff] + - Payload destination IP address: 10.0.[0..255].2 +""" + +from trex.stl.api import * +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") + + +class VXLAN(Packet): + name = 'VXLAN' + fields_desc = [FlagsField('flags', 0x08000000, 32, _VXLAN_FLAGS), + ThreeBytesField('vni', 0), + XByteField('reserved', 0x00)] + + def mysummary(self): + return self.sprintf("VXLAN (vni=%VXLAN.vni%)") + + +bind_layers(UDP, VXLAN, dport=4789) +bind_layers(VXLAN, Ether) + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + self.nf_chains = 10 + + def define_packets(self): + """Defines the packets to be sent from the traffic generator. + + Packet definition: | ETH | DOT1Q | IP | VXLAN | ETH | IP + + :returns: Packets to be sent from the traffic generator. + :rtype: tuple + """ + + # 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)) + + # 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)) + + # 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') + ]) + + # 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') + ]) + + return base_pkt_a, base_pkt_b, vm1, vm2 + +def register(): + """Register this traffic profile to T-rex. + + Do not change this function. + + :return: Traffic streams. + :rtype: Object + """ + return TrafficStreams() + diff --git a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src1udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src1udpsrcrnd.py new file mode 100755 index 0000000000..77247102b7 --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src1udpsrcrnd.py @@ -0,0 +1,156 @@ +# Copyright (c) 2019 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: +# +# 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. + +"""Stream profile for T-rex traffic generator. + +Stream profile: + - Two streams sent in directions 0 --> 1 and 1 --> 0 at the same time. + - Packet: ETH / DOT1Q / IP / VXLAN / ETH / IP + - Direction 0 --> 1: + - VLAN range: 100 + - Source IP address: 172.17.0.2 + - Destination IP address: 172.16.0.1 + - Source UDP port: random([1024..65535]) + - Destination UDP port: 4789 + - VXLAN VNI: 0 + - Payload source MAC address: 00:aa:aa:00:00:[00..ff] + - Payload source IP address: 10.0.[0..255].2 + - Payload destination MAC address: 00:bb:bb:00:00:[00..ff] + - Payload destination IP address: 10.0.[0..255].1 + - Direction 1 --> 0: + - VLAN range: 200 + - Source IP address: 172.27.0.2 + - Destination IP address: 172.26.0.1 + - Source UDP port: random([1024..65535]) + - Destination UDP port: 4789 + - VXLAN VNI: 0 + - Payload source MAC address: 00:bb:bb:00:00:[00..ff] + - Payload source IP address: 10.0.[0..255].1 + - Payload destination MAC address: 00:aa:aa:00:00:[00..ff] + - Payload destination IP address: 10.0.[0..255].2 +""" + +from trex.stl.api import * +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") + + +class VXLAN(Packet): + name = 'VXLAN' + fields_desc = [FlagsField('flags', 0x08000000, 32, _VXLAN_FLAGS), + ThreeBytesField('vni', 0), + XByteField('reserved', 0x00)] + + def mysummary(self): + return self.sprintf("VXLAN (vni=%VXLAN.vni%)") + + +bind_layers(UDP, VXLAN, dport=4789) +bind_layers(VXLAN, Ether) + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + self.nf_chains = 1 + + def define_packets(self): + """Defines the packets to be sent from the traffic generator. + + Packet definition: | ETH | DOT1Q | IP | VXLAN | ETH | IP + + :returns: Packets to be sent from the traffic generator. + :rtype: tuple + """ + + # 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)) + + # 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)) + + # 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') + ]) + + # 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') + ]) + + return base_pkt_a, base_pkt_b, vm1, vm2 + +def register(): + """Register this traffic profile to T-rex. + + Do not change this function. + + :return: Traffic streams. + :rtype: Object + """ + return TrafficStreams() + diff --git a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src2udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src2udpsrcrnd.py new file mode 100755 index 0000000000..c82dd23b58 --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src2udpsrcrnd.py @@ -0,0 +1,156 @@ +# Copyright (c) 2019 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: +# +# 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. + +"""Stream profile for T-rex traffic generator. + +Stream profile: + - Two streams sent in directions 0 --> 1 and 1 --> 0 at the same time. + - Packet: ETH / DOT1Q / IP / VXLAN / ETH / IP + - Direction 0 --> 1: + - VLAN range: 100 + - Source IP address: 172.17.[0..1].2 + - Destination IP address: 172.16.0.1 + - Source UDP port: random([1024..65535]) + - Destination UDP port: 4789 + - VXLAN VNI: [0..1] + - Payload source MAC address: 00:aa:aa:00:00:[00..ff] + - Payload source IP address: 10.0.[0..255].2 + - Payload destination MAC address: 00:bb:bb:00:00:[00..ff] + - Payload destination IP address: 10.0.[0..255].1 + - Direction 1 --> 0: + - VLAN range: 200 + - Source IP address: 172.27.[0..1].2 + - Destination IP address: 172.26.0.1 + - Source UDP port: random([1024..65535]) + - Destination UDP port: 4789 + - VXLAN VNI: [0..1] + - Payload source MAC address: 00:bb:bb:00:00:[00..ff] + - Payload source IP address: 10.0.[0..255].1 + - Payload destination MAC address: 00:aa:aa:00:00:[00..ff] + - Payload destination IP address: 10.0.[0..255].2 +""" + +from trex.stl.api import * +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") + + +class VXLAN(Packet): + name = 'VXLAN' + fields_desc = [FlagsField('flags', 0x08000000, 32, _VXLAN_FLAGS), + ThreeBytesField('vni', 0), + XByteField('reserved', 0x00)] + + def mysummary(self): + return self.sprintf("VXLAN (vni=%VXLAN.vni%)") + + +bind_layers(UDP, VXLAN, dport=4789) +bind_layers(VXLAN, Ether) + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + self.nf_chains = 2 + + def define_packets(self): + """Defines the packets to be sent from the traffic generator. + + Packet definition: | ETH | DOT1Q | IP | VXLAN | ETH | IP + + :returns: Packets to be sent from the traffic generator. + :rtype: tuple + """ + + # 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)) + + # 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)) + + # 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') + ]) + + # 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') + ]) + + return base_pkt_a, base_pkt_b, vm1, vm2 + +def register(): + """Register this traffic profile to T-rex. + + Do not change this function. + + :return: Traffic streams. + :rtype: Object + """ + return TrafficStreams() + diff --git a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src4udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src4udpsrcrnd.py new file mode 100755 index 0000000000..317d269c8d --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src4udpsrcrnd.py @@ -0,0 +1,156 @@ +# Copyright (c) 2019 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: +# +# 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. + +"""Stream profile for T-rex traffic generator. + +Stream profile: + - Two streams sent in directions 0 --> 1 and 1 --> 0 at the same time. + - Packet: ETH / DOT1Q / IP / VXLAN / ETH / IP + - Direction 0 --> 1: + - VLAN range: 100 + - Source IP address: 172.17.[0..3].2 + - Destination IP address: 172.16.0.1 + - Source UDP port: random([1024..65535]) + - Destination UDP port: 4789 + - VXLAN VNI: [0..3] + - Payload source MAC address: 00:aa:aa:00:00:[00..ff] + - Payload source IP address: 10.0.[0..255].2 + - Payload destination MAC address: 00:bb:bb:00:00:[00..ff] + - Payload destination IP address: 10.0.[0..255].1 + - Direction 1 --> 0: + - VLAN range: 200 + - Source IP address: 172.27.[0..3].2 + - Destination IP address: 172.26.0.1 + - Source UDP port: random([1024..65535]) + - Destination UDP port: 4789 + - VXLAN VNI: [0..3] + - Payload source MAC address: 00:bb:bb:00:00:[00..ff] + - Payload source IP address: 10.0.[0..255].1 + - Payload destination MAC address: 00:aa:aa:00:00:[00..ff] + - Payload destination IP address: 10.0.[0..255].2 +""" + +from trex.stl.api import * +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") + + +class VXLAN(Packet): + name = 'VXLAN' + fields_desc = [FlagsField('flags', 0x08000000, 32, _VXLAN_FLAGS), + ThreeBytesField('vni', 0), + XByteField('reserved', 0x00)] + + def mysummary(self): + return self.sprintf("VXLAN (vni=%VXLAN.vni%)") + + +bind_layers(UDP, VXLAN, dport=4789) +bind_layers(VXLAN, Ether) + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + self.nf_chains = 4 + + def define_packets(self): + """Defines the packets to be sent from the traffic generator. + + Packet definition: | ETH | DOT1Q | IP | VXLAN | ETH | IP + + :returns: Packets to be sent from the traffic generator. + :rtype: tuple + """ + + # 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)) + + # 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)) + + # 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') + ]) + + # 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') + ]) + + return base_pkt_a, base_pkt_b, vm1, vm2 + +def register(): + """Register this traffic profile to T-rex. + + Do not change this function. + + :return: Traffic streams. + :rtype: Object + """ + return TrafficStreams() + diff --git a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src6udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src6udpsrcrnd.py new file mode 100755 index 0000000000..d4dd81c5db --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src6udpsrcrnd.py @@ -0,0 +1,156 @@ +# Copyright (c) 2019 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: +# +# 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. + +"""Stream profile for T-rex traffic generator. + +Stream profile: + - Two streams sent in directions 0 --> 1 and 1 --> 0 at the same time. + - Packet: ETH / DOT1Q / IP / VXLAN / ETH / IP + - Direction 0 --> 1: + - VLAN range: 100 + - Source IP address: 172.17.[0..5].2 + - Destination IP address: 172.16.0.1 + - Source UDP port: random([1024..65535]) + - Destination UDP port: 4789 + - VXLAN VNI: [0..5] + - Payload source MAC address: 00:aa:aa:00:00:[00..ff] + - Payload source IP address: 10.0.[0..255].2 + - Payload destination MAC address: 00:bb:bb:00:00:[00..ff] + - Payload destination IP address: 10.0.[0..255].1 + - Direction 1 --> 0: + - VLAN range: 200 + - Source IP address: 172.27.[0..5].2 + - Destination IP address: 172.26.0.1 + - Source UDP port: random([1024..65535]) + - Destination UDP port: 4789 + - VXLAN VNI: [0..5] + - Payload source MAC address: 00:bb:bb:00:00:[00..ff] + - Payload source IP address: 10.0.[0..255].1 + - Payload destination MAC address: 00:aa:aa:00:00:[00..ff] + - Payload destination IP address: 10.0.[0..255].2 +""" + +from trex.stl.api import * +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") + + +class VXLAN(Packet): + name = 'VXLAN' + fields_desc = [FlagsField('flags', 0x08000000, 32, _VXLAN_FLAGS), + ThreeBytesField('vni', 0), + XByteField('reserved', 0x00)] + + def mysummary(self): + return self.sprintf("VXLAN (vni=%VXLAN.vni%)") + + +bind_layers(UDP, VXLAN, dport=4789) +bind_layers(VXLAN, Ether) + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + self.nf_chains = 6 + + def define_packets(self): + """Defines the packets to be sent from the traffic generator. + + Packet definition: | ETH | DOT1Q | IP | VXLAN | ETH | IP + + :returns: Packets to be sent from the traffic generator. + :rtype: tuple + """ + + # 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)) + + # 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)) + + # 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') + ]) + + # 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') + ]) + + return base_pkt_a, base_pkt_b, vm1, vm2 + +def register(): + """Register this traffic profile to T-rex. + + Do not change this function. + + :return: Traffic streams. + :rtype: Object + """ + return TrafficStreams() + diff --git a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py new file mode 100755 index 0000000000..29548a3e62 --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py @@ -0,0 +1,156 @@ +# Copyright (c) 2019 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: +# +# 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. + +"""Stream profile for T-rex traffic generator. + +Stream profile: + - Two streams sent in directions 0 --> 1 and 1 --> 0 at the same time. + - Packet: ETH / DOT1Q / IP / VXLAN / ETH / IP + - Direction 0 --> 1: + - VLAN range: 100 + - Source IP address: 172.17.[0..7].2 + - Destination IP address: 172.16.0.1 + - Source UDP port: random([1024..65535]) + - Destination UDP port: 4789 + - VXLAN VNI: [0..7] + - Payload source MAC address: 00:aa:aa:00:00:[00..ff] + - Payload source IP address: 10.0.[0..255].2 + - Payload destination MAC address: 00:bb:bb:00:00:[00..ff] + - Payload destination IP address: 10.0.[0..255].1 + - Direction 1 --> 0: + - VLAN range: 200 + - Source IP address: 172.27.[0..7].2 + - Destination IP address: 172.26.0.1 + - Source UDP port: random([1024..65535]) + - Destination UDP port: 4789 + - VXLAN VNI: [0..7] + - Payload source MAC address: 00:bb:bb:00:00:[00..ff] + - Payload source IP address: 10.0.[0..255].1 + - Payload destination MAC address: 00:aa:aa:00:00:[00..ff] + - Payload destination IP address: 10.0.[0..255].2 +""" + +from trex.stl.api import * +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") + + +class VXLAN(Packet): + name = 'VXLAN' + fields_desc = [FlagsField('flags', 0x08000000, 32, _VXLAN_FLAGS), + ThreeBytesField('vni', 0), + XByteField('reserved', 0x00)] + + def mysummary(self): + return self.sprintf("VXLAN (vni=%VXLAN.vni%)") + + +bind_layers(UDP, VXLAN, dport=4789) +bind_layers(VXLAN, Ether) + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + self.nf_chains = 8 + + def define_packets(self): + """Defines the packets to be sent from the traffic generator. + + Packet definition: | ETH | DOT1Q | IP | VXLAN | ETH | IP + + :returns: Packets to be sent from the traffic generator. + :rtype: tuple + """ + + # 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)) + + # 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)) + + # 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') + ]) + + # 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') + ]) + + return base_pkt_a, base_pkt_b, vm1, vm2 + +def register(): + """Register this traffic profile to T-rex. + + Do not change this function. + + :return: Traffic streams. + :rtype: Object + """ + return TrafficStreams() + diff --git a/resources/traffic_profiles/trex/trex-sl-ethip4-vxlansrc253.py b/resources/traffic_profiles/trex/trex-sl-ethip4-vxlansrc253.py deleted file mode 100755 index 69de6e9335..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-ethip4-vxlansrc253.py +++ /dev/null @@ -1,134 +0,0 @@ -# Copyright (c) 2019 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: -# -# 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. - -"""Stream profile for T-rex traffic generator. - -Stream profile: - - Two streams sent in directions 0 --> 1 and 1 --> 0 at the same time. - - Packet: ETH / IP / VXLAN / ETH / IP - - Direction 0 --> 1: - - Source IP address: 172.17.0.2 - - Destination IP address: 172.16.0.1 - - VXLAN VNI: 24 - - Payload source MAC address: 00:de:ad:00:00:00 - - Payload source IP address: 10.0.0.2 - - Payload destination MAC address: 00:de:ad:00:00:01 - - Payload destination IP address: 10.0.0.1 - - Direction 1 --> 0: - - Source IP address: 172.27.0.2 - - Destination IP address: 172.26.0.1 - - VXLAN VNI: 24 - - Payload source MAC address: 00:de:ad:00:00:01 - - Payload source IP address: 10.0.0.1 - - Payload destination MAC address: 00:de:ad:00:00:00 - - Payload destination IP address: 10.0.0.2 - -""" - -from trex.stl.api import * -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") - - -class VXLAN(Packet): - name = "VXLAN" - fields_desc = [FlagsField("flags", 0x08000000, 32, _VXLAN_FLAGS), - ThreeBytesField("vni", 0), - XByteField("reserved", 0x00)] - - def mysummary(self): - return self.sprintf("VXLAN (vni=%VXLAN.vni%)") - - -bind_layers(UDP, VXLAN, dport=4789) -bind_layers(VXLAN, Ether) - - -class TrafficStreams(TrafficStreamsBaseClass): - """Stream profile.""" - - def __init__(self): - """Initialization and setting of streams' parameters.""" - - super(TrafficStreamsBaseClass, self).__init__() - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | IP | - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - # Direction 0 --> 1 - base_pkt_a = ( - Ether()/ - IP(src="172.17.0.2",dst="172.16.0.1")/ - UDP(sport=1337,dport=4789)/ - VXLAN(vni=24)/ - Ether(src="00:de:ad:00:00:00",dst="00:de:ad:00:00:01")/ - IP(src="10.0.0.2",dst="10.0.0.1")) - - # Direction 1 --> 0 - base_pkt_b = ( - Ether()/ - IP(src="172.27.0.2",dst="172.26.0.1")/ - UDP(sport=1337,dport=4789)/ - VXLAN(vni=24)/ - Ether(src="00:de:ad:00:00:01",dst="00:de:ad:00:00:00")/ - IP(src="10.0.0.1",dst="10.0.0.2")) - - - # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmFlowVar(name="src", min_value="172.17.0.2" , - max_value="172.17.0.254", size=4, op="inc"), - STLVmFlowVar(name="src_mac", min_value=2 , max_value=3100, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), - STLVmWrFlowVar(fv_name="src_mac", pkt_offset=60), - STLVmFixIpv4(offset = "IP") - ]) - - # Direction 1 --> 0 - vm2 = STLScVmRaw([ - STLVmFlowVar(name="src", min_value="172.27.0.2" , - max_value="172.27.0.254", size=4, op="inc"), - STLVmFlowVar(name="src_mac", min_value=2 , max_value=3100, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), - STLVmWrFlowVar(fv_name="src_mac", pkt_offset=60), - STLVmFixIpv4(offset = "IP") - ]) - - # for now there's a single VXLAN tunnel per direction, the above - # variations are for reference only - vm1, vm2 = [], [] - - return base_pkt_a, base_pkt_b, vm1, vm2 - -def register(): - """Register this traffic profile to T-rex. - - Do not change this function. - - :return: Traffic streams. - :rtype: Object - """ - return TrafficStreams() - diff --git a/resources/traffic_profiles/trex/trex-sl-ethip4vxlan-ip4src1udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-ethip4vxlan-ip4src1udpsrcrnd.py new file mode 100755 index 0000000000..caf56651fb --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-ethip4vxlan-ip4src1udpsrcrnd.py @@ -0,0 +1,148 @@ +# Copyright (c) 2019 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: +# +# 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. + +"""Stream profile for T-rex traffic generator. + +Stream profile: + - Two streams sent in directions 0 --> 1 and 1 --> 0 at the same time. + - Packet: ETH / IP / VXLAN / ETH / IP + - Direction 0 --> 1: + - Source IP address: 172.17.0.2 + - Destination IP address: 172.16.0.1 + - Source UDP port: random([1024-65535]) + - Destination UDP port: 4789 + - VXLAN VNI: 0 + - Payload source MAC address: 00:aa:aa:00:00:[00..ff] + - Payload source IP address: 10.0.0.2 + - Payload destination MAC address: 00:bb:bb:00:00:[00..ff] + - Payload destination IP address: 10.0.0.1 + - Direction 1 --> 0: + - Source IP address: 172.27.0.2 + - Destination IP address: 172.26.0.1 + - Source UDP port: random([1024-65535]) + - Destination UDP port: 4789 + - VXLAN VNI: 0 + - Payload source MAC address: 00:bb:bb:00:00:[00..ff] + - Payload source IP address: 10.0.0.1 + - Payload destination MAC address: 00:aa:aa:00:00:[00..ff] + - Payload destination IP address: 10.0.0.2 +""" + +from trex.stl.api import * +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") + + +class VXLAN(Packet): + name = 'VXLAN' + fields_desc = [FlagsField('flags', 0x08000000, 32, _VXLAN_FLAGS), + ThreeBytesField('vni', 0), + XByteField('reserved', 0x00)] + + def mysummary(self): + return self.sprintf("VXLAN (vni=%VXLAN.vni%)") + + +bind_layers(UDP, VXLAN, dport=4789) +bind_layers(VXLAN, Ether) + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + self.nf_chains = 1 + + def define_packets(self): + """Defines the packets to be sent from the traffic generator. + + Packet definition: | ETH | IP | VXLAN | ETH | IP + + :returns: Packets to be sent from the traffic generator. + :rtype: tuple + """ + + # Direction 0 --> 1 + base_pkt_a = ( + Ether()/ + 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)) + + # Direction 1 --> 0 + base_pkt_b = ( + Ether()/ + 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)) + + # 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=28), + STLVmWrFlowVar(fv_name='src_port', pkt_offset='UDP.sport'), + STLVmWrFlowVar(fv_name='nf_id', pkt_offset=48), + STLVmWrFlowVar(fv_name='in_mac', pkt_offset=54), + STLVmWrFlowVar(fv_name='in_mac', pkt_offset=60), + STLVmFixIpv4(offset = '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=28), + STLVmWrFlowVar(fv_name='src_port', pkt_offset='UDP.sport'), + STLVmWrFlowVar(fv_name='nf_id', pkt_offset=48), + STLVmWrFlowVar(fv_name='in_mac', pkt_offset=54), + STLVmWrFlowVar(fv_name='in_mac', pkt_offset=60), + STLVmFixIpv4(offset = 'IP') + ]) + + return base_pkt_a, base_pkt_b, vm1, vm2 + +def register(): + """Register this traffic profile to T-rex. + + Do not change this function. + + :return: Traffic streams. + :rtype: Object + """ + return TrafficStreams() + |