]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Ml2 Mechanism Driver for OVSvApp Solution
authorRomil Gupta <romilg@hp.com>
Mon, 2 Mar 2015 07:25:37 +0000 (23:25 -0800)
committerArmando Migliaccio <armamig@gmail.com>
Tue, 24 Mar 2015 16:28:10 +0000 (16:28 +0000)
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 [new file with mode: 0644]
neutron/cmd/eventlet/plugins/ovsvapp_neutron_agent.py [new file with mode: 0644]
neutron/plugins/ml2/drivers/ovsvapp/__init__.py [new file with mode: 0644]
neutron/plugins/ml2/drivers/ovsvapp/mech_driver.py [new file with mode: 0644]
neutron/plugins/ml2/drivers/ovsvapp/requirements.txt [new file with mode: 0644]
setup.cfg

diff --git a/etc/neutron/plugins/ovsvapp/ovsvapp_agent.ini b/etc/neutron/plugins/ovsvapp/ovsvapp_agent.ini
new file mode 100644 (file)
index 0000000..77d93a9
--- /dev/null
@@ -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://<vCenter_ip>:<https_port>/sdk/vimService.wsdl
+
+# Provide Cluster to DVS/vDS mapping.
+# cluster_dvs_mapping =
+#
+# Example:
+# cluster_dvs_mapping = <DatacenterName>/<host>/<ClusterName>:<vDSName>
+
+# 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 (file)
index 0000000..1017f61
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
diff --git a/neutron/plugins/ml2/drivers/ovsvapp/mech_driver.py b/neutron/plugins/ml2/drivers/ovsvapp/mech_driver.py
new file mode 100644 (file)
index 0000000..d053285
--- /dev/null
@@ -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 (file)
index 0000000..ab0954d
--- /dev/null
@@ -0,0 +1 @@
+networking-vsphere
index 2c15a35309b82e8eb47c2a8523f8e6f54093d526..2cb5a6818766d7bd3e74d90a8f1bc45f8d29d9ec 100644 (file)
--- 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