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

Python router.create_lrouter函数代码示例

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

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



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

示例1: test_get_lrouters

 def test_get_lrouters(self):
     lrouter_uuids = [routerlib.create_lrouter(
         self.fake_cluster, 'whatever', 'pippo', 'fake-lrouter-%s' % k,
         '10.0.0.1')['uuid'] for k in range(3)]
     routers = routerlib.get_lrouters(self.fake_cluster, 'pippo')
     for router in routers:
         self.assertIn(router['uuid'], lrouter_uuids)
开发者ID:AsherBond,项目名称:quantum,代码行数:7,代码来源:test_router.py


示例2: test_plug_lrouter_port_patch_attachment

 def test_plug_lrouter_port_patch_attachment(self):
     tenant_id = 'pippo'
     transport_zones_config = [{'zone_uuid': _uuid(),
                                'transport_type': 'stt'}]
     lswitch = switchlib.create_lswitch(self.fake_cluster,
                                        _uuid(),
                                        tenant_id, 'fake-switch',
                                        transport_zones_config)
     lport = switchlib.create_lport(self.fake_cluster, lswitch['uuid'],
                                    tenant_id, 'xyz',
                                    'name', 'device_id', True)
     lrouter = routerlib.create_lrouter(self.fake_cluster,
                                        uuidutils.generate_uuid(),
                                        tenant_id,
                                        'fake-lrouter',
                                        '10.0.0.1')
     lrouter_port = routerlib.create_router_lport(
         self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
         'name', True, ['192.168.0.1'], '00:11:22:33:44:55:66')
     result = routerlib.plug_router_port_attachment(
         self.fake_cluster, lrouter['uuid'],
         lrouter_port['uuid'],
         lport['uuid'], 'PatchAttachment')
     self.assertEqual(lport['uuid'],
                      result['LogicalPortAttachment']['peer_port_uuid'])
开发者ID:AsherBond,项目名称:quantum,代码行数:25,代码来源:test_router.py


示例3: test_update_lrouter_port

    def test_update_lrouter_port(self):
        lrouter = routerlib.create_lrouter(self.fake_cluster,
                                           uuidutils.generate_uuid(),
                                           'pippo',
                                           'fake-lrouter',
                                           '10.0.0.1')
        lrouter_port = routerlib.create_router_lport(
            self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
            'name', True, ['192.168.0.1'], '00:11:22:33:44:55')
        routerlib.update_router_lport(
            self.fake_cluster, lrouter['uuid'], lrouter_port['uuid'],
            'pippo', 'another_port_id', 'name', False,
            ['192.168.0.1', '10.10.10.254'])

        ports = routerlib.query_lrouter_lports(
            self.fake_cluster, lrouter['uuid'])
        self.assertEqual(len(ports), 1)
        res_port = ports[0]
        port_tags = self._build_tag_dict(res_port['tags'])
        self.assertEqual(['192.168.0.1', '10.10.10.254'],
                         res_port['ip_addresses'])
        self.assertEqual('False', res_port['admin_status_enabled'])
        self.assertIn('os_tid', port_tags)
        self.assertIn('q_port_id', port_tags)
        self.assertEqual('pippo', port_tags['os_tid'])
        self.assertEqual('another_port_id', port_tags['q_port_id'])
开发者ID:AsherBond,项目名称:quantum,代码行数:26,代码来源:test_router.py


示例4: test_delete_lrouter_port_nonexistent_port_raises

 def test_delete_lrouter_port_nonexistent_port_raises(self):
     lrouter = routerlib.create_lrouter(self.fake_cluster,
                                        uuidutils.generate_uuid(),
                                        'pippo',
                                        'fake-lrouter',
                                        '10.0.0.1')
     self.assertRaises(exceptions.NotFound,
                       routerlib.delete_router_lport,
                       self.fake_cluster, lrouter['uuid'], 'abc')
开发者ID:AsherBond,项目名称:quantum,代码行数:9,代码来源:test_router.py


示例5: test_update_lrouter_port_nonexistent_port_raises

 def test_update_lrouter_port_nonexistent_port_raises(self):
     lrouter = routerlib.create_lrouter(self.fake_cluster,
                                        uuidutils.generate_uuid(),
                                        'pippo',
                                        'fake-lrouter',
                                        '10.0.0.1')
     self.assertRaises(
         exceptions.NotFound, routerlib.update_router_lport,
         self.fake_cluster, lrouter['uuid'], 'boo-port', 'pippo',
         'neutron_port_id', 'name', True, ['192.168.0.1'])
