Inject "wim_port_mappings" from "wim.config"
Automatically create/update port mappings during WIM creation/update,
as discussed in the WIM implementation meeting (12/Dec/2018).
Additionally fix small related errors and ensure wan_port_mappings
are returned by the HTTP server using the same keys forming the schema.
Change-Id: Icc27ad85c1de826ed96cb42b377055ea1b0c2cab
Signed-off-by: Anderson Bravalheri <a.bravalheri@bristol.ac.uk>
diff --git a/osm_ro/wim/http_handler.py b/osm_ro/wim/http_handler.py
index f5eeed9..b88dab3 100644
--- a/osm_ro/wim/http_handler.py
+++ b/osm_ro/wim/http_handler.py
@@ -120,6 +120,9 @@
def http_get_wim(self, tenant_id, wim_id):
tenant_id = None if tenant_id == 'any' else tenant_id
wim = self.engine.get_wim(wim_id, tenant_id)
+ mappings = self.engine.get_wim_port_mappings(wim_id)
+ wim['config'] = utils.merge_dicts(wim.get('config', {}) or {},
+ wim_port_mapping=mappings)
return format_out({'wim': wim})
@route('POST', '/wims')