• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python client.Client类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_firewall_update

    def test_firewall_update(self):
        firewall = self.firewalls.first()
        firewall_dict = self.api_firewalls.first()

        firewall.name = "new name"
        firewall.description = "new desc"
        firewall.admin_state_up = False

        firewall_dict["name"] = "new name"
        firewall_dict["description"] = "new desc"
        firewall_dict["admin_state_up"] = False

        form_data = {
            "name": firewall.name,
            "description": firewall.description,
            "admin_state_up": firewall.admin_state_up,
        }

        form_dict = {"firewall": form_data}
        ret_dict = {"firewall": firewall_dict}

        neutronclient.update_firewall(firewall.id, form_dict).AndReturn(ret_dict)
        self.mox.ReplayAll()

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


示例2: test_firewall_update

    def test_firewall_update(self):
        firewall = self.firewalls.first()
        firewall_dict = self.api_firewalls.first()

        firewall.name = 'new name'
        firewall.description = 'new desc'
        firewall.admin_state_up = False

        firewall_dict['name'] = 'new name'
        firewall_dict['description'] = 'new desc'
        firewall_dict['admin_state_up'] = False

        form_data = {'name': firewall.name,
                     'description': firewall.description,
                     'admin_state_up': firewall.admin_state_up
                     }

        form_dict = {'firewall': form_data}
        ret_dict = {'firewall': firewall_dict}

        neutronclient.update_firewall(
            firewall.id, form_dict).AndReturn(ret_dict)
        self.mox.ReplayAll()

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


示例3: test_policy_update

    def test_policy_update(self):
        policy = self.fw_policies.first()
        policy_dict = self.api_fw_policies.first()

        policy.name = 'new name'
        policy.description = 'new desc'
        policy.shared = True
        policy.audited = False

        policy_dict['name'] = 'new name'
        policy_dict['description'] = 'new desc'
        policy_dict['shared'] = True
        policy_dict['audited'] = False

        form_data = {'name': policy.name,
                     'description': policy.description,
                     'shared': policy.shared,
                     'audited': policy.audited
                     }

        form_dict = {'firewall_policy': form_data}
        ret_dict = {'firewall_policy': policy_dict}

        neutronclient.update_firewall_policy(
            policy.id, form_dict).AndReturn(ret_dict)
        self.mox.ReplayAll()

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


示例4: test_policy_update

    def test_policy_update(self):
        policy = self.fw_policies.first()
        policy_dict = self.api_fw_policies.first()

        policy.name = "new name"
        policy.description = "new desc"
        policy.shared = True
        policy.audited = False

        policy_dict["name"] = "new name"
        policy_dict["description"] = "new desc"
        policy_dict["shared"] = True
        policy_dict["audited"] = False

        form_data = {
            "name": policy.name,
            "description": policy.description,
            "shared": policy.shared,
            "audited": policy.audited,
        }

        form_dict = {"firewall_policy": form_data}
        ret_dict = {"firewall_policy": policy_dict}

        neutronclient.update_firewall_policy(policy.id, form_dict).AndReturn(ret_dict)
        self.mox.ReplayAll()

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


示例5: test_bgpvpn_delete

 def test_bgpvpn_delete(self):
     bgpvpn = self.bgpvpns.first()
     api_bgpvpn = {'bgpvpn': self.api_bgpvpns.first()}
     neutronclient.delete_ext('/bgpvpn/bgpvpns/%s',
                              bgpvpn.id).AndReturn(api_bgpvpn)
     self.mox.ReplayAll()
     api.bgpvpn.bgpvpn_delete(self.request, bgpvpn.id)
开发者ID:rasta-rocket,项目名称:networking-bgpvpn,代码行数:7,代码来源:bgpvpn_tests.py


示例6: test_vip_update

    def test_vip_update(self):
        form_data = {'address': '10.0.0.100',
                     'name': 'vip1name',
                     'description': 'vip1description',
                     'subnet_id': '12381d38-c3eb-4fee-9763-12de3338041e',
                     'protocol_port': '80',
                     'protocol': 'HTTP',
                     'pool_id': '8913dde8-4915-4b90-8d3e-b95eeedb0d49',
                     'connection_limit': '10',
                     'admin_state_up': True
                     }

        vip = {'vip': {'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
                       'address': '10.0.0.100',
                       'name': 'vip1name',
                       'description': 'vip1description',
                       'subnet_id': '12381d38-c3eb-4fee-9763-12de3338041e',
                       'protocol_port': '80',
                       'protocol': 'HTTP',
                       'pool_id': '8913dde8-4915-4b90-8d3e-b95eeedb0d49',
                       'connection_limit': '10',
                       'admin_state_up': True
                       }}
        neutronclient.update_vip(vip['vip']['id'], form_data).AndReturn(vip)
        self.mox.ReplayAll()

        ret_val = api.lbaas.vip_update(self.request,
                                       vip['vip']['id'], **form_data)
        self.assertIsInstance(ret_val, api.lbaas.Vip)
