Deal with flake8 [E501].

Change-Id: I55e254b2bf9c16b0bdc50bd6810e682dc6dddabf
This commit is contained in:
KongWei 2016-07-25 07:19:54 +00:00
parent 16bab84b20
commit f7127cbd6a
10 changed files with 657 additions and 444 deletions

View File

@ -167,7 +167,8 @@ class BaseDaisyTest(tempest.test.BaseTestCase):
@classmethod
def get_discover_host_detail(self, host_meta):
host_detail = self.daisy_client.hosts.get_discover_host_detail(host_meta)
host_detail = self.daisy_client.hosts.get_discover_host_detail(
host_meta)
return host_detail
@classmethod
@ -178,7 +179,8 @@ class BaseDaisyTest(tempest.test.BaseTestCase):
@classmethod
def _clean_all_discover_host(self):
host_meta = {}
hosts_list_generator = self.daisy_client.hosts.list_discover_host(**host_meta)
hosts_list_generator = self.daisy_client.hosts.list_discover_host(
**host_meta)
hosts_list = [hosts for hosts in hosts_list_generator]
if hosts_list:
for host in hosts_list:
@ -315,7 +317,9 @@ class BaseDaisyTest(tempest.test.BaseTestCase):
@classmethod
def cluster_config_set_progress(self, **config_set):
config_set = self.daisy_client.config_sets.cluster_config_set_progress(**config_set)
config_set = \
self.daisy_client.config_sets.cluster_config_set_progress(
**config_set)
return config_set
@classmethod
@ -344,7 +348,8 @@ class BaseDaisyTest(tempest.test.BaseTestCase):
@classmethod
def _clean_all_config_set(self):
config_set_list_generator = self.daisy_client.config_sets.list()
config_set_list = [config_set for config_set in config_set_list_generator]
config_set_list = [config_set for config_set
in config_set_list_generator]
if config_set_list:
for config_set in config_set_list:
self.daisy_client.config_sets.delete(config_set.id)
@ -375,7 +380,8 @@ class BaseDaisyTest(tempest.test.BaseTestCase):
@classmethod
def _clean_all_config_file(self):
config_file_list_generator = self.daisy_client.config_files.list()
config_file_list = [config_file for config_file in config_file_list_generator]
config_file_list = [config_file for config_file
in config_file_list_generator]
if config_file_list:
for config_file in config_file_list:
self.daisy_client.config_files.delete(config_file.id)
@ -438,7 +444,9 @@ class BaseDaisyTest(tempest.test.BaseTestCase):
@classmethod
def update_cinder_volume(self, cinder_volume_id, **cinder_volume_meta):
cinder_volume_info = self.daisy_client.disk_array.cinder_volume_update(cinder_volume_id, **cinder_volume_meta)
cinder_volume_info = self.daisy_client.\
disk_array.cinder_volume_update(cinder_volume_id,
**cinder_volume_meta)
return cinder_volume_info
@classmethod
@ -454,7 +462,8 @@ class BaseDaisyTest(tempest.test.BaseTestCase):
@classmethod
def get_cinder_volume_detail(self, cinder_volume_id):
cinder_volume_info = self.daisy_client.disk_array.cinder_volume_detail(cinder_volume_id)
cinder_volume_info = self.daisy_client.\
disk_array.cinder_volume_detail(cinder_volume_id)
return cinder_volume_info
@classmethod
@ -482,13 +491,15 @@ class BaseDaisyTest(tempest.test.BaseTestCase):
@classmethod
def get_service_disk_detail(self, service_disk_id):
service_disk_detail = self.daisy_client.disk_array.service_disk_detail(service_disk_id)
service_disk_detail = self.daisy_client.\
disk_array.service_disk_detail(service_disk_id)
return service_disk_detail
@classmethod
def _clean_all_physical_node(self):
physical_node_list_generator = self.ironic_client.physical_node.list()
physical_node_list = [physical_node for physical_node in physical_node_list_generator]
physical_node_list = [physical_node for physical_node
in physical_node_list_generator]
if physical_node_list:
for physical_node in physical_node_list:
self.ironic_client.physical_node.delete(physical_node.uuid)
@ -525,7 +536,8 @@ class BaseDaisyTest(tempest.test.BaseTestCase):
@classmethod
def import_json_to_template(self, **kwargs):
template = self.daisy_client.template.import_json_to_template(**kwargs)
template = \
self.daisy_client.template.import_json_to_template(**kwargs)
return template
@classmethod
@ -553,7 +565,8 @@ class BaseDaisyTest(tempest.test.BaseTestCase):
@classmethod
def host_template_list(self, **kwargs):
host_templates = self.daisy_client.template.host_template_list(**kwargs)
host_templates = \
self.daisy_client.template.host_template_list(**kwargs)
return host_templates
@classmethod

View File

