使用 Cisco VM(和物理设备)实现的 Neutron 路由服务

https://blueprints.launchpad.net/neutron/+spec/cisco-routing-service-vm

问题描述

存在支持在 Cisco 设备中实现的 Neutron 路由服务的需求。此蓝图针对该用例。特别是,它使用 Cisco CSR1kv VM 设备实现路由。

提议的变更

备选方案

本方案本可以作为重构现有路由服务插件的一部分来完成。但是,为了减少影响,没有采取这种方法,因为社区内部就 L3 路由器模块化、flavor 框架等问题存在更广泛的讨论。

数据模型影响

基本 l3 路由数据模型通过常规 Neutron 扩展机制进行扩展。基本类将不会被修改。

三个新的 DB 表:hostingdevicesHostedHostingPortBindingrouterhostingdevicebindings

class HostingDevice(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant):
   """Represents an appliance hosting Neutron router(s).

      When the hosting device is a Nova VM 'id' is uuid of that VM.
   """
   # complementary id to enable identification of associated Neutron resources
   complementary_id = sa.Column(sa.String(36))
   # manufacturer id of the device, e.g., its serial number
   device_id = sa.Column(sa.String(255))
   admin_state_up = sa.Column(sa.Boolean, nullable=False, default=True)
   # 'management_port_id' is the Neutron Port used for management interface
   management_port_id = sa.Column(sa.String(36),
                                  sa.ForeignKey('ports.id',
                                                ondelete="SET NULL"))
   management_port = orm.relationship(models_v2.Port)
   # 'protocol_port' is udp/tcp port of hosting device. May be empty.
   protocol_port = sa.Column(sa.Integer)
   cfg_agent_id = sa.Column(sa.String(36),
                            sa.ForeignKey('agents.id'),
                            nullable=True)
   cfg_agent = orm.relationship(agents_db.Agent)
   # Service VMs take time to boot so we store creation time
   # so we can give preference to older ones when scheduling
   created_at = sa.Column(sa.DateTime, nullable=False)
   status = sa.Column(sa.String(16))

class HostedHostingPortBinding(model_base.BASEV2):
   """Represents binding of logical resource's port to its hosting port."""
   logical_resource_id = sa.Column(sa.String(36), primary_key=True)
   logical_port_id = sa.Column(sa.String(36),
                               sa.ForeignKey('ports.id',
                                             ondelete="CASCADE"),
                               primary_key=True)
   logical_port = orm.relationship(
       models_v2.Port,
       primaryjoin='Port.id==HostedHostingPortBinding.logical_port_id',
       backref=orm.backref('hosting_info', cascade='all', uselist=False))
   # type of router port: router_interface, ..._gateway, ..._floatingip
   port_type = sa.Column(sa.String(32))
   # type of network the router port belongs to
   network_type = sa.Column(sa.String(32))
   hosting_port_id = sa.Column(sa.String(36),
                               sa.ForeignKey('ports.id',
                                             ondelete='CASCADE'))
   hosting_port = orm.relationship(
       models_v2.Port,
       primaryjoin='Port.id==HostedHostingPortBinding.hosting_port_id')
   # VLAN tag for trunk ports
   segmentation_tag = sa.Column(sa.Integer, autoincrement=False)

class RouterHostingDeviceBinding(model_base.BASEV2):
   """Represents binding between Neutron routers and their hosting devices."""
   router_id = sa.Column(sa.String(36),
                         sa.ForeignKey('routers.id', ondelete='CASCADE'),
                         primary_key=True)
   router = orm.relationship(l3_db.Router)
   # If 'auto_schedule' is True then router is automatically scheduled
   # if it lacks a hosting device or its hosting device fails.
   auto_schedule = sa.Column(sa.Boolean, default=True, nullable=False)
   # id of hosting device hosting this router, None/NULL if unscheduled.
   hosting_device_id = sa.Column(sa.String(36),
                                 sa.ForeignKey('hostingdevices.id',
                                               ondelete='SET NULL'))
   hosting_device = orm.relationship(hd_models.HostingDevice)"

REST API 影响

l3 路由服务 REST API 保持不变。没有引入新的 REST API。

安全影响

我们创建一个虚拟管理网络,该网络是 CSR1kv VM 将在其上拥有 VIF 的 Neutron 提供者网络,也是用于应用其中配置的配置代理。该配置代理必须能够通过 RPC 与 Neutron 服务器通信。常规 Neutron 管理网络用于该通信。虚拟管理网络和 Neutron 管理网络不必相同,并且最好保持分离以提高安全性隔离。

与元数据服务相关的安全问题不适用,因为此实现不支持通过 Neutron 路由器使用元数据服务。

通知影响

对现有功能没有影响。此 l3 路由服务插件使用其自身的 RPC 与 Cisco 配置代理进行交互。这些代理在 https://blueprints.launchpad.net/neutron/+spec/cisco-config-agent 中定义。

