← Back to team overview

yahoo-eng-team team mailing list archive

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

 

Public bug reported:

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']

** Affects: neutron
     Importance: Undecided
     Assignee: ChenjieXu (midone)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => ChenjieXu (midone)

-- 
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:
  New

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


Follow ups