@ -15,12 +15,13 @@ class DaisyCinderVolumeTest(base.BaseDaisyTest):
super(DaisyCinderVolumeTest, cls).resource_setup()
cls.fake = logical_fake()
cls.cinder_volume_add_meta = {'disk_array': [{'management_ips': '10.43.177.1,10.43.177.2',
'pools': 'pool1,pool2',
'user_name': 'rooot',
'user_pwd': 'pwd',
'volume_driver': 'KS3200_FCSAN',
'volume_type': 'KISP-1'}]}
cls.cinder_volume_add_meta = \
{'disk_array': [{'management_ips': '10.43.177.1,10.43.177.2',
'pools': 'pool1,pool2',
'user_name': 'rooot',
'user_pwd': 'pwd',
'volume_driver': 'KS3200_FCSAN',
'volume_type': 'KISP-1'}]}
cls.cinder_volume_update_meta = {'management_ips': '10.43.177.3',
'pools': 'pool3',
@ -29,80 +30,87 @@ class DaisyCinderVolumeTest(base.BaseDaisyTest):
'volume_driver': 'KS3200_FCSAN',
'volume_type': 'KISP-1'}
cls.cluster_meta = {'description': 'desc',
'logic_networks': [{'name': 'external1',
'physnet_name': 'phynet2',
'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': 'external'},
{'name': 'internal2',
'physnet_name': 'phynet1',
'segmentation_id': 1023,
'segmentation_type': 'vxlan',
'shared': True,
'subnets': [{'cidr': '192.168.2.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.2.130',
'192.168.2.254']],
'gateway': '192.168.2.1',
'name': 'subnet123'}],
'type': 'internal'},
{'name': 'internal1',
'physnet_name': 'phynet3',
'segmentation_id': '777',
'segmentation_type': 'vlan',
'shared': False,
'subnets': [{'cidr': '192.168.31.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.31.130',
'192.168.31.254']],
'gateway': '192.168.31.1',
'name': 'subnet3'},
{'cidr': '192.168.4.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.4.130',
'192.168.4.254']],
'gateway': '192.168.4.1',
'name': 'subnet4'}],
'type': 'internal'}],
'name': 'test',
'networking_parameters': {'base_mac': 'fa:16:3e:00:00:00',
'gre_id_range': [2, 2000],
'net_l23_provider': 'ovs',
'public_vip': '172.16.0.3',
'segmentation_type': 'vlan,vxlan',
'vlan_range': [2, 4094],
'vni_range': [1000, 1030]},
'networks': [],
'nodes': [],
'routers': [{'description': 'router1',
'external_logic_network': 'external1',
'name': 'router1',
'subnets': ['subnet4', 'subnet3', 'subnet2']},
{'description': 'router2',
'external_logic_network': 'external1',
'name': 'router2',
'subnets': ['subnet10']}]}
cls.cluster_meta = \
{'description': 'desc',
'logic_networks': [{'name': 'external1',
'physnet_name': 'phynet2',
'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': 'external'},
{'name': 'internal2',
'physnet_name': 'phynet1',
'segmentation_id': 1023,
'segmentation_type': 'vxlan',
'shared': True,
'subnets': [{'cidr': '192.168.2.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges':
[['192.168.2.130',
'192.168.2.254']],
'gateway': '192.168.2.1',
'name': 'subnet123'}],
'type': 'internal'},
{'name': 'internal1',
'physnet_name': 'phynet3',
'segmentation_id': '777',
'segmentation_type': 'vlan',
'shared': False,
'subnets': [{'cidr': '192.168.31.0/24',
'dns_nameservers':
['8.8.4.4',
'8.8.8.8'],
'floating_ranges':
[['192.168.31.130',
'192.168.31.254']],
'gateway': '192.168.31.1',
'name': 'subnet3'},
{'cidr': '192.168.4.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges':
[['192.168.4.130',
'192.168.4.254']],
'gateway': '192.168.4.1',
'name': 'subnet4'}],
'type': 'internal'}],
'name': 'test',
'networking_parameters': {'base_mac': 'fa:16:3e:00:00:00',
'gre_id_range': [2, 2000],
'net_l23_provider': 'ovs',
'public_vip': '172.16.0.3',
'segmentation_type': 'vlan,vxlan',
'vlan_range': [2, 4094],
'vni_range': [1000, 1030]},
'networks': [],
'nodes': [],
'routers': [{'description': 'router1',
'external_logic_network': 'external1',
'name': 'router1',
'subnets': ['subnet4', 'subnet3', 'subnet2']},
{'description': 'router2',
'external_logic_network': 'external1',
'name': 'router2',
'subnets': ['subnet10']}]}
cls.role_meta = {'name': 'test_role',
'description': 'test'}
@ -139,7 +147,8 @@ class DaisyCinderVolumeTest(base.BaseDaisyTest):
role = self.add_role(**self.role_meta)
self.cinder_volume_add_meta['role_id'] = role.id
cinder_volume_info = self.add_cinder_volume(**self.cinder_volume_add_meta)
cinder_volume_info = self.add_cinder_volume(
**self.cinder_volume_add_meta)
self.assertEqual('10.43.177.1,10.43.177.2',
cinder_volume_info.management_ips,
"test_add_cinder_volume failed")
@ -153,7 +162,8 @@ class DaisyCinderVolumeTest(base.BaseDaisyTest):
self.cinder_volume_add_meta['role_id'] = role.id
self.cinder_volume_add_meta['role_id']
cinder_volume_info = self.add_cinder_volume(**self.cinder_volume_add_meta)
cinder_volume_info = self.add_cinder_volume(
**self.cinder_volume_add_meta)
self.assertRaisesMessage(client_exc.HTTPBadRequest,
"400 Bad Request: cinder_volume array disks "
"conflict with cinder_volume %s (HTTP 400)" %
@ -163,7 +173,8 @@ class DaisyCinderVolumeTest(base.BaseDaisyTest):
self.delete_cinder_volume(cinder_volume_info.id)
def test_add_cinder_volume_with_wrong_role(self):
self.cinder_volume_add_meta['role_id'] = 'af47d81c-7ae4-4148-a801-b4a5c6a52074'
self.cinder_volume_add_meta['role_id'] = \
'af47d81c-7ae4-4148-a801-b4a5c6a52074'
self.assertRaisesMessage(client_exc.HTTPNotFound,
"404 Not Found: The resource could not be "
@ -180,7 +191,8 @@ class DaisyCinderVolumeTest(base.BaseDaisyTest):
self.role_meta['cluster_id'] = cluster_info.id
role = self.add_role(**self.role_meta)
self.cinder_volume_add_meta['role_id'] = role.id
self.cinder_volume_add_meta['disk_array'][0]['volume_driver'] = 'test_driver'
self.cinder_volume_add_meta['disk_array'][0]['volume_driver'] = \
'test_driver'
self.assertRaisesMessage(client_exc.HTTPBadRequest,
"400 Bad Request: volume_driver test_driver "
@ -188,7 +200,8 @@ class DaisyCinderVolumeTest(base.BaseDaisyTest):
self.add_cinder_volume,
**self.cinder_volume_add_meta)
del self.cinder_volume_add_meta['role_id']
self.cinder_volume_add_meta['disk_array'][0]['volume_driver'] = 'KS3200_FCSAN'
self.cinder_volume_add_meta['disk_array'][0]['volume_driver'] = \
'KS3200_FCSAN'
def test_update_cinder_volume(self):
self.private_network_add()
@ -196,9 +209,12 @@ class DaisyCinderVolumeTest(base.BaseDaisyTest):
self.role_meta['cluster_id'] = cluster_info.id
role = self.add_role(**self.role_meta)
self.cinder_volume_add_meta['role_id'] = role.id
cinder_volume_info = self.add_cinder_volume(**self.cinder_volume_add_meta)
cinder_volume_info = self.add_cinder_volume(
**self.cinder_volume_add_meta)
cinder_volume_update_info = self.update_cinder_volume(cinder_volume_info.id, **self.cinder_volume_update_meta)
cinder_volume_update_info = self.update_cinder_volume(
cinder_volume_info.id,
**self.cinder_volume_update_meta)
self.assertEqual('10.43.177.3',
cinder_volume_update_info.management_ips,
"test_update_cinder_volume failed")
@ -210,17 +226,20 @@ class DaisyCinderVolumeTest(base.BaseDaisyTest):
self.role_meta['cluster_id'] = cluster_info.id
role = self.add_role(**self.role_meta)
self.cinder_volume_add_meta['role_id'] = role.id
cinder_volume_info = self.add_cinder_volume(**self.cinder_volume_add_meta)
cinder_volume_info = self.add_cinder_volume(
**self.cinder_volume_add_meta)
cinder_volume_add_meta1 = {'disk_array': [{'management_ips':
'10.43.177.3,10.43.177.4',
'pools': 'pool1,pool2',
'user_name': 'rooot',
'user_pwd': 'pwd',
'volume_driver': 'KS3200_FCSAN',
'volume_type': 'KISP-1'}]}
cinder_volume_add_meta1 = {'disk_array':
[{'management_ips':
'10.43.177.3,10.43.177.4',
'pools': 'pool1,pool2',
'user_name': 'rooot',
'user_pwd': 'pwd',
'volume_driver': 'KS3200_FCSAN',
'volume_type': 'KISP-1'}]}
cinder_volume_add_meta1['role_id'] = role.id
cinder_volume_info1 = self.add_cinder_volume(**cinder_volume_add_meta1)
cinder_volume_info1 = self.add_cinder_volume(
**cinder_volume_add_meta1)
update_meta = {'management_ips': '10.43.177.1,10.43.177.2'}
self.assertRaisesMessage(
client_exc.HTTPBadRequest,
@ -239,7 +258,8 @@ class DaisyCinderVolumeTest(base.BaseDaisyTest):
self.role_meta['cluster_id'] = cluster_info.id
role = self.add_role(**self.role_meta)
self.cinder_volume_add_meta['role_id'] = role.id
cinder_volume_info = self.add_cinder_volume(**self.cinder_volume_add_meta)
cinder_volume_info = self.add_cinder_volume(
**self.cinder_volume_add_meta)
update_meta = {'volume_driver': 'test_driver'}
self.assertRaisesMessage(
@ -255,12 +275,14 @@ class DaisyCinderVolumeTest(base.BaseDaisyTest):
self.role_meta['cluster_id'] = cluster_info.id
role = self.add_role(**self.role_meta)
self.cinder_volume_add_meta['role_id'] = role.id
cinder_volume_info = self.add_cinder_volume(**self.cinder_volume_add_meta)
cinder_volume_info = self.add_cinder_volume(
**self.cinder_volume_add_meta)
cinder_volume_meta = {}
cinder_volume_flag = False
list_cinder_volume = self.list_cinder_volume(**cinder_volume_meta)
query_cinder_volume_list = [volume_info for volume_info in list_cinder_volume]
query_cinder_volume_list = [volume_info for volume_info
in list_cinder_volume]
if query_cinder_volume_list:
cinder_volume_flag = True
@ -273,9 +295,11 @@ class DaisyCinderVolumeTest(base.BaseDaisyTest):
self.role_meta['cluster_id'] = cluster_info.id
role = self.add_role(**self.role_meta)
self.cinder_volume_add_meta['role_id'] = role.id
cinder_volume_info = self.add_cinder_volume(**self.cinder_volume_add_meta)
cinder_volume_info = self.add_cinder_volume(
**self.cinder_volume_add_meta)
cinder_volume_detail_info = self.get_cinder_volume_detail(cinder_volume_info.id)
cinder_volume_detail_info = self.get_cinder_volume_detail(
cinder_volume_info.id)
self.assertEqual("10.43.177.1,10.43.177.2",
cinder_volume_detail_info.management_ips,
"test_get_cinder_volume_detail failed")

View File

@ -37,65 +37,67 @@ class TecsClusterTest(base.BaseDaisyTest):
cls.cluster_meta1 = {'description': 'desc',
'name': 'test'}
cls.cluster_meta2 = {'description': 'desc',
'logic_networks': [{'name': 'external1',
'physnet_name': 'phynet2',
'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']],
'gateway': '172.16.1.1',
'name': 'subnet10'}],
'type': 'external'},
{'name': 'internal1',
'physnet_name': 'phynet1',
'segmentation_id': '777',
'segmentation_type': 'vlan',
'shared': False,
'subnets': [{'cidr': '192.168.31.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.31.130',
'192.168.31.254']],
'gateway': '192.168.31.1',
'name': 'subnet3'},
{'cidr': '192.168.4.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.4.130',
'192.168.4.254']],
'gateway': '192.168.4.1',
'name': 'subnet4'}],
'type': 'internal'}],
'name': 'test',
'networking_parameters': {'base_mac': 'fa:16:3e:00:00:00',
'gre_id_range': [2, 2000],
'net_l23_provider': 'ovs',
'public_vip': '172.16.0.3',
'segmentation_type': 'vlan,vxlan',
'vlan_range': [2, 4094],
'vni_range': [1000, 1030]},
'networks': [],
'nodes': [],
'routers': [{'description': 'router1',
'external_logic_network': 'external1',
'name': 'router1',
'subnets': ['subnet4']},
{'description': 'router2',
'external_logic_network': 'external1',
'name': 'router2',
'subnets': ['subnet10']}]}
cls.cluster_meta2 = \
{'description': 'desc',
'logic_networks':
[{'name': 'external1',
'physnet_name': 'phynet2',
'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']],
'gateway': '172.16.1.1',
'name': 'subnet10'}],
'type': 'external'},
{'name': 'internal1',
'physnet_name': 'phynet1',
'segmentation_id': '777',
'segmentation_type': 'vlan',
'shared': False,
'subnets': [{'cidr': '192.168.31.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.31.130',
'192.168.31.254']],
'gateway': '192.168.31.1',
'name': 'subnet3'},
{'cidr': '192.168.4.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.4.130',
'192.168.4.254']],
'gateway': '192.168.4.1',
'name': 'subnet4'}],
'type': 'internal'}],
'name': 'test',
'networking_parameters': {'base_mac': 'fa:16:3e:00:00:00',
'gre_id_range': [2, 2000],
'net_l23_provider': 'ovs',
'public_vip': '172.16.0.3',
'segmentation_type': 'vlan,vxlan',
'vlan_range': [2, 4094],
'vni_range': [1000, 1030]},
'networks': [],
'nodes': [],
'routers': [{'description': 'router1',
'external_logic_network': 'external1',
'name': 'router1',
'subnets': ['subnet4']},
{'description': 'router2',
'external_logic_network': 'external1',
'name': 'router2',
'subnets': ['subnet10']}]}
cls.cluster_meta3 = {'description': "This cluster's name is null",
'name': ""}
cls.cluster_meta4 = {'description': "",
@ -140,19 +142,39 @@ class TecsClusterTest(base.BaseDaisyTest):
def test_add_cluster_with_networking_parameters(self):
self.private_network_add()
cluster_info = self.add_cluster(**self.cluster_meta2)
self.assertEqual(self.cluster_meta2['name'], cluster_info.name, "cluster name is not correct")
self.assertEqual(self.cluster_meta2['description'], cluster_info.description, "cluster add interface execute failed")
self.assertEqual(self.cluster_meta2['networking_parameters']['base_mac'], cluster_info.base_mac, "cluster add interface execute failed")
self.assertEqual(self.cluster_meta2['networking_parameters']['net_l23_provider'], cluster_info.net_l23_provider, "cluster add interface execute failed")
self.assertEqual(self.cluster_meta2['networking_parameters']['public_vip'], cluster_info.public_vip, "cluster add interface execute failed")
self.assertEqual(self.cluster_meta2['networking_parameters']['segmentation_type'], cluster_info.segmentation_type, "cluster add interface execute failed")
self.assertEqual(self.cluster_meta2['name'],
cluster_info.name,
"cluster name is not correct")
self.assertEqual(self.cluster_meta2['description'],
cluster_info.description,
"cluster add interface execute failed")
self.assertEqual(
self.cluster_meta2['networking_parameters']['base_mac'],
cluster_info.base_mac,
"cluster add interface execute failed")
self.assertEqual(
self.cluster_meta2['networking_parameters']['net_l23_provider'],
cluster_info.net_l23_provider,
"cluster add interface execute failed")
self.assertEqual(
self.cluster_meta2['networking_parameters']['public_vip'],
cluster_info.public_vip,
"cluster add interface execute failed")
self.assertEqual(
self.cluster_meta2['networking_parameters']['segmentation_type'],
cluster_info.segmentation_type,
"cluster add interface execute failed")
self.delete_cluster(cluster_info.id)
def test_add_cluster_no_networking_parameters(self):
self.private_network_add()
cluster_info = self.add_cluster(**self.cluster_meta1)
self.assertEqual(self.cluster_meta1['name'], cluster_info.name, "cluster add interface is not correct")
self.assertEqual(self.cluster_meta1['description'], cluster_info.description, "cluster add interface execute failed")
self.assertEqual(self.cluster_meta1['name'],
cluster_info.name,
"cluster add interface is not correct")
self.assertEqual(self.cluster_meta1['description'],
cluster_info.description,
"cluster add interface execute failed")
self.delete_cluster(cluster_info.id)
def test_add_cluster_with_networking_parameters_no_routers(self):
@ -162,7 +184,9 @@ class TecsClusterTest(base.BaseDaisyTest):
del cluster_temp['routers']
cluster_info = self.add_cluster(**cluster_temp)
# cluster = self.get_cluster(cluster_info.id)
self.assertEqual(cluster_temp['name'], cluster_info.name, "cluster add interface execute failed")
self.assertEqual(cluster_temp['name'],
cluster_info.name,
"cluster add interface execute failed")
self.delete_cluster(cluster_info.id)
def test_add_cluster_with_nodes(self):
@ -173,9 +197,15 @@ class TecsClusterTest(base.BaseDaisyTest):
self.private_network_add()
cluster_info = self.add_cluster(**self.cluster_meta1)
cluster = self.get_cluster(cluster_info.id)
self.assertEqual(self.cluster_meta1['name'], cluster.name, "add cluster with nodes is not correct")
self.assertEqual(self.cluster_meta1['description'], cluster.description, "add cluster with nodes execute failed")
self.assertEqual(self.cluster_meta1['nodes'], cluster.nodes, "add cluster with nodes execute failed")
self.assertEqual(self.cluster_meta1['name'],
cluster.name,
"add cluster with nodes is not correct")
self.assertEqual(self.cluster_meta1['description'],
cluster.description,
"add cluster with nodes execute failed")
self.assertEqual(self.cluster_meta1['nodes'],
cluster.nodes,
"add cluster with nodes execute failed")
self.delete_cluster(cluster_info.id)
self.delete_host(host_info.id)
@ -184,9 +214,14 @@ class TecsClusterTest(base.BaseDaisyTest):
cluster_info = self.add_cluster(**self.cluster_meta1)
self.cluster_meta1['name'] = "test_name"
self.cluster_meta1['description'] = "test_desc"
cluster_update_info = self.update_cluster(cluster_info.id, **self.cluster_meta1)
self.assertEqual(self.cluster_meta1['name'], cluster_update_info.name, "cluster update interface is not correct")
self.assertEqual(self.cluster_meta1['description'], cluster_update_info.description, "cluster update interface is not correct")
cluster_update_info = self.update_cluster(cluster_info.id,
**self.cluster_meta1)
self.assertEqual(self.cluster_meta1['name'],
cluster_update_info.name,
"cluster update interface is not correct")
self.assertEqual(self.cluster_meta1['description'],
cluster_update_info.description,
"cluster update interface is not correct")
self.delete_cluster(cluster_info.id)
def test_update_cluster_with_nodes(self):
@ -196,20 +231,34 @@ class TecsClusterTest(base.BaseDaisyTest):
self.private_network_add()
cluster_info = self.add_cluster(**self.cluster_meta1)
self.cluster_meta1['nodes'] = nodes
cluster_update_info = self.update_cluster(cluster_info.id, **self.cluster_meta1)
cluster_update_info = self.update_cluster(cluster_info.id,
**self.cluster_meta1)
cluster = self.get_cluster(cluster_info.id)
self.assertEqual(self.cluster_meta1['name'], cluster_update_info.name, "update cluster with nodes is not correct")
self.assertEqual(self.cluster_meta1['description'], cluster_update_info.description, "update cluster with nodes execute failed")
self.assertEqual(self.cluster_meta1['nodes'], cluster.nodes, "update cluster with nodes execute failed")
self.assertEqual(self.cluster_meta1['name'],
cluster_update_info.name,
"update cluster with nodes is not correct")
self.assertEqual(self.cluster_meta1['description'],
cluster_update_info.description,
"update cluster with nodes execute failed")
self.assertEqual(self.cluster_meta1['nodes'],
cluster.nodes,
"update cluster with nodes execute failed")
self.delete_cluster(cluster_info.id)
self.delete_host(host_info.id)
def test_update_cluster_with_networking_parameters(self):
self.private_network_add()
cluster_info = self.add_cluster(**self.cluster_meta1)
cluster_update_info = self.update_cluster(cluster_info.id, **self.cluster_meta2)
self.assertEqual(self.cluster_meta2['name'], cluster_update_info.name, "update cluster with networking parameters is not correct")
self.assertEqual(self.cluster_meta2['description'], cluster_update_info.description, "update cluster with networking parameters execute failed")
cluster_update_info = self.update_cluster(cluster_info.id,
**self.cluster_meta2)
self.assertEqual(self.cluster_meta2['name'],
cluster_update_info.name,
"update cluster with networking parameters "
"is not correct")
self.assertEqual(self.cluster_meta2['description'],
cluster_update_info.description,
"update cluster with networking parameters "
"execute failed")
# cluster = self.get_cluster(cluster_info.id)
self.delete_cluster(cluster_info.id)
@ -217,8 +266,10 @@ class TecsClusterTest(base.BaseDaisyTest):
self.private_network_add()
cluster_info = self.add_cluster(**self.cluster_meta1)
hwm_meta = {"hwm_ip": "10.43.211.63"}
cluster_update_info = self.update_cluster(cluster_info.id, **hwm_meta)
self.assertEqual("10.43.211.63", cluster_update_info.hwm_ip,
cluster_update_info = self.update_cluster(cluster_info.id,
**hwm_meta)
self.assertEqual("10.43.211.63",
cluster_update_info.hwm_ip,
"Update cluster with hwm_ip failed")
self.delete_cluster(cluster_info.id)
@ -232,9 +283,16 @@ class TecsClusterTest(base.BaseDaisyTest):
'subnets': ['subnet3']}
self.cluster_meta2['routers'].append(router)
cluster_update_info = self.update_cluster(cluster_info.id, **self.cluster_meta2)
self.assertEqual(self.cluster_meta2['name'], cluster_update_info.name, "update cluster with networking parameters is not correct")
self.assertEqual(self.cluster_meta2['description'], cluster_update_info.description, "update cluster with networking parameters execute failed")
cluster_update_info = self.update_cluster(cluster_info.id,
**self.cluster_meta2)
self.assertEqual(self.cluster_meta2['name'],
cluster_update_info.name,
"update cluster with networking parameters "
"is not correct")
self.assertEqual(self.cluster_meta2['description'],
cluster_update_info.description,
"update cluster with networking parameters "
"execute failed")
# cluster = self.get_cluster(cluster_info.id)
self.delete_cluster(cluster_info.id)
@ -252,7 +310,8 @@ class TecsClusterTest(base.BaseDaisyTest):
for query_cluster in list_clusters:
if query_cluster.name == "test":
cluster_flag = True
self.assertTrue(cluster_flag, "test_list_cluster_filter_by_name error")
self.assertTrue(cluster_flag,
"test_list_cluster_filter_by_name error")
def test_delete_cluster(self):
cluster_info1 = self.add_cluster(**self.cluster_meta1)
@ -271,11 +330,16 @@ class TecsClusterTest(base.BaseDaisyTest):
cluster_info5 = self.add_cluster(**self.cluster_meta5)
cluster_info6 = self.add_cluster(**self.cluster_meta6)
cluster_info7 = self.add_cluster(**self.cluster_meta7)
cluster_id_sort = sorted([cluster_info5.id, cluster_info6.id, cluster_info7.id], reverse=True)
cluster_id_sort = sorted([cluster_info5.id,
cluster_info6.id,
cluster_info7.id],
reverse=True)
cluster_meta = {'sort_key': "id"}
list_cluster = self.list_clusters(**cluster_meta)
query_cluster_id_list = [cluster_info.id for cluster_info in list_cluster]
self.assertEqual(query_cluster_id_list, cluster_id_sort, "test_list_cluster_by_sort_key error")
query_cluster_id_list = [cluster_info.id for cluster_info
in list_cluster]
self.assertEqual(query_cluster_id_list, cluster_id_sort,
"test_list_cluster_by_sort_key error")
self.delete_cluster(cluster_info5.id)
self.delete_cluster(cluster_info6.id)
self.delete_cluster(cluster_info7.id)
@ -284,11 +348,15 @@ class TecsClusterTest(base.BaseDaisyTest):
cluster_info5 = self.add_cluster(**self.cluster_meta5)
cluster_info6 = self.add_cluster(**self.cluster_meta6)
cluster_info7 = self.add_cluster(**self.cluster_meta7)
cluster_name_sort = ['test_add_host7', 'test_add_host6', 'test_add_host5']
cluster_name_sort = ['test_add_host7',
'test_add_host6',
'test_add_host5']
cluster_meta = {'sort_dir': "desc", 'sort_key': "name"}
list_cluster = self.list_clusters(**cluster_meta)
query_cluster_name_list = [cluster_info.name for cluster_info in list_cluster]
self.assertEqual(query_cluster_name_list, cluster_name_sort, "test_list_cluster_by_sort_dir error")
query_cluster_name_list = [cluster_info.name for cluster_info
in list_cluster]
self.assertEqual(query_cluster_name_list, cluster_name_sort,
"test_list_cluster_by_sort_dir error")
self.delete_cluster(cluster_info5.id)
self.delete_cluster(cluster_info6.id)
self.delete_cluster(cluster_info7.id)
@ -297,10 +365,15 @@ class TecsClusterTest(base.BaseDaisyTest):
cluster_info5 = self.add_cluster(**self.cluster_meta5)
cluster_info6 = self.add_cluster(**self.cluster_meta6)
cluster_info7 = self.add_cluster(**self.cluster_meta7)
cluster_meta = {'page_size': "1", 'sort_dir': "desc", 'sort_key': "name"}
cluster_meta = {'page_size': "1",
'sort_dir': "desc",
'sort_key': "name"}
list_cluster = self.list_clusters(**cluster_meta)
query_cluster_id_list = [cluster_info.id for cluster_info in list_cluster]
self.assertEqual(query_cluster_id_list, [cluster_info7.id], "test_list_cluster_by_sort_key error")
query_cluster_id_list = [cluster_info.id for cluster_info
in list_cluster]
self.assertEqual(query_cluster_id_list,
[cluster_info7.id],
"test_list_cluster_by_sort_key error")
self.delete_cluster(cluster_info5.id)
self.delete_cluster(cluster_info6.id)
self.delete_cluster(cluster_info7.id)
@ -309,58 +382,90 @@ class TecsClusterTest(base.BaseDaisyTest):
self.private_network_add()
add_host = self.add_cluster(**self.cluster_meta2)
cluster_detail = self.get_cluster(add_host.id)
self.assertEqual(self.cluster_meta2['networking_parameters']['base_mac'], cluster_detail.base_mac, "cluster add networking_parameters failed")
self.assertEqual(
self.cluster_meta2['networking_parameters']['base_mac'],
cluster_detail.base_mac,
"cluster add networking_parameters failed")
router_flag = False
floating_ranges_flag = False
dns_nameservers_flag = False
if (cluster_detail.routers[0]['name'] == 'router1') or (cluster_detail.routers[0]['name'] == 'router2'):
if (cluster_detail.routers[0]['name'] == 'router1') or \
(cluster_detail.routers[0]['name'] == 'router2'):
router_flag = True
if (cluster_detail.logic_networks[0]['subnets'][0]['floating_ranges'] == [['192.168.4.130', '192.168.4.254']]) or \
(cluster_detail.logic_networks[0]['subnets'][0]['floating_ranges'] == [['192.168.1.2', '192.168.1.200']]) or \
(cluster_detail.logic_networks[0]['subnets'][0]['floating_ranges'] == [['172.16.1.130', '172.16.1.150']]) or \
(cluster_detail.logic_networks[0]['subnets'][0]['floating_ranges'] == [['192.168.31.130', '192.168.31.254']]):
floating_ranges = cluster_detail.\
logic_networks[0]['subnets'][0]['floating_ranges']
if (floating_ranges == [['192.168.4.130', '192.168.4.254']]) or \
(floating_ranges == [['192.168.1.2', '192.168.1.200']]) or \
(floating_ranges == [['172.16.1.130', '172.16.1.150']]) or \
(floating_ranges == [['192.168.31.130', '192.168.31.254']]):
floating_ranges_flag = True
if cluster_detail.logic_networks[0]['subnets'][0]['dns_nameservers'] == ['8.8.8.8', '8.8.4.4'] or \
cluster_detail.logic_networks[0]['subnets'][0]['dns_nameservers'] == ['8.8.4.4', '8.8.8.8']:
dns_nameservers = cluster_detail.\
logic_networks[0]['subnets'][0]['dns_nameservers']
if dns_nameservers == ['8.8.8.8', '8.8.4.4'] or \
dns_nameservers == ['8.8.4.4', '8.8.8.8']:
dns_nameservers_flag = True
self.assertTrue(router_flag, "cluster add floating_ranges failed")
self.assertTrue(floating_ranges_flag, "cluster add floating_ranges failed")
self.assertTrue(dns_nameservers_flag, "cluster add dns_nameservers failed")
self.assertTrue(floating_ranges_flag,
"cluster add floating_ranges failed")
self.assertTrue(dns_nameservers_flag,
"cluster add dns_nameservers failed")
self.delete_cluster(add_host.id)
def test_cluster_detail_info(self):
self.private_network_add()
add_cluster = self.add_cluster(**self.cluster_meta2)
cluster_detail = self.get_cluster(add_cluster.id)
self.assertEqual(self.cluster_meta2['networking_parameters']['base_mac'], cluster_detail.base_mac, "cluster base_mac detail failed")
self.assertEqual(self.cluster_meta2['name'], cluster_detail.name, "cluster name detail failed")
self.assertEqual(self.cluster_meta2['description'], cluster_detail.description, "cluster description detail failed")
self.assertEqual(self.cluster_meta2['networking_parameters']['public_vip'], cluster_detail.public_vip, "cluster public_vip detail failed")
self.assertEqual(
self.cluster_meta2['networking_parameters']['base_mac'],
cluster_detail.base_mac,
"cluster base_mac detail failed")
self.assertEqual(self.cluster_meta2['name'],
cluster_detail.name,
"cluster name detail failed")
self.assertEqual(self.cluster_meta2['description'],
cluster_detail.description,
"cluster description detail failed")
self.assertEqual(
self.cluster_meta2['networking_parameters']['public_vip'],
cluster_detail.public_vip,
"cluster public_vip detail failed")
self.private_network_delete()
def test_add_cluster_no_description(self):
self.private_network_add()
cluster_info = self.add_cluster(**self.cluster_meta4)
if cluster_info.description is None:
self.assertEqual(self.cluster_meta4['description'], cluster_info.description, "cluster add interface execute failed")
print "\n ===========cluster_description= %s ", cluster_info.description
print "\n ===========STC-F-Daisy_Cluster-0013 run is over ==============="
self.assertEqual(self.cluster_meta4['description'],
cluster_info.description,
"cluster add interface execute failed")
print("\n ===========cluster_description= %s ",
cluster_info.description)
print("\n ===========STC-F-Daisy_Cluster-0013 run is over "
" ===============")
self.delete_cluster(cluster_info.id)
def test_add_cluster_set_auto_scale(self):
self.private_network_add()
cluster_info = self.add_cluster(**self.cluster_meta8)
if cluster_info:
self.assertEqual(self.cluster_meta8['auto_scale'], cluster_info.auto_scale, "cluster add set auto_scale=1 failed")
print "\n ===========cluster auto_scale= %s ", cluster_info.auto_scale
print "\n ===========STC-F-Daisy_Cluster-0020 run is over ==============="
self.assertEqual(self.cluster_meta8['auto_scale'],
cluster_info.auto_scale,
"cluster add set auto_scale=1 failed")
print("\n ===========cluster auto_scale= %s ",
cluster_info.auto_scale)
print("\n ===========STC-F-Daisy_Cluster-0020 run is over "
"===============")
self.delete_cluster(cluster_info.id)
def test_add_cluster_with_hwm(self):
self.private_network_add()
cluster_info = self.add_cluster(**self.cluster_meta9)
if cluster_info:
self.assertEqual(self.cluster_meta9['hwm_ip'], cluster_info.hwm_ip,
self.assertEqual(self.cluster_meta9['hwm_ip'],
cluster_info.hwm_ip,
"Add cluster with hwm_ip failed")
self.delete_cluster(cluster_info.id)

View File

@ -12,89 +12,92 @@ class DaisyComponentTest(base.BaseDaisyTest):
super(DaisyComponentTest, cls).resource_setup()
cls.host_meta = {'name': 'test_add_host',
'description': 'test_tempest'}
cls.host_meta_interfaces = {'type': 'ether',
'name': 'eth1',
'mac': 'fe80::f816:3eff',
'ip': '10.43.177.121',
'netmask': '255.255.254.0',
'is_deployment': 'True',
'assigned_networks': ['MANAGEMENT', 'DEPLOYMENT'],
'slaves': 'eth1'}
cls.host_meta_interfaces = \
{'type': 'ether',
'name': 'eth1',
'mac': 'fe80::f816:3eff',
'ip': '10.43.177.121',
'netmask': '255.255.254.0',
'is_deployment': 'True',
'assigned_networks': ['MANAGEMENT', 'DEPLOYMENT'],
'slaves': 'eth1'}
cls.cluster_meta = {'description': 'desc',
'logic_networks': [{'name': 'external1',
'physnet_name': 'PRIVATE',
'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': 'external'},
{'name': 'external2',
'physnet_name': 'PUBLIC',
'segmentation_id': 1023,
'segmentation_type': 'vxlan',
'shared': True,
'subnets': [{'cidr': '192.168.2.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.2.130',
'192.168.2.254']],
'gateway': '192.168.2.1',
'name': 'subnet123'}],
'type': 'external'},
{'name': 'internal1',
'physnet_name': 'PRIVATE',
'segmentation_id': '777',
'segmentation_type': 'vlan',
'shared': False,
'subnets': [{'cidr': '192.168.31.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.31.130',
'192.168.31.254']],
'gateway': '192.168.31.1',
'name': 'subnet3'},
{'cidr': '192.168.4.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.4.130',
'192.168.4.254']],
'gateway': '192.168.4.1',
'name': 'subnet4'}],
'type': 'internal'}],
'name': 'test',
'networking_parameters': {'base_mac': 'fa:16:3e:00:00:00',
'gre_id_range': [2, 2000],
'net_l23_provider': 'ovs',
'public_vip': '172.16.0.3',
'segmentation_type': 'vlan,vxlan',
'vlan_range': [2, 4094],
'vni_range': [1000, 1030]},
'networks': [],
'nodes': [],
'routers': [{'description': 'router1',
'external_logic_network': 'external1',
'name': 'router1',
'subnets': ['subnet4', 'subnet3']},
{'description': 'router2',
'external_logic_network': 'external2',
'name': 'router2',
'subnets': ['subnet2', 'subnet10']}]}
cls.cluster_meta = \
{'description': 'desc',
'logic_networks':
[{'name': 'external1',
'physnet_name': 'PRIVATE',
'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': 'external'},
{'name': 'external2',
'physnet_name': 'PUBLIC',
'segmentation_id': 1023,
'segmentation_type': 'vxlan',
'shared': True,
'subnets': [{'cidr': '192.168.2.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.2.130',
'192.168.2.254']],
'gateway': '192.168.2.1',
'name': 'subnet123'}],
'type': 'external'},
{'name': 'internal1',
'physnet_name': 'PRIVATE',
'segmentation_id': '777',
'segmentation_type': 'vlan',
'shared': False,
'subnets': [{'cidr': '192.168.31.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.31.130',
'192.168.31.254']],
'gateway': '192.168.31.1',
'name': 'subnet3'},
{'cidr': '192.168.4.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.4.130',
'192.168.4.254']],
'gateway': '192.168.4.1',
'name': 'subnet4'}],
'type': 'internal'}],
'name': 'test',
'networking_parameters': {'base_mac': 'fa:16:3e:00:00:00',
'gre_id_range': [2, 2000],
'net_l23_provider': 'ovs',
'public_vip': '172.16.0.3',
'segmentation_type': 'vlan,vxlan',
'vlan_range': [2, 4094],
'vni_range': [1000, 1030]},
'networks': [],
'nodes': [],
'routers': [{'description': 'router1',
'external_logic_network': 'external1',
'name': 'router1',
'subnets': ['subnet4', 'subnet3']},
{'description': 'router2',
'external_logic_network': 'external2',
'name': 'router2',
'subnets': ['subnet2', 'subnet10']}]}
cls.component_meta = {'name': 'test_component',
'description': 'test'}
@ -102,10 +105,12 @@ class DaisyComponentTest(base.BaseDaisyTest):
component_meta = {}
component_flag = True
list_component = self.list_component(**component_meta)
query_component_list = [component_info for component_info in list_component]
query_component_list = [component_info for component_info
in list_component]
component_list = ["camellia", "ha", "loadbalance", "amqp", "database",
"keystone", "ironic", "neutron",
"horizon", "ceilometer", "glance", "heat", "nova", "cinder"]
"horizon", "ceilometer", "glance", "heat", "nova",
"cinder"]
for query_component in query_component_list:
if query_component.name not in component_list:
component_flag = False
@ -113,7 +118,9 @@ class DaisyComponentTest(base.BaseDaisyTest):
def test_add_component(self):
component = self.add_component(**self.component_meta)
self.assertEqual("test_component", component.name, "test_add_component failed")
self.assertEqual("test_component",
component.name,
"test_add_component failed")
self.delete_component(component.id)
def test_component_delete(self):
@ -122,7 +129,8 @@ class DaisyComponentTest(base.BaseDaisyTest):
component_flag = True
component_meta = {}
list_component = self.list_component(**component_meta)
query_component_list = [component_info for component_info in list_component]
query_component_list = [component_info for component_info
in list_component]
for query_component in query_component_list:
if component.name == query_component.name:
component_flag = False
@ -138,6 +146,9 @@ class DaisyComponentTest(base.BaseDaisyTest):
add_component_info = self.add_component(**self.component_meta)
update_component_meta = {'name': 'test_update_component',
'description': 'test_tempest'}
update_component_info = self.update_component(add_component_info.id, **update_component_meta)
self.assertEqual("test_update_component", update_component_info.name, "test_update_component_with_cluster failed")
update_component_info = self.update_component(add_component_info.id,
**update_component_meta)
self.assertEqual("test_update_component",
update_component_info.name,
"test_update_component_with_cluster failed")
self.delete_component(add_component_info.id)

