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


Python VCA.get_gateway方法代码示例

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


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

示例1: __init__

# 需要导入模块: from pyvcloud.vcloudair import VCA [as 别名]
# 或者: from pyvcloud.vcloudair.VCA import get_gateway [as 别名]

#.........这里部分代码省略.........
        the_vdc = self.vca.get_vdc(vdc_name)
        assert the_vdc
        assert the_vdc.get_name() == vdc_name
        the_vapp = self.vca.get_vapp(the_vdc, vapp_name)
        assert the_vapp
        assert the_vapp.name == vapp_name
        details = the_vapp.get_vms_details()
        assert details[0].get('cpus') == cpus
        task = the_vapp.modify_vm_cpu(vm_name, cpus_new)
        assert task
        result = self.vca.block_until_completed(task)
        assert result
        the_vapp = self.vca.get_vapp(the_vdc, vapp_name)
        assert the_vapp
        assert the_vapp.name == vapp_name
        details = the_vapp.get_vms_details()
        assert details[0].get('cpus') == cpus_new

    def test_0009(self):
        """Add NAT rule"""
        vdc_name = config['vcloud']['vdc']
        vapp_name = config['vcloud']['vapp']
        vm_name = config['vcloud']['vm']
        gateway_name = config['vcloud']['gateway']
        rule_type = config['vcloud']['nat_rule_type']
        original_ip = config['vcloud']['nat_original_ip']
        original_port = config['vcloud']['nat_original_port']
        translated_ip = config['vcloud']['nat_translated_ip']
        translated_port = config['vcloud']['nat_translated_port']
        protocol = config['vcloud']['nat_protocol']
        the_vdc = self.vca.get_vdc(vdc_name)
        assert the_vdc
        assert the_vdc.get_name() == vdc_name
        the_gateway = self.vca.get_gateway(vdc_name, gateway_name)
        assert the_gateway
        assert the_gateway.get_name() == gateway_name
        the_gateway.add_nat_rule(rule_type, original_ip, original_port, translated_ip, translated_port, protocol)
        task = the_gateway.save_services_configuration()
        assert task
        result = self.vca.block_until_completed(task)
        assert result

    def test_0010(self):
        """Get NAT rule"""
        vdc_name = config['vcloud']['vdc']
        vapp_name = config['vcloud']['vapp']
        vm_name = config['vcloud']['vm']
        gateway_name = config['vcloud']['gateway']
        rule_type = config['vcloud']['nat_rule_type']
        original_ip = config['vcloud']['nat_original_ip']
        original_port = str(config['vcloud']['nat_original_port'])
        translated_ip = config['vcloud']['nat_translated_ip']
        translated_port = str(config['vcloud']['nat_translated_port'])
        protocol = config['vcloud']['nat_protocol']
        the_vdc = self.vca.get_vdc(vdc_name)
        assert the_vdc
        assert the_vdc.get_name() == vdc_name
        the_gateway = self.vca.get_gateway(vdc_name, gateway_name)
        assert the_gateway
        assert the_gateway.get_name() == gateway_name
        nat_rules = the_gateway.get_nat_rules()
        found_rule = False
        for natRule in nat_rules:
            ruleId = natRule.get_Id()
            if rule_type == natRule.get_RuleType():
                gatewayNatRule = natRule.get_GatewayNatRule()
开发者ID:piraz,项目名称:pyvcloud,代码行数:70,代码来源:vcloud_tests.py


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