def test_clusters_info_no_vmware_attributes_exception(self):
     self.env.upload_fixtures(['openstack'])
     info = InstallationInfo()
     release = ReleaseCollection.filter_by(
         None, operating_system=consts.RELEASE_OS.ubuntu)
     nodes_params = [{
         'roles': ['compute']
     }, {
         'roles': ['compute']
     }, {
         'roles': ['controller']
     }]
     cluster = self.env.create(cluster_kwargs={
         'release_id':
         release[0].id,
         'mode':
         consts.CLUSTER_MODES.ha_compact,
         'net_provider':
         consts.CLUSTER_NET_PROVIDERS.neutron
     },
                               nodes_kwargs=nodes_params)
     self.env.create_node({'status': consts.NODE_STATUSES.discover})
     VmwareAttributes.delete(cluster.vmware_attributes)
     self.env.db.flush()
     self.assertNotRaises(AttributeError, info.get_clusters_info)
    def test_clusters_info(self):
        self.env.upload_fixtures(['openstack'])
        info = InstallationInfo()
        release = ReleaseCollection.filter_by(
            None, operating_system=consts.RELEASE_OS.ubuntu)
        nodes_params = [
            {'roles': ['compute']},
            {'roles': ['compute']},
            {'roles': ['controller']}
        ]
        cluster = self.env.create(
            cluster_kwargs={
                'release_id': release[0].id,
                'mode': consts.CLUSTER_MODES.ha_compact,
                'net_provider': consts.CLUSTER_NET_PROVIDERS.neutron},
            nodes_kwargs=nodes_params
        )
        self.env.create_node(
            {'status': consts.NODE_STATUSES.discover})
        clusters_info = info.get_clusters_info()
        self.assertEquals(1, len(clusters_info))
        cluster_info = clusters_info[0]

        self.assertEquals(len(nodes_params), len(cluster_info['nodes']))
        self.assertEquals(len(nodes_params), cluster_info['nodes_num'])

        self.assertEquals(consts.CLUSTER_MODES.ha_compact,
                          cluster_info['mode'])
        self.assertEquals(consts.CLUSTER_NET_PROVIDERS.neutron,
                          cluster_info['net_provider'])
        self.assertEquals(consts.CLUSTER_STATUSES.new,
                          cluster_info['status'])
        self.assertEquals(False,
                          cluster_info['is_customized'])

        self.assertEquals(cluster['id'],
                          cluster_info['id'])
        self.assertEquals(cluster.fuel_version,
                          cluster_info['fuel_version'])

        self.assertTrue('attributes' in cluster_info)

        self.assertTrue('release' in cluster_info)
        self.assertEquals(cluster.release.operating_system,
                          cluster_info['release']['os'])
        self.assertEquals(cluster.release.name,
                          cluster_info['release']['name'])
        self.assertEquals(cluster.release.version,
                          cluster_info['release']['version'])

        self.assertEquals(1, len(cluster_info['node_groups']))
        group_info = cluster_info['node_groups'][0]
        group = [ng for ng in cluster.node_groups][0]
        self.assertEquals(group.id,
                          group_info['id'])
        self.assertEquals(len(nodes_params),
                          len(group_info['nodes']))
        self.assertEquals(set([n.id for n in group.nodes]),
                          set(group_info['nodes']))
    def test_clusters_info(self):
        self.env.upload_fixtures(['openstack'])
        info = InstallationInfo()
        release = ReleaseCollection.filter_by(
            None, operating_system=consts.RELEASE_OS.ubuntu)
        nodes_params = [
            {'roles': ['compute']},
            {'roles': ['compute']},
            {'roles': ['controller']}
        ]
        cluster = self.env.create(
            cluster_kwargs={
                'release_id': release[0].id,
                'mode': consts.CLUSTER_MODES.ha_compact,
                'net_provider': consts.CLUSTER_NET_PROVIDERS.neutron},
            nodes_kwargs=nodes_params
        )
        self.env.create_node(
            {'status': consts.NODE_STATUSES.discover})
        clusters_info = info.get_clusters_info()
        self.assertEquals(1, len(clusters_info))
        cluster_info = clusters_info[0]

        self.assertEquals(len(nodes_params), len(cluster_info['nodes']))
        self.assertEquals(len(nodes_params), cluster_info['nodes_num'])

        self.assertEquals(consts.CLUSTER_MODES.ha_compact,
                          cluster_info['mode'])
        self.assertEquals(consts.CLUSTER_NET_PROVIDERS.neutron,
                          cluster_info['net_provider'])
        self.assertEquals(consts.CLUSTER_STATUSES.new,
                          cluster_info['status'])
        self.assertEquals(False,
                          cluster_info['is_customized'])

        self.assertEquals(cluster['id'],
                          cluster_info['id'])
        self.assertEquals(cluster.fuel_version,
                          cluster_info['fuel_version'])

        self.assertTrue('attributes' in cluster_info)

        self.assertTrue('release' in cluster_info)
        self.assertEquals(cluster.release.operating_system,
                          cluster_info['release']['os'])
        self.assertEquals(cluster.release.name,
                          cluster_info['release']['name'])
        self.assertEquals(cluster.release.version,
                          cluster_info['release']['version'])

        self.assertEquals(1, len(cluster_info['node_groups']))
        group_info = cluster_info['node_groups'][0]
        group = [ng for ng in cluster.node_groups][0]
        self.assertEquals(group.id,
                          group_info['id'])
        self.assertEquals(len(nodes_params),
                          len(group_info['nodes']))
        self.assertEquals(set([n.id for n in group.nodes]),
                          set(group_info['nodes']))