View File

@ -35,7 +35,9 @@ class DaisyConfigFileTest(base.BaseDaisyTest):
add_config_file = self.add_config_file(**config_file_meta)
update_config_file_meta = {'name': 'update_config_file'}
update_config_file = self.update_config_file(add_config_file.id, **update_config_file_meta)
update_config_file = self.update_config_file(
add_config_file.id,
**update_config_file_meta)
self.assertEqual('update_config_file', update_config_file.name)

View File

@ -49,33 +49,56 @@ class DaisyDiscoverHostTest(base.BaseDaisyTest):
self.assertEqual(2, host_count, "list discover host failed")
def test_update_discover_host(self):
add_host_meta = {'ip': '127.0.0.2', 'passwd': 'ossdbg2', 'user': 'root'}
add_host_meta = {'ip': '127.0.0.2',
'passwd': 'ossdbg2',
'user': 'root'}
host_1 = self.add_discover_host(**add_host_meta)
self.assertEqual("root", host_1.user, "add discover host failed")
update_host_meta = {'ip': '127.0.0.2', 'passwd': 'ossdbg1', 'user': 'root2'}
update_host = self.update_discover_host(host_1.id, **update_host_meta)
self.assertEqual("ossdbg1", update_host.passwd, "update discover host failed")
self.assertEqual("root2", update_host.user, "update discover host failed")
update_host_meta = {'ip': '127.0.0.2',
'passwd': 'ossdbg1',
'user': 'root2'}
update_host = self.update_discover_host(host_1.id,
**update_host_meta)
self.assertEqual("ossdbg1",
update_host.passwd,
"update discover host failed")
self.assertEqual("root2",
update_host.user,
"update discover host failed")
def test_get_discover_host_detail(self):
add_host_meta = {'ip': '127.0.0.2', 'passwd': 'ossdbg2', 'user': 'root'}
add_host_meta = {'ip': '127.0.0.2',
'passwd': 'ossdbg2',
'user': 'root'}
host_1 = self.add_discover_host(**add_host_meta)
host_info = self.get_discover_host_detail(host_1.id)
self.assertEqual("root", host_info.user, "get discover host failed")
self.assertEqual("ossdbg2", host_info.passwd, "get discover host failed")
self.assertEqual("127.0.0.2", host_info.ip, "get discover host failed")
self.assertEqual("root",
host_info.user,
"get discover host failed")
self.assertEqual("ossdbg2",
host_info.passwd,
"get discover host failed")
self.assertEqual("127.0.0.2",
host_info.ip,
"get discover host failed")
def test_add_discover_host_without_passwd(self):
add_host_meta = {'ip': '127.0.0.2', 'user': 'root'}
ex = self.assertRaises(client_exc.HTTPBadRequest, self.add_discover_host, **add_host_meta)
ex = self.assertRaises(client_exc.HTTPBadRequest,
self.add_discover_host,
**add_host_meta)
self.assertIn("PASSWD parameter can not be None.", str(ex))
def test_add_discover_host_with_repeat_ip(self):
# add_host_meta = {'ip': '127.0.0.2', 'passwd': 'ossdbg2', 'user': 'root'}
# add_host_meta = {'ip': '127.0.0.2',
# 'passwd': 'ossdbg2',
# 'user': 'root'}
# host_1 = self.add_discover_host(**add_host_meta)
# ex = self.assertRaises(client_exc.HTTPForbidden, self.add_discover_host, **add_host_meta)
# self.assertIn("403 Forbidden: ip %s already existed." % add_host_meta['ip'], str(ex))
# ex = self.assertRaises(client_exc.HTTPForbidden,
# self.add_discover_host, **add_host_meta)
# self.assertIn("403 Forbidden: ip %s already existed."
# % add_host_meta['ip'], str(ex))
pass
def test_discover_host(self):
@ -103,7 +126,8 @@ class DaisyDiscoverHostTest(base.BaseDaisyTest):
if discover_flag == 'true':
break
discovery_host_list_generator = self.list_discover_host()
discovery_host_list = [discover_host_tmp for discover_host_tmp in discovery_host_list_generator]
discovery_host_list = [discover_host_tmp for discover_host_tmp
in discovery_host_list_generator]
for host in discovery_host_list:
if host.status == 'DISCOVERY_SUCCESSFUL':
discover_flag = 'true'

