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

cyclades: Add deleted attribute for changes-since

Extend API response for servers, networks, subnets and floating IPs,
to support HTTP 'changes-since' queries.
parent bbd20aef
......@@ -98,7 +98,8 @@ def ip_to_dict(floating_ip):
"instance_id": str(machine_id) if machine_id else None,
"floating_ip_address": floating_ip.address,
"port_id": str(port_id) if port_id else None,
"floating_network_id": str(floating_ip.network_id)}
"floating_network_id": str(floating_ip.network_id),
"deleted": floating_ip.deleted}
@api.api_method(http_method="GET", user_required=True, logger=log,
......@@ -236,4 +237,5 @@ def network_to_floating_ip_pool(network):
total, free = network.ip_count()
return {"name": str(network.id),
"size": total,
"free": free}
"free": free,
"deleted": network.deleted}
......@@ -187,6 +187,7 @@ def network_to_dict(network, detail=True):
d['admin_state_up'] = True
d['subnets'] = subnet_ids
d['SNF:floating_ip_pool'] = network.floating_ip_pool
d['deleted'] = True
return d
......
......@@ -210,6 +210,7 @@ def vm_to_dict(vm, detail=False):
d["SNF:fqdn"] = fqdn
d["SNF:port_forwarding"] = get_server_port_forwarding(vm, active_nics,
fqdn)
d['deleted'] = vm.deleted
return d
......
......@@ -226,7 +226,8 @@ def subnet_to_dict(subnet):
'enable_dhcp': subnet.dhcp,
'dns_nameservers': dns,
'host_routes': hosts,
'allocation_pools': allocation_pools}
'allocation_pools': allocation_pools,
'deleted': subnet.deleted}
if subnet.ipversion == 6:
d['enable_slaac'] = subnet.dhcp
......
......@@ -76,6 +76,7 @@ class FloatingIPAPITest(BaseAPITest):
"fixed_ip_address": None,
"id": str(ip.id),
"port_id": str(ip.nic.id),
"deleted": False,
"floating_network_id": str(ip.network_id)})
def test_get_ip(self):
......@@ -90,6 +91,7 @@ class FloatingIPAPITest(BaseAPITest):
"fixed_ip_address": None,
"id": str(ip.id),
"port_id": str(ip.nic.id),
"deleted": False,
"floating_network_id": str(ip.network_id)})
def test_wrong_user(self):
......@@ -121,6 +123,7 @@ class FloatingIPAPITest(BaseAPITest):
"fixed_ip_address": None,
"id": str(ip.id),
"port_id": None,
"deleted": False,
"floating_network_id": str(self.pool.id)})
def test_reserve_empty_body(self):
......@@ -194,6 +197,7 @@ class FloatingIPAPITest(BaseAPITest):
"fixed_ip_address": None,
"id": str(ip.id),
"port_id": None,
"deleted": False,
"floating_network_id": str(self.pool.id)})
# Already reserved
......
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