Exemple #4
0
 def test_get_attributes_centos(self):
     self.env.upload_fixtures(['openstack'])
     info = InstallationInfo()
     release = ReleaseCollection.filter_by(None, operating_system='CentOS')
     cluster_data = self.env.create_cluster(release_id=release[0].id)
     cluster = Cluster.get_by_uid(cluster_data['id'])
     editable = cluster.attributes.editable
     attr_key_list = [a[1] for a in info.attributes_white_list]
     attrs_dict = info.get_attributes(editable, info.attributes_white_list)
     self.assertEqual(set(attr_key_list), set(attrs_dict.keys()))
 def test_get_attributes_centos(self):
     self.skipTest("CentOS is unavailable in current release.")
     self.env.upload_fixtures(["openstack"])
     info = InstallationInfo()
     release = ReleaseCollection.filter_by(None, operating_system="CentOS")
     cluster_data = self.env.create_cluster(release_id=release[0].id)
     cluster = Cluster.get_by_uid(cluster_data["id"])
     editable = cluster.attributes.editable
     attr_key_list = [a[1] for a in info.attributes_white_list]
     attrs_dict = info.get_attributes(editable, info.attributes_white_list)
     self.assertEqual(set(attr_key_list), set(attrs_dict.keys()))
 def test_get_attributes_centos(self):
     self.skipTest('CentOS is unavailable in current release.')
     self.env.upload_fixtures(['openstack'])
     releases = ReleaseCollection.filter_by(
         None, operating_system=consts.RELEASE_OS.centos)
     release = releases[0]
     info = InstallationInfo()
     attr_key_list = [a[1] for a in info.attributes_white_list]
     # No UCA configs for CentOS.
     expected_attributes = set(attr_key_list) - set(
         ('pin_haproxy', 'repo_type', 'pin_ceph', 'pin_rabbitmq'))
     self._do_test_attributes_in_white_list(release, expected_attributes)
 def test_get_attributes_centos(self):
     self.skipTest('CentOS is unavailable in current release.')
     self.env.upload_fixtures(['openstack'])
     releases = ReleaseCollection.filter_by(
         None, operating_system=consts.RELEASE_OS.centos)
     release = releases[0]
     info = InstallationInfo()
     attr_key_list = [a[1] for a in info.attributes_white_list]
     # No UCA configs for CentOS.
     expected_attributes = set(attr_key_list) - set(
         ('pin_haproxy', 'repo_type', 'pin_ceph', 'pin_rabbitmq'))
     self._do_test_attributes_in_white_list(
         release, expected_attributes)