View File

@ -12,8 +12,10 @@ CONF = config.CONF
class TecsLogicalNetworkTest(base.BaseDaisyTest):
LOGICAL_FILTER = ['name', 'physnet_name', 'segmentation_id',
'segmentation_type', 'shared', 'type']
SUBNET_FILTER = ['name', 'dns_nameservers', 'floating_ranges', 'gateway', 'cidr']
ROUTER_FILTER = ['name', 'description', 'external_logic_network', 'subnets']
SUBNET_FILTER = ['name', 'dns_nameservers', 'floating_ranges',
'gateway', 'cidr']
ROUTER_FILTER = ['name', 'description',
'external_logic_network', 'subnets']
@classmethod
def resource_setup(cls):
@ -22,10 +24,14 @@ class TecsLogicalNetworkTest(base.BaseDaisyTest):
def _verify_logical_params(self, cluster_meta, fake_logical):
cluster_meta['logic_networks'] = \
[dict(filter(lambda paris: paris[0] in TecsLogicalNetworkTest.LOGICAL_FILTER, logic_network.items()))
[dict(filter(lambda paris: paris[0]
in TecsLogicalNetworkTest.LOGICAL_FILTER,
logic_network.items()))
for logic_network in cluster_meta['logic_networks']]
tmp_fake_logical = [dict(filter(lambda paris: paris[0] in TecsLogicalNetworkTest.LOGICAL_FILTER,
tmp_fake_logical = [dict(filter(lambda paris:
paris[0] in
TecsLogicalNetworkTest.LOGICAL_FILTER,
logic_network.items()))
for logic_network in fake_logical]
if cluster_meta['logic_networks'] != tmp_fake_logical:
@ -35,7 +41,9 @@ class TecsLogicalNetworkTest(base.BaseDaisyTest):
def _verify_router_params(self, cluster_meta):
cluster_meta['routers'] = \
[dict(filter(lambda paris: paris[0] in TecsLogicalNetworkTest.ROUTER_FILTER, router.items()))
[dict(filter(lambda paris: paris[0] in
TecsLogicalNetworkTest.ROUTER_FILTER,
router.items()))
for router in cluster_meta['routers']]
for router in cluster_meta['routers']:
router['subnets'] = copy.deepcopy(list(set(router['subnets'])))
@ -65,10 +73,12 @@ class TecsLogicalNetworkTest(base.BaseDaisyTest):
cluster_info = self.add_cluster(**fake_cluster)
cluster_meta = self.get_cluster(cluster_info.id).to_dict()
self.assertEqual(cluster_meta.get('networking_parameters', None), fake_network)
self.assertEqual(cluster_meta.get('networking_parameters', None),
fake_network)
fake_logical = self._verify_logical_params(cluster_meta, fake_logical)
self.assertEqual(cluster_meta.get('logic_networks', None), fake_logical)
self.assertEqual(cluster_meta.get('logic_networks', None),
fake_logical)
self._verify_router_params(cluster_meta)
self.assertEqual(cluster_meta.get('routers', None), fake_routers)
@ -86,7 +96,8 @@ class TecsLogicalNetworkTest(base.BaseDaisyTest):
self.assertRaisesMessage(
client_exc.HTTPBadRequest,
"400 Bad Request: Logic_network flat1 is not valid range. (HTTP 400)",
"400 Bad Request: "
"Logic_network flat1 is not valid range. (HTTP 400)",
self.add_cluster, **fake_cluster)
# STC-F-Daisy_Logical_Network-0002
@ -99,7 +110,8 @@ class TecsLogicalNetworkTest(base.BaseDaisyTest):
cluster_info = self.add_cluster(**fake_cluster)
cluster_meta = self.get_cluster(cluster_info.id).to_dict()
self.assertEqual(cluster_meta.get('networking_parameters', None), fake_network)
self.assertEqual(cluster_meta.get('networking_parameters', None),
fake_network)
self.delete_cluster(cluster_info.id)
# STC-F-Daisy_Logical_Network-0003
@ -115,10 +127,12 @@ class TecsLogicalNetworkTest(base.BaseDaisyTest):
cluster_info = self.add_cluster(**fake_cluster)
cluster_meta = self.get_cluster(cluster_info.id).to_dict()
self.assertEqual(cluster_meta.get('networking_parameters', None), fake_network)
self.assertEqual(cluster_meta.get('networking_parameters', None),
fake_network)
fake_logical = self._verify_logical_params(cluster_meta, fake_logical)
self.assertEqual(cluster_meta.get('logic_networks', None), fake_logical)
self.assertEqual(cluster_meta.get('logic_networks', None),
fake_logical)
self.delete_cluster(cluster_info.id)
# STC-A-Daisy_Logical_Network-0007
@ -134,7 +148,8 @@ class TecsLogicalNetworkTest(base.BaseDaisyTest):
'routers': fake_router})
self.assertRaisesMessage(
client_exc.HTTPBadRequest,
"400 Bad Request: Logic network's subnets is all related with a router, it's not allowed. (HTTP 400)",
"400 Bad Request: Logic network's subnets is all related "
"with a router, it's not allowed. (HTTP 400)",
self.add_cluster, **fake_cluster)
tmp_fake_router1 = copy.deepcopy(fake_router)
@ -142,7 +157,8 @@ class TecsLogicalNetworkTest(base.BaseDaisyTest):
fake_cluster.update({'routers': tmp_fake_router1})
self.assertRaisesMessage(
client_exc.HTTPBadRequest,
"400 Bad Request: Logic network's subnets is all related with a router, it's not allowed. (HTTP 400)",
"400 Bad Request: Logic network's subnets is all related with a "
"router, it's not allowed. (HTTP 400)",
self.add_cluster, **fake_cluster)
tmp_fake_router2 = copy.deepcopy(fake_router)
@ -150,7 +166,8 @@ class TecsLogicalNetworkTest(base.BaseDaisyTest):
fake_cluster.update({'routers': tmp_fake_router2})
self.assertRaisesMessage(
client_exc.HTTPBadRequest,
"400 Bad Request: Logic_network test is not valid range. (HTTP 400)",
"400 Bad Request: "
"Logic_network test is not valid range. (HTTP 400)",
self.add_cluster, **fake_cluster)
tmp_fake_router3 = copy.deepcopy(fake_router)
@ -177,11 +194,14 @@ class TecsLogicalNetworkTest(base.BaseDaisyTest):
'logic_networks': tmp_fake_logical1})
self.assertRaisesMessage(
client_exc.HTTPBadRequest,
"400 Bad Request: Between floating ip range can not be overlap. (HTTP 400)",
"400 Bad Request: "
"Between floating ip range can not be overlap. (HTTP 400)",
self.add_cluster, **fake_cluster)
tmp_fake_logical2 = copy.deepcopy(self.fake.fake_logical_parameters2())
tmp_fake_logical2[0].update({'subnets': self.fake.fake_subnet_parameters2()})
tmp_fake_logical2 = copy.deepcopy(
self.fake.fake_logical_parameters2())
tmp_fake_logical2[0].update({'subnets':
self.fake.fake_subnet_parameters2()})
tmp_fake_logical2[0]['subnets'][0].update({'floating_ranges': []})
tmp_fake_logical2[0]['subnets'][1].update({'floating_ranges': []})
@ -214,13 +234,17 @@ class TecsLogicalNetworkTest(base.BaseDaisyTest):
cluster_meta = self.get_cluster(cluster_id2).to_dict()
# check
self.assertEqual(cluster_meta.get('networking_parameters', None), fake_network)
self.assertEqual(cluster_meta.get('networking_parameters', None),
fake_network)
tmp_fake_logical = self._verify_logical_params(cluster_meta, fake_logical)
self.assertEqual(cluster_meta.get('logic_networks', None), tmp_fake_logical)
tmp_fake_logical = self._verify_logical_params(cluster_meta,
fake_logical)
self.assertEqual(cluster_meta.get('logic_networks', None),
tmp_fake_logical)
self._verify_router_params(cluster_meta)
self.assertEqual(cluster_meta.get('routers', None), self.fake.fake_router_parameters())
self.assertEqual(cluster_meta.get('routers', None),
self.fake.fake_router_parameters())
self.delete_cluster(cluster_id2)
@ -239,10 +263,12 @@ class TecsLogicalNetworkTest(base.BaseDaisyTest):
cluster_info = self.add_cluster(**fake_cluster)
cluster_meta = self.get_cluster(cluster_info.id).to_dict()
self.assertEqual(cluster_meta.get('networking_parameters', None), fake_network)
self.assertEqual(cluster_meta.get('networking_parameters', None),
fake_network)
fake_logical = self._verify_logical_params(cluster_meta, fake_logical)
self.assertEqual(cluster_meta.get('logic_networks', None), fake_logical)
self.assertEqual(cluster_meta.get('logic_networks', None),
fake_logical)
self._verify_router_params(cluster_meta)
self.assertEqual(cluster_meta.get('routers', None), fake_routers)
@ -263,7 +289,8 @@ class TecsLogicalNetworkTest(base.BaseDaisyTest):
u'segmentation_type': None,
u'vlan_range': [None, None],
u'vni_range': [None, None]}
self.assertEqual(default_networking_parameters, cluster_meta.get('networking_parameters', None))
self.assertEqual(default_networking_parameters,
cluster_meta.get('networking_parameters', None))
self.assertEqual([], cluster_meta.get('logic_networks', None))
self.assertEqual([], cluster_meta.get('routers', None))

