* [dts] [PATCH V1 1/3][nsh] framwork/packet: add support of mpls and nsh
@ 2019-10-11 0:25 lihong
2019-10-11 0:25 ` [dts] [PATCH V1 2/3][nsh] dep: " lihong
2019-10-11 0:25 ` [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep lihong
0 siblings, 2 replies; 8+ messages in thread
From: lihong @ 2019-10-11 0:25 UTC (permalink / raw)
To: dts; +Cc: lihong
Signed-off-by: lihong <lihongx.ma@intel.com>
---
framework/packet.py | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/framework/packet.py b/framework/packet.py
index 502d85c..84ab0f8 100755
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -69,6 +69,8 @@ from vxlan import VXLAN
from nvgre import NVGRE, IPPROTO_NVGRE
from lldp import LLDP, LLDPManagementAddress
from Dot1BR import Dot1BR
+from nsh import NSH
+from mpls import MPLS
# get tester logger
from logger import getLogger
@@ -81,7 +83,7 @@ from utils import get_backtrace_object
PACKETGEN = "scapy"
LayersTypes = {
- "L2": ['ether', 'vlan', 'etag', '1588', 'arp', 'lldp'],
+ "L2": ['ether', 'vlan', 'etag', '1588', 'arp', 'lldp', 'mpls', 'nsh'],
# ipv4_ext_unknown, ipv6_ext_unknown
"L3": ['ipv4', 'ipv4ihl', 'ipv6', 'ipv4_ext', 'ipv6_ext', 'ipv6_ext2', 'ipv6_frag'],
"L4": ['tcp', 'udp', 'frag', 'sctp', 'icmp', 'nofrag'],
@@ -124,6 +126,8 @@ class scapy(object):
'gre': GRE(),
'raw': Raw(),
'vxlan': VXLAN(),
+ 'nsh': NSH(),
+ 'mpls': MPLS(),
'inner_mac': Ether(),
'inner_vlan': Dot1Q(),
@@ -328,6 +332,30 @@ class scapy(object):
def vxlan(self, pkt_layer, vni=0):
pkt_layer.vni = vni
+ def nsh(self, pkt_layer, ver=0, oam=0, critical=0, reserved=0, len=0, mdtype=1, nextproto=3,
+ nsp=0x0, nsi=1, npc= 0x0, nsc= 0x0, spc= 0x0, ssc= 0x0):
+ pkt_layer.Ver = ver
+ pkt_layer.OAM = oam
+ pkt_layer.Critical = critical
+ pkt_layer.Reserved = reserved
+ if len != 0:
+ pkt_layer.Len = len
+ pkt_layer.MDType = mdtype
+ pkt_layer.NextProto = nextproto
+ pkt_layer.NSP = nsp
+ pkt_layer.NSI = nsi
+ if mdtype == 1:
+ pkt_layer.NPC = npc
+ pkt_layer.NSC = nsc
+ pkt_layer.SPC = spc
+ pkt_layer.SSC = ssc
+
+ def mpls(self, pkt_layer, label=0, cos=0, s=0, ttl=64):
+ pkt_layer.label = label
+ pkt_layer.cos = cos
+ pkt_layer.s = s
+ pkt_layer.ttl = ttl
+
def read_pcap(self, file):
pcap_pkts = []
try:
@@ -555,6 +583,8 @@ class Packet(object):
'GRE': 'gre',
'VXLAN': 'vxlan',
'PKT': 'raw',
+ 'MPLS': 'mpls',
+ 'NSH': 'nsh',
}
layers = self.pkt_type.split('_')
@@ -674,6 +704,12 @@ class Packet(object):
def _config_layer_vxlan(self, pkt_layer, config):
return self.pktgen.vxlan(pkt_layer, **config)
+ def _config_layer_mpls(self, pkt_layer, config):
+ return self.pktgen.mpls(pkt_layer, **config)
+
+ def _config_layer_nsh(self, pkt_layer, config):
+ return self.pktgen.nsh(pkt_layer, **config)
+
def strip_layer_element(self, layer, element):
"""
Strip packet layer elements
--
2.7.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dts] [PATCH V1 2/3][nsh] dep: add support of mpls and nsh
2019-10-11 0:25 [dts] [PATCH V1 1/3][nsh] framwork/packet: add support of mpls and nsh lihong
@ 2019-10-11 0:25 ` lihong
2019-10-11 0:25 ` [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep lihong
1 sibling, 0 replies; 8+ messages in thread
From: lihong @ 2019-10-11 0:25 UTC (permalink / raw)
To: dts; +Cc: lihong
Signed-off-by: lihong <lihongx.ma@intel.com>
---
dep/mpls.py | 24 ++++++++++++++++++++++
dep/nsh.py | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 91 insertions(+)
create mode 100644 dep/mpls.py
create mode 100644 dep/nsh.py
diff --git a/dep/mpls.py b/dep/mpls.py
new file mode 100644
index 0000000..0b37bba
--- /dev/null
+++ b/dep/mpls.py
@@ -0,0 +1,24 @@
+from scapy.packet import Packet, bind_layers, Padding
+from scapy.fields import BitField,ByteField
+from scapy.layers.inet import IP
+from scapy.layers.inet6 import IPv6
+from scapy.layers.l2 import Ether, GRE
+
+class MPLS(Packet):
+ name = "MPLS"
+ fields_desc = [ BitField("label", 3, 20),
+ BitField("cos", 0, 3),
+ BitField("s", 1, 1),
+ ByteField("ttl", 0) ]
+
+ def guess_payload_class(self, payload):
+ if len(payload) >= 1:
+ ip_version = (ord(payload[0]) >> 4) & 0xF
+ if ip_version == 4:
+ return IP
+ elif ip_version == 6:
+ return IPv6
+ return Padding
+
+bind_layers(Ether, MPLS, type=0x8847)
+bind_layers(GRE, MPLS, proto=0x8847)
diff --git a/dep/nsh.py b/dep/nsh.py
new file mode 100644
index 0000000..2e249c9
--- /dev/null
+++ b/dep/nsh.py
@@ -0,0 +1,67 @@
+from scapy.packet import *
+from scapy.fields import *
+from scapy.layers.inet import Ether, IP
+from scapy.layers.inet6 import IPv6
+from vxlan import VXLAN
+from mpls import MPLS
+
+
+class Metadata(Packet):
+ name = 'NSH metadata'
+ fields_desc = [XIntField('value', 0)]
+
+
+class NSHTLV(Packet):
+ "NSH MD-type 2 - Variable Length Context Headers"
+ name = "NSHTLV"
+ fields_desc = [
+ ShortField('Class', 0),
+ BitField('Critical', 0, 1),
+ BitField('Type', 0, 7),
+ BitField('Reserved', 0, 3),
+ BitField('Len', 0, 5),
+ PacketListField('Metadata', None, XIntField, count_from='Len')
+ ]
+
+
+class NSH(Packet):
+ """Network Service Header.
+ NSH MD-type 1 if there is no ContextHeaders"""
+ name = "NSH"
+
+ fields_desc = [
+ BitField('Ver', 0, 2),
+ BitField('OAM', 0, 1),
+ BitField('Critical', 0, 1),
+ BitField('Reserved', 0, 6),
+ BitField('Len', 0, 6),
+ ByteEnumField('MDType', 1, {1: 'Fixed Length',
+ 2: 'Variable Length'}),
+ ByteEnumField('NextProto', 3, {1: 'IPv4',
+ 2: 'IPv6',
+ 3: 'Ethernet',
+ 4: 'NSH',
+ 5: 'MPLS'}),
+ X3BytesField('NSP', 0),
+ ByteField('NSI', 1),
+ ConditionalField(XIntField('NPC', 0), lambda pkt: pkt.MDType == 1),
+ ConditionalField(XIntField('NSC', 0), lambda pkt: pkt.MDType == 1),
+ ConditionalField(XIntField('SPC', 0), lambda pkt: pkt.MDType == 1),
+ ConditionalField(XIntField('SSC', 0), lambda pkt: pkt.MDType == 1),
+ ConditionalField(PacketListField("ContextHeaders", None,
+ NSHTLV, count_from="Length"),
+ lambda pkt: pkt.MDType == 2)
+ ]
+
+ def mysummary(self):
+ return self.sprintf("NSP: %NSP% - NSI: %NSI%")
+
+
+bind_layers(Ether, NSH, {'type': 0x894F}, type=0x894F)
+bind_layers(VXLAN, NSH, {'flags': 0xC, 'NextProtocol': 4}, NextProtocol=4)
+
+bind_layers(NSH, IP, {'NextProto': 1}, NextProto=1)
+bind_layers(NSH, IPv6, {'NextProto': 2}, NextProto=2)
+bind_layers(NSH, Ether, {'NextProto': 3}, NextProto=3)
+bind_layers(NSH, NSH, {'NextProto': 4}, NextProto=4)
+bind_layers(NSH, MPLS, {'NextProto': 5}, NextProto=5)
--
2.7.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep
2019-10-11 0:25 [dts] [PATCH V1 1/3][nsh] framwork/packet: add support of mpls and nsh lihong
2019-10-11 0:25 ` [dts] [PATCH V1 2/3][nsh] dep: " lihong
@ 2019-10-11 0:25 ` lihong
2019-10-12 1:26 ` Mo, YufengX
2019-10-12 6:10 ` Tu, Lijuan
1 sibling, 2 replies; 8+ messages in thread
From: lihong @ 2019-10-11 0:25 UTC (permalink / raw)
To: dts; +Cc: lihong
Signed-off-by: lihong <lihongx.ma@intel.com>
---
tests/TestSuite_uni_pkt.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tests/TestSuite_uni_pkt.py b/tests/TestSuite_uni_pkt.py
index 9a75061..cdc5849 100644
--- a/tests/TestSuite_uni_pkt.py
+++ b/tests/TestSuite_uni_pkt.py
@@ -47,6 +47,7 @@ import utils
from test_case import TestCase
from exception import VerifyFailure
from packet import Packet
+import os
import time
@@ -442,10 +443,12 @@ class TestUniPacket(TestCase):
"ether+nsh+ipv6+udp": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_UDP", \
"ether+nsh+ipv6+sctp": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_SCTP"
}
-
+ cwd = os.getcwd()
+ dir_module = cwd + r"/" + "dep"
for packet in nsh_packets:
self.tester.scapy_foreground()
- self.tester.scapy_append("from scapy.contrib.nsh import *")
+ self.tester.scapy_append("sys.path.append('%s')" % dir_module)
+ self.tester.scapy_append("from nsh import NSH")
self.tester.scapy_append("sendp([%s],iface='%s')" % (nsh_packets[packet], self.tester_iface))
self.tester.scapy_execute()
out = self.dut.get_session_output(timeout=2)
--
2.7.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep
2019-10-11 0:25 ` [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep lihong
@ 2019-10-12 1:26 ` Mo, YufengX
2019-10-12 2:02 ` Mo, YufengX
2019-10-14 5:04 ` Ma, LihongX
2019-10-12 6:10 ` Tu, Lijuan
1 sibling, 2 replies; 8+ messages in thread
From: Mo, YufengX @ 2019-10-12 1:26 UTC (permalink / raw)
To: Ma, LihongX, dts; +Cc: Ma, LihongX
Hi,ma lihong
> + cwd = os.getcwd()
> + dir_module = cwd + r"/" + "dep"
It will be '/xxx/dts/tests/dep'. Are you sure?
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of lihong
> Sent: Friday, October 11, 2019 8:25 AM
> To: dts@dpdk.org
> Cc: Ma, LihongX <lihongx.ma@intel.com>
> Subject: [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep
>
> Signed-off-by: lihong <lihongx.ma@intel.com>
> ---
> tests/TestSuite_uni_pkt.py | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tests/TestSuite_uni_pkt.py b/tests/TestSuite_uni_pkt.py
> index 9a75061..cdc5849 100644
> --- a/tests/TestSuite_uni_pkt.py
> +++ b/tests/TestSuite_uni_pkt.py
> @@ -47,6 +47,7 @@ import utils
> from test_case import TestCase
> from exception import VerifyFailure
> from packet import Packet
> +import os
> import time
>
>
> @@ -442,10 +443,12 @@ class TestUniPacket(TestCase):
> "ether+nsh+ipv6+udp": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_UDP", \
> "ether+nsh+ipv6+sctp": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_SCTP"
> }
> -
> + cwd = os.getcwd()
> + dir_module = cwd + r"/" + "dep"
> for packet in nsh_packets:
> self.tester.scapy_foreground()
> - self.tester.scapy_append("from scapy.contrib.nsh import *")
> + self.tester.scapy_append("sys.path.append('%s')" % dir_module)
> + self.tester.scapy_append("from nsh import NSH")
> self.tester.scapy_append("sendp([%s],iface='%s')" % (nsh_packets[packet], self.tester_iface))
> self.tester.scapy_execute()
> out = self.dut.get_session_output(timeout=2)
> --
> 2.7.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep
2019-10-12 1:26 ` Mo, YufengX
@ 2019-10-12 2:02 ` Mo, YufengX
2019-10-14 5:15 ` Ma, LihongX
2019-10-14 5:04 ` Ma, LihongX
1 sibling, 1 reply; 8+ messages in thread
From: Mo, YufengX @ 2019-10-12 2:02 UTC (permalink / raw)
To: Mo, YufengX, Ma, LihongX, dts; +Cc: Ma, LihongX
Hi, ma, lihong
You can use 'from packet import DEP_FOLDER'.
When os.chdir is ran by other script, os.getcwd will be uncertain.
BRs
Yufen, Mo
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Mo, YufengX
> Sent: Saturday, October 12, 2019 9:26 AM
> To: Ma, LihongX <lihongx.ma@intel.com>; dts@dpdk.org
> Cc: Ma, LihongX <lihongx.ma@intel.com>
> Subject: Re: [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep
>
> Hi,ma lihong
>
> > + cwd = os.getcwd()
> > + dir_module = cwd + r"/" + "dep"
>
> It will be '/xxx/dts/tests/dep'. Are you sure?
>
>
> > -----Original Message-----
> > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of lihong
> > Sent: Friday, October 11, 2019 8:25 AM
> > To: dts@dpdk.org
> > Cc: Ma, LihongX <lihongx.ma@intel.com>
> > Subject: [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep
> >
> > Signed-off-by: lihong <lihongx.ma@intel.com>
> > ---
> > tests/TestSuite_uni_pkt.py | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/tests/TestSuite_uni_pkt.py b/tests/TestSuite_uni_pkt.py
> > index 9a75061..cdc5849 100644
> > --- a/tests/TestSuite_uni_pkt.py
> > +++ b/tests/TestSuite_uni_pkt.py
> > @@ -47,6 +47,7 @@ import utils
> > from test_case import TestCase
> > from exception import VerifyFailure
> > from packet import Packet
> > +import os
> > import time
> >
> >
> > @@ -442,10 +443,12 @@ class TestUniPacket(TestCase):
> > "ether+nsh+ipv6+udp": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_UDP", \
> > "ether+nsh+ipv6+sctp": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_SCTP"
> > }
> > -
> > + cwd = os.getcwd()
> > + dir_module = cwd + r"/" + "dep"
> > for packet in nsh_packets:
> > self.tester.scapy_foreground()
> > - self.tester.scapy_append("from scapy.contrib.nsh import *")
> > + self.tester.scapy_append("sys.path.append('%s')" % dir_module)
> > + self.tester.scapy_append("from nsh import NSH")
> > self.tester.scapy_append("sendp([%s],iface='%s')" % (nsh_packets[packet], self.tester_iface))
> > self.tester.scapy_execute()
> > out = self.dut.get_session_output(timeout=2)
> > --
> > 2.7.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep
2019-10-11 0:25 ` [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep lihong
2019-10-12 1:26 ` Mo, YufengX
@ 2019-10-12 6:10 ` Tu, Lijuan
1 sibling, 0 replies; 8+ messages in thread
From: Tu, Lijuan @ 2019-10-12 6:10 UTC (permalink / raw)
To: Ma, LihongX, dts; +Cc: Ma, LihongX
Please rework your patch series, the framework changed.
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of lihong
> Sent: Friday, October 11, 2019 8:25 AM
> To: dts@dpdk.org
> Cc: Ma, LihongX <lihongx.ma@intel.com>
> Subject: [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current
> dep
>
> Signed-off-by: lihong <lihongx.ma@intel.com>
> ---
> tests/TestSuite_uni_pkt.py | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tests/TestSuite_uni_pkt.py b/tests/TestSuite_uni_pkt.py index
> 9a75061..cdc5849 100644
> --- a/tests/TestSuite_uni_pkt.py
> +++ b/tests/TestSuite_uni_pkt.py
> @@ -47,6 +47,7 @@ import utils
> from test_case import TestCase
> from exception import VerifyFailure
> from packet import Packet
> +import os
> import time
>
>
> @@ -442,10 +443,12 @@ class TestUniPacket(TestCase):
> "ether+nsh+ipv6+udp": "L2_ETHER_NSH
> L3_IPV6_EXT_UNKNOWN L4_UDP", \
> "ether+nsh+ipv6+sctp": "L2_ETHER_NSH
> L3_IPV6_EXT_UNKNOWN L4_SCTP"
> }
> -
> + cwd = os.getcwd()
> + dir_module = cwd + r"/" + "dep"
> for packet in nsh_packets:
> self.tester.scapy_foreground()
> - self.tester.scapy_append("from scapy.contrib.nsh import *")
> + self.tester.scapy_append("sys.path.append('%s')" % dir_module)
> + self.tester.scapy_append("from nsh import NSH")
> self.tester.scapy_append("sendp([%s],iface='%s')" %
> (nsh_packets[packet], self.tester_iface))
> self.tester.scapy_execute()
> out = self.dut.get_session_output(timeout=2)
> --
> 2.7.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep
2019-10-12 1:26 ` Mo, YufengX
2019-10-12 2:02 ` Mo, YufengX
@ 2019-10-14 5:04 ` Ma, LihongX
1 sibling, 0 replies; 8+ messages in thread
From: Ma, LihongX @ 2019-10-14 5:04 UTC (permalink / raw)
To: Mo, YufengX, dts
Hi, yufeng
The path of os.getcwd() is dts, not the dts/tests, so the path is dts/dep
-----Original Message-----
From: Mo, YufengX
Sent: Saturday, October 12, 2019 9:26 AM
To: Ma, LihongX <lihongx.ma@intel.com>; dts@dpdk.org
Cc: Ma, LihongX <lihongx.ma@intel.com>
Subject: RE: [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep
Hi,ma lihong
> + cwd = os.getcwd()
> + dir_module = cwd + r"/" + "dep"
It will be '/xxx/dts/tests/dep'. Are you sure?
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of lihong
> Sent: Friday, October 11, 2019 8:25 AM
> To: dts@dpdk.org
> Cc: Ma, LihongX <lihongx.ma@intel.com>
> Subject: [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from
> current dep
>
> Signed-off-by: lihong <lihongx.ma@intel.com>
> ---
> tests/TestSuite_uni_pkt.py | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tests/TestSuite_uni_pkt.py b/tests/TestSuite_uni_pkt.py
> index 9a75061..cdc5849 100644
> --- a/tests/TestSuite_uni_pkt.py
> +++ b/tests/TestSuite_uni_pkt.py
> @@ -47,6 +47,7 @@ import utils
> from test_case import TestCase
> from exception import VerifyFailure
> from packet import Packet
> +import os
> import time
>
>
> @@ -442,10 +443,12 @@ class TestUniPacket(TestCase):
> "ether+nsh+ipv6+udp": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_UDP", \
> "ether+nsh+ipv6+sctp": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_SCTP"
> }
> -
> + cwd = os.getcwd()
> + dir_module = cwd + r"/" + "dep"
> for packet in nsh_packets:
> self.tester.scapy_foreground()
> - self.tester.scapy_append("from scapy.contrib.nsh import *")
> + self.tester.scapy_append("sys.path.append('%s')" % dir_module)
> + self.tester.scapy_append("from nsh import NSH")
> self.tester.scapy_append("sendp([%s],iface='%s')" % (nsh_packets[packet], self.tester_iface))
> self.tester.scapy_execute()
> out = self.dut.get_session_output(timeout=2)
> --
> 2.7.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep
2019-10-12 2:02 ` Mo, YufengX
@ 2019-10-14 5:15 ` Ma, LihongX
0 siblings, 0 replies; 8+ messages in thread
From: Ma, LihongX @ 2019-10-14 5:15 UTC (permalink / raw)
To: Mo, YufengX, dts
Hi, yufeng
Thanks for you suggest.
-----Original Message-----
From: Mo, YufengX
Sent: Saturday, October 12, 2019 10:02 AM
To: Mo, YufengX <yufengx.mo@intel.com>; Ma, LihongX <lihongx.ma@intel.com>; dts@dpdk.org
Cc: Ma, LihongX <lihongx.ma@intel.com>
Subject: RE: [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep
Hi, ma, lihong
You can use 'from packet import DEP_FOLDER'.
When os.chdir is ran by other script, os.getcwd will be uncertain.
BRs
Yufen, Mo
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Mo, YufengX
> Sent: Saturday, October 12, 2019 9:26 AM
> To: Ma, LihongX <lihongx.ma@intel.com>; dts@dpdk.org
> Cc: Ma, LihongX <lihongx.ma@intel.com>
> Subject: Re: [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from
> current dep
>
> Hi,ma lihong
>
> > + cwd = os.getcwd()
> > + dir_module = cwd + r"/" + "dep"
>
> It will be '/xxx/dts/tests/dep'. Are you sure?
>
>
> > -----Original Message-----
> > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of lihong
> > Sent: Friday, October 11, 2019 8:25 AM
> > To: dts@dpdk.org
> > Cc: Ma, LihongX <lihongx.ma@intel.com>
> > Subject: [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from
> > current dep
> >
> > Signed-off-by: lihong <lihongx.ma@intel.com>
> > ---
> > tests/TestSuite_uni_pkt.py | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/tests/TestSuite_uni_pkt.py b/tests/TestSuite_uni_pkt.py
> > index 9a75061..cdc5849 100644
> > --- a/tests/TestSuite_uni_pkt.py
> > +++ b/tests/TestSuite_uni_pkt.py
> > @@ -47,6 +47,7 @@ import utils
> > from test_case import TestCase
> > from exception import VerifyFailure from packet import Packet
> > +import os
> > import time
> >
> >
> > @@ -442,10 +443,12 @@ class TestUniPacket(TestCase):
> > "ether+nsh+ipv6+udp": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_UDP", \
> > "ether+nsh+ipv6+sctp": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_SCTP"
> > }
> > -
> > + cwd = os.getcwd()
> > + dir_module = cwd + r"/" + "dep"
> > for packet in nsh_packets:
> > self.tester.scapy_foreground()
> > - self.tester.scapy_append("from scapy.contrib.nsh import *")
> > + self.tester.scapy_append("sys.path.append('%s')" % dir_module)
> > + self.tester.scapy_append("from nsh import NSH")
> > self.tester.scapy_append("sendp([%s],iface='%s')" % (nsh_packets[packet], self.tester_iface))
> > self.tester.scapy_execute()
> > out = self.dut.get_session_output(timeout=2)
> > --
> > 2.7.4
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-10-14 5:15 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-11 0:25 [dts] [PATCH V1 1/3][nsh] framwork/packet: add support of mpls and nsh lihong
2019-10-11 0:25 ` [dts] [PATCH V1 2/3][nsh] dep: " lihong
2019-10-11 0:25 ` [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep lihong
2019-10-12 1:26 ` Mo, YufengX
2019-10-12 2:02 ` Mo, YufengX
2019-10-14 5:15 ` Ma, LihongX
2019-10-14 5:04 ` Ma, LihongX
2019-10-12 6:10 ` 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).