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


Python Client.update_firewall_rule方法代码示例

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


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

示例1: test_rule_update

# 需要导入模块: from neutronclient.v2_0.client import Client [as 别名]
# 或者: from neutronclient.v2_0.client.Client import update_firewall_rule [as 别名]
    def test_rule_update(self):
        rule = self.fw_rules.first()
        rule_dict = self.api_fw_rules.first()

        rule.name = 'new name'
        rule.description = 'new desc'
        rule.protocol = 'icmp'
        rule.action = 'deny'
        rule.shared = True
        rule.enabled = False

        rule_dict['name'] = 'new name'
        rule_dict['description'] = 'new desc'
        rule_dict['protocol'] = 'icmp'
        rule_dict['action'] = 'deny'
        rule_dict['shared'] = True
        rule_dict['enabled'] = False

        form_data = {'name': rule.name,
                     'description': rule.description,
                     'protocol': rule.protocol,
                     'action': rule.action,
                     'shared': rule.shared,
                     'enabled': rule.enabled
                     }
        form_dict = {'firewall_rule': form_data}
        ret_dict = {'firewall_rule': rule_dict}

        neutronclient.update_firewall_rule(
            rule.id, form_dict).AndReturn(ret_dict)
        self.mox.ReplayAll()

        ret_val = api.fwaas.rule_update(self.request,
                                        rule.id, **form_data)
        self.assertIsInstance(ret_val, api.fwaas.Rule)
        self.assertEqual(rule.name, ret_val.name)
        self.assertTrue(ret_val.id)
开发者ID:Dirk41,项目名称:horizon,代码行数:39,代码来源:fwaas_tests.py

示例2: test_rule_update

# 需要导入模块: from neutronclient.v2_0.client import Client [as 别名]
# 或者: from neutronclient.v2_0.client.Client import update_firewall_rule [as 别名]
    def test_rule_update(self):
        rule = self.fw_rules.first()
        rule_dict = self.api_fw_rules.first()

        rule.name = "new name"
        rule.description = "new desc"
        rule.protocol = "icmp"
        rule.action = "deny"
        rule.shared = True
        rule.enabled = False

        rule_dict["name"] = "new name"
        rule_dict["description"] = "new desc"
        rule_dict["protocol"] = "icmp"
        rule_dict["action"] = "deny"
        rule_dict["shared"] = True
        rule_dict["enabled"] = False

        form_data = {
            "name": rule.name,
            "description": rule.description,
            "protocol": rule.protocol,
            "action": rule.action,
            "shared": rule.shared,
            "enabled": rule.enabled,
        }
        form_dict = {"firewall_rule": form_data}
        ret_dict = {"firewall_rule": rule_dict}

        neutronclient.update_firewall_rule(rule.id, form_dict).AndReturn(ret_dict)
        self.mox.ReplayAll()

        ret_val = api.fwaas.rule_update(self.request, rule.id, **form_data)
        self.assertIsInstance(ret_val, api.fwaas.Rule)
        self.assertEqual(rule.name, ret_val.name)
        self.assertTrue(ret_val.id)
开发者ID:TsinghuaCloud,项目名称:TsinghuaCloud2.0-gui,代码行数:38,代码来源:fwaas_tests.py


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