networking-generic-switch(一)

 

 

 

 

 

openstack queens安装

pip install networking-generic-switch==1.0.1
c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
       #include <ffi.h>
                       ^
      compilation terminated.
      error: command 'gcc' failed with exit status 1
  centos
sudo yum install libffi-devel
Ubuntu

$ sudo apt-get install libffi-dev

 

 

 思科

 

ML2 Nexus MD Installation
Install networking-cisco package as described in the section Installing the networking-cisco Package.

Configure Nexus ML2 Driver. Once the networking-cisco code is installed, it needs to be configured and enabled in neutron, the Nexus Mechanism Driver Administration Guide provides full details on how to create the neutron configs for various use cases. For details on each configuration parameters, refer to Nexus Configuration Reference.

Below is a simple VLAN configuration which can be applied to ML2 neutron config files ml2_conf.ini and possibly ml2_conf_cisco.ini located in directory /etc/neutron/plugins/ml2. The file ml2_conf_cisco.ini is optional if you’d like to isolate cisco specific parameters.

[ml2]
#- This neutron config specifies to use vlan type driver and use
#  cisco nexus mechanism driver.
type_drivers = vlan
tenant_network_types = vlan
mechanism_drivers = openvswitch,cisco_nexus

#- This extension driver must be enabled when the mechanism
#  driver includes nexus.
extension_drivers = cisco_providernet_ext

#- This neutron config specifies the vlan range to use.
[ml2_type_vlan]
network_vlan_ranges = physnet1:1400:3900

#- Provide Nexus credentials, OpenStack hostname, and nexus interface
[ml2_mech_cisco_nexus:192.168.1.1]
username=admin
password=mySecretPasswordForNexus
host_ports_mapping=host-1:[1/2]
Restart neutron to pick-up configuration changes.

$ service neutron-server restart

 

 

 netmiko_ovs_linux = networking_generic_switch.devices.netmiko_devices.ovs:OvsLinux
    netmiko_cisco_ios = networking_generic_switch.devices.netmiko_devices.cisco:CiscoIos
    netmiko_huawei = networking_generic_switch.devices.netmiko_devices.huawei:Huawei
    netmiko_huawei_vrpv8 = networking_generic_switch.devices.netmiko_devices.huawei_vrpv8:Huawei
    netmiko_arista_eos = networking_generic_switch.devices.netmiko_devices.arista:AristaEos
    netmiko_dell_force10 = networking_generic_switch.devices.netmiko_devices.dell:DellNos
    netmiko_brocade_fastiron = networking_generic_switch.devices.netmiko_devices.brocade:BrocadeFastIron

 

 

 

 

55434 2020-06-05 14:20:37.947 39992 ERROR neutron   File "/usr/lib/python2.7/site-packages/neutron/plugins/ml2/         plugin.py", line 200, in __init__
55435 2020-06-05 14:20:37.947 39992 ERROR neutron     self.mechanism_manager.initialize()
55436 2020-06-05 14:20:37.947 39992 ERROR neutron   File "/usr/lib/python2.7/site-packages/neutron/plugins/ml2/         managers.py", line 393, in initialize
55437 2020-06-05 14:20:37.947 39992 ERROR neutron     driver.obj.initialize()
55438 2020-06-05 14:20:37.947 39992 ERROR neutron   File "/usr/lib/python2.7/site-packages/                             networking_generic_switch/generic_switch_mech.py", line 43, in initialize
55439 2020-06-05 14:20:37.947 39992 ERROR neutron     switch = devices.device_manager(device_cfg)
55440 2020-06-05 14:20:37.947 39992 ERROR neutron   File "/usr/lib/python2.7/site-packages/                             networking_generic_switch/devices/__init__.py", line 47, in device_manager
55441 2020-06-05 14:20:37.947 39992 ERROR neutron     on_load_failure_callback=_load_failure_hook
55442 2020-06-05 14:20:37.947 39992 ERROR neutron   File "/usr/lib/python2.7/site-packages/stevedore/driver.py",        line 61, in __init__
55443 2020-06-05 14:20:37.947 39992 ERROR neutron     warn_on_missing_entrypoint=warn_on_missing_entrypoint
55444 2020-06-05 14:20:37.947 39992 ERROR neutron   File "/usr/lib/python2.7/site-packages/stevedore/named.py",         line 81, in __init__
55445 2020-06-05 14:20:37.947 39992 ERROR neutron     verify_requirements)
55446 2020-06-05 14:20:37.947 39992 ERROR neutron   File "/usr/lib/python2.7/site-packages/stevedore/extension.         py", line 203, in _load_plugins
55447 2020-06-05 14:20:37.947 39992 ERROR neutron     self._on_load_failure_callback(self, ep, err)
55448 2020-06-05 14:20:37.947 39992 ERROR neutron   File "/usr/lib/python2.7/site-packages/                             networking_generic_switch/devices/__init__.py", line 62, in _load_failure_hook
55449 2020-06-05 14:20:37.947 39992 ERROR neutron     err=exception)
55450 2020-06-05 14:20:37.947 39992 ERROR neutron GenericSwitchEntrypointLoadError: Failed to load entrypoint           netmiko_huawei_vrpv8 = networking_generic_switch.devices.netmiko_devices.huawei_vrpv8:Huawei: invalid             syntax (cisco_base_connection.py, line 143)
55451 2020-06-05 14:20:37.947 39992 ERROR neutron

 

 

 

