← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1284986] [NEW] Filter of port details with field parameter as junk value is not throwing error

 

Public bug reported:

Description:
neutron port-show <port-id> would give us the details about particular port. When we filter the details of port by mentioning --field parameter, we get details of only mentioned field.

When --field parameter value is given as junk, there is no error code
and proper error message returned. Instead we get 200 as response code
and improper error message

Also if the junk field is mentioned along with one or more valid fields,
it simply neglects the junk field as long as we give at least one valid
field.

Steps to reproduce:

1. Do neutron port-list and get list of ports to note ID of any one port
2. neutron port-show <id> --field JUNK

Actual Result:
Response code 200 and Error message: "need more than 0 values to unpack"

Expected Result:
Must return 400 as response code as the request is a bad request.
and Error message should be " The field parameter value entered is invalid"

LOG:

# A single invalid field

REQ: curl -i http://127.0.0.1:9696/v2.0/ports/023f2108-3524-47b3-aa5a-
ebe10d37deb9.json?fields=dedjfsdgfj -X GET -H "X-Auth-Token: <Token
–Omitted>" -H "Content-Type: application/json" -H "Accept:
application/json" -H "User-Agent: python-neutronclient"

RESP:{'date': 'Wed, 26 Feb 2014 05:22:08 GMT', 'status': '200',
'content-length': '12', 'content-type': 'application/json;
charset=UTF-8', 'content-location':
'http://127.0.0.1:9696/v2.0/ports/023f2108-3524-47b3-aa5a-
ebe10d37deb9.json?fields=dedjfsdgfj'} {"port": {}}

need more than 0 values to unpack
venkater@ravi-tempest-devstack2:~$
---------------------------------------------------------------------


# Interestingly it simply neglects a junk filed as long as you give at
least one valid field! This holds even with more valid fields.

curl -i http://127.0.0.1:9696/v2.0/ports/023f2108-3524-47b3-aa5a-
ebe10d37deb9.json?fields=id&fields=dedjfsdgfj -X GET -H "X-Auth-Token:
<Token –Omitted>" -H "Content-Type: application/json" -H "Accept:
application/json" -H "User-Agent: python-neutronclient"

RESP:{'date': 'Wed, 26 Feb 2014 05:29:16 GMT', 'status': '200',
'content-length': '56', 'content-type': 'application/json;
charset=UTF-8', 'content-location':
'http://127.0.0.1:9696/v2.0/ports/023f2108-3524-47b3-aa5a-
ebe10d37deb9.json?fields=id&fields=dedjfsdgfj'} {"port": {"id":
"023f2108-3524-47b3-aa5a-ebe10d37deb9"}}

# Giving id , junk and another valid field
curl -i http://127.0.0.1:9696/v2.0/ports/023f2108-3524-47b3-aa5a-ebe10d37deb9.json?fields=id&fields=nnnjsj&fields=name -X GET -H "X-Auth-Token: <Token –Omitted>" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient"

RESP:{'date': 'Wed, 26 Feb 2014 05:35:01 GMT', 'status': '200',
'content-length': '108', 'content-type': 'application/json;
charset=UTF-8', 'content-location':
'http://127.0.0.1:9696/v2.0/ports/023f2108-3524-47b3-aa5a-
ebe10d37deb9.json?fields=id&fields=nnnjsj&fields=name'} {"port": {"id":
"023f2108-3524-47b3-aa5a-ebe10d37deb9", "name": "vip-
20da0078-e8e0-4ef8-9d65-a03e54850d45"}}

** Affects: neutron
     Importance: Undecided
         Status: New

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

Title:
  Filter of port details with field parameter as junk value is not
  throwing error

Status in OpenStack Neutron (virtual network service):
  New

Bug description:
  Description:
  neutron port-show <port-id> would give us the details about particular port. When we filter the details of port by mentioning --field parameter, we get details of only mentioned field.

  When --field parameter value is given as junk, there is no error code
  and proper error message returned. Instead we get 200 as response code
  and improper error message

  Also if the junk field is mentioned along with one or more valid
  fields, it simply neglects the junk field as long as we give at least
  one valid field.

  Steps to reproduce:

  1. Do neutron port-list and get list of ports to note ID of any one port
  2. neutron port-show <id> --field JUNK

  Actual Result:
  Response code 200 and Error message: "need more than 0 values to unpack"

  Expected Result:
  Must return 400 as response code as the request is a bad request.
  and Error message should be " The field parameter value entered is invalid"

  LOG:

  # A single invalid field

  REQ: curl -i http://127.0.0.1:9696/v2.0/ports/023f2108-3524-47b3-aa5a-
  ebe10d37deb9.json?fields=dedjfsdgfj -X GET -H "X-Auth-Token: <Token
  –Omitted>" -H "Content-Type: application/json" -H "Accept:
  application/json" -H "User-Agent: python-neutronclient"

  RESP:{'date': 'Wed, 26 Feb 2014 05:22:08 GMT', 'status': '200',
  'content-length': '12', 'content-type': 'application/json;
  charset=UTF-8', 'content-location':
  'http://127.0.0.1:9696/v2.0/ports/023f2108-3524-47b3-aa5a-
  ebe10d37deb9.json?fields=dedjfsdgfj'} {"port": {}}

  need more than 0 values to unpack
  venkater@ravi-tempest-devstack2:~$
  ---------------------------------------------------------------------


  # Interestingly it simply neglects a junk filed as long as you give at
  least one valid field! This holds even with more valid fields.

  curl -i http://127.0.0.1:9696/v2.0/ports/023f2108-3524-47b3-aa5a-
  ebe10d37deb9.json?fields=id&fields=dedjfsdgfj -X GET -H "X-Auth-Token:
  <Token –Omitted>" -H "Content-Type: application/json" -H "Accept:
  application/json" -H "User-Agent: python-neutronclient"

  RESP:{'date': 'Wed, 26 Feb 2014 05:29:16 GMT', 'status': '200',
  'content-length': '56', 'content-type': 'application/json;
  charset=UTF-8', 'content-location':
  'http://127.0.0.1:9696/v2.0/ports/023f2108-3524-47b3-aa5a-
  ebe10d37deb9.json?fields=id&fields=dedjfsdgfj'} {"port": {"id":
  "023f2108-3524-47b3-aa5a-ebe10d37deb9"}}

  # Giving id , junk and another valid field
  curl -i http://127.0.0.1:9696/v2.0/ports/023f2108-3524-47b3-aa5a-ebe10d37deb9.json?fields=id&fields=nnnjsj&fields=name -X GET -H "X-Auth-Token: <Token –Omitted>" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient"

  RESP:{'date': 'Wed, 26 Feb 2014 05:35:01 GMT', 'status': '200',
  'content-length': '108', 'content-type': 'application/json;
  charset=UTF-8', 'content-location':
  'http://127.0.0.1:9696/v2.0/ports/023f2108-3524-47b3-aa5a-
  ebe10d37deb9.json?fields=id&fields=nnnjsj&fields=name'} {"port":
  {"id": "023f2108-3524-47b3-aa5a-ebe10d37deb9", "name": "vip-
  20da0078-e8e0-4ef8-9d65-a03e54850d45"}}

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


Follow ups

References