Deal with flake8 errors in tempest
Change-Id: I69f02ce3a589d3854b0508c56b77758a4cf013bd Signed-off-by: Zhijiang Hu <hu.zhijiang@zte.com.cn>
This commit is contained in:
parent
caa9c11e4a
commit
73d88a9f76
|
@ -4,6 +4,7 @@ import uuid
|
||||||
|
|
||||||
class FakeLogicNetwork():
|
class FakeLogicNetwork():
|
||||||
# 1----------------------------------------------------------
|
# 1----------------------------------------------------------
|
||||||
|
|
||||||
def fake_network_parameters(self):
|
def fake_network_parameters(self):
|
||||||
return {
|
return {
|
||||||
'base_mac': 'fa:16:3e:00:00:00',
|
'base_mac': 'fa:16:3e:00:00:00',
|
||||||
|
@ -102,7 +103,6 @@ class FakeLogicNetwork():
|
||||||
'gateway': '172.16.1.1',
|
'gateway': '172.16.1.1',
|
||||||
'name': 'subnet10'}]
|
'name': 'subnet10'}]
|
||||||
|
|
||||||
|
|
||||||
def fake_router_parameters2(self):
|
def fake_router_parameters2(self):
|
||||||
return [{
|
return [{
|
||||||
'description': 'router1',
|
'description': 'router1',
|
||||||
|
@ -150,6 +150,7 @@ class FakeLogicNetwork():
|
||||||
'ml2_type': 'ovs'
|
'ml2_type': 'ovs'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class FakeDiscoverHosts():
|
class FakeDiscoverHosts():
|
||||||
# 1----------------------------------------------------------
|
# 1----------------------------------------------------------
|
||||||
daisy_data = [{'description': 'default',
|
daisy_data = [{'description': 'default',
|
||||||
|
@ -192,22 +193,29 @@ class FakeDiscoverHosts():
|
||||||
'os_status': 'init',
|
'os_status': 'init',
|
||||||
'dmi_uuid': '03000200-0400-0500-0006-000700080009'}]
|
'dmi_uuid': '03000200-0400-0500-0006-000700080009'}]
|
||||||
|
|
||||||
ironic_disk_data = [{'uuid':'03000200-0400-0500-0006-000700080009',
|
ironic_disk_data = \
|
||||||
|
[{'uuid': '03000200-0400-0500-0006-000700080009',
|
||||||
'mac': '4c:09:b4:b2:78:8a',
|
'mac': '4c:09:b4:b2:78:8a',
|
||||||
'patch': [{'op': 'add',
|
'patch': [{'op': 'add',
|
||||||
'path': '/disks/sda',
|
'path': '/disks/sda',
|
||||||
'value': {'disk': 'pci-0000:01:00.0-sas-0x500003956831a6da-lun-0',
|
'value': {
|
||||||
'extra': ['scsi-3500003956831a6d8', 'wwn-0x500003956831a6d8'],
|
'disk':
|
||||||
|
'pci-0000:01:00.0-sas-0x500003956831a6da-lun-0',
|
||||||
|
'extra': ['scsi-3500003956831a6d8',
|
||||||
|
'wwn-0x500003956831a6d8'],
|
||||||
'model': '',
|
'model': '',
|
||||||
'name': 'sda',
|
'name': 'sda',
|
||||||
'removable': '',
|
'removable': '',
|
||||||
'size': ' 200127266816 bytes'}}]},
|
'size': ' 200127266816 bytes'}}]},
|
||||||
{'uuid': '03000200-0400-0500-0006-000700080009',
|
{'uuid': '03000200-0400-0500-0006-000700080009',
|
||||||
'mac': '4c:09:b4:b2:79:8a',
|
'mac': '4c:09:b4:b2:79:8a',
|
||||||
'patch':[{'op': 'add',
|
'patch':
|
||||||
|
[{'op': 'add',
|
||||||
'path': '/disks/sda',
|
'path': '/disks/sda',
|
||||||
'value': {'disk': 'pci-0000:01:00.0-sas-0x500003956831a6da-lun-0',
|
'value':
|
||||||
'extra': ['scsi-3500003956831a6d8', 'wwn-0x500003956831a6d8'],
|
{'disk': 'pci-0000:01:00.0-sas-0x500003956831a6da-lun-0',
|
||||||
|
'extra': ['scsi-3500003956831a6d8',
|
||||||
|
'wwn-0x500003956831a6d8'],
|
||||||
'model': '',
|
'model': '',
|
||||||
'name': 'sda',
|
'name': 'sda',
|
||||||
'removable': '',
|
'removable': '',
|
||||||
|
@ -216,8 +224,11 @@ class FakeDiscoverHosts():
|
||||||
'mac': '4c:09:b4:b2:80:8a',
|
'mac': '4c:09:b4:b2:80:8a',
|
||||||
'patch': [{'op': 'add',
|
'patch': [{'op': 'add',
|
||||||
'path': '/disks/sda',
|
'path': '/disks/sda',
|
||||||
'value': {'disk': 'pci-0000:01:00.0-sas-0x500003956831a6da-lun-0',
|
'value':
|
||||||
'extra': ['scsi-3500003956831a6d8', 'wwn-0x500003956831a6d8'],
|
{'disk': 'pci-0000:01:00.0-sas-'
|
||||||
|
'0x500003956831a6da-lun-0',
|
||||||
|
'extra': ['scsi-3500003956831a6d8',
|
||||||
|
'wwn-0x500003956831a6d8'],
|
||||||
'model': '',
|
'model': '',
|
||||||
'name': 'sda',
|
'name': 'sda',
|
||||||
'removable': '',
|
'removable': '',
|
||||||
|
@ -229,13 +240,17 @@ class FakeDiscoverHosts():
|
||||||
'value': ' 1850020 kB',
|
'value': ' 1850020 kB',
|
||||||
'op': 'add'},
|
'op': 'add'},
|
||||||
{'path': '/memory/phy_memory_1',
|
{'path': '/memory/phy_memory_1',
|
||||||
'value': {'slots': ' 2',
|
'value':
|
||||||
'devices_1': {'frequency': '',
|
{'slots': ' 2',
|
||||||
'type': ' DIMM SDRAM',
|
'devices_1':
|
||||||
|
{'frequency': '',
|
||||||
|
'type':
|
||||||
|
' DIMM SDRAM',
|
||||||
'size': ' 4096 MB'},
|
'size': ' 4096 MB'},
|
||||||
'maximum_capacity': ' 4 GB',
|
'maximum_capacity': ' 4 GB',
|
||||||
'devices_2': {'frequency': ' 3 ns',
|
'devices_2': {'frequency': ' 3 ns',
|
||||||
'type': ' DIMM SDRAM',
|
'type':
|
||||||
|
' DIMM SDRAM',
|
||||||
'size': ' 8192 MB'}},
|
'size': ' 8192 MB'}},
|
||||||
'op': 'add'},
|
'op': 'add'},
|
||||||
]},
|
]},
|
||||||
|
@ -246,11 +261,13 @@ class FakeDiscoverHosts():
|
||||||
'op': 'add'},
|
'op': 'add'},
|
||||||
{'path': '/memory/phy_memory_1',
|
{'path': '/memory/phy_memory_1',
|
||||||
'value': {'slots': ' 3',
|
'value': {'slots': ' 3',
|
||||||
'devices_1': {'frequency': '',
|
'devices_1':
|
||||||
|
{'frequency': '',
|
||||||
'type': ' DIMM SDRAM',
|
'type': ' DIMM SDRAM',
|
||||||
'size': ' 4096 MB'},
|
'size': ' 4096 MB'},
|
||||||
'maximum_capacity': ' 4 GB',
|
'maximum_capacity': ' 4 GB',
|
||||||
'devices_2': {'frequency': ' 3 ns',
|
'devices_2': {
|
||||||
|
'frequency': ' 3 ns',
|
||||||
'type': ' DIMM SDRAM',
|
'type': ' DIMM SDRAM',
|
||||||
'size': ' 8192 MB'}},
|
'size': ' 8192 MB'}},
|
||||||
'op': 'add'},
|
'op': 'add'},
|
||||||
|
@ -262,17 +279,20 @@ class FakeDiscoverHosts():
|
||||||
'op': 'add'},
|
'op': 'add'},
|
||||||
{'path': '/memory/phy_memory_1',
|
{'path': '/memory/phy_memory_1',
|
||||||
'value': {'slots': ' 3',
|
'value': {'slots': ' 3',
|
||||||
'devices_1': {'frequency': '',
|
'devices_1': {
|
||||||
|
'frequency': '',
|
||||||
'type': ' DIMM SDRAM',
|
'type': ' DIMM SDRAM',
|
||||||
'size': ' 4096 MB'},
|
'size': ' 4096 MB'},
|
||||||
'maximum_capacity': ' 4 GB',
|
'maximum_capacity': ' 4 GB',
|
||||||
'devices_2': {'frequency': ' 3 ns',
|
'devices_2': {
|
||||||
|
'frequency': ' 3 ns',
|
||||||
'type': ' DIMM SDRAM',
|
'type': ' DIMM SDRAM',
|
||||||
'size': ' 8192 MB'}},
|
'size': ' 8192 MB'}},
|
||||||
'op': 'add'},
|
'op': 'add'},
|
||||||
]}]
|
]}]
|
||||||
|
|
||||||
ironic_cpu_data = [{'uuid':'03000200-0400-0500-0006-000700080009',
|
ironic_cpu_data = \
|
||||||
|
[{'uuid': '03000200-0400-0500-0006-000700080009',
|
||||||
'mac': '4c:09:b4:b2:78:8a',
|
'mac': '4c:09:b4:b2:78:8a',
|
||||||
'patch': [{'path': '/cpu/real',
|
'patch': [{'path': '/cpu/real',
|
||||||
'value': 1,
|
'value': 1,
|
||||||
|
@ -281,10 +301,14 @@ class FakeDiscoverHosts():
|
||||||
'value': 2,
|
'value': 2,
|
||||||
'op': 'add'},
|
'op': 'add'},
|
||||||
{'path': '/cpu/spec_1',
|
{'path': '/cpu/spec_1',
|
||||||
'value': {'model': ' Pentium(R) Dual-Core CPU E5700 @ 3.00GHz' , 'frequency': 3003},
|
'value': {'model': ' Pentium(R) Dual-Core CPU '
|
||||||
|
' E5700 @ 3.00GHz',
|
||||||
|
'frequency': 3003},
|
||||||
'op': 'add'},
|
'op': 'add'},
|
||||||
{'path': '/cpu/spec_2',
|
{'path': '/cpu/spec_2',
|
||||||
'value': {'model': ' Pentium(R) Dual-Core CPU E5700 @ 3.00GHz', 'frequency': 3003},
|
'value': {'model': ' Pentium(R) Dual-Core CPU '
|
||||||
|
' E5700 @ 3.00GHz',
|
||||||
|
'frequency': 3003},
|
||||||
'op': 'add'}
|
'op': 'add'}
|
||||||
]},
|
]},
|
||||||
{'uuid': '03000200-0400-0500-0006-000700080009',
|
{'uuid': '03000200-0400-0500-0006-000700080009',
|
||||||
|
@ -296,10 +320,15 @@ class FakeDiscoverHosts():
|
||||||
'value': 2,
|
'value': 2,
|
||||||
'op': 'add'},
|
'op': 'add'},
|
||||||
{'path': '/cpu/spec_1',
|
{'path': '/cpu/spec_1',
|
||||||
'value': {'model': ' Pentium(R) Dual-Core CPU E5700 @ 3.00GHz' , 'frequency': 3003},
|
'value':
|
||||||
|
{'model': ' Pentium(R) Dual-Core CPU '
|
||||||
|
' E5700 @ 3.00GHz',
|
||||||
|
'frequency': 3003},
|
||||||
'op': 'add'},
|
'op': 'add'},
|
||||||
{'path': '/cpu/spec_2',
|
{'path': '/cpu/spec_2',
|
||||||
'value': {'model': ' Pentium(R) Dual-Core CPU E5700 @ 3.00GHz', 'frequency': 3003},
|
'value': {'model': ' Pentium(R) Dual-Core CPU '
|
||||||
|
' E5700 @ 3.00GHz',
|
||||||
|
'frequency': 3003},
|
||||||
'op': 'add'}
|
'op': 'add'}
|
||||||
]},
|
]},
|
||||||
{'uuid': '03000200-0400-0500-0006-000700080009',
|
{'uuid': '03000200-0400-0500-0006-000700080009',
|
||||||
|
@ -311,9 +340,13 @@ class FakeDiscoverHosts():
|
||||||
'value': 2,
|
'value': 2,
|
||||||
'op': 'add'},
|
'op': 'add'},
|
||||||
{'path': '/cpu/spec_1',
|
{'path': '/cpu/spec_1',
|
||||||
'value': {'model': ' Pentium(R) Dual-Core CPU E5700 @ 3.00GHz' , 'frequency': 3003},
|
'value': {'model': ' Pentium(R) Dual-Core CPU '
|
||||||
|
' E5700 @ 3.00GHz',
|
||||||
|
'frequency': 3003},
|
||||||
'op': 'add'},
|
'op': 'add'},
|
||||||
{'path': '/cpu/spec_2',
|
{'path': '/cpu/spec_2',
|
||||||
'value': {'model': ' Pentium(R) Dual-Core CPU E5700 @ 3.00GHz', 'frequency': 3003},
|
'value': {'model': ' Pentium(R) Dual-Core CPU '
|
||||||
|
' E5700 @ 3.00GHz',
|
||||||
|
'frequency': 3003},
|
||||||
'op': 'add'}
|
'op': 'add'}
|
||||||
]}]
|
]}]
|
||||||
|
|
|
@ -28,7 +28,8 @@ class RemoteClient(object):
|
||||||
# NOTE(afazekas): It should always get an address instead of server
|
# NOTE(afazekas): It should always get an address instead of server
|
||||||
def __init__(self, server, username, password=None, pkey=None):
|
def __init__(self, server, username, password=None, pkey=None):
|
||||||
# zfl: use server's generated adminpass can't ssh,so
|
# zfl: use server's generated adminpass can't ssh,so
|
||||||
#if password is a generated one, use CONF.compute.image_ssh_password instead;
|
# if password is a generated one,
|
||||||
|
# use CONF.compute.image_ssh_password instead;
|
||||||
# if password is specified by use, just use it
|
# if password is specified by use, just use it
|
||||||
if password is not None and password.startswith('opencos'):
|
if password is not None and password.startswith('opencos'):
|
||||||
self.password = password[len('opencos'):]
|
self.password = password[len('opencos'):]
|
||||||
|
@ -44,7 +45,8 @@ class RemoteClient(object):
|
||||||
self.ip_address = server
|
self.ip_address = server
|
||||||
else:
|
else:
|
||||||
self.addresses = server['addresses'][network]
|
self.addresses = server['addresses'][network]
|
||||||
#zfl look for network backwards (first floating ip,then internal ip)
|
# zfl look for network backwards (first floating ip,then internal
|
||||||
|
# ip)
|
||||||
for address in self.addresses[::-1]:
|
for address in self.addresses[::-1]:
|
||||||
if address['version'] == self.ip_version:
|
if address['version'] == self.ip_version:
|
||||||
self.ip_address = address['addr']
|
self.ip_address = address['addr']
|
||||||
|
|
|
@ -27,7 +27,8 @@ def exectime(func):
|
||||||
def newfunc(*args, **args2):
|
def newfunc(*args, **args2):
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
f = func(*args, **args2)
|
f = func(*args, **args2)
|
||||||
print "\n\n@====exectime====%.3fs taken for {%s}\n\n" % (time.time() - t0, func.__name__)
|
print "\n\n@====exectime====%.3fs taken for {%s}\n\n" \
|
||||||
|
% (time.time() - t0, func.__name__)
|
||||||
return f
|
return f
|
||||||
return newfunc
|
return newfunc
|
||||||
# zfl add end
|
# zfl add end
|
||||||
|
@ -95,6 +96,7 @@ class TempestException(Exception):
|
||||||
# zfl add end: get related opencos log
|
# zfl add end: get related opencos log
|
||||||
return self._error_string
|
return self._error_string
|
||||||
|
|
||||||
|
|
||||||
class RestClientException(TempestException,
|
class RestClientException(TempestException,
|
||||||
testtools.TestCase.failureException):
|
testtools.TestCase.failureException):
|
||||||
pass
|
pass
|
||||||
|
@ -227,6 +229,7 @@ class InvalidStructure(TempestException):
|
||||||
|
|
||||||
|
|
||||||
class CommandFailed(Exception):
|
class CommandFailed(Exception):
|
||||||
|
|
||||||
def __init__(self, returncode, cmd, output, stderr):
|
def __init__(self, returncode, cmd, output, stderr):
|
||||||
super(CommandFailed, self).__init__()
|
super(CommandFailed, self).__init__()
|
||||||
self.returncode = returncode
|
self.returncode = returncode
|
||||||
|
|
|
@ -13,10 +13,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import copy
|
|
||||||
import errno
|
|
||||||
import json
|
import json
|
||||||
import os
|
|
||||||
import time
|
import time
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
|
@ -53,9 +50,6 @@ class DaisyClientJSON(service_client.ServiceClient):
|
||||||
self.dscv = disable_ssl_certificate_validation
|
self.dscv = disable_ssl_certificate_validation
|
||||||
self.ca_certs = ca_certs
|
self.ca_certs = ca_certs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _get_http(self):
|
def _get_http(self):
|
||||||
return glance_http.HTTPClient(auth_provider=self.auth_provider,
|
return glance_http.HTTPClient(auth_provider=self.auth_provider,
|
||||||
filters=self.filters,
|
filters=self.filters,
|
||||||
|
|
Loading…
Reference in New Issue