开发者ID:deepakselvaraj,项目名称:federated-horizon,代码行数:29,代码来源:lbaas_tests.py


示例7: test_bgpvpn_get

 def test_bgpvpn_get(self):
     bgpvpn = self.bgpvpns.first()
     ret_dict = {'bgpvpn': self.api_bgpvpns.first()}
     neutronclient.show_ext('/bgpvpn/bgpvpns/%s',
                            bgpvpn.id).AndReturn(ret_dict)
     self.mox.ReplayAll()
     ret_val = api.bgpvpn.bgpvpn_get(self.request, bgpvpn.id)
     self.assertIsInstance(ret_val, api.bgpvpn.Bgpvpn)
开发者ID:rasta-rocket,项目名称:networking-bgpvpn,代码行数:8,代码来源:bgpvpn_tests.py


示例8: test_bgpvpn_list

 def test_bgpvpn_list(self):
     bgpvpns = {'bgpvpns': self.api_bgpvpns.list()}
     neutronclient.list_ext('bgpvpns',
                            '/bgpvpn/bgpvpns', True).AndReturn(bgpvpns)
     self.mox.ReplayAll()
     ret_val = api.bgpvpn.bgpvpns_list(self.request)
     for n in ret_val:
         self.assertIsInstance(n, api.bgpvpn.Bgpvpn)
开发者ID:rasta-rocket,项目名称:networking-bgpvpn,代码行数:8,代码来源:bgpvpn_tests.py


示例9: test_network_association_delete

 def test_network_association_delete(self):
     bgpvpn = self.bgpvpns.first()
     na = self.network_associations.first()
     api_bgpvpn = {
         'network_association': self.api_network_associations.first()}
     neutronclient.delete_ext(
         '/bgpvpn/bgpvpns/' + bgpvpn.id + '/network_associations/%s',
         na.id).AndReturn(api_bgpvpn)
     self.mox.ReplayAll()
     api.bgpvpn.network_association_delete(self.request, na.id, bgpvpn.id)
开发者ID:rasta-rocket,项目名称:networking-bgpvpn,代码行数:10,代码来源:bgpvpn_tests.py


示例10: test_rules_list

    def test_rules_list(self):
        rules = {'firewall_rules': self.fw_rules.list()}
        rules_dict = {'firewall_rules': self.api_fw_rules.list()}
        neutronclient.list_firewall_rules().AndReturn(rules_dict)
        self.mox.ReplayAll()

        ret_val = api.fwaas.rules_list(self.request)
        for (v, d) in zip(ret_val, rules['firewall_rules']):
            self.assertIsInstance(v, api.fwaas.Rule)
            self.assertTrue(v.name, d.name)
            self.assertTrue(v.id)
开发者ID:StokesB1,项目名称:horizon,代码行数:11,代码来源:fwaas_tests.py


示例11: test_network_association_list

 def test_network_association_list(self):
     bgpvpn = self.bgpvpns.first()
     na = {'network_associations': self.api_network_associations.list()}
     neutronclient.list_ext(
         'network_associations',
         '/bgpvpn/bgpvpns/%s/network_associations' % bgpvpn.id,
         True).AndReturn(na)
     self.mox.ReplayAll()
     ret_val = api.bgpvpn.network_association_list(self.request, bgpvpn.id)
     for n in ret_val:
         self.assertIsInstance(n, api.bgpvpn.NetworkAssociation)
开发者ID:rasta-rocket,项目名称:networking-bgpvpn,代码行数:11,代码来源:bgpvpn_tests.py


示例12: test_bgpvpn_create

 def test_bgpvpn_create(self):
     bgpvpn = self.bgpvpns.first()
     data = {'name': bgpvpn.name,
             'route_targets': bgpvpn.route_targets,
             'tenant_id': bgpvpn.tenant_id}
     ret_dict = {'bgpvpn': data}
     neutronclient.create_ext('/bgpvpn/bgpvpns',
                              ret_dict).AndReturn(ret_dict)
     self.mox.ReplayAll()
     ret_val = api.bgpvpn.bgpvpn_create(self.request, **data)
     self.assertIsInstance(ret_val, api.bgpvpn.Bgpvpn)