开发者ID:AsherBond,项目名称:quantum,代码行数:10,代码来源:test_router.py


示例6: test_delete_lrouter

 def test_delete_lrouter(self):
     lrouter = routerlib.create_lrouter(self.fake_cluster,
                                        uuidutils.generate_uuid(),
                                        'pippo',
                                        'fake-lrouter',
                                        '10.0.0.1')
     routerlib.delete_lrouter(self.fake_cluster, lrouter['uuid'])
     self.assertRaises(exceptions.NotFound,
                       routerlib.get_lrouter,
                       self.fake_cluster,
                       lrouter['uuid'])
开发者ID:AsherBond,项目名称:quantum,代码行数:11,代码来源:test_router.py


示例7: _create_lrouter

 def _create_lrouter(self, version, neutron_id=None, distributed=None):
     with mock.patch.object(
         self.fake_cluster.api_client, 'get_version',
         return_value=version_module.Version(version)):
         if not neutron_id:
             neutron_id = uuidutils.generate_uuid()
         lrouter = routerlib.create_lrouter(
             self.fake_cluster, neutron_id, 'pippo',
             'fake-lrouter', '10.0.0.1', distributed=distributed)
         return routerlib.get_lrouter(self.fake_cluster,
                                      lrouter['uuid'])
开发者ID:AsherBond,项目名称:quantum,代码行数:11,代码来源:test_router.py


示例8: test_plug_lrouter_port_invalid_attachment_type_raises

 def test_plug_lrouter_port_invalid_attachment_type_raises(self):
     lrouter = routerlib.create_lrouter(self.fake_cluster,
                                        uuidutils.generate_uuid(),
                                        'pippo',
                                        'fake-lrouter',
                                        '10.0.0.1')
     lrouter_port = routerlib.create_router_lport(
         self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
         'name', True, ['192.168.0.1'], '00:11:22:33:44:55')
     self.assertRaises(nsx_exc.InvalidAttachmentType,
                       routerlib.plug_router_port_attachment,
                       self.fake_cluster, lrouter['uuid'],
                       lrouter_port['uuid'], 'gw_att', 'BadType')
开发者ID:AsherBond,项目名称:quantum,代码行数:13,代码来源:test_router.py


示例9: test_create_and_get_lrouter_name_exceeds_40chars

 def test_create_and_get_lrouter_name_exceeds_40chars(self):
     neutron_id = uuidutils.generate_uuid()
     display_name = '*' * 50
     lrouter = routerlib.create_lrouter(self.fake_cluster,
                                        neutron_id,
                                        'pippo',
                                        display_name,
                                        '10.0.0.1')
     res_lrouter = routerlib.get_lrouter(self.fake_cluster,
                                         lrouter['uuid'])
     self._verify_lrouter(res_lrouter, lrouter['uuid'],
                          '*' * 40, '10.0.0.1', 'pippo',
                          expected_neutron_id=neutron_id)
开发者ID:AsherBond,项目名称:quantum,代码行数:13,代码来源:test_router.py


示例10: test_create_router_snat_rule_invalid_match_keys_raises

    def test_create_router_snat_rule_invalid_match_keys_raises(self):
        # In this case the version does not make a difference
        lrouter = routerlib.create_lrouter(self.fake_cluster,
                                           uuidutils.generate_uuid(),
                                           'pippo',
                                           'fake-lrouter',
                                           '10.0.0.1')

        with mock.patch.object(self.fake_cluster.api_client,
                               'get_version',
                               new=lambda: '2.0'):
            self.assertRaises(AttributeError,
                              routerlib.create_lrouter_snat_rule,
                              self.fake_cluster, lrouter['uuid'],
                              '10.0.0.2', '10.0.0.2', order=200,
                              match_criteria={'foo': 'bar'})
开发者ID:AsherBond,项目名称:quantum,代码行数:16,代码来源:test_router.py


示例11: test_query_lrouter_ports

 def test_query_lrouter_ports(self):
     lrouter = routerlib.create_lrouter(self.fake_cluster,
                                        uuidutils.generate_uuid(),
                                        'pippo',
                                        'fake-lrouter',
                                        '10.0.0.1')
     router_port_uuids = [routerlib.create_router_lport(
         self.fake_cluster, lrouter['uuid'], 'pippo',
         'qp_id_%s' % k, 'port-%s' % k, True,
         ['192.168.0.%s' % k], '00:11:22:33:44:55')['uuid']
         for k in range(3)]
     ports = routerlib.query_lrouter_lports(
         self.fake_cluster, lrouter['uuid'])
     self.assertEqual(len(ports), 3)
     for res_port in ports:
         self.assertIn(res_port['uuid'], router_port_uuids)
