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,43 +4,44 @@ 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',
|
||||||
'gre_id_range': [2, 4094],
|
'gre_id_range': [2, 4094],
|
||||||
'net_l23_provider': 'ovs',
|
'net_l23_provider': 'ovs',
|
||||||
'public_vip': '172.16.0.3',
|
'public_vip': '172.16.0.3',
|
||||||
'segmentation_type': 'vlan,flat,vxlan,gre',
|
'segmentation_type': 'vlan,flat,vxlan,gre',
|
||||||
'vni_range': [2, 4094],
|
'vni_range': [2, 4094],
|
||||||
'vlan_range': [2, 4094],
|
'vlan_range': [2, 4094],
|
||||||
}
|
}
|
||||||
|
|
||||||
def fake_logical_parameters(self, private_network):
|
def fake_logical_parameters(self, private_network):
|
||||||
return [{
|
return [{
|
||||||
'name': 'internal1',
|
'name': 'internal1',
|
||||||
'physnet_name': private_network.name,
|
'physnet_name': private_network.name,
|
||||||
'segmentation_id': 200,
|
'segmentation_id': 200,
|
||||||
'segmentation_type': 'vlan',
|
'segmentation_type': 'vlan',
|
||||||
'shared': True,
|
'shared': True,
|
||||||
'subnets': [{'cidr': '192.168.1.0/24',
|
'subnets': [{'cidr': '192.168.1.0/24',
|
||||||
'dns_nameservers': ['8.8.4.4',
|
'dns_nameservers': ['8.8.4.4',
|
||||||
'8.8.8.8'],
|
'8.8.8.8'],
|
||||||
'floating_ranges': [['192.168.1.2',
|
'floating_ranges': [['192.168.1.2',
|
||||||
'192.168.1.200']],
|
'192.168.1.200']],
|
||||||
'gateway': '192.168.1.1',
|
'gateway': '192.168.1.1',
|
||||||
'name': 'subnet2'},
|
'name': 'subnet2'},
|
||||||
{'cidr': '172.16.1.0/24',
|
{'cidr': '172.16.1.0/24',
|
||||||
'dns_nameservers': ['8.8.4.4',
|
'dns_nameservers': ['8.8.4.4',
|
||||||
'8.8.8.8'],
|
'8.8.8.8'],
|
||||||
'floating_ranges': [['172.16.1.130',
|
'floating_ranges': [['172.16.1.130',
|
||||||
'172.16.1.150'],
|
'172.16.1.150'],
|
||||||
['172.16.1.151',
|
['172.16.1.151',
|
||||||
'172.16.1.254']],
|
'172.16.1.254']],
|
||||||
'gateway': '172.16.1.1',
|
'gateway': '172.16.1.1',
|
||||||
'name': 'subnet10'}],
|
'name': 'subnet10'}],
|
||||||
'type': 'internal'},
|
'type': 'internal'},
|
||||||
{'name': 'flat1',
|
{'name': 'flat1',
|
||||||
'physnet_name': 'physnet1',
|
'physnet_name': 'physnet1',
|
||||||
'segmentation_type': 'flat',
|
'segmentation_type': 'flat',
|
||||||
'segmentation_id': -1,
|
'segmentation_id': -1,
|
||||||
'shared': True,
|
'shared': True,
|
||||||
|
@ -51,16 +52,16 @@ class FakeLogicNetwork():
|
||||||
'192.168.2.254']],
|
'192.168.2.254']],
|
||||||
'gateway': '192.168.2.1',
|
'gateway': '192.168.2.1',
|
||||||
'name': 'subnet123'}],
|
'name': 'subnet123'}],
|
||||||
'type': 'external'}
|
'type': 'external'}
|
||||||
]
|
]
|
||||||
|
|
||||||
def fake_router_parameters(self):
|
def fake_router_parameters(self):
|
||||||
return [{
|
return [{
|
||||||
'description': 'router1',
|
'description': 'router1',
|
||||||
'external_logic_network': 'flat1',
|
'external_logic_network': 'flat1',
|
||||||
'name': 'router1',
|
'name': 'router1',
|
||||||
'subnets': ['subnet2', 'subnet10']}
|
'subnets': ['subnet2', 'subnet10']}
|
||||||
]
|
]
|
||||||
|
|
||||||
def fake_cluster_parameters(self, private_network=None):
|
def fake_cluster_parameters(self, private_network=None):
|
||||||
networks = []
|
networks = []
|
||||||
|
@ -76,244 +77,276 @@ class FakeLogicNetwork():
|
||||||
# 2----------------------------------------------------------
|
# 2----------------------------------------------------------
|
||||||
def fake_logical_parameters2(self):
|
def fake_logical_parameters2(self):
|
||||||
return [{
|
return [{
|
||||||
'name': 'internal1',
|
'name': 'internal1',
|
||||||
'physnet_name': 'phynet2',
|
'physnet_name': 'phynet2',
|
||||||
'segmentation_id': 200,
|
'segmentation_id': 200,
|
||||||
'segmentation_type': 'vlan',
|
'segmentation_type': 'vlan',
|
||||||
'shared': True,
|
'shared': True,
|
||||||
'subnets': [],
|
'subnets': [],
|
||||||
'type': 'internal'}]
|
'type': 'internal'}]
|
||||||
|
|
||||||
def fake_subnet_parameters2(self):
|
def fake_subnet_parameters2(self):
|
||||||
return [{'cidr': '192.168.1.0/24',
|
return [{'cidr': '192.168.1.0/24',
|
||||||
'dns_nameservers': ['8.8.4.4',
|
'dns_nameservers': ['8.8.4.4',
|
||||||
'8.8.8.8'],
|
'8.8.8.8'],
|
||||||
'floating_ranges': [['192.168.1.2',
|
'floating_ranges': [['192.168.1.2',
|
||||||
'192.168.1.200']],
|
'192.168.1.200']],
|
||||||
'gateway': '192.168.1.1',
|
'gateway': '192.168.1.1',
|
||||||
'name': 'subnet10'},
|
'name': 'subnet10'},
|
||||||
{'cidr': '172.16.1.0/24',
|
{'cidr': '172.16.1.0/24',
|
||||||
'dns_nameservers': ['8.8.4.4',
|
'dns_nameservers': ['8.8.4.4',
|
||||||
'8.8.8.8'],
|
'8.8.8.8'],
|
||||||
'floating_ranges': [['172.16.1.130',
|
'floating_ranges': [['172.16.1.130',
|
||||||
'172.16.1.152'],
|
'172.16.1.152'],
|
||||||
['172.16.1.151',
|
['172.16.1.151',
|
||||||
'172.16.1.254']],
|
'172.16.1.254']],
|
||||||
'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',
|
||||||
'external_logic_network': 'flat1',
|
'external_logic_network': 'flat1',
|
||||||
'name': 'router1',
|
'name': 'router1',
|
||||||
'subnets': ['subnet2', 'subnet10']},
|
'subnets': ['subnet2', 'subnet10']},
|
||||||
{
|
{
|
||||||
'description': 'test',
|
'description': 'test',
|
||||||
'external_logic_network': 'flat1',
|
'external_logic_network': 'flat1',
|
||||||
'name': 'router1',
|
'name': 'router1',
|
||||||
'subnets': ['subnet123']}
|
'subnets': ['subnet123']}
|
||||||
]
|
]
|
||||||
|
|
||||||
# 3-------------------------------------------------------------
|
# 3-------------------------------------------------------------
|
||||||
def fake_private_network_parameters(self):
|
def fake_private_network_parameters(self):
|
||||||
return {
|
return {
|
||||||
'name' : 'phynet2',
|
'name': 'phynet2',
|
||||||
'description' : 'phynet2',
|
'description': 'phynet2',
|
||||||
'network_type':'DATAPLANE',
|
'network_type': 'DATAPLANE',
|
||||||
'type':'custom',
|
'type': 'custom',
|
||||||
'vlan_start':'101',
|
'vlan_start': '101',
|
||||||
'vlan_end':'1001',
|
'vlan_end': '1001',
|
||||||
'ml2_type':'ovs'
|
'ml2_type': 'ovs'
|
||||||
}
|
}
|
||||||
|
|
||||||
def fake_private_network_parameters1(self):
|
def fake_private_network_parameters1(self):
|
||||||
return {
|
return {
|
||||||
'name' : 'phynet3',
|
'name': 'phynet3',
|
||||||
'description' : 'phynet3',
|
'description': 'phynet3',
|
||||||
'network_type':'DATAPLANE',
|
'network_type': 'DATAPLANE',
|
||||||
'type':'custom',
|
'type': 'custom',
|
||||||
'vlan_start':'101',
|
'vlan_start': '101',
|
||||||
'vlan_end':'2000',
|
'vlan_end': '2000',
|
||||||
'ml2_type':'ovs'
|
'ml2_type': 'ovs'
|
||||||
}
|
}
|
||||||
|
|
||||||
def fake_private_network_parameters2(self):
|
def fake_private_network_parameters2(self):
|
||||||
return {
|
return {
|
||||||
'name' : 'phynet1',
|
'name': 'phynet1',
|
||||||
'description' : 'phynet1',
|
'description': 'phynet1',
|
||||||
'network_type':'DATAPLANE',
|
'network_type': 'DATAPLANE',
|
||||||
'type':'custom',
|
'type': 'custom',
|
||||||
'vlan_start':'101',
|
'vlan_start': '101',
|
||||||
'vlan_end':'2000',
|
'vlan_end': '2000',
|
||||||
'ml2_type':'ovs'
|
'ml2_type': 'ovs'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class FakeDiscoverHosts():
|
class FakeDiscoverHosts():
|
||||||
# 1----------------------------------------------------------
|
# 1----------------------------------------------------------
|
||||||
daisy_data = [{'description': 'default',
|
daisy_data = [{'description': 'default',
|
||||||
'name': '4c09b4b2788a',
|
'name': '4c09b4b2788a',
|
||||||
'ipmi_addr': '10.43.203.230',
|
'ipmi_addr': '10.43.203.230',
|
||||||
'ipmi_user':'albert',
|
'ipmi_user': 'albert',
|
||||||
'ipmi_passwd':'superuser',
|
'ipmi_passwd': 'superuser',
|
||||||
'interfaces': [{'name': 'enp132s0f0',
|
'interfaces': [{'name': 'enp132s0f0',
|
||||||
"mac": '4c:09:b4:b2:78:8a',
|
"mac": '4c:09:b4:b2:78:8a',
|
||||||
"ip": '99.99.1.60',
|
"ip": '99.99.1.60',
|
||||||
'is_deployment': 'True',
|
'is_deployment': 'True',
|
||||||
'pci': '0000:84:00.0',
|
'pci': '0000:84:00.0',
|
||||||
'netmask': '255.255.255.0'}],
|
'netmask': '255.255.255.0'}],
|
||||||
'os_status': 'init',
|
'os_status': 'init',
|
||||||
'dmi_uuid': '03000200-0400-0500-0006-000700080009'},
|
'dmi_uuid': '03000200-0400-0500-0006-000700080009'},
|
||||||
{'description': 'default',
|
{'description': 'default',
|
||||||
'name': '4c09b4b2798a',
|
'name': '4c09b4b2798a',
|
||||||
'ipmi_addr': '10.43.203.231',
|
'ipmi_addr': '10.43.203.231',
|
||||||
'ipmi_user':'albert',
|
'ipmi_user': 'albert',
|
||||||
'ipmi_passwd':'superuser',
|
'ipmi_passwd': 'superuser',
|
||||||
'interfaces': [{'name': 'enp132s0f0',
|
'interfaces': [{'name': 'enp132s0f0',
|
||||||
"mac": '4c:09:b4:b2:79:8a',
|
"mac": '4c:09:b4:b2:79:8a',
|
||||||
"ip": '99.99.1.61',
|
"ip": '99.99.1.61',
|
||||||
'is_deployment': 'True',
|
'is_deployment': 'True',
|
||||||
'pci': '0000:84:00.0',
|
'pci': '0000:84:00.0',
|
||||||
'netmask': '255.255.255.0'}],
|
'netmask': '255.255.255.0'}],
|
||||||
'os_status': 'init',
|
'os_status': 'init',
|
||||||
'dmi_uuid': '03000200-0400-0500-0006-000700080009'},
|
'dmi_uuid': '03000200-0400-0500-0006-000700080009'},
|
||||||
{'description': 'default',
|
{'description': 'default',
|
||||||
'name': '4c09b4b2808a',
|
'name': '4c09b4b2808a',
|
||||||
'ipmi_addr': '10.43.203.232',
|
'ipmi_addr': '10.43.203.232',
|
||||||
'ipmi_user':'albert',
|
'ipmi_user': 'albert',
|
||||||
'ipmi_passwd':'superuser',
|
'ipmi_passwd': 'superuser',
|
||||||
'interfaces': [{'name': 'enp132s0f0',
|
'interfaces': [{'name': 'enp132s0f0',
|
||||||
"mac": '4c:09:b4:b2:80:8a',
|
"mac": '4c:09:b4:b2:80:8a',
|
||||||
"ip": '99.99.1.62',
|
"ip": '99.99.1.62',
|
||||||
'is_deployment': 'True',
|
'is_deployment': 'True',
|
||||||
'pci': '0000:84:00.0',
|
'pci': '0000:84:00.0',
|
||||||
'netmask': '255.255.255.0'}],
|
'netmask': '255.255.255.0'}],
|
||||||
'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 = \
|
||||||
'mac': '4c:09:b4:b2:78:8a',
|
[{'uuid': '03000200-0400-0500-0006-000700080009',
|
||||||
'patch':[{'op': 'add',
|
'mac': '4c:09:b4:b2:78:8a',
|
||||||
'path': '/disks/sda',
|
'patch': [{'op': 'add',
|
||||||
'value': {'disk': 'pci-0000:01:00.0-sas-0x500003956831a6da-lun-0',
|
'path': '/disks/sda',
|
||||||
'extra': ['scsi-3500003956831a6d8', 'wwn-0x500003956831a6d8'],
|
'value': {
|
||||||
'model': '',
|
'disk':
|
||||||
'name': 'sda',
|
'pci-0000:01:00.0-sas-0x500003956831a6da-lun-0',
|
||||||
'removable': '',
|
'extra': ['scsi-3500003956831a6d8',
|
||||||
'size': ' 200127266816 bytes'}}]},
|
'wwn-0x500003956831a6d8'],
|
||||||
{'uuid':'03000200-0400-0500-0006-000700080009',
|
'model': '',
|
||||||
'mac': '4c:09:b4:b2:79:8a',
|
'name': 'sda',
|
||||||
'patch':[{'op': 'add',
|
'removable': '',
|
||||||
'path': '/disks/sda',
|
'size': ' 200127266816 bytes'}}]},
|
||||||
'value': {'disk': 'pci-0000:01:00.0-sas-0x500003956831a6da-lun-0',
|
{'uuid': '03000200-0400-0500-0006-000700080009',
|
||||||
'extra': ['scsi-3500003956831a6d8', 'wwn-0x500003956831a6d8'],
|
'mac': '4c:09:b4:b2:79:8a',
|
||||||
'model': '',
|
'patch':
|
||||||
'name': 'sda',
|
[{'op': 'add',
|
||||||
'removable': '',
|
'path': '/disks/sda',
|
||||||
'size': ' 200127266816 bytes'}}]},
|
'value':
|
||||||
{'uuid':'03000200-0400-0500-0006-000700080009',
|
{'disk': 'pci-0000:01:00.0-sas-0x500003956831a6da-lun-0',
|
||||||
'mac': '4c:09:b4:b2:80:8a',
|
'extra': ['scsi-3500003956831a6d8',
|
||||||
'patch':[{'op': 'add',
|
'wwn-0x500003956831a6d8'],
|
||||||
'path': '/disks/sda',
|
'model': '',
|
||||||
'value': {'disk': 'pci-0000:01:00.0-sas-0x500003956831a6da-lun-0',
|
'name': 'sda',
|
||||||
'extra': ['scsi-3500003956831a6d8', 'wwn-0x500003956831a6d8'],
|
'removable': '',
|
||||||
'model': '',
|
'size': ' 200127266816 bytes'}}]},
|
||||||
'name': 'sda',
|
{'uuid': '03000200-0400-0500-0006-000700080009',
|
||||||
'removable': '',
|
'mac': '4c:09:b4:b2:80:8a',
|
||||||
'size': ' 200127266816 bytes'}}]}]
|
'patch': [{'op': 'add',
|
||||||
|
'path': '/disks/sda',
|
||||||
ironic_memory_data = [{'uuid':'03000200-0400-0500-0006-000700080009',
|
'value':
|
||||||
|
{'disk': 'pci-0000:01:00.0-sas-'
|
||||||
|
'0x500003956831a6da-lun-0',
|
||||||
|
'extra': ['scsi-3500003956831a6d8',
|
||||||
|
'wwn-0x500003956831a6d8'],
|
||||||
|
'model': '',
|
||||||
|
'name': 'sda',
|
||||||
|
'removable': '',
|
||||||
|
'size': ' 200127266816 bytes'}}]}]
|
||||||
|
|
||||||
|
ironic_memory_data = [{'uuid': '03000200-0400-0500-0006-000700080009',
|
||||||
'mac': '4c:09:b4:b2:78:8a',
|
'mac': '4c:09:b4:b2:78:8a',
|
||||||
'patch':[{'path': '/memory/total',
|
'patch': [{'path': '/memory/total',
|
||||||
'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':
|
||||||
'size': ' 4096 MB'},
|
{'frequency': '',
|
||||||
'maximum_capacity': ' 4 GB',
|
'type':
|
||||||
'devices_2': {'frequency': ' 3 ns',
|
' DIMM SDRAM',
|
||||||
'type': ' DIMM SDRAM',
|
'size': ' 4096 MB'},
|
||||||
'size': ' 8192 MB'}},
|
'maximum_capacity': ' 4 GB',
|
||||||
'op': 'add'},
|
'devices_2': {'frequency': ' 3 ns',
|
||||||
]},
|
'type':
|
||||||
{'uuid':'03000200-0400-0500-0006-000700080009',
|
' DIMM SDRAM',
|
||||||
'mac': '4c:09:b4:b2:79:8a',
|
'size': ' 8192 MB'}},
|
||||||
'patch':[{'path': '/memory/total',
|
'op': 'add'},
|
||||||
'value': ' 1850020 kB',
|
]},
|
||||||
'op': 'add'},
|
{'uuid': '03000200-0400-0500-0006-000700080009',
|
||||||
{'path': '/memory/phy_memory_1',
|
'mac': '4c:09:b4:b2:79:8a',
|
||||||
'value': {'slots': ' 3',
|
'patch': [{'path': '/memory/total',
|
||||||
'devices_1': {'frequency': '',
|
'value': ' 1850020 kB',
|
||||||
'type': ' DIMM SDRAM',
|
'op': 'add'},
|
||||||
'size': ' 4096 MB'},
|
{'path': '/memory/phy_memory_1',
|
||||||
'maximum_capacity': ' 4 GB',
|
'value': {'slots': ' 3',
|
||||||
'devices_2': {'frequency': ' 3 ns',
|
'devices_1':
|
||||||
'type': ' DIMM SDRAM',
|
{'frequency': '',
|
||||||
'size': ' 8192 MB'}},
|
'type': ' DIMM SDRAM',
|
||||||
'op': 'add'},
|
'size': ' 4096 MB'},
|
||||||
]},
|
'maximum_capacity': ' 4 GB',
|
||||||
{'uuid':'03000200-0400-0500-0006-000700080009',
|
'devices_2': {
|
||||||
'mac': '4c:09:b4:b2:80:8a',
|
'frequency': ' 3 ns',
|
||||||
'patch':[{'path': '/memory/total',
|
'type': ' DIMM SDRAM',
|
||||||
'value': ' 1850020 kB',
|
'size': ' 8192 MB'}},
|
||||||
'op': 'add'},
|
'op': 'add'},
|
||||||
{'path': '/memory/phy_memory_1',
|
]},
|
||||||
'value': {'slots': ' 3',
|
{'uuid': '03000200-0400-0500-0006-000700080009',
|
||||||
'devices_1': {'frequency': '',
|
'mac': '4c:09:b4:b2:80:8a',
|
||||||
'type': ' DIMM SDRAM',
|
'patch': [{'path': '/memory/total',
|
||||||
'size': ' 4096 MB'},
|
'value': ' 1850020 kB',
|
||||||
'maximum_capacity': ' 4 GB',
|
'op': 'add'},
|
||||||
'devices_2': {'frequency': ' 3 ns',
|
{'path': '/memory/phy_memory_1',
|
||||||
'type': ' DIMM SDRAM',
|
'value': {'slots': ' 3',
|
||||||
'size': ' 8192 MB'}},
|
'devices_1': {
|
||||||
'op': 'add'},
|
'frequency': '',
|
||||||
]}]
|
'type': ' DIMM SDRAM',
|
||||||
|
'size': ' 4096 MB'},
|
||||||
ironic_cpu_data = [{'uuid':'03000200-0400-0500-0006-000700080009',
|
'maximum_capacity': ' 4 GB',
|
||||||
'mac': '4c:09:b4:b2:78:8a',
|
'devices_2': {
|
||||||
'patch':[{'path': '/cpu/real',
|
'frequency': ' 3 ns',
|
||||||
'value': 1,
|
'type': ' DIMM SDRAM',
|
||||||
'op': 'add'},
|
'size': ' 8192 MB'}},
|
||||||
{'path': '/cpu/total',
|
'op': 'add'},
|
||||||
'value': 2,
|
]}]
|
||||||
'op': 'add'},
|
|
||||||
{'path': '/cpu/spec_1',
|
ironic_cpu_data = \
|
||||||
'value': {'model': ' Pentium(R) Dual-Core CPU E5700 @ 3.00GHz' , 'frequency': 3003},
|
[{'uuid': '03000200-0400-0500-0006-000700080009',
|
||||||
'op': 'add'},
|
'mac': '4c:09:b4:b2:78:8a',
|
||||||
{'path': '/cpu/spec_2',
|
'patch': [{'path': '/cpu/real',
|
||||||
'value': {'model': ' Pentium(R) Dual-Core CPU E5700 @ 3.00GHz', 'frequency': 3003},
|
'value': 1,
|
||||||
'op': 'add'}
|
'op': 'add'},
|
||||||
]},
|
{'path': '/cpu/total',
|
||||||
{'uuid':'03000200-0400-0500-0006-000700080009',
|
'value': 2,
|
||||||
'mac': '4c:09:b4:b2:79:8a',
|
'op': 'add'},
|
||||||
'patch':[{'path': '/cpu/real',
|
{'path': '/cpu/spec_1',
|
||||||
'value': 1,
|
'value': {'model': ' Pentium(R) Dual-Core CPU '
|
||||||
'op': 'add'},
|
' E5700 @ 3.00GHz',
|
||||||
{'path': '/cpu/total',
|
'frequency': 3003},
|
||||||
'value': 2,
|
'op': 'add'},
|
||||||
'op': 'add'},
|
{'path': '/cpu/spec_2',
|
||||||
{'path': '/cpu/spec_1',
|
'value': {'model': ' Pentium(R) Dual-Core CPU '
|
||||||
'value': {'model': ' Pentium(R) Dual-Core CPU E5700 @ 3.00GHz' , 'frequency': 3003},
|
' E5700 @ 3.00GHz',
|
||||||
'op': 'add'},
|
'frequency': 3003},
|
||||||
{'path': '/cpu/spec_2',
|
'op': 'add'}
|
||||||
'value': {'model': ' Pentium(R) Dual-Core CPU E5700 @ 3.00GHz', 'frequency': 3003},
|
]},
|
||||||
'op': 'add'}
|
{'uuid': '03000200-0400-0500-0006-000700080009',
|
||||||
]},
|
'mac': '4c:09:b4:b2:79:8a',
|
||||||
{'uuid':'03000200-0400-0500-0006-000700080009',
|
'patch': [{'path': '/cpu/real',
|
||||||
'mac': '4c:09:b4:b2:80:8a',
|
'value': 1,
|
||||||
'patch':[{'path': '/cpu/real',
|
'op': 'add'},
|
||||||
'value': 1,
|
{'path': '/cpu/total',
|
||||||
'op': 'add'},
|
'value': 2,
|
||||||
{'path': '/cpu/total',
|
'op': 'add'},
|
||||||
'value': 2,
|
{'path': '/cpu/spec_1',
|
||||||
'op': 'add'},
|
'value':
|
||||||
{'path': '/cpu/spec_1',
|
{'model': ' Pentium(R) Dual-Core CPU '
|
||||||
'value': {'model': ' Pentium(R) Dual-Core CPU E5700 @ 3.00GHz' , 'frequency': 3003},
|
' E5700 @ 3.00GHz',
|
||||||
'op': 'add'},
|
'frequency': 3003},
|
||||||
{'path': '/cpu/spec_2',
|
'op': 'add'},
|
||||||
'value': {'model': ' Pentium(R) Dual-Core CPU E5700 @ 3.00GHz', 'frequency': 3003},
|
{'path': '/cpu/spec_2',
|
||||||
'op': 'add'}
|
'value': {'model': ' Pentium(R) Dual-Core CPU '
|
||||||
]}]
|
' E5700 @ 3.00GHz',
|
||||||
|
'frequency': 3003},
|
||||||
|
'op': 'add'}
|
||||||
|
]},
|
||||||
|
{'uuid': '03000200-0400-0500-0006-000700080009',
|
||||||
|
'mac': '4c:09:b4:b2:80:8a',
|
||||||
|
'patch': [{'path': '/cpu/real',
|
||||||
|
'value': 1,
|
||||||
|
'op': 'add'},
|
||||||
|
{'path': '/cpu/total',
|
||||||
|
'value': 2,
|
||||||
|
'op': 'add'},
|
||||||
|
{'path': '/cpu/spec_1',
|
||||||
|
'value': {'model': ' Pentium(R) Dual-Core CPU '
|
||||||
|
' E5700 @ 3.00GHz',
|
||||||
|
'frequency': 3003},
|
||||||
|
'op': 'add'},
|
||||||
|
{'path': '/cpu/spec_2',
|
||||||
|
'value': {'model': ' Pentium(R) Dual-Core CPU '
|
||||||
|
' E5700 @ 3.00GHz',
|
||||||
|
'frequency': 3003},
|
||||||
|
'op': 'add'}
|
||||||
|
]}]
|
||||||
|
|
|
@ -30,8 +30,8 @@ list_migrations = {
|
||||||
'dest_node': {'type': 'string'},
|
'dest_node': {'type': 'string'},
|
||||||
'dest_compute': {'type': 'string'},
|
'dest_compute': {'type': 'string'},
|
||||||
'dest_host': {'type': 'string'},
|
'dest_host': {'type': 'string'},
|
||||||
#zfl : tecs 1.0 old_instance_type_id is None
|
# zfl : tecs 1.0 old_instance_type_id is None
|
||||||
#'old_instance_type_id': {'type': 'integer'},
|
# 'old_instance_type_id': {'type': 'integer'},
|
||||||
'new_instance_type_id': {'type': 'integer'},
|
'new_instance_type_id': {'type': 'integer'},
|
||||||
'created_at': {'type': 'string'},
|
'created_at': {'type': 'string'},
|
||||||
'updated_at': {'type': ['string', 'null']}
|
'updated_at': {'type': ['string', 'null']}
|
||||||
|
|
|
@ -27,16 +27,17 @@ 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,
|
||||||
#if password is specified by use, just use it
|
# use CONF.compute.image_ssh_password instead;
|
||||||
|
# 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'):]
|
||||||
else:
|
else:
|
||||||
self.password = CONF.compute.image_ssh_password
|
self.password = CONF.compute.image_ssh_password
|
||||||
|
|
||||||
self.ssh_timeout = CONF.compute.ssh_timeout
|
self.ssh_timeout = CONF.compute.ssh_timeout
|
||||||
#network = CONF.compute.network_for_ssh
|
# network = CONF.compute.network_for_ssh
|
||||||
network = CONF.compute.fixed_network_name
|
network = CONF.compute.fixed_network_name
|
||||||
self.ip_version = CONF.compute.ip_version_for_ssh
|
self.ip_version = CONF.compute.ip_version_for_ssh
|
||||||
self.ssh_channel_timeout = CONF.compute.ssh_channel_timeout
|
self.ssh_channel_timeout = CONF.compute.ssh_channel_timeout
|
||||||
|
@ -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']
|
||||||
|
|
|
@ -23,11 +23,12 @@ from tempest_lib.common.utils import misc
|
||||||
|
|
||||||
|
|
||||||
# zfl add a decorator to show func's exec time
|
# zfl add a decorator to show func's exec time
|
||||||
def exectime(func):
|
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
|
||||||
|
@ -61,39 +62,40 @@ class TempestException(Exception):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
# zfl add : get related opencos log
|
# zfl add : get related opencos log
|
||||||
try:
|
try:
|
||||||
# zfl for debug only: stop and reserve
|
# zfl for debug only: stop and reserve
|
||||||
# if issubclass(type(self),SSHTimeout):
|
# if issubclass(type(self),SSHTimeout):
|
||||||
# import time
|
# import time
|
||||||
# time.sleep(999999999)
|
# time.sleep(999999999)
|
||||||
# zfl for debug only: stop and reserve end
|
# zfl for debug only: stop and reserve end
|
||||||
|
|
||||||
self.get_log = True
|
self.get_log = True
|
||||||
log_obj = misc.GetOpenCosLog()
|
log_obj = misc.GetOpenCosLog()
|
||||||
pattern1 = re.compile(r'\w+-\w+-\w+-\w+-\w+')
|
pattern1 = re.compile(r'\w+-\w+-\w+-\w+-\w+')
|
||||||
sresult = pattern1.findall(self._error_string)
|
sresult = pattern1.findall(self._error_string)
|
||||||
obj_type = ""
|
obj_type = ""
|
||||||
if 'server' in self._error_string.lower():
|
if 'server' in self._error_string.lower():
|
||||||
obj_type = "server"
|
obj_type = "server"
|
||||||
if sresult:
|
if sresult:
|
||||||
log_result = log_obj.get_opencos_log(sresult,
|
log_result = log_obj.get_opencos_log(sresult,
|
||||||
obj_type=obj_type)
|
obj_type=obj_type)
|
||||||
else:
|
else:
|
||||||
log_result = log_obj.get_opencos_log([],
|
log_result = log_obj.get_opencos_log([],
|
||||||
obj_type=obj_type)
|
obj_type=obj_type)
|
||||||
log_result = "\n--------- <logs>\n" + log_result
|
log_result = "\n--------- <logs>\n" + log_result
|
||||||
self._error_string = self._error_string + \
|
self._error_string = self._error_string + \
|
||||||
"\n\n\n===possible log ===" + \
|
"\n\n\n===possible log ===" + \
|
||||||
log_result + \
|
log_result + \
|
||||||
"\n\n===possiblelog end===\n\n\n"
|
"\n\n===possiblelog end===\n\n\n"
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print "ZTE ===zfl : error ==" , e
|
print "ZTE ===zfl : error ==", e
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
# else:
|
# else:
|
||||||
# print "\n========zfl,exception call __str__ again"
|
# print "\n========zfl,exception call __str__ again"
|
||||||
|
|
||||||
#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):
|
||||||
|
@ -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
|
||||||
|
|
|
@ -71,7 +71,7 @@ class ServersClientJSON(service_client.ServiceClient):
|
||||||
# zfl add boot from volume
|
# zfl add boot from volume
|
||||||
if image_ref == "":
|
if image_ref == "":
|
||||||
post_body.pop('imageRef')
|
post_body.pop('imageRef')
|
||||||
# zfl add boot from volume end
|
# zfl add boot from volume end
|
||||||
|
|
||||||
# zfl add config_drive
|
# zfl add config_drive
|
||||||
for option in ['personality', 'adminPass', 'key_name',
|
for option in ['personality', 'adminPass', 'key_name',
|
||||||
|
@ -95,7 +95,7 @@ class ServersClientJSON(service_client.ServiceClient):
|
||||||
else:
|
else:
|
||||||
if key == "networks":
|
if key == "networks":
|
||||||
netid = CONF.network.internal_network_id
|
netid = CONF.network.internal_network_id
|
||||||
post_body['networks'] = [{'uuid': netid}]
|
post_body['networks'] = [{'uuid': netid}]
|
||||||
# zfl add end
|
# zfl add end
|
||||||
if 'host' in kwargs:
|
if 'host' in kwargs:
|
||||||
post_body['availability_zone'] = kwargs.get('host')
|
post_body['availability_zone'] = kwargs.get('host')
|
||||||
|
@ -105,7 +105,7 @@ class ServersClientJSON(service_client.ServiceClient):
|
||||||
if 'sched_hints' in kwargs:
|
if 'sched_hints' in kwargs:
|
||||||
hints = {'os:scheduler_hints': kwargs.get('sched_hints')}
|
hints = {'os:scheduler_hints': kwargs.get('sched_hints')}
|
||||||
post_body = dict(post_body.items() + hints.items())
|
post_body = dict(post_body.items() + hints.items())
|
||||||
|
|
||||||
if 'uuid' in kwargs:
|
if 'uuid' in kwargs:
|
||||||
networks = {'networks': [kwargs.get('uuid')]}
|
networks = {'networks': [kwargs.get('uuid')]}
|
||||||
post_body = dict(post_body.items() + networks.items())
|
post_body = dict(post_body.items() + networks.items())
|
||||||
|
@ -503,7 +503,7 @@ class ServersClientJSON(service_client.ServiceClient):
|
||||||
List the virtual interfaces used in an instance.
|
List the virtual interfaces used in an instance.
|
||||||
"""
|
"""
|
||||||
resp, body = self.get('/'.join(['servers', server_id,
|
resp, body = self.get('/'.join(['servers', server_id,
|
||||||
'os-virtual-interfaces']))
|
'os-virtual-interfaces']))
|
||||||
body = json.loads(body)
|
body = json.loads(body)
|
||||||
self.validate_response(schema.list_virtual_interfaces, resp, body)
|
self.validate_response(schema.list_virtual_interfaces, resp, body)
|
||||||
return service_client.ResponseBody(resp, body)
|
return service_client.ResponseBody(resp, body)
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -85,7 +85,7 @@ class TokenClientJSON(rest_client.RestClient):
|
||||||
|
|
||||||
resp, resp_body = self.raw_request(url, method,
|
resp, resp_body = self.raw_request(url, method,
|
||||||
headers=headers, body=body)
|
headers=headers, body=body)
|
||||||
self._log_request(method, url, resp, req_body=body) #zfl add
|
self._log_request(method, url, resp, req_body=body) # zfl add
|
||||||
|
|
||||||
if resp.status in [401, 403]:
|
if resp.status in [401, 403]:
|
||||||
resp_body = json.loads(resp_body)
|
resp_body = json.loads(resp_body)
|
||||||
|
|
Loading…
Reference in New Issue