Commit a1f08511 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Make servers response compatible with OS

parent 6253554d
......@@ -128,9 +128,13 @@ def nics_to_addresses(nics):
addresses = {}
for nic in nics:
net_nics = []
net_nics.append({"version": 4, "addr": nic.ipv4})
net_nics.append({"version": 4,
"addr": nic.ipv4,
"OS-EXT-IPS:type": "fixed"})
if nic.ipv6:
net_nics.append({"version": 6, "addr": nic.ipv6})
net_nics.append({"version": 6,
"addr": nic.ipv6,
"OS-EXT-IPS:type": "fixed"})
addresses[nic.network.id] = net_nics
return addresses
......@@ -167,6 +171,12 @@ def vm_to_dict(vm, detail=False):
d['diagnostics'] = diagnostics_to_dict([diagnostic])
else:
d['diagnostics'] = []
# Fixed
d["security_groups"] = [{"name": "default"}]
d["key_name"] = None
d["config_drive"] = ""
d["accessIPv4"] = ""
d["accessIPv6"] = ""
return d
......
......@@ -141,8 +141,8 @@ class ServerAPITest(ComputeAPITest):
self.assertEqual(api_nic['id'], 'nic-%s-%s' % (db_vm.id, nic.index))
api_address = server["addresses"]
self.assertEqual(api_address[str(net.id)],
[{"version": 4, "addr": nic.ipv4},
{"version": 6, "addr": nic.ipv6}])
[{"version": 4, "addr": nic.ipv4, "OS-EXT-IPS:type": "fixed"},
{"version": 6, "addr": nic.ipv6, "OS-EXT-IPS:type": "fixed"}])
metadata = server['metadata']
self.assertEqual(len(metadata), 1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment