* [dts] [PATCH V1]framework: compatible with different versions of scapy
@ 2020-04-16 9:26 hanyingya
2020-04-20 5:11 ` Tu, Lijuan
0 siblings, 1 reply; 2+ messages in thread
From: hanyingya @ 2020-04-16 9:26 UTC (permalink / raw)
To: dts; +Cc: hanyingya
some scapy version may have "L" suffix, and the other may not have.
Signed-off-by: hanyingya <yingyax.han@intel.com>
---
framework/pktgen.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/framework/pktgen.py b/framework/pktgen.py
index 889e94a..d00cf3b 100644
--- a/framework/pktgen.py
+++ b/framework/pktgen.py
@@ -167,7 +167,10 @@ class PacketGeneratorHelper(object):
action = config.get('action') or 'default'
range = config.get('range') or 64
# ignore 'L' suffix
- start_vlan = int(pcap_fields.get(layer_name)[:-1])
+ if 'L' in pcap_fields.get(layer_name):
+ start_vlan = int(pcap_fields.get(layer_name)[:-1])
+ else:
+ start_vlan = int(pcap_fields.get(layer_name))
end_vlan = start_vlan + range - 1
fields_config[layer_name][name] = {}
fields_config[layer_name][name]['start'] = start_vlan
@@ -212,4 +215,4 @@ def getPacketGenerator(tester, pktgen_type=PKTGEN_IXIA):
return CLS(tester)
else:
msg = "not support <{0}> packet generator".format(pktgen_type)
- raise Exception(msg)
\ No newline at end of file
+ raise Exception(msg)
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dts] [PATCH V1]framework: compatible with different versions of scapy
2020-04-16 9:26 [dts] [PATCH V1]framework: compatible with different versions of scapy hanyingya
@ 2020-04-20 5:11 ` Tu, Lijuan
0 siblings, 0 replies; 2+ messages in thread
From: Tu, Lijuan @ 2020-04-20 5:11 UTC (permalink / raw)
To: Han, YingyaX, dts; +Cc: Han, YingyaX
Applied, thanks
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of hanyingya
> Sent: Thursday, April 16, 2020 5:26 PM
> To: dts@dpdk.org
> Cc: Han, YingyaX <yingyax.han@intel.com>
> Subject: [dts] [PATCH V1]framework: compatible with different versions of
> scapy
>
> some scapy version may have "L" suffix, and the other may not have.
>
> Signed-off-by: hanyingya <yingyax.han@intel.com>
> ---
> framework/pktgen.py | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/framework/pktgen.py b/framework/pktgen.py index
> 889e94a..d00cf3b 100644
> --- a/framework/pktgen.py
> +++ b/framework/pktgen.py
> @@ -167,7 +167,10 @@ class PacketGeneratorHelper(object):
> action = config.get('action') or 'default'
> range = config.get('range') or 64
> # ignore 'L' suffix
> - start_vlan = int(pcap_fields.get(layer_name)[:-1])
> + if 'L' in pcap_fields.get(layer_name):
> + start_vlan = int(pcap_fields.get(layer_name)[:-1])
> + else:
> + start_vlan = int(pcap_fields.get(layer_name))
> end_vlan = start_vlan + range - 1
> fields_config[layer_name][name] = {}
> fields_config[layer_name][name]['start'] = start_vlan @@ -212,4
> +215,4 @@ def getPacketGenerator(tester, pktgen_type=PKTGEN_IXIA):
> return CLS(tester)
> else:
> msg = "not support <{0}> packet generator".format(pktgen_type)
> - raise Exception(msg)
> \ No newline at end of file
> + raise Exception(msg)
> --
> 2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-20 5:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16 9:26 [dts] [PATCH V1]framework: compatible with different versions of scapy hanyingya
2020-04-20 5:11 ` Tu, Lijuan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).