Neutron API-site: Normal response codes of "Update network" should be 200

Bug #1471228 reported by Keiichiro Tokunaga
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openstack-api-site
Fix Released
Medium
Keiichiro Tokunaga

Bug Description

In "Networks provider extended attributes (networks)" section, Normal response codes of "Update network" is 201 now, but it actually should be 200.

http://developer.openstack.org/api-ref-networking-v2-ext.html#updateProviderNetwork

Changed in openstack-api-site:
assignee: nobody → Keiichiro Tokunaga (keiichiro)
Changed in openstack-api-site:
status: New → In Progress
Revision history for this message
Anne Gentle (annegentle) wrote :

Does the code reflect 200? How do I know the code is correct? Can you point to the code and to the API Working Group Guideline that backs up this change?

Revision history for this message
Keiichiro Tokunaga (keiichiro) wrote :

Thanks, Anne. Here's the information of how I confirmed the return code was 200.

$ source devstack/openrc admin admin
$ export TOKEN=`keystone token-get | grep ' id ' | get_field 2`
/usr/local/lib/python2.7/dist-packages/keystoneclient/shell.py:64: DeprecationWarning: The keystone CLI is deprecated in favor of python-openstackclient. For a Python library, continue using python-keystoneclient.
  'python-keystoneclient.', DeprecationWarning)
$ neutron net-list
+--------------------------------------+----------+----------------------------------------------------------+
| id | name | subnets |
+--------------------------------------+----------+----------------------------------------------------------+
| 0d4af632-5e88-4d9a-a155-3f1a64a49986 | private2 | a0a928f1-e057-4ecd-99d6-659fe2c950c5 fdc6:3c3c:39a7::/64 |
| | | a9d8ad08-71f9-4a7b-82f1-9005ff24e7c1 10.0.0.0/24 |
| ae75fb2a-c44f-4e85-a1b5-c2b79bd79dab | public | c2c2c941-c315-43b3-8318-73adff030aad 172.24.4.0/24 |
| | | e8cb68cf-f0ad-4d7e-a0b3-2c56d35f01ce 2001:db8::/64 |
+--------------------------------------+----------+----------------------------------------------------------+
$ curl -i -X PUT -H "x-auth-token: $TOKEN" -H "content-type:application/json" -d '{"network":{"name":"private3"}}' http://192.168.122.111:969
6/v2.0/networks/0d4af632-5e88-4d9a-a155-3f1a64a49986
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 452
X-Openstack-Request-Id: req-bbc23538-ccda-479b-8204-ac9d75983529
Date: Wed, 08 Jul 2015 23:58:12 GMT

{"network": {"status": "ACTIVE", "subnets": ["a0a928f1-e057-4ecd-99d6-659fe2c950c5", "a9d8ad08-71f9-4a7b-82f1-9005ff24e7c1"], "name": "private3", "provider:physical_network": null, "router:external": false, "tenant_id": "56b048ae10a94b3893c3ac0b1cfb40a3", "admin_state_up": true, "provider:network_type": "vxlan", "shared": false, "port_security_enabled": true, "mtu": 0, "id": "0d4af632-5e88-4d9a-a155-3f1a64a49986", "provider:segmentation_id": 1065}}

I followed this section of the guideline.

  http://specs.openstack.org/openstack/api-wg/guidelines/http.html#xx-success-codes

Revision history for this message
Anne Gentle (annegentle) wrote :

Hi thanks for following up.

I think the neutron code should be changed to 201 because it is a successful creation - what do you think?

Pasted from the API working group guidance:

Synchronous resource creation
Response status code must be 201 Created
Must return a Location header with the URI of the created resource
Should return a representation of the resource in the body

Revision history for this message
Keiichiro Tokunaga (keiichiro) wrote :

"Update network" is not quite "successful creation". It's a resource update, using PUT. So returning 200 seems correct to me.

Revision history for this message
Tom Fifield (fifieldt) wrote :

I tend to agree this is an update, rather than a creation, so this bug looks fine to me

Changed in openstack-api-site:
milestone: none → liberty
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to api-site (master)

Reviewed: https://review.openstack.org/199036
Committed: https://git.openstack.org/cgit/openstack/api-site/commit/?id=2f5375a1d19b5e97875cc5e6c8100d7cc742d0dc
Submitter: Jenkins
Branch: master

commit 2f5375a1d19b5e97875cc5e6c8100d7cc742d0dc
Author: Keiichiro Tokunaga <email address hidden>
Date: Tue Jul 7 19:05:59 2015 +0900

    Fix the normal response codes of "Update network".

    This changes the normal reponse code of "Update network"
    from 201 to 200.

    Change-Id: I04b0fc52c01f4901a6280a465fe46687ffb533d1
    Closes-Bug: #1471228

Changed in openstack-api-site:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.