Confirmed, I'm seeing this error too. Thanks for the well-written bug

** Changed in: neutron
       Status: New => Triaged

** Changed in: neutron
   Importance: Undecided => Medium

** Also affects: python-neutronclient
   Importance: Undecided
       Status: New

** Changed in: python-neutronclient
       Status: New => Triaged

** Changed in: python-neutronclient
   Importance: Undecided => Low

You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.

  port-update fails if allowed_address_pair is not a dict

Status in neutron:
Status in python-neutronclient:

Bug description:
  CLI help is misleading. Neutron port-update called with parameters
  according to documentation returns an error.

  neutron help port-update
    --allowed-address-pair ip_address=IP_ADDR[,mac_address=MAC_ADDR]
                          Allowed address pair associated with the port.You can
                          repeat this option.

  # neutron port-update 3f36328f-0629-4e41-afa8-e2992815bcd0 
--allowed-address-pairs ip_address=
  The number of allowed address pair exceeds the maximum 10.
  Neutron server returns request_ids: 

  Work correctly when specific data type is enforced:
  # neutron port-update 3f36328f-0629-4e41-afa8-e2992815bcd0 
--allowed-address-pairs type=dict list=true ip_address=
  Updated port: 3f36328f-0629-4e41-afa8-e2992815bcd0

  It always should be a list of dict, even when only one pair is given.

  CLI doc should be corrected.

  Furthermore, input data in neutron-server seem to be not validated correctly. 
The reason of misleading exception about exceeded number of address pairs is an 
implicit test of length of user data. In case of list of dict it is a number of 
elements of list - number of address pairs. When only one pair is given, it 
returns length of string "ip_address=" == 20 what is greater than 10. 
There is a try-except clause for TypeError exception, but it is not thrown in 
this case.
  This bug is observed if there is no other pairs already defined on given 
port. In other case lists are merged and type error is thrown.

  def _validate_allowed_address_pairs(address_pairs, valid_values=None):
          if len(address_pairs) > cfg.CONF.max_allowed_address_pair:
              raise AllowedAddressPairExhausted(
      except TypeError:
          raise webob.exc.HTTPBadRequest(
              _("Allowed address pairs must be a list."))

To manage notifications about this bug go to:

Mailing list:
Post to     :
Unsubscribe :
More help   :

Reply via email to