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


Python InstallationInfo.get_nodes_info方法代码示例

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


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

示例1: test_nodes_info

# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_nodes_info [as 别名]
    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,代码行数:62,代码来源:test_installation_info.py

示例2: test_nodes_info

# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_nodes_info [as 别名]
    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,代码行数:59,代码来源:test_installation_info.py

示例3: test_nodes_info

# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_nodes_info [as 别名]
    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
        )
        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:gdyuldin,项目名称:fuel-web,代码行数:43,代码来源:test_installation_info.py


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