provider centric service chains

With the introduction of NCP, one single chain will have only
one provider but multiple consumers. This reduces
the number of instances (and consumed resources).

Partially implements blueprint node-centric-chain-plugin

Change-Id: I2bef4d7c6d8e578b8cd4b6555820630f1eecf05f
This commit is contained in:
Ivar Lazzaro
2015-08-21 15:12:33 -07:00
parent 203f544bf7
commit 98e21c3c34
16 changed files with 233 additions and 420 deletions

View File

@@ -21,7 +21,7 @@ service_chain_opts = [
"gbpservice.neutron.servicechain.ncp_drivers "
"namespace.")),
cfg.StrOpt('node_plumber',
default='agnostic_plumber',
default='dummy_plumber',
help=_("The plumber used by the Node Composition Plugin "
"for service plumbing. Entrypoint loaded from the "
"gbpservice.neutron.servicechain.ncp_plumbers "

View File

@@ -14,6 +14,7 @@ from neutron import manager
from neutron.plugins.common import constants as pconst
from gbpservice.common import utils
from gbpservice.neutron.services.grouppolicy.drivers import resource_mapping
from gbpservice.neutron.services.servicechain.plugins.ncp import model
@@ -63,6 +64,8 @@ def get_node_driver_context(sc_plugin, context, sc_instance,
def _get_ptg_or_ep(context, group_id):
if group_id == resource_mapping.SCI_CONSUMER_NOT_AVAILABLE:
return None, False
group = None
is_group_external = False
if group_id:

View File

@@ -277,17 +277,21 @@ class HeatNodeDriver(driver_base.NodeDriverBase):
else:
provider_subnet = context.core_plugin.get_subnet(
context.plugin_context, provider_ptg_subnet_id)
if context.is_consumer_external:
# REVISIT(Magesh): Allowing the first destination which is 0/0
# Validate and skip adding FW rule in case routes is not set
es = context.gbp_plugin.get_external_segment(
context.plugin_context, consumer['external_segments'][0])
consumer_cidrs = [x['destination']
for x in es['external_routes']]
else:
consumer_subnet = context.core_plugin.get_subnet(
context._plugin_context, consumer['subnets'][0])
consumer_cidrs = [consumer_subnet['cidr']]
consumer_cidrs = []
if consumer:
if context.is_consumer_external:
# REVISIT(Magesh): Allowing the first destination which is
# 0/0 Validate and skip adding FW rule in case routes is
# not set
es = context.gbp_plugin.get_external_segment(
context.plugin_context,
consumer['external_segments'][0])
consumer_cidrs = [x['destination']
for x in es['external_routes']]
else:
consumer_subnet = context.core_plugin.get_subnet(
context._plugin_context, consumer['subnets'][0])
consumer_cidrs = [consumer_subnet['cidr']]
provider_cidr = provider_subnet['cidr']
self._update_template_with_firewall_rules(
context, provider_ptg, provider_cidr, consumer_cidrs,

View File

@@ -1,38 +0,0 @@
# 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.common import log
from gbpservice.neutron.services.servicechain.plugins.ncp import plumber_base
class ChainAgnosticPlumber(plumber_base.NodePlumberBase):
""" Chain Agnostic Plumber.
This plumber simply provides node drivers with the Service Targets
they requested for, without making any modification depending on the
rest of the chain.
"""
@log.log
def initialize(self):
pass
@log.log
def plug_services(self, context, deployment):
for part in deployment:
self._create_service_targets(context, part)
@log.log
def unplug_services(self, context, deployment):
for part in deployment:
self._delete_service_targets(context, part)

View File

@@ -127,7 +127,7 @@ class NodePlumberBase(object):
gbp_plugin = part_context.gbp_plugin
for target in targets:
if not group:
exceptions.NotAvailablePTGForTargetRequest(
raise exceptions.NotAvailablePTGForTargetRequest(
ptg_type=relationship, instance=instance['id'],
node=node['id'])
data = {'policy_target_group_id': group['id'],
@@ -146,4 +146,4 @@ class NodePlumberBase(object):
def _sort_deployment(self, deployment):
deployment.sort(key=lambda x: x['context'].current_position,
reverse=True)
reverse=True)