From 862bb9f2f877006e677aa258472112442e5aaa3e Mon Sep 17 00:00:00 2001 From: Romil Gupta Date: Sun, 1 Mar 2015 23:25:37 -0800 Subject: [PATCH] Ml2 Mechanism Driver for OVSvApp Solution With the introduction of stackforge/networking-vsphere project which includes the OVSvApp L2 agent for doing vsphere networking using neutron. We need to have thin mechanism driver in neutron which integrates the ml2 plugin with the OVSvApp L2 Agent. The mechanism driver implements the abstract method given in mech_agent.SimpleAgentMechanismDriverBase. Closes-Bug: 1426365 Partially-implements: blueprint core-vendor-decomposition Change-Id: I57b2abb58671b8a1c6a2734959346ddeb8fda988 --- etc/neutron/plugins/ovsvapp/ovsvapp_agent.ini | 63 +++++++++++++++++++ .../eventlet/plugins/ovsvapp_neutron_agent.py | 26 ++++++++ .../plugins/ml2/drivers/ovsvapp/__init__.py | 0 .../ml2/drivers/ovsvapp/mech_driver.py | 50 +++++++++++++++ .../ml2/drivers/ovsvapp/requirements.txt | 1 + setup.cfg | 3 + 6 files changed, 143 insertions(+) create mode 100644 etc/neutron/plugins/ovsvapp/ovsvapp_agent.ini create mode 100644 neutron/cmd/eventlet/plugins/ovsvapp_neutron_agent.py create mode 100644 neutron/plugins/ml2/drivers/ovsvapp/__init__.py create mode 100644 neutron/plugins/ml2/drivers/ovsvapp/mech_driver.py create mode 100644 neutron/plugins/ml2/drivers/ovsvapp/requirements.txt diff --git a/etc/neutron/plugins/ovsvapp/ovsvapp_agent.ini b/etc/neutron/plugins/ovsvapp/ovsvapp_agent.ini new file mode 100644 index 000000000..77d93a954 --- /dev/null +++ b/etc/neutron/plugins/ovsvapp/ovsvapp_agent.ini @@ -0,0 +1,63 @@ +[vmware] +# Provide IP address for vCenter. +# vcenter_ip = + +# Provide vCenter Credentials. +# vcenter_username = +# vcenter_password = + +# SSL communication between OVSvApp Agent and vCenter Server +# cert_check = False +# Provide Certificate file location. +# cert_path = + +# Customized https_port for OVSvApp agent and vCenter Server communication +# https_port = 443 + +# Number of retries by OVSvApp Agent to connect to vCenter server +# vcenter_api_retry_count = 2 + +# wsdl_location = +# vCenter server wsdl location +# Example: +# wsdl_location=https://:/sdk/vimService.wsdl + +# Provide Cluster to DVS/vDS mapping. +# cluster_dvs_mapping = +# +# Example: +# cluster_dvs_mapping = //: + +# Provide ESX host name or IP address. +# esx_hostname = + +# To set the ESX host in maintenance mode during Fault Management. +# esx_maintenance_mode = True + +[ovsvapp] +# Currently OVSvApp Agent supports only VLAN. +# tenant_network_type = vlan + +# OVS integration bridge. +# integration_bridge = br-int + +# Provide bridge mappings for VLAN networks. +# bridge_mappings = +# +# Example: +# bridge_mappings = physnet1:br-eth1 +# where eth1 is data interface. + +# Firewall driver for OVSvApp. +# firewall_driver = networking_vsphere.drivers.ovs_firewall.OVSFirewallDriver + +# For disbaling security groups. +# firewall_driver = neutron.agent.firewall.NoopFirewallDriver + +[securitygroup] +# Provide bridge mapping for security groups. +# security_bridge_mapping = +# +# Example: +# security_bridge_mapping = br-sec:eth2 +# where br-sec is default security bridge and eth2 is trunk interface. diff --git a/neutron/cmd/eventlet/plugins/ovsvapp_neutron_agent.py b/neutron/cmd/eventlet/plugins/ovsvapp_neutron_agent.py new file mode 100644 index 000000000..1017f6146 --- /dev/null +++ b/neutron/cmd/eventlet/plugins/ovsvapp_neutron_agent.py @@ -0,0 +1,26 @@ +# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import sys + +from networking_vsphere import service + +from neutron.common import config as common_config + + +def main(): + common_config.init(sys.argv[1:]) + common_config.setup_logging() + service.run() diff --git a/neutron/plugins/ml2/drivers/ovsvapp/__init__.py b/neutron/plugins/ml2/drivers/ovsvapp/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/neutron/plugins/ml2/drivers/ovsvapp/mech_driver.py b/neutron/plugins/ml2/drivers/ovsvapp/mech_driver.py new file mode 100644 index 000000000..d05328532 --- /dev/null +++ b/neutron/plugins/ml2/drivers/ovsvapp/mech_driver.py @@ -0,0 +1,50 @@ +# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. +# +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from networking_vsphere.common import constants as ovsvapp_const +from networking_vsphere.ml2 import ovsvapp_driver +from oslo_log import log + +from neutron.extensions import portbindings +from neutron.plugins.common import constants as p_const +from neutron.plugins.ml2.drivers import mech_agent + +LOG = log.getLogger(__name__) + + +class OVSvAppAgentMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase): + """Attach to networks using OVSvApp Agent. + + The OVSvAppAgentMechanismDriver integrates the ml2 plugin with the + OVSvApp Agent. Port binding with this driver requires the + OVSvApp Agent to be running on the port's host, and that agent + to have connectivity to at least one segment of the port's + network. + """ + def __init__(self): + super(OVSvAppAgentMechanismDriver, self).__init__( + ovsvapp_const.AGENT_TYPE_OVSVAPP, + portbindings.VIF_TYPE_OTHER, + {portbindings.CAP_PORT_FILTER: True}) + self.ovsvapp_driver = ovsvapp_driver.OVSvAppAgentDriver() + self.ovsvapp_driver.initialize() + + def get_allowed_network_types(self, agent): + return (agent['configurations'].get('tunnel_types', []) + + [p_const.TYPE_VLAN]) + + def get_mappings(self, agent): + return agent['configurations'].get('bridge_mappings', {}) diff --git a/neutron/plugins/ml2/drivers/ovsvapp/requirements.txt b/neutron/plugins/ml2/drivers/ovsvapp/requirements.txt new file mode 100644 index 000000000..ab0954d87 --- /dev/null +++ b/neutron/plugins/ml2/drivers/ovsvapp/requirements.txt @@ -0,0 +1 @@ +networking-vsphere diff --git a/setup.cfg b/setup.cfg index 2c15a3530..2cb5a6818 100644 --- a/setup.cfg +++ b/setup.cfg @@ -80,6 +80,7 @@ data_files = etc/neutron/plugins/plumgrid = etc/neutron/plugins/plumgrid/plumgrid.ini etc/neutron/plugins/vmware = etc/neutron/plugins/vmware/nsx.ini etc/neutron/plugins/opencontrail = etc/neutron/plugins/opencontrail/contrailplugin.ini + etc/neutron/plugins/ovsvapp = etc/neutron/plugins/ovsvapp/ovsvapp_agent.ini scripts = bin/neutron-rootwrap-xen-dom0 @@ -103,6 +104,7 @@ console_scripts = neutron-nec-agent = neutron.cmd.eventlet.plugins.nec_neutron_agent:main neutron-netns-cleanup = neutron.cmd.netns_cleanup:main neutron-ns-metadata-proxy = neutron.cmd.eventlet.agents.metadata_proxy:main + neutron-ovsvapp-agent = neutron.cmd.eventlet.plugins.ovsvapp_neutron_agent:main neutron-nvsd-agent = neutron.plugins.oneconvergence.agent.nvsd_neutron_agent:main neutron-openvswitch-agent = neutron.plugins.openvswitch.agent.ovs_neutron_agent:main neutron-ovs-cleanup = neutron.cmd.ovs_cleanup:main @@ -163,6 +165,7 @@ neutron.ml2.type_drivers = vxlan = neutron.plugins.ml2.drivers.type_vxlan:VxlanTypeDriver nexus_vxlan = neutron.plugins.ml2.drivers.cisco.nexus.type_nexus_vxlan:NexusVxlanTypeDriver neutron.ml2.mechanism_drivers = + ovsvapp = neutron.plugins.ml2.drivers.ovsvapp.mech_driver:OVSvAppAgentMechanismDriver opendaylight = neutron.plugins.ml2.drivers.opendaylight.driver:OpenDaylightMechanismDriver logger = neutron.tests.unit.ml2.drivers.mechanism_logger:LoggerMechanismDriver test = neutron.tests.unit.ml2.drivers.mechanism_test:TestMechanismDriver -- 2.45.2