Files
group-based-policy/gbpservice/neutron/plugins/ml2plus/driver_context.py
Kent Wu 74c36b721d Security Group support
1. Change 2 binding parameters to False, which will disable iptables FW. This is
basically what we do for the legacy GBP.
2. Provide a monkey patch to address those upstream bugs related to SG and SG_rules.
3. Register for those SG and SG_rules events then process them accordingly. This will
create/update/delete the corresponding objects in AIM.
4. If a SG_rule's remote_group_id is set, expand the port's fixed_ips into this rule's
remote_ips. Also remove that ip when the port is being deleted. This will also happen
when SGs are added or removed from the port.
5. Insert some default rules to allow ARP traffic to go thru during the MD initialization.
6. Add the SG info into the EP file.

Change-Id: I4b0d9f9da2c15ac95aef6697a74f03194eb74487
2017-10-05 12:14:39 -07:00

91 lines
3.0 KiB
Python

# Copyright (c) 2016 Cisco Systems 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.plugins.ml2 import driver_context as ml2_context
from gbpservice.neutron.plugins.ml2plus import driver_api as api
class SubnetPoolContext(ml2_context.MechanismDriverContext,
api.SubnetPoolContext):
def __init__(self, plugin, plugin_context, subnetpool,
original_subnetpool=None):
super(SubnetPoolContext, self).__init__(plugin, plugin_context)
self._subnetpool = subnetpool
self._original_subnetpool = original_subnetpool
@property
def current(self):
return self._subnetpool
@property
def original(self):
return self._original_subnetpool
class AddressScopeContext(ml2_context.MechanismDriverContext,
api.AddressScopeContext):
def __init__(self, plugin, plugin_context, address_scope,
original_address_scope=None):
super(AddressScopeContext, self).__init__(plugin, plugin_context)
self._address_scope = address_scope
self._original_address_scope = original_address_scope
@property
def current(self):
return self._address_scope
@property
def original(self):
return self._original_address_scope
class SecurityGroupContext(ml2_context.MechanismDriverContext,
api.SecurityGroupContext):
def __init__(self, plugin, plugin_context, security_group,
original_security_group=None):
super(SecurityGroupContext, self).__init__(plugin, plugin_context)
self._security_group = security_group
self._original_security_group = original_security_group
@property
def current(self):
return self._security_group
@property
def original(self):
return self._original_security_group
class SecurityGroupRuleContext(ml2_context.MechanismDriverContext,
api.SecurityGroupRuleContext):
def __init__(self, plugin, plugin_context, security_group_rule,
original_security_group_rule=None):
super(SecurityGroupRuleContext, self).__init__(plugin, plugin_context)
self._security_group_rule = security_group_rule
self._original_security_group_rule = original_security_group_rule
@property
def current(self):
return self._security_group_rule
@property
def original(self):
return self._original_security_group_rule