Skip to content

Commit

Permalink
Merge pull request #824 from gridsingularity/bug/D3ASIM-2599
Browse files Browse the repository at this point in the history
D3ASIM-2599: Creating an aggregator_device mapping while selecting if…
  • Loading branch information
faizan2590 authored Jul 13, 2020
2 parents fee385a + 9692f2a commit 8b49401
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/d3a/d3a_core/redis_connections/aggregator_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,16 @@ def aggregator_callback(self, payload):

def _select_aggregator(self, message):
if message['aggregator_uuid'] not in self.aggregator_device_mapping:
msg = f"{message['aggregator_uuid']} aggregator not found."
error_response_message = {
"status": "error", "aggregator_uuid": message['aggregator_uuid'],
self.aggregator_device_mapping[message['aggregator_uuid']] = []
self.aggregator_device_mapping[message['aggregator_uuid']].\
append(message['device_uuid'])
self.device_aggregator_mapping[message['device_uuid']] = message['aggregator_uuid']
success_response_message = {
"status": "SELECTED", "aggregator_uuid": message['aggregator_uuid'],
"device_uuid": message['device_uuid'],
"transaction_id": message['transaction_id'],
"msg": msg
}
"transaction_id": message['transaction_id']}
self.redis_db.publish(
"aggregator_response", json.dumps(error_response_message)
"aggregator_response", json.dumps(success_response_message)
)
elif message['device_uuid'] in self.device_aggregator_mapping:
msg = f"Device already have selected " \
Expand Down

0 comments on commit 8b49401

Please sign in to comment.