本文整理汇总了Python中pyvcloud.system_test_framework.environment.Environment.get_config方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.get_config方法的具体用法?Python Environment.get_config怎么用?Python Environment.get_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.system_test_framework.environment.Environment
的用法示例。
在下文中一共展示了Environment.get_config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_0000_setup
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_config [as 别名]
def test_0000_setup(self):
"""Add Firewall Rules in the gateway.
Invokes the add_firewall_rule of the gateway.
"""
TestFirewallRules._org_client = Environment.get_client_in_default_org(
TestFirewallRules._test_runner_role)
TestFirewallRules._system_client = Environment.get_sys_admin_client()
TestFirewallRules._config = Environment.get_config()
gateway = Environment.get_test_gateway(TestFirewallRules._org_client)
TestFirewallRules._gateway_obj = Gateway(
TestFirewallRules._org_client,
TestFirewallRules._name,
href=gateway.get('href'))
TestFirewallRules._external_network = Environment. \
get_test_external_network(TestFirewallRules._system_client)
TestFirewallRules._gateway_obj.add_firewall_rule(
TestFirewallRules._firewall_rule_name)
firewall_rules_resource = \
TestFirewallRules._gateway_obj.get_firewall_rules()
# Verify
matchFound = False
for firewallRule in firewall_rules_resource.firewallRules.firewallRule:
if firewallRule['name'] == TestFirewallRules._firewall_rule_name:
TestFirewallRules._rule_id = firewallRule.id
matchFound = True
break
self.assertTrue(matchFound)
示例2: test_0000_setup
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_config [as 别名]
def test_0000_setup(self):
self._config = Environment.get_config()
TestFirewallRule._logger = Environment.get_default_logger()
TestFirewallRule._client = Environment.get_sys_admin_client()
TestFirewallRule._runner = CliRunner()
default_org = self._config['vcd']['default_org_name']
TestFirewallRule._ext_nw = self._config['external_network']['name']
self._login()
TestFirewallRule._runner.invoke(org, ['use', default_org])
result = TestFirewallRule._runner.invoke(
gateway,
args=[
'services', 'firewall', 'create', TestFirewallRule.__name,
'--name', TestFirewallRule.__firewall_rule_name, '--action',
'accept', '--type', 'User', '--enabled', '--logging-enabled'
])
self.assertEqual(0, result.exit_code)
gateway_res = Environment.get_test_gateway(TestFirewallRule._client)
gateway_obj = Gateway(
TestFirewallRule._client, href=gateway_res.get('href'))
firewall_rules = gateway_obj.get_firewall_rules()
for rule in firewall_rules.firewallRules.firewallRule:
if rule.name == TestFirewallRule.__firewall_rule_name:
TestFirewallRule._rule_id = rule.id
break
示例3: test_0000_setup
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_config [as 别名]
def test_0000_setup(self):
"""Add the sub allocated ip pools to gateway.
This sub allocated ip pools required by the Nat Rule
Invokes the add_sub_allocated_ip_pools of the gateway.
"""
TestNatRule._client = Environment.get_sys_admin_client()
TestNatRule._config = Environment.get_config()
gateway = Environment. \
get_test_gateway(TestNatRule._client)
gateway_obj = Gateway(TestNatRule._client,
TestNatRule._name,
href=gateway.get('href'))
ip_allocations = gateway_obj.list_configure_ip_settings()
ip_allocation = ip_allocations[0]
ext_network = ip_allocation.get('external_network')
config = TestNatRule._config['external_network']
gateway_sub_allocated_ip_range = \
config['gateway_sub_allocated_ip_range']
ip_range_list = [gateway_sub_allocated_ip_range]
task = gateway_obj.add_sub_allocated_ip_pools(ext_network,
ip_range_list)
result = TestNatRule._client.get_task_monitor().wait_for_success(
task=task)
self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)
gateway_obj = Gateway(TestNatRule._client,
TestNatRule._name,
href=gateway.get('href'))
subnet_participation = self.__get_subnet_participation(
gateway_obj.get_resource(), ext_network)
ip_ranges = gateway_obj.get_sub_allocate_ip_ranges_element(
subnet_participation)
self.__validate_ip_range(ip_ranges, gateway_sub_allocated_ip_range)
示例4: setUp
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_config [as 别名]
def setUp(self):
"""Load configuration and create a click runner to invoke CLI."""
self._config = Environment.get_config()
self._logger = Environment.get_default_logger()
self._runner = CliRunner()
self._login()
示例5: setUp
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_config [as 别名]
def setUp(self):
self._config = Environment.get_config()
self._host = self._config['vcd']['host']
self._org = self._config['vcd']['sys_org_name']
self._user = self._config['vcd']['sys_admin_username']
self._pass = self._config['vcd']['sys_admin_pass']
self._logger = Environment.get_default_logger()
示例6: setUp
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_config [as 别名]
def setUp(self):
"""Load configuration and create a click runner to invoke CLI."""
self._config = Environment.get_config()
self._host = self._config['vcd']['host']
self._org = self._config['vcd']['sys_org_name']
self._admin_user = self._config['vcd']['sys_admin_username']
self._admin_pass = self._config['vcd']['sys_admin_pass']
self._logger = Environment.get_default_logger()
self._runner = CliRunner()
示例7: test_0020_pvdc_setup
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_config [as 别名]
def test_0020_pvdc_setup(self):
TestPVDC._config = Environment.get_config()
TestPVDC._pvdc_name = self._config['pvdc']['pvdc_name']
TestPVDC._resource_pool_names = \
self._config['pvdc']['respools_to_attach']
TestPVDC._vms_to_migrate = []
TestPVDC._vms_to_migrate.append(TestPVDC._test_vapp_first_vm_name)
TestPVDC._target_resource_pool = \
self._config['pvdc']['target_resource_pool']
TestPVDC._storage_profiles = \
self._config['pvdc']['storage_profiles']
示例8: test_0040_get_vc
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_config [as 别名]
def test_0040_get_vc(self):
"""Test the method VM.get_vc().
This test passes if the retrieved vc name matches with the expected
vc name.
"""
vm = VM(TestVM._sys_admin_client, href=TestVM._test_vapp_first_vm_href)
retrieved_vc_name = vm.get_vc()
expected_vc_name = Environment.get_config()['vc']['vcenter_host_name']
self.assertEqual(retrieved_vc_name, expected_vc_name)
示例9: test_0000_setup
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_config [as 别名]
def test_0000_setup(self):
TestCaCertificates._client = Environment.get_sys_admin_client()
TestCaCertificates._config = Environment.get_config()
TestCaCertificates._org = Environment.get_test_org(
TestCaCertificates._client)
test_gateway = Environment.get_test_gateway(TestCaCertificates._client)
gateway_obj1 = Gateway(TestCaCertificates._client, GatewayConstants.name,
href=test_gateway.get('href'))
TestCaCertificates.gateway_obj = gateway_obj1
TestCaCertificates._runner = CliRunner()
default_org = self._config['vcd']['default_org_name']
self._login()
TestCaCertificates._runner.invoke(org, ['use', default_org])
示例10: test_0001_list_static_routes
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_config [as 别名]
def test_0001_list_static_routes(self):
"""List Static Routes of the gateway.
Invokes the list_static_routes of the gateway.
"""
TestStaticRoute._config = Environment.get_config()
gateway = Environment. \
get_test_gateway(TestStaticRoute._client)
gateway_obj = Gateway(TestStaticRoute._client,
TestStaticRoute._name,
href=gateway.get('href'))
static_route_list = gateway_obj.list_static_routes()
# Verify
self.assertTrue(len(static_route_list) > 0)
示例11: test_0001_list_dhcp_pools
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_config [as 别名]
def test_0001_list_dhcp_pools(self):
"""List DHCP pools of the gateway.
Invokes the list_dhcp_pools of the gateway.
"""
TestDhcp._config = Environment.get_config()
gateway = Environment. \
get_test_gateway(TestDhcp._client)
gateway_obj = Gateway(TestDhcp._client,
TestDhcp._name,
href=gateway.get('href'))
dhcp_pool_list = gateway_obj.list_dhcp_pools()
# Verify
self.assertTrue(len(dhcp_pool_list) > 0)
示例12: test_0001_list_firewall_rules
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_config [as 别名]
def test_0001_list_firewall_rules(self):
"""List Firewall Rules of the gateway.
Invokes the get_firewall_rules_list of the gateway.
"""
TestFirewallRules._config = Environment.get_config()
gateway = Environment. \
get_test_gateway(TestFirewallRules._org_client)
gateway_obj = Gateway(
TestFirewallRules._org_client,
TestFirewallRules._name,
href=gateway.get('href'))
firewall_rules_list = gateway_obj.get_firewall_rules_list()
# Verify
self.assertTrue(len(firewall_rules_list) > 0)
示例13: test_0000_setup
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_config [as 别名]
def test_0000_setup(self):
# TODO(): need more pipeline work before this test can actually be run
TestVC._client = Environment.get_sys_admin_client()
TestVC._config = Environment.get_config()
TestVC._vcenter_host_name = self._config['vc']['vcenter_host_name']
TestVC._vcenter_invalid = 'xyz'
TestVC._vcServerName = self._config['vc']['vcServerName']
TestVC._vcServerHost = self._config['vc']['vcServerHost']
TestVC._vcAdminUser = self._config['vc']['vcAdminUser']
TestVC._vcAdminPwd = self._config['vc']['vcAdminPwd']
TestVC._NSXServerName = self._config['vc']['NSXServerName']
TestVC._NSXHost = self._config['vc']['NSXHost']
TestVC._NSXAdminUser = self._config['vc']['NSXAdminUser']
TestVC._NSXAdminPwd = self._config['vc']['NSXAdminPwd']
TestVC._isEnabled = False
示例14: test_0098_teardown
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_config [as 别名]
def test_0098_teardown(self):
"""Delete a DHCP Pool from gateway.
It will trigger the cli command services dhcp-pool delete
"""
self._config = Environment.get_config()
TestDhcpPool._logger = Environment.get_default_logger()
TestDhcpPool._runner = CliRunner()
default_org = self._config['vcd']['default_org_name']
TestDhcpPool._runner.invoke(org, ['use', default_org])
result = TestDhcpPool._runner.invoke(
gateway,
args=[
'services', 'dhcp-pool', 'delete', TestDhcpPool._gateway_name,
TestDhcpPool._pool_id])
self.assertEqual(0, result.exit_code)
示例15: test_0000_setup
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_config [as 别名]
def test_0000_setup(self):
"""Adds new DHCP pool to the gateway.
It will trigger the cli command service dhcp-pool create
"""
self._config = Environment.get_config()
TestDhcpPool._logger = Environment.get_default_logger()
TestDhcpPool._runner = CliRunner()
default_org = self._config['vcd']['default_org_name']
self._login()
TestDhcpPool._runner.invoke(org, ['use', default_org])
result = TestDhcpPool._runner.invoke(
gateway,
args=[
'services', 'dhcp-pool', 'create', TestDhcpPool._gateway_name,
'-r', TestDhcpPool._pool_ip_range])
self.assertEqual(0, result.exit_code)