← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1924237] Re: TypeError when formating IP address for BGP plugin

 

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

commit 43f50d5d9b5c8859354014d1c21ed94ad19560d6
Author: Aggelos Kolaitis <akolaitis@xxxxxxxxxxxxxx>
Date:   Thu Apr 15 00:02:34 2021 +0300

    Fix TypeError when formatting BGP IP address.
    
    floating_ip_address may be a netaddr.IPAddress, and using '+'
    to append the /32 suffix raises a TypeError. Explicitly convert to
    string before appending the suffix.
    
    Additionally, introduce a unit test case for floatingip_update_callback
    to test that the error does not re-appear.
    
    Closes-Bug: #1924237
    Signed-off-by: Aggelos Kolaitis <akolaitis@xxxxxxxxxxxxxx>
    Change-Id: I98d266fb986649f1d14969c968baa2f93b469f73


** 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/1924237

Title:
  TypeError when formating IP address for BGP plugin

Status in neutron:
  Fix Released

Bug description:
  ## Description

  We run OpenStack Ussuri and see the following errors repeatedly on
  `neutron-server.log`:

  ```
  2021-04-14 16:39:02.230 30704 ERROR neutron_lib.callbacks.manager [req-33c1014f-75c4-4306-96a8-927bb62f7f60 1718caa43bf24e7990cc09d5daa1fb85 46e94ce6568449209de022fa3bbbbae4 - 3dbb1c3c0fc54cc0b793ac49f841f103 3dbb1c3c0fc54cc0b793ac49f841f103] Error during notification for neutron_dynamic_routing.services.bgp.bgp_plugin.BgpPlugin.floatingip_update_callback--9223372036854663447 floatingip, after_update: TypeError: unsupported operand type(s) for +: 'int' and 'str'
  2021-04-14 16:39:02.230 30704 ERROR neutron_lib.callbacks.manager Traceback (most recent call last):
  2021-04-14 16:39:02.230 30704 ERROR neutron_lib.callbacks.manager   File "/usr/lib/python3/dist-packages/neutron_lib/callbacks/manager.py", line 197, in _notify_loop
  2021-04-14 16:39:02.230 30704 ERROR neutron_lib.callbacks.manager     callback(resource, event, trigger, **kwargs)
  2021-04-14 16:39:02.230 30704 ERROR neutron_lib.callbacks.manager   File "/usr/lib/python3/dist-packages/neutron_dynamic_routing/services/bgp/bgp_plugin.py", line 235, in floatingip_update_callback
  2021-04-14 16:39:02.230 30704 ERROR neutron_lib.callbacks.manager     dest = floating_ip_address + '/32'
  2021-04-14 16:39:02.230 30704 ERROR neutron_lib.callbacks.manager   File "/usr/lib/python3/dist-packages/netaddr/ip/__init__.py", line 426, in __add__
  2021-04-14 16:39:02.230 30704 ERROR neutron_lib.callbacks.manager     new_value = int(self._value + num)
  2021-04-14 16:39:02.230 30704 ERROR neutron_lib.callbacks.manager TypeError: unsupported operand type(s) for +: 'int' and 'str'
  ```

  The error is caused by https://opendev.org/openstack/neutron-dynamic-
  routing/src/branch/master/neutron_dynamic_routing/services/bgp/bgp_plugin.py#L235.

  While debugging the issue, `floating_ip_address` was found to be a
  netaddr.IPAddress object, so using + '/32' to add a suffix raises a
  TypeError.

  ## Environment

  OpenStack Ussuri

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


References