Modifies responses to return provider subnet IDs

JIRA:NCP-1580

Updates the port view functionality to replace the real subnet_id with a
provider one. Necessitates updating the config again to incorporate the
ip_version in the provider subnet variable.
This commit is contained in:
Matt Dietz
2015-11-08 16:06:08 -06:00
parent ac622ec497
commit 53848e357a
8 changed files with 50 additions and 15 deletions

View File

@@ -205,7 +205,12 @@ def _port_dict(port, fields=None):
def _make_port_address_dict(ip, port, fields=None):
enabled = ip.enabled_for_port(port)
ip_addr = {"subnet_id": ip.get("subnet_id"),
subnet_id = ip.get("subnet_id")
net_id = ip.get("network_id")
if STRATEGY.is_provider_network(net_id):
subnet_id = STRATEGY.get_provider_subnet_id(net_id, ip["version"])
ip_addr = {"subnet_id": subnet_id,
"ip_address": ip.formatted(),
"enabled": enabled}
if fields and "port_subnets" in fields: