Cleanup several pep8 warnings

The following pep8/flake8 warnings are no longer
being suppressed:

 E101 indentation contains mixed spaces and tabs
 E203 whitespace before ':'
 E211 whitespace before '('
 E228 missing whitespace around modulo operator
 E251 unexpected spaces around keyword / parameter equal
 E302 expected 2 blank lines, found 1
 E303 too many blank lines

Story: 2003499
Task: 26190

Change-Id: I8df57783417e4372a008f876365f9c24d2c0cb4b
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
This commit is contained in:
Al Bailey 2018-09-05 11:38:38 -05:00
parent 250fb4dc31
commit 3a419fef8d
8 changed files with 128 additions and 133 deletions

View File

@ -6,6 +6,7 @@
# flake8: noqa # flake8: noqa
# #
class _NfvVimRecordType(object): class _NfvVimRecordType(object):
""" """
NFV-VIM Record Type Constants NFV-VIM Record Type Constants

View File

@ -56,6 +56,7 @@ if not os.path.exists(logDir):
call("cp nfv-vim.log nfv-vim.log.[0-9] nfv-vim.log.[0-9][0-9] nfv-vim.log.[0-9].gz nfv-vim.log.[0-9][0-9].gz logs/", shell=True) call("cp nfv-vim.log nfv-vim.log.[0-9] nfv-vim.log.[0-9][0-9] nfv-vim.log.[0-9].gz nfv-vim.log.[0-9][0-9].gz logs/", shell=True)
call("gunzip logs/nfv-vim.log.[0-9].gz logs/nfv-vim.log.[0-9][0-9].gz", shell=True) call("gunzip logs/nfv-vim.log.[0-9].gz logs/nfv-vim.log.[0-9][0-9].gz", shell=True)
class Parser: class Parser:
def __init__(self): def __init__(self):
self.proc="" # Name of process being read self.proc="" # Name of process being read

View File

@ -70,6 +70,7 @@ group=[]
graphName="" graphName=""
plotType="" plotType=""
def helpMessage(): def helpMessage():
print("\n"+"-"*120) print("\n"+"-"*120)
print("NFV-VIM Histogram Graphing Script\n") print("NFV-VIM Histogram Graphing Script\n")
@ -207,7 +208,7 @@ def gCommand(groups):
break break
else: else:
if not groupFound: if not groupFound:
warnings.append("WARNING: The following group could not be found: %s\n\t\t Please check your logplot.cfg file for the intended group name."%(g,)) warnings.append("WARNING: The following group could not be found: %s\n\t\t Please check your logplot.cfg file for the intended group name." % (g,))
f.close() f.close()
return procs return procs
@ -229,7 +230,7 @@ def pCommand(pList):
procList.append(pList[i]) procList.append(pList[i])
else: else:
while(not isFile): while(not isFile):
print("\nFiles containing keyword: %s"%(str(procName))) print("\nFiles containing keyword: %s" % (str(procName)))
csvFile=str(procName)+".csv" csvFile=str(procName)+".csv"
for root, directories, filenames in os.walk(pth): for root, directories, filenames in os.walk(pth):
for filename in filenames: for filename in filenames:
@ -274,10 +275,10 @@ def storeGraphData(procs, dateRange=[], execTime=False, hits=False, plots=1):
f.close() f.close()
hitList[i][0]=None hitList[i][0]=None
graphData['trace'+str(i)] = go.Scatter( graphData['trace'+str(i)] = go.Scatter(
x = dateList[i], x=dateList[i],
y = timeList[i] if execTime else hitList[i], y=timeList[i] if execTime else hitList[i],
mode = plotType, mode=plotType,
name = (procs[i] if not oneAxis else (procs[i]+"_"+("time" if execTime else "hits"))) name=(procs[i] if not oneAxis else (procs[i]+"_"+("time" if execTime else "hits")))
) )
if plots==1: if plots==1:
fig.append_trace(graphData['trace'+str(i)], 1, 1) fig.append_trace(graphData['trace'+str(i)], 1, 1)
@ -297,10 +298,10 @@ def storeGraphData(procs, dateRange=[], execTime=False, hits=False, plots=1):
f.close() f.close()
hitList[i][0]=None hitList[i][0]=None
graphData['trace'+str(i)] = go.Scatter( graphData['trace'+str(i)] = go.Scatter(
x = dateList[i], x=dateList[i],
y = timeList[i] if execTime else hitList[i], y=timeList[i] if execTime else hitList[i],
mode = plotType, mode=plotType,
name = (procs[i] if not oneAxis else (procs[i]+"_"+("time" if execTime else "hits"))) name=(procs[i] if not oneAxis else (procs[i]+"_"+("time" if execTime else "hits")))
) )
if plots==1: if plots==1:
fig.append_trace(graphData['trace'+str(i)], 1, 1) fig.append_trace(graphData['trace'+str(i)], 1, 1)
@ -363,7 +364,6 @@ def setFilename(graphName):
return graphName return graphName
print("Welcome to plotter, type --help for information") print("Welcome to plotter, type --help for information")
# Checks that plotly is installed, otherwise graphs cannot be generated. # Checks that plotly is installed, otherwise graphs cannot be generated.
plotCheck=commands.getstatusoutput("pip list | grep plotly") plotCheck=commands.getstatusoutput("pip list | grep plotly")
@ -465,7 +465,7 @@ if config:
if os.path.exists(os.path.join(pth,csvFile)): if os.path.exists(os.path.join(pth,csvFile)):
procs.append(cfgLine[0]) procs.append(cfgLine[0])
else: else:
warnings.append("WARNING: %s does not exist."%(csvFile,)) warnings.append("WARNING: %s does not exist." % (csvFile,))
f.close() f.close()
# If both average execution time and delta hits are specified to be shown, generate two graphs if -oneaxis wasn't specified. # If both average execution time and delta hits are specified to be shown, generate two graphs if -oneaxis wasn't specified.

