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


Python Environment.get_test_gateway方法代码示例

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


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

示例1: test_0000_setup

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_gateway [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)
开发者ID:vmware,项目名称:pyvcloud,代码行数:32,代码来源:firewall_rule_tests.py

示例2: test_0000_setup

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_gateway [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
开发者ID:vmware,项目名称:vca-cli,代码行数:28,代码来源:firewall_rule_tests.py

示例3: __convert_enable_dr_in_gateway_using_sys_client

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_gateway [as 别名]
    def __convert_enable_dr_in_gateway_using_sys_client(self, is_enable):
        client = TestNetwork._system_client
        gateway = Environment.get_test_gateway(client)
        if is_enable is True:
            current_state = 'false'
            new_state = 'true'
        else:
            current_state = 'true'
            new_state = 'false'

        if gateway.get('distributedRoutingEnabled') == current_state:
            self.__enable_gateway_distributed_routing(client, gateway,
                                                      is_enable)
            gateway = Environment.get_test_gateway(client)
            self.assertEqual(
                gateway.get('distributedRoutingEnabled'), new_state)
开发者ID:vmware,项目名称:pyvcloud,代码行数:18,代码来源:network_tests.py

示例4: test_0000_setup

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_gateway [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])
开发者ID:vmware,项目名称:vca-cli,代码行数:15,代码来源:ca_certificate_tests.py

示例5: test_0025_add_ca_certificate

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_gateway [as 别名]
 def test_0025_add_ca_certificate(self):
     """Add CA certificate in the gateway.
     Invokes the add_ca_certificate of the gateway.
     """
     gateway = Environment.get_test_gateway(TestCertificates._client)
     gateway_obj1 = Gateway(TestCertificates._client, GatewayConstants.name,
                            href=gateway.get('href'))
     TestCertificates._gateway1 = gateway_obj1
     gateway_obj1.add_ca_certificate(
         ca_certificate_file_path=TestCertificates.
             _ca_certificate_file_path)
     gateway_obj1.reload()
     certificates = gateway_obj1.get_certificates()
     self.__validate_certificate(certificates)
开发者ID:vmware,项目名称:pyvcloud,代码行数:16,代码来源:certificate_tests.py

示例6: test_0100_add_dhcp_pool

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_gateway [as 别名]
    def test_0100_add_dhcp_pool(self):
        """Add DHCP pool in the gateway.
         Invokes the add_dhcp_pool of the gateway.
        """

        gateway_obj = Gateway(
            TestGateway._client, self._name,
            Environment.get_test_gateway(Environment.get_sys_admin_client())
            .get('href'))
        gateway_obj.add_dhcp_pool(TestGateway._pool_ip_range)
        dhcp_resource = gateway_obj.get_dhcp()
        # Verify
        matchFound = False
        for ipPool in dhcp_resource.ipPools.ipPool:
            if ipPool.ipRange.text == TestGateway._pool_ip_range:
                matchFound = True
                break
        self.assertTrue(matchFound)
开发者ID:vmware,项目名称:pyvcloud,代码行数:20,代码来源:gateway_tests.py

示例7: test_0000_setup

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_gateway [as 别名]
    def test_0000_setup(self):
        """Add one orgvdc, one gateways and one routed orgvdc networks.

        """
        TestIpSecVpn._client = Environment.get_sys_admin_client()
        TestIpSecVpn._logger = Environment.get_default_logger()
        TestIpSecVpn._config = Environment.get_config()
        TestIpSecVpn._org = Environment.get_test_org(TestIpSecVpn._client)
        TestIpSecVpn._pvdc_name = Environment.get_test_pvdc_name()
        TestIpSecVpn._ext_config = TestIpSecVpn._config['external_network']
        TestIpSecVpn._ext_net_name = TestIpSecVpn._ext_config['name']
        # Create another vdc, gateway and routed network

        self.__create_ovdc()
        self.__create_advanced_gateway()
        self.__create_routed_ovdc_network()
        test_gateway = Environment.get_test_gateway(TestIpSecVpn._client)
        gateway_obj1 = Gateway(TestIpSecVpn._client, GatewayConstants.name,
                               href=test_gateway.get('href'))
        gateway_obj2 = TestIpSecVpn._gateway_obj
        TestIpSecVpn._local_ip = self.__get_ip_address(
            gateway=gateway_obj1, ext_net_name=TestIpSecVpn._ext_net_name)

        TestIpSecVpn._peer_ip = self.__get_ip_address(
            gateway=gateway_obj2, ext_net_name=TestIpSecVpn._ext_net_name)

        TestIpSecVpn._runner = CliRunner()
        default_org = self._config['vcd']['default_org_name']
        self._login()
        TestIpSecVpn._runner.invoke(org, ['use', default_org])
        result = TestIpSecVpn._runner.invoke(
            gateway,
            args=[
                'services', 'ipsec-vpn', 'create', TestIpSecVpn._name,
                '--name', TestIpSecVpn._ipsec_vpn_name,
                '--local-id', TestIpSecVpn._local_id,
                '--peer-id', TestIpSecVpn._peer_id,
                '--local-ip', TestIpSecVpn._local_ip,
                '--peer-ip', TestIpSecVpn._peer_ip,
                '--local-subnet', TestIpSecVpn._local_subnet,
                '--peer-subnet', TestIpSecVpn._peer_subnet,
                '--pre-shared-key', TestIpSecVpn._psk, '--enable'])
        self.assertEqual(0, result.exit_code)
开发者ID:vmware,项目名称:vca-cli,代码行数:45,代码来源:ipsec_vpn_tests.py

示例8: test_0105_add_dhcp_binding

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_gateway [as 别名]
    def test_0105_add_dhcp_binding(self):
        """Add DHCP Binding in the gateway.

         Invokes the add_dhcp_binding of the gateway.
        """
        gateway_obj = Gateway(
            TestGateway._client, self._name,
            Environment.get_test_gateway(Environment.get_sys_admin_client())
            .get('href'))
        gateway_obj.add_dhcp_binding(TestGateway._mac_address,
                                     TestGateway._host_name,
                                     TestGateway._binding_ip_address)
        dhcp_resource = gateway_obj.get_dhcp()
        # Verify
        matchFound = False
        for static_binding in dhcp_resource.staticBindings.staticBinding:
            if static_binding.macAddress.text == TestGateway._mac_address:
                matchFound = True
                break
        self.assertTrue(matchFound)
开发者ID:vmware,项目名称:pyvcloud,代码行数:22,代码来源:gateway_tests.py


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