其他最终用户影响

创建 Neutron 路由器的最终用户将经历从 Neutron 路由器创建请求返回到 Neutron 路由器运行(即转发数据包)之间稍长的延迟。这是由于启动 CSR1kv VM 所需的时间。

性能影响

Neutron 和 Nova 服务不应受到此路由服务插件的显著影响。RPC 在产生的流量方面基本等同于 l3agent RPC。与 Linux 命名空间路由器实现相比,当创建 Neutron 路由器时,此实现会创建更多的 Neutron 资源(端口、网络、子网)。我们预计这些额外的操作不会导致 Neutron 服务器负载显著增加。

其他部署者影响

我们认为这不会影响社区 L3 路由器服务插件,无论是在其当前实现中,还是在合并 DVR 后。部署者必须指定使用 Cisco 路由服务插件而不是社区插件。还必须部署配置代理。

开发人员影响

无。

实现

下图显示了新的路由服务插件及其与之交互的组件。宿主机设备框是数据库中的对象,仅用于显示路由服务插件了解其在其中放置 Neutron 路由器的设备。RouterHostingDeviceBindings 框表示存储此绑定的数据库表。

Novaclient 用于与 Nova 交互,以请求创建和删除 CSR1kv VM。

插件到配置代理的 RPC 类似于 l3 代理 RPC。即,插件将路由器更新/删除通知发送到配置代理。后者会定期执行 get_routers() 回调以获取已更新路由器的最新路由器配置。

发送到配置代理的路由器信息包括有关宿主机设备的的信息。配置代理因此可以通过虚拟管理网络(这是一个 Neutron 提供者网络)远程配置该设备。

使用 Nova 启动的所有 CSR1kv VM 都由一个特殊的租户拥有。这同样适用于为 CSR1kv VM 实例创建的 Neutron 资源。这些资源包括:虚拟管理网络上的 Neutron 端口、具有 trunking 功能的 Neutron 网络以及这些网络上的 Neutron 端口。

一个 CSR1kv VM 实例将仅宿主机一个 Neutron 路由器。因此,一个 CSR1kv VM 实例将完全分配给拥有其宿主机 Neutron 路由器的租户。这种限制并非出于性能原因,而是为了减少实施范围。它允许我们简化调度。如果这些实例绑定到 CSR1kv VM 实例中宿主机 Neutron 路由器的 VPN 和/或防火墙服务实例,则可以将其宿主机在 CSR1kv VM 实例中。

                      ............
                      .   Nova   .
                      .   api    .
                      .  server  .
                      ............
                            ^
                            |
............................|.............     .............     ..............
. Neutron                   |            .     . Some      .     . Nova       .
. Server                    |            .     . Server    .     . Compute    .
.                           |            .     .           .     .            .
.                           |            .     .           .     .  +-------+ .
.  +------------------------|---------+  .     .           .     .  |Hosting| .
.  | Cisco Router         Nova        |  .     .           .  +---->|Device | .
.  | Service Plugin       client      |  .     .           .  |  .  |Svc VM | .
.  |                                  |  .     .           .  |  .  +-------+ .
.  |                                  |  . RPC .  +------+ .  |  ..............
.  |   +-------+   +-------------+    |  NOTIFIC. |Config|<---+
.  |  +-------+|   |    Router   |    |<--------->|Agent | .    Device specific
.  | +-------+||   |HostingDevice|    | CALLBACKS |      | .    protocol (e.g.,
.  | |Hosting||+   |  Bindings   |    |  .     .  +------+ .    Netconf, REST)
.  | |Device |+    +-------------+    |  .     .           .
.  | +-------+                        |  .     .           .
.  +----------------------------------+  .     .           .
.                                        .     .           .
.                                        .     .           .
..........................................     .............

负责人

主要负责人:bob-melander

其他贡献者:hareesh-puthalath, skandasw

工作项

  • 实现从 extraroute DB mixin 派生的新的路由器 DB mixin。

  • 实现新的 mixin,使用 Nova 管理 CSR1kv VM。

  • 实现与配置代理交互的 RPC 通知和回调。

  • 实现使用上述 mixin 和 RPC 的新的路由服务插件。

  • 创建路由服务插件的模板配置文件 .ini 文件。

  • 创建 bash 脚本,说明如何设置路由服务插件。

  • 扩展现有的 L3 路由单元测试套件,以涵盖新的功能。

依赖项

Devstack 必须更新以支持此插件。路由服务插件使用 Cisco 配置代理:https://blueprints.launchpad.net/neutron/+spec/cisco-config-agent

测试

将为所有新功能添加单元测试。Tempest 对第三方 CI 的支持正在进行中,并将于 Juno 准备就绪。社区 L3 实现的功能和场景测试对于此实现也很有用。

文档影响

需要在 Cisco 部分添加新的文档。

参考资料