@@ -42,21 +42,21 @@ def _translate_floating_ip_view(floating_ip):
4242
4343 return {
4444 'floating_ip' : {
45+ 'fixed_ip' : floating_ip ['fixed_ip_address' ],
4546 'id' : floating_ip ['id' ],
47+ 'instance_id' : instance_id ,
4648 'ip' : floating_ip ['floating_ip_address' ],
47- 'pool' : floating_ip ['network_details' ]['name' ] or (
49+ 'pool' : (
50+ floating_ip ['network_details' ]['name' ] or
4851 floating_ip ['network_details' ]['id' ]),
49- 'fixed_ip' : floating_ip ['fixed_ip_address' ],
50- 'instance_id' : instance_id ,
5152 }
5253 }
5354
5455
5556def get_instance_by_floating_ip_addr (self , context , address ):
5657 try :
57- instance_id = \
58- self .network_api .get_instance_id_by_floating_address (
59- context , address )
58+ instance_id = self .network_api .get_instance_id_by_floating_address (
59+ context , address )
6060 except exception .FloatingIpNotFoundForAddress as ex :
6161 raise webob .exc .HTTPNotFound (explanation = ex .format_message ())
6262 except exception .FloatingIpMultipleFoundForAddress as ex :
@@ -74,6 +74,7 @@ def disassociate_floating_ip(self, context, instance, address):
7474 raise webob .exc .HTTPForbidden ()
7575
7676
77+ @validation .validated
7778class FloatingIPController (wsgi .Controller ):
7879 """The Floating IPs API controller for the OpenStack API."""
7980
@@ -85,6 +86,7 @@ def __init__(self):
8586 @wsgi .api_version ("2.1" , MAX_PROXY_API_SUPPORT_VERSION )
8687 @wsgi .expected_errors ((400 , 404 ))
8788 @validation .query_schema (schema .show_query )
89+ @validation .response_body_schema (schema .show_response )
8890 def show (self , req , id ):
8991 """Return data about the given floating IP."""
9092 context = req .environ ['nova.context' ]
@@ -104,6 +106,7 @@ def show(self, req, id):
104106 @wsgi .api_version ("2.1" , MAX_PROXY_API_SUPPORT_VERSION )
105107 @wsgi .expected_errors (())
106108 @validation .query_schema (schema .index_query )
109+ @validation .response_body_schema (schema .index_response )
107110 def index (self , req ):
108111 """Return a list of floating IPs allocated to a project."""
109112 context = req .environ ['nova.context' ]
@@ -118,6 +121,7 @@ def index(self, req):
118121 @wsgi .api_version ("2.1" , MAX_PROXY_API_SUPPORT_VERSION )
119122 @wsgi .expected_errors ((400 , 403 , 404 ))
120123 @validation .schema (schema .create )
124+ @validation .response_body_schema (schema .create_response )
121125 def create (self , req , body = None ):
122126 context = req .environ ['nova.context' ]
123127 context .can (fi_policies .BASE_POLICY_NAME % 'create' ,
@@ -151,6 +155,7 @@ def create(self, req, body=None):
151155 @wsgi .api_version ("2.1" , MAX_PROXY_API_SUPPORT_VERSION )
152156 @wsgi .response (202 )
153157 @wsgi .expected_errors ((400 , 403 , 404 , 409 ))
158+ @validation .response_body_schema (schema .delete_response )
154159 def delete (self , req , id ):
155160 context = req .environ ['nova.context' ]
156161 context .can (fi_policies .BASE_POLICY_NAME % 'delete' ,
0 commit comments