本文整理汇总了Python中nailgun.statistics.fuel_statistics.installation_info.InstallationInfo.get_clusters_info方法的典型用法代码示例。如果您正苦于以下问题:Python InstallationInfo.get_clusters_info方法的具体用法?Python InstallationInfo.get_clusters_info怎么用?Python InstallationInfo.get_clusters_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.statistics.fuel_statistics.installation_info.InstallationInfo
的用法示例。
在下文中一共展示了InstallationInfo.get_clusters_info方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_network_configuration
# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_clusters_info [as 别名]
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)
示例2: test_network_configuration
# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_clusters_info [as 别名]
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)
示例3: test_clusters_info
# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_clusters_info [as 别名]
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']))
示例4: test_clusters_info
# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_clusters_info [as 别名]
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"]))