当前位置: 首页>>代码示例>>Python>>正文


Python installation_info.InstallationInfo类代码示例

本文整理汇总了Python中nailgun.statistics.fuel_statistics.installation_info.InstallationInfo的典型用法代码示例。如果您正苦于以下问题:Python InstallationInfo类的具体用法?Python InstallationInfo怎么用?Python InstallationInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了InstallationInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_network_configuration

    def test_network_configuration(self):
        info = InstallationInfo()
        # Checking nova network configuration
        nova = consts.CLUSTER_NET_PROVIDERS.nova_network
        self.env.create(cluster_kwargs={
            'mode': consts.CLUSTER_MODES.ha_full,
            'net_provider': nova
        })
        clusters_info = info.get_clusters_info()
        cluster_info = clusters_info[0]
        self.assertTrue('network_configuration' in cluster_info)
        network_config = cluster_info['network_configuration']

        for field in ('fixed_network_size', 'fixed_networks_vlan_start',
                      'fixed_networks_amount', 'net_manager'):
            self.assertIn(field, network_config)

        # Checking neutron network configuration
        neutron = consts.CLUSTER_NET_PROVIDERS.neutron
        self.env.create(cluster_kwargs={
            'mode': consts.CLUSTER_MODES.ha_full,
            'net_provider': neutron
        })
        clusters_info = info.get_clusters_info()
        # Clusters info is unordered list, so we should find required
        # cluster_info
        cluster_info = filter(lambda x: x['net_provider'] == neutron,
                              clusters_info)[0]
        self.assertTrue('network_configuration' in cluster_info)
        network_config = cluster_info['network_configuration']

        for field in ('segmentation_type', 'net_l23_provider'):
            self.assertIn(field, network_config)
开发者ID:apporc,项目名称:fuel-web,代码行数:33,代码来源:test_installation_info.py

示例2: test_plugins_info

    def test_plugins_info(self):
        info = InstallationInfo()

        cluster = self.env.create_cluster(api=False)

        plugin_kwargs = self.env.get_default_plugin_metadata()
        plugin_obj = plugins.Plugin(**plugin_kwargs)

        self.db.add(plugin_obj)
        self.db.flush()

        plugin_kwargs["id"] = plugin_obj.id

        cluster_plugin_kwargs = {"cluster_id": cluster.id, "plugin_id": plugin_obj.id, "enabled": True}
        cluster_plugin = plugins.ClusterPlugins(**cluster_plugin_kwargs)

        self.db.add(cluster_plugin)
        self.db.flush()

        expected_attributes_names = ("id", "name", "version", "releases", "fuel_version", "package_version")

        expected_info = dict(
            [(key, value) for key, value in six.iteritems(plugin_kwargs) if key in expected_attributes_names]
        )

        expected = [expected_info]
        actual = info.get_cluster_plugins_info(cluster)
        self.assertEqual(expected, actual)
开发者ID:gdyuldin,项目名称:fuel-web,代码行数:28,代码来源:test_installation_info.py

示例3: test_installation_info

 def test_installation_info(self):
     info = InstallationInfo()
     nodes_params = [
         {'roles': ['compute']},
         {'roles': ['compute']},
         {'roles': ['controller']}
     ]
     self.env.create(
         release_kwargs={
             'operating_system': consts.RELEASE_OS.centos
         },
         cluster_kwargs={},
         nodes_kwargs=nodes_params
     )
     unallocated_nodes_params = [
         {'status': consts.NODE_STATUSES.discover},
         {'status': consts.NODE_STATUSES.discover}
     ]
     for unallocated_node in unallocated_nodes_params:
         self.env.create_node(**unallocated_node)
     info = info.get_installation_info()
     self.assertEquals(1, info['clusters_num'])
     self.assertEquals(len(nodes_params), info['allocated_nodes_num'])
     self.assertEquals(len(unallocated_nodes_params),
                       info['unallocated_nodes_num'])
     self.assertTrue('master_node_uid' in info)
     self.assertTrue('contact_info_provided' in info['user_information'])
     self.assertDictEqual(settings.VERSION, info['fuel_release'])