Exemple #8
0
 def test_get_attributes_ubuntu(self):
     self.env.upload_fixtures(['openstack'])
     info = InstallationInfo()
     release = ReleaseCollection.filter_by(None, operating_system='Ubuntu')
     cluster_data = self.env.create_cluster(release_id=release[0].id)
     cluster = Cluster.get_by_uid(cluster_data['id'])
     editable = cluster.attributes.editable
     attr_key_list = [a[1] for a in info.attributes_white_list]
     attrs_dict = info.get_attributes(editable, info.attributes_white_list)
     self.assertEqual(
         # no vlan splinters for ubuntu
         set(attr_key_list) - set(('vlan_splinters', 'vlan_splinters_ovs')),
         set(attrs_dict.keys()))
 def test_get_attributes_ubuntu_uca(self):
     self.env.upload_fixtures(['openstack'])
     releases = ReleaseCollection.filter_by(
         None, operating_system=consts.RELEASE_OS.ubuntu).order_by(
             ReleaseCollection.single.model.id)
     release = releases[1]
     info = InstallationInfo()
     attr_key_list = [a[1] for a in info.attributes_white_list]
     # No vlan splinters for Ubuntu, no mellanox related entries
     # since 8.0.
     expected_attributes = set(attr_key_list) - set(
         ('vlan_splinters', 'vlan_splinters_ovs', 'mellanox',
          'mellanox_vf_num', 'iser'))
     self._do_test_attributes_in_white_list(release, expected_attributes)
 def test_get_attributes_ubuntu(self):
     self.env.upload_fixtures(["openstack"])
     info = InstallationInfo()
     release = ReleaseCollection.filter_by(None, operating_system="Ubuntu")
     cluster_data = self.env.create_cluster(release_id=release[0].id)
     cluster = Cluster.get_by_uid(cluster_data["id"])
     editable = cluster.attributes.editable
     attr_key_list = [a[1] for a in info.attributes_white_list]
     attrs_dict = info.get_attributes(editable, info.attributes_white_list)
     self.assertEqual(
         # no vlan splinters for ubuntu
         set(attr_key_list) - set(("vlan_splinters", "vlan_splinters_ovs")),
         set(attrs_dict.keys()),
     )
 def test_get_attributes_ubuntu_uca(self):
     self.env.upload_fixtures(['openstack'])
     releases = ReleaseCollection.filter_by(
         None, operating_system=consts.RELEASE_OS.ubuntu).order_by(
         ReleaseCollection.single.model.id)
     release = releases[1]
     info = InstallationInfo()
     attr_key_list = [a[1] for a in info.attributes_white_list]
     # No vlan splinters for Ubuntu, no mellanox related entries
     # since 8.0.
     expected_attributes = set(attr_key_list) - set(
         ('vlan_splinters', 'vlan_splinters_ovs',
          'mellanox', 'mellanox_vf_num', 'iser'))
     self._do_test_attributes_in_white_list(
         release, expected_attributes)
