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


Python client.Client类代码示例

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


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


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