开发者ID:apporc,项目名称:fuel-web,代码行数:28,代码来源:test_installation_info.py

示例4: test_network_configuration

    def test_network_configuration(self):
        info = InstallationInfo()
        # Checking nova network configuration
        nova = consts.CLUSTER_NET_PROVIDERS.nova_network
        self.env.create(cluster_kwargs={"mode": consts.CLUSTER_MODES.ha_compact, "net_provider": nova})
        clusters_info = info.get_clusters_info()
        cluster_info = clusters_info[0]
        self.assertTrue("network_configuration" in cluster_info)
        network_config = cluster_info["network_configuration"]

        for field in ("fixed_network_size", "fixed_networks_vlan_start", "fixed_networks_amount", "net_manager"):
            self.assertIn(field, network_config)

        # Checking neutron network configuration
        neutron = consts.CLUSTER_NET_PROVIDERS.neutron
        self.env.create(cluster_kwargs={"mode": consts.CLUSTER_MODES.ha_compact, "net_provider": neutron})
        clusters_info = info.get_clusters_info()
        # Clusters info is unordered list, so we should find required
        # cluster_info
        cluster_info = filter(lambda x: x["net_provider"] == neutron, clusters_info)[0]
        self.assertTrue("network_configuration" in cluster_info)
        network_config = cluster_info["network_configuration"]

        for field in ("segmentation_type", "net_l23_provider"):
            self.assertIn(field, network_config)
开发者ID:gdyuldin,项目名称:fuel-web,代码行数:25,代码来源:test_installation_info.py

示例5: test_nodes_info

    def test_nodes_info(self):
        info = InstallationInfo()
        cluster = self.env.create(
            release_kwargs={
                'operating_system': consts.RELEASE_OS.centos
            })
        self.env.create_nodes_w_interfaces_count(
            nodes_count=2,
            if_count=4,
            roles=['controller', 'compute'],
            pending_addition=True,
            cluster_id=cluster['id'])

        self.env.make_bond_via_api(
            'bond0', consts.BOND_MODES.active_backup,
            ['eth1', 'eth2'], node_id=self.env.nodes[0].id,
            attrs={'type__': {'value': consts.BOND_TYPES.linux}})
        nodes_info = info.get_nodes_info(self.env.nodes)
        self.assertEquals(len(self.env.nodes), len(nodes_info))
        for idx, node in enumerate(self.env.nodes):
            node_info = nodes_info[idx]
            self.assertEquals(node_info['id'], node.id)
            self.assertEquals(node_info['group_id'], node.group_id)
            self.assertListEqual(node_info['roles'], node.roles)
            self.assertEquals(node_info['os'], node.os_platform)

            self.assertEquals(node_info['status'], node.status)
            self.assertEquals(node_info['error_type'], node.error_type)
            self.assertEquals(node_info['online'], node.online)

            self.assertEquals(node_info['manufacturer'], node.manufacturer)
            self.assertEquals(node_info['platform_name'], node.platform_name)

            self.assertIn('meta', node_info)
            for iface in node_info['meta']['interfaces']:
                self.assertNotIn('mac', iface)
            self.assertNotIn('fqdn', node_info['meta']['system'])
            self.assertNotIn('serial', node_info['meta']['system'])
            self.assertIn('cpu', node_info['meta'])
            self.assertIn('memory', node_info['meta'])
            self.assertIn('disks', node_info['meta'])
            self.assertIn('pci_devices', node_info['meta'])
            self.assertIn('interfaces', node_info['meta'])
            self.assertIn('numa_topology', node_info['meta'])

            self.assertEquals(node_info['pending_addition'],
                              node.pending_addition)
            self.assertEquals(node_info['pending_deletion'],
                              node.pending_deletion)
            self.assertEquals(node_info['pending_roles'], node.pending_roles)

            self.assertEqual(
                node_info['nic_interfaces'],
                [{'id': i.id} for i in node.nic_interfaces]
            )
            self.assertEqual(
                node_info['bond_interfaces'],
                [{'id': i.id, 'slaves': [s.id for s in i.slaves]}
                 for i in node.bond_interfaces]
            )
开发者ID:openstack,项目名称:fuel-web,代码行数:60,代码来源:test_installation_info.py

示例6: test_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']))
开发者ID:mmalchuk,项目名称:openstack-fuel-web,代码行数:59,代码来源:test_installation_info.py

示例7: test_nodes_info

    def test_nodes_info(self):
        info = InstallationInfo()
        self.env.create(
            release_kwargs={
                'operating_system': consts.RELEASE_OS.centos
            },
            nodes_kwargs=[
                {'status': consts.NODE_STATUSES.discover,
                 'roles': ['controller', 'compute'],
                 'meta': {}},
                {'roles': [],
                 'pending_roles': ['compute'],
                 'meta': {'cpu': {},
                          'interfaces': [{'mac': 'x', 'name': 'eth0'}],
                          'disks': [{'name': 'a', 'disk': 'a'}]}}
            ]
        )
        self.env.make_bond_via_api(
            'bond0', consts.BOND_MODES.active_backup,
            ['eth0', 'eth1'], node_id=self.env.nodes[0].id)
        nodes_info = info.get_nodes_info(self.env.nodes)
        self.assertEquals(len(self.env.nodes), len(nodes_info))
        for idx, node in enumerate(self.env.nodes):
            node_info = nodes_info[idx]
            self.assertEquals(node_info['id'], node.id)
            self.assertEquals(node_info['group_id'], node.group_id)
            self.assertListEqual(node_info['roles'], node.roles)
            self.assertEquals(node_info['os'], node.os_platform)

            self.assertEquals(node_info['status'], node.status)
            self.assertEquals(node_info['error_type'], node.error_type)
            self.assertEquals(node_info['online'], node.online)

            self.assertEquals(node_info['manufacturer'], node.manufacturer)
            self.assertEquals(node_info['platform_name'], node.platform_name)

            self.assertIn('meta', node_info)
            for iface in node_info['meta']['interfaces']:
                self.assertNotIn('mac', iface)
            self.assertNotIn('fqdn', node_info['meta']['system'])
            self.assertNotIn('serial', node_info['meta']['system'])

            self.assertEquals(node_info['pending_addition'],
                              node.pending_addition)
            self.assertEquals(node_info['pending_deletion'],
                              node.pending_deletion)
            self.assertEquals(node_info['pending_roles'], node.pending_roles)

            self.assertEqual(
                node_info['nic_interfaces'],
                [{'id': i.id} for i in node.nic_interfaces]
            )
            self.assertEqual(
                node_info['bond_interfaces'],
                [{'id': i.id, 'slaves': [s.id for s in i.slaves]}
                 for i in node.bond_interfaces]
            )
开发者ID:nebril,项目名称:fuel-web,代码行数:57,代码来源:test_installation_info.py

示例8: test_get_attributes_centos

 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()))
开发者ID:gdyuldin,项目名称:fuel-web,代码行数:11,代码来源:test_installation_info.py

示例9: test_get_attributes_exception_handled

 def test_get_attributes_exception_handled(self):
     info = InstallationInfo()
     variants = [
         None,
         {},
         {'common': None},
         {'common': {'libvirt_type': {}}},
         {'common': {'libvirt_type': 3}},
     ]
     for attrs in variants:
         result = info.get_attributes(attrs, info.attributes_white_list)
         self.assertDictEqual({}, result)
开发者ID:apporc,项目名称:fuel-web,代码行数:12,代码来源:test_installation_info.py

示例10: test_get_attributes_ubuntu

 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()),
     )
开发者ID:gdyuldin,项目名称:fuel-web,代码行数:14,代码来源:test_installation_info.py

示例11: _do_test_attributes_in_white_list

    def _do_test_attributes_in_white_list(self, release,
                                          expected_attributes):
        cluster_data = self.env.create_cluster(
            release_id=release.id
        )
        cluster = Cluster.get_by_uid(cluster_data['id'])
        editable = cluster.attributes.editable

        info = InstallationInfo()
        actual_attributes = info.get_attributes(
            editable, info.attributes_white_list)
        self.assertEqual(
            set(expected_attributes),
            set(actual_attributes.keys())
        )
开发者ID:mmalchuk,项目名称:openstack-fuel-web,代码行数:15,代码来源:test_installation_info.py

示例12: test_all_cluster_data_collected

    def test_all_cluster_data_collected(self):
        self.env.create(nodes_kwargs=[{"roles": ["compute"]}])
        self.env.create_node(status=consts.NODE_STATUSES.discover)

        # Fetching installation info struct
        info = InstallationInfo()
        info = info.get_installation_info()
        actual_cluster = info["clusters"][0]

        # Creating cluster schema
        cluster_schema = {}
        for column in inspect(cluster_model.Cluster).columns:
            cluster_schema[six.text_type(column.name)] = None
        for rel in inspect(cluster_model.Cluster).relationships:
            cluster_schema[six.text_type(rel.table.name)] = None

        # Removing of not required fields
        remove_fields = (
            "tasks",
            "cluster_changes",
            "nodegroups",
            "pending_release_id",
            "releases",
            "replaced_provisioning_info",
            "notifications",
            "deployment_tasks",
            "name",
            "replaced_deployment_info",
            "ui_settings",
        )
        for field in remove_fields:
            cluster_schema.pop(field)
        # Renaming fields for matching
        rename_fields = (
            ("plugins", "installed_plugins"),
            ("networking_configs", "network_configuration"),
            ("release_id", "release"),
        )
        for name_from, name_to in rename_fields:
            cluster_schema.pop(name_from)
            cluster_schema[name_to] = None

        # If test failed here it means, that you have added properties
        # to cluster and they are not exported into statistics.
        # If you don't know  what to do, contact fuel-stats team please.
        for key in six.iterkeys(cluster_schema):
            self.assertIn(key, actual_cluster)
开发者ID:gdyuldin,项目名称:fuel-web,代码行数:47,代码来源:test_installation_info.py

示例13: test_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"]}]
        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"]))
开发者ID:gdyuldin,项目名称:fuel-web,代码行数:43,代码来源:test_installation_info.py

示例14: test_installation_info

 def test_installation_info(self):
     info = InstallationInfo()
     nodes_params = [{"roles": ["compute"]}, {"roles": ["compute"]}, {"roles": ["controller"]}]
     self.env.create(
         release_kwargs={"operating_system": consts.RELEASE_OS.centos}, cluster_kwargs={}, nodes_kwargs=nodes_params
     )
     unallocated_nodes_params = [
         {"status": consts.NODE_STATUSES.discover},
         {"status": consts.NODE_STATUSES.discover},
     ]
     for unallocated_node in unallocated_nodes_params:
         self.env.create_node(**unallocated_node)
     info = info.get_installation_info()
     self.assertEquals(1, info["clusters_num"])
     self.assertEquals(len(nodes_params), info["allocated_nodes_num"])
     self.assertEquals(len(unallocated_nodes_params), info["unallocated_nodes_num"])
     self.assertTrue("master_node_uid" in info)
     self.assertTrue("contact_info_provided" in info["user_information"])
     self.assertDictEqual(settings.VERSION, info["fuel_release"])
开发者ID:gdyuldin,项目名称:fuel-web,代码行数:19,代码来源:test_installation_info.py

示例15: test_get_attributes_ubuntu

 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())
     )
开发者ID:ansumanbebarta,项目名称:fuel-web,代码行数:19,代码来源:test_installation_info.py


注:本文中的nailgun.statistics.fuel_statistics.installation_info.InstallationInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。