Exemple #12
0
 def test_get_attributes_centos(self):
     self.env.upload_fixtures(['openstack'])
     info = InstallationInfo()
     release = ReleaseCollection.filter_by(None, operating_system='CentOS')
     cluster_data = self.env.create_cluster(
         release_id=release[0].id
     )
     cluster = Cluster.get_by_uid(cluster_data['id'])
     editable = cluster.attributes.editable
     attr_key_list = [a[1] for a in info.attributes_white_list]
     attrs_dict = info.get_attributes(editable)
     self.assertEqual(
         set(attr_key_list),
         set(attrs_dict.keys())
     )
 def test_clusters_info_no_vmware_attributes_exception(self):
     self.env.upload_fixtures(["openstack"])
     info = InstallationInfo()
     release = ReleaseCollection.filter_by(None, operating_system=consts.RELEASE_OS.ubuntu)
     nodes_params = [{"roles": ["compute"]}, {"roles": ["compute"]}, {"roles": ["controller"]}]
     self.env.create(
         cluster_kwargs={
             "release_id": release[0].id,
             "mode": consts.CLUSTER_MODES.ha_compact,
             "net_provider": consts.CLUSTER_NET_PROVIDERS.nova_network,
         },
         nodes_kwargs=nodes_params,
     )
     self.env.create_node({"status": consts.NODE_STATUSES.discover})
     cluster = self.env.clusters[0]
     VmwareAttributes.delete(cluster.vmware_attributes)
     self.env.db.flush()
     self.assertNotRaises(AttributeError, info.get_clusters_info)
 def test_get_attributes_ubuntu(self):
     self.env.upload_fixtures(['openstack'])
     info = InstallationInfo()
     release = ReleaseCollection.filter_by(None, operating_system='Ubuntu')
     cluster_data = self.env.create_cluster(
         release_id=release[0].id
     )
     cluster = Cluster.get_by_uid(cluster_data['id'])
     editable = cluster.attributes.editable
     attr_key_list = [a[1] for a in info.attributes_white_list]
     attrs_dict = info.get_attributes(editable, info.attributes_white_list)
     self.assertEqual(
         # No vlan splinters for ubuntu.
         # And no mellanox related entries since 8.0.
         set(attr_key_list) - set(
             ('vlan_splinters', 'vlan_splinters_ovs',
              'mellanox', 'mellanox_vf_num', 'iser')),
         set(attrs_dict.keys())
     )
    def test_clusters_info(self):
        self.env.upload_fixtures(["openstack"])
        info = InstallationInfo()
        release = ReleaseCollection.filter_by(None, operating_system=consts.RELEASE_OS.ubuntu)
        nodes_params = [{"roles": ["compute"]}, {"roles": ["compute"]}, {"roles": ["controller"]}]
        self.env.create(
            cluster_kwargs={
                "release_id": release[0].id,
                "mode": consts.CLUSTER_MODES.ha_compact,
                "net_provider": consts.CLUSTER_NET_PROVIDERS.nova_network,
            },
            nodes_kwargs=nodes_params,
        )
        self.env.create_node({"status": consts.NODE_STATUSES.discover})
        clusters_info = info.get_clusters_info()
        cluster = self.env.clusters[0]
        self.assertEquals(1, len(clusters_info))
        cluster_info = clusters_info[0]

        self.assertEquals(len(nodes_params), len(cluster_info["nodes"]))
        self.assertEquals(len(nodes_params), cluster_info["nodes_num"])

        self.assertEquals(consts.CLUSTER_MODES.ha_compact, cluster_info["mode"])
        self.assertEquals(consts.CLUSTER_NET_PROVIDERS.nova_network, cluster_info["net_provider"])
        self.assertEquals(consts.CLUSTER_STATUSES.new, cluster_info["status"])
        self.assertEquals(False, cluster_info["is_customized"])

        self.assertEquals(cluster.id, cluster_info["id"])
        self.assertEquals(cluster.fuel_version, cluster_info["fuel_version"])

        self.assertTrue("attributes" in cluster_info)

        self.assertTrue("release" in cluster_info)
        self.assertEquals(cluster.release.operating_system, cluster_info["release"]["os"])
        self.assertEquals(cluster.release.name, cluster_info["release"]["name"])
        self.assertEquals(cluster.release.version, cluster_info["release"]["version"])

        self.assertEquals(1, len(cluster_info["node_groups"]))
        group_info = cluster_info["node_groups"][0]
        group = [ng for ng in cluster.node_groups][0]
        self.assertEquals(group.id, group_info["id"])
        self.assertEquals(len(nodes_params), len(group_info["nodes"]))
        self.assertEquals(set([n.id for n in group.nodes]), set(group_info["nodes"]))
 def test_clusters_info_no_vmware_attributes_exception(self):
     self.env.upload_fixtures(['openstack'])
     info = InstallationInfo()
     release = ReleaseCollection.filter_by(None, operating_system='CentOS')
     nodes_params = [
         {'roles': ['compute']},
         {'roles': ['compute']},
         {'roles': ['controller']}
     ]
     self.env.create(
         cluster_kwargs={
             'release_id': release[0].id,
             'mode': consts.CLUSTER_MODES.ha_compact,
             'net_provider': consts.CLUSTER_NET_PROVIDERS.nova_network},
         nodes_kwargs=nodes_params
     )
     self.env.create_node({'status': consts.NODE_STATUSES.discover})
     cluster = self.env.clusters[0]
     VmwareAttributes.delete(cluster.vmware_attributes)
     self.env.db.flush()
     self.assertNotRaises(AttributeError, info.get_clusters_info)