diff options
Diffstat (limited to 'resources')
20 files changed, 2350 insertions, 43 deletions
diff --git a/resources/libraries/robot/performance/performance_configuration.robot b/resources/libraries/robot/performance/performance_configuration.robot index f8628d0734..53bb4365e6 100644 --- a/resources/libraries/robot/performance/performance_configuration.robot +++ b/resources/libraries/robot/performance/performance_configuration.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2018 Cisco and/or its affiliates. +# 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: @@ -1686,7 +1686,8 @@ | | ... | | ... | *Arguments:* | | ... | - dut - DUT node. Type: string -| | ... | - vm_count - VM count. Type: integer +| | ... | - nf_chain - NF chain. Type: integer +| | ... | - nf_nodes - Number of NFs nodes per chain. Type: integer | | ... | | ... | *Note:* | | ... | Socket paths for VM are defined in following format: @@ -1696,47 +1697,72 @@ | | ... | *Example:* | | ... | | ... | \| Initialize L2 bridge domains with Vhost-User on node \| DUT1 \ -| | ... | \| 1 \| +| | ... | \| 1 \| 1 \| | | ... -| | [Arguments] | ${dut} | ${vm_count}=${1} +| | [Arguments] | ${dut} | ${nf_chain}=${1} | ${nf_nodes}=${1} | | ... -| | ${bd_id2}= | Evaluate | ${vm_count}+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 | ${number} | IN RANGE | 1 | ${vm_count}+1 -| | | ${sock1}= | Set Variable | /tmp/sock-${number}-1 -| | | ${sock2}= | Set Variable | /tmp/sock-${number}-2 +| | :FOR | ${nf_node} | IN RANGE | 1 | ${nf_nodes}+1 +| | | ${qemu_id}= | Evaluate | (${nf_chain} - ${1}) * ${nf_nodes} + ${nf_node} +| | | ${sock1}= | Set Variable | /tmp/sock-${qemu_id}-1 +| | | ${sock2}= | Set Variable | /tmp/sock-${qemu_id}-2 | | | Configure vhost interfaces for L2BD forwarding | ${nodes['${dut}']} -| | | ... | ${sock1} | ${sock2} | ${dut}-vhost-${number}-if1 -| | | ... | ${dut}-vhost-${number}-if2 -| | | ${bd_id2}= | Evaluate | ${number}+1 +| | | ... | ${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-${number}-if1} | ${number} +| | | ... | ${${dut}-vhost-${qemu_id}-if1} | ${nf_node} | | | Add interface to bridge domain | ${nodes['${dut}']} -| | | ... | ${${dut}-vhost-${number}-if2} | ${bd_id2} +| | | ... | ${${dut}-vhost-${qemu_id}-if2} | ${bd_id2} | Initialize L2 bridge domains with Vhost-User | | [Documentation] -| | ... | Create pairs of Vhost-User interfaces for defined number of VMs on all -| | ... | defined VPP nodes. Add each Vhost-User interface into L2 bridge +| | ... | Create pairs of Vhost-User interfaces for 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. | | ... | | ... | *Arguments:* -| | ... | - vm_count - VM count. Type: integer +| | ... | - nf_chain - NF chain. Type: integer +| | ... | - nf_nodes - Number of NFs nodes per chain. Type: integer | | ... | | ... | *Example:* | | ... -| | ... | \| Initialize L2 bridge domains with Vhost-User \| 1 \| +| | ... | \| Initialize L2 bridge domains with Vhost-User \| 1 \| 1 \| | | ... -| | [Arguments] | ${vm_count}=${1} +| | [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} -| | | ... | vm_count=${vm_count} +| | | ... | nf_chain=${nf_chain} | nf_nodes=${nf_nodes} + +| Initialize L2 bridge domains for multiple chains with Vhost-User +| | [Documentation] +| | ... | Create pairs of Vhost-User interfaces for defined number of NF chains +| | ... | 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. +| | ... +| | ... | *Arguments:* +| | ... | - nf_chains - Number of chains of NFs. Type: integer +| | ... | - nf_nodes - Number of NFs nodes per chain. Type: integer +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Initialize L2 bridge domains for multiple chains with Vhost-User \ +| | ... | \| 1 \| 1 \| +| | ... +| | [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} | Initialize L2 bridge domain with VXLANoIPv4 in 3-node circular topology | | [Documentation] @@ -2263,8 +2289,7 @@ | | ... | - sock2 - Socket path for second Vhost-User interface. | | ... | Type: string | | ... | - vm_name - QemuUtil instance name. Type: string -| | ... | - chains: Total number of chains. Type: integer -| | ... | - nodeness: Total number of nodes per chain. Type: integer +| | ... | - nf_cpus: List of allocated CPUs. Type: list | | ... | - qemu_id - Qemu Id when starting more then one guest VM on DUT | | ... | node. Type: integer | | ... | - jumbo - Set True if jumbo frames are used in the test. @@ -2280,16 +2305,13 @@ | | ... | *Example:* | | ... | | ... | \| Configure guest VM with dpdk-testpmd connected via vhost-user \ -| | ... | \| ${nodes['DUT1']} \| /tmp/sock-2-1 \| /tmp/sock-2-2 \| DUT1_VM2 \ -| | ... | \| qemu_id=${2} \| +| | ... | \| ${nodes['DUT1']} \| /tmp/sock-1-1 \| /tmp/sock-1-2 \ +| | ... | \| DUT1_VM2 \| qemu_id=${2} \| | | ... -| | [Arguments] | ${dut} | ${sock1} | ${sock2} | ${vm_name} | ${chains}=${1} -| | ... | ${nodeness}=${1} | ${qemu_id}=${1} | ${jumbo}=${False} -| | ... | ${perf_qemu_qsz}=${256} | ${use_tuned_cfs}=${False} +| | [Arguments] | ${dut} | ${sock1} | ${sock2} | ${vm_name} | ${nf_cpus} +| | ... | ${qemu_id}=${1} | ${jumbo}=${False} | ${perf_qemu_qsz}=${256} +| | ... | ${use_tuned_cfs}=${False} | | ... -| | ${nf_cpus}= | Create network function CPU list | ${dut} -| | ... | chains=${chains} | nodeness=${nodeness} | chain_id=${1} -| | ... | node_id=${qemu_id} | auto_scale=${True} | | ${nf_cpus_count}= | Get Length | ${nf_cpus} | | Import Library | resources.libraries.python.QemuUtils | qemu_id=${qemu_id} | | ... | WITH NAME | ${vm_name} @@ -2319,9 +2341,8 @@ | | Run keyword | ${vm_name}.Qemu Set Affinity | @{nf_cpus} | | Run keyword If | ${use_tuned_cfs} | ${vm_name}.Qemu Set Scheduler Policy | | ${max_pkt_len}= | Set Variable If | ${jumbo} | 9200 | ${EMPTY} -| | ${testpmd_cpus}= | Evaluate | ${thr_count_int} + ${1} | | ${testpmd_cpus}= | Cpu list per node str | ${nodes['${dut}']} | ${0} -| | ... | cpu_cnt=${testpmd_cpus} +| | ... | cpu_cnt=${nf_cpus_count} | | Dpdk Testpmd Start | ${vm} | eal_corelist=${testpmd_cpus} | | ... | eal_mem_channels=4 | pmd_fwd_mode=io | pmd_disable_hw_vlan=${TRUE} | | ... | pmd_rxd=${perf_qemu_qsz} | pmd_txd=${perf_qemu_qsz} @@ -2353,12 +2374,15 @@ | | ... | ${perf_qemu_qsz}=${256} | ${use_tuned_cfs}=${False} | | ... | | :FOR | ${number} | IN RANGE | 1 | ${vm_count}+1 +| | | ${nf_cpus}= | Create network function CPU list | ${dut} +| | | ... | chains=${1} | nodeness=${vm_count} | chain_id=${1} +| | | ... | node_id=${number} | auto_scale=${True} | | | ${sock1}= | Set Variable | /tmp/sock-${number}-1 | | | ${sock2}= | Set Variable | /tmp/sock-${number}-2 | | | ${vm}= | | | ... | Configure guest VM with dpdk-testpmd connected via vhost-user | | | ... | ${dut} | ${sock1} | ${sock2} | ${dut}_VM${number} -| | | ... | nodeness=${vm_count} | qemu_id=${number} | jumbo=${jumbo} +| | | ... | ${nf_cpus} | qemu_id=${number} | jumbo=${jumbo} | | | ... | perf_qemu_qsz=${perf_qemu_qsz} | use_tuned_cfs=${use_tuned_cfs} | | | Set To Dictionary | ${${dut}_vm_refs} | ${dut}_VM${number} | ${vm} @@ -2405,8 +2429,7 @@ | | ... | - vm_name - QemuUtil instance name. Type: string | | ... | - eth0_mac - MAC address of first Vhost interface. Type: string | | ... | - eth1_mac - MAC address of second Vhost interface. Type: string -| | ... | - chains: Total number of chains. Type: integer -| | ... | - nodeness: Total number of nodes per chain. Type: integer +| | ... | - nf_cpus: List of allocated CPUs. Type: list | | ... | - qemu_id - Qemu Id when starting more then one guest VM on DUT | | ... | node. Type: integer | | ... | - jumbo - Set True if jumbo frames are used in the test. @@ -2426,13 +2449,10 @@ | | ... | \| 00:00:00:00:00:01 \| 00:00:00:00:00:02 \| | | ... | | [Arguments] | ${dut} | ${sock1} | ${sock2} | ${vm_name} -| | ... | ${eth0_mac} | ${eth1_mac} | ${chains}=${1} | ${nodeness}=${1} -| | ... | ${qemu_id}=${1} | ${jumbo}=${False} | ${perf_qemu_qsz}=${256} +| | ... | ${eth0_mac} | ${eth1_mac} | ${nf_cpus} | ${qemu_id}=${1} +| | ... | ${jumbo}=${False} | ${perf_qemu_qsz}=${256} | | ... | ${use_tuned_cfs}=${False} | | ... -| | ${nf_cpus}= | Create network function CPU list | ${dut} -| | ... | chains=${chains} | nodeness=${nodeness} | chain_id=${1} -| | ... | node_id=${qemu_id} | auto_scale=${True} | | ${nf_cpus_count}= | Get Length | ${nf_cpus} | | Import Library | resources.libraries.python.QemuUtils | qemu_id=${qemu_id} | | ... | WITH NAME | ${vm_name} @@ -2462,9 +2482,8 @@ | | Run keyword | ${vm_name}.Qemu Set Affinity | @{nf_cpus} | | Run keyword If | ${use_tuned_cfs} | ${vm_name}.Qemu Set Scheduler Policy | | ${max_pkt_len}= | Set Variable If | ${jumbo} | 9200 | ${EMPTY} -| | ${testpmd_cpus}= | Evaluate | ${thr_count_int} + ${1} | | ${testpmd_cpus}= | Cpu list per node str | ${nodes['${dut}']} | ${0} -| | ... | cpu_cnt=${testpmd_cpus} +| | ... | cpu_cnt=${nf_cpus_count} | | Dpdk Testpmd Start | ${vm} | eal_corelist=${testpmd_cpus} | | ... | eal_mem_channels=4 | pmd_fwd_mode=mac | pmd_eth_peer_0=0,${eth0_mac} | | ... | pmd_eth_peer_1=1,${eth1_mac} | pmd_disable_hw_vlan=${TRUE} @@ -2481,7 +2500,7 @@ | | ... | | ... | *Arguments:* | | ... | - dut - DUT node to start guest VM on. Type: dictionary -| | ... | - vm_count} - Number of guest VMs. Type: int +| | ... | - vm_count - Number of guest VMs. Type: int | | ... | - jumbo - Jumbo frames are used (True) or are not used (False) | | ... | in the test. Type: boolean | | ... | - perf_qemu_qsz - Virtio Queue Size. Type: int @@ -2500,13 +2519,16 @@ | | ... | ${perf_qemu_qsz}=${256} | ${use_tuned_cfs}=${False} | | ... | | :FOR | ${number} | IN RANGE | 1 | ${vm_count}+1 +| | | ${nf_cpus}= | Create network function CPU list | ${dut} +| | | ... | chains=${1} | nodeness=${vm_count} | chain_id=${1} +| | | ... | node_id=${number} | auto_scale=${True} | | | ${sock1}= | Set Variable | /tmp/sock-${number}-1 | | | ${sock2}= | Set Variable | /tmp/sock-${number}-2 | | | ${vm}= | | | ... | Configure guest VM with dpdk-testpmd-mac connected via vhost-user | | | ... | ${dut} | ${sock1} | ${sock2} | ${dut}_VM${number} | | | ... | ${${dut}-vhost-${number}-if1_mac} -| | | ... | ${${dut}-vhost-${number}-if2_mac} | nodeness=${vm_count} +| | | ... | ${${dut}-vhost-${number}-if2_mac} | nf_cpus=${nf_cpus} | | | ... | qemu_id=${number} | jumbo=${jumbo} | perf_qemu_qsz=${perf_qemu_qsz} | | | ... | use_tuned_cfs=${use_tuned_cfs} | | | Set To Dictionary | ${${dut}_vm_refs} | ${dut}_VM${number} | ${vm} @@ -2540,6 +2562,123 @@ | | | ... | perf_qemu_qsz=${perf_qemu_qsz} | use_tuned_cfs=${False} | | All VPP Interfaces Ready Wait | ${nodes} +| Configure chain of NFs with dpdk-testpmd-mac connected via vhost-user on node +| | [Documentation] +| | ... | Start 1 chain of 1..N QEMU guests (VNFs) with two vhost-user\ +| | ... | interfaces and interconnecting DPDK testpmd with fwd mode set to mac\ +| | ... | rewrite on VPP node. +| | ... +| | ... | *Arguments:* +| | ... | - dut - DUT node to start guest VM on. Type: dictionary +| | ... | - nf_chains - Number of chains of NFs. Type: integer +| | ... | - nf_chain - NF chain ID. Type: integer +| | ... | - nf_nodes - Number of guest VMs. Type: integer +| | ... | - jumbo - Jumbo frames are used (True) or are not used (False) +| | ... | in the test. Type: boolean +| | ... | - perf_qemu_qsz - Virtio Queue Size. Type: integer +| | ... | - use_tuned_cfs - Set True if CFS RR should be used for Qemu SMP. +| | ... | Type: boolean +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Configure chain of NFs with dpdk-testpmd-mac connected via \ +| | ... | vhost-user on node \| DUT1 \| 1 \| 1 \| 1 \| False \| 256 \| +| | ... +| | [Arguments] | ${dut} | ${nf_chains}=${1} | ${nf_chain}=${1} +| | ... | ${nf_nodes}=${1} | ${jumbo}=${False} | ${perf_qemu_qsz}=${256} +| | ... | ${use_tuned_cfs}=${False} +| | ... +| | ${tg_if1_mac}= | Get Interface MAC | ${tg} | ${tg_if1} +| | ${tg_if2_mac}= | Get Interface MAC | ${tg} | ${tg_if2} +| | :FOR | ${nf_node} | IN RANGE | 1 | ${nf_nodes} + ${1} +| | | ${nf_cpus}= | Create network function CPU list | ${dut} +| | | ... | chains=${nf_chains} | nodeness=${nf_nodes} | chain_id=${nf_chain} +| | | ... | node_id=${nf_node} | auto_scale=${False} +| | | ${qemu_id}= | Evaluate | (${nf_chain} - ${1}) * ${nf_nodes} + ${nf_node} +| | | ${sock1}= | Set Variable | /tmp/sock-${qemu_id}-1 +| | | ${sock2}= | Set Variable | /tmp/sock-${qemu_id}-2 +| | | ${nf_name}= | Set Variable | ${dut}_VM${qemu_id} +| | | ${prev_qemu_id}= | Evaluate | ${qemu_id} - ${1} +| | | ${next_qemu_id}= | Evaluate | ${qemu_id} + ${1} +| | | ${prev_qemu_id_hex}= | Convert To Hex | ${prev_qemu_id} | length=2 +| | | ... | lowercase=yes +| | | ${next_qemu_id_hex}= | Convert To Hex | ${next_qemu_id} | length=2 +| | | ... | lowercase=yes +| | | ${vif1_mac}= | Set Variable If | ${nf_node} == ${1} +| | | ... | ${tg_if1_mac} +| | | ... | 52:54:00:00:${prev_qemu_id_hex}:02 +| | | ${vif2_mac}= | Set Variable If | ${nf_node} == ${nf_nodes} +| | | ... | ${tg_if2_mac} +| | | ... | 52:54:00:00:${next_qemu_id_hex}:01 +| | | ${vm}= +| | | ... | Configure guest VM with dpdk-testpmd-mac connected via vhost-user +| | | ... | ${dut} | ${sock1} | ${sock2} | ${nf_name} | ${vif1_mac} +| | | ... | ${vif2_mac} | ${nf_cpus} | qemu_id=${qemu_id} | jumbo=${jumbo} +| | | ... | perf_qemu_qsz=${perf_qemu_qsz} | use_tuned_cfs=${use_tuned_cfs} +| | | Set To Dictionary | ${${dut}_vm_refs} | ${nf_name} | ${vm} + +| Configure chain of NFs with dpdk-testpmd-mac connected via vhost-user +| | [Documentation] +| | ... | Start 1 chain of 1..N QEMU guests (VNFs) with two vhost-user\ +| | ... | interfaces and interconnecting DPDK testpmd with fwd mode set to mac\ +| | ... | rewrite on all defined VPP nodes. +| | ... +| | ... | *Arguments:* +| | ... | - nf_chains - Number of chains of NFs. Type: integer +| | ... | - nf_chain - NF chain ID. Type: integer +| | ... | - nf_nodes - Number of NFs nodes per chain. Type: integer +| | ... | - jumbo - Jumbo frames are used (True) or are not used (False) +| | ... | in the test. Type: boolean +| | ... | - perf_qemu_qsz - Virtio Queue Size. Type: integer +| | ... | - use_tuned_cfs - Set True if CFS RR should be used for Qemu SMP. +| | ... | Type: boolean +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Configure chain of NFs with dpdk-testpmd-mac connected via\ +| | ... | vhost-user \| 1 \| 1 \| 1 \| False \| 256 \| +| | ... +| | [Arguments] | ${nf_chains}=${1} | ${nf_chain}=${1} | ${nf_nodes}=${1} +| | ... | ${jumbo}=${False} | ${perf_qemu_qsz}=${256} +| | ... | ${use_tuned_cfs}=${False} +| | ... +| | ${duts}= | Get Matches | ${nodes} | DUT* +| | :FOR | ${dut} | IN | @{duts} +| | | Configure chain of NFs with dpdk-testpmd-mac connected via vhost-user on node +| | | ... | ${dut} | nf_chains=${nf_chains} | nf_chain=${nf_chain} +| | | ... | nf_nodes=${nf_nodes} | jumbo=${jumbo} +| | | ... | perf_qemu_qsz=${perf_qemu_qsz} | use_tuned_cfs=${False} + +| Configure chains of NFs with dpdk-testpmd-mac connected via vhost-user +| | [Documentation] +| | ... | Start 1..N chains of 1..N QEMU guests (VNFs) with two vhost-user\ +| | ... | interfaces and interconnecting DPDK testpmd with fwd mode set to mac\ +| | ... | rewrite on all defined VPP nodes. +| | ... +| | ... | *Arguments:* +| | ... | - nf_chains - Number of chains of NFs. Type: integer +| | ... | - nf_nodes - Number of NFs nodes per chain. Type: integer +| | ... | - jumbo - Jumbo frames are used (True) or are not used (False) +| | ... | in the test. Type: boolean +| | ... | - perf_qemu_qsz - Virtio Queue Size. Type: integer +| | ... | - use_tuned_cfs - Set True if CFS RR should be used for Qemu SMP. +| | ... | Type: boolean +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Configure chains of VMs with dpdk-testpmd-mac connected via \ +| | ... | vhost-user \| 1 \| 1 \| False \| 256 \| +| | ... +| | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${jumbo}=${False} +| | ... | ${perf_qemu_qsz}=${256} | ${use_tuned_cfs}=${False} +| | ... +| | :FOR | ${nf_chain} | IN RANGE | 1 | ${nf_chains}+1 +| | | Configure chain of NFs with dpdk-testpmd-mac connected via vhost-user +| | | ... | nf_chains=${nf_chains} | nf_chain=${nf_chain} | nf_nodes=${nf_nodes} +| | | ... | jumbo=${jumbo} | perf_qemu_qsz=${perf_qemu_qsz} +| | | ... | use_tuned_cfs=${False} +| | All VPP Interfaces Ready Wait | ${nodes} + | Initialize LISP IPv4 forwarding in 3-node circular topology | | [Documentation] | Custom setup of IPv4 addresses on all DUT nodes and TG \ | | ... | Don`t set route. diff --git a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c1n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c1n.py new file mode 100644 index 0000000000..33a472c53d --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c1n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 10 + self.nf_nodes = 1 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-1c10n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c10n.py new file mode 100644 index 0000000000..6ced7d702e --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c10n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 1 + self.nf_nodes = 10 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-1c1n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c1n.py new file mode 100644 index 0000000000..760b60e50c --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c1n.py @@ -0,0 +1,116 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from re import finditer + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 1 + self.nf_nodes = 1 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-1c2n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c2n.py new file mode 100644 index 0000000000..3de8b6c186 --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c2n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 1 + self.nf_nodes = 2 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-1c4n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c4n.py new file mode 100644 index 0000000000..74392235a6 --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c4n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 1 + self.nf_nodes = 4 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-1c6n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c6n.py new file mode 100644 index 0000000000..c7493eb01b --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c6n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 1 + self.nf_nodes = 6 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-1c8n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c8n.py new file mode 100644 index 0000000000..3c0b164f02 --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c8n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 1 + self.nf_nodes = 8 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-2c1n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c1n.py new file mode 100644 index 0000000000..70c263fbda --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c1n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 2 + self.nf_nodes = 1 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-2c2n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c2n.py new file mode 100644 index 0000000000..1f4a4421c0 --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c2n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 2 + self.nf_nodes = 2 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-2c4n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c4n.py new file mode 100644 index 0000000000..310834543a --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c4n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 2 + self.nf_nodes = 4 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-2c6n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c6n.py new file mode 100644 index 0000000000..3c85a6796c --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c6n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 2 + self.nf_nodes = 6 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-2c8n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c8n.py new file mode 100644 index 0000000000..b0e7a8e768 --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c8n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 2 + self.nf_nodes = 8 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-4c1n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c1n.py new file mode 100644 index 0000000000..b0ccff8d49 --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c1n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 4 + self.nf_nodes = 1 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-4c2n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c2n.py new file mode 100644 index 0000000000..249e57ce45 --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c2n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 4 + self.nf_nodes = 2 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-4c4n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c4n.py new file mode 100644 index 0000000000..1f2c258627 --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c4n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 4 + self.nf_nodes = 4 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-6c1n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c1n.py new file mode 100644 index 0000000000..319d4b8bc5 --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c1n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 6 + self.nf_nodes = 1 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-6c2n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c2n.py new file mode 100644 index 0000000000..cea3f08e89 --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c2n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 6 + self.nf_nodes = 2 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-8c1n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c1n.py new file mode 100644 index 0000000000..20d654df23 --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c1n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 8 + self.nf_nodes = 1 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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-2n3n-ethip4-ip4src254-8c2n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c2n.py new file mode 100644 index 0000000000..36d618fad6 --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c2n.py @@ -0,0 +1,114 @@ +# 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 / + - Direction 0 --> 1: + - Destination MAC address: 52:54:00:00:nf_id:01 + - Source IP address range: 10.10.10.1 - 10.10.10.254 + - Destination IP address range: 20.20.20.1 + - Direction 1 --> 0: + - Destination MAC address: 52:54:00:00:nf_id:02 + - Source IP address range: 20.20.20.1 - 20.20.20.254 + - Destination IP address range: 10.10.10.1 +""" + +from trex_stl_lib.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # Service density parameters. + self.nf_chains = 8 + self.nf_nodes = 2 + + # MACs used in packet headers. + self.p1_dst_start_mac = '52:54:00:00:00:01' + self.p2_dst_start_mac = '52:54:00:00:00:02' + + # IPs used in packet headers. + self.p1_src_start_ip = '10.10.10.1' + self.p1_src_end_ip = '10.10.10.254' + self.p1_dst_start_ip = '20.20.20.1' + + self.p2_src_start_ip = '20.20.20.1' + self.p2_src_end_ip = '20.20.20.254' + self.p2_dst_start_ip = '10.10.10.1' + + 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(dst=self.p1_dst_start_mac) / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether(dst=self.p2_dst_start_mac) / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, op="inc"), + STLVmWrFlowVar(fv_name="mac_dst", pkt_offset=4), + STLVmFlowVar(name="src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), + 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() |