SQL integer type is to small to store BGP LOCAL_PREF value

Bug #1733905 reported by Édouard Thuleau
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
networking-bgpvpn
Fix Released
Undecided
Édouard Thuleau

Bug Description

SQL interger type max size is 2^31-1 and BGP LOCAL_PREF max value is 2^32-1 (RFC 4271, section 4.3 p.18)

DEBUG neutron.api.v2.base [None req-4aa8e09d-235a-4c7a-b956-02dcca7eea7f demo demo] Request body: {u'port_association': {u'routes': [{u'local_pref': 1234, u'prefix': u'5.6.7.8/24', u'type': u'prefix'}, {u'
local_pref': 2147483647, u'prefix': u'5.6.7.6/24', u'type': u'prefix'}, {u'prefix': u'1.2.3.4/32', u'type': u'prefix'}, {u'local_pref': 2147483648, u'bgpvpn_id': u'39d7d7d2-ffa2-4fd4-8556-f8e7a759abdf', u'
type': u'bgpvpn'}, {u'bgpvpn_id': u'b5d3e8ff-f381-40a6-a4d1-56622effba1e', u'type': u'bgpvpn'}]}} {{(pid=8447) prepare_request_body /opt/stack/openstack/neutron/neutron/api/v2/base.py:685}}
DEBUG neutron_lib.api.validators [None req-4aa8e09d-235a-4c7a-b956-02dcca7eea7f demo demo] Validation of dictionary's keys failed. Expected keys: set(['prefix', 'type']) Provided keys: set([u'local_pref',
u'bgpvpn_id', u'type']) {{(pid=8447) _verify_dict_keys /usr/local/lib/python2.7/dist-packages/neutron_lib/api/validators/__init__.py:69}}
DEBUG neutron_lib.api.validators [None req-4aa8e09d-235a-4c7a-b956-02dcca7eea7f demo demo] Validation of dictionary's keys failed. Expected keys: set(['prefix', 'type']) Provided keys: set([u'bgpvpn_id', u
'type']) {{(pid=8447) _verify_dict_keys /usr/local/lib/python2.7/dist-packages/neutron_lib/api/validators/__init__.py:69}}
ERROR neutron.api.v2.resource [None req-4aa8e09d-235a-4c7a-b956-02dcca7eea7f demo demo] update failed: No details.: DBDataError: (pymysql.err.DataError) (1264, u"Out of range value for column 'local_pref'
at row 1") [SQL: u'INSERT INTO bgpvpn_port_association_routes (id, port_association_id, type, local_pref, prefix, bgpvpn_id) VALUES (%(id)s, %(port_association_id)s, %(type)s, %(local_pref)s, %(prefix)s, %
(bgpvpn_id)s)'] [parameters: {'prefix': None, 'port_association_id': u'915bc1bb-cafe-4fa0-a44b-3b705dedb5f6', 'bgpvpn_id': u'39d7d7d2-ffa2-4fd4-8556-f8e7a759abdf', 'local_pref': 2147483648, 'type': 'bgpvpn
', 'id': 'faf251ff-648c-445b-a9bc-183ea0edadbe'}]

Tags: db
Revision history for this message
Thomas Morin (tmmorin-orange) wrote :

good catch doude!

adding neutron, since the field definition is in neutron-lib

Revision history for this message
Thomas Morin (tmmorin-orange) wrote :

Disregard my previous comment, this is only à DB issue.

Changed in bgpvpn:
status: New → Confirmed
no longer affects: neutron
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to networking-bgpvpn (master)

Fix proposed to branch: master
Review: https://review.openstack.org/522631

Changed in bgpvpn:
assignee: nobody → Édouard Thuleau (ethuleau)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to networking-bgpvpn (master)

Reviewed: https://review.openstack.org/522631
Committed: https://git.openstack.org/cgit/openstack/networking-bgpvpn/commit/?id=db39605d2987dd59163ed0d603828fe743c1b332
Submitter: Zuul
Branch: master

commit db39605d2987dd59163ed0d603828fe743c1b332
Author: Édouard Thuleau <email address hidden>
Date: Thu Nov 23 19:21:09 2017 +0100

    Use SQL BigInteger type to store BGP LOCAL_PREF

    The new route control API extension allows to define BGP LOCAL_PREF for
    the routes that will be advertised. BGP LOCAL_PREF maximum value is
    2^32-1 and the SQL Integer type is limited to 2^31-1.
    Cannot add a unit test as unit test framework uses an in-memory sqlite3
    DB and its Integer type maximum value is 2^64-1. Need to add a
    functional test.

    Change-Id: I372bdbe6916ef7c5ace660c1bc7782a0ea8d82b6
    Partial-Bug: #1733905

Changed in bgpvpn:
status: In Progress → Fix Released
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.