Tong Liu b533a8ee3f NSXv3: Neutron LBaaS nsxv3 support
This patch adds neutron lBaaS nsxv3 support. The refactor has been
done in neutron-lbaas to share the same driver for nsxv and nsxv3.
(I7308035d38f2ab15a85096ec30388ef5c3f56ca3). Also load balancer
API wrapper for nsxv3 also has been added to vmware-nsxlib in
(I0fc80e20551e0994888d8c222a9a620dcb2f6e32).

This patch implements the functionality of the following lbaas
resources:
  - loadbalancer
  - listener
  - pool
  - member
  - healthmonitor

If nsx platform doesn't support LB, we will return a dummy
driver class. It will raise NotImplementedError if user tries
to use LBaaS driver.

Note that layer7 support is not in this patch. It will be
supported in another path.

Change-Id: I43473f41343e7b7499bf3ebdaf0a51fd2644509a
2017-07-17 11:20:27 -07:00

76 lines
2.3 KiB
Python

# Copyright 2015 VMware, Inc.
# 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 neutron_lib.plugins import constants as plugin_const
from neutron_lib.plugins import directory
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
class LoadbalancerBaseManager(object):
_lbv2_driver = None
_core_plugin = None
_flavor_plugin = None
def __init__(self):
super(LoadbalancerBaseManager, self).__init__()
def _get_plugin(self, plugin_type):
return directory.get_plugin(plugin_type)
@property
def lbv2_driver(self):
if not LoadbalancerBaseManager._lbv2_driver:
plugin = self._get_plugin(
plugin_const.LOADBALANCERV2)
LoadbalancerBaseManager._lbv2_driver = (
plugin.drivers['vmwareedge'])
return LoadbalancerBaseManager._lbv2_driver
@property
def core_plugin(self):
if not LoadbalancerBaseManager._core_plugin:
LoadbalancerBaseManager._core_plugin = (
self._get_plugin(plugin_const.CORE))
return LoadbalancerBaseManager._core_plugin
@property
def flavor_plugin(self):
if not LoadbalancerBaseManager._flavor_plugin:
LoadbalancerBaseManager._flavor_plugin = (
self._get_plugin(plugin_const.FLAVORS))
return LoadbalancerBaseManager._flavor_plugin
class EdgeLoadbalancerBaseManager(LoadbalancerBaseManager):
def __init__(self, vcns_driver):
super(EdgeLoadbalancerBaseManager, self).__init__()
self.vcns_driver = vcns_driver
@property
def vcns(self):
return self.vcns_driver.vcns
class Nsxv3LoadbalancerBaseManager(LoadbalancerBaseManager):
def __init__(self):
super(Nsxv3LoadbalancerBaseManager, self).__init__()