开发者ID:AsherBond,项目名称:quantum,代码行数:16,代码来源:test_router.py


示例12: test_update_lrouter

 def test_update_lrouter(self):
     neutron_id = uuidutils.generate_uuid()
     lrouter = routerlib.create_lrouter(self.fake_cluster,
                                        neutron_id,
                                        'pippo',
                                        'fake-lrouter',
                                        '10.0.0.1')
     lrouter = routerlib.update_lrouter(self.fake_cluster,
                                        lrouter['uuid'],
                                        'new_name',
                                        '192.168.0.1')
     res_lrouter = routerlib.get_lrouter(self.fake_cluster,
                                         lrouter['uuid'])
     self._verify_lrouter(res_lrouter, lrouter['uuid'],
                          'new_name', '192.168.0.1', 'pippo',
                          expected_neutron_id=neutron_id)
开发者ID:AsherBond,项目名称:quantum,代码行数:16,代码来源:test_router.py


示例13: _test_create_router_dnat_rule

 def _test_create_router_dnat_rule(self, version, dest_port=None):
     lrouter = routerlib.create_lrouter(self.fake_cluster,
                                        uuidutils.generate_uuid(),
                                        'pippo',
                                        'fake-lrouter',
                                        '10.0.0.1')
     with mock.patch.object(self.fake_cluster.api_client,
                            'get_version',
                            return_value=version_module.Version(version)):
         routerlib.create_lrouter_dnat_rule(
             self.fake_cluster, lrouter['uuid'], '192.168.0.2', order=200,
             dest_port=dest_port,
             match_criteria={'destination_ip_addresses': '10.0.0.3'})
         rules = routerlib.query_nat_rules(
             self.fake_cluster, lrouter['uuid'])
         self.assertEqual(len(rules), 1)
开发者ID:AsherBond,项目名称:quantum,代码行数:16,代码来源:test_router.py


示例14: _test_create_router_snat_rule

 def _test_create_router_snat_rule(self, version):
     lrouter = routerlib.create_lrouter(self.fake_cluster,
                                        uuidutils.generate_uuid(),
                                        'pippo',
                                        'fake-lrouter',
                                        '10.0.0.1')
     with mock.patch.object(self.fake_cluster.api_client,
                            'get_version',
                            new=lambda: version_module.Version(version)):
         routerlib.create_lrouter_snat_rule(
             self.fake_cluster, lrouter['uuid'],
             '10.0.0.2', '10.0.0.2', order=200,
             match_criteria={'source_ip_addresses': '192.168.0.24'})
         rules = routerlib.query_nat_rules(
             self.fake_cluster, lrouter['uuid'])
         self.assertEqual(len(rules), 1)
开发者ID:AsherBond,项目名称:quantum,代码行数:16,代码来源:test_router.py


示例15: test_plug_lrouter_port_l3_gw_attachment

 def test_plug_lrouter_port_l3_gw_attachment(self):
     lrouter = routerlib.create_lrouter(self.fake_cluster,
                                        uuidutils.generate_uuid(),
                                        'pippo',
                                        'fake-lrouter',
                                        '10.0.0.1')
     lrouter_port = routerlib.create_router_lport(
         self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
         'name', True, ['192.168.0.1'], '00:11:22:33:44:55:66')
     result = routerlib.plug_router_port_attachment(
         self.fake_cluster, lrouter['uuid'],
         lrouter_port['uuid'],
         'gw_att', 'L3GatewayAttachment')
     self.assertEqual(
         'gw_att',
         result['LogicalPortAttachment']['l3_gateway_service_uuid'])
开发者ID:AsherBond,项目名称:quantum,代码行数:16,代码来源:test_router.py


示例16: test_delete_lrouter_port

 def test_delete_lrouter_port(self):
     lrouter = routerlib.create_lrouter(self.fake_cluster,
                                        uuidutils.generate_uuid(),
                                        'pippo',
                                        'fake-lrouter',
                                        '10.0.0.1')
     lrouter_port = routerlib.create_router_lport(
         self.fake_cluster, lrouter['uuid'], 'pippo', 'x', 'y', True, [],
         '00:11:22:33:44:55')
     ports = routerlib.query_lrouter_lports(
         self.fake_cluster, lrouter['uuid'])
     self.assertEqual(len(ports), 1)
     routerlib.delete_router_lport(self.fake_cluster, lrouter['uuid'],
                                   lrouter_port['uuid'])
     ports = routerlib.query_lrouter_lports(
         self.fake_cluster, lrouter['uuid'])
     self.assertFalse(len(ports))
