跳转到: 导航, 搜索

Cisco-quantum

适用于跨多个物理交换机的 Quantum L2 网络覆盖的 Cisco 插件框架(Grizzly 版本)

Quantum v2.0 Cisco 插件自述文件

简介

此插件实现提供以下功能:

  • Quantum 插件框架的参考实现(详情请参阅:https://wiki.openstack.org/quantum-multi-switch-plugin
  • 支持网络中的多个交换机
  • 同时支持多种型号的交换机
  • 支持使用多种 L2 技术
  • 支持 Cisco Nexus 系列交换机(已通过 Nexus 3000、5000 和 7000 系列验证)

覆盖架构

Cisco 插件覆盖架构使用模型层将 Nexus 插件覆盖在 Openvswitch 插件之上。它支持 Openvswitch 插件的两种分段方法:VLAN 和 GRE 隧道。

先决条件

(以下内容仅在使用系统中的 Nexus 设备时才需要。如果您只打算利用插件框架,则不需要这些内容。)

如果您在拓扑中使用 Nexus 交换机,则需要以下 NX-OS 版本和软件包才能启用 Nexus 支持

  • NX-OS 5.2.1 (Delhi) Build 69 或更高版本。
  • paramiko 库 - 适用于 python 的 SSHv2 协议库
  • ncclient v0.3.1 - 适用于 NETCONF 客户端的 Python 库
    • 您需要 Cisco Systems 修改过的 ncclient 版本。要获取它,请从 shell 提示符执行
git clone git@github.com:CiscoSystems/ncclient.git
sudo python ./setup.py install
  • 有关 ncclient 的更多信息,请参阅:http://schmizz.net/ncclient/
  • 支持的操作系统
  • RHEL 6.1 或更高版本
  • Ubuntu 11.10 或更高版本
  • 软件包:python-configobj-4.6.0-3.el6.noarch(或更高版本)
  • 软件包:python-routes-1.12.3-2.el6.noarch(或更高版本)
  • 软件包:pip install mysql-python

模块结构

  • quantum/plugins/cisco/ - 包含网络插件框架
    • /client - 用于核心和扩展 API 的 CLI 模块
    • /common - 整个插件共有的模块
    • /conf - 所有配置文件
    • /db - 持久化框架
    • /models - 将逻辑抽象与物理拓扑联系起来的类
    • /nexus - Nexus 特定的模块
    • /tests - 此插件特有的测试

基本插件配置

1. 备份 /etc/quantum/quantum.conf

2. 编辑 /etc/quantum.conf 并为 v2 API 编辑 "core_plugin"


core_plugin = quantum.plugins.cisco.network_plugin.PluginV2

3. MySQL 数据库设置

  • 3a. 使用以下命令在 mysql 中创建 quantum_l2network 数据库 -


mysql -u<mysqlusername> -p<mysqlpassword> -e "create database quantum_l2network"
  • 3b. 在 /etc/quantum/plugins/cisco/db_conn.ini 文件中输入 quantum_l2network 数据库配置信息。
    • /etc/quantum/plugins/cisco/db_conn.ini 文件。

4. 配置模型层以使用 Openvswitch 作为 vswitch 插件

  • 编辑 /etc/quantum/plugins/cisco/cisco_plugins.ini 的 [PLUGINS] 部分,如下所示:
vswitch_plugin=quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2

Cisco 插件覆盖在 Openvswitch GRE 隧道模式下

在此模式下,Nexus 交换机不配置任何内容,并充当简单的直通设备。

  • 使用 /etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini 中的以下设置配置 OVS 插件


[OVS]
tenant_network_type = gre
enable_tunneling = True
tunnel_id_ranges = 1:1000
local_ip = 172.29.74.73
  • 使用以下设置配置 Cisco 插件 (/etc/quantum/plugins/cisco/l2network_plugin.ini)


[MODEL]
model_class=quantum.plugins.cisco.models.virt_phy_sw_v2.VirtualPhysicalSwitchModelV2
  • 修改 /etc/quantum/plugins/cisco/nexus.ini 的 [DRIVER] 部分以添加伪造的 nexus 驱动程序


[DRIVER]
name=quantum.plugins.cisco.tests.unit.v2.nexus.fake_nexus_driver.CiscoNEXUSFakeDriver

Cisco 插件覆盖在 Openvswitch VLAN 模式下

  • 使用 /etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini 中的以下设置配置 OVS 插件


[OVS]
bridge_mappings = physnet1:br-eth1
network_vlan_ranges = physnet1:1000:1100
tenant_network_type = vlan
  • 配置 /etc/quantum/plugins/cisco/cisco_plugins.ini 的 [PLUGINS]:


[PLUGINS]
nexus_plugin=quantum.plugins.cisco.nexus.cisco_nexus_plugin_v2.NexusPlugin
vswitch_plugin=quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2
  • 在 /etc/quantum/plugins/cisco/nexus.ini 中配置 Nexus 交换机信息。格式应包括交换机的 IP 地址、连接到交换机的主机以及该主机连接到的交换机上的端口。您可以配置多个交换机以及每个交换机的多个主机,如下例所示


[SWITCH]
# Ip address of the switch
[[1.1.1.1]]
# Hostname of the node
[[[compute-1]]]
# Port this node is connected to on the nexus switch
ports=1/1
# Hostname of the node
[[[compute-2]]]
# Port this node is connected to on the nexus switch
ports=1/2
# Port number where the SSH will be running at the Nexus Switch, e.g.: 22 (Default)
[[[ssh_port]]]
ssh_port=22

[[2.2.2.2]]
# Hostname of the node
[[[compute-3]]]
# Port this node is connected to on the nexus switch
ports=1/15
# Hostname of the node
[[[compute-4]]]
# Port this node is connected to on the nexus switch
ports=1/16
# Port number where the SSH will be running at the Nexus Switch, e.g.: 22 (Default)
[[[ssh_port]]]
ssh_port=22
[DRIVER]
name=quantum.plugins.cisco.nexus.cisco_nexus_network_driver_v2.CiscoNEXUSDriver
  • 4c. 确保运行 Quantum 服务的主机知道所有 Nexus 交换机的 SSH 主机密钥。您只需以运行 Quantum 的用户身份登录到 Quantum 主机,并至少 SSH 到交换机一次即可完成此操作。如果主机密钥发生更改(例如,由于更换了监管器或清除了交换机上的 SSH 配置),您可能需要重复此步骤并从 ~/.ssh/known_hosts 中删除旧主机密钥。
    • host on which you are running the Quantum service. You can do this simply by logging in to your Quantum host as the user that Quantum runs as and SSHing to the switches at least once. If the host key changes (e.g. due to replacement of the supervisor or clearing of the SSH config on the switch), you may need to repeat this step and remove the old hostkeys from ~/.ssh/known_hosts.

7. 验证您是否拥有 quantum/plugins/cisco/credentials.ini 中列出的每个 IP 地址的正确凭据。示例

  • in quantum/plugins/cisco/credentials.ini. Example


# Provide the Nexus credentials, if you are using Nexus switches.
# If not this will be ignored.
[1.1.1.1]
username=admin
password=mySecretPasswordForNexus

[2.2.2.2]
username=admin
password=mySecretPasswordForNexus
  • 通常,请确保系统中使用的每个 Nexus 交换机都在上述文件中有一个凭据条目。这是系统能够与这些交换机通信所必需的。

9. 启动 Quantum 服务。如果某些功能无法正常工作,请验证上述每个文件的配置。

  • your configuration of each of the above files.

如何测试安装

单元测试位于 quantum/plugins/cisco/tests/unit/v2。可以使用 run_tests.sh 脚本从顶层 Quantum 目录执行它们。

1. 测试核心 API(未配置 UCS/Nexus/RHEL 设备子插件)

  • 默认情况下,所有设备子插件都在 etc/quantum/plugins/cisco/cisco_plugins.ini 中禁用(注释掉)


   ./run_tests.sh quantum.plugins.cisco.tests.unit.v2.test_api_v2
   ./run_tests.sh quantum.plugins.cisco.tests.unit.v2.test_network_plugin

2. 要测试 Nexus 设备子插件,请执行以下配置

  • 编辑 etc/quantum/plugins/cisco/cisco_plugins.ini 以添加:在 [PLUGINS] 部分添加


nexus_plugin=quantum.plugins.cisco.nexus.cisco_nexus_plugin_v2.NexusPlugin
  • 编辑 etc/quantum/plugins/cisco/nexus.ini 文件。不使用 Nexus 硬件时,请按原样使用以下虚拟配置


[SWITCH]
[[1.1.1.1]]
# Hostname of the node
[[[compute-1]]]
# Port this node is connected to on the nexus switch
ports=1/1
# Port number where the SSH will be running at the Nexus Switch, e.g.: 22 (Default)
[[[ssh_port]]]
ssh_port=22

[DRIVER]
name=quantum.plugins.cisco.tests.unit.v2.nexus.fake_nexus_driver.CiscoNEXUSFakeDriver


适用于跨多个物理交换机的 Quantum L2 网络覆盖的 Cisco 插件框架(Havana 版本及更高版本)

在 Havana 版本中,Quantum 已更名为 "Neutron"。有关 Havana 及更高版本的信息,请参见此处

https://wiki.openstack.org/wiki/Cisco-neutron

Pre-grizzly 支持信息

Cisco UCS 插件在 grizzly 版本中已被弃用(将在更高版本中恢复),并添加了对智能多交换机配置的支持。如果您使用的是 grizzly 之前的任何版本,则以下信息相关。

模块结构

  • quantum/plugins/cisco/ - 包含网络插件框架
    • /client - 用于核心和扩展 API 的 CLI 模块
    • /common - 整个插件共有的模块
    • /conf - 所有配置文件
    • /db - 持久化框架
    • /models - 将逻辑抽象与物理拓扑联系起来的类
    • /nova - Nova 使用的调度程序和 VIF 驱动程序
    • /nexus - Nexus 特定的模块
    • /segmentation - 分段管理器实现,例如 VLAN 管理器
    • /services - 用于插入路径内网络服务的编排库集
    • /ucs - UCS 特定的模块

插件安装说明

1. 备份 quantum/etc/quantum.conf

2. 编辑 quantum/etc/quantum.conf 并为 v2 API 编辑 "core_plugin"

`core_plugin = quantum.plugins.cisco.network_plugin.PluginV2`

3. MySQL 数据库设置

  • 3a. 使用以下命令在 mysql 中创建 quantum_l2network 数据库 -

`mysql -u<mysqlusername> -p<mysqlpassword> -e "create database quantum_l2network"`

  • 3b. 在 /etc/quantum/plugins/cisco/db_conn.ini 文件中输入 quantum_l2network 数据库配置信息。
    • quantum/plugins/cisco/db_conn.ini file.

4. 如果要开启对 Cisco Nexus 交换机的支持

  • 4a. 取消注释 etc/quantum/plugins/cisco/cisco_plugins.ini 中的 nexus_plugin 属性,使其显示为
    • etc/quantum/plugins/cisco/cisco_plugins.ini to read


[PLUGINS]
nexus_plugin=quantum.plugins.cisco.nexus.cisco_nexus_plugin_v2.NexusPlugin
  • 4b. 在 etc/quantum/plugins/cisco/nexus.ini 文件中输入相关配置。示例
    • etc/quantum/plugins/cisco/nexus.ini file. Example


[SWITCH]
# Change the following to reflect the IP address of the Nexus switch.
# This will be the address at which Quantum sends and receives configuration
# information via SSHv2.
nexus_ip_address=10.0.0.1
# Port numbers on the Nexus switch to each one of the compute nodes are connected
# Use shortened interface syntax, e.g. "1/10" not "Ethernet1/10" and "," between ports.
ports=1/10,1/11,1/12
#Port number where SSH will be running on the Nexus switch.  Typically this is 22
#unless you've configured your switch otherwise.
nexus_ssh_port=22

[DRIVER]
name=quantum.plugins.cisco.nexus.cisco_nexus_network_driver.CiscoNEXUSDriver
  • 4c. 确保运行 Quantum 服务的主机知道 Nexus 交换机的 SSH 主机密钥。您只需以运行 Quantum 的用户身份登录到 Quantum 主机,并至少 SSH 到交换机一次即可完成此操作。如果主机密钥发生更改(例如,由于更换了监管器或清除了交换机上的 SSH 配置),您可能需要重复此步骤并从 ~/.ssh/known_hosts 中删除旧主机密钥。
    • host on which you are running the Quantum service. You can do this simply by logging in to your Quantum host as the user that Quantum runs as and SSHing to the switch at least once. If the host key changes (e.g. due to replacement of the supervisor or clearing of the SSH config on the switch), you may need to repeat this step and remove the old hostkey from ~/.ssh/known_hosts.

5. 如果您使用的是带有 M81KR 虚拟接口卡的 UCS 刀片服务器,并且想要利用 VM-FEX 功能,请执行以下操作:5a. 取消注释 ucs_plugin 属性

  • want to leverage the VM-FEX features, 5a. Uncomment the ucs_plugin propertes in
    • etc/quantum/plugins/cisco/cisco_plugins.ini to read


[PLUGINS]
ucs_plugin=quantum.plugins.cisco.ucs.cisco_ucs_plugin_v2.UCSVICPlugin
[INVENTORY]
ucs_plugin=quantum.plugins.cisco.ucs.cisco_ucs_inventory_v2.UCSInventory

    5b.  Enter the relevant configuration in the
         etc/quantum/plugins/cisco/ucs.ini file.  Example:

[UCSM]
#change the following to the appropriate UCSM IP address
#if you have more than one UCSM, enter info from any one
ip_address=<put_ucsm_ip_address_here>
default_vlan_name=default
default_vlan_id=1
max_ucsm_port_profiles=1024
profile_name_prefix=q-

[DRIVER]
name=quantum.plugins.cisco.ucs.cisco_ucs_network_driver.CiscoUCSMDriver
  • 5c. 通过编辑 quantum/plugins/cisco/conf/ucs_inventory.ini 文件来配置部署中的 UCS 系统信息。您可以为每个部署配置多个 UCSM、每个 UCSM 多个机箱以及每个机箱多个刀片。机箱 ID 和刀片 ID 可以从 UCSM 获取(它们通常是 1、2、3 等数字)。还要确保输入 Nova 看到的确切主机名(nova DB 中 services 表中的 host 列将提供该信息)。
    • quantum/plugins/cisco/conf/ucs_inventory.ini file. You can configure multiple UCSMs per deployment, multiple chassis per UCSM, and multiple blades per chassis. Chassis ID and blade ID can be obtained from the UCSM (they will typically be numbers like 1, 2, 3, etc.). Also make sure that you put the exact hostname as nova sees it (the host column in the services table of the nova DB will give you that information).


[ucsm-1]
ip_address = <put_ucsm_ip_address_here>
[[chassis-1]]
chassis_id = <put_the_chassis_id_here>
[[[blade-1]]]
blade_id = <put_blade_id_here>
host_name = <put_hostname_here>
[[[blade-2]]]
blade_id = <put_blade_id_here>
host_name = <put_hostname_here>
[[[blade-3]]]
blade_id = <put_blade_id_here>
host_name = <put_hostname_here>

[ucsm-2]
ip_address = <put_ucsm_ip_address_here>
[[chassis-1]]
chassis_id = <put_the_chassis_id_here>
[[[blade-1]]]
blade_id = <put_blade_id_here>
host_name = <put_hostname_here>
[[[blade-2]]]
blade_id = <put_blade_id_here>
host_name = <put_hostname_here>
  • 5d. 通过在 /etc/nova/nova.conf 文件中添加以下条目,配置 OpenStack 安装以使用 802.1qbh VIF 驱动程序和 Quantum 感知调度程序
    • Quantum-aware scheduler by editing the /etc/nova/nova.conf file with the following entries


scheduler_driver=quantum.plugins.cisco.nova.quantum_port_aware_scheduler.QuantumPortAwareScheduler
quantum_host=127.0.0.1
quantum_port=9696
libvirt_vif_driver=quantum.plugins.cisco.nova.vifdirect.Libvirt802dot1QbhDriver
libvirt_vif_type=802.1Qbh
  • 注意:要在 UCS 刀片上启动 VM,您应该首先使用 Quantum create port API 为该 VM 创建一个端口。如果未使用的端口不可用,VM 创建将失败。如果您为 Nova 项目配置了多个网络,Nova 将尝试为每个配置的网络实例化一个网络接口 (VIF)。要为每个 VIF 提供插件点,您需要在启动 VM 之前为每个网络创建一个 Quantum 端口。但是,在这种情况下,您需要使用 Cisco multiport 扩展 API 而不是 Quantum create port API。有关使用 multiport 扩展的更多详细信息,请参阅多 NIC 支持部分。
    • port for that VM using the Quantum create port API. VM creation will fail if an unused port is not available. If you have configured your Nova project with more than one network, Nova will attempt to instantiate the VM with one network interface (VIF) per configured network. To provide plugin points for each of these VIFs, you will need to create multiple Quantum ports, one for each of the networks, prior to starting the VM. However, in this case you will need to use the Cisco multiport extension API instead of the Quantum create port API. More details on using the multiport extension follow in the section on multi NIC support.
To support the above configuration, you will need some Quantum modules. It's easiest to copy the entire quantum directory from your quantum installation into: /usr/lib/python2.7/site-packages/ This needs to be done on each nova compute node.

7. 验证您是否拥有 quantum/plugins/cisco/credentials.ini 中列出的每个 IP 地址的正确凭据。示例

  • in quantum/plugins/cisco/conf/credentials.ini. Example


# Provide the UCSM credentials, create a separte entry for each UCSM used in your system
# UCSM IP address, username and password.
[10.0.0.2]
username=admin
password=mySecretPasswordForUCSM

# Provide the Nexus credentials, if you are using Nexus switches.
# If not this will be ignored.
[10.0.0.1]
username=admin
password=mySecretPasswordForNexus
  • 通常,请确保系统中使用的每个 UCSM 和 Nexus 交换机都在上述文件中有一个凭据条目。这是系统能够与这些交换机通信所必需的。

9. 启动 Quantum 服务。如果某些功能无法正常工作,请验证上述每个文件的配置。

  • your configuration of each of the above files.

VM 的多 NIC 支持


如前所述,如果您的 Nova 设置中的项目有多个网络,Nova 将尝试为每个网络在 VM 上创建一个虚拟网络接口 (VIF)。

如前所述,如果您的 Nova 设置中的项目有多个网络,Nova 将尝试为每个网络在 VM 上创建一个虚拟网络接口 (VIF)。在实例化每个 VM 之前,您应该在每个网络上创建 Quantum 端口。需要使用以下 rest 调用创建这些端口

POST /1.0/extensions/csco/tenants/{tenant_id}/multiport/

请求正文为


{'multiport':
 {'status': 'ACTIVE',
  'net_id_list': net_id_list,
  'ports_desc': {'key': 'value'

</nowiki></pre>


其中,

net_id_list 是网络 ID 列表:[netid1, netid2, ...]。"ports_desc" 字典保留供以后使用。目前,应使用相同的字典名称、键和值结构。

此操作对应的 CLI 如下所示:

`PYTHONPATH=. python quantum/plugins/cisco/client/cli.py create_multiport <tenant_id> <net_id1,net_id2,...>`

  • (请注意,在上述情况下,您不应使用 create port 核心 API。)

将独立插件用作设备子插件

如果您想使用独立的虚拟交换机插件作为子插件之一(例如:OpenVSwitch 插件)与 nexus 设备子插件一起使用,请执行以下步骤

(以下说明与 OpenVSwitch 插件有关)1. 更新 etc/quantum/plugins/cisco/l2network_plugin.ini

  • 在配置文件的 [MODEL] 部分中放入以下配置(请注意,这应该是本部分中唯一的配置,所有其他配置都应删除或注释掉)

2. 更新 etc/quantum/plugins/cisco/cisco_plugins.ini

  • 在配置文件的 [PLUGINS] 部分中放入以下配置
`vswitch_plugin=quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2`

3. 设置 DB 名称,必须在三个位置配置相同的名称

  • 在 etc/quantum/plugins/cisco/conf/db_conn.ini 中设置 "name" 值 在 /etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini 中设置 "sql_connection" 在 etc/quantum/plugins/cisco/conf/db_conn.ini 中设置 "name" 值 在 /etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini 中设置 "sql_connection" 在 /etc/quantum/dhcp_agent.ini 中设置 "db_connection"

4. 必须在 OpenVSwitch 配置文件中设置 VLAN ID 范围

  • 在 /etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini 中设置


   vlan_min = <lower_id>
   vlan_max = <higher_id>
   enable_tunneling = False

5. 有关 Nexus 设备子插件配置,请参阅以上部分

如何测试安装

单元测试位于 quantum/tests/unit/cisco/。可以使用 tox 从顶层 Quantum 目录执行它们(
[sudo] pip install pip testrepository
)

1. 测试核心 API(未配置 UCS/Nexus/RHEL 设备子插件)

  • 默认情况下,所有设备子插件都在 etc/quantum/plugins/cisco/cisco_plugins.ini 中禁用(注释掉)


   tox -e py27 -- quantum.tests.unit.cisco.test_network_plugin
   tox -e py27 -- quantum.tests.unit.cisco.test_nexus_plugin


2. 要测试 Nexus 设备子插件,请执行以下配置

  • 编辑 etc/quantum/plugins/cisco/cisco_plugins.ini 以添加:在 [PLUGINS] 部分添加

`nexus_plugin=quantum.plugins.cisco.nexus.cisco_nexus_plugin_v2.NexusPlugin`

  • 编辑 etc/quantum/plugins/cisco/nexus.ini 文件。不使用 Nexus 硬件时,请按原样使用以下虚拟配置


[SWITCH]
nexus_ip_address=1.1.1.1
ports=1/10,1/11,1/12
nexus_ssh_port=22
[DRIVER]
name=quantum.plugins.cisco.test.nexus.fake_nexus_driver.CiscoNEXUSFakeDriver
   Or when using Nexus hardware (put the values relevant to your setup):
[SWITCH]
nexus_ip_address=1.1.1.1
ports=1/10,1/11,1/12
nexus_ssh_port=22
[DRIVER]
name=quantum.plugins.cisco.nexus.cisco_nexus_network_driver.CiscoNEXUSDriver
  • (注意:确保 quantum/plugins/cisco/conf/credentials.ini 中有以下条目

3. 要测试 UCS 设备子插件,请执行以下配置

  • 编辑 etc/quantum/plugins/cisco/cisco_plugins.ini 以添加:在 [PLUGINS] 部分添加

`ucs_plugin=quantum.plugins.cisco.ucs.cisco_ucs_plugin_v2.UCSVICPlugin`

  • 在 [INVENTORY] 部分添加:不使用 UCS 硬件时

`ucs_plugin=quantum.plugins.cisco.test.ucs.cisco_ucs_inventory_fake.UCSInventory`

  • 或者使用 UCS 硬件时

`ucs_plugin=quantum.plugins.cisco.ucs.cisco_ucs_inventory_v2.UCSInventory`

  • 编辑 etc/quantum/plugins/cisco/ucs.ini 文件。不使用 UCS 硬件时


[DRIVER]
name=quantum.plugins.cisco.test.ucs.fake_ucs_driver.CiscoUCSMFakeDriver
   Or when using UCS hardware:
[DRIVER]
name=quantum.plugins.cisco.ucs.cisco_ucs_network_driver.CiscoUCSMDriver
版权所有:2013 Cisco Systems, Inc.