← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1102897] Re: quantum port-create --fixed-ip ignores additional invalid items

 

Reviewed:  https://review.openstack.org/253878
Committed: https://git.openstack.org/cgit/openstack/python-neutronclient/commit/?id=ed17ae60bd5fbcfffb94e91f270191f0b4d92970
Submitter: Jenkins
Branch:    master

commit ed17ae60bd5fbcfffb94e91f270191f0b4d92970
Author: Akihiro Motoki <motoki@xxxxxxxxxxxxx>
Date:   Sun Dec 6 16:55:24 2015 +0900

    Improve str2dict key validation to avoid wrong keys
    
    This commit adds valid_keys and required_keys to str2dict
    and define a new function which can be used as argparse type
    validator.
    
    By this function, we can declare what fields are valid and what
    fields are required for dictionary option in option definition.
    
    Change-Id: Ib7b233e082c15d0bd6e16a754b8acad52e413986
    Closes-Bug: #1102897


** Changed in: python-neutronclient
       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/1102897

Title:
  quantum port-create --fixed-ip ignores additional invalid items

Status in neutron:
  Invalid
Status in python-neutronclient:
  Fix Released

Bug description:
  
  When doing a port-create - and possibly other requests - you can add any old rubbish to the request, and provided the minimum required info is present, there is no error :

  ubuntu@az3devstackvm2:~/devstack$ quantum port-create --fixed-ip  subnet_id=1972dfa7-5537-465b-b41d-d3fdcd1de7ce,RUBBISH=SOMETHING 20147087-5520-4bb0-81a1-43ccbf2d101a
  Created a new port:
  +----------------+---------------------------------------------------------------------------------+
  | Field          | Value                                                                           |
  +----------------+---------------------------------------------------------------------------------+
  | admin_state_up | True                                                                            |
  | device_id      |                                                                                 |
  | device_owner   |                                                                                 |
  | fixed_ips      | {"subnet_id": "1972dfa7-5537-465b-b41d-d3fdcd1de7ce", "ip_address": "10.0.0.6"} |
  | id             | 78b68e9f-b414-40c8-af9e-0c537e5e45c8                                            |
  | mac_address    | fa:16:3e:a0:b6:82                                                               |
  | name           |                                                                                 |
  | network_id     | 20147087-5520-4bb0-81a1-43ccbf2d101a                                            |
  | status         | ACTIVE                                                                          |
  | tenant_id      | 5e0d8b02dd0a448da10749dd5d33b88c                                                |
  +----------------+---------------------------------------------------------------------------------+
  ubuntu@az3devstackvm2:~/devstack$ 

  
  I have validated that the RUBBISH:SOMETHING is passed to the server, and is silently ignored.

  This means that e.g. typos in commands can generate something other
  than the user was expecting :

  ubuntu@az3devstackvm2:~/devstack$ q port-create --fixed-ip subnet_id=1972dfa7-5537-465b-b41d-d3fdcd1de7ce,ip-address=10.0.0.6 20147087-5520-4bb0-81a1-43ccbf2d101a
  Created a new port:
  +----------------+---------------------------------------------------------------------------------+
  | Field          | Value                                                                           |
  +----------------+---------------------------------------------------------------------------------+
  | admin_state_up | True                                                                            |
  | device_id      |                                                                                 |
  | device_owner   |                                                                                 |
  | fixed_ips      | {"subnet_id": "1972dfa7-5537-465b-b41d-d3fdcd1de7ce", "ip_address": "10.0.0.5"} |
  | id             | 008336f8-6fbd-4821-ab67-f9c8f70d0ab2                                            |
  | mac_address    | fa:16:3e:c6:ca:05                                                               |
  | name           |                                                                                 |
  | network_id     | 20147087-5520-4bb0-81a1-43ccbf2d101a                                            |
  | status         | ACTIVE                                                                          |
  | tenant_id      | 5e0d8b02dd0a448da10749dd5d33b88c                                                |
  +----------------+---------------------------------------------------------------------------------+

  
  I thought I was asking for 10.0.0.6, but I got 10.0.0.5

  Would a 400 error not be more appropriate here ?

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