开发者ID:rasta-rocket,项目名称:networking-bgpvpn,代码行数:11,代码来源:bgpvpn_tests.py


示例13: test_firewall_list

    def test_firewall_list(self):
        exp_firewalls = self.firewalls.list()
        firewalls_dict = {'firewalls': self.api_firewalls.list()}
        policies_dict = {'firewall_policies': self.api_fw_policies.list()}

        neutronclient.list_firewalls().AndReturn(firewalls_dict)
        neutronclient.list_firewall_policies().AndReturn(policies_dict)
        self.mox.ReplayAll()

        ret_val = api.fwaas.firewall_list(self.request)
        for (v, d) in zip(ret_val, exp_firewalls):
            self._assert_firewall_return_value(v, d)
开发者ID:28607895,项目名称:horizon,代码行数:12,代码来源:fwaas_tests.py


示例14: test_rule_get

    def test_rule_get(self):
        rule = self.fw_rules.first()
        rule_dict = self.api_fw_rules.first()
        ret_dict = {'firewall_rule': rule_dict}

        neutronclient.show_firewall_rule(rule.id).AndReturn(ret_dict)
        self.mox.ReplayAll()

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


示例15: test_firewalls_list

    def test_firewalls_list(self):
        firewalls = {'firewalls': self.firewalls.list()}
        firewalls_dict = {'firewalls': self.api_firewalls.list()}

        neutronclient.list_firewalls().AndReturn(firewalls_dict)
        self.mox.ReplayAll()

        ret_val = api.fwaas.firewalls_list(self.request)
        for (v, d) in zip(ret_val, firewalls['firewalls']):
            self.assertIsInstance(v, api.fwaas.Firewall)
            self.assertTrue(v.name, d.name)
            self.assertTrue(v.id)
开发者ID:StokesB1,项目名称:horizon,代码行数:12,代码来源:fwaas_tests.py


示例16: test_rule_get

    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,代码行数:12,代码来源:fwaas_tests.py


示例17: test_policy_get

    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,代码行数:12,代码来源:fwaas_tests.py


示例18: test_rule_list

    def test_rule_list(self):
        exp_rules = self.fw_rules.list()
        api_rules = {'firewall_rules': self.api_fw_rules.list()}
        api_policies = {'firewall_policies': self.api_fw_policies.list()}

        neutronclient.list_firewall_rules().AndReturn(api_rules)
        neutronclient.list_firewall_policies().AndReturn(api_policies)
        self.mox.ReplayAll()

        ret_val = api.fwaas.rule_list(self.request)
        for (v, d) in zip(ret_val, exp_rules):
            self._assert_rule_return_value(v, d)
开发者ID:28607895,项目名称:horizon,代码行数:12,代码来源:fwaas_tests.py


示例19: test_member_get

    def test_member_get(self):
        member = {'member': {'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
                              'pool_id': 'abcdef-c3eb-4fee-9763-12de3338041e',
                              'address': '10.0.1.2',
                              'protocol_port': '80',
                              'weight': '10',
                              'admin_state_up': True}}
        neutronclient.show_member(member['member']['id']).AndReturn(member)
        self.mox.ReplayAll()

        ret_val = api.lbaas.member_get(self.request, member['member']['id'])
        self.assertIsInstance(ret_val, api.lbaas.Member)
开发者ID:deepakselvaraj,项目名称:federated-horizon,代码行数:12,代码来源:lbaas_tests.py


示例20: test_network_association_create

 def test_network_association_create(self):
     bgpvpn = self.bgpvpns.first()
     network = self.networks.first()
     data = {'network_id': network.id}
     ret_dict = {'network_association': data}
     neutronclient.create_ext(
         '/bgpvpn/bgpvpns/%s/network_associations' % bgpvpn.id,
         ret_dict).AndReturn(ret_dict)
     self.mox.ReplayAll()
     ret_val = api.bgpvpn.network_association_create(self.request,
                                                     bgpvpn.id,
                                                     **data)
     self.assertIsInstance(ret_val, api.bgpvpn.NetworkAssociation)
开发者ID:rasta-rocket,项目名称:networking-bgpvpn,代码行数:13,代码来源:bgpvpn_tests.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python flat.flatten函数代码示例发布时间:2022-05-27
下一篇:
Python test_cli20.end_url函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap