[AIM mapping] Extract agent host in RPC properly
For RPC method 'request_endpoint_details', the host from where the RPC was invoked is present as a top-level RPC parameter instead of being embedded inside the 'request' parameter. Change-Id: I847957b2fa8c870d1e6303acbcaa8246e4c5ccb1 Signed-off-by: Amit Bose <amitbose@gmail.com>
This commit is contained in:
@@ -61,7 +61,7 @@ class AIMMappingRPCMixin(ha_ip_db.HAIPOwnerDbMixin):
|
||||
def get_gbp_details(self, context, **kwargs):
|
||||
LOG.debug("APIC AIM MD handling get_gbp_details for: %s", kwargs)
|
||||
try:
|
||||
return self._get_gbp_details(context, kwargs)
|
||||
return self._get_gbp_details(context, kwargs, kwargs.get('host'))
|
||||
except Exception as e:
|
||||
device = kwargs.get('device')
|
||||
LOG.error(_LE("An exception has occurred while retrieving device "
|
||||
@@ -73,10 +73,12 @@ class AIMMappingRPCMixin(ha_ip_db.HAIPOwnerDbMixin):
|
||||
LOG.debug("APIC AIM handling get_endpoint_details for: %s", kwargs)
|
||||
try:
|
||||
request = kwargs.get('request')
|
||||
host = kwargs.get('host')
|
||||
result = {'device': request['device'],
|
||||
'timestamp': request['timestamp'],
|
||||
'request_id': request['request_id'],
|
||||
'gbp_details': self._get_gbp_details(context, request),
|
||||
'gbp_details': self._get_gbp_details(context, request,
|
||||
host),
|
||||
'neutron_details': ml2_rpc.RpcCallbacks(
|
||||
None, None).get_device_details(context, **request)}
|
||||
return result
|
||||
@@ -96,11 +98,10 @@ class AIMMappingRPCMixin(ha_ip_db.HAIPOwnerDbMixin):
|
||||
# - self._is_dhcp_optimized(context, port);
|
||||
# - self._is_metadata_optimized(context, port);
|
||||
# - self._get_vrf_id(context, port, details): VRF identified for the port;
|
||||
def _get_gbp_details(self, context, request):
|
||||
def _get_gbp_details(self, context, request, host):
|
||||
# TODO(ivar): should this happen within a single transaction? what are
|
||||
# the concurrency risks?
|
||||
device = request.get('device')
|
||||
host = request.get('host')
|
||||
|
||||
core_plugin = self._core_plugin
|
||||
port_id = core_plugin._device_to_port_id(context, device)
|
||||
|
||||
@@ -1775,8 +1775,9 @@ class TestPolicyTarget(AIMBaseTestCase):
|
||||
mapping['segmentation_labels'])
|
||||
req_mapping = self.driver.request_endpoint_details(
|
||||
nctx.get_admin_context(),
|
||||
request={'device': 'tap%s' % pt1['port_id'], 'host': 'h1',
|
||||
'timestamp': 0, 'request_id': 'request_id'})
|
||||
request={'device': 'tap%s' % pt1['port_id'],
|
||||
'timestamp': 0, 'request_id': 'request_id'},
|
||||
host='h1')
|
||||
epg_name = self.driver.apic_epg_name_for_policy_target_group(
|
||||
self._neutron_context.session, ptg['id'], ptg['name'])
|
||||
epg_tenant = self.name_mapper.tenant(self._neutron_context.session,
|
||||
@@ -1856,8 +1857,9 @@ class TestPolicyTarget(AIMBaseTestCase):
|
||||
host='h1')
|
||||
req_mapping = self.driver.request_endpoint_details(
|
||||
nctx.get_admin_context(),
|
||||
request={'device': 'tap%s' % port_id, 'host': 'h1',
|
||||
'timestamp': 0, 'request_id': 'request_id'})
|
||||
request={'device': 'tap%s' % port_id,
|
||||
'timestamp': 0, 'request_id': 'request_id'},
|
||||
host='h1')
|
||||
vrf_mapping = self.driver.get_vrf_details(
|
||||
self._neutron_admin_context,
|
||||
vrf_id=address_scope['id'])
|
||||
|
||||
Reference in New Issue
Block a user