dynamic-routing: address_scope calculation error

Bug #1998104 reported by Roberto Acosta
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Unassigned

Bug Description

Neutron dynamic routing needs to be fixed in the iteration to obtain address_scope linked to a provider network with multiple subnets. A network can be linked to more than one subnet (e.g. ipv4 and ipv6), but if one of them does not have an address_scope, a null object element access failure occurs.

Fix proposed in the neutron-dynamic-routing project [1].

[1] - https://review.opendev.org/c/openstack/neutron-dynamic-routing/+/863708

Steps to reproduce:

#1 - IPv6 address scope
openstack address scope create --share --ip-version 6 bgp

#2 - self-service subnet pool
openstack subnet pool create --address-scope address-scope-ipv6 --share --default --pool-prefix 2001:db9:1234::/48 --default-prefix-length 64 --max-prefix-length 64 default-pool-ipv6

#3 - provider subnet pool
openstack subnet pool create --address-scope address-scope-ipv6 --pool-prefix 2001:db9:4321:42::/64 --default-prefix-length 64 public-pool-ipv6

#4 - Provider network
openstack network create provider --external --provider-physical-network \
  provider --provider-network-type flat
#5 - provider subnet
openstack subnet create --ip-version 6 --subnet-pool public-pool-ipv6 --network provider --ipv6-address-mode dhcpv6-stateful --ipv6-ra-mode dhcpv6-stateful provider1-v6
openstack subnet create --ip-version 4 --network provider --dhcp --host-route destination=200.201.0.0/24,gateway=200.201.0.1 --subnet-range 200.201.0.0/24 provider1-v4

#6 - self-service network
openstack network create self-service

#7 - self-service subnet
openstack subnet create --ip-version 6 --subnet-pool default-pool-ipv6 --network self-service --ipv6-address-mode dhcpv6-stateful --ipv6-ra-mode dhcpv6-stateful self-service-v6
openstack subnet create --ip-version 4 --network self-service --dhcp --host-route destination=192.168.0.0/24,gateway=192.168.0.1 --subnet-range 192.168.0.0/24 self-service-v4

#8 - create router
openstack router create router1

#9 - add self-service subnet as an interface on the router
openstack router add subnet router1 self-service-v4
openstack router add subnet router1 self-service-v6

#10 - Add the provider network as a gateway on each router.
openstack router set --external-gateway provider router1

#11 - create bgp speaker
openstack bgp speaker create --ip-version 6 --local-as 65000 bgpspeaker
openstack bgp speaker add network bgpspeaker provider

#12 - create a vm on the self-service network
openstack server create --image cirros --flavor 1vcpu --network=self-service --security-group cf2e7d53-0db7-4873-82ab-cf67eceda937 vm1

# We can see the messages below in the neutron log:

Nov 07 14:20:00 os-infra-1-neutron-server-container-819795c0 neutron-server[3698]: 2022-11-07 14:20:00.472 3698 ERROR neutron_lib.callbacks.manager [req-24fe543c-7122-4869-b52d-21ecb782ea0e 8c140d00a7754295beae4ac85c5beecc 115a2ce896ad4958a26e3a4d624902a5 - default default] Error during notification for neutron_dynamic_routing.services.bgp.bgp_plugin.BgpPlugin.port_callback-950729 port, after_update: AttributeError: 'NoneType' object has no attribute 'address_scope_id'
                                                                                   2022-11-07 14:20:00.472 3698 ERROR neutron_lib.callbacks.manager Traceback (most recent call last):
                                                                                   2022-11-07 14:20:00.472 3698 ERROR neutron_lib.callbacks.manager File "/usr/lib/python3/dist-packages/neutron_lib/callbacks/manager.py", line 181, in _notify_loop
                                                                                   2022-11-07 14:20:00.472 3698 ERROR neutron_lib.callbacks.manager callback(resource, event, trigger, payload=payload)
                                                                                   2022-11-07 14:20:00.472 3698 ERROR neutron_lib.callbacks.manager File "/usr/lib/python3/dist-packages/neutron_dynamic_routing/services/bgp/bgp_plugin.py", line 375, in port_callback
                                                                                   2022-11-07 14:20:00.472 3698 ERROR neutron_lib.callbacks.manager ext_nets = self.get_external_networks_for_port(ctx,
                                                                                   2022-11-07 14:20:00.472 3698 ERROR neutron_lib.callbacks.manager File "/usr/lib/python3/dist-packages/neutron_dynamic_routing/db/bgp_db.py", line 1190, in get_external_networks_for_port
                                                                                   2022-11-07 14:20:00.472 3698 ERROR neutron_lib.callbacks.manager ext_scope_set.add(ext_pool.address_scope_id)
                                                                                   2022-11-07 14:20:00.472 3698 ERROR neutron_lib.callbacks.manager AttributeError: 'NoneType' object has no attribute 'address_scope_id'
                                                                                   2022-11-07 14:20:00.472 3698 ERROR neutron_lib.callbacks.manager

Changed in neutron:
status: New → In Progress
Changed in neutron:
importance: Undecided → High
tags: added: l3-bgp
Revision history for this message
Brian Haley (brian-haley) wrote :

Since the closes-bug in the commit message was added late, adding a link to the patch.

https://review.opendev.org/c/openstack/neutron-dynamic-routing/+/863708

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron-dynamic-routing (master)

Reviewed: https://review.opendev.org/c/openstack/neutron-dynamic-routing/+/863708
Committed: https://opendev.org/openstack/neutron-dynamic-routing/commit/feff164b608d00bf8163ea259305c3a64e68c1da
Submitter: "Zuul (22348)"
Branch: master

commit feff164b608d00bf8163ea259305c3a64e68c1da
Author: ROBERTO BARTZEN ACOSTA <email address hidden>
Date: Fri Nov 4 17:01:08 2022 -0300

    Fix address_scope calculation

    Fix in the iteration to obtain address_scope linked to a subnet.
    A network can be linked to more than one subnet (ipv4 and ipv6),
    but if one of them does not have an address_scope, a null object
    element access failure occurs.

    Closes-bug: #1998104
    Change-Id: Ic6d48a86043aaf4b458bb2230883a355fc841ee9

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron-dynamic-routing 22.0.0.0rc1

This issue was fixed in the openstack/neutron-dynamic-routing 22.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron-dynamic-routing (stable/zed)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron-dynamic-routing (stable/zed)

Reviewed: https://review.opendev.org/c/openstack/neutron-dynamic-routing/+/883583
Committed: https://opendev.org/openstack/neutron-dynamic-routing/commit/962bb66743caf8b9052776a32ab71c83403dcd54
Submitter: "Zuul (22348)"
Branch: stable/zed

commit 962bb66743caf8b9052776a32ab71c83403dcd54
Author: ROBERTO BARTZEN ACOSTA <email address hidden>
Date: Fri Nov 4 17:01:08 2022 -0300

    Fix address_scope calculation

    Fix in the iteration to obtain address_scope linked to a subnet.
    A network can be linked to more than one subnet (ipv4 and ipv6),
    but if one of them does not have an address_scope, a null object
    element access failure occurs.

    Closes-bug: #1998104
    Change-Id: Ic6d48a86043aaf4b458bb2230883a355fc841ee9
    (cherry picked from commit feff164b608d00bf8163ea259305c3a64e68c1da)

tags: added: in-stable-zed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron-dynamic-routing 21.0.1

This issue was fixed in the openstack/neutron-dynamic-routing 21.0.1 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.