← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1520601] Re: FWaaS - GET /v2.0/fw/firewalls with colomn selection returns 500

 

Reviewed:  https://review.openstack.org/251140
Committed: https://git.openstack.org/cgit/openstack/neutron-fwaas/commit/?id=f9e8daa9f758c634e946565a4820153520b2034f
Submitter: Jenkins
Branch:    master

commit f9e8daa9f758c634e946565a4820153520b2034f
Author: Yushiro FURUKAWA <y.furukawa_2@xxxxxxxxxxxxxx>
Date:   Mon Nov 30 00:09:02 2015 +0900

    Validation of router_ids insertion with column selection
    
    Currently, FWaaS Column Selection/Filtering does not work correctly
    without 'id'.  This commit adds the validation of the params for
    column selection.
    
      GET v2.0/fw/firewalls with fields 'router_ids'
        -> Add 'id' into fields and remove it after router_ids insertion.
    
      GET v2.0/fw/firewalls with fields without 'router_ids'
        -> Skip router_ids insertion.
    
    Change-Id: I5bcd148de524af802f01e4e5444a6e605318954f
    Closes-Bug: #1520601


** Changed in: neutron
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1520601

Title:
  FWaaS - GET /v2.0/fw/firewalls with colomn selection returns 500

Status in neutron:
  Fix Released

Bug description:
  Current FWaaS, colomn selection doesn't work correctly without "id".
  Actually, following result should be expected:

    v2.0/fw/firewalls?fields=name
      => {"firewalls": [{"name": "fw1"}, {"name": "fw2"}]}

  However, it occurs 500(Internal Server Error) as follows:

  [Condition]
    REST-API request (CLI can use colomn selection)

  [How to confirm]
  $ source devstack/openrc admin admin
  $ export TOKEN=`openstack token issue|grep ' id '|get_field 2`
  $ curl -s -X GET -H "x-auth-token:$TOKEN" localhost:9696/v2.0/fw/firewalls|jq "."
  {
    "firewalls": [
      {
        "description": "",
        "id": "2f291bd0-e4cc-474d-92b8-3ea3aaa0b935",
        "firewall_policy_id": "a5ccb8ae-760f-47c6-ac9a-4a2078b2bc63",
        "tenant_id": "cb3d9e782f4c4537989a904a8cbefc69",
        "admin_state_up": true,
        "name": "fw1",
        "router_ids": [
          "ae06e6f6-39e1-446b-b06f-f3ed6c6ad605"
        ],
        "status": "ACTIVE"
      },
      {
        "description": "",
        "id": "6a102aee-4a48-4cc8-8f90-2a4cb97ad92a",
        "firewall_policy_id": "fde08235-c377-48ea-951e-11e42abe2c72",
        "tenant_id": "cb3d9e782f4c4537989a904a8cbefc69",
        "admin_state_up": true,
        "name": "fw2",
        "router_ids": [
          "dd37ca9b-4bde-4d4c-a097-570da542293f"
        ],
        "status": "ACTIVE"
      }
    ]
  }

  $ curl -i -X GET -H "x-auth-token:$TOKEN" localhost:9696/v2.0/fw/firewalls?fields=name
  HTTP/1.1 500 Internal Server Error
  Content-Type: application/json; charset=UTF-8
  Content-Length: 150
  X-Openstack-Request-Id: req-03ae14dd-32e5-4ee7-87e2-efd7df272e09
  Date: Fri, 27 Nov 2015 14:09:49 GMT

  {"NeutronError": {"message": "Request Failed: internal server error
  while processing your request.", "type": "HTTPInternalServerError",
  "detail": ""}}

  [Environment]
    devstack

  [Version]
    trunk

  [q-svc.log]
  DEBUG neutron_fwaas.db.firewall.firewall_db [req-acc3d252-d0ea-458e-ad74-8209eeeeb8a0 admin cb3d9e782f4c4537989a904a8cbefc69] get_firewalls() ca
  firewalls /opt/stack/neutron-fwaas/neutron_fwaas/db/firewall/firewall_db.py:381
  ERROR neutron.api.v2.resource [req-acc3d252-d0ea-458e-ad74-8209eeeeb8a0 admin cb3d9e782f4c4537989a904a8cbefc69] index failed
  TRACE neutron.api.v2.resource Traceback (most recent call last):
  TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/resource.py", line 83, in resource
  TRACE neutron.api.v2.resource     result = method(request=request, **args)
  TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/base.py", line 340, in index
  TRACE neutron.api.v2.resource     return self._items(request, True, parent_id)
  TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/base.py", line 267, in _items
  TRACE neutron.api.v2.resource     obj_list = obj_getter(request.context, **kwargs)
  TRACE neutron.api.v2.resource   File "/opt/stack/neutron-fwaas/neutron_fwaas/services/firewall/fwaas_plugin.py", line 382, in get_firewalls
  TRACE neutron.api.v2.resource     fw_current_rtrs = self.get_firewall_routers(context, fw['id'])
  TRACE neutron.api.v2.resource KeyError: 'id'

  The cause is that referring 'id' after filtering.

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1520601/+subscriptions


References