开发者ID:AsherBond,项目名称:quantum,代码行数:17,代码来源:test_router.py


示例17: _test_create_router_nosnat_rule

 def _test_create_router_nosnat_rule(self, version, expected=1):
     lrouter = routerlib.create_lrouter(self.fake_cluster,
                                        uuidutils.generate_uuid(),
                                        'pippo',
                                        'fake-lrouter',
                                        '10.0.0.1')
     with mock.patch.object(self.fake_cluster.api_client,
                            'get_version',
                            new=lambda: version_module.Version(version)):
         routerlib.create_lrouter_nosnat_rule(
             self.fake_cluster, lrouter['uuid'],
             order=100,
             match_criteria={'destination_ip_addresses': '192.168.0.0/24'})
         rules = routerlib.query_nat_rules(
             self.fake_cluster, lrouter['uuid'])
         # NoSNAT rules do not exist in V2
         self.assertEqual(len(rules), expected)
开发者ID:AsherBond,项目名称:quantum,代码行数:17,代码来源:test_router.py


示例18: test_update_lrouter_port_ips_add_and_remove

 def test_update_lrouter_port_ips_add_and_remove(self):
     lrouter = routerlib.create_lrouter(self.fake_cluster,
                                        uuidutils.generate_uuid(),
                                        'pippo',
                                        'fake-lrouter',
                                        '10.0.0.1')
     lrouter_port = routerlib.create_router_lport(
         self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
         'name', True, ['192.168.0.1'], '00:11:22:33:44:55')
     routerlib.update_lrouter_port_ips(
         self.fake_cluster, lrouter['uuid'], lrouter_port['uuid'],
         ['10.10.10.254'], ['192.168.0.1'])
     ports = routerlib.query_lrouter_lports(
         self.fake_cluster, lrouter['uuid'])
     self.assertEqual(len(ports), 1)
     res_port = ports[0]
     self.assertEqual(['10.10.10.254'], res_port['ip_addresses'])
开发者ID:AsherBond,项目名称:quantum,代码行数:17,代码来源:test_router.py


示例19: test_delete_peer_lrouter_port

    def test_delete_peer_lrouter_port(self):
        lrouter = routerlib.create_lrouter(self.fake_cluster,
                                           uuidutils.generate_uuid(),
                                           'pippo',
                                           'fake-lrouter',
                                           '10.0.0.1')
        lrouter_port = routerlib.create_router_lport(
            self.fake_cluster, lrouter['uuid'], 'pippo', 'x', 'y', True, [],
            '00:11:22:33:44:55')

        def fakegetport(*args, **kwargs):
            return {'_relations': {'LogicalPortAttachment':
                                   {'peer_port_uuid': lrouter_port['uuid']}}}
        # mock get_port
        with mock.patch.object(switchlib, 'get_port', new=fakegetport):
            routerlib.delete_peer_router_lport(self.fake_cluster,
                                               lrouter_port['uuid'],
                                               'whatwever', 'whatever')
开发者ID:AsherBond,项目名称:quantum,代码行数:18,代码来源:test_router.py


示例20: test_update_lrouter_port_ips_nsx_exception_raises

    def test_update_lrouter_port_ips_nsx_exception_raises(self):
        lrouter = routerlib.create_lrouter(self.fake_cluster,
                                           uuidutils.generate_uuid(),
                                           'pippo',
                                           'fake-lrouter',
                                           '10.0.0.1')
        lrouter_port = routerlib.create_router_lport(
            self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
            'name', True, ['192.168.0.1'], '00:11:22:33:44:55')

        def raise_nsx_exc(*args, **kwargs):
            raise api_exc.NsxApiException()

        with mock.patch.object(nsxlib, 'do_request', new=raise_nsx_exc):
            self.assertRaises(
                nsx_exc.NsxPluginException, routerlib.update_lrouter_port_ips,
                self.fake_cluster, lrouter['uuid'],
                lrouter_port['uuid'], [], [])
开发者ID:AsherBond,项目名称:quantum,代码行数:18,代码来源:test_router.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python router.create_router_lport函数代码示例发布时间:2022-05-27
下一篇:
Python nsxlib.get_all_query_pages函数代码示例发布时间: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