aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2019-04-30 20:57:04 -0700
committerDamjan Marion <dmarion@me.com>2019-05-01 17:23:35 +0000
commitb11c288f11bb04cb48c50088279546085db8bc27 (patch)
tree1a535078db39bed74e0e88517d1b5047aab62446
parentb31c0ce2194ddb198320e91f42973e35a1ab4619 (diff)
vpp_config: correct usage of 'is' for equality tests.
Change-Id: I30b1cdb2930560d7c40c1bde098fd21f16a17683 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
-rw-r--r--extras/vpp_config/vpplib/AutoConfig.py16
-rw-r--r--extras/vpp_config/vpplib/VPPUtil.py16
2 files changed, 16 insertions, 16 deletions
diff --git a/extras/vpp_config/vpplib/AutoConfig.py b/extras/vpp_config/vpplib/AutoConfig.py
index 6fd6eeea096..c4777104c0b 100644
--- a/extras/vpp_config/vpplib/AutoConfig.py
+++ b/extras/vpp_config/vpplib/AutoConfig.py
@@ -351,7 +351,7 @@ class AutoConfig(object):
vpp_main_core = node['cpu']['vpp_main_core']
else:
vpp_main_core = 0
- if vpp_main_core is not 0:
+ if vpp_main_core != 0:
cpu += ' main-core {}\n'.format(vpp_main_core)
# Get workers
@@ -419,7 +419,7 @@ class AutoConfig(object):
# If the total mbufs is not 0 or less than the default, set num-bufs
logging.debug("Total mbufs: {}".format(total_mbufs))
- if total_mbufs is not 0 and total_mbufs > 16384:
+ if total_mbufs != 0 and total_mbufs > 16384:
devices += '\n num-mbufs {}'.format(total_mbufs)
return devices
@@ -558,7 +558,7 @@ class AutoConfig(object):
other_cpus_end = other_cpus_start + \
node['cpu']['total_other_cpus'] - 1
other_workers = None
- if other_cpus_end is not 0:
+ if other_cpus_end != 0:
other_workers = (other_cpus_start, other_cpus_end)
node['cpu']['other_workers'] = other_workers
@@ -577,7 +577,7 @@ class AutoConfig(object):
if reserve_vpp_main_core:
total_main = 1
total_mbufs = 0
- if total_main + total_workers_node is not 0:
+ if total_main + total_workers_node != 0:
for item in ports_per_numa.items():
numa_node = item[0]
value = item[1]
@@ -735,7 +735,7 @@ class AutoConfig(object):
all_workers = []
if other_workers is not None:
all_workers = [other_workers]
- if vpp_main_core is not 0:
+ if vpp_main_core != 0:
all_workers += [(vpp_main_core, vpp_main_core)]
all_workers += vpp_workers
isolated_cpus = ''
@@ -804,7 +804,7 @@ class AutoConfig(object):
iso_cpul = iso_cpu_str.split(',')
for iso_cpu in iso_cpul:
isocpuspl = iso_cpu.split('-')
- if len(isocpuspl) is 1:
+ if len(isocpuspl) == 1:
current_iso_cpus += 1
else:
first = int(isocpuspl[0])
@@ -1409,7 +1409,7 @@ class AutoConfig(object):
if 'cpu' in node and 'total_mbufs' in node['cpu']:
total_mbufs = node['cpu']['total_mbufs']
- if total_mbufs is not 0:
+ if total_mbufs != 0:
print("Total Number of Buffers: {}".format(total_mbufs))
vpp = VppPCIUtil(node)
@@ -1631,7 +1631,7 @@ class AutoConfig(object):
# Show the current interfaces with IP addresses
current_ints = VPPUtil.get_int_ip(node)
- if current_ints is not {}:
+ if current_ints != {}:
print("\nThese are the current interfaces with IP addresses:")
for items in sorted(current_ints.items()):
name = items[0]
diff --git a/extras/vpp_config/vpplib/VPPUtil.py b/extras/vpp_config/vpplib/VPPUtil.py
index 2cbaa2d0aaf..5ed46f2452e 100644
--- a/extras/vpp_config/vpplib/VPPUtil.py
+++ b/extras/vpp_config/vpplib/VPPUtil.py
@@ -402,18 +402,18 @@ class VPPUtil(object):
return interfaces
lines = stdout.split('\n')
- if len(lines[0]) is not 0:
+ if len(lines[0]) != 0:
if lines[0].split(' ')[0] == 'FileNotFoundError':
return interfaces
name = ''
for line in lines:
- if len(line) is 0:
+ if len(line) == 0:
continue
# If the first character is not whitespace
# create a new interface
- if len(re.findall(r'\s', line[0])) is 0:
+ if len(re.findall(r'\s', line[0])) == 0:
spl = line.split()
name = spl[0]
if name == 'local0':
@@ -444,17 +444,17 @@ class VPPUtil(object):
return interfaces
lines = stdout.split('\n')
- if len(lines[0]) is not 0:
+ if len(lines[0]) != 0:
if lines[0].split(' ')[0] == 'FileNotFoundError':
return interfaces
for line in lines:
- if len(line) is 0:
+ if len(line) == 0:
continue
# If the first character is not whitespace
# create a new interface
- if len(re.findall(r'\s', line[0])) is 0:
+ if len(re.findall(r'\s', line[0])) == 0:
spl = line.split()
name = spl[0]
interfaces[name] = {}
@@ -731,12 +731,12 @@ class VPPUtil(object):
return version
lines = stdout.split('\n')
- if len(lines[0]) is not 0:
+ if len(lines[0]) != 0:
if lines[0].split(' ')[0] == 'FileNotFoundError':
return version
for line in lines:
- if len(line) is 0:
+ if len(line) == 0:
continue
dct = line.split(':')
version[dct[0]] = dct[1].lstrip(' ')