aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorgoldammx <martinx.goldammer@intel.com>2017-02-09 08:03:00 -0500
committergoldammx <martinx.goldammer@intel.com>2017-02-13 06:21:28 -0500
commitca9c9275ed6d5d852987c69a378e88a3502cb2ab (patch)
tree23a28663a4db92cd1c409b887691650642f18023 /src
parentea4376cb3c89f4e3605d7f48036fd61325a52fcf (diff)
pylint: Fixing pylint errors and warnings
All python files must reach pylint score 10/10. This will be regularly verified by Jenkins jobs to keep constant code quality. VSPERF specific pylintrc file was updated according to the vsperf coding standards. Distro version included in reports will be slightly different, due to migration to new python package distro. Previously used platform.distro() will be deprecated since python 3.7. JIRA: VSPERF-487 Change-Id: I934120208b9624787a3567ccaa49e14d77d7a5bf Signed-off-by: Martin Goldammer <martinx.goldammer@intel.com> Reviewed-by: Martin Klozik <martinx.klozik@intel.com> Reviewed-by: Al Morton <acmorton@att.com> Reviewed-by: Christian Trautman <ctrautma@redhat.com> Reviewed-by: Bill Michalowski <bmichalo@redhat.com> Reviewed-by: Antonio Fischetti <antonio.fischetti@intel.com> Reviewed-by: Sridhar Rao <sridhar.rao@spirent.com>
Diffstat (limited to 'src')
-rw-r--r--src/dpdk/__init__.py3
-rw-r--r--src/dpdk/dpdk.py3
-rw-r--r--src/ovs/dpctl.py6
-rw-r--r--src/ovs/ofctl.py10
4 files changed, 8 insertions, 14 deletions
diff --git a/src/dpdk/__init__.py b/src/dpdk/__init__.py
index fdbc5414..7b721be0 100644
--- a/src/dpdk/__init__.py
+++ b/src/dpdk/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2015 Intel Corporation.
+# Copyright 2015-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,4 +20,3 @@ and removing drivers and binding/unbinding NICs.
from src.dpdk.dpdk import *
from src.dpdk.testpmd_proc import TestPMDProcess
-
diff --git a/src/dpdk/dpdk.py b/src/dpdk/dpdk.py
index 0c5ed9f4..438fe40b 100644
--- a/src/dpdk/dpdk.py
+++ b/src/dpdk/dpdk.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2016 Intel Corporation.
+# Copyright 2015-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -44,6 +44,7 @@ _NICS_PCI = []
def init():
"""Setup system for DPDK.
"""
+ # pylint: disable=global-statement
global _NICS
global _NICS_PCI
_NICS = S.getValue('NICS')
diff --git a/src/ovs/dpctl.py b/src/ovs/dpctl.py
index 44a4ec9b..015fb38c 100644
--- a/src/ovs/dpctl.py
+++ b/src/ovs/dpctl.py
@@ -1,4 +1,4 @@
-# Copyright 2016 Intel Corporation.
+# Copyright 2016-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,10 +15,7 @@
"""Wrapper for an OVS dpctl (``ovs-dpctl``) for managing datapaths.
"""
-
-import os
import logging
-import string
from tools import tasks
from conf import settings
@@ -65,4 +62,3 @@ class DPCtl(object):
"""
self.logger.debug('delete datapath ' + dp_name)
self.run_dpctl(['del-dp', dp_name])
-
diff --git a/src/ovs/ofctl.py b/src/ovs/ofctl.py
index e9b86127..f0d116da 100644
--- a/src/ovs/ofctl.py
+++ b/src/ovs/ofctl.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2016 Intel Corporation.
+# Copyright 2015-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,8 +19,6 @@ Much of this code is based on ``ovs-lib.py`` from Open Stack:
https://github.com/openstack/neutron/blob/6eac1dc99124ca024d6a69b3abfa3bc69c735667/neutron/agent/linux/ovs_lib.py
"""
-
-import os
import logging
import string
import re
@@ -177,7 +175,7 @@ class OFBridge(OFBase):
:return: None
"""
- tmp_timeout = self.timeout if timeout == None else timeout
+ tmp_timeout = self.timeout if timeout is None else timeout
cmd = ['sudo', settings.getValue('TOOLS')['ovs-ofctl'], '-O',
'OpenFlow13', '--timeout', str(tmp_timeout)] + args
return tasks.run_task(
@@ -292,7 +290,7 @@ class OFBridge(OFBase):
"""
# insert flows from cache into OVS if needed
if cache == 'flush':
- if self._cache_file == None:
+ if self._cache_file is None:
self.logger.error('flow cache flush called, but nothing is cached')
return
self.logger.debug('flows cached in %s will be added to the bridge', _CACHE_FILE_NAME)
@@ -311,7 +309,7 @@ class OFBridge(OFBase):
# insert flow to the cache or OVS
if cache == 'on':
# create and open cache file if needed
- if self._cache_file == None:
+ if self._cache_file is None:
self._cache_file = open(_CACHE_FILE_NAME, 'w')
self._cache_file.write(_flow_key + '\n')
else: