[aim_mapping] APG mapping to AIM ApplicationProfile
Prior to this patch, the same AIM ApplicationProfile (with name 'OpenStack'), was used for EPGs (a different ApplicationProfile was created in each tenant, but with the same name).This patch attempts to map the GBP Application Policy Group (APG) to an AIM ApplicationProfile, such that a new AIM ApplicationProfile is created for every GBP Application Policy Group with the name of the ApplicationProfile derived from the ID of the GBP APG. The ApplicationProfile is created lazily and at the time of creating the first EPG that needs to be associated with this ApplicationProfile. Correspondingly, the ApplicationProfile is deleted when the last EPG using this ApplicationProfile is deleted. Implements: blueprint application-group Change-Id: I24d12f96d4e15bad5861b00887707fe7cda492a5
This commit is contained in:
@@ -26,6 +26,7 @@ ADDRESS_SCOPE_TYPE_TAG = 'as'
|
||||
ROUTER_TYPE_TAG = 'rtr'
|
||||
POLICY_RULE_SET_TYPE_TAG = 'prs'
|
||||
POLICY_RULE_TYPE_TAG = 'pr'
|
||||
APPLICATION_POLICY_GROUP_TYPE_TAG = 'apg'
|
||||
|
||||
|
||||
class APICNameMapper(object):
|
||||
@@ -81,6 +82,15 @@ class APICNameMapper(object):
|
||||
return self._unmap(
|
||||
session, name, POLICY_RULE_TYPE_TAG, prefix, enforce)
|
||||
|
||||
def application_policy_group(self, session, id, prefix=""):
|
||||
return self._map(
|
||||
session, id, APPLICATION_POLICY_GROUP_TYPE_TAG, prefix)
|
||||
|
||||
def reverse_application_policy_group(
|
||||
self, session, name, prefix="", enforce=True):
|
||||
return self._unmap(
|
||||
session, name, APPLICATION_POLICY_GROUP_TYPE_TAG, prefix, enforce)
|
||||
|
||||
def _map(self, session, id, type_tag, prefix):
|
||||
return ("%(prefix)s%(type_tag)s_%(id)s" %
|
||||
{'prefix': prefix, 'type_tag': type_tag, 'id': id})
|
||||
|
||||
Reference in New Issue
Block a user