← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1631432] Re: port-update fails if allowed_address_pair is not a dict

 

On the CLI side, no option named "--allowed-address-pairs" is defined
and it is parsed according to the extra argument mechanism [1], so
'type=dict list=true' is required.

Users is suggested to use '--allow-address-pair' (singular form) option
(which is defined as option) rather than '--allowed-address-pairs'
(plural form).

This is the tricky part of neutron CLI, but it is the expected behavior.
There is nothing to be fixed in the CLI side.

[1] https://docs.openstack.org/developer/python-
neutronclient/usage/cli.html#extra-arguments-for-create-update-operation

** Changed in: python-neutronclient
       Status: Incomplete => Invalid

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

Title:
  port-update fails if allowed_address_pair is not a dict

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

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=10.0.0.1
  The number of allowed address pair exceeds the maximum 10.
  Neutron server returns request_ids: ['req-62e258cc-d47d-4ab7-8e69-a13c50865042']

  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=10.0.0.1
  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=10.0.0.1" == 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):
      ..
      try:
          if len(address_pairs) > cfg.CONF.max_allowed_address_pair:
              raise AllowedAddressPairExhausted(
                  quota=cfg.CONF.max_allowed_address_pair)
      except TypeError:
          raise webob.exc.HTTPBadRequest(
              _("Allowed address pairs must be a list."))

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


References