diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/__init__.py | 1 | ||||
-rw-r--r-- | src/dpdk/dpdk.py | 4 | ||||
-rw-r--r-- | src/ovs/dpctl.py | 2 | ||||
-rw-r--r-- | src/ovs/ofctl.py | 37 | ||||
-rw-r--r-- | src/package-list.mk | 2 | ||||
-rw-r--r-- | src/trex/Makefile | 2 |
6 files changed, 18 insertions, 30 deletions
diff --git a/src/__init__.py b/src/__init__.py index 9293b4f8..c784ea3c 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -18,4 +18,3 @@ No functionality is expected for this package and its purpose is just to keep Python package structure intact without extra requirements for PYTHONPATH. """ - diff --git a/src/dpdk/dpdk.py b/src/dpdk/dpdk.py index 2f120129..c2e656ef 100644 --- a/src/dpdk/dpdk.py +++ b/src/dpdk/dpdk.py @@ -140,7 +140,7 @@ def _vhost_user_cleanup(): def _bind_nics(): """Bind NICs using the bind tool specified in the configuration. """ - if not len(_NICS_PCI): + if not _NICS_PCI: _LOGGER.info('NICs are not configured - nothing to bind') return try: @@ -171,7 +171,7 @@ def _bind_nics(): def _unbind_nics(): """Unbind NICs using the bind tool specified in the configuration. """ - if not len(_NICS_PCI): + if not _NICS_PCI: _LOGGER.info('NICs are not configured - nothing to unbind') return try: diff --git a/src/ovs/dpctl.py b/src/ovs/dpctl.py index 015fb38c..5030223e 100644 --- a/src/ovs/dpctl.py +++ b/src/ovs/dpctl.py @@ -60,5 +60,5 @@ class DPCtl(object): :return: None """ - self.logger.debug('delete datapath ' + dp_name) + self.logger.debug('delete datapath %s', dp_name) self.run_dpctl(['del-dp', dp_name]) diff --git a/src/ovs/ofctl.py b/src/ovs/ofctl.py index 64d54466..21da850a 100644 --- a/src/ovs/ofctl.py +++ b/src/ovs/ofctl.py @@ -25,10 +25,10 @@ import re import netaddr from tools import tasks -from conf import settings +from conf import settings as S -_OVS_BRIDGE_NAME = settings.getValue('VSWITCH_BRIDGE_NAME') -_OVS_CMD_TIMEOUT = settings.getValue('OVS_CMD_TIMEOUT') +_OVS_BRIDGE_NAME = S.getValue('VSWITCH_BRIDGE_NAME') +_OVS_CMD_TIMEOUT = S.getValue('OVS_CMD_TIMEOUT') _CACHE_FILE_NAME = '/tmp/vsperf_flows_cache' @@ -62,9 +62,11 @@ class OFBase(object): :return: None """ if self.timeout == -1: - cmd = ['sudo', settings.getValue('TOOLS')['ovs-vsctl'], '--no-wait'] + args + cmd = ['sudo', S.getValue('TOOLS')['ovs-vsctl'], '--no-wait'] + \ + S.getValue('OVS_VSCTL_ARGS') + args else: - cmd = ['sudo', settings.getValue('TOOLS')['ovs-vsctl'], '--timeout', str(self.timeout)] + args + cmd = ['sudo', S.getValue('TOOLS')['ovs-vsctl'], '--timeout', + str(self.timeout)] + S.getValue('OVS_VSCTL_ARGS') + args return tasks.run_task( cmd, self.logger, 'Running ovs-vsctl...', check_error) @@ -77,9 +79,9 @@ class OFBase(object): :return: None """ - cmd = ['sudo', settings.getValue('TOOLS')['ovs-appctl'], + cmd = ['sudo', S.getValue('TOOLS')['ovs-appctl'], '--timeout', - str(self.timeout)] + args + str(self.timeout)] + S.getValue('OVS_APPCTL_ARGS') + args return tasks.run_task( cmd, self.logger, 'Running ovs-appctl...', check_error) @@ -154,21 +156,6 @@ class OFBridge(OFBase): self._ports = {} self._cache_file = None - # context manager - - def __enter__(self): - """Create datapath - - :returns: self - """ - return self - - def __exit__(self, type_, value, traceback): - """Remove datapath. - """ - if not traceback: - self.destroy() - # helpers def run_ofctl(self, args, check_error=False, timeout=None): @@ -180,8 +167,8 @@ class OFBridge(OFBase): :return: None """ tmp_timeout = self.timeout if timeout is None else timeout - cmd = ['sudo', settings.getValue('TOOLS')['ovs-ofctl'], '-O', - 'OpenFlow13', '--timeout', str(tmp_timeout)] + args + cmd = ['sudo', S.getValue('TOOLS')['ovs-ofctl'], '--timeout', + str(tmp_timeout)] + S.getValue('OVS_OFCTL_ARGS') + args return tasks.run_task( cmd, self.logger, 'Running ovs-ofctl...', check_error) @@ -467,4 +454,4 @@ def flow_match(flow_dump, flow_src): for rule in flow_src_list: if rule in flow_dump_list: flow_src_ctrl.remove(rule) - return True if not len(flow_src_ctrl) else False + return True if not flow_src_ctrl else False diff --git a/src/package-list.mk b/src/package-list.mk index 7b82ee6f..d32a9ffd 100644 --- a/src/package-list.mk +++ b/src/package-list.mk @@ -29,4 +29,4 @@ QEMU_TAG ?= v2.9.1 # TREX section TREX_URL ?= https://github.com/cisco-system-traffic-generator/trex-core.git -TREX_TAG ?= 8bf9c16556843e55c232b64d9a5061bf588fad42 +TREX_TAG ?= v2.38 diff --git a/src/trex/Makefile b/src/trex/Makefile index 41eb52ab..9a0704af 100644 --- a/src/trex/Makefile +++ b/src/trex/Makefile @@ -29,6 +29,8 @@ all: force_pull force_pull: $(TAG_DONE_FLAG) $(AT)cd $(WORK_DIR) && git pull $(TREX_URL) $(TREX_TAG) @echo "git pull done" + $(AT)wget https://raw.githubusercontent.com/phaethon/scapy/v0.18/scapy/layers/all.py -O $(WORK_DIR)/scripts/external_libs/scapy-2.3.1/python3/scapy/layers/all.py + @echo "orignal SCAPY 2.3.1 layers/all.py was restored" $(WORK_DIR): $(AT)git clone $(TREX_URL) $(WORK_DIR) |