View File

@ -12,89 +12,92 @@ class DaisyServiceTest(base.BaseDaisyTest):
super(DaisyServiceTest, cls).resource_setup()
cls.host_meta = {'name': 'test_add_host',
'description': 'test_tempest'}
cls.host_meta_interfaces = {'type': 'ether',
'name': 'eth1',
'mac': 'fe80::f816:3eff',
'ip': '10.43.177.121',
'netmask': '255.255.254.0',
'is_deployment': 'True',
'assigned_networks': ['MANAGEMENT', 'DEPLOYMENT'],
'slaves': 'eth1'}
cls.host_meta_interfaces =\
{'type': 'ether',
'name': 'eth1',
'mac': 'fe80::f816:3eff',
'ip': '10.43.177.121',
'netmask': '255.255.254.0',
'is_deployment': 'True',
'assigned_networks': ['MANAGEMENT', 'DEPLOYMENT'],
'slaves': 'eth1'}
cls.cluster_meta = {'description': 'desc',
'logic_networks': [{'name': 'external1',
'physnet_name': 'PRIVATE',
'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': 'external'},
{'name': 'external2',
'physnet_name': 'PUBLIC',
'segmentation_id': 1023,
'segmentation_type': 'vxlan',
'shared': True,
'subnets': [{'cidr': '192.168.2.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.2.130',
'192.168.2.254']],
'gateway': '192.168.2.1',
'name': 'subnet123'}],
'type': 'external'},
{'name': 'internal1',
'physnet_name': 'PRIVATE',
'segmentation_id': '777',
'segmentation_type': 'vlan',
'shared': False,
'subnets': [{'cidr': '192.168.31.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.31.130',
'192.168.31.254']],
'gateway': '192.168.31.1',
'name': 'subnet3'},
{'cidr': '192.168.4.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.4.130',
'192.168.4.254']],
'gateway': '192.168.4.1',
'name': 'subnet4'}],
'type': 'internal'}],
'name': 'test',
'networking_parameters': {'base_mac': 'fa:16:3e:00:00:00',
'gre_id_range': [2, 2000],
'net_l23_provider': 'ovs',
'public_vip': '172.16.0.3',
'segmentation_type': 'vlan,vxlan',
'vlan_range': [2, 4094],
'vni_range': [1000, 1030]},
'networks': [],
'nodes': [],
'routers': [{'description': 'router1',
'external_logic_network': 'external1',
'name': 'router1',
'subnets': ['subnet4', 'subnet3']},
{'description': 'router2',
'external_logic_network': 'external2',
'name': 'router2',
'subnets': ['subnet2', 'subnet10']}]}
cls.cluster_meta = \
{'description': 'desc',
'logic_networks':
[{'name': 'external1',
'physnet_name': 'PRIVATE',
'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': 'external'},
{'name': 'external2',
'physnet_name': 'PUBLIC',
'segmentation_id': 1023,
'segmentation_type': 'vxlan',
'shared': True,
'subnets': [{'cidr': '192.168.2.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.2.130',
'192.168.2.254']],
'gateway': '192.168.2.1',
'name': 'subnet123'}],
'type': 'external'},
{'name': 'internal1',
'physnet_name': 'PRIVATE',
'segmentation_id': '777',
'segmentation_type': 'vlan',
'shared': False,
'subnets': [{'cidr': '192.168.31.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.31.130',
'192.168.31.254']],
'gateway': '192.168.31.1',
'name': 'subnet3'},
{'cidr': '192.168.4.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.4.130',
'192.168.4.254']],
'gateway': '192.168.4.1',
'name': 'subnet4'}],
'type': 'internal'}],
'name': 'test',
'networking_parameters': {'base_mac': 'fa:16:3e:00:00:00',
'gre_id_range': [2, 2000],
'net_l23_provider': 'ovs',
'public_vip': '172.16.0.3',
'segmentation_type': 'vlan,vxlan',
'vlan_range': [2, 4094],
'vni_range': [1000, 1030]},
'networks': [],
'nodes': [],
'routers': [{'description': 'router1',
'external_logic_network': 'external1',
'name': 'router1',
'subnets': ['subnet4', 'subnet3']},
{'description': 'router2',
'external_logic_network': 'external2',
'name': 'router2',
'subnets': ['subnet2', 'subnet10']}]}
cls.service_meta = {'name': 'test_service', 'description': 'test'}
def test_list_service(self):
@ -122,7 +125,9 @@ class DaisyServiceTest(base.BaseDaisyTest):
def test_add_service(self):
service = self.add_service(**self.service_meta)
self.assertEqual("test_service", service.name, "test_add_service failed")
self.assertEqual("test_service",
service.name,
"test_add_service failed")
self.delete_service(service.id)
def test_service_delete(self):
@ -147,6 +152,9 @@ class DaisyServiceTest(base.BaseDaisyTest):
add_service_info = self.add_service(**self.service_meta)
update_service_meta = {'name': 'test_update_service',
'description': 'test_tempest'}
update_service_info = self.update_service(add_service_info.id, **update_service_meta)
self.assertEqual("test_update_service", update_service_info.name, "test_update_service_with_cluster failed")
update_service_info = self.update_service(add_service_info.id,
**update_service_meta)
self.assertEqual("test_update_service",
update_service_info.name,
"test_update_service_with_cluster failed")
self.delete_service(add_service_info.id)

View File

@ -332,8 +332,7 @@ class BaseTestCase(testtools.testcase.WithAttributes,
BaseTestCase.is_lvm = misc.lvm_skip_check()
if BaseTestCase.is_lvm:
raise testtools.TestCase.skipException("skip : LVM " +
" not support this function")
raise testtools.TestCase.skipException("skip: don't support LVM")
@classmethod
def connectvm_skip_check(cls):

View File

@ -128,6 +128,6 @@ import_exceptions = tempest.services
# E123 skipped because it is ignored by default in the default pep8
# E129 skipped because it is too limiting when combined with other rules
# Skipped because of new hacking 0.9: H405
ignore = E125,E123,E129,H404,H405,E501
ignore = E125,E123,E129,H404,H405
show-source = True
exclude = .git,.venv,.tox,dist,doc,openstack,*egg