← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1652729] [NEW] OFPort's _get_allowed_pairs method fails when there is CIDR in allowed_address_pairs

 

Public bug reported:

The following code throws an exception when CIDR is provided in
allowed_address_pairs.

https://github.com/openstack/neutron/blob/49d614895f44c44f9e1735210498facf1886c404/neutron/agent/linux/openvswitch_firewall/firewall.py#L102

StackTrace:
----------
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent [req-f0e9bdd1-5f4a-4f35-87de-3eecded79154 - - - - -] Error while processing VIF ports
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent Traceback (most recent call last):
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py", line 2047, in rpc_loop
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     port_info, ovs_restarted)
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/osprofiler/profiler.py", line 154, in wrapper
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     return f(*args, **kwargs)
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py", line 1655, in process_network_ports
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     port_info.get('updated', set()))
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/securitygroups_rpc.py", line 265, in setup_port_filters
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     self.prepare_devices_filter(new_devices)
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/securitygroups_rpc.py", line 130, in decorated_function
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     *args, **kwargs)
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/securitygroups_rpc.py", line 138, in prepare_devices_filter
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     self._apply_port_filter(device_ids)
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/securitygroups_rpc.py", line 163, in _apply_port_filter
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     self.firewall.prepare_port_filter(device)
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/linux/openvswitch_firewall/firewall.py", line 273, in prepare_port_filter
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     of_port = self.get_or_create_ofport(port)
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/linux/openvswitch_firewall/firewall.py", line 262, in get_or_create_ofport
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     self.sg_port_map.update_port(of_port, port)
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/linux/openvswitch_firewall/firewall.py", line 151, in update_port
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     port.update(port_dict)
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/linux/openvswitch_firewall/firewall.py", line 116, in update
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     version=4)
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/linux/openvswitch_firewall/firewall.py", line 101, in _get_allowed_pairs
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     return {(aap['mac_address'], aap['ip_address']) for aap in aap_dict
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/linux/openvswitch_firewall/firewall.py", line 102, in <setcomp>
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     if netaddr.IPNetwork(aap['ip_address']).version == version}
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/netaddr/ip/__init__.py", line 280, in __init__
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     % self.__class__.__name__)
2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent ValueError: IPAddress() does not support netmasks or subnet prefixes! See documentation for details.


Similiar bug fixed at a different place.
https://bugs.launchpad.net/neutron/+bug/1382562

** Affects: neutron
     Importance: Undecided
     Assignee: Ravi Kumar Kota (ravkota3)
         Status: In Progress

** Changed in: neutron
     Assignee: (unassigned) => Ravi Kumar Kota (ravkota3)

** Changed in: neutron
       Status: New => In Progress

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

Title:
  OFPort's _get_allowed_pairs method fails when there is CIDR in
  allowed_address_pairs

Status in neutron:
  In Progress

Bug description:
  The following code throws an exception when CIDR is provided in
  allowed_address_pairs.

  https://github.com/openstack/neutron/blob/49d614895f44c44f9e1735210498facf1886c404/neutron/agent/linux/openvswitch_firewall/firewall.py#L102

  StackTrace:
  ----------
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent [req-f0e9bdd1-5f4a-4f35-87de-3eecded79154 - - - - -] Error while processing VIF ports
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent Traceback (most recent call last):
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py", line 2047, in rpc_loop
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     port_info, ovs_restarted)
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/osprofiler/profiler.py", line 154, in wrapper
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     return f(*args, **kwargs)
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py", line 1655, in process_network_ports
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     port_info.get('updated', set()))
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/securitygroups_rpc.py", line 265, in setup_port_filters
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     self.prepare_devices_filter(new_devices)
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/securitygroups_rpc.py", line 130, in decorated_function
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     *args, **kwargs)
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/securitygroups_rpc.py", line 138, in prepare_devices_filter
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     self._apply_port_filter(device_ids)
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/securitygroups_rpc.py", line 163, in _apply_port_filter
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     self.firewall.prepare_port_filter(device)
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/linux/openvswitch_firewall/firewall.py", line 273, in prepare_port_filter
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     of_port = self.get_or_create_ofport(port)
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/linux/openvswitch_firewall/firewall.py", line 262, in get_or_create_ofport
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     self.sg_port_map.update_port(of_port, port)
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/linux/openvswitch_firewall/firewall.py", line 151, in update_port
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     port.update(port_dict)
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/linux/openvswitch_firewall/firewall.py", line 116, in update
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     version=4)
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/linux/openvswitch_firewall/firewall.py", line 101, in _get_allowed_pairs
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     return {(aap['mac_address'], aap['ip_address']) for aap in aap_dict
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/neutron/agent/linux/openvswitch_firewall/firewall.py", line 102, in <setcomp>
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     if netaddr.IPNetwork(aap['ip_address']).version == version}
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent   File "/usr/lib/python2.7/dist-packages/netaddr/ip/__init__.py", line 280, in __init__
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent     % self.__class__.__name__)
  2016-12-27 01:32:51.434 2737 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent ValueError: IPAddress() does not support netmasks or subnet prefixes! See documentation for details.


  
  Similiar bug fixed at a different place.
  https://bugs.launchpad.net/neutron/+bug/1382562

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


Follow ups