View File

@ -291,7 +291,6 @@ class TestInstance:
'compute-0') 'compute-0')
assert 300 == instance.max_live_migrate_wait_in_secs assert 300 == instance.max_live_migrate_wait_in_secs
def test_live_migration_completion_timeout_from_image(self): def test_live_migration_completion_timeout_from_image(self):
create_instance_type('small') create_instance_type('small')
create_image('image_0', create_image('image_0',

View File

@ -171,9 +171,9 @@ def create_host_aggregate(name, host_names):
global _host_aggregate_table global _host_aggregate_table
nfvi_host_aggregate = nfvi.objects.v1.HostAggregate( nfvi_host_aggregate = nfvi.objects.v1.HostAggregate(
name = name, name=name,
host_names = host_names, host_names=host_names,
availability_zone = '' availability_zone=''
) )
host_aggregate = objects.HostAggregate(nfvi_host_aggregate) host_aggregate = objects.HostAggregate(nfvi_host_aggregate)
@ -366,8 +366,8 @@ class TestSwPatchStrategy:
) )
success, reason = strategy._add_compute_strategy_stages( success, reason = strategy._add_compute_strategy_stages(
compute_hosts = sorted_compute_hosts, compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
assert success == True, "Strategy creation failed" assert success == True, "Strategy creation failed"
@ -418,8 +418,8 @@ class TestSwPatchStrategy:
max_parallel_compute_hosts=2 max_parallel_compute_hosts=2
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -528,8 +528,8 @@ class TestSwPatchStrategy:
max_parallel_compute_hosts=2 max_parallel_compute_hosts=2
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -691,8 +691,8 @@ class TestSwPatchStrategy:
max_parallel_compute_hosts=2 max_parallel_compute_hosts=2
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -864,8 +864,8 @@ class TestSwPatchStrategy:
max_parallel_compute_hosts=2 max_parallel_compute_hosts=2
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -1029,8 +1029,8 @@ class TestSwPatchStrategy:
max_parallel_compute_hosts=2 max_parallel_compute_hosts=2
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -1180,8 +1180,8 @@ class TestSwPatchStrategy:
default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -1270,7 +1270,7 @@ class TestSwPatchStrategy:
create_instance('small', create_instance('small',
"test_instance_1", "test_instance_1",
'compute-1', 'compute-1',
admin_state = nfvi.objects.v1.INSTANCE_ADMIN_STATE.LOCKED) admin_state=nfvi.objects.v1.INSTANCE_ADMIN_STATE.LOCKED)
create_instance_group('instance_group_1', create_instance_group('instance_group_1',
['test_instance_0', 'test_instance_1'], ['test_instance_0', 'test_instance_1'],
@ -1289,8 +1289,8 @@ class TestSwPatchStrategy:
) )
success, reason = strategy._add_compute_strategy_stages( success, reason = strategy._add_compute_strategy_stages(
compute_hosts = sorted_compute_hosts, compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
assert success == False, "Strategy creation did not fail" assert success == False, "Strategy creation did not fail"
@ -1331,8 +1331,8 @@ class TestSwPatchStrategy:
default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -1405,11 +1405,11 @@ class TestSwPatchStrategy:
strategy = create_sw_patch_strategy( strategy = create_sw_patch_strategy(
compute_apply_type=SW_UPDATE_APPLY_TYPE.PARALLEL, compute_apply_type=SW_UPDATE_APPLY_TYPE.PARALLEL,
default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START, default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START,
max_parallel_compute_hosts = 3, max_parallel_compute_hosts=3,
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = False) reboot=False)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -1457,7 +1457,7 @@ class TestSwPatchStrategy:
create_host('compute-1') create_host('compute-1')
create_host('compute-2') create_host('compute-2')
create_host('compute-3', create_host('compute-3',
admin_state = nfvi.objects.v1.HOST_ADMIN_STATE.LOCKED) admin_state=nfvi.objects.v1.HOST_ADMIN_STATE.LOCKED)
create_instance('small', create_instance('small',
"test_instance_0", "test_instance_0",
@ -1479,8 +1479,8 @@ class TestSwPatchStrategy:
default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -1551,7 +1551,7 @@ class TestSwPatchStrategy:
create_instance('small', create_instance('small',
"test_instance_1", "test_instance_1",
'compute-1', 'compute-1',
admin_state = nfvi.objects.v1.INSTANCE_ADMIN_STATE.LOCKED) admin_state=nfvi.objects.v1.INSTANCE_ADMIN_STATE.LOCKED)
compute_hosts = [] compute_hosts = []
for host in _host_table.values(): for host in _host_table.values():
@ -1566,8 +1566,8 @@ class TestSwPatchStrategy:
default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -1665,8 +1665,8 @@ class TestSwPatchStrategy:
default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -1744,8 +1744,8 @@ class TestSwPatchStrategy:
default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -1836,8 +1836,8 @@ class TestSwPatchStrategy:
default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -1925,8 +1925,8 @@ class TestSwPatchStrategy:
default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = False) reboot=False)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -1940,7 +1940,7 @@ class TestSwPatchStrategy:
{'name': 'sw-patch-hosts', {'name': 'sw-patch-hosts',
'entity_names': ['compute-2']}, 'entity_names': ['compute-2']},
{'name': 'system-stabilize', {'name': 'system-stabilize',
'timeout' : 30} 'timeout': 30}
] ]
}, },
{'name': 'sw-patch-compute-hosts', {'name': 'sw-patch-compute-hosts',
@ -1950,7 +1950,7 @@ class TestSwPatchStrategy:
{'name': 'sw-patch-hosts', {'name': 'sw-patch-hosts',
'entity_names': ['compute-3']}, 'entity_names': ['compute-3']},
{'name': 'system-stabilize', {'name': 'system-stabilize',
'timeout' : 30} 'timeout': 30}
] ]
}, },
{'name': 'sw-patch-compute-hosts', {'name': 'sw-patch-compute-hosts',
@ -1960,7 +1960,7 @@ class TestSwPatchStrategy:
{'name': 'sw-patch-hosts', {'name': 'sw-patch-hosts',
'entity_names': ['compute-0']}, 'entity_names': ['compute-0']},
{'name': 'system-stabilize', {'name': 'system-stabilize',
'timeout' : 30} 'timeout': 30}
] ]
}, },
{'name': 'sw-patch-compute-hosts', {'name': 'sw-patch-compute-hosts',
@ -1970,7 +1970,7 @@ class TestSwPatchStrategy:
{'name': 'sw-patch-hosts', {'name': 'sw-patch-hosts',
'entity_names': ['compute-1']}, 'entity_names': ['compute-1']},
{'name': 'system-stabilize', {'name': 'system-stabilize',
'timeout' : 30} 'timeout': 30}
] ]
} }
] ]
@ -1993,7 +1993,7 @@ class TestSwPatchStrategy:
create_host('compute-0') create_host('compute-0')
create_host('compute-1') create_host('compute-1')
create_host('compute-2', create_host('compute-2',
admin_state = nfvi.objects.v1.HOST_ADMIN_STATE.LOCKED) admin_state=nfvi.objects.v1.HOST_ADMIN_STATE.LOCKED)
create_host('compute-3') create_host('compute-3')
create_instance('small', create_instance('small',
@ -2023,8 +2023,8 @@ class TestSwPatchStrategy:
default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -2117,8 +2117,8 @@ class TestSwPatchStrategy:
default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = False) reboot=False)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -2195,8 +2195,8 @@ class TestSwPatchStrategy:
max_parallel_compute_hosts=5 max_parallel_compute_hosts=5
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -2325,8 +2325,8 @@ class TestSwPatchStrategy:
default_instance_action=SW_UPDATE_INSTANCE_ACTION.MIGRATE default_instance_action=SW_UPDATE_INSTANCE_ACTION.MIGRATE
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -2488,7 +2488,7 @@ class TestSwPatchStrategy:
create_instance('small', create_instance('small',
"test_instance_0", "test_instance_0",
'compute-0', 'compute-0',
admin_state = nfvi.objects.v1.INSTANCE_ADMIN_STATE.LOCKED) admin_state=nfvi.objects.v1.INSTANCE_ADMIN_STATE.LOCKED)
create_instance('small', create_instance('small',
"test_instance_1", "test_instance_1",
'compute-1') 'compute-1')
@ -2511,8 +2511,8 @@ class TestSwPatchStrategy:
) )
success, reason = strategy._add_compute_strategy_stages( success, reason = strategy._add_compute_strategy_stages(
compute_hosts = sorted_compute_hosts, compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
assert success == False, "Strategy creation did not fail" assert success == False, "Strategy creation did not fail"
@ -2608,8 +2608,8 @@ class TestSwPatchStrategy:
) )
success, reason = strategy._add_storage_strategy_stages( success, reason = strategy._add_storage_strategy_stages(
storage_hosts = sorted_storage_hosts, storage_hosts=sorted_storage_hosts,
reboot = True) reboot=True)
assert success == True, "Strategy creation failed" assert success == True, "Strategy creation failed"
@ -2654,8 +2654,8 @@ class TestSwPatchStrategy:
storage_apply_type=SW_UPDATE_APPLY_TYPE.PARALLEL storage_apply_type=SW_UPDATE_APPLY_TYPE.PARALLEL
) )
strategy._add_storage_strategy_stages(storage_hosts = sorted_storage_hosts, strategy._add_storage_strategy_stages(storage_hosts=sorted_storage_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -2715,8 +2715,8 @@ class TestSwPatchStrategy:
storage_apply_type=SW_UPDATE_APPLY_TYPE.PARALLEL storage_apply_type=SW_UPDATE_APPLY_TYPE.PARALLEL
) )
strategy._add_storage_strategy_stages(storage_hosts = sorted_storage_hosts, strategy._add_storage_strategy_stages(storage_hosts=sorted_storage_hosts,
reboot = False) reboot=False)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -2777,8 +2777,8 @@ class TestSwPatchStrategy:
storage_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL storage_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL
) )
strategy._add_storage_strategy_stages(storage_hosts = sorted_storage_hosts, strategy._add_storage_strategy_stages(storage_hosts=sorted_storage_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -2900,8 +2900,8 @@ class TestSwPatchStrategy:
) )
success, reason = strategy._add_controller_strategy_stages( success, reason = strategy._add_controller_strategy_stages(
controllers = controller_hosts, controllers=controller_hosts,
reboot = True) reboot=True)
assert success == True, "Strategy creation failed" assert success == True, "Strategy creation failed"
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -2934,8 +2934,8 @@ class TestSwPatchStrategy:
controller_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL controller_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL
) )
strategy._add_controller_strategy_stages(controllers = controller_hosts, strategy._add_controller_strategy_stages(controllers=controller_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -2989,8 +2989,8 @@ class TestSwPatchStrategy:
controller_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL controller_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL
) )
strategy._add_controller_strategy_stages(controllers = controller_hosts, strategy._add_controller_strategy_stages(controllers=controller_hosts,
reboot = False) reboot=False)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -3054,8 +3054,8 @@ class TestSwPatchStrategy:
default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -3118,8 +3118,8 @@ class TestSwPatchStrategy:
default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = False) reboot=False)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -3179,8 +3179,8 @@ class TestSwPatchStrategy:
default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -3260,8 +3260,8 @@ class TestSwPatchStrategy:
default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -3283,7 +3283,7 @@ class TestSwPatchStrategy:
{'name': 'unlock-hosts', {'name': 'unlock-hosts',
'entity_names': ['controller-0']}, 'entity_names': ['controller-0']},
{'name': 'system-stabilize', {'name': 'system-stabilize',
'timeout' : 60} 'timeout': 60}
] ]
}, },
{'name': 'sw-patch-compute-hosts', {'name': 'sw-patch-compute-hosts',
@ -3301,7 +3301,7 @@ class TestSwPatchStrategy:
{'name': 'unlock-hosts', {'name': 'unlock-hosts',
'entity_names': ['controller-1']}, 'entity_names': ['controller-1']},
{'name': 'system-stabilize', {'name': 'system-stabilize',
'timeout' : 60} 'timeout': 60}
] ]
}, },
] ]
@ -3340,8 +3340,8 @@ class TestSwPatchStrategy:
) )
success, reason = strategy._add_compute_strategy_stages( success, reason = strategy._add_compute_strategy_stages(
compute_hosts = compute_hosts, compute_hosts=compute_hosts,
reboot = True) reboot=True)
assert success == False, "Strategy creation did not fail" assert success == False, "Strategy creation did not fail"
@ -3369,8 +3369,8 @@ class TestSwPatchStrategy:
single_controller=True single_controller=True
) )
strategy._add_compute_strategy_stages(compute_hosts = compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -3424,8 +3424,8 @@ class TestSwPatchStrategy:
single_controller=True single_controller=True
) )
strategy._add_compute_strategy_stages(compute_hosts = compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()

View File

@ -373,8 +373,8 @@ class TestSwUpgradeStrategy:
) )
success, reason = strategy._add_compute_strategy_stages( success, reason = strategy._add_compute_strategy_stages(
compute_hosts = sorted_compute_hosts, compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
assert success == True, "Strategy creation failed" assert success == True, "Strategy creation failed"
@ -427,8 +427,8 @@ class TestSwUpgradeStrategy:
) )
strategy._add_compute_strategy_stages( strategy._add_compute_strategy_stages(
compute_hosts = sorted_compute_hosts, compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -756,8 +756,8 @@ class TestSwUpgradeStrategy:
compute_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL compute_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL
) )
strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -845,7 +845,7 @@ class TestSwUpgradeStrategy:
create_instance('small', create_instance('small',
"test_instance_0", "test_instance_0",
'compute-0', 'compute-0',
admin_state = nfvi.objects.v1.INSTANCE_ADMIN_STATE.LOCKED) admin_state=nfvi.objects.v1.INSTANCE_ADMIN_STATE.LOCKED)
create_instance('small', create_instance('small',
"test_instance_1", "test_instance_1",
'compute-1') 'compute-1')
@ -866,8 +866,8 @@ class TestSwUpgradeStrategy:
) )
success, reason = strategy._add_compute_strategy_stages( success, reason = strategy._add_compute_strategy_stages(
compute_hosts = sorted_compute_hosts, compute_hosts=sorted_compute_hosts,
reboot = True) reboot=True)
assert success == False, "Strategy creation did not fail" assert success == False, "Strategy creation did not fail"
@ -904,8 +904,8 @@ class TestSwUpgradeStrategy:
) )
success, reason = strategy._add_storage_strategy_stages( success, reason = strategy._add_storage_strategy_stages(
storage_hosts = sorted_storage_hosts, storage_hosts=sorted_storage_hosts,
reboot = True) reboot=True)
assert success == True, "Strategy creation failed" assert success == True, "Strategy creation failed"
@ -951,8 +951,8 @@ class TestSwUpgradeStrategy:
storage_apply_type=SW_UPDATE_APPLY_TYPE.PARALLEL storage_apply_type=SW_UPDATE_APPLY_TYPE.PARALLEL
) )
strategy._add_storage_strategy_stages(storage_hosts = sorted_storage_hosts, strategy._add_storage_strategy_stages(storage_hosts=sorted_storage_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -1037,8 +1037,8 @@ class TestSwUpgradeStrategy:
storage_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL storage_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL
) )
strategy._add_storage_strategy_stages(storage_hosts = sorted_storage_hosts, strategy._add_storage_strategy_stages(storage_hosts=sorted_storage_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -1131,8 +1131,8 @@ class TestSwUpgradeStrategy:
strategy = create_sw_upgrade_strategy() strategy = create_sw_upgrade_strategy()
strategy._add_controller_strategy_stages(controllers = controller_hosts, strategy._add_controller_strategy_stages(controllers=controller_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -1179,8 +1179,8 @@ class TestSwUpgradeStrategy:
strategy = create_sw_upgrade_strategy() strategy = create_sw_upgrade_strategy()
strategy._add_controller_strategy_stages(controllers = controller_hosts, strategy._add_controller_strategy_stages(controllers=controller_hosts,
reboot = True) reboot=True)
apply_phase = strategy.apply_phase.as_dict() apply_phase = strategy.apply_phase.as_dict()
@ -1247,8 +1247,8 @@ class TestSwUpgradeStrategy:
strategy = create_sw_upgrade_strategy() strategy = create_sw_upgrade_strategy()
success, reason = strategy._add_controller_strategy_stages( success, reason = strategy._add_controller_strategy_stages(
controllers = controller_hosts, controllers=controller_hosts,
reboot = True) reboot=True)
assert success == False, "Strategy creation did not fail" assert success == False, "Strategy creation did not fail"
assert reason == "cannot apply software upgrades to CPE configuration", \ assert reason == "cannot apply software upgrades to CPE configuration", \
@ -1541,7 +1541,7 @@ class TestSwUpgradeStrategy:
strategy = create_sw_upgrade_strategy( strategy = create_sw_upgrade_strategy(
compute_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL, compute_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL,
nfvi_upgrade = nfvi.objects.v1.Upgrade( nfvi_upgrade=nfvi.objects.v1.Upgrade(
UPGRADE_STATE.DATA_MIGRATION_COMPLETE, UPGRADE_STATE.DATA_MIGRATION_COMPLETE,
'12.01', '12.01',
'13.01') '13.01')
@ -1627,7 +1627,7 @@ class TestSwUpgradeStrategy:
strategy = create_sw_upgrade_strategy( strategy = create_sw_upgrade_strategy(
compute_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL, compute_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL,
nfvi_upgrade = nfvi.objects.v1.Upgrade( nfvi_upgrade=nfvi.objects.v1.Upgrade(
UPGRADE_STATE.DATA_MIGRATION_COMPLETE, UPGRADE_STATE.DATA_MIGRATION_COMPLETE,
'12.01', '12.01',
'13.01') '13.01')
@ -1672,7 +1672,7 @@ class TestSwUpgradeStrategy:
strategy = create_sw_upgrade_strategy( strategy = create_sw_upgrade_strategy(
compute_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL, compute_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL,
nfvi_upgrade = nfvi.objects.v1.Upgrade( nfvi_upgrade=nfvi.objects.v1.Upgrade(
UPGRADE_STATE.UPGRADING_CONTROLLERS, UPGRADE_STATE.UPGRADING_CONTROLLERS,
'12.01', '12.01',
'13.01') '13.01')
@ -1703,7 +1703,7 @@ class TestSwUpgradeStrategy:
- build fails - build fails
""" """
create_host('controller-0', create_host('controller-0',
admin_state = nfvi.objects.v1.HOST_ADMIN_STATE.LOCKED) admin_state=nfvi.objects.v1.HOST_ADMIN_STATE.LOCKED)
create_host('controller-1') create_host('controller-1')
create_host('compute-0') create_host('compute-0')
create_host('compute-1') create_host('compute-1')
@ -1754,7 +1754,7 @@ class TestSwUpgradeStrategy:
create_host('compute-1') create_host('compute-1')
create_host('compute-2') create_host('compute-2')
create_host('compute-3', create_host('compute-3',
admin_state = nfvi.objects.v1.HOST_ADMIN_STATE.LOCKED) admin_state=nfvi.objects.v1.HOST_ADMIN_STATE.LOCKED)
create_instance('small', create_instance('small',
"test_instance_0", "test_instance_0",
@ -1765,7 +1765,7 @@ class TestSwUpgradeStrategy:
strategy = create_sw_upgrade_strategy( strategy = create_sw_upgrade_strategy(
compute_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL, compute_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL,
nfvi_upgrade = nfvi.objects.v1.Upgrade( nfvi_upgrade=nfvi.objects.v1.Upgrade(
UPGRADE_STATE.UPGRADING_CONTROLLERS, UPGRADE_STATE.UPGRADING_CONTROLLERS,
'12.01', '12.01',
'13.01') '13.01')

View File

@ -21,6 +21,7 @@
# #
# #
class ProxyException(Exception): class ProxyException(Exception):
"""Base Exception """Base Exception
""" """

View File

@ -26,7 +26,6 @@ commands =
[pep8] [pep8]
# Temporarily ignoring these warnings # Temporarily ignoring these warnings
# E101 indentation contains mixed spaces and tabs
# E116 unexpected indentation (comment) # E116 unexpected indentation (comment)
# E121 continuation line under-indented for hanging indent # E121 continuation line under-indented for hanging indent
# E122 continuation line missing indentation or outdented # E122 continuation line missing indentation or outdented
@ -36,22 +35,16 @@ commands =
# E127 continuation line over-indented for visual indent # E127 continuation line over-indented for visual indent
# E128 continuation line under-indented for visual indent # E128 continuation line under-indented for visual indent
# E129 visually indented line with same indent as next logical line # E129 visually indented line with same indent as next logical line
# E203 whitespace before ':'
# E211 whitespace before '('
# E225 missing whitespace around operator # E225 missing whitespace around operator
# E226 missing whitespace around arithmetic operator # E226 missing whitespace around arithmetic operator
# E228 missing whitespace around modulo operator
# E231 missing whitespace after ':' # E231 missing whitespace after ':'
# E241 multiple spaces after # E241 multiple spaces after
# E261 at least two spaces before inline comment # E261 at least two spaces before inline comment
# E265 block comment should start with '# ' # E265 block comment should start with '# '
# E251 unexpected spaces around keyword / parameter equals
# E302 expected 2 blank lines, found 1
# E303 too many blank lines
# E501 line too long # E501 line too long
# E712 comparison to bool should be reworded # E712 comparison to bool should be reworded
ignore = E101,E116,E121,E123,E122,E124,E126,E127,E128,E129,E203,E211,E225,E226,E228,E231,E241,E251,E261,E265,E302,E303,E501,E712 ignore = E116,E121,E122,E123,E124,E126,E127,E128,E129,E225,E226,E231,E241,E261,E265,E501,E712
[testenv:pep8] [testenv:pep8]
usedevelop = False usedevelop = False