[root@bogon site-packages]# find ./ -name cisco_base_connection.py
./netmiko/cisco_base_connection.py
[root@bogon site-packages]# pip list | grep netmiko
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
netmiko                          3.1.1
[root@bogon site-packages]#

For PY27, you would need to pip install netmiko==2.4.2
 Attempting uninstall: netmiko
    Found existing installation: netmiko 3.1.1
    Uninstalling netmiko-3.1.1:
      Successfully uninstalled netmiko-3.1.1
Successfully installed netmiko-2.4.2
[root@bogon site-packages]# pip install --upgrade  netmiko==2.4.2

 

Examples
Here is an example of /etc/neutron/plugins/ml2/ml2_conf_genericswitch.ini for the Cisco 300 series device:

[genericswitch:sw-hostname]
device_type = netmiko_cisco_s300
ngs_mac_address = <switch mac address>
username = admin
password = password
ip = <switch mgmt ip address>

 

(Re)start neutron-server specifying this additional configuration file:

neutron-server \
    --config-file /etc/neutron/neutron.conf \
    --config-file /etc/neutron/plugins/ml2/ml2_conf.ini \
    --config-file /etc/neutron/plugins/ml2/ml2_conf_genericswitch.ini

 

network_vlan_ranges = physnet_vlan:1:900

neutron net-create vlan1 --provider:network_type vlan  \
                                --provider:physical_network physnet_vlan --provider:segmentation_id 1
[root@bogon ironic]# neutron net-list 
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+-------+----------------------------------+------------------------------------------------------+
| id                                   | name  | tenant_id                        | subnets                                              |
+--------------------------------------+-------+----------------------------------+------------------------------------------------------+
| 1fcf749d-8e67-40ad-8718-e5daa85453fc | vlan1 | 46cc02c6fab04f7095c4bc687d397610 |                                                      |
| e00c4e3a-3634-4c59-8ce9-c09221cf684b | net1  | 46cc02c6fab04f7095c4bc687d397610 | 6e6628cf-58e1-4452-8364-9b5f95287a1d 172.16.100.0/24 |
+--------------------------------------+-------+----------------------------------+------------------------------------------------------+
[root@bogon ironic]# neutron net-list | grep vlan1 | awk '{print $2}'
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
1fcf749d-8e67-40ad-8718-e5daa85453fc
Created a new subnet:
+-------------------+------------------------------------------------------+
| Field             | Value                                                |
+-------------------+------------------------------------------------------+
| allocation_pools  | {"start": "172.16.100.100", "end": "172.16.100.250"} |
| cidr              | 172.16.100.0/24                                      |
| created_at        | 2020-06-05T06:51:49Z                                 |
| description       |                                                      |
| dns_nameservers   |                                                      |
| enable_dhcp       | True                                                 |
| gateway_ip        | 172.16.100.254                                       |
| host_routes       |                                                      |
| id                | 455abe0a-c1a2-4b2d-a8a2-0503f210eebe                 |
| ip_version        | 4                                                    |
| ipv6_address_mode |                                                      |
| ipv6_ra_mode      |                                                      |
| name              | public_subnet                                        |
| network_id        | 1fcf749d-8e67-40ad-8718-e5daa85453fc                 |
| project_id        | 46cc02c6fab04f7095c4bc687d397610                     |
| revision_number   | 0                                                    |
| service_types     |                                                      |
| subnetpool_id     |                                                      |
| tags              |                                                      |
| tenant_id         | 46cc02c6fab04f7095c4bc687d397610                     |
| updated_at        | 2020-06-05T06:51:49Z                                 |
+-------------------+------------------------------------------------------+

租户网络

 

