[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):
|
def get_gbp_details(self, context, **kwargs):
|
||||||
LOG.debug("APIC AIM MD handling get_gbp_details for: %s", kwargs)
|
LOG.debug("APIC AIM MD handling get_gbp_details for: %s", kwargs)
|
||||||
try:
|
try:
|
||||||
return self._get_gbp_details(context, kwargs)
|
return self._get_gbp_details(context, kwargs, kwargs.get('host'))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
device = kwargs.get('device')
|
device = kwargs.get('device')
|
||||||
LOG.error(_LE("An exception has occurred while retrieving 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)
|
LOG.debug("APIC AIM handling get_endpoint_details for: %s", kwargs)
|
||||||
try:
|
try:
|
||||||
request = kwargs.get('request')
|
request = kwargs.get('request')
|
||||||
|
host = kwargs.get('host')
|
||||||
result = {'device': request['device'],
|
result = {'device': request['device'],
|
||||||
'timestamp': request['timestamp'],
|
'timestamp': request['timestamp'],
|
||||||
'request_id': request['request_id'],
|
'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(
|
'neutron_details': ml2_rpc.RpcCallbacks(
|
||||||
None, None).get_device_details(context, **request)}
|
None, None).get_device_details(context, **request)}
|
||||||
return result
|
return result
|
||||||
@@ -96,11 +98,10 @@ class AIMMappingRPCMixin(ha_ip_db.HAIPOwnerDbMixin):
|
|||||||
# - self._is_dhcp_optimized(context, port);
|
# - self._is_dhcp_optimized(context, port);
|
||||||
# - self._is_metadata_optimized(context, port);
|
# - self._is_metadata_optimized(context, port);
|
||||||
# - self._get_vrf_id(context, port, details): VRF identified for the 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
|
# TODO(ivar): should this happen within a single transaction? what are
|
||||||
# the concurrency risks?
|
# the concurrency risks?
|
||||||
device = request.get('device')
|
device = request.get('device')
|
||||||
host = request.get('host')
|
|
||||||
|
|
||||||
core_plugin = self._core_plugin
|
core_plugin = self._core_plugin
|
||||||
port_id = core_plugin._device_to_port_id(context, device)
|
port_id = core_plugin._device_to_port_id(context, device)
|
||||||
|
|||||||
@@ -1775,8 +1775,9 @@ class TestPolicyTarget(AIMBaseTestCase):
|
|||||||
mapping['segmentation_labels'])
|
mapping['segmentation_labels'])
|
||||||
req_mapping = self.driver.request_endpoint_details(
|
req_mapping = self.driver.request_endpoint_details(
|
||||||
nctx.get_admin_context(),
|
nctx.get_admin_context(),
|
||||||
request={'device': 'tap%s' % pt1['port_id'], 'host': 'h1',
|
request={'device': 'tap%s' % pt1['port_id'],
|
||||||
'timestamp': 0, 'request_id': 'request_id'})
|
'timestamp': 0, 'request_id': 'request_id'},
|
||||||
|
host='h1')
|
||||||
epg_name = self.driver.apic_epg_name_for_policy_target_group(
|
epg_name = self.driver.apic_epg_name_for_policy_target_group(
|
||||||
self._neutron_context.session, ptg['id'], ptg['name'])
|
self._neutron_context.session, ptg['id'], ptg['name'])
|
||||||
epg_tenant = self.name_mapper.tenant(self._neutron_context.session,
|
epg_tenant = self.name_mapper.tenant(self._neutron_context.session,
|
||||||
@@ -1856,8 +1857,9 @@ class TestPolicyTarget(AIMBaseTestCase):
|
|||||||
host='h1')
|
host='h1')
|
||||||
req_mapping = self.driver.request_endpoint_details(
|
req_mapping = self.driver.request_endpoint_details(
|
||||||
nctx.get_admin_context(),
|
nctx.get_admin_context(),
|
||||||
request={'device': 'tap%s' % port_id, 'host': 'h1',
|
request={'device': 'tap%s' % port_id,
|
||||||
'timestamp': 0, 'request_id': 'request_id'})
|
'timestamp': 0, 'request_id': 'request_id'},
|
||||||
|
host='h1')
|
||||||
vrf_mapping = self.driver.get_vrf_details(
|
vrf_mapping = self.driver.get_vrf_details(
|
||||||
self._neutron_admin_context,
|
self._neutron_admin_context,
|
||||||
vrf_id=address_scope['id'])
|
vrf_id=address_scope['id'])
|
||||||
|
|||||||
Reference in New Issue
Block a user