* [dts] [PATCH V2 1/2] add 802.1BR UDP format support in framework/packet module
2016-07-26 1:30 [dts] [PATCH V2 0/2] Etag automation testing script Yufen Mo
@ 2016-07-26 1:30 ` Yufen Mo
2016-07-26 1:30 ` [dts] [PATCH V2 2/2] Etag: upload automation testing script Yufen Mo
1 sibling, 0 replies; 5+ messages in thread
From: Yufen Mo @ 2016-07-26 1:30 UTC (permalink / raw)
To: dts; +Cc: yufengmx
From: yufengmx <yufengx.mo@intel.com>
Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
framework/packet.py | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/framework/packet.py b/framework/packet.py
index a46fd47..98bc5c0 100755
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -69,12 +69,13 @@ sys.path.append(DEP_FOLDER)
from vxlan import Vxlan
from nvgre import NVGRE, IPPROTO_NVGRE
from lldp import LLDP, LLDPManagementAddress
+from Dot1BR import Dot1BR
# packet generator type should be configured later
PACKETGEN = "scapy"
LayersTypes = {
- "L2": ['ether', 'vlan', '1588', 'arp', 'lldp'],
+ "L2": ['ether', 'vlan', 'etag', '1588', 'arp', 'lldp'],
# 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'],
@@ -98,6 +99,7 @@ class scapy(object):
SCAPY_LAYERS = {
'ether': Ether(dst="ff:ff:ff:ff:ff:ff"),
'vlan': Dot1Q(),
+ 'etag': Dot1BR(),
'1588': Ether(type=0x88f7),
'arp': ARP(),
'ipv4': IP(),
@@ -178,6 +180,24 @@ class scapy(object):
value = int(str(self.pkt[Dot1Q].vlan))
return value
+ def etag(self, pkt_layer, ECIDbase=0, prio=0, type=None):
+ if pkt_layer.name != "802.1BR":
+ return
+ pkt_layer.ECIDbase = int(ECIDbase)
+ pkt_layer.prio = prio
+ if type is not None:
+ pkt_layer.type = type
+
+ def strip_etag(self, element):
+ value = None
+
+ if self.pkt.haslayer('Dot1BR') is 0:
+ return None
+
+ if element == 'ECIDbase':
+ value = int(str(self.pkt[Dot1BR].ECIDbase))
+ return value
+
def strip_layer2(self, element):
value = None
layer = self.pkt.getlayer(0)
@@ -316,6 +336,7 @@ class Packet(object):
'TCP': {'layers': ['ether', 'ipv4', 'tcp', 'raw'], 'cfgload': True},
'UDP': {'layers': ['ether', 'ipv4', 'udp', 'raw'], 'cfgload': True},
'VLAN_UDP': {'layers': ['ether', 'vlan', 'ipv4', 'udp', 'raw'], 'cfgload': True},
+ 'ETAG_UDP': {'layers': ['ether', 'etag', 'ipv4', 'udp', 'raw'], 'cfgload': True},
'SCTP': {'layers': ['ether', 'ipv4', 'sctp', 'raw'], 'cfgload': True},
'IPv6_TCP': {'layers': ['ether', 'ipv6', 'tcp', 'raw'], 'cfgload': True},
'IPv6_UDP': {'layers': ['ether', 'ipv6', 'udp', 'raw'], 'cfgload': True},
@@ -446,6 +467,7 @@ class Packet(object):
name2type = {
'MAC': 'ether',
'VLAN': 'vlan',
+ 'ETAG': 'etag',
'IP': 'ipv4',
'IPihl': 'ipv4ihl',
'IPFRAG': 'ipv4_ext',
@@ -553,6 +575,9 @@ class Packet(object):
def _config_layer_vlan(self, pkt_layer, config):
return self.pktgen.vlan(pkt_layer, **config)
+ def _config_layer_etag(self, pkt_layer, config):
+ return self.pktgen.etag(pkt_layer, **config)
+
def _config_layer_ipv4(self, pkt_layer, config):
return self.pktgen.ipv4(pkt_layer, **config)
@@ -586,6 +611,9 @@ class Packet(object):
def strip_element_vlan(self, element):
return self.pktgen.strip_vlan(element)
+ def strip_element_etag(self, element):
+ return self.pktgen.strip_etag(element)
+
def strip_element_layer4(self, element):
return self.pktgen.strip_layer4(element)
--
1.9.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dts] [PATCH V2 2/2] Etag: upload automation testing script
2016-07-26 1:30 [dts] [PATCH V2 0/2] Etag automation testing script Yufen Mo
2016-07-26 1:30 ` [dts] [PATCH V2 1/2] add 802.1BR UDP format support in framework/packet module Yufen Mo
@ 2016-07-26 1:30 ` Yufen Mo
1 sibling, 0 replies; 5+ messages in thread
From: Yufen Mo @ 2016-07-26 1:30 UTC (permalink / raw)
To: dts; +Cc: yufengmx
From: yufengmx <yufengx.mo@intel.com>
E-tag mode is used for systems where the device adds a tag to identify a subsystem (usually a VM) and
the near end switch adds a tag indicating the destination subsystem.
Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
conf/vf_etag.cfg | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 106 insertions(+)
create mode 100644 conf/vf_etag.cfg
diff --git a/conf/vf_etag.cfg b/conf/vf_etag.cfg
new file mode 100644
index 0000000..116be5a
--- /dev/null
+++ b/conf/vf_etag.cfg
@@ -0,0 +1,106 @@
+# QEMU options
+# name
+# name: vm0
+#
+# enable_kvm
+# enable: [yes | no]
+#
+# cpu
+# model: [host | core2duo | ...]
+# usage:
+# choose model value from the command
+# qemu-system-x86_64 -cpu help
+# number: '4' #number of vcpus
+# cpupin: '3 4 5 6' # host cpu list
+#
+# mem
+# size: 1024
+#
+# disk
+# file: /path/to/image/test.img
+#
+# net
+# type: [nic | user | tap | bridge | ...]
+# nic
+# opt_vlan: 0
+# note: Default is 0.
+# opt_macaddr: 00:00:00:00:01:01
+# note: if creating a nic, it`s better to specify a MAC,
+# else it will get a random number.
+# opt_model:["e1000" | "virtio" | "i82551" | ...]
+# note: Default is e1000.
+# opt_name: 'nic1'
+# opt_addr: ''
+# note: PCI cards only.
+# opt_vectors:
+# note: This option currently only affects virtio cards.
+# user
+# opt_vlan: 0
+# note: default is 0.
+# opt_hostfwd: [tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport
+# note: If not specified, it will be setted automatically.
+# tap
+# opt_vlan: 0
+# note: default is 0.
+# opt_br: br0
+# note: if choosing tap, need to specify bridge name,
+# else it will be br0.
+# opt_script: QEMU_IFUP_PATH
+# note: if not specified, default is self.QEMU_IFUP_PATH.
+# opt_downscript: QEMU_IFDOWN_PATH
+# note: if not specified, default is self.QEMU_IFDOWN_PATH.
+#
+# device
+# driver: [pci-assign | virtio-net-pci | ...]
+# pci-assign
+# prop_host: 08:00.0
+# prop_addr: 00:00:00:00:01:02
+# virtio-net-pci
+# prop_netdev: mynet1
+# prop_id: net1
+# prop_mac: 00:00:00:00:01:03
+# prop_bus: pci.0
+# prop_addr: 0x3
+#
+# monitor
+# port: 6061
+# note: if adding monitor to vm, need to specicy
+# this port, else it will get a free port
+# on the host machine.
+#
+# qga
+# enable: [yes | no]
+#
+# serial_port
+# enable: [yes | no]
+#
+# vnc
+# displayNum: 1
+# note: you can choose a number not used on the host.
+#
+# daemon
+# enable: 'yes'
+# note:
+# By default VM will start with the daemonize status.
+# Not support starting it on the stdin now.
+
+# vm configuration for pmd sriov case
+[vm0]
+cpu =
+ model=host,number=4,cpupin=4,5,6,7;
+disk =
+ file=/home/image/vdisk01-sriov-fc20.img;
+login =
+ user=root,password=tester;
+net =
+ type=nic,opt_vlan=0;
+ type=user,opt_vlan=0;
+monitor =
+ port=;
+qga =
+ enable=yes;
+vnc =
+ displayNum=1;
+daemon =
+ enable=yes;
+
--
1.9.3
^ permalink raw reply [flat|nested] 5+ messages in thread