diff options
130 files changed, 10715 insertions, 4745 deletions
diff --git a/resources/traffic_profiles/trex/profile_trex_stateless_base_class.py b/resources/traffic_profiles/trex/profile_trex_stateless_base_class.py index 6576cb7bdf..a3736796eb 100755 --- a/resources/traffic_profiles/trex/profile_trex_stateless_base_class.py +++ b/resources/traffic_profiles/trex/profile_trex_stateless_base_class.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -153,13 +153,15 @@ class TrafficStreamsBaseClass: # Streams for latency measurement: # Direction 0 --> 1 lat_stream1 = STLStream( - packet=pkt_lat_a, flow_stats=STLFlowLatencyStats(pg_id=0), + packet=pkt_lat_a, + flow_stats=STLFlowLatencyStats(pg_id=0), mode=STLTXCont(pps=9000) ) # Direction 1 --> 0 # second traffic stream with a phase of 10ns (inter-stream gap) lat_stream2 = STLStream( - packet=pkt_lat_b, isg=10.0, + packet=pkt_lat_b, + isg=10.0, flow_stats=STLFlowLatencyStats(pg_id=1), mode=STLTXCont(pps=9000) ) @@ -185,11 +187,13 @@ class TrafficStreamsBaseClass: # Create the streams: stream1.append(STLStream( - packet=pkt_a, isg=stream[u"isg"], + packet=pkt_a, + isg=stream[u"isg"], mode=STLTXCont(pps=stream[u"pps"])) ) stream2.append(STLStream( - packet=pkt_b, isg=stream[u"isg"], + packet=pkt_b, + isg=stream[u"isg"], mode=STLTXCont(pps=stream[u"pps"])) ) streams = list() diff --git a/resources/traffic_profiles/trex/trex-sl-2n-dot1qip4asym-ip4src254.py b/resources/traffic_profiles/trex/trex-sl-2n-dot1qip4asym-ip4src254.py index 676236b196..ae411e233b 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-dot1qip4asym-ip4src254.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-dot1qip4asym-ip4src254.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,13 +41,13 @@ class TrafficStreams(TrafficStreamsBaseClass): self.vlan_id = 10 # 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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -59,31 +59,65 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - Dot1Q(vlan=self.vlan_id) / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + Dot1Q( + vlan=self.vlan_id + ) / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-dot1qip6asym-ip6src253.py b/resources/traffic_profiles/trex/trex-sl-2n-dot1qip6asym-ip6src253.py index acf6bccc16..f2e9e81920 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-dot1qip6asym-ip6src253.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-dot1qip6asym-ip6src253.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,13 +41,13 @@ class TrafficStreams(TrafficStreamsBaseClass): self.vlan_id = 10 # IPs used in packet headers. - self.p1_src_start_ip = '2001:1::2' - self.p1_src_end_ip = '2001:1::FE' - self.p1_dst_start_ip = '2001:2::2' + self.p1_src_start_ip = u"2001:1::2" + self.p1_src_end_ip = u"2001:1::FE" + self.p1_dst_start_ip = u"2001:2::2" - self.p2_src_start_ip = '2001:2::2' - self.p2_src_end_ip = '2001:2::FE' - self.p2_dst_start_ip = '2001:1::2' + self.p2_src_start_ip = u"2001:2::2" + self.p2_src_end_ip = u"2001:2::FE" + self.p2_dst_start_ip = u"2001:1::2" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -58,37 +58,67 @@ class TrafficStreams(TrafficStreamsBaseClass): :rtype: tuple """ - base_p1, count_p1 = self._get_start_end_ipv6(self.p1_src_start_ip, - self.p1_src_end_ip) - base_p2, count_p2 = self._get_start_end_ipv6(self.p2_src_start_ip, - self.p2_src_end_ip) + base_p1, count_p1 = self._get_start_end_ipv6( + self.p1_src_start_ip, + self.p1_src_end_ip + ) + base_p2, count_p2 = self._get_start_end_ipv6( + self.p2_src_start_ip, + self.p2_src_end_ip + ) # Direction 0 --> 1 - base_pkt_a = (Ether() / - IPv6(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip)) + base_pkt_a = ( + Ether() / + IPv6( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - Dot1Q(vlan=self.vlan_id) / - IPv6(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip)) + base_pkt_b = ( + Ether() / + Dot1Q( + vlan=self.vlan_id + ) / + IPv6( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="ipv6_src", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_src", - pkt_offset="IPv6.src", - offset_fixup=8)]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_src", + min_value=base_p1, + max_value=base_p1 + count_p1, + size=8, op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_src", + pkt_offset=u"IPv6.src", + offset_fixup=8 + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="ipv6_src", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_src", - pkt_offset="IPv6.src", - offset_fixup=8)]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_src", + min_value=base_p2, + max_value=base_p2 + count_p2, + size=8, op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_src", + pkt_offset=u"IPv6.src", + offset_fixup=8 + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd10000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd10000.py index 4ad4de5a3b..321b12c115 100644 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd10000.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd10000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -55,34 +55,65 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVarRepeatableRandom (\ - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - limit=10000, seed=0x0000), - STLVmWrFlowVar(\ - fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVarRepeatableRandom( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + limit=10000, + seed=0x0000 + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) + # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVarRepeatableRandom (name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - limit=10000, seed=0x0000), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVarRepeatableRandom( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + limit=10000, + seed=0x0000 + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd100000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd100000.py index 423af64e24..1e181c966e 100644 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd100000.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd100000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -55,34 +55,64 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVarRepeatableRandom (\ - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - limit=100000, seed=0x0000), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVarRepeatableRandom( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + limit=100000, + seed=0x0000 + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVarRepeatableRandom (\ - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - limit=100000, seed=0x0000), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVarRepeatableRandom( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + limit=100000, + seed=0x0000 + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd1000000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd1000000.py index d32d90c70c..d7e74abf68 100644 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd1000000.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd1000000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -55,34 +55,64 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVarRepeatableRandom (\ - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - limit=1000000, seed=0x0000), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVarRepeatableRandom( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + limit=1000000, + seed=0x0000 + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVarRepeatableRandom (\ - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - limit=1000000, seed=0x0000), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVarRepeatableRandom( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + limit=1000000, + seed=0x0000 + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst10000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst10000.py index e324aa7c2e..e9d5fb15f6 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst10000.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst10000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.0.39.15' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.0.39.15" - self.p2_src_start_ip = '20.0.0.1' - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.0.39.15' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.0.39.15" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,30 +55,61 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst100000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst100000.py index 65b85b4fd6..5977d36b5b 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst100000.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst100000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.1.134.159' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.1.134.159" - self.p2_src_start_ip = '20.0.0.1' - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.1.134.159' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.1.134.159" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,30 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst1000000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst1000000.py index 84df261ddf..8b63b82e4f 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst1000000.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst1000000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.15.66.63' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.15.66.63" - self.p2_src_start_ip = '20.0.0.1' - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.15.66.63' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.15.66.63" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,30 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name="dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op="inc" + ), + STLVmWrFlowVar( + fv_name="dst", + pkt_offset="IP.dst" + ), + STLVmFixIpv4( + offset="IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name="dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op="inc" + ), + STLVmWrFlowVar( + fv_name="dst", + pkt_offset="IP.dst" + ), + STLVmFixIpv4( + offset="IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src253.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src253.py index 685365aa1d..883883ad18 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src253.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src253.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.10.10.2' - self.p1_src_end_ip = '10.10.10.254' - self.p1_dst_start_ip = '20.20.20.2' + self.p1_src_start_ip = u"10.10.10.2" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"20.20.20.2" - self.p2_src_start_ip = '20.20.20.2' - self.p2_src_end_ip = '20.20.20.254' - self.p2_dst_start_ip = '10.10.10.2' + self.p2_src_start_ip = u"20.20.20.2" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.2" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,28 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = Ether() / IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = Ether() / IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src254.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src254.py index 1a0b0475e5..fc6167d126 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src254.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src254.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # 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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,28 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = Ether() / IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = Ether() / IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc500kdst500k.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc500kdst500k.py index 6dda8fe2aa..9c55482078 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc500kdst500k.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc500kdst500k.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,24 +43,24 @@ class TrafficStreams(TrafficStreamsBaseClass): self.clients = 500000 # MACs used in packet headers. - self.p1_src_start_mac = 'ca:fe:00:00:00:00' # mask: 00:00:FF:FF:FF:FF - self.p1_dst_start_mac = 'fa:ce:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF + self.p1_dst_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p2_src_start_mac = 'fa:ce:00:00:00:00' # mask: 00:00:FF:FF:FF:FF - self.p2_dst_start_mac = 'ca:fe:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF + self.p2_dst_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.0' - self.p1_src_end_ip = '10.7.161.31' + self.p1_src_start_ip = u"10.0.0.0" + self.p1_src_end_ip = u"10.7.161.31" - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.7.161.31' + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.7.161.31" - self.p2_src_start_ip = '20.0.0.0' - self.p2_src_end_ip = '20.7.161.31' + self.p2_src_start_ip = u"20.0.0.0" + self.p2_src_end_ip = u"20.7.161.31" - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.7.161.31' + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.7.161.31" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -72,62 +72,134 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether(src=self.p1_src_start_mac, - dst=self.p1_dst_start_mac) / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether( + src=self.p1_src_start_mac, + 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(src=self.p2_src_start_mac, - dst=self.p2_dst_start_mac) / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether( + src=self.p2_src_start_mac, + 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_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmFlowVar(name="mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset= 8), - STLVmWrFlowVar(fv_name="mac_dst", pkt_offset= 2), - STLVmFlowVar(name="ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset= 8 + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset= 2 + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="mac_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmFlowVar(name="mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset= 8), - STLVmWrFlowVar(fv_name="mac_dst", pkt_offset= 2), - STLVmFlowVar(name="ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset= 8 + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset= 2 + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc50kdst50k.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc50kdst50k.py index 03559115d2..42e3db6a6f 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc50kdst50k.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc50kdst50k.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,24 +43,24 @@ class TrafficStreams(TrafficStreamsBaseClass): self.clients = 50000 # MACs used in packet headers. - self.p1_src_start_mac = 'ca:fe:00:00:00:00' # mask: 00:00:FF:FF:FF:FF - self.p1_dst_start_mac = 'fa:ce:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF + self.p1_dst_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p2_src_start_mac = 'fa:ce:00:00:00:00' # mask: 00:00:FF:FF:FF:FF - self.p2_dst_start_mac = 'ca:fe:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF + self.p2_dst_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.0' - self.p1_src_end_ip = '10.0.195.79' + self.p1_src_start_ip = u"10.0.0.0" + self.p1_src_end_ip = u"10.0.195.79" - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.0.195.79' + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.0.195.79" - self.p2_src_start_ip = '20.0.0.0' - self.p2_src_end_ip = '20.0.195.79' + self.p2_src_start_ip = u"20.0.0.0" + self.p2_src_end_ip = u"20.0.195.79" - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.0.195.79' + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.0.195.79" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -72,62 +72,133 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether(src=self.p1_src_start_mac, - dst=self.p1_dst_start_mac) / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether( + src=self.p1_src_start_mac, + 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(src=self.p2_src_start_mac, - dst=self.p2_dst_start_mac) / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether( + src=self.p2_src_start_mac, + 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_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmFlowVar(name="mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset= 8), - STLVmWrFlowVar(fv_name="mac_dst", pkt_offset= 2), - STLVmFlowVar(name="ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset= 8 + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset= 2 + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="mac_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmFlowVar(name="mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset= 8), - STLVmWrFlowVar(fv_name="mac_dst", pkt_offset= 2), - STLVmFlowVar(name="ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset= 8 + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset= 2 + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc5kdst5k.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc5kdst5k.py index 0ce4ca94d1..29df3373d3 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc5kdst5k.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc5kdst5k.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,24 +43,24 @@ class TrafficStreams(TrafficStreamsBaseClass): self.clients = 5000 # MACs used in packet headers. - self.p1_src_start_mac = 'ca:fe:00:00:00:00' # mask: 00:00:FF:FF:FF:FF - self.p1_dst_start_mac = 'fa:ce:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF + self.p1_dst_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p2_src_start_mac = 'fa:ce:00:00:00:00' # mask: 00:00:FF:FF:FF:FF - self.p2_dst_start_mac = 'ca:fe:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF + self.p2_dst_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.0' - self.p1_src_end_ip = '10.0.19.135' + self.p1_src_start_ip = u"10.0.0.0" + self.p1_src_end_ip = u"10.0.19.135" - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.0.19.135' + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.0.19.135" - self.p2_src_start_ip = '20.0.0.0' - self.p2_src_end_ip = '20.0.19.135' + self.p2_src_start_ip = u"20.0.0.0" + self.p2_src_end_ip = u"20.0.19.135" - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.0.19.135' + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.0.19.135" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -72,62 +72,134 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether(src=self.p1_src_start_mac, - dst=self.p1_dst_start_mac) / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether( + src=self.p1_src_start_mac, + 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(src=self.p2_src_start_mac, - dst=self.p2_dst_start_mac) / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether( + src=self.p2_src_start_mac, + 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_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmFlowVar(name="mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset= 8), - STLVmWrFlowVar(fv_name="mac_dst", pkt_offset= 2), - STLVmFlowVar(name="ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset= 8 + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset= 2 + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="mac_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmFlowVar(name="mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset= 8), - STLVmWrFlowVar(fv_name="mac_dst", pkt_offset= 2), - STLVmFlowVar(name="ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset= 8 + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset= 2 + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-1000u15p.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-1000u15p.py index 74a07c30c2..4c306aabc0 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-1000u15p.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-1000u15p.py @@ -69,29 +69,29 @@ class TrafficStreams(TrafficStreamsBaseClass): # Direction 0 --> 1 base_pkt_a = ( - Ether() / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=17 - ) / - UDP( - sport=self.p1_src_start_udp_port, - dport=self.p1_dst_start_udp_port - ) + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p1_src_start_udp_port, + dport=self.p1_dst_start_udp_port + ) ) # Direction 1 --> 0 base_pkt_b = ( - Ether() / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17 - ) / - UDP( - sport=self.p2_src_start_udp_port, - dport=self.p2_dst_start_udp_port - ) + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p2_src_start_udp_port, + dport=self.p2_dst_start_udp_port + ) ) # Direction 0 --> 1 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-10u1000p-conc.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-10u1000p-conc.py index 384037d860..77f05f8af3 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-10u1000p-conc.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-10u1000p-conc.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,15 +41,15 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.10.10.2' - self.p1_src_end_ip = '10.10.10.11' - self.p1_dst_start_ip = '20.20.20.2' - self.p1_dst_end_ip = '20.20.20.11' + self.p1_src_start_ip = u"10.10.10.2" + self.p1_src_end_ip = u"10.10.10.11" + self.p1_dst_start_ip = u"20.20.20.2" + self.p1_dst_end_ip = u"20.20.20.11" - self.p2_src_start_ip = '20.20.20.2' - self.p2_src_end_ip = '20.20.20.11' - self.p2_dst_start_ip = '10.10.10.2' - self.p2_dst_end_ip = '10.10.10.11' + self.p2_src_start_ip = u"20.20.20.2" + self.p2_src_end_ip = u"20.20.20.11" + self.p2_dst_start_ip = u"10.10.10.2" + self.p2_dst_end_ip = u"10.10.10.11" # UDP ports used in packet headers. self.p1_src_start_udp_port = 1001 @@ -72,56 +72,108 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=17) / - UDP(sport=self.p1_src_start_udp_port, - dport=self.p1_dst_start_udp_port)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p1_src_start_udp_port, + dport=self.p1_dst_start_udp_port + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17) / - UDP(sport=self.p2_src_start_udp_port, - dport=self.p2_dst_start_udp_port)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p2_src_start_udp_port, + dport=self.p2_dst_start_udp_port + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p1_src_start_ip, - ip_max=self.p1_src_end_ip, - port_min=self.p1_src_start_udp_port, - port_max=self.p1_src_end_udp_port, - name="tuple1_src"), - STLVmTupleGen(ip_min=self.p1_dst_start_ip, - ip_max=self.p1_dst_end_ip, - port_min=self.p1_dst_start_udp_port, - port_max=self.p1_dst_end_udp_port, - name="tuple1_dst"), - STLVmWrFlowVar(fv_name="tuple1_src.ip", pkt_offset="IP.src"), - STLVmWrFlowVar(fv_name="tuple1_dst.ip", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple1_src.port", pkt_offset="UDP.sport"), - STLVmWrFlowVar(fv_name="tuple1_dst.port", pkt_offset="UDP.dport") - ]) + vm1 = STLScVmRaw( + [ + STLVmTupleGen( + ip_min=self.p1_src_start_ip, + ip_max=self.p1_src_end_ip, + port_min=self.p1_src_start_udp_port, + port_max=self.p1_src_end_udp_port, + name=u"tuple1_src" + ), + STLVmTupleGen( + ip_min=self.p1_dst_start_ip, + ip_max=self.p1_dst_end_ip, + port_min=self.p1_dst_start_udp_port, + port_max=self.p1_dst_end_udp_port, + name=u"tuple1_dst" + ), + STLVmWrFlowVar( + fv_name=u"tuple1_src.ip", + pkt_offset=u"IP.src" + ), + STLVmWrFlowVar( + fv_name=u"tuple1_dst.ip", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ), + STLVmWrFlowVar( + fv_name=u"tuple1_src.port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"tuple1_dst.port", + pkt_offset=u"UDP.dport" + ) + ] + ) # Direction 0 --> 1 - vm2 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p2_src_start_ip, - ip_max=self.p2_src_end_ip, - port_min=self.p2_src_start_udp_port, - port_max=self.p2_src_end_udp_port, - name="tuple2_src"), - STLVmTupleGen(ip_min=self.p2_dst_start_ip, - ip_max=self.p2_dst_end_ip, - port_min=self.p2_dst_start_udp_port, - port_max=self.p2_dst_end_udp_port, - name="tuple2_dst"), - STLVmWrFlowVar(fv_name="tuple2_src.ip", pkt_offset="IP.src"), - STLVmWrFlowVar(fv_name="tuple2_dst.ip", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple2_src.port", pkt_offset="UDP.sport"), - STLVmWrFlowVar(fv_name="tuple2_dst.port", pkt_offset="UDP.dport") - ]) + vm2 = STLScVmRaw( + [ + STLVmTupleGen( + ip_min=self.p2_src_start_ip, + ip_max=self.p2_src_end_ip, + port_min=self.p2_src_start_udp_port, + port_max=self.p2_src_end_udp_port, + name=u"tuple2_src" + ), + STLVmTupleGen( + ip_min=self.p2_dst_start_ip, + ip_max=self.p2_dst_end_ip, + port_min=self.p2_dst_start_udp_port, + port_max=self.p2_dst_end_udp_port, + name=u"tuple2_dst" + ), + STLVmWrFlowVar( + fv_name=u"tuple2_src.ip", + pkt_offset=u"IP.src" + ), + STLVmWrFlowVar( + fv_name=u"tuple2_dst.ip", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ), + STLVmWrFlowVar( + fv_name=u"tuple2_src.port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"tuple2_dst.port", + pkt_offset=u"UDP.dport" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-1u1p.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-1u1p.py index a4d0842a50..a892ec8822 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-1u1p.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-1u1p.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,11 +41,11 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_ip = '20.0.0.0' - self.p1_dst_ip = '12.0.0.2' + self.p1_src_ip = u"20.0.0.0" + self.p1_dst_ip = u"12.0.0.2" - self.p2_src_ip = '12.0.0.2' - self.p2_dst_ip = '200.0.0.0' + self.p2_src_ip = u"12.0.0.2" + self.p2_dst_ip = u"200.0.0.0" # UDP ports used in packet headers. self.p1_src_udp_port = 1024 @@ -64,15 +64,31 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_ip, dst=self.p1_dst_ip, proto=17) / - UDP(sport=self.p1_src_udp_port, - dport=self.p1_dst_udp_port)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_ip, + dst=self.p1_dst_ip, + proto=17 + ) / + UDP( + sport=self.p1_src_udp_port, + dport=self.p1_dst_udp_port + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_ip, dst=self.p2_dst_ip, proto=17) / - UDP(sport=self.p2_src_udp_port, - dport=self.p2_dst_udp_port)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_ip, + dst=self.p2_dst_ip, + proto=17 + ) / + UDP( + sport=self.p2_src_udp_port, + dport=self.p2_dst_udp_port + ) + ) return base_pkt_a, base_pkt_b, None, None diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-lb.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-lb.py index bcd5328edd..df05cbff17 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-lb.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-lb.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Intel and/or its affiliates. +# Copyright (c) 2020 Intel and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -36,14 +36,14 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '192.168.50.74' - self.p1_src_end_ip = '192.168.50.79' - self.p1_dst_start_ip = '90.1.2.1' + self.p1_src_start_ip = u"192.168.50.74" + self.p1_src_end_ip = u"192.168.50.79" + self.p1_dst_start_ip = u"90.1.2.1" - self.p2_src_start_ip = '192.168.60.74' - self.p2_src_end_ip = '192.168.60.79' - self.p2_dst_start_ip = '192.168.50.74' - self.p2_dst_end_ip = '192.168.50.79' + self.p2_src_start_ip = u"192.168.60.74" + self.p2_src_end_ip = u"192.168.60.79" + self.p2_dst_start_ip = u"192.168.50.74" + self.p2_dst_end_ip = u"192.168.50.79" # UDP ports used in packet headers. self.p1_src_udp_port = 63 @@ -62,36 +62,80 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = Ether() / IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=17) / UDP(sport=self.p1_src_udp_port, - dport=self.p1_dst_udp_port) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=17) / + UDP( + sport=self.p1_src_udp_port, + dport=self.p1_dst_udp_port + ) + ) # Direction 1 --> 0 - base_pkt_b = Ether() / IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17) / UDP(sport=self.p2_src_udp_port, - dport=self.p2_dst_udp_port) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p2_src_udp_port, + dport=self.p2_dst_udp_port + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([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"), - STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) - + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst10000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst10000.py index 085787aa6b..f1b90350fb 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst10000.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst10000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '2001:1::1' - self.p1_dst_start_ip = '2001:2::0' - self.p1_dst_end_ip = '2001:2::270F' + self.p1_src_start_ip = u"2001:1::1" + self.p1_dst_start_ip = u"2001:2::0" + self.p1_dst_end_ip = u"2001:2::270F" - self.p2_src_start_ip = '2001:2::1' - self.p2_dst_start_ip = '2001:1::0' - self.p2_dst_end_ip = '2001:1::270F' + self.p2_src_start_ip = u"2001:2::1" + self.p2_dst_start_ip = u"2001:1::0" + self.p2_dst_end_ip = u"2001:1::270F" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -54,34 +54,66 @@ class TrafficStreams(TrafficStreamsBaseClass): :rtype: tuple """ - base_p1, count_p1 = self._get_start_end_ipv6(self.p1_dst_start_ip, - self.p1_dst_end_ip) - base_p2, count_p2 = self._get_start_end_ipv6(self.p2_dst_start_ip, - self.p2_dst_end_ip) + base_p1, count_p1 = self._get_start_end_ipv6( + self.p1_dst_start_ip, + self.p1_dst_end_ip + ) + base_p2, count_p2 = self._get_start_end_ipv6( + self.p2_dst_start_ip, + self.p2_dst_end_ip + ) # Direction 0 --> 1 - base_pkt_a = Ether() / IPv6(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip) + base_pkt_a = ( + Ether() / + IPv6( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip + ) + ) # Direction 1 --> 0 - base_pkt_b = Ether() / IPv6(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip) + base_pkt_b = ( + Ether() / + IPv6( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_dst", + min_value=base_p1, + max_value=base_p1 + count_p1, + size=8, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_dst", + pkt_offset=u"IPv6.dst", + offset_fixup=8 + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_dst", + min_value=base_p2, + max_value=base_p2 + count_p2, + size=8, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_dst", + pkt_offset=u"IPv6.dst", + offset_fixup=8 + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst100000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst100000.py index b32943062a..87e76726b2 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst100000.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst100000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '2001:1::1' - self.p1_dst_start_ip = '2001:2::0' - self.p1_dst_end_ip = '2001:2::1:869F' + self.p1_src_start_ip = u"2001:1::1" + self.p1_dst_start_ip = u"2001:2::0" + self.p1_dst_end_ip = u"2001:2::1:869F" - self.p2_src_start_ip = '2001:2::1' - self.p2_dst_start_ip = '2001:1::0' - self.p2_dst_end_ip = '2001:1::1:869F' + self.p2_src_start_ip = u"2001:2::1" + self.p2_dst_start_ip = u"2001:1::0" + self.p2_dst_end_ip = u"2001:1::1:869F" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -54,34 +54,66 @@ class TrafficStreams(TrafficStreamsBaseClass): :rtype: tuple """ - base_p1, count_p1 = self._get_start_end_ipv6(self.p1_dst_start_ip, - self.p1_dst_end_ip) - base_p2, count_p2 = self._get_start_end_ipv6(self.p2_dst_start_ip, - self.p2_dst_end_ip) + base_p1, count_p1 = self._get_start_end_ipv6( + self.p1_dst_start_ip, + self.p1_dst_end_ip + ) + base_p2, count_p2 = self._get_start_end_ipv6( + self.p2_dst_start_ip, + self.p2_dst_end_ip + ) # Direction 0 --> 1 - base_pkt_a = Ether() / IPv6(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip) + base_pkt_a = ( + Ether() / + IPv6( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip + ) + ) # Direction 1 --> 0 - base_pkt_b = Ether() / IPv6(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip) + base_pkt_b = ( + Ether() / + IPv6( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_dst", + min_value=base_p1, + max_value=base_p1 + count_p1, + size=8, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_dst", + pkt_offset=u"IPv6.dst", + offset_fixup=8 + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_dst", + min_value=base_p2, + max_value=base_p2 + count_p2, + size=8, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_dst", + pkt_offset=u"IPv6.dst", + offset_fixup=8 + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst1000000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst1000000.py index e45d37f833..9214b6239d 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst1000000.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst1000000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '2001:1::1' - self.p1_dst_start_ip = '2001:2::0' - self.p1_dst_end_ip = '2001:2::F:423F' + self.p1_src_start_ip = u"2001:1::1" + self.p1_dst_start_ip = u"2001:2::0" + self.p1_dst_end_ip = u"2001:2::F:423F" - self.p2_src_start_ip = '2001:2::1' - self.p2_dst_start_ip = '2001:1::0' - self.p2_dst_end_ip = '2001:1::F:423F' + self.p2_src_start_ip = u"2001:2::1" + self.p2_dst_start_ip = u"2001:1::0" + self.p2_dst_end_ip = u"2001:1::F:423F" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -54,34 +54,66 @@ class TrafficStreams(TrafficStreamsBaseClass): :rtype: tuple """ - base_p1, count_p1 = self._get_start_end_ipv6(self.p1_dst_start_ip, - self.p1_dst_end_ip) - base_p2, count_p2 = self._get_start_end_ipv6(self.p2_dst_start_ip, - self.p2_dst_end_ip) + base_p1, count_p1 = self._get_start_end_ipv6( + self.p1_dst_start_ip, + self.p1_dst_end_ip + ) + base_p2, count_p2 = self._get_start_end_ipv6( + self.p2_dst_start_ip, + self.p2_dst_end_ip + ) # Direction 0 --> 1 - base_pkt_a = Ether() / IPv6(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip) + base_pkt_a = ( + Ether() / + IPv6( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip + ) + ) # Direction 1 --> 0 - base_pkt_b = Ether() / IPv6(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip) + base_pkt_b = ( + Ether() / + IPv6( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_dst", + min_value=base_p1, + max_value=base_p1 + count_p1, + size=8, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_dst", + pkt_offset=u"IPv6.dst", + offset_fixup=8 + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_dst", + min_value=base_p2, + max_value=base_p2 + count_p2, + size=8, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_dst", + pkt_offset=u"IPv6.dst", + offset_fixup=8 + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6src253.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6src253.py index 8bce54f85b..7ac5f75bed 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6src253.py +++ b/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6src253.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '2001:1::2' - self.p1_src_end_ip = '2001:1::FE' - self.p1_dst_start_ip = '2001:2::2' + self.p1_src_start_ip = u"2001:1::2" + self.p1_src_end_ip = u"2001:1::FE" + self.p1_dst_start_ip = u"2001:2::2" - self.p2_src_start_ip = '2001:2::2' - self.p2_src_end_ip = '2001:2::FE' - self.p2_dst_start_ip = '2001:1::2' + self.p2_src_start_ip = u"2001:2::2" + self.p2_src_end_ip = u"2001:2::FE" + self.p2_dst_start_ip = u"2001:1::2" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -54,34 +54,66 @@ class TrafficStreams(TrafficStreamsBaseClass): :rtype: tuple """ - base_p1, count_p1 = self._get_start_end_ipv6(self.p1_src_start_ip, - self.p1_src_end_ip) - base_p2, count_p2 = self._get_start_end_ipv6(self.p2_src_start_ip, - self.p2_src_end_ip) + base_p1, count_p1 = self._get_start_end_ipv6( + self.p1_src_start_ip, + self.p1_src_end_ip + ) + base_p2, count_p2 = self._get_start_end_ipv6( + self.p2_src_start_ip, + self.p2_src_end_ip + ) # Direction 0 --> 1 - base_pkt_a = Ether() / IPv6(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip) - # Direction 1 --> 0 - base_pkt_b = Ether() / IPv6(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip) + base_pkt_a = ( + Ether() / + IPv6( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip + ) + ) + # Direction 1 --> 0 + base_pkt_b = ( + Ether() / + IPv6( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="ipv6_src", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_src", - pkt_offset="IPv6.src", - offset_fixup=8)]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_src", + min_value=base_p1, + max_value=base_p1 + count_p1, + size=8, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_src", + pkt_offset=u"IPv6.src", + offset_fixup=8 + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="ipv6_src", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_src", - pkt_offset="IPv6.src", - offset_fixup=8)]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_src", + min_value=base_p2, + max_value=base_p2 + count_p2, + size=8, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_src", + pkt_offset=u"IPv6.src", + offset_fixup=8 + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index 4495d32b4b..7a70177d28 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c1n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c1n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,89 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c2n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c2n.py index fe5d986af9..abae4f4570 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c2n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c2n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u'52:54:00:00:00:01' + self.p2_dst_start_mac = u'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.p1_src_start_ip = u'10.10.10.1' + self.p1_src_end_ip = u'10.10.10.254' + self.p1_dst_start_ip = u'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' + self.p2_src_start_ip = u'20.20.20.1' + self.p2_src_end_ip = u'20.20.20.254' + self.p2_dst_start_ip = u'10.10.10.1' def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index 83c2f049de..cb482359fc 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c10n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c10n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index 2b1aa52f77..86b6a95822 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c1n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c1n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -45,17 +45,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -67,40 +67,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index 9fffaf2cd7..277c17f604 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c2n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c2n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index a256107ef0..d5f1332580 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c4n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c4n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index 68647d4208..d284756af8 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c6n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c6n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index 59b571d487..ac95e1b197 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c8n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c8n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c10n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c10n.py index 429758efa7..33905d33aa 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c10n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c10n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index 667c970a3c..5940921c6b 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c1n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c1n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index 647cbc8d1a..cc9f8fc2a9 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c2n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c2n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index a3059be7a0..9edc6cb02f 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c4n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c4n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index 5225ff312e..a9acd36e57 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c6n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c6n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index 6b105b8605..1d78147e3d 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c8n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c8n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index 38a9a7dc3d..4d1f64075a 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c1n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c1n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index 5fb88e3645..e7da41d1fa 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c2n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c2n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,88 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index 8608f37c89..2d874d4578 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c4n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c4n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c6n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c6n.py index 088cde7724..a28475f555 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c6n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c6n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index dab881b81f..4c24d9ee75 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c1n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c1n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index 491fcdaad1..c2d6453fe3 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c2n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c2n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c4n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c4n.py index c4602c324c..ac88465d71 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c4n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c4n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index 2ed83154b5..f04f4bc14e 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c1n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c1n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 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 index c214fae91e..0537efbfa7 100755 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c2n.py +++ b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c2n.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): 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' + self.p1_dst_start_mac = u"52:54:00:00:00:01" + self.p2_dst_start_mac = u"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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,40 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=1, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=self.nf_nodes, + max_value=self.nf_chains*self.nf_nodes, + size=1, + step=self.nf_nodes, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=4 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan100ip4src254ip4dst254.py b/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan100ip4src254ip4dst254.py index 3c3206df8e..b414bd1c7a 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan100ip4src254ip4dst254.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan100ip4src254ip4dst254.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -48,17 +48,17 @@ class TrafficStreams(TrafficStreamsBaseClass): self.p2_vlan_end = self.p2_vlan_start + self.vlans - 1 # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_src_end_ip = '10.0.0.254' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_src_end_ip = u"10.0.0.254" - self.p1_dst_start_ip = '20.0.0.1' - self.p1_dst_end_ip = '20.0.0.254' + self.p1_dst_start_ip = u"20.0.0.1" + self.p1_dst_end_ip = u"20.0.0.254" - self.p2_src_start_ip = '20.0.0.1' - self.p2_src_end_ip = '20.0.0.254' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_src_end_ip = u"20.0.0.254" - self.p2_dst_start_ip = '10.0.0.1' - self.p2_dst_end_ip = '10.0.0.254' + self.p2_dst_start_ip = u"10.0.0.1" + self.p2_dst_end_ip = u"10.0.0.254" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -70,54 +70,112 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - Dot1Q(vlan=self.p1_vlan_start) / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + Dot1Q( + vlan=self.p1_vlan_start + ) / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - Dot1Q(vlan=self.p2_vlan_start) / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + Dot1Q( + vlan=self.p2_vlan_start + ) / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="vlan", - min_value=self.p1_vlan_start, - max_value=self.p1_vlan_end, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="vlan", - pkt_offset="Dot1Q.vlan"), - STLVmFlowVar(name="ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"vlan", + min_value=self.p1_vlan_start, + max_value=self.p1_vlan_end, + size=2, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"vlan", + pkt_offset=u"Dot1Q.vlan" + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="vlan", - min_value=self.p2_vlan_start, - max_value=self.p2_vlan_end, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="vlan", - pkt_offset="Dot1Q.vlan"), - STLVmFlowVar(name="ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"vlan", + min_value=self.p2_vlan_start, + max_value=self.p2_vlan_end, + size=2, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"vlan", + pkt_offset=u"Dot1Q.vlan" + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan10ip4src254ip4dst254.py b/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan10ip4src254ip4dst254.py index b07793f89d..d878e2d726 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan10ip4src254ip4dst254.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan10ip4src254ip4dst254.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -49,17 +49,17 @@ class TrafficStreams(TrafficStreamsBaseClass): # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_src_end_ip = '10.0.0.254' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_src_end_ip = u"10.0.0.254" - self.p1_dst_start_ip = '20.0.0.1' - self.p1_dst_end_ip = '20.0.0.254' + self.p1_dst_start_ip = u"20.0.0.1" + self.p1_dst_end_ip = u"20.0.0.254" - self.p2_src_start_ip = '20.0.0.1' - self.p2_src_end_ip = '20.0.0.254' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_src_end_ip = u"20.0.0.254" - self.p2_dst_start_ip = '10.0.0.1' - self.p2_dst_end_ip = '10.0.0.254' + self.p2_dst_start_ip = u"10.0.0.1" + self.p2_dst_end_ip = u"10.0.0.254" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -71,54 +71,111 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - Dot1Q(vlan=self.p1_vlan_start) / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + Dot1Q( + vlan=self.p1_vlan_start + ) / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - Dot1Q(vlan=self.p2_vlan_start) / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + Dot1Q( + vlan=self.p2_vlan_start + ) / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="vlan", - min_value=self.p1_vlan_start, - max_value=self.p1_vlan_end, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="vlan", - pkt_offset="Dot1Q.vlan"), - STLVmFlowVar(name="ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"vlan", + min_value=self.p1_vlan_start, + max_value=self.p1_vlan_end, + size=2, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"vlan", + pkt_offset=u"Dot1Q.vlan" + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="vlan", - min_value=self.p2_vlan_start, - max_value=self.p2_vlan_end, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="vlan", - pkt_offset="Dot1Q.vlan"), - STLVmFlowVar(name="ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"vlan", + min_value=self.p2_vlan_start, + max_value=self.p2_vlan_end, + size=2, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"vlan", + pkt_offset=u"Dot1Q.vlan" + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar(name=u"ip_dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1ip4src254ip4dst254.py b/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1ip4src254ip4dst254.py index c5924b1bec..c8f279bdb3 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1ip4src254ip4dst254.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1ip4src254ip4dst254.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -45,17 +45,17 @@ class TrafficStreams(TrafficStreamsBaseClass): # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_src_end_ip = '10.0.0.254' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_src_end_ip = u"10.0.0.254" - self.p1_dst_start_ip = '20.0.0.1' - self.p1_dst_end_ip = '20.0.0.254' + self.p1_dst_start_ip = u"20.0.0.1" + self.p1_dst_end_ip = u"20.0.0.254" - self.p2_src_start_ip = '20.0.0.1' - self.p2_src_end_ip = '20.0.0.254' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_src_end_ip = u"20.0.0.254" - self.p2_dst_start_ip = '10.0.0.1' - self.p2_dst_end_ip = '10.0.0.254' + self.p2_dst_start_ip = u"10.0.0.1" + self.p2_dst_end_ip = u"10.0.0.254" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -67,42 +67,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - Dot1Q(vlan=self.p1_vlan_start) / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + Dot1Q( + vlan=self.p1_vlan_start + ) / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - Dot1Q(vlan=self.p2_vlan_start) / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + Dot1Q( + vlan=self.p2_vlan_start + ) / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ip_src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ip_src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1kip4src254ip4dst254.py b/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1kip4src254ip4dst254.py index dda21f470d..02decf4284 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1kip4src254ip4dst254.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1kip4src254ip4dst254.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -48,17 +48,17 @@ class TrafficStreams(TrafficStreamsBaseClass): self.p2_vlan_end = self.p2_vlan_start + self.vlans - 1 # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_src_end_ip = '10.0.0.254' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_src_end_ip = u"10.0.0.254" - self.p1_dst_start_ip = '20.0.0.1' - self.p1_dst_end_ip = '20.0.0.254' + self.p1_dst_start_ip = u"20.0.0.1" + self.p1_dst_end_ip = u"20.0.0.254" - self.p2_src_start_ip = '20.0.0.1' - self.p2_src_end_ip = '20.0.0.254' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_src_end_ip = u"20.0.0.254" - self.p2_dst_start_ip = '10.0.0.1' - self.p2_dst_end_ip = '10.0.0.254' + self.p2_dst_start_ip = u"10.0.0.1" + self.p2_dst_end_ip = u"10.0.0.254" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -70,54 +70,112 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - Dot1Q(vlan=self.p1_vlan_start) / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + Dot1Q( + vlan=self.p1_vlan_start + ) / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - Dot1Q(vlan=self.p2_vlan_start) / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + Dot1Q( + vlan=self.p2_vlan_start + ) / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="vlan", - min_value=self.p1_vlan_start, - max_value=self.p1_vlan_end, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="vlan", - pkt_offset="Dot1Q.vlan"), - STLVmFlowVar(name="ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"vlan", + min_value=self.p1_vlan_start, + max_value=self.p1_vlan_end, + size=2, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"vlan", + pkt_offset=u"Dot1Q.vlan" + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="vlan", - min_value=self.p2_vlan_start, - max_value=self.p2_vlan_end, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="vlan", - pkt_offset="Dot1Q.vlan"), - STLVmFlowVar(name="ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"vlan", + min_value=self.p2_vlan_start, + max_value=self.p2_vlan_end, + size=2, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"vlan", + pkt_offset=u"Dot1Q.vlan" + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1.py index 7c080813ff..0d36b7358f 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,11 +37,11 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_ip = '10.0.0.1' - self.p1_dst_ip = '20.0.0.0' + self.p1_src_ip = u"10.0.0.1" + self.p1_dst_ip = u"20.0.0.0" - self.p2_src_ip = '20.0.0.1' - self.p2_dst_ip = '10.0.0.0' + self.p2_src_ip = u"20.0.0.1" + self.p2_dst_ip = u"10.0.0.0" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -53,11 +53,23 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_ip, dst=self.p1_dst_ip, proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_ip, + dst=self.p1_dst_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_ip, dst=self.p2_dst_ip, proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_ip, + dst=self.p2_dst_ip, + proto=61 + ) + ) return base_pkt_a, base_pkt_b, None, None diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100.py index 9ffd66fa58..222b127914 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.0.0.99' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.0.0.99" - self.p2_src_start_ip = '20.0.0.1' - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.0.0.99' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.0.0.99" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,30 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-1cnf.py index ab03d9506a..1189fba9cb 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-1cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-1cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.3.231 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.3.231 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:00" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:00" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-2cnf.py index b93835478e..3fc8eb6e82 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-2cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-2cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.3.231 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.3.231 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:01" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:01" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,83 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-4cnf.py index 4c72ab958b..58f790531f 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-4cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-4cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.3.231 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.3.231 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:03" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:03" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-8cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-8cnf.py index a09b459f34..d118d12d1a 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-8cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-8cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.3.231 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.3.231 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:07" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:07" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=7, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=7, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=7, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=7, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000.py index 5ee1f0cd9a..8d9ec21a25 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.0.3.231' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.0.3.231" - self.p2_src_start_ip = '20.0.0.1' - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.0.3.231' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.0.3.231" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,30 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-1cnf.py index 28c9873c22..53e68de2b9 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-1cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-1cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.39.15 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.39.15 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:00" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:00" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,88 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-2cnf.py index f845b2aeb2..dc81579637 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-2cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-2cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.39.15 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.39.15 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:01" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:01" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-4cnf.py index 70fc18965c..fe75ec1678 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-4cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-4cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.39.15 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.39.15 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:03" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:03" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-8cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-8cnf.py index 8a1697a71e..f0f7b8d155 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-8cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-8cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.39.15 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.39.15 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:07" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:07" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=7, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=7, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=7, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=7, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000.py index e324aa7c2e..9f55ff71de 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.0.39.15' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.0.39.15" - self.p2_src_start_ip = '20.0.0.1' - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.0.39.15' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.0.39.15" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,30 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100000.py index 65b85b4fd6..ae36cf9995 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100000.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.1.134.159' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.1.134.159" - self.p2_src_start_ip = '20.0.0.1' - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.1.134.159' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.1.134.159" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,30 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000000.py index 84df261ddf..8f6e5a0836 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000000.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.15.66.63' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.15.66.63" - self.p2_src_start_ip = '20.0.0.1' - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.15.66.63' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.15.66.63" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,30 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-1cnf.py index 56e40a9b7e..cb61bb25dd 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-1cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-1cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.78.31 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.78.31 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:00" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:00" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-2cnf.py index 584b9a4378..ed92ff65ef 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-2cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-2cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.78.31 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.78.31 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:01" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:01" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-4cnf.py index d05f2caac7..2305d52c60 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-4cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-4cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.78.31 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.78.31 """ from trex.stl.api import * @@ -36,20 +36,18 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() - self.p1_dst_start_mac = "02:02:00:00:12:00" - self.p1_dst_end_mac = "02:02:00:00:12:03" + self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p2_dst_start_mac = "02:02:00:00:02:00" - self.p2_dst_end_mac = "02:02:00:00:02:03" + self.p2_dst_start_mac = u"02:02:00:00:02:00" # IPs used in packet headers. - self.p1_src_start_ip = "10.0.0.1" - self.p1_dst_start_ip = "20.0.0.0" - self.p1_dst_end_ip = "20.0.78.31" + self.p1_src_start_ip = u"10.0.0.1" + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.0.78.31" - self.p2_src_start_ip = "20.0.0.1" - self.p2_dst_start_ip = "10.0.0.0" - self.p2_dst_end_ip = "10.0.78.31" + self.p2_src_start_ip = u"20.0.0.1" + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.0.78.31" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-8cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-8cnf.py index e00303a397..1d897e2d5b 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-8cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-8cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.78.31 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.78.31 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:07" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:07" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=7, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=7, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=7, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=7, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000.py index 87eceb155b..877e6cdc66 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.0.78.31' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.0.78.31" - self.p2_src_start_ip = '20.0.0.1' - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.0.78.31' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.0.78.31" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,30 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253.py index d83f4240ad..e1e6a89af7 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '20.20.20.2' - self.p1_dst_start_ip = '2.1.1.2' - self.p1_dst_end_ip = '2.1.1.254' + self.p1_src_start_ip = u"20.20.20.2" + self.p1_dst_start_ip = u"2.1.1.2" + self.p1_dst_end_ip = u"2.1.1.254" - self.p2_src_start_ip = '10.10.10.2' - self.p2_dst_start_ip = '1.1.1.2' - self.p2_dst_end_ip = '1.1.1.254' + self.p2_src_start_ip = u"10.10.10.2" + self.p2_dst_start_ip = u"1.1.1.2" + self.p2_dst_end_ip = u"1.1.1.254" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,30 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253_l3fwd.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253_l3fwd.py index 7ad8f03a90..ed4f5b5bd6 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253_l3fwd.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253_l3fwd.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '20.20.20.2' - self.p1_dst_start_ip = '1.1.1.2' - self.p1_dst_end_ip = '1.1.1.254' + self.p1_src_start_ip = u"20.20.20.2" + self.p1_dst_start_ip = u"1.1.1.2" + self.p1_dst_end_ip = u"1.1.1.254" - self.p2_src_start_ip = '10.10.10.2' - self.p2_dst_start_ip = '2.1.1.2' - self.p2_dst_end_ip = '2.1.1.254' + self.p2_src_start_ip = u"10.10.10.2" + self.p2_dst_start_ip = u"2.1.1.2" + self.p2_dst_end_ip = u"2.1.1.254" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,30 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-1cnf.py index 8158d5a0fc..f3cdabe611 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-1cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-1cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.0.3 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.0.3 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:00" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:00" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-2cnf.py index 5e2acb5309..972aa169b1 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-2cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-2cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.0.3 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.0.3 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:01" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:01" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-4cnf.py index 7daef807c9..5204c153e5 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-4cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-4cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.0.3 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.0.3 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:03" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:03" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4.py index f036cd6d19..9f14d4c929 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.0.0.3' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.0.0.3" - self.p2_src_start_ip = '20.0.0.1' - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.0.0.3' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.0.0.3" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,30 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-1cnf.py index f461aeace6..bf653953c8 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-1cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-1cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.0.39 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.0.39 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:00" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:00" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-2cnf.py index bce38697bf..7a718e8e4d 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-2cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-2cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.0.39 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.0.39 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:01" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:01" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-4cnf.py index 80786a13ec..ff47ead5e5 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-4cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-4cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.0.39 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.0.39 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:03" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:03" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-8cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-8cnf.py index d819426634..d9fae8fee3 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-8cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-8cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.0.39 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.0.39 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:07" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:07" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=7, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=7, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=7, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=7, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40.py index eaf2bd6319..5dbc5fc803 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.0.0.39' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.0.0.39" - self.p2_src_start_ip = '20.0.0.1' - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.0.0.39' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.0.0.39" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,30 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-1cnf.py index 17f2b3cdf6..9a645e3498 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-1cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-1cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:00" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:00" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-2cnf.py index 3484ed3ddc..e422be7f5a 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-2cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-2cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:01" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:01" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-4cnf.py index 5f8011a426..0c1ace3b60 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-4cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-4cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:03" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:03" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-8cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-8cnf.py index 00721d5d10..7b224fa9e1 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-8cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-8cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:07" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:07" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=7, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=7, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=7, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=7, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400.py index 1a1e59f8e8..44db3ec81c 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.0.1.143' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.0.1.143" - self.p2_src_start_ip = '20.0.0.1' - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.0.1.143' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.0.1.143" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,30 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-1cnf.py index 8bf01235eb..8463e0094f 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-1cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-1cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.156.63 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.156.63 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:00" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:00" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-2cnf.py index e2f4063aba..ec6ef2836a 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-2cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-2cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.156.63 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.156.63 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:01" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:01" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-4cnf.py index ced1c06623..0fc6dad4fb 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-4cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-4cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.156.63 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.156.63 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:03" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:03" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-8cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-8cnf.py index cc989ef24d..b1c370294e 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-8cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-8cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.156.63 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.156.63 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:07" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:07" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=7, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=7, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=7, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=7, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000.py index 068af2f3c3..570a236fd6 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.0.156.63' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.0.156.63" - self.p2_src_start_ip = '20.0.0.1' - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.0.156.63' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.0.156.63" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,30 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-1cnf.py index 0be9c649bd..acc210c291 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-1cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-1cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.19.135 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.19.135 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:00" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:00" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-2cnf.py index 991c4049b2..b10ad4e854 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-2cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-2cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.19.135 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.19.135 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:01" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:01" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-4cnf.py index c3f8fb8dd0..6176c16ab9 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-4cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-4cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.19.135 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.19.135 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:03" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:03" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-8cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-8cnf.py index 9cf779c8db..5ae0e52aa1 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-8cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-8cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.19.135 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.19.135 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:07" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:07" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=7, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=7, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=7, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=7, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000.py index 4675fab1ef..95d8380a22 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.0.19.135' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.0.19.135" - self.p2_src_start_ip = '20.0.0.1' - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.0.19.135' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.0.19.135" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,30 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-1cnf.py index a84c302205..9b4a0e68ab 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-1cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-1cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.234.95 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.234.95 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:00" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:00" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=0, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=0, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-2cnf.py index d3c720d1f9..f99b84cc63 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-2cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-2cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.234.95 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.234.95 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:01" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:01" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=1, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=1, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-4cnf.py index 034cd5738f..ba705aaee4 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-4cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-4cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.234.95 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.234.95 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:03" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:03" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=3, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=3, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-8cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-8cnf.py index b6fbf8c213..210bd59ad8 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-8cnf.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-8cnf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -18,10 +18,10 @@ Stream profile: - Packet: ETH / IP / - Direction 0 --> 1: - Source IP address range: 10.0.0.1 - - Destination IP address range: 20.0.0.0 - 20.0.1.143 + - Destination IP address range: 20.0.0.0 - 20.0.234.95 - Direction 1 --> 0: - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 + - Destination IP address range: 10.0.0.0 - 10.0.234.95 """ from trex.stl.api import * @@ -37,10 +37,8 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() self.p1_dst_start_mac = u"02:02:00:00:12:00" - self.p1_dst_end_mac = u"02:02:00:00:12:07" self.p2_dst_start_mac = u"02:02:00:00:02:00" - self.p2_dst_end_mac = u"02:02:00:00:02:07" # IPs used in packet headers. self.p1_src_start_ip = u"10.0.0.1" @@ -61,40 +59,84 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # 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)) + 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)) + 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=u"mac_dst", - min_value=0, - max_value=7, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=7, + size=1, + op=u"inc" + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name=u"mac_dst", - min_value=0, - max_value=7, - size=1, op=u"inc"), - STLVmWrFlowVar(fv_name=u"mac_dst", pkt_offset=5), - STLVmFlowVar(name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc"), - STLVmWrFlowVar(fv_name=u"dst", pkt_offset=u"IP.dst"), - STLVmFixIpv4(offset=u"IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=7, + size=1, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset=5 + ), + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000.py index 82a9f8c3cb..126302d545 100644 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.1' - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.0.234.95' + self.p1_src_start_ip = u"10.0.0.1" + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.0.234.95" - self.p2_src_start_ip = '20.0.0.1' - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.0.234.95' + self.p2_src_start_ip = u"20.0.0.1" + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.0.234.95" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,30 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src253.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src253.py index 685365aa1d..883883ad18 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src253.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src253.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.10.10.2' - self.p1_src_end_ip = '10.10.10.254' - self.p1_dst_start_ip = '20.20.20.2' + self.p1_src_start_ip = u"10.10.10.2" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"20.20.20.2" - self.p2_src_start_ip = '20.20.20.2' - self.p2_src_end_ip = '20.20.20.254' - self.p2_dst_start_ip = '10.10.10.2' + self.p2_src_start_ip = u"20.20.20.2" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.2" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,28 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = Ether() / IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = Ether() / IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src254.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src254.py index 1a0b0475e5..fc6167d126 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src254.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src254.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # 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.p1_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" + self.p1_dst_start_ip = u"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' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" + self.p2_dst_start_ip = u"10.10.10.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -55,28 +55,62 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = Ether() / IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = Ether() / IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100ip4src100.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100ip4src100.py index 8036638ed8..b94c56ad6c 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100ip4src100.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100ip4src100.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,18 +41,18 @@ class TrafficStreams(TrafficStreamsBaseClass): self.clients = 100 # MACs used in packet headers. - self.p1_src_start_mac = 'ca:fe:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p2_src_start_mac = 'fa:ce:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.2' - self.p1_src_end_ip = '10.0.0.101' - self.p1_dst_start_ip = '20.0.0.1' + self.p1_src_start_ip = u"10.0.0.2" + self.p1_src_end_ip = u"10.0.0.101" + self.p1_dst_start_ip = u"20.0.0.1" - self.p2_src_start_ip = '20.0.0.2' - self.p2_src_end_ip = '20.0.0.101' - self.p2_dst_start_ip = '10.0.0.1' + self.p2_src_start_ip = u"20.0.0.2" + self.p2_src_end_ip = u"20.0.0.101" + self.p2_dst_start_ip = u"10.0.0.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -64,40 +64,88 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether(src=self.p1_src_start_mac) / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether( + src=self.p1_src_start_mac + ) / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether(src=self.p2_src_start_mac) / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether( + src=self.p2_src_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_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset=8), - 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset=8 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="mac_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset=8), - 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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset=8 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100kip4src100k.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100kip4src100k.py index 681579fe34..52eb841ab0 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100kip4src100k.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100kip4src100k.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,18 +41,18 @@ class TrafficStreams(TrafficStreamsBaseClass): self.clients = 100000 # MACs used in packet headers. - self.p1_src_start_mac = 'ca:fe:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p2_src_start_mac = 'fa:ce:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.2' - self.p1_src_end_ip = '10.1.134.161' - self.p1_dst_start_ip = '20.0.0.1' + self.p1_src_start_ip = u"10.0.0.2" + self.p1_src_end_ip = u"10.1.134.161" + self.p1_dst_start_ip = u"20.0.0.1" - self.p2_src_start_ip = '20.0.0.2' - self.p2_src_end_ip = '20.1.134.161' - self.p2_dst_start_ip = '10.0.0.1' + self.p2_src_start_ip = u"20.0.0.2" + self.p2_src_end_ip = u"20.1.134.161" + self.p2_dst_start_ip = u"10.0.0.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -64,40 +64,88 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether(src=self.p1_src_start_mac) / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether( + src=self.p1_src_start_mac + ) / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether(src=self.p2_src_start_mac) / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether( + src=self.p2_src_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_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset=8), - 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset=8 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="mac_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset=8), - 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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset=8 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc10kip4src10k.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc10kip4src10k.py index ff1c2061d4..8e959c829d 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc10kip4src10k.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc10kip4src10k.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,18 +41,18 @@ class TrafficStreams(TrafficStreamsBaseClass): self.clients = 10000 # MACs used in packet headers. - self.p1_src_start_mac = 'ca:fe:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p2_src_start_mac = 'fa:ce:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.2' - self.p1_src_end_ip = '10.0.39.17' - self.p1_dst_start_ip = '20.0.0.1' + self.p1_src_start_ip = u"10.0.0.2" + self.p1_src_end_ip = u"10.0.39.17" + self.p1_dst_start_ip = u"20.0.0.1" - self.p2_src_start_ip = '20.0.0.2' - self.p2_src_end_ip = '20.0.39.17' - self.p2_dst_start_ip = '10.0.0.1' + self.p2_src_start_ip = u"20.0.0.2" + self.p2_src_end_ip = u"20.0.39.17" + self.p2_dst_start_ip = u"10.0.0.1" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -64,40 +64,88 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether(src=self.p1_src_start_mac) / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether( + src=self.p1_src_start_mac + ) / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether(src=self.p2_src_start_mac) / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether( + src=self.p2_src_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_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset=8), - 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")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset=8 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="mac_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset=8), - 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")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset=8 + ), + STLVmFlowVar( + name=u"src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"src", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc500kdst500k.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc500kdst500k.py index 6dda8fe2aa..da4348f2a0 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc500kdst500k.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc500kdst500k.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,24 +43,24 @@ class TrafficStreams(TrafficStreamsBaseClass): self.clients = 500000 # MACs used in packet headers. - self.p1_src_start_mac = 'ca:fe:00:00:00:00' # mask: 00:00:FF:FF:FF:FF - self.p1_dst_start_mac = 'fa:ce:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF + self.p1_dst_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p2_src_start_mac = 'fa:ce:00:00:00:00' # mask: 00:00:FF:FF:FF:FF - self.p2_dst_start_mac = 'ca:fe:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF + self.p2_dst_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.0' - self.p1_src_end_ip = '10.7.161.31' + self.p1_src_start_ip = u"10.0.0.0" + self.p1_src_end_ip = u"10.7.161.31" - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.7.161.31' + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.7.161.31" - self.p2_src_start_ip = '20.0.0.0' - self.p2_src_end_ip = '20.7.161.31' + self.p2_src_start_ip = u"20.0.0.0" + self.p2_src_end_ip = u"20.7.161.31" - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.7.161.31' + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.7.161.31" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -72,62 +72,134 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether(src=self.p1_src_start_mac, - dst=self.p1_dst_start_mac) / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether( + src=self.p1_src_start_mac, + 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(src=self.p2_src_start_mac, - dst=self.p2_dst_start_mac) / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether( + src=self.p2_src_start_mac, + 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_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmFlowVar(name="mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset= 8), - STLVmWrFlowVar(fv_name="mac_dst", pkt_offset= 2), - STLVmFlowVar(name="ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset= 8 + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset= 2 + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="mac_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmFlowVar(name="mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset= 8), - STLVmWrFlowVar(fv_name="mac_dst", pkt_offset= 2), - STLVmFlowVar(name="ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset= 8 + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset= 2 + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc50kdst50k.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc50kdst50k.py index 03559115d2..6cf066367b 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc50kdst50k.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc50kdst50k.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,24 +43,24 @@ class TrafficStreams(TrafficStreamsBaseClass): self.clients = 50000 # MACs used in packet headers. - self.p1_src_start_mac = 'ca:fe:00:00:00:00' # mask: 00:00:FF:FF:FF:FF - self.p1_dst_start_mac = 'fa:ce:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF + self.p1_dst_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p2_src_start_mac = 'fa:ce:00:00:00:00' # mask: 00:00:FF:FF:FF:FF - self.p2_dst_start_mac = 'ca:fe:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF + self.p2_dst_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.0' - self.p1_src_end_ip = '10.0.195.79' + self.p1_src_start_ip = u"10.0.0.0" + self.p1_src_end_ip = u"10.0.195.79" - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.0.195.79' + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.0.195.79" - self.p2_src_start_ip = '20.0.0.0' - self.p2_src_end_ip = '20.0.195.79' + self.p2_src_start_ip = u"20.0.0.0" + self.p2_src_end_ip = u"20.0.195.79" - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.0.195.79' + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.0.195.79" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -72,62 +72,134 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether(src=self.p1_src_start_mac, - dst=self.p1_dst_start_mac) / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether( + src=self.p1_src_start_mac, + 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(src=self.p2_src_start_mac, - dst=self.p2_dst_start_mac) / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether( + src=self.p2_src_start_mac, + 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_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmFlowVar(name="mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset= 8), - STLVmWrFlowVar(fv_name="mac_dst", pkt_offset= 2), - STLVmFlowVar(name="ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset= 8 + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset= 2 + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="mac_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmFlowVar(name="mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset= 8), - STLVmWrFlowVar(fv_name="mac_dst", pkt_offset= 2), - STLVmFlowVar(name="ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset= 8 + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset= 2 + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc5kdst5k.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc5kdst5k.py index 0ce4ca94d1..29df3373d3 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc5kdst5k.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc5kdst5k.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,24 +43,24 @@ class TrafficStreams(TrafficStreamsBaseClass): self.clients = 5000 # MACs used in packet headers. - self.p1_src_start_mac = 'ca:fe:00:00:00:00' # mask: 00:00:FF:FF:FF:FF - self.p1_dst_start_mac = 'fa:ce:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF + self.p1_dst_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p2_src_start_mac = 'fa:ce:00:00:00:00' # mask: 00:00:FF:FF:FF:FF - self.p2_dst_start_mac = 'ca:fe:00:00:00:00' # mask: 00:00:FF:FF:FF:FF + self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF + self.p2_dst_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF # IPs used in packet headers. - self.p1_src_start_ip = '10.0.0.0' - self.p1_src_end_ip = '10.0.19.135' + self.p1_src_start_ip = u"10.0.0.0" + self.p1_src_end_ip = u"10.0.19.135" - self.p1_dst_start_ip = '20.0.0.0' - self.p1_dst_end_ip = '20.0.19.135' + self.p1_dst_start_ip = u"20.0.0.0" + self.p1_dst_end_ip = u"20.0.19.135" - self.p2_src_start_ip = '20.0.0.0' - self.p2_src_end_ip = '20.0.19.135' + self.p2_src_start_ip = u"20.0.0.0" + self.p2_src_end_ip = u"20.0.19.135" - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.0.19.135' + self.p2_dst_start_ip = u"10.0.0.0" + self.p2_dst_end_ip = u"10.0.19.135" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -72,62 +72,134 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether(src=self.p1_src_start_mac, - dst=self.p1_dst_start_mac) / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether( + src=self.p1_src_start_mac, + 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(src=self.p2_src_start_mac, - dst=self.p2_dst_start_mac) / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether( + src=self.p2_src_start_mac, + 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_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmFlowVar(name="mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset= 8), - STLVmWrFlowVar(fv_name="mac_dst", pkt_offset= 2), - STLVmFlowVar(name="ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset= 8 + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset= 2 + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="mac_src", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmFlowVar(name="mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="mac_src", pkt_offset= 8), - STLVmWrFlowVar(fv_name="mac_dst", pkt_offset= 2), - STLVmFlowVar(name="ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"mac_src", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmFlowVar( + name=u"mac_dst", + min_value=0, + max_value=self.clients-1, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"mac_src", + pkt_offset= 8 + ), + STLVmWrFlowVar( + fv_name=u"mac_dst", + pkt_offset= 2 + ), + STLVmFlowVar( + name=u"ip_src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1000u15p.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1000u15p.py index 2ad2eea734..b7b364f195 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1000u15p.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1000u15p.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,13 +41,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '20.0.0.0' - self.p1_src_end_ip = '20.0.3.231' - self.p1_dst_start_ip = '12.0.0.2' + self.p1_src_start_ip = u"20.0.0.0" + self.p1_src_end_ip = u"20.0.3.231" + self.p1_dst_start_ip = u"12.0.0.2" - self.p2_src_start_ip = '12.0.0.2' - self.p2_src_end_ip = '12.0.0.2' - self.p2_dst_start_ip = '200.0.0.0' + self.p2_src_start_ip = u"12.0.0.2" + self.p2_src_end_ip = u"12.0.0.2" + self.p2_dst_start_ip = u"200.0.0.0" # UDP ports used in packet headers. self.p1_src_start_udp_port = 1024 @@ -68,39 +68,71 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=17) / - UDP(sport=self.p1_src_start_udp_port, - dport=self.p1_dst_start_udp_port)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p1_src_start_udp_port, + dport=self.p1_dst_start_udp_port + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17) / - UDP(sport=self.p2_src_start_udp_port, - dport=self.p2_dst_start_udp_port)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p2_src_start_udp_port, + dport=self.p2_dst_start_udp_port + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p1_src_start_ip, - ip_max=self.p1_src_end_ip, - port_min=self.p1_src_start_udp_port, - port_max=self.p1_src_end_udp_port, - name="tuple"), - STLVmWrFlowVar(fv_name="tuple.ip", pkt_offset="IP.src"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple.port", pkt_offset="UDP.sport") - ]) + vm1 = STLScVmRaw( + [ + STLVmTupleGen( + ip_min=self.p1_src_start_ip, + ip_max=self.p1_src_end_ip, + port_min=self.p1_src_start_udp_port, + port_max=self.p1_src_end_udp_port, + name=u"tuple" + ), + STLVmWrFlowVar( + fv_name=u"tuple.ip", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ), + STLVmWrFlowVar( + fv_name=u"tuple.port", + pkt_offset=u"UDP.sport" + ) + ] + ) # Direction 0 --> 1 - vm2 = STLScVmRaw([ - STLVmFlowVar(name="dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="dport", pkt_offset="UDP.dport") - ]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dport", + min_value=self.p2_dst_start_udp_port, + max_value=self.p2_dst_end_udp_port, + size=2, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dport", + pkt_offset=u"UDP.dport" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u1000p-conc.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u1000p-conc.py index acc1b31980..b93cd645ae 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u1000p-conc.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u1000p-conc.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,15 +41,15 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.10.10.2' - self.p1_src_end_ip = '10.10.10.101' - self.p1_dst_start_ip = '20.20.20.2' - self.p1_dst_end_ip = '20.20.20.101' + self.p1_src_start_ip = u"10.10.10.2" + self.p1_src_end_ip = u"10.10.10.101" + self.p1_dst_start_ip = u"20.20.20.2" + self.p1_dst_end_ip = u"20.20.20.101" - self.p2_src_start_ip = '20.20.20.2' - self.p2_src_end_ip = '20.20.20.101' - self.p2_dst_start_ip = '10.10.10.2' - self.p2_dst_end_ip = '10.10.10.101' + self.p2_src_start_ip = u"20.20.20.2" + self.p2_src_end_ip = u"20.20.20.101" + self.p2_dst_start_ip = u"10.10.10.2" + self.p2_dst_end_ip = u"10.10.10.101" # UDP ports used in packet headers. self.p1_src_start_udp_port = 1001 @@ -72,56 +72,108 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=17) / - UDP(sport=self.p1_src_start_udp_port, - dport=self.p1_dst_start_udp_port)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p1_src_start_udp_port, + dport=self.p1_dst_start_udp_port + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17) / - UDP(sport=self.p2_src_start_udp_port, - dport=self.p2_dst_start_udp_port)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p2_src_start_udp_port, + dport=self.p2_dst_start_udp_port + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p1_src_start_ip, - ip_max=self.p1_src_end_ip, - port_min=self.p1_src_start_udp_port, - port_max=self.p1_src_end_udp_port, - name="tuple1_src"), - STLVmTupleGen(ip_min=self.p1_dst_start_ip, - ip_max=self.p1_dst_end_ip, - port_min=self.p1_dst_start_udp_port, - port_max=self.p1_dst_end_udp_port, - name="tuple1_dst"), - STLVmWrFlowVar(fv_name="tuple1_src.ip", pkt_offset="IP.src"), - STLVmWrFlowVar(fv_name="tuple1_dst.ip", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple1_src.port", pkt_offset="UDP.sport"), - STLVmWrFlowVar(fv_name="tuple1_dst.port", pkt_offset="UDP.dport") - ]) + vm1 = STLScVmRaw( + [ + STLVmTupleGen( + ip_min=self.p1_src_start_ip, + ip_max=self.p1_src_end_ip, + port_min=self.p1_src_start_udp_port, + port_max=self.p1_src_end_udp_port, + name=u"tuple1_src" + ), + STLVmTupleGen( + ip_min=self.p1_dst_start_ip, + ip_max=self.p1_dst_end_ip, + port_min=self.p1_dst_start_udp_port, + port_max=self.p1_dst_end_udp_port, + name=u"tuple1_dst" + ), + STLVmWrFlowVar( + fv_name=u"tuple1_src.ip", + pkt_offset=u"IP.src" + ), + STLVmWrFlowVar( + fv_name=u"tuple1_dst.ip", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ), + STLVmWrFlowVar( + fv_name=u"tuple1_src.port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"tuple1_dst.port", + pkt_offset=u"UDP.dport" + ) + ] + ) # Direction 0 --> 1 - vm2 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p2_src_start_ip, - ip_max=self.p2_src_end_ip, - port_min=self.p2_src_start_udp_port, - port_max=self.p2_src_end_udp_port, - name="tuple2_src"), - STLVmTupleGen(ip_min=self.p2_dst_start_ip, - ip_max=self.p2_dst_end_ip, - port_min=self.p2_dst_start_udp_port, - port_max=self.p2_dst_end_udp_port, - name="tuple2_dst"), - STLVmWrFlowVar(fv_name="tuple2_src.ip", pkt_offset="IP.src"), - STLVmWrFlowVar(fv_name="tuple2_dst.ip", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple2_src.port", pkt_offset="UDP.sport"), - STLVmWrFlowVar(fv_name="tuple2_dst.port", pkt_offset="UDP.dport") - ]) + vm2 = STLScVmRaw( + [ + STLVmTupleGen( + ip_min=self.p2_src_start_ip, + ip_max=self.p2_src_end_ip, + port_min=self.p2_src_start_udp_port, + port_max=self.p2_src_end_udp_port, + name=u"tuple2_src" + ), + STLVmTupleGen( + ip_min=self.p2_dst_start_ip, + ip_max=self.p2_dst_end_ip, + port_min=self.p2_dst_start_udp_port, + port_max=self.p2_dst_end_udp_port, + name=u"tuple2_dst" + ), + STLVmWrFlowVar( + fv_name=u"tuple2_src.ip", + pkt_offset=u"IP.src" + ), + STLVmWrFlowVar( + fv_name=u"tuple2_dst.ip", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ), + STLVmWrFlowVar( + fv_name=u"tuple2_src.port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"tuple2_dst.port", + pkt_offset=u"UDP.dport" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u15p.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u15p.py index d1d4016e62..31cdc5e628 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u15p.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u15p.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,13 +41,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '20.0.0.0' - self.p1_src_end_ip = '20.0.0.99' - self.p1_dst_start_ip = '12.0.0.2' + self.p1_src_start_ip = u"20.0.0.0" + self.p1_src_end_ip = u"20.0.0.99" + self.p1_dst_start_ip = u"12.0.0.2" - self.p2_src_start_ip = '12.0.0.2' - self.p2_src_end_ip = '12.0.0.2' - self.p2_dst_start_ip = '200.0.0.0' + self.p2_src_start_ip = u"12.0.0.2" + self.p2_src_end_ip = u"12.0.0.2" + self.p2_dst_start_ip = u"200.0.0.0" # UDP ports used in packet headers. self.p1_src_start_udp_port = 1024 @@ -68,39 +68,71 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=17) / - UDP(sport=self.p1_src_start_udp_port, - dport=self.p1_dst_start_udp_port)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p1_src_start_udp_port, + dport=self.p1_dst_start_udp_port + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17) / - UDP(sport=self.p2_src_start_udp_port, - dport=self.p2_dst_start_udp_port)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p2_src_start_udp_port, + dport=self.p2_dst_start_udp_port + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p1_src_start_ip, - ip_max=self.p1_src_end_ip, - port_min=self.p1_src_start_udp_port, - port_max=self.p1_src_end_udp_port, - name="tuple"), - STLVmWrFlowVar(fv_name="tuple.ip", pkt_offset="IP.src"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple.port", pkt_offset="UDP.sport") - ]) + vm1 = STLScVmRaw( + [ + STLVmTupleGen( + ip_min=self.p1_src_start_ip, + ip_max=self.p1_src_end_ip, + port_min=self.p1_src_start_udp_port, + port_max=self.p1_src_end_udp_port, + name=u"tuple" + ), + STLVmWrFlowVar( + fv_name=u"tuple.ip", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ), + STLVmWrFlowVar( + fv_name=u"tuple.port", + pkt_offset=u"UDP.sport" + ) + ] + ) # Direction 0 --> 1 - vm2 = STLScVmRaw([ - STLVmFlowVar(name="dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="dport", pkt_offset="UDP.dport") - ]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dport", + min_value=self.p2_dst_start_udp_port, + max_value=self.p2_dst_end_udp_port, + size=2, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dport", + pkt_offset=u"UDP.dport" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u1000p-conc.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u1000p-conc.py index 384037d860..9032a8c2f5 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u1000p-conc.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u1000p-conc.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,15 +41,15 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.10.10.2' - self.p1_src_end_ip = '10.10.10.11' - self.p1_dst_start_ip = '20.20.20.2' - self.p1_dst_end_ip = '20.20.20.11' + self.p1_src_start_ip = u"10.10.10.2" + self.p1_src_end_ip = u"10.10.10.11" + self.p1_dst_start_ip = u"20.20.20.2" + self.p1_dst_end_ip = u"20.20.20.11" - self.p2_src_start_ip = '20.20.20.2' - self.p2_src_end_ip = '20.20.20.11' - self.p2_dst_start_ip = '10.10.10.2' - self.p2_dst_end_ip = '10.10.10.11' + self.p2_src_start_ip = u"20.20.20.2" + self.p2_src_end_ip = u"20.20.20.11" + self.p2_dst_start_ip = u"10.10.10.2" + self.p2_dst_end_ip = u"10.10.10.11" # UDP ports used in packet headers. self.p1_src_start_udp_port = 1001 @@ -72,56 +72,108 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=17) / - UDP(sport=self.p1_src_start_udp_port, - dport=self.p1_dst_start_udp_port)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p1_src_start_udp_port, + dport=self.p1_dst_start_udp_port + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17) / - UDP(sport=self.p2_src_start_udp_port, - dport=self.p2_dst_start_udp_port)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p2_src_start_udp_port, + dport=self.p2_dst_start_udp_port + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p1_src_start_ip, - ip_max=self.p1_src_end_ip, - port_min=self.p1_src_start_udp_port, - port_max=self.p1_src_end_udp_port, - name="tuple1_src"), - STLVmTupleGen(ip_min=self.p1_dst_start_ip, - ip_max=self.p1_dst_end_ip, - port_min=self.p1_dst_start_udp_port, - port_max=self.p1_dst_end_udp_port, - name="tuple1_dst"), - STLVmWrFlowVar(fv_name="tuple1_src.ip", pkt_offset="IP.src"), - STLVmWrFlowVar(fv_name="tuple1_dst.ip", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple1_src.port", pkt_offset="UDP.sport"), - STLVmWrFlowVar(fv_name="tuple1_dst.port", pkt_offset="UDP.dport") - ]) + vm1 = STLScVmRaw( + [ + STLVmTupleGen( + ip_min=self.p1_src_start_ip, + ip_max=self.p1_src_end_ip, + port_min=self.p1_src_start_udp_port, + port_max=self.p1_src_end_udp_port, + name=u"tuple1_src" + ), + STLVmTupleGen( + ip_min=self.p1_dst_start_ip, + ip_max=self.p1_dst_end_ip, + port_min=self.p1_dst_start_udp_port, + port_max=self.p1_dst_end_udp_port, + name=u"tuple1_dst" + ), + STLVmWrFlowVar( + fv_name=u"tuple1_src.ip", + pkt_offset=u"IP.src" + ), + STLVmWrFlowVar( + fv_name=u"tuple1_dst.ip", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ), + STLVmWrFlowVar( + fv_name=u"tuple1_src.port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"tuple1_dst.port", + pkt_offset=u"UDP.dport" + ) + ] + ) # Direction 0 --> 1 - vm2 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p2_src_start_ip, - ip_max=self.p2_src_end_ip, - port_min=self.p2_src_start_udp_port, - port_max=self.p2_src_end_udp_port, - name="tuple2_src"), - STLVmTupleGen(ip_min=self.p2_dst_start_ip, - ip_max=self.p2_dst_end_ip, - port_min=self.p2_dst_start_udp_port, - port_max=self.p2_dst_end_udp_port, - name="tuple2_dst"), - STLVmWrFlowVar(fv_name="tuple2_src.ip", pkt_offset="IP.src"), - STLVmWrFlowVar(fv_name="tuple2_dst.ip", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple2_src.port", pkt_offset="UDP.sport"), - STLVmWrFlowVar(fv_name="tuple2_dst.port", pkt_offset="UDP.dport") - ]) + vm2 = STLScVmRaw( + [ + STLVmTupleGen( + ip_min=self.p2_src_start_ip, + ip_max=self.p2_src_end_ip, + port_min=self.p2_src_start_udp_port, + port_max=self.p2_src_end_udp_port, + name=u"tuple2_src" + ), + STLVmTupleGen( + ip_min=self.p2_dst_start_ip, + ip_max=self.p2_dst_end_ip, + port_min=self.p2_dst_start_udp_port, + port_max=self.p2_dst_end_udp_port, + name=u"tuple2_dst" + ), + STLVmWrFlowVar( + fv_name=u"tuple2_src.ip", + pkt_offset=u"IP.src" + ), + STLVmWrFlowVar( + fv_name=u"tuple2_dst.ip", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ), + STLVmWrFlowVar( + fv_name=u"tuple2_src.port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"tuple2_dst.port", + pkt_offset=u"UDP.dport" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u10p-conc.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u10p-conc.py index e6d095066b..29433b3d27 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u10p-conc.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u10p-conc.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,15 +41,15 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '10.10.10.2' - self.p1_src_end_ip = '10.10.10.11' - self.p1_dst_start_ip = '20.20.20.2' - self.p1_dst_end_ip = '20.20.20.11' + self.p1_src_start_ip = u"10.10.10.2" + self.p1_src_end_ip = u"10.10.10.11" + self.p1_dst_start_ip = u"20.20.20.2" + self.p1_dst_end_ip = u"20.20.20.11" - self.p2_src_start_ip = '20.20.20.2' - self.p2_src_end_ip = '20.20.20.11' - self.p2_dst_start_ip = '10.10.10.2' - self.p2_dst_end_ip = '10.10.10.11' + self.p2_src_start_ip = u"20.20.20.2" + self.p2_src_end_ip = u"20.20.20.11" + self.p2_dst_start_ip = u"10.10.10.2" + self.p2_dst_end_ip = u"10.10.10.11" # UDP ports used in packet headers. self.p1_src_start_udp_port = 1001 @@ -72,56 +72,108 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=17) / - UDP(sport=self.p1_src_start_udp_port, - dport=self.p1_dst_start_udp_port)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p1_src_start_udp_port, + dport=self.p1_dst_start_udp_port + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17) / - UDP(sport=self.p2_src_start_udp_port, - dport=self.p2_dst_start_udp_port)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p2_src_start_udp_port, + dport=self.p2_dst_start_udp_port + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p1_src_start_ip, - ip_max=self.p1_src_end_ip, - port_min=self.p1_src_start_udp_port, - port_max=self.p1_src_end_udp_port, - name="tuple1_src"), - STLVmTupleGen(ip_min=self.p1_dst_start_ip, - ip_max=self.p1_dst_end_ip, - port_min=self.p1_dst_start_udp_port, - port_max=self.p1_dst_end_udp_port, - name="tuple1_dst"), - STLVmWrFlowVar(fv_name="tuple1_src.ip", pkt_offset="IP.src"), - STLVmWrFlowVar(fv_name="tuple1_dst.ip", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple1_src.port", pkt_offset="UDP.sport"), - STLVmWrFlowVar(fv_name="tuple1_dst.port", pkt_offset="UDP.dport") - ]) + vm1 = STLScVmRaw( + [ + STLVmTupleGen( + ip_min=self.p1_src_start_ip, + ip_max=self.p1_src_end_ip, + port_min=self.p1_src_start_udp_port, + port_max=self.p1_src_end_udp_port, + name=u"tuple1_src" + ), + STLVmTupleGen( + ip_min=self.p1_dst_start_ip, + ip_max=self.p1_dst_end_ip, + port_min=self.p1_dst_start_udp_port, + port_max=self.p1_dst_end_udp_port, + name=u"tuple1_dst" + ), + STLVmWrFlowVar( + fv_name=u"tuple1_src.ip", + pkt_offset=u"IP.src" + ), + STLVmWrFlowVar( + fv_name=u"tuple1_dst.ip", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ), + STLVmWrFlowVar( + fv_name=u"tuple1_src.port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"tuple1_dst.port", + pkt_offset=u"UDP.dport" + ) + ] + ) # Direction 0 --> 1 - vm2 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p2_src_start_ip, - ip_max=self.p2_src_end_ip, - port_min=self.p2_src_start_udp_port, - port_max=self.p2_src_end_udp_port, - name="tuple2_src"), - STLVmTupleGen(ip_min=self.p2_dst_start_ip, - ip_max=self.p2_dst_end_ip, - port_min=self.p2_dst_start_udp_port, - port_max=self.p2_dst_end_udp_port, - name="tuple2_dst"), - STLVmWrFlowVar(fv_name="tuple2_src.ip", pkt_offset="IP.src"), - STLVmWrFlowVar(fv_name="tuple2_dst.ip", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple2_src.port", pkt_offset="UDP.sport"), - STLVmWrFlowVar(fv_name="tuple2_dst.port", pkt_offset="UDP.dport") - ]) + vm2 = STLScVmRaw( + [ + STLVmTupleGen( + ip_min=self.p2_src_start_ip, + ip_max=self.p2_src_end_ip, + port_min=self.p2_src_start_udp_port, + port_max=self.p2_src_end_udp_port, + name=u"tuple2_src" + ), + STLVmTupleGen( + ip_min=self.p2_dst_start_ip, + ip_max=self.p2_dst_end_ip, + port_min=self.p2_dst_start_udp_port, + port_max=self.p2_dst_end_udp_port, + name=u"tuple2_dst" + ), + STLVmWrFlowVar( + fv_name=u"tuple2_src.ip", + pkt_offset=u"IP.src" + ), + STLVmWrFlowVar( + fv_name=u"tuple2_dst.ip", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ), + STLVmWrFlowVar( + fv_name=u"tuple2_src.port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"tuple2_dst.port", + pkt_offset=u"UDP.dport" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u15p.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u15p.py index 346a9a50de..57c5b2dcbc 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u15p.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u15p.py @@ -1,4 +1,4 @@ -# Copyright (c) 201 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,13 +41,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '20.0.0.0' - self.p1_src_end_ip = '20.0.0.9' - self.p1_dst_start_ip = '12.0.0.2' + self.p1_src_start_ip = u"20.0.0.0" + self.p1_src_end_ip = u"20.0.0.9" + self.p1_dst_start_ip = u"12.0.0.2" - self.p2_src_start_ip = '12.0.0.2' - #self.p2_src_end_ip = '12.0.0.2' - self.p2_dst_start_ip = '200.0.0.0' + self.p2_src_start_ip = u"12.0.0.2" + #self.p2_src_end_ip = u"12.0.0.2" + self.p2_dst_start_ip = u"200.0.0.0" # UDP ports used in packet headers. self.p1_src_start_udp_port = 1024 @@ -68,39 +68,71 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=17) / - UDP(sport=self.p1_src_start_udp_port, - dport=self.p1_dst_start_udp_port)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p1_src_start_udp_port, + dport=self.p1_dst_start_udp_port + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17) / - UDP(sport=self.p2_src_start_udp_port, - dport=self.p2_dst_start_udp_port)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p2_src_start_udp_port, + dport=self.p2_dst_start_udp_port + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p1_src_start_ip, - ip_max=self.p1_src_end_ip, - port_min=self.p1_src_start_udp_port, - port_max=self.p1_src_end_udp_port, - name="tuple"), - STLVmWrFlowVar(fv_name="tuple.ip", pkt_offset="IP.src"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple.port", pkt_offset="UDP.sport") - ]) + vm1 = STLScVmRaw( + [ + STLVmTupleGen( + ip_min=self.p1_src_start_ip, + ip_max=self.p1_src_end_ip, + port_min=self.p1_src_start_udp_port, + port_max=self.p1_src_end_udp_port, + name=u"tuple" + ), + STLVmWrFlowVar( + fv_name=u"tuple.ip", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ), + STLVmWrFlowVar( + fv_name=u"tuple.port", + pkt_offset=u"UDP.sport" + ) + ] + ) # Direction 0 --> 1 - vm2 = STLScVmRaw([ - STLVmFlowVar(name="dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="dport", pkt_offset="UDP.dport") - ]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dport", + min_value=self.p2_dst_start_udp_port, + max_value=self.p2_dst_end_udp_port, + size=2, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dport", + pkt_offset=u"UDP.dport" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u15p.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u15p.py index 19cb9e672d..df9a1642a9 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u15p.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u15p.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,13 +41,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '20.0.0.0' - self.p1_src_end_ip = '20.0.0.0' - self.p1_dst_start_ip = '12.0.0.2' + self.p1_src_start_ip = u"20.0.0.0" + self.p1_src_end_ip = u"20.0.0.0" + self.p1_dst_start_ip = u"12.0.0.2" - self.p2_src_start_ip = '12.0.0.2' - self.p2_src_end_ip = '12.0.0.2' - self.p2_dst_start_ip = '200.0.0.0' + self.p2_src_start_ip = u"12.0.0.2" + self.p2_src_end_ip = u"12.0.0.2" + self.p2_dst_start_ip = u"200.0.0.0" # UDP ports used in packet headers. self.p1_src_start_udp_port = 1024 @@ -68,36 +68,64 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=17) / - UDP(sport=self.p1_src_start_udp_port, - dport=self.p1_dst_start_udp_port)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p1_src_start_udp_port, + dport=self.p1_dst_start_udp_port + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17) / - UDP(sport=self.p2_src_start_udp_port, - dport=self.p2_dst_start_udp_port)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p2_src_start_udp_port, + dport=self.p2_dst_start_udp_port + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmFlowVar(name="sport", - min_value=self.p1_src_start_udp_port, - max_value=self.p1_src_end_udp_port, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="sport", pkt_offset="UDP.sport") - ]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"sport", + min_value=self.p1_src_start_udp_port, + max_value=self.p1_src_end_udp_port, + size=2, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"sport", + pkt_offset=u"UDP.sport" + ) + ] + ) # Direction 0 --> 1 - vm2 = STLScVmRaw([ - STLVmFlowVar(name="dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="dport", pkt_offset="UDP.dport") - ]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dport", + min_value=self.p2_dst_start_udp_port, + max_value=self.p2_dst_end_udp_port, + size=2, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dport", + pkt_offset=u"UDP.dport" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u1p.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u1p.py index a4d0842a50..a892ec8822 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u1p.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u1p.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,11 +41,11 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_ip = '20.0.0.0' - self.p1_dst_ip = '12.0.0.2' + self.p1_src_ip = u"20.0.0.0" + self.p1_dst_ip = u"12.0.0.2" - self.p2_src_ip = '12.0.0.2' - self.p2_dst_ip = '200.0.0.0' + self.p2_src_ip = u"12.0.0.2" + self.p2_dst_ip = u"200.0.0.0" # UDP ports used in packet headers. self.p1_src_udp_port = 1024 @@ -64,15 +64,31 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_ip, dst=self.p1_dst_ip, proto=17) / - UDP(sport=self.p1_src_udp_port, - dport=self.p1_dst_udp_port)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_ip, + dst=self.p1_dst_ip, + proto=17 + ) / + UDP( + sport=self.p1_src_udp_port, + dport=self.p1_dst_udp_port + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_ip, dst=self.p2_dst_ip, proto=17) / - UDP(sport=self.p2_src_udp_port, - dport=self.p2_dst_udp_port)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_ip, + dst=self.p2_dst_ip, + proto=17 + ) / + UDP( + sport=self.p2_src_udp_port, + dport=self.p2_dst_udp_port + ) + ) return base_pkt_a, base_pkt_b, None, None diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-2000u15p.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-2000u15p.py index 45919a656a..c96f76aaee 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-2000u15p.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-2000u15p.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,13 +41,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '20.0.0.0' - self.p1_src_end_ip = '20.0.7.207' - self.p1_dst_start_ip = '12.0.0.2' + self.p1_src_start_ip = u"20.0.0.0" + self.p1_src_end_ip = u"20.0.7.207" + self.p1_dst_start_ip = u"12.0.0.2" - self.p2_src_start_ip = '12.0.0.2' - self.p2_src_end_ip = '12.0.0.2' - self.p2_dst_start_ip = '200.0.0.0' + self.p2_src_start_ip = u"12.0.0.2" + self.p2_src_end_ip = u"12.0.0.2" + self.p2_dst_start_ip = u"200.0.0.0" # UDP ports used in packet headers. self.p1_src_start_udp_port = 1024 @@ -68,39 +68,71 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=17) / - UDP(sport=self.p1_src_start_udp_port, - dport=self.p1_dst_start_udp_port)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p1_src_start_udp_port, + dport=self.p1_dst_start_udp_port + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17) / - UDP(sport=self.p2_src_start_udp_port, - dport=self.p2_dst_start_udp_port)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p2_src_start_udp_port, + dport=self.p2_dst_start_udp_port + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p1_src_start_ip, - ip_max=self.p1_src_end_ip, - port_min=self.p1_src_start_udp_port, - port_max=self.p1_src_end_udp_port, - name="tuple"), - STLVmWrFlowVar(fv_name="tuple.ip", pkt_offset="IP.src"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple.port", pkt_offset="UDP.sport") - ]) + vm1 = STLScVmRaw( + [ + STLVmTupleGen( + ip_min=self.p1_src_start_ip, + ip_max=self.p1_src_end_ip, + port_min=self.p1_src_start_udp_port, + port_max=self.p1_src_end_udp_port, + name=u"tuple" + ), + STLVmWrFlowVar( + fv_name=u"tuple.ip", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ), + STLVmWrFlowVar( + fv_name=u"tuple.port", + pkt_offset=u"UDP.sport" + ) + ] + ) # Direction 0 --> 1 - vm2 = STLScVmRaw([ - STLVmFlowVar(name="dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="dport", pkt_offset="UDP.dport") - ]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dport", + min_value=self.p2_dst_start_udp_port, + max_value=self.p2_dst_end_udp_port, + size=2, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dport", + pkt_offset=u"UDP.dport" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-4000u15p.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-4000u15p.py index 626acd6e89..c1b3d5ba59 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-4000u15p.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-4000u15p.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -41,13 +41,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '20.0.0.0' - self.p1_src_end_ip = '20.0.15.159' - self.p1_dst_start_ip = '12.0.0.2' + self.p1_src_start_ip = u"20.0.0.0" + self.p1_src_end_ip = u"20.0.15.159" + self.p1_dst_start_ip = u"12.0.0.2" - self.p2_src_start_ip = '12.0.0.2' - self.p2_src_end_ip = '12.0.0.2' - self.p2_dst_start_ip = '200.0.0.0' + self.p2_src_start_ip = u"12.0.0.2" + self.p2_src_end_ip = u"12.0.0.2" + self.p2_dst_start_ip = u"200.0.0.0" # UDP ports used in packet headers. self.p1_src_start_udp_port = 1024 @@ -68,39 +68,71 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=17) / - UDP(sport=self.p1_src_start_udp_port, - dport=self.p1_dst_start_udp_port)) + base_pkt_a = ( + Ether() / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p1_src_start_udp_port, + dport=self.p1_dst_start_udp_port + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17) / - UDP(sport=self.p2_src_start_udp_port, - dport=self.p2_dst_start_udp_port)) + base_pkt_b = ( + Ether() / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=17 + ) / + UDP( + sport=self.p2_src_start_udp_port, + dport=self.p2_dst_start_udp_port + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p1_src_start_ip, - ip_max=self.p1_src_end_ip, - port_min=self.p1_src_start_udp_port, - port_max=self.p1_src_end_udp_port, - name="tuple"), - STLVmWrFlowVar(fv_name="tuple.ip", pkt_offset="IP.src"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple.port", pkt_offset="UDP.sport") - ]) + vm1 = STLScVmRaw( + [ + STLVmTupleGen( + ip_min=self.p1_src_start_ip, + ip_max=self.p1_src_end_ip, + port_min=self.p1_src_start_udp_port, + port_max=self.p1_src_end_udp_port, + name=u"tuple" + ), + STLVmWrFlowVar( + fv_name=u"tuple.ip", + pkt_offset=u"IP.src" + ), + STLVmFixIpv4( + offset=u"IP" + ), + STLVmWrFlowVar( + fv_name=u"tuple.port", + pkt_offset=u"UDP.sport" + ) + ] + ) # Direction 0 --> 1 - vm2 = STLScVmRaw([ - STLVmFlowVar(name="dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="dport", pkt_offset="UDP.dport") - ]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"dport", + min_value=self.p2_dst_start_udp_port, + max_value=self.p2_dst_end_udp_port, + size=2, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"dport", + pkt_offset=u"UDP.dport" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst10000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst10000.py index 085787aa6b..f1b90350fb 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst10000.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst10000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '2001:1::1' - self.p1_dst_start_ip = '2001:2::0' - self.p1_dst_end_ip = '2001:2::270F' + self.p1_src_start_ip = u"2001:1::1" + self.p1_dst_start_ip = u"2001:2::0" + self.p1_dst_end_ip = u"2001:2::270F" - self.p2_src_start_ip = '2001:2::1' - self.p2_dst_start_ip = '2001:1::0' - self.p2_dst_end_ip = '2001:1::270F' + self.p2_src_start_ip = u"2001:2::1" + self.p2_dst_start_ip = u"2001:1::0" + self.p2_dst_end_ip = u"2001:1::270F" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -54,34 +54,66 @@ class TrafficStreams(TrafficStreamsBaseClass): :rtype: tuple """ - base_p1, count_p1 = self._get_start_end_ipv6(self.p1_dst_start_ip, - self.p1_dst_end_ip) - base_p2, count_p2 = self._get_start_end_ipv6(self.p2_dst_start_ip, - self.p2_dst_end_ip) + base_p1, count_p1 = self._get_start_end_ipv6( + self.p1_dst_start_ip, + self.p1_dst_end_ip + ) + base_p2, count_p2 = self._get_start_end_ipv6( + self.p2_dst_start_ip, + self.p2_dst_end_ip + ) # Direction 0 --> 1 - base_pkt_a = Ether() / IPv6(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip) + base_pkt_a = ( + Ether() / + IPv6( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip + ) + ) # Direction 1 --> 0 - base_pkt_b = Ether() / IPv6(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip) + base_pkt_b = ( + Ether() / + IPv6( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_dst", + min_value=base_p1, + max_value=base_p1 + count_p1, + size=8, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_dst", + pkt_offset=u"IPv6.dst", + offset_fixup=8 + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_dst", + min_value=base_p2, + max_value=base_p2 + count_p2, + size=8, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_dst", + pkt_offset=u"IPv6.dst", + offset_fixup=8 + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst100000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst100000.py index b32943062a..87e76726b2 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst100000.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst100000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '2001:1::1' - self.p1_dst_start_ip = '2001:2::0' - self.p1_dst_end_ip = '2001:2::1:869F' + self.p1_src_start_ip = u"2001:1::1" + self.p1_dst_start_ip = u"2001:2::0" + self.p1_dst_end_ip = u"2001:2::1:869F" - self.p2_src_start_ip = '2001:2::1' - self.p2_dst_start_ip = '2001:1::0' - self.p2_dst_end_ip = '2001:1::1:869F' + self.p2_src_start_ip = u"2001:2::1" + self.p2_dst_start_ip = u"2001:1::0" + self.p2_dst_end_ip = u"2001:1::1:869F" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -54,34 +54,66 @@ class TrafficStreams(TrafficStreamsBaseClass): :rtype: tuple """ - base_p1, count_p1 = self._get_start_end_ipv6(self.p1_dst_start_ip, - self.p1_dst_end_ip) - base_p2, count_p2 = self._get_start_end_ipv6(self.p2_dst_start_ip, - self.p2_dst_end_ip) + base_p1, count_p1 = self._get_start_end_ipv6( + self.p1_dst_start_ip, + self.p1_dst_end_ip + ) + base_p2, count_p2 = self._get_start_end_ipv6( + self.p2_dst_start_ip, + self.p2_dst_end_ip + ) # Direction 0 --> 1 - base_pkt_a = Ether() / IPv6(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip) + base_pkt_a = ( + Ether() / + IPv6( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip + ) + ) # Direction 1 --> 0 - base_pkt_b = Ether() / IPv6(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip) + base_pkt_b = ( + Ether() / + IPv6( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_dst", + min_value=base_p1, + max_value=base_p1 + count_p1, + size=8, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_dst", + pkt_offset=u"IPv6.dst", + offset_fixup=8 + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_dst", + min_value=base_p2, + max_value=base_p2 + count_p2, + size=8, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_dst", + pkt_offset=u"IPv6.dst", + offset_fixup=8 + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst1000000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst1000000.py index e45d37f833..c6870d89fa 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst1000000.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst1000000.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '2001:1::1' - self.p1_dst_start_ip = '2001:2::0' - self.p1_dst_end_ip = '2001:2::F:423F' + self.p1_src_start_ip = u"2001:1::1" + self.p1_dst_start_ip = u"2001:2::0" + self.p1_dst_end_ip = u"2001:2::F:423F" - self.p2_src_start_ip = '2001:2::1' - self.p2_dst_start_ip = '2001:1::0' - self.p2_dst_end_ip = '2001:1::F:423F' + self.p2_src_start_ip = u"2001:2::1" + self.p2_dst_start_ip = u"2001:1::0" + self.p2_dst_end_ip = u"2001:1::F:423F" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -54,34 +54,66 @@ class TrafficStreams(TrafficStreamsBaseClass): :rtype: tuple """ - base_p1, count_p1 = self._get_start_end_ipv6(self.p1_dst_start_ip, - self.p1_dst_end_ip) - base_p2, count_p2 = self._get_start_end_ipv6(self.p2_dst_start_ip, - self.p2_dst_end_ip) + base_p1, count_p1 = self._get_start_end_ipv6( + self.p1_dst_start_ip, + self.p1_dst_end_ip + ) + base_p2, count_p2 = self._get_start_end_ipv6( + self.p2_dst_start_ip, + self.p2_dst_end_ip + ) # Direction 0 --> 1 - base_pkt_a = Ether() / IPv6(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip) + base_pkt_a = ( + Ether() / + IPv6( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip + ) + ) # Direction 1 --> 0 - base_pkt_b = Ether() / IPv6(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip) + base_pkt_b = ( + Ether() / + IPv6( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_dst", + min_value=base_p1, + max_value=base_p1 + count_p1, + size=8, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_dst", + pkt_offset=u"IPv6.dst", + offset_fixup=8 + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_dst", + min_value=base_p2, + max_value=base_p2 + count_p2, + size=8, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_dst", + pkt_offset=u"IPv6.dst", + offset_fixup=8 + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6src253.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6src253.py index 8bce54f85b..fbe8b94ab3 100755 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6src253.py +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6src253.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -37,13 +37,13 @@ class TrafficStreams(TrafficStreamsBaseClass): super(TrafficStreamsBaseClass, self).__init__() # IPs used in packet headers. - self.p1_src_start_ip = '2001:1::2' - self.p1_src_end_ip = '2001:1::FE' - self.p1_dst_start_ip = '2001:2::2' + self.p1_src_start_ip = u"2001:1::2" + self.p1_src_end_ip = u"2001:1::FE" + self.p1_dst_start_ip = u"2001:2::2" - self.p2_src_start_ip = '2001:2::2' - self.p2_src_end_ip = '2001:2::FE' - self.p2_dst_start_ip = '2001:1::2' + self.p2_src_start_ip = u"2001:2::2" + self.p2_src_end_ip = u"2001:2::FE" + self.p2_dst_start_ip = u"2001:1::2" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -54,34 +54,66 @@ class TrafficStreams(TrafficStreamsBaseClass): :rtype: tuple """ - base_p1, count_p1 = self._get_start_end_ipv6(self.p1_src_start_ip, - self.p1_src_end_ip) - base_p2, count_p2 = self._get_start_end_ipv6(self.p2_src_start_ip, - self.p2_src_end_ip) + base_p1, count_p1 = self._get_start_end_ipv6( + self.p1_src_start_ip, + self.p1_src_end_ip + ) + base_p2, count_p2 = self._get_start_end_ipv6( + self.p2_src_start_ip, + self.p2_src_end_ip + ) # Direction 0 --> 1 - base_pkt_a = Ether() / IPv6(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip) + base_pkt_a = ( + Ether() / + IPv6( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip + ) + ) # Direction 1 --> 0 - base_pkt_b = Ether() / IPv6(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip) + base_pkt_b = ( + Ether() / + IPv6( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="ipv6_src", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_src", - pkt_offset="IPv6.src", - offset_fixup=8)]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_src", + min_value=base_p1, + max_value=base_p1 + count_p1, + size=8, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_src", + pkt_offset=u"IPv6.src", + offset_fixup=8 + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="ipv6_src", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_src", - pkt_offset="IPv6.src", - offset_fixup=8)]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ipv6_src", + min_value=base_p2, + max_value=base_p2 + count_p2, + size=8, + op=u"inc" + ), + STLVmWrFlowVar( + fv_name=u"ipv6_src", + pkt_offset=u"IPv6.src", + offset_fixup=8 + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254-bvi.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254-bvi.py index 24deddf694..28ec10bf8b 100755 --- a/resources/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254-bvi.py +++ b/resources/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254-bvi.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -45,17 +45,17 @@ class TrafficStreams(TrafficStreamsBaseClass): self.p2_vlan_start = 200 # 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_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = '20.20.20.1' - self.p1_dst_end_ip = '20.20.20.254' + self.p1_dst_start_ip = u"20.20.20.1" + self.p1_dst_end_ip = u"20.20.20.254" - self.p2_src_start_ip = '20.20.20.1' - self.p2_src_end_ip = '20.20.20.254' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = '10.10.10.1' - self.p2_dst_end_ip = '10.10.10.254' + self.p2_dst_start_ip = u"10.10.10.1" + self.p2_dst_end_ip = u"10.10.10.254" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -67,42 +67,94 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether(dst='ba:dc:00:ff:ee:01') / - Dot1Q(vlan=self.p1_vlan_start) / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether( + dst=u"ba:dc:00:ff:ee:01" + ) / + Dot1Q( + vlan=self.p1_vlan_start + ) / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether(dst='ba:dc:00:ff:ee:01') / - Dot1Q(vlan=self.p2_vlan_start) / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether( + dst=u"ba:dc:00:ff:ee:01" + ) / + Dot1Q( + vlan=self.p2_vlan_start + ) / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ip_src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ip_src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254.py index bf5151905c..6ce351968c 100755 --- a/resources/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254.py +++ b/resources/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -43,17 +43,17 @@ class TrafficStreams(TrafficStreamsBaseClass): self.p2_vlan_start = 200 # 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_src_start_ip = u"10.10.10.1" + self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = '20.20.20.1' - self.p1_dst_end_ip = '20.20.20.254' + self.p1_dst_start_ip = u"20.20.20.1" + self.p1_dst_end_ip = u"20.20.20.254" - self.p2_src_start_ip = '20.20.20.1' - self.p2_src_end_ip = '20.20.20.254' + self.p2_src_start_ip = u"20.20.20.1" + self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = '10.10.10.1' - self.p2_dst_end_ip = '10.10.10.254' + self.p2_dst_start_ip = u"10.10.10.1" + self.p2_dst_end_ip = u"10.10.10.254" def define_packets(self): """Defines the packets to be sent from the traffic generator. @@ -65,42 +65,90 @@ class TrafficStreams(TrafficStreamsBaseClass): """ # Direction 0 --> 1 - base_pkt_a = (Ether() / - Dot1Q(vlan=self.p1_vlan_start) / - IP(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61)) + base_pkt_a = ( + Ether() / + Dot1Q( + vlan=self.p1_vlan_start + ) / + IP( + src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61 + ) + ) # Direction 1 --> 0 - base_pkt_b = (Ether() / - Dot1Q(vlan=self.p2_vlan_start) / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61)) + base_pkt_b = ( + Ether() / + Dot1Q( + vlan=self.p2_vlan_start + ) / + IP( + src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ip_src", + min_value=self.p1_src_start_ip, + max_value=self.p1_src_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src"), - STLVmFlowVar(name="ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op="random"), - STLVmWrFlowVar(fv_name="ip_dst", pkt_offset="IP.dst"), - STLVmFixIpv4(offset="IP")]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"ip_src", + min_value=self.p2_src_start_ip, + max_value=self.p2_src_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_src", + pkt_offset=u"IP.src" + ), + STLVmFlowVar( + name=u"ip_dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, + op=u"random" + ), + STLVmWrFlowVar( + fv_name=u"ip_dst", + pkt_offset=u"IP.dst" + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src10udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src10udpsrcrnd.py index 854e327966..e286a1e8d5 100755 --- a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src10udpsrcrnd.py +++ b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src10udpsrcrnd.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -46,17 +46,19 @@ from profile_trex_stateless_base_class import TrafficStreamsBaseClass # RFC 7348 - Virtual eXtensible Local Area Network (VXLAN): # A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks # http://tools.ietf.org/html/rfc7348 -_VXLAN_FLAGS = list('R'*24 + "RRRIRRRRR") +_VXLAN_FLAGS = list(u"R"*24 + u"RRRIRRRRR") class VXLAN(Packet): - name = 'VXLAN' - fields_desc = [FlagsField('flags', 0x08000000, 32, _VXLAN_FLAGS), - ThreeBytesField('vni', 0), - XByteField('reserved', 0x00)] + name=u"VXLAN" + fields_desc = [ + FlagsField(u"flags", 0x08000000, 32, _VXLAN_FLAGS), + ThreeBytesField(u"vni", 0), + XByteField(u"reserved", 0x00) + ] def mysummary(self): - return self.sprintf("VXLAN (vni=%VXLAN.vni%)") + return self.sprintf(u"VXLAN (vni=%VXLAN.vni%)") bind_layers(UDP, VXLAN, dport=4789) @@ -85,62 +87,187 @@ class TrafficStreams(TrafficStreamsBaseClass): # Direction 0 --> 1 base_pkt_a = ( Ether()/ - Dot1Q(vlan=100) / - IP(src='172.17.0.2', dst='172.16.0.1')/ - UDP(sport=1024, dport=4789)/ - VXLAN(vni=0)/ - Ether(src='00:aa:aa:00:00:00', dst='00:bb:bb:00:00:00')/ - IP(src='10.0.0.2', dst='10.0.0.1', proto=61)) + Dot1Q( + vlan=100 + ) / + IP( + src=u"172.17.0.2", + dst=u"172.16.0.1" + )/ + UDP( + sport=1024, + dport=4789 + )/ + VXLAN( + vni=0 + )/ + Ether( + src=u"00:aa:aa:00:00:00", + dst=u"00:bb:bb:00:00:00" + )/ + IP( + src=u"10.0.0.2", + dst=u"10.0.0.1", + proto=61 + ) + ) # Direction 1 --> 0 base_pkt_b = ( Ether()/ - Dot1Q(vlan=200) / - IP(src='172.27.0.2', dst='172.26.0.1')/ - UDP(sport=1024, dport=4789)/ - VXLAN(vni=0)/ - Ether(src='00:bb:bb:00:00:00', dst='00:aa:aa:00:00:00')/ - IP(src='10.0.0.1', dst='10.0.0.2', proto=61)) + Dot1Q( + vlan=200 + ) / + IP( + src=u"172.27.0.2", + dst=u"172.26.0.1" + )/ + UDP( + sport=1024, + dport=4789 + )/ + VXLAN( + vni=0 + )/ + Ether( + src=u"00:bb:bb:00:00:00", + dst=u"00:aa:aa:00:00:00" + )/ + IP( + src=u"10.0.0.1", + dst=u"10.0.0.2", + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmFlowVar(name='nf_id', size=1, op='inc', - min_value=0, max_value=self.nf_chains - 1), - STLVmFlowVar(name='in_mac', size=2, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='in_ip', size=1, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='src_port', size=2, op='random', - min_value=1024, max_value=65535), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=32), - STLVmWrFlowVar(fv_name='src_port', pkt_offset='UDP.sport'), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=52), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=58), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=64), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=82), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=86), - STLVmFixIpv4(offset = 'IP') - ]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"nf_id", + size=1, + op=u"inc", + min_value=0, + max_value=self.nf_chains - 1 + ), + STLVmFlowVar( + name=u"in_mac", + size=2, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"in_ip", + size=1, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"src_port", + size=2, + op=u"random", + min_value=1024, + max_value=65535 + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=32 + ), + STLVmWrFlowVar( + fv_name=u"src_port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=52 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=58 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=64 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=82 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=86 + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([ - STLVmFlowVar(name='nf_id', size=1, op='inc', - min_value=0, max_value=self.nf_chains - 1), - STLVmFlowVar(name='in_mac', size=2, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='in_ip', size=1, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='src_port', size=2, op='random', - min_value=1024, max_value=65535), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=32), - STLVmWrFlowVar(fv_name='src_port', pkt_offset='UDP.sport'), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=52), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=58), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=64), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=82), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=86), - STLVmFixIpv4(offset = 'IP') - ]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"nf_id", + size=1, + op=u"inc", + min_value=0, + max_value=self.nf_chains - 1 + ), + STLVmFlowVar( + name=u"in_mac", + size=2, op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"in_ip", + size=1, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"src_port", + size=2, + op=u"random", + min_value=1024, + max_value=65535 + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=32 + ), + STLVmWrFlowVar( + fv_name=u"src_port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=52 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=58 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=64 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=82 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=86 + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src1udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src1udpsrcrnd.py index 77247102b7..b65803bdfd 100755 --- a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src1udpsrcrnd.py +++ b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src1udpsrcrnd.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -44,19 +44,21 @@ 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 +# A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks. # http://tools.ietf.org/html/rfc7348 -_VXLAN_FLAGS = list('R'*24 + "RRRIRRRRR") +_VXLAN_FLAGS = list(u"R"*24 + u"RRRIRRRRR") class VXLAN(Packet): - name = 'VXLAN' - fields_desc = [FlagsField('flags', 0x08000000, 32, _VXLAN_FLAGS), - ThreeBytesField('vni', 0), - XByteField('reserved', 0x00)] + name=u"VXLAN" + fields_desc = [ + FlagsField(u"flags", 0x08000000, 32, _VXLAN_FLAGS), + ThreeBytesField(u"vni", 0), + XByteField(u"reserved", 0x00) + ] def mysummary(self): - return self.sprintf("VXLAN (vni=%VXLAN.vni%)") + return self.sprintf(u"VXLAN (vni=%VXLAN.vni%)") bind_layers(UDP, VXLAN, dport=4789) @@ -85,62 +87,188 @@ class TrafficStreams(TrafficStreamsBaseClass): # Direction 0 --> 1 base_pkt_a = ( Ether()/ - Dot1Q(vlan=100) / - IP(src='172.17.0.2', dst='172.16.0.1')/ - UDP(sport=1024, dport=4789)/ - VXLAN(vni=0)/ - Ether(src='00:aa:aa:00:00:00', dst='00:bb:bb:00:00:00')/ - IP(src='10.0.0.2', dst='10.0.0.1', proto=61)) + Dot1Q( + vlan=100 + ) / + IP( + src=u"172.17.0.2", + dst=u"172.16.0.1" + )/ + UDP( + sport=1024, + dport=4789 + )/ + VXLAN( + vni=0 + )/ + Ether( + src=u"00:aa:aa:00:00:00", + dst=u"00:bb:bb:00:00:00" + )/ + IP( + src=u"10.0.0.2", + dst=u"10.0.0.1", + proto=61 + ) + ) # Direction 1 --> 0 base_pkt_b = ( Ether()/ - Dot1Q(vlan=200) / - IP(src='172.27.0.2', dst='172.26.0.1')/ - UDP(sport=1024, dport=4789)/ - VXLAN(vni=0)/ - Ether(src='00:bb:bb:00:00:00', dst='00:aa:aa:00:00:00')/ - IP(src='10.0.0.1', dst='10.0.0.2', proto=61)) + Dot1Q( + vlan=200 + ) / + IP( + src=u"172.27.0.2", + dst=u"172.26.0.1" + )/ + UDP( + sport=1024, + dport=4789 + )/ + VXLAN( + vni=0 + )/ + Ether( + src=u"00:bb:bb:00:00:00", + dst=u"00:aa:aa:00:00:00" + )/ + IP( + src=u"10.0.0.1", + dst=u"10.0.0.2", + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmFlowVar(name='nf_id', size=1, op='inc', - min_value=0, max_value=self.nf_chains - 1), - STLVmFlowVar(name='in_mac', size=2, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='in_ip', size=1, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='src_port', size=2, op='random', - min_value=1024, max_value=65535), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=32), - STLVmWrFlowVar(fv_name='src_port', pkt_offset='UDP.sport'), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=52), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=58), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=64), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=82), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=86), - STLVmFixIpv4(offset = 'IP') - ]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"nf_id", + size=1, + op=u"inc", + min_value=0, + max_value=self.nf_chains - 1 + ), + STLVmFlowVar( + name=u"in_mac", + size=2, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"in_ip", + size=1, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"src_port", + size=2, + op=u"random", + min_value=1024, + max_value=65535 + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=32 + ), + STLVmWrFlowVar( + fv_name=u"src_port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=52 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=58 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=64 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=82 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=86 + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([ - STLVmFlowVar(name='nf_id', size=1, op='inc', - min_value=0, max_value=self.nf_chains - 1), - STLVmFlowVar(name='in_mac', size=2, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='in_ip', size=1, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='src_port', size=2, op='random', - min_value=1024, max_value=65535), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=32), - STLVmWrFlowVar(fv_name='src_port', pkt_offset='UDP.sport'), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=52), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=58), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=64), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=82), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=86), - STLVmFixIpv4(offset = 'IP') - ]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"nf_id", + size=1, + op=u"inc", + min_value=0, + max_value=self.nf_chains - 1 + ), + STLVmFlowVar( + name=u"in_mac", + size=2, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"in_ip", + size=1, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"src_port", + size=2, + op=u"random", + min_value=1024, + max_value=65535 + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=32 + ), + STLVmWrFlowVar( + fv_name=u"src_port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=52 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=58 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=64 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=82 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=86 + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src2udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src2udpsrcrnd.py index c82dd23b58..a622830675 100755 --- a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src2udpsrcrnd.py +++ b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src2udpsrcrnd.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -46,17 +46,19 @@ from profile_trex_stateless_base_class import TrafficStreamsBaseClass # RFC 7348 - Virtual eXtensible Local Area Network (VXLAN): # A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks # http://tools.ietf.org/html/rfc7348 -_VXLAN_FLAGS = list('R'*24 + "RRRIRRRRR") +_VXLAN_FLAGS = list(u"R"*24 + u"RRRIRRRRR") class VXLAN(Packet): - name = 'VXLAN' - fields_desc = [FlagsField('flags', 0x08000000, 32, _VXLAN_FLAGS), - ThreeBytesField('vni', 0), - XByteField('reserved', 0x00)] + name=u"VXLAN" + fields_desc = [ + FlagsField(u"flags", 0x08000000, 32, _VXLAN_FLAGS), + ThreeBytesField(u"vni", 0), + XByteField(u"reserved", 0x00) + ] def mysummary(self): - return self.sprintf("VXLAN (vni=%VXLAN.vni%)") + return self.sprintf(u"VXLAN (vni=%VXLAN.vni%)") bind_layers(UDP, VXLAN, dport=4789) @@ -85,62 +87,188 @@ class TrafficStreams(TrafficStreamsBaseClass): # Direction 0 --> 1 base_pkt_a = ( Ether()/ - Dot1Q(vlan=100) / - IP(src='172.17.0.2', dst='172.16.0.1')/ - UDP(sport=1024, dport=4789)/ - VXLAN(vni=0)/ - Ether(src='00:aa:aa:00:00:00', dst='00:bb:bb:00:00:00')/ - IP(src='10.0.0.2', dst='10.0.0.1', proto=61)) + Dot1Q( + vlan=100 + ) / + IP( + src=u"172.17.0.2", + dst=u"172.16.0.1" + )/ + UDP( + sport=1024, + dport=4789 + )/ + VXLAN( + vni=0 + )/ + Ether( + src=u"00:aa:aa:00:00:00", + dst=u"00:bb:bb:00:00:00" + )/ + IP( + src=u"10.0.0.2", + dst=u"10.0.0.1", + proto=61 + ) + ) # Direction 1 --> 0 base_pkt_b = ( Ether()/ - Dot1Q(vlan=200) / - IP(src='172.27.0.2', dst='172.26.0.1')/ - UDP(sport=1024, dport=4789)/ - VXLAN(vni=0)/ - Ether(src='00:bb:bb:00:00:00', dst='00:aa:aa:00:00:00')/ - IP(src='10.0.0.1', dst='10.0.0.2', proto=61)) + Dot1Q( + vlan=200 + ) / + IP( + src=u"172.27.0.2", + dst=u"172.26.0.1" + )/ + UDP( + sport=1024, + dport=4789 + )/ + VXLAN( + vni=0 + )/ + Ether( + src=u"00:bb:bb:00:00:00", + dst=u"00:aa:aa:00:00:00" + )/ + IP( + src=u"10.0.0.1", + dst=u"10.0.0.2", + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmFlowVar(name='nf_id', size=1, op='inc', - min_value=0, max_value=self.nf_chains - 1), - STLVmFlowVar(name='in_mac', size=2, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='in_ip', size=1, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='src_port', size=2, op='random', - min_value=1024, max_value=65535), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=32), - STLVmWrFlowVar(fv_name='src_port', pkt_offset='UDP.sport'), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=52), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=58), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=64), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=82), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=86), - STLVmFixIpv4(offset = 'IP') - ]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"nf_id", + size=1, + op=u"inc", + min_value=0, + max_value=self.nf_chains - 1 + ), + STLVmFlowVar( + name=u"in_mac", + size=2, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"in_ip", + size=1, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"src_port", + size=2, + op=u"random", + min_value=1024, + max_value=65535 + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=32 + ), + STLVmWrFlowVar( + fv_name=u"src_port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=52 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=58 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=64 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=82 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=86 + ), + STLVmFixIpv4( + offset = u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([ - STLVmFlowVar(name='nf_id', size=1, op='inc', - min_value=0, max_value=self.nf_chains - 1), - STLVmFlowVar(name='in_mac', size=2, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='in_ip', size=1, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='src_port', size=2, op='random', - min_value=1024, max_value=65535), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=32), - STLVmWrFlowVar(fv_name='src_port', pkt_offset='UDP.sport'), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=52), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=58), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=64), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=82), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=86), - STLVmFixIpv4(offset = 'IP') - ]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"nf_id", + size=1, + op=u"inc", + min_value=0, + max_value=self.nf_chains - 1 + ), + STLVmFlowVar( + name=u"in_mac", + size=2, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"in_ip", + size=1, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"src_port", + size=2, + op=u"random", + min_value=1024, + max_value=65535 + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=32 + ), + STLVmWrFlowVar( + fv_name=u"src_port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=52 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=58 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=64 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=82 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=86 + ), + STLVmFixIpv4( + offset = u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src4udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src4udpsrcrnd.py index 317d269c8d..91ab119cc8 100755 --- a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src4udpsrcrnd.py +++ b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src4udpsrcrnd.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -46,17 +46,19 @@ from profile_trex_stateless_base_class import TrafficStreamsBaseClass # RFC 7348 - Virtual eXtensible Local Area Network (VXLAN): # A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks # http://tools.ietf.org/html/rfc7348 -_VXLAN_FLAGS = list('R'*24 + "RRRIRRRRR") +_VXLAN_FLAGS = list(u"R"*24 + u"RRRIRRRRR") class VXLAN(Packet): - name = 'VXLAN' - fields_desc = [FlagsField('flags', 0x08000000, 32, _VXLAN_FLAGS), - ThreeBytesField('vni', 0), - XByteField('reserved', 0x00)] + name=u"VXLAN" + fields_desc = [ + FlagsField(u"flags", 0x08000000, 32, _VXLAN_FLAGS), + ThreeBytesField(u"vni", 0), + XByteField(u"reserved", 0x00) + ] def mysummary(self): - return self.sprintf("VXLAN (vni=%VXLAN.vni%)") + return self.sprintf(u"VXLAN (vni=%VXLAN.vni%)") bind_layers(UDP, VXLAN, dport=4789) @@ -85,62 +87,188 @@ class TrafficStreams(TrafficStreamsBaseClass): # Direction 0 --> 1 base_pkt_a = ( Ether()/ - Dot1Q(vlan=100) / - IP(src='172.17.0.2', dst='172.16.0.1')/ - UDP(sport=1024, dport=4789)/ - VXLAN(vni=0)/ - Ether(src='00:aa:aa:00:00:00', dst='00:bb:bb:00:00:00')/ - IP(src='10.0.0.2', dst='10.0.0.1', proto=61)) + Dot1Q( + vlan=100 + )/ + IP( + src=u"172.17.0.2", + dst=u"172.16.0.1" + )/ + UDP( + sport=1024, + dport=4789 + )/ + VXLAN( + vni=0 + )/ + Ether( + src=u"00:aa:aa:00:00:00", + dst=u"00:bb:bb:00:00:00" + )/ + IP( + src=u"10.0.0.2", + dst=u"10.0.0.1", + proto=61 + ) + ) # Direction 1 --> 0 base_pkt_b = ( Ether()/ - Dot1Q(vlan=200) / - IP(src='172.27.0.2', dst='172.26.0.1')/ - UDP(sport=1024, dport=4789)/ - VXLAN(vni=0)/ - Ether(src='00:bb:bb:00:00:00', dst='00:aa:aa:00:00:00')/ - IP(src='10.0.0.1', dst='10.0.0.2', proto=61)) + Dot1Q( + vlan=200 + ) / + IP( + src=u"172.27.0.2", + dst=u"172.26.0.1" + )/ + UDP( + sport=1024, + dport=4789 + )/ + VXLAN( + vni=0 + )/ + Ether( + src=u"00:bb:bb:00:00:00", + dst=u"00:aa:aa:00:00:00" + )/ + IP( + src=u"10.0.0.1", + dst=u"10.0.0.2", + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmFlowVar(name='nf_id', size=1, op='inc', - min_value=0, max_value=self.nf_chains - 1), - STLVmFlowVar(name='in_mac', size=2, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='in_ip', size=1, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='src_port', size=2, op='random', - min_value=1024, max_value=65535), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=32), - STLVmWrFlowVar(fv_name='src_port', pkt_offset='UDP.sport'), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=52), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=58), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=64), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=82), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=86), - STLVmFixIpv4(offset = 'IP') - ]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"nf_id", + size=1, + op=u"inc", + min_value=0, + max_value=self.nf_chains - 1 + ), + STLVmFlowVar( + name=u"in_mac", + size=2, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"in_ip", + size=1, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"src_port", + size=2, + op=u"random", + min_value=1024, + max_value=65535 + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=32 + ), + STLVmWrFlowVar( + fv_name=u"src_port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=52 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=58 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=64 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=82 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=86 + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([ - STLVmFlowVar(name='nf_id', size=1, op='inc', - min_value=0, max_value=self.nf_chains - 1), - STLVmFlowVar(name='in_mac', size=2, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='in_ip', size=1, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='src_port', size=2, op='random', - min_value=1024, max_value=65535), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=32), - STLVmWrFlowVar(fv_name='src_port', pkt_offset='UDP.sport'), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=52), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=58), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=64), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=82), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=86), - STLVmFixIpv4(offset = 'IP') - ]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"nf_id", + size=1, + op=u"inc", + min_value=0, + max_value=self.nf_chains - 1 + ), + STLVmFlowVar( + name=u"in_mac", + size=2, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"in_ip", + size=1, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"src_port", + size=2, + op=u"random", + min_value=1024, + max_value=65535 + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=32 + ), + STLVmWrFlowVar( + fv_name=u"src_port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=52 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=58 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=64 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=82 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=86 + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src6udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src6udpsrcrnd.py index d4dd81c5db..ccc8484808 100755 --- a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src6udpsrcrnd.py +++ b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src6udpsrcrnd.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -46,17 +46,19 @@ from profile_trex_stateless_base_class import TrafficStreamsBaseClass # RFC 7348 - Virtual eXtensible Local Area Network (VXLAN): # A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks # http://tools.ietf.org/html/rfc7348 -_VXLAN_FLAGS = list('R'*24 + "RRRIRRRRR") +_VXLAN_FLAGS = list(u"R"*24 + u"RRRIRRRRR") class VXLAN(Packet): - name = 'VXLAN' - fields_desc = [FlagsField('flags', 0x08000000, 32, _VXLAN_FLAGS), - ThreeBytesField('vni', 0), - XByteField('reserved', 0x00)] + name=u"VXLAN" + fields_desc = [ + FlagsField(u"flags", 0x08000000, 32, _VXLAN_FLAGS), + ThreeBytesField(u"vni", 0), + XByteField(u"reserved", 0x00) + ] def mysummary(self): - return self.sprintf("VXLAN (vni=%VXLAN.vni%)") + return self.sprintf(u"VXLAN (vni=%VXLAN.vni%)") bind_layers(UDP, VXLAN, dport=4789) @@ -85,62 +87,188 @@ class TrafficStreams(TrafficStreamsBaseClass): # Direction 0 --> 1 base_pkt_a = ( Ether()/ - Dot1Q(vlan=100) / - IP(src='172.17.0.2', dst='172.16.0.1')/ - UDP(sport=1024, dport=4789)/ - VXLAN(vni=0)/ - Ether(src='00:aa:aa:00:00:00', dst='00:bb:bb:00:00:00')/ - IP(src='10.0.0.2', dst='10.0.0.1', proto=61)) + Dot1Q( + vlan=100 + ) / + IP( + src=u"172.17.0.2", + dst=u"172.16.0.1" + )/ + UDP( + sport=1024, + dport=4789 + )/ + VXLAN( + vni=0 + )/ + Ether( + src=u"00:aa:aa:00:00:00", + dst=u"00:bb:bb:00:00:00" + )/ + IP( + src=u"10.0.0.2", + dst=u"10.0.0.1", + proto=61 + ) + ) # Direction 1 --> 0 base_pkt_b = ( Ether()/ - Dot1Q(vlan=200) / - IP(src='172.27.0.2', dst='172.26.0.1')/ - UDP(sport=1024, dport=4789)/ - VXLAN(vni=0)/ - Ether(src='00:bb:bb:00:00:00', dst='00:aa:aa:00:00:00')/ - IP(src='10.0.0.1', dst='10.0.0.2', proto=61)) + Dot1Q( + vlan=200 + ) / + IP( + src=u"172.27.0.2", + dst=u"172.26.0.1" + )/ + UDP( + sport=1024, + dport=4789 + )/ + VXLAN( + vni=0 + )/ + Ether( + src=u"00:bb:bb:00:00:00", + dst=u"00:aa:aa:00:00:00" + )/ + IP( + src=u"10.0.0.1", + dst=u"10.0.0.2", + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmFlowVar(name='nf_id', size=1, op='inc', - min_value=0, max_value=self.nf_chains - 1), - STLVmFlowVar(name='in_mac', size=2, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='in_ip', size=1, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='src_port', size=2, op='random', - min_value=1024, max_value=65535), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=32), - STLVmWrFlowVar(fv_name='src_port', pkt_offset='UDP.sport'), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=52), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=58), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=64), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=82), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=86), - STLVmFixIpv4(offset = 'IP') - ]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"nf_id", + size=1, + op=u"inc", + min_value=0, + max_value=self.nf_chains - 1 + ), + STLVmFlowVar( + name=u"in_mac", + size=2, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"in_ip", + size=1, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"src_port", + size=2, + op=u"random", + min_value=1024, + max_value=65535 + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=32 + ), + STLVmWrFlowVar( + fv_name=u"src_port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=52 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=58 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=64 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=82 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=86 + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([ - STLVmFlowVar(name='nf_id', size=1, op='inc', - min_value=0, max_value=self.nf_chains - 1), - STLVmFlowVar(name='in_mac', size=2, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='in_ip', size=1, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='src_port', size=2, op='random', - min_value=1024, max_value=65535), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=32), - STLVmWrFlowVar(fv_name='src_port', pkt_offset='UDP.sport'), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=52), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=58), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=64), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=82), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=86), - STLVmFixIpv4(offset = 'IP') - ]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"nf_id", + size=1, + op=u"inc", + min_value=0, + max_value=self.nf_chains - 1 + ), + STLVmFlowVar( + name=u"in_mac", + size=2, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"in_ip", + size=1, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"src_port", + size=2, + op=u"random", + min_value=1024, + max_value=65535 + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=32 + ), + STLVmWrFlowVar( + fv_name=u"src_port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=52 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=58 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=64 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=82 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=86 + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py index 29548a3e62..9209aed8b9 100755 --- a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py +++ b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -46,17 +46,19 @@ from profile_trex_stateless_base_class import TrafficStreamsBaseClass # RFC 7348 - Virtual eXtensible Local Area Network (VXLAN): # A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks # http://tools.ietf.org/html/rfc7348 -_VXLAN_FLAGS = list('R'*24 + "RRRIRRRRR") +_VXLAN_FLAGS = list(u"R"*24 + u"RRRIRRRRR") class VXLAN(Packet): - name = 'VXLAN' - fields_desc = [FlagsField('flags', 0x08000000, 32, _VXLAN_FLAGS), - ThreeBytesField('vni', 0), - XByteField('reserved', 0x00)] + name=u"VXLAN" + fields_desc = [ + FlagsField(u"flags", 0x08000000, 32, _VXLAN_FLAGS), + ThreeBytesField(u"vni", 0), + XByteField(u"reserved", 0x00) + ] def mysummary(self): - return self.sprintf("VXLAN (vni=%VXLAN.vni%)") + return self.sprintf(u"VXLAN (vni=%VXLAN.vni%)") bind_layers(UDP, VXLAN, dport=4789) @@ -85,62 +87,188 @@ class TrafficStreams(TrafficStreamsBaseClass): # Direction 0 --> 1 base_pkt_a = ( Ether()/ - Dot1Q(vlan=100) / - IP(src='172.17.0.2', dst='172.16.0.1')/ - UDP(sport=1024, dport=4789)/ - VXLAN(vni=0)/ - Ether(src='00:aa:aa:00:00:00', dst='00:bb:bb:00:00:00')/ - IP(src='10.0.0.2', dst='10.0.0.1', proto=61)) + Dot1Q( + vlan=100 + ) / + IP( + src=u"172.17.0.2", + dst=u"172.16.0.1" + )/ + UDP( + sport=1024, + dport=4789 + )/ + VXLAN( + vni=0 + )/ + Ether( + src=u"00:aa:aa:00:00:00", + dst=u"00:bb:bb:00:00:00" + )/ + IP( + src=u"10.0.0.2", + dst=u"10.0.0.1", + proto=61 + ) + ) # Direction 1 --> 0 base_pkt_b = ( Ether()/ - Dot1Q(vlan=200) / - IP(src='172.27.0.2', dst='172.26.0.1')/ - UDP(sport=1024, dport=4789)/ - VXLAN(vni=0)/ - Ether(src='00:bb:bb:00:00:00', dst='00:aa:aa:00:00:00')/ - IP(src='10.0.0.1', dst='10.0.0.2', proto=61)) + Dot1Q( + vlan=200 + ) / + IP( + src=u"172.27.0.2", + dst=u"172.26.0.1" + )/ + UDP( + sport=1024, + dport=4789 + )/ + VXLAN( + vni=0 + )/ + Ether( + src=u"00:bb:bb:00:00:00", + dst=u"00:aa:aa:00:00:00" + )/ + IP( + src=u"10.0.0.1", + dst=u"10.0.0.2", + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmFlowVar(name='nf_id', size=1, op='inc', - min_value=0, max_value=self.nf_chains - 1), - STLVmFlowVar(name='in_mac', size=2, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='in_ip', size=1, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='src_port', size=2, op='random', - min_value=1024, max_value=65535), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=32), - STLVmWrFlowVar(fv_name='src_port', pkt_offset='UDP.sport'), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=52), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=58), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=64), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=82), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=86), - STLVmFixIpv4(offset = 'IP') - ]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"nf_id", + size=1, + op=u"inc", + min_value=0, + max_value=self.nf_chains - 1 + ), + STLVmFlowVar( + name=u"in_mac", + size=2, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"in_ip", + size=1, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"src_port", + size=2, + op=u"random", + min_value=1024, + max_value=65535 + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=32 + ), + STLVmWrFlowVar( + fv_name=u"src_port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=52 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=58 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=64 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=82 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=86 + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([ - STLVmFlowVar(name='nf_id', size=1, op='inc', - min_value=0, max_value=self.nf_chains - 1), - STLVmFlowVar(name='in_mac', size=2, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='in_ip', size=1, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='src_port', size=2, op='random', - min_value=1024, max_value=65535), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=32), - STLVmWrFlowVar(fv_name='src_port', pkt_offset='UDP.sport'), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=52), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=58), - STLVmWrFlowVar(fv_name='in_mac', pkt_offset=64), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=82), - STLVmWrFlowVar(fv_name='in_ip', pkt_offset=86), - STLVmFixIpv4(offset = 'IP') - ]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"nf_id", + size=1, + op=u"inc", + min_value=0, + max_value=self.nf_chains - 1 + ), + STLVmFlowVar( + name=u"in_mac", + size=2, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"in_ip", + size=1, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"src_port", + size=2, + op=u"random", + min_value=1024, + max_value=65535 + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=32 + ), + STLVmWrFlowVar( + fv_name=u"src_port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=52 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=58 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=64 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=82 + ), + STLVmWrFlowVar( + fv_name=u"in_ip", + pkt_offset=86 + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 diff --git a/resources/traffic_profiles/trex/trex-sl-ethip4vxlan-ip4src1udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-ethip4vxlan-ip4src1udpsrcrnd.py index caf56651fb..cf97364da6 100755 --- a/resources/traffic_profiles/trex/trex-sl-ethip4vxlan-ip4src1udpsrcrnd.py +++ b/resources/traffic_profiles/trex/trex-sl-ethip4vxlan-ip4src1udpsrcrnd.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -44,17 +44,19 @@ from profile_trex_stateless_base_class import TrafficStreamsBaseClass # RFC 7348 - Virtual eXtensible Local Area Network (VXLAN): # A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks # http://tools.ietf.org/html/rfc7348 -_VXLAN_FLAGS = list('R'*24 + "RRRIRRRRR") +_VXLAN_FLAGS = list(u"R"*24 + u"RRRIRRRRR") class VXLAN(Packet): - name = 'VXLAN' - fields_desc = [FlagsField('flags', 0x08000000, 32, _VXLAN_FLAGS), - ThreeBytesField('vni', 0), - XByteField('reserved', 0x00)] + name=u"VXLAN" + fields_desc = [ + FlagsField(u"flags", 0x08000000, 32, _VXLAN_FLAGS), + ThreeBytesField(u"vni", 0), + XByteField(u"reserved", 0x00) + ] def mysummary(self): - return self.sprintf("VXLAN (vni=%VXLAN.vni%)") + return self.sprintf(u"VXLAN (vni=%VXLAN.vni%)") bind_layers(UDP, VXLAN, dport=4789) @@ -83,56 +85,163 @@ class TrafficStreams(TrafficStreamsBaseClass): # 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)) + IP( + src=u"172.17.0.2", + dst=u"172.16.0.1" + )/ + UDP( + sport=1024, + dport=4789)/ + VXLAN( + vni=0 + )/ + Ether( + src=u"00:aa:aa:00:00:00", + dst=u"00:bb:bb:00:00:00" + )/ + IP( + src=u"10.0.0.2", + dst=u"10.0.0.1", + proto=61 + ) + ) # Direction 1 --> 0 base_pkt_b = ( Ether()/ - 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)) + IP( + src=u"172.27.0.2", + dst=u"172.26.0.1" + )/ + UDP( + sport=1024, + dport=4789 + )/ + VXLAN( + vni=0 + )/ + Ether( + src=u"00:bb:bb:00:00:00", + dst=u"00:aa:aa:00:00:00" + )/ + IP( + src=u"10.0.0.1", + dst=u"10.0.0.2", + proto=61 + ) + ) # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmFlowVar(name='nf_id', size=1, op='inc', - min_value=0, max_value=self.nf_chains - 1), - STLVmFlowVar(name='in_mac', size=2, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='in_ip', size=1, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='src_port', size=2, op='random', - min_value=1024, max_value=65535), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=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') - ]) + vm1 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"nf_id", + size=1, + op=u"inc", + min_value=0, + max_value=self.nf_chains - 1 + ), + STLVmFlowVar( + name=u"in_mac", + size=2, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"in_ip", + size=1, + op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"src_port", + size=2, + op=u"random", + min_value=1024, + max_value=65535 + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=28 + ), + STLVmWrFlowVar( + fv_name=u"src_port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=48 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=54 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=60 + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) # Direction 1 --> 0 - vm2 = STLScVmRaw([ - STLVmFlowVar(name='nf_id', size=1, op='inc', - min_value=0, max_value=self.nf_chains - 1), - STLVmFlowVar(name='in_mac', size=2, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='in_ip', size=1, op='inc', - min_value=0, max_value=255), - STLVmFlowVar(name='src_port', size=2, op='random', - min_value=1024, max_value=65535), - STLVmWrFlowVar(fv_name='nf_id', pkt_offset=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') - ]) + vm2 = STLScVmRaw( + [ + STLVmFlowVar( + name=u"nf_id", + size=1, + op=u"inc", + min_value=0, + max_value=self.nf_chains - 1 + ), + STLVmFlowVar( + name=u"in_mac", + size=2, op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"in_ip", + size=1, op=u"inc", + min_value=0, + max_value=255 + ), + STLVmFlowVar( + name=u"src_port", + size=2, + op=u"random", + min_value=1024, + max_value=65535 + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=28 + ), + STLVmWrFlowVar( + fv_name=u"src_port", + pkt_offset=u"UDP.sport" + ), + STLVmWrFlowVar( + fv_name=u"nf_id", + pkt_offset=48 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=54 + ), + STLVmWrFlowVar( + fv_name=u"in_mac", + pkt_offset=60 + ), + STLVmFixIpv4( + offset=u"IP" + ) + ] + ) return base_pkt_a, base_pkt_b, vm1, vm2 |