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


Python Client.show_firewall_policy方法代码示例

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


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

示例1: test_rule_get

# 需要导入模块: from neutronclient.v2_0.client import Client [as 别名]
# 或者: from neutronclient.v2_0.client.Client import show_firewall_policy [as 别名]
    def test_rule_get(self):
        exp_rule = self.fw_rules.first()
        ret_dict = {'firewall_rule': self.api_fw_rules.first()}
        policy_dict = {'firewall_policy': self.api_fw_policies.first()}

        neutronclient.show_firewall_rule(exp_rule.id).AndReturn(ret_dict)
        neutronclient.show_firewall_policy(
            exp_rule.firewall_policy_id).AndReturn(policy_dict)
        self.mox.ReplayAll()

        ret_val = api.fwaas.rule_get(self.request, exp_rule.id)
        self._assert_rule_return_value(ret_val, exp_rule)
开发者ID:28607895,项目名称:horizon,代码行数:14,代码来源:fwaas_tests.py

示例2: test_policy_get

# 需要导入模块: from neutronclient.v2_0.client import Client [as 别名]
# 或者: from neutronclient.v2_0.client.Client import show_firewall_policy [as 别名]
    def test_policy_get(self):
        policy = self.fw_policies.first()
        policy_dict = self.api_fw_policies.first()

        ret_dict = {'firewall_policy': policy_dict}
        neutronclient.show_firewall_policy(policy.id).AndReturn(ret_dict)
        self.mox.ReplayAll()

        ret_val = api.fwaas.policy_get(self.request, policy.id)
        self.assertIsInstance(ret_val, api.fwaas.Policy)
        self.assertEqual(policy.name, ret_val.name)
        self.assertTrue(ret_val.id)
开发者ID:StokesB1,项目名称:horizon,代码行数:14,代码来源:fwaas_tests.py

示例3: test_policy_get_no_rule

# 需要导入模块: from neutronclient.v2_0.client import Client [as 别名]
# 或者: from neutronclient.v2_0.client.Client import show_firewall_policy [as 别名]
    def test_policy_get_no_rule(self):
        # 2nd policy is not associated with any rules.
        exp_policy = self.fw_policies.list()[1]
        policy_dict = self.api_fw_policies.list()[1]

        ret_dict = {'firewall_policy': policy_dict}
        neutronclient.show_firewall_policy(exp_policy.id).AndReturn(ret_dict)
        self.mox.ReplayAll()

        ret_val = api.fwaas.policy_get(self.request, exp_policy.id)
        self.assertIsInstance(ret_val, api.fwaas.Policy)
        self.assertEqual(exp_policy.name, ret_val.name)
        self.assertTrue(ret_val.id)
        self.assertFalse(len(ret_val.rules))
开发者ID:Dirk41,项目名称:horizon,代码行数:16,代码来源:fwaas_tests.py

示例4: test_rule_get

# 需要导入模块: from neutronclient.v2_0.client import Client [as 别名]
# 或者: from neutronclient.v2_0.client.Client import show_firewall_policy [as 别名]
    def test_rule_get(self):
        exp_rule = self.fw_rules.first()
        ret_dict = {"firewall_rule": self.api_fw_rules.first()}
        policy_dict = {"firewall_policy": self.api_fw_policies.first()}

        neutronclient.show_firewall_rule(exp_rule.id).AndReturn(ret_dict)
        neutronclient.show_firewall_policy(exp_rule.firewall_policy_id).AndReturn(policy_dict)
        self.mox.ReplayAll()

        ret_val = api.fwaas.rule_get(self.request, exp_rule.id)
        self.assertIsInstance(ret_val, api.fwaas.Rule)
        self.assertEqual(exp_rule.name, ret_val.name)
        self.assertTrue(ret_val.id)
        self.assertEqual(ret_val.policy.id, exp_rule.firewall_policy_id)
        self.assertEqual(ret_val.policy.name, exp_rule.policy.name)
开发者ID:TsinghuaCloud,项目名称:TsinghuaCloud2.0-gui,代码行数:17,代码来源:fwaas_tests.py

示例5: test_policy_get

# 需要导入模块: from neutronclient.v2_0.client import Client [as 别名]
# 或者: from neutronclient.v2_0.client.Client import show_firewall_policy [as 别名]
    def test_policy_get(self):
        exp_policy = self.fw_policies.first()
        policy_dict = self.api_fw_policies.first()
        # The first two rules are associated with the first policy.
        api_rules = self.api_fw_rules.list()[:2]

        ret_dict = {'firewall_policy': policy_dict}
        neutronclient.show_firewall_policy(exp_policy.id).AndReturn(ret_dict)
        filters = {'firewall_policy_id': exp_policy.id}
        ret_dict = {'firewall_rules': api_rules}
        neutronclient.list_firewall_rules(**filters).AndReturn(ret_dict)
        self.mox.ReplayAll()

        ret_val = api.fwaas.policy_get(self.request, exp_policy.id)
        self._assert_policy_return_value(ret_val, exp_policy)
开发者ID:28607895,项目名称:horizon,代码行数:17,代码来源:fwaas_tests.py

示例6: test_firewall_get

# 需要导入模块: from neutronclient.v2_0.client import Client [as 别名]
# 或者: from neutronclient.v2_0.client.Client import show_firewall_policy [as 别名]
    def test_firewall_get(self):
        exp_firewall = self.firewalls.first()
        ret_dict = {'firewall': self.api_firewalls.first()}
        policy_dict = {'firewall_policy': self.api_fw_policies.first()}

        neutronclient.show_firewall(exp_firewall.id).AndReturn(ret_dict)
        neutronclient.show_firewall_policy(
            exp_firewall.firewall_policy_id).AndReturn(policy_dict)
        self.mox.ReplayAll()

        ret_val = api.fwaas.firewall_get(self.request, exp_firewall.id)
        self.assertIsInstance(ret_val, api.fwaas.Firewall)
        self.assertEqual(exp_firewall.name, ret_val.name)
        self.assertTrue(ret_val.id)
        self.assertEqual(exp_firewall.firewall_policy_id, ret_val.policy.id)
        self.assertEqual(exp_firewall.policy.name, ret_val.policy.name)
开发者ID:Dirk41,项目名称:horizon,代码行数:18,代码来源:fwaas_tests.py

示例7: test_policy_get

# 需要导入模块: from neutronclient.v2_0.client import Client [as 别名]
# 或者: from neutronclient.v2_0.client.Client import show_firewall_policy [as 别名]
    def test_policy_get(self):
        exp_policy = self.fw_policies.first()
        policy_dict = self.api_fw_policies.first()
        # The first two rules are associated with the first policy.
        api_rules = self.api_fw_rules.list()[:2]

        ret_dict = {'firewall_policy': policy_dict}
        neutronclient.show_firewall_policy(exp_policy.id).AndReturn(ret_dict)
        filters = {'firewall_policy_id': exp_policy.id}
        ret_dict = {'firewall_rules': api_rules}
        neutronclient.list_firewall_rules(**filters).AndReturn(ret_dict)
        self.mox.ReplayAll()

        ret_val = api.fwaas.policy_get(self.request, exp_policy.id)
        self.assertIsInstance(ret_val, api.fwaas.Policy)
        self.assertEqual(exp_policy.name, ret_val.name)
        self.assertTrue(ret_val.id)
        self.assertEqual(len(exp_policy.rules), len(ret_val.rules))
        for (exp, ret) in zip(exp_policy.rules, ret_val.rules):
            self.assertEqual(exp.id, ret.id)
开发者ID:Dirk41,项目名称:horizon,代码行数:22,代码来源:fwaas_tests.py


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