diff --git a/test/tempest/tempest/api/daisy/v1/fake/logical_network_fake.py b/test/tempest/tempest/api/daisy/v1/fake/logical_network_fake.py old mode 100755 new mode 100644 index f17e633b..b928ec2d --- a/test/tempest/tempest/api/daisy/v1/fake/logical_network_fake.py +++ b/test/tempest/tempest/api/daisy/v1/fake/logical_network_fake.py @@ -4,43 +4,44 @@ import uuid class FakeLogicNetwork(): # 1---------------------------------------------------------- + def fake_network_parameters(self): return { - 'base_mac': 'fa:16:3e:00:00:00', - 'gre_id_range': [2, 4094], - 'net_l23_provider': 'ovs', - 'public_vip': '172.16.0.3', - 'segmentation_type': 'vlan,flat,vxlan,gre', - 'vni_range': [2, 4094], - 'vlan_range': [2, 4094], + 'base_mac': 'fa:16:3e:00:00:00', + 'gre_id_range': [2, 4094], + 'net_l23_provider': 'ovs', + 'public_vip': '172.16.0.3', + 'segmentation_type': 'vlan,flat,vxlan,gre', + 'vni_range': [2, 4094], + 'vlan_range': [2, 4094], } def fake_logical_parameters(self, private_network): return [{ - 'name': 'internal1', - 'physnet_name': private_network.name, - 'segmentation_id': 200, - 'segmentation_type': 'vlan', - 'shared': True, - 'subnets': [{'cidr': '192.168.1.0/24', - 'dns_nameservers': ['8.8.4.4', - '8.8.8.8'], - 'floating_ranges': [['192.168.1.2', - '192.168.1.200']], - 'gateway': '192.168.1.1', - 'name': 'subnet2'}, - {'cidr': '172.16.1.0/24', - 'dns_nameservers': ['8.8.4.4', - '8.8.8.8'], - 'floating_ranges': [['172.16.1.130', - '172.16.1.150'], - ['172.16.1.151', - '172.16.1.254']], - 'gateway': '172.16.1.1', - 'name': 'subnet10'}], - 'type': 'internal'}, - {'name': 'flat1', - 'physnet_name': 'physnet1', + 'name': 'internal1', + 'physnet_name': private_network.name, + 'segmentation_id': 200, + 'segmentation_type': 'vlan', + 'shared': True, + 'subnets': [{'cidr': '192.168.1.0/24', + 'dns_nameservers': ['8.8.4.4', + '8.8.8.8'], + 'floating_ranges': [['192.168.1.2', + '192.168.1.200']], + 'gateway': '192.168.1.1', + 'name': 'subnet2'}, + {'cidr': '172.16.1.0/24', + 'dns_nameservers': ['8.8.4.4', + '8.8.8.8'], + 'floating_ranges': [['172.16.1.130', + '172.16.1.150'], + ['172.16.1.151', + '172.16.1.254']], + 'gateway': '172.16.1.1', + 'name': 'subnet10'}], + 'type': 'internal'}, + {'name': 'flat1', + 'physnet_name': 'physnet1', 'segmentation_type': 'flat', 'segmentation_id': -1, 'shared': True, @@ -51,16 +52,16 @@ class FakeLogicNetwork(): '192.168.2.254']], 'gateway': '192.168.2.1', 'name': 'subnet123'}], - 'type': 'external'} - ] + 'type': 'external'} + ] def fake_router_parameters(self): return [{ - 'description': 'router1', - 'external_logic_network': 'flat1', - 'name': 'router1', + 'description': 'router1', + 'external_logic_network': 'flat1', + 'name': 'router1', 'subnets': ['subnet2', 'subnet10']} - ] + ] def fake_cluster_parameters(self, private_network=None): networks = [] @@ -76,244 +77,276 @@ class FakeLogicNetwork(): # 2---------------------------------------------------------- def fake_logical_parameters2(self): return [{ - 'name': 'internal1', - 'physnet_name': 'phynet2', - 'segmentation_id': 200, - 'segmentation_type': 'vlan', - 'shared': True, - 'subnets': [], - 'type': 'internal'}] + 'name': 'internal1', + 'physnet_name': 'phynet2', + 'segmentation_id': 200, + 'segmentation_type': 'vlan', + 'shared': True, + 'subnets': [], + 'type': 'internal'}] def fake_subnet_parameters2(self): return [{'cidr': '192.168.1.0/24', - 'dns_nameservers': ['8.8.4.4', - '8.8.8.8'], - 'floating_ranges': [['192.168.1.2', - '192.168.1.200']], - 'gateway': '192.168.1.1', - 'name': 'subnet10'}, - {'cidr': '172.16.1.0/24', - 'dns_nameservers': ['8.8.4.4', - '8.8.8.8'], - 'floating_ranges': [['172.16.1.130', - '172.16.1.152'], - ['172.16.1.151', - '172.16.1.254']], - 'gateway': '172.16.1.1', - 'name': 'subnet10'}] - + 'dns_nameservers': ['8.8.4.4', + '8.8.8.8'], + 'floating_ranges': [['192.168.1.2', + '192.168.1.200']], + 'gateway': '192.168.1.1', + 'name': 'subnet10'}, + {'cidr': '172.16.1.0/24', + 'dns_nameservers': ['8.8.4.4', + '8.8.8.8'], + 'floating_ranges': [['172.16.1.130', + '172.16.1.152'], + ['172.16.1.151', + '172.16.1.254']], + 'gateway': '172.16.1.1', + 'name': 'subnet10'}] def fake_router_parameters2(self): return [{ - 'description': 'router1', - 'external_logic_network': 'flat1', - 'name': 'router1', + 'description': 'router1', + 'external_logic_network': 'flat1', + 'name': 'router1', 'subnets': ['subnet2', 'subnet10']}, { 'description': 'test', 'external_logic_network': 'flat1', 'name': 'router1', 'subnets': ['subnet123']} - ] + ] # 3------------------------------------------------------------- def fake_private_network_parameters(self): return { - 'name' : 'phynet2', - 'description' : 'phynet2', - 'network_type':'DATAPLANE', - 'type':'custom', - 'vlan_start':'101', - 'vlan_end':'1001', - 'ml2_type':'ovs' + 'name': 'phynet2', + 'description': 'phynet2', + 'network_type': 'DATAPLANE', + 'type': 'custom', + 'vlan_start': '101', + 'vlan_end': '1001', + 'ml2_type': 'ovs' } def fake_private_network_parameters1(self): return { - 'name' : 'phynet3', - 'description' : 'phynet3', - 'network_type':'DATAPLANE', - 'type':'custom', - 'vlan_start':'101', - 'vlan_end':'2000', - 'ml2_type':'ovs' + 'name': 'phynet3', + 'description': 'phynet3', + 'network_type': 'DATAPLANE', + 'type': 'custom', + 'vlan_start': '101', + 'vlan_end': '2000', + 'ml2_type': 'ovs' } def fake_private_network_parameters2(self): return { - 'name' : 'phynet1', - 'description' : 'phynet1', - 'network_type':'DATAPLANE', - 'type':'custom', - 'vlan_start':'101', - 'vlan_end':'2000', - 'ml2_type':'ovs' + 'name': 'phynet1', + 'description': 'phynet1', + 'network_type': 'DATAPLANE', + 'type': 'custom', + 'vlan_start': '101', + 'vlan_end': '2000', + 'ml2_type': 'ovs' } + class FakeDiscoverHosts(): # 1---------------------------------------------------------- daisy_data = [{'description': 'default', - 'name': '4c09b4b2788a', - 'ipmi_addr': '10.43.203.230', - 'ipmi_user':'albert', - 'ipmi_passwd':'superuser', - 'interfaces': [{'name': 'enp132s0f0', - "mac": '4c:09:b4:b2:78:8a', - "ip": '99.99.1.60', - 'is_deployment': 'True', - 'pci': '0000:84:00.0', - 'netmask': '255.255.255.0'}], - 'os_status': 'init', - 'dmi_uuid': '03000200-0400-0500-0006-000700080009'}, - {'description': 'default', - 'name': '4c09b4b2798a', - 'ipmi_addr': '10.43.203.231', - 'ipmi_user':'albert', - 'ipmi_passwd':'superuser', - 'interfaces': [{'name': 'enp132s0f0', - "mac": '4c:09:b4:b2:79:8a', - "ip": '99.99.1.61', - 'is_deployment': 'True', - 'pci': '0000:84:00.0', - 'netmask': '255.255.255.0'}], - 'os_status': 'init', - 'dmi_uuid': '03000200-0400-0500-0006-000700080009'}, - {'description': 'default', - 'name': '4c09b4b2808a', - 'ipmi_addr': '10.43.203.232', - 'ipmi_user':'albert', - 'ipmi_passwd':'superuser', - 'interfaces': [{'name': 'enp132s0f0', - "mac": '4c:09:b4:b2:80:8a', - "ip": '99.99.1.62', - 'is_deployment': 'True', - 'pci': '0000:84:00.0', - 'netmask': '255.255.255.0'}], - 'os_status': 'init', - 'dmi_uuid': '03000200-0400-0500-0006-000700080009'}] + 'name': '4c09b4b2788a', + 'ipmi_addr': '10.43.203.230', + 'ipmi_user': 'albert', + 'ipmi_passwd': 'superuser', + 'interfaces': [{'name': 'enp132s0f0', + "mac": '4c:09:b4:b2:78:8a', + "ip": '99.99.1.60', + 'is_deployment': 'True', + 'pci': '0000:84:00.0', + 'netmask': '255.255.255.0'}], + 'os_status': 'init', + 'dmi_uuid': '03000200-0400-0500-0006-000700080009'}, + {'description': 'default', + 'name': '4c09b4b2798a', + 'ipmi_addr': '10.43.203.231', + 'ipmi_user': 'albert', + 'ipmi_passwd': 'superuser', + 'interfaces': [{'name': 'enp132s0f0', + "mac": '4c:09:b4:b2:79:8a', + "ip": '99.99.1.61', + 'is_deployment': 'True', + 'pci': '0000:84:00.0', + 'netmask': '255.255.255.0'}], + 'os_status': 'init', + 'dmi_uuid': '03000200-0400-0500-0006-000700080009'}, + {'description': 'default', + 'name': '4c09b4b2808a', + 'ipmi_addr': '10.43.203.232', + 'ipmi_user': 'albert', + 'ipmi_passwd': 'superuser', + 'interfaces': [{'name': 'enp132s0f0', + "mac": '4c:09:b4:b2:80:8a', + "ip": '99.99.1.62', + 'is_deployment': 'True', + 'pci': '0000:84:00.0', + 'netmask': '255.255.255.0'}], + 'os_status': 'init', + 'dmi_uuid': '03000200-0400-0500-0006-000700080009'}] - ironic_disk_data = [{'uuid':'03000200-0400-0500-0006-000700080009', - 'mac': '4c:09:b4:b2:78:8a', - 'patch':[{'op': 'add', - 'path': '/disks/sda', - 'value': {'disk': 'pci-0000:01:00.0-sas-0x500003956831a6da-lun-0', - 'extra': ['scsi-3500003956831a6d8', 'wwn-0x500003956831a6d8'], - 'model': '', - 'name': 'sda', - 'removable': '', - 'size': ' 200127266816 bytes'}}]}, - {'uuid':'03000200-0400-0500-0006-000700080009', - 'mac': '4c:09:b4:b2:79:8a', - 'patch':[{'op': 'add', - 'path': '/disks/sda', - 'value': {'disk': 'pci-0000:01:00.0-sas-0x500003956831a6da-lun-0', - 'extra': ['scsi-3500003956831a6d8', 'wwn-0x500003956831a6d8'], - 'model': '', - 'name': 'sda', - 'removable': '', - 'size': ' 200127266816 bytes'}}]}, - {'uuid':'03000200-0400-0500-0006-000700080009', - 'mac': '4c:09:b4:b2:80:8a', - 'patch':[{'op': 'add', - 'path': '/disks/sda', - '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', + ironic_disk_data = \ + [{'uuid': '03000200-0400-0500-0006-000700080009', + 'mac': '4c:09:b4:b2:78:8a', + 'patch': [{'op': 'add', + 'path': '/disks/sda', + 'value': { + 'disk': + 'pci-0000:01:00.0-sas-0x500003956831a6da-lun-0', + 'extra': ['scsi-3500003956831a6d8', + 'wwn-0x500003956831a6d8'], + 'model': '', + 'name': 'sda', + 'removable': '', + 'size': ' 200127266816 bytes'}}]}, + {'uuid': '03000200-0400-0500-0006-000700080009', + 'mac': '4c:09:b4:b2:79:8a', + 'patch': + [{'op': 'add', + 'path': '/disks/sda', + 'value': + {'disk': 'pci-0000:01:00.0-sas-0x500003956831a6da-lun-0', + 'extra': ['scsi-3500003956831a6d8', + 'wwn-0x500003956831a6d8'], + 'model': '', + 'name': 'sda', + 'removable': '', + 'size': ' 200127266816 bytes'}}]}, + {'uuid': '03000200-0400-0500-0006-000700080009', + 'mac': '4c:09:b4:b2:80:8a', + 'patch': [{'op': 'add', + 'path': '/disks/sda', + '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', - 'patch':[{'path': '/memory/total', - 'value': ' 1850020 kB', - 'op': 'add'}, - {'path': '/memory/phy_memory_1', - 'value': {'slots': ' 2', - 'devices_1': {'frequency': '', - 'type': ' DIMM SDRAM', - 'size': ' 4096 MB'}, - 'maximum_capacity': ' 4 GB', - 'devices_2': {'frequency': ' 3 ns', - 'type': ' DIMM SDRAM', - 'size': ' 8192 MB'}}, - 'op': 'add'}, - ]}, - {'uuid':'03000200-0400-0500-0006-000700080009', - 'mac': '4c:09:b4:b2:79:8a', - 'patch':[{'path': '/memory/total', - 'value': ' 1850020 kB', - 'op': 'add'}, - {'path': '/memory/phy_memory_1', - 'value': {'slots': ' 3', - 'devices_1': {'frequency': '', - 'type': ' DIMM SDRAM', - 'size': ' 4096 MB'}, - 'maximum_capacity': ' 4 GB', - 'devices_2': {'frequency': ' 3 ns', - 'type': ' DIMM SDRAM', - 'size': ' 8192 MB'}}, - 'op': 'add'}, - ]}, - {'uuid':'03000200-0400-0500-0006-000700080009', - 'mac': '4c:09:b4:b2:80:8a', - 'patch':[{'path': '/memory/total', - 'value': ' 1850020 kB', - 'op': 'add'}, - {'path': '/memory/phy_memory_1', - 'value': {'slots': ' 3', - 'devices_1': {'frequency': '', - 'type': ' DIMM SDRAM', - 'size': ' 4096 MB'}, - 'maximum_capacity': ' 4 GB', - 'devices_2': {'frequency': ' 3 ns', - 'type': ' DIMM SDRAM', - 'size': ' 8192 MB'}}, - 'op': 'add'}, - ]}] - - ironic_cpu_data = [{'uuid':'03000200-0400-0500-0006-000700080009', - 'mac': '4c:09:b4:b2:78: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'} - ]}, - {'uuid':'03000200-0400-0500-0006-000700080009', - 'mac': '4c:09:b4:b2:79: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'} - ]}, - {'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'} - ]}] + 'patch': [{'path': '/memory/total', + 'value': ' 1850020 kB', + 'op': 'add'}, + {'path': '/memory/phy_memory_1', + 'value': + {'slots': ' 2', + 'devices_1': + {'frequency': '', + 'type': + ' DIMM SDRAM', + 'size': ' 4096 MB'}, + 'maximum_capacity': ' 4 GB', + 'devices_2': {'frequency': ' 3 ns', + 'type': + ' DIMM SDRAM', + 'size': ' 8192 MB'}}, + 'op': 'add'}, + ]}, + {'uuid': '03000200-0400-0500-0006-000700080009', + 'mac': '4c:09:b4:b2:79:8a', + 'patch': [{'path': '/memory/total', + 'value': ' 1850020 kB', + 'op': 'add'}, + {'path': '/memory/phy_memory_1', + 'value': {'slots': ' 3', + 'devices_1': + {'frequency': '', + 'type': ' DIMM SDRAM', + 'size': ' 4096 MB'}, + 'maximum_capacity': ' 4 GB', + 'devices_2': { + 'frequency': ' 3 ns', + 'type': ' DIMM SDRAM', + 'size': ' 8192 MB'}}, + 'op': 'add'}, + ]}, + {'uuid': '03000200-0400-0500-0006-000700080009', + 'mac': '4c:09:b4:b2:80:8a', + 'patch': [{'path': '/memory/total', + 'value': ' 1850020 kB', + 'op': 'add'}, + {'path': '/memory/phy_memory_1', + 'value': {'slots': ' 3', + 'devices_1': { + 'frequency': '', + 'type': ' DIMM SDRAM', + 'size': ' 4096 MB'}, + 'maximum_capacity': ' 4 GB', + 'devices_2': { + 'frequency': ' 3 ns', + 'type': ' DIMM SDRAM', + 'size': ' 8192 MB'}}, + 'op': 'add'}, + ]}] + + ironic_cpu_data = \ + [{'uuid': '03000200-0400-0500-0006-000700080009', + 'mac': '4c:09:b4:b2:78: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'} + ]}, + {'uuid': '03000200-0400-0500-0006-000700080009', + 'mac': '4c:09:b4:b2:79: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'} + ]}, + {'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'} + ]}] diff --git a/test/tempest/tempest/api_schema/response/compute/migrations.py b/test/tempest/tempest/api_schema/response/compute/migrations.py index e57e0a54..c38492ad 100644 --- a/test/tempest/tempest/api_schema/response/compute/migrations.py +++ b/test/tempest/tempest/api_schema/response/compute/migrations.py @@ -30,8 +30,8 @@ list_migrations = { 'dest_node': {'type': 'string'}, 'dest_compute': {'type': 'string'}, 'dest_host': {'type': 'string'}, - #zfl : tecs 1.0 old_instance_type_id is None - #'old_instance_type_id': {'type': 'integer'}, + # zfl : tecs 1.0 old_instance_type_id is None + # 'old_instance_type_id': {'type': 'integer'}, 'new_instance_type_id': {'type': 'integer'}, 'created_at': {'type': 'string'}, 'updated_at': {'type': ['string', 'null']} diff --git a/test/tempest/tempest/common/utils/linux/remote_client.py b/test/tempest/tempest/common/utils/linux/remote_client.py index 1624fadd..30a2132a 100644 --- a/test/tempest/tempest/common/utils/linux/remote_client.py +++ b/test/tempest/tempest/common/utils/linux/remote_client.py @@ -27,16 +27,17 @@ class RemoteClient(object): # NOTE(afazekas): It should always get an address instead of server def __init__(self, server, username, password=None, pkey=None): - #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 specified by use, just use it + # 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 specified by use, just use it if password is not None and password.startswith('opencos'): - self.password = password[len('opencos'):] + self.password = password[len('opencos'):] else: self.password = CONF.compute.image_ssh_password - + 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 self.ip_version = CONF.compute.ip_version_for_ssh self.ssh_channel_timeout = CONF.compute.ssh_channel_timeout @@ -44,7 +45,8 @@ class RemoteClient(object): self.ip_address = server else: 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]: if address['version'] == self.ip_version: self.ip_address = address['addr'] diff --git a/test/tempest/tempest/exceptions.py b/test/tempest/tempest/exceptions.py index f1eec92e..f52744d2 100644 --- a/test/tempest/tempest/exceptions.py +++ b/test/tempest/tempest/exceptions.py @@ -23,11 +23,12 @@ from tempest_lib.common.utils import misc # zfl add a decorator to show func's exec time -def exectime(func): - def newfunc(*args, **args2): +def exectime(func): + def newfunc(*args, **args2): t0 = time.time() 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 newfunc # zfl add end @@ -61,39 +62,40 @@ class TempestException(Exception): def __str__(self): # zfl add : get related opencos log - try: - # zfl for debug only: stop and reserve - # if issubclass(type(self),SSHTimeout): - # import time - # time.sleep(999999999) - # zfl for debug only: stop and reserve end + try: + # zfl for debug only: stop and reserve + # if issubclass(type(self),SSHTimeout): + # import time + # time.sleep(999999999) + # zfl for debug only: stop and reserve end - self.get_log = True - log_obj = misc.GetOpenCosLog() - pattern1 = re.compile(r'\w+-\w+-\w+-\w+-\w+') - sresult = pattern1.findall(self._error_string) - obj_type = "" - if 'server' in self._error_string.lower(): - obj_type = "server" - if sresult: - log_result = log_obj.get_opencos_log(sresult, - obj_type=obj_type) - else: - log_result = log_obj.get_opencos_log([], - obj_type=obj_type) - log_result = "\n--------- \n" + log_result - self._error_string = self._error_string + \ - "\n\n\n===possible log ===" + \ - log_result + \ - "\n\n===possiblelog end===\n\n\n" - except Exception as e: - print "ZTE ===zfl : error ==" , e - traceback.print_exc() + self.get_log = True + log_obj = misc.GetOpenCosLog() + pattern1 = re.compile(r'\w+-\w+-\w+-\w+-\w+') + sresult = pattern1.findall(self._error_string) + obj_type = "" + if 'server' in self._error_string.lower(): + obj_type = "server" + if sresult: + log_result = log_obj.get_opencos_log(sresult, + obj_type=obj_type) + else: + log_result = log_obj.get_opencos_log([], + obj_type=obj_type) + log_result = "\n--------- \n" + log_result + self._error_string = self._error_string + \ + "\n\n\n===possible log ===" + \ + log_result + \ + "\n\n===possiblelog end===\n\n\n" + except Exception as e: + print "ZTE ===zfl : error ==", e + traceback.print_exc() # else: # print "\n========zfl,exception call __str__ again" - - #zfl add end: get related opencos log - return self._error_string + + # zfl add end: get related opencos log + return self._error_string + class RestClientException(TempestException, testtools.TestCase.failureException): @@ -227,6 +229,7 @@ class InvalidStructure(TempestException): class CommandFailed(Exception): + def __init__(self, returncode, cmd, output, stderr): super(CommandFailed, self).__init__() self.returncode = returncode diff --git a/test/tempest/tempest/services/compute/json/servers_client.py b/test/tempest/tempest/services/compute/json/servers_client.py index 975ccff3..5f2a194d 100644 --- a/test/tempest/tempest/services/compute/json/servers_client.py +++ b/test/tempest/tempest/services/compute/json/servers_client.py @@ -71,7 +71,7 @@ class ServersClientJSON(service_client.ServiceClient): # zfl add boot from volume if image_ref == "": post_body.pop('imageRef') - # zfl add boot from volume end + # zfl add boot from volume end # zfl add config_drive for option in ['personality', 'adminPass', 'key_name', @@ -95,7 +95,7 @@ class ServersClientJSON(service_client.ServiceClient): else: if key == "networks": netid = CONF.network.internal_network_id - post_body['networks'] = [{'uuid': netid}] + post_body['networks'] = [{'uuid': netid}] # zfl add end if 'host' in kwargs: post_body['availability_zone'] = kwargs.get('host') @@ -105,7 +105,7 @@ class ServersClientJSON(service_client.ServiceClient): if 'sched_hints' in kwargs: hints = {'os:scheduler_hints': kwargs.get('sched_hints')} post_body = dict(post_body.items() + hints.items()) - + if 'uuid' in kwargs: networks = {'networks': [kwargs.get('uuid')]} 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. """ resp, body = self.get('/'.join(['servers', server_id, - 'os-virtual-interfaces'])) + 'os-virtual-interfaces'])) body = json.loads(body) self.validate_response(schema.list_virtual_interfaces, resp, body) return service_client.ResponseBody(resp, body) diff --git a/test/tempest/tempest/services/daisy/v1/json/daisy_client.py b/test/tempest/tempest/services/daisy/v1/json/daisy_client.py index c72ffdbe..94d68b47 100644 --- a/test/tempest/tempest/services/daisy/v1/json/daisy_client.py +++ b/test/tempest/tempest/services/daisy/v1/json/daisy_client.py @@ -13,10 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import copy -import errno import json -import os import time import urllib @@ -53,9 +50,6 @@ class DaisyClientJSON(service_client.ServiceClient): self.dscv = disable_ssl_certificate_validation self.ca_certs = ca_certs - - - def _get_http(self): return glance_http.HTTPClient(auth_provider=self.auth_provider, filters=self.filters, diff --git a/test/tempest/tempest/services/identity/v2/json/token_client.py b/test/tempest/tempest/services/identity/v2/json/token_client.py index be416659..898709a1 100644 --- a/test/tempest/tempest/services/identity/v2/json/token_client.py +++ b/test/tempest/tempest/services/identity/v2/json/token_client.py @@ -85,7 +85,7 @@ class TokenClientJSON(rest_client.RestClient): resp, resp_body = self.raw_request(url, method, 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]: resp_body = json.loads(resp_body)