Created a new network:
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | True                                 |
| availability_zone_hints   |                                      |
| availability_zones        |                                      |
| created_at                | 2020-06-05T07:09:32Z                 |
| description               |                                      |
| id                        | d25bad06-1316-4321-837e-9dde06147c05 |
| ipv4_address_scope        |                                      |
| ipv6_address_scope        |                                      |
| is_default                | False                                |
| mtu                       | 1500                                 |
| name                      | vlan101                              |
| port_security_enabled     | True                                 |
| project_id                | 46cc02c6fab04f7095c4bc687d397610     |
| provider:network_type     | vlan                                 |
| provider:physical_network | physnet_vlan                         |
| provider:segmentation_id  | 101                                  |
| revision_number           | 2                                    |
| router:external           | False                                |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tags                      |                                      |
| tenant_id                 | 46cc02c6fab04f7095c4bc687d397610     |
| updated_at                | 2020-06-05T07:09:32Z                 |
+---------------------------+--------------------------------------+
[root@bogon ironic]# neutron subnet-create --name tenant_subnet --ip-version 4   d25bad06-1316-4321-837e-9dde06147c05  172.16.101.0/24
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Created a new subnet:
+-------------------+----------------------------------------------------+
| Field             | Value                                              |
+-------------------+----------------------------------------------------+
| allocation_pools  | {"start": "172.16.101.2", "end": "172.16.101.254"} |
| cidr              | 172.16.101.0/24                                    |
| created_at        | 2020-06-05T07:15:34Z                               |
| description       |                                                    |
| dns_nameservers   |                                                    |
| enable_dhcp       | True                                               |
| gateway_ip        | 172.16.101.1                                       |
| host_routes       |                                                    |
| id                | 479cefc6-9df2-4f0a-ab1d-6c0248816d22               |
| ip_version        | 4                                                  |
| ipv6_address_mode |                                                    |
| ipv6_ra_mode      |                                                    |
| name              | tenant_subnet                                      |
| network_id        | d25bad06-1316-4321-837e-9dde06147c05               |
| project_id        | 46cc02c6fab04f7095c4bc687d397610                   |
| revision_number   | 0                                                  |
| service_types     |                                                    |
| subnetpool_id     |                                                    |
| tags              |                                                    |
| tenant_id         | 46cc02c6fab04f7095c4bc687d397610                   |
| updated_at        | 2020-06-05T07:15:34Z                               |
+-------------------+----------------------------------------------------+
[root@bogon ironic]# 

 

 

[ml2]
type_drivers = flat,vlan,vxlan
tenant_network_types = vxlan,vlan
mechanism_drivers = linuxbridge,l2population
extension_drivers = qos,dns

[ml2_type_vlan]
network_vlan_ranges = physnet1:1:4094

[ml2_type_flat]
flat_networks = external,pub

[ml2_type_vxlan]
vni_ranges = 1:1000
vxlan_group = 1.1.1.1

[securitygroup]
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

[agent]
extensions = qos

[linux_bridge]
physical_interface_mappings = physnet1:eth3,external:eth1,pub:bond0

[vxlan]
l2_population = true
local_ip = 10.10.36.5

 

server.log:39100:2020-06-06 11:45:46.215 56570 INFO networking_generic_switch.generic_switch_mech [req-e1c70273-02cd-4339-839c-1b95136f078f 33c5f89c308d40869e04811a2463898f 42272601916748e2ba64d8a1c5413ba4 - default default] Successfully bound port 03a9da5e-794a-4b66-80bf-eb27cc768fd6 in segment 1 on device JG05-SA-01-CE8850
server.log:41174:2020-06-06 12:10:34.158 56550 INFO networking_generic_switch.generic_switch_mech [req-1558e383-3743-4702-8143-d8c6b188180d 33c5f89c308d40869e04811a2463898f 42272601916748e2ba64d8a1c5413ba4 - default default] Port 03a9da5e-794a-4b66-80bf-eb27cc768fd6 has been unplugged from network 1fcf749d-8e67-40ad-8718-e5daa85453fc on device JG05-SA-01-CE8850
server.log:41496:2020-06-06 12:13:17.150 56550 INFO networking_generic_switch.generic_switch_mech [req-1c0ba418-a69a-4ef2-b661-3c179efd6e8c 33c5f89c308d40869e04811a2463898f 42272601916748e2ba64d8a1c5413ba4 - default default] Successfully bound port 39058c90-2cf5-41ad-87b1-d1632d7ece3a in segment 1 on device JG05-SA-01-CE8850
server.log:44137:2020-06-06 12:44:52.912 56526 INFO networking_generic_switch.generic_switch_mech [req-0fa3d932-92c9-41b4-b8b6-dae763d7e522 33c5f89c308d40869e04811a2463898f 42272601916748e2ba64d8a1c5413ba4 - default default] Port 39058c90-2cf5-41ad-87b1-d1632d7ece3a has been unplugged from network 1fcf749d-8e67-40ad-8718-e5daa85453fc on device JG05-SA-01-CE8850

 

posted on 2020-06-05 09:48  tycoon3  阅读(891)  评论(0编辑  收藏  举报

导航