← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1796629] Re: Incorrectly passing ext_ips as gw_ips after creating router gateway

 

Reviewed:  https://review.openstack.org/608608
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=221f386029faf499c5a445374685cba5b67df31e
Submitter: Zuul
Branch:    master

commit 221f386029faf499c5a445374685cba5b67df31e
Author: mid_one <chenjie.xu@xxxxxxxxx>
Date:   Tue Oct 9 01:19:51 2018 +0800

    Fix incorrectly passing ext_ips as gateway ips
    
    An event will be sent out after creating
    router gateway. Within the event, ext_ips
    is sent incorrectly while gw_ips is expected.
    Project neutron-dynamic-routing subscribes
    the topic and will process the event. But
    it can't process ext_ips.
    
    This commit gets the gw_ips through the
    ext_ips and sends gw_ips out.
    
    Co-Authored-By: Allain Legacy<Allain.legacy@xxxxxxxxxxxxx>
    
    Change-Id: I9b67b58e87faa9cbb8ed4cd03c74f467ca20d73f
    Closes-Bug: #1796629


** Changed in: neutron
       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/1796629

Title:
  Incorrectly passing ext_ips  as gw_ips  after creating router gateway

Status in neutron:
  Fix Released

Bug description:
  In neutron/db/l3_db.py, function _create_gw_port will send an event
  after creating router gateway as following:

  registry.notify(resources.ROUTER_GATEWAY,
                  events.AFTER_CREATE,
                  self._create_gw_port,
                  context=context,
                  gw_ips=ext_ips,
                  network_id=new_network_id,
                  router_id=router_id)

  However the ext_ips is sent out while gw_ips is expected.

  ext_ips: external_fixed_ips
  gw_ips: gateway_ips
  (Ps: gw_ips = [x['ip_address'] for x in router.gw_port.fixed_ips])
  Example:
  ext_ips = [{"subnet_id": "966eff11-909d-4b6c-8d5f-4505e8a8c15f",
              "ip_address": "192.168.1.200"},
             {"subnet_id": "f2dee576-7535-40ee-a5ba-d5dae8e1f600",
              "ip_address": "2001:db8::d"}]
  gw_ips = ['192.168.1.200', '2001:db8::d']

  
  bgp_plugin(neutron_dynamic_routing\services\bgp\bgp_plugin.py) in the project neutron-dynamic-routing will subscribe the topic and process the event. Function _register_callbacks in bgp_plugin will subscribe the topic after creating router gateway as following:

  registry.subscribe(self.router_gateway_callback,
                             resources.ROUTER_GATEWAY,
                             events.AFTER_CREATE)

  Function _next_hops_from_gateway_ips in bgp_plugin will process the
  gw_ips finally as following:

  if gw_ips:
      return {IPAddress(ip).version: ip for ip in gw_ips}
  return {}

  If the ext_ips are sent as gw_ips, then function _next_hops_from_gateway_ips can’t process it. “TypeError: unhashable type: 'dict'” will occur.
  Remember that ext_ips and gw_ips looks like following:
  ext_ips = [{"subnet_id": "966eff11-909d-4b6c-8d5f-4505e8a8c15f",
              "ip_address": "192.168.1.200"},
             {"subnet_id": "f2dee576-7535-40ee-a5ba-d5dae8e1f600",
              "ip_address": "2001:db8::d"}]
  gw_ips = ['192.168.1.200', '2001:db8::d']

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


References