neutron and neutron-lib version dismatch when run tox

Bug #1858195 reported by uchenily on 2020-01-03
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Networking ML2 Generic Switch
Undecided
Unassigned

Bug Description

when i try to run ngs tox test(branch: stable/rocky), i encountered the following error:
$ tox -epy37
...
networking_generic_switch.tests.unit.netmiko.test_netmiko_base.TestNetmikoSwitch.test_switch_send_commands_with_coordinator
---------------------------------------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    b'Traceback (most recent call last):'
    b' File "/root/ngs/.tox/py37/lib/python3.7/site-packages/mock/mock.py", line 1305, in patched'
    b' return func(*args, **keywargs)'
    b' File "/root/ngs/networking_generic_switch/tests/unit/netmiko/test_netmiko_base.py", line 272, in test_switch_send_commands_with_coordinator'
    b" self.cfg.config(host='viking')"
    b' File "/root/ngs/.tox/py37/lib/python3.7/site-packages/oslo_config/fixture.py", line 70, in config'
    b' self.conf.set_override(k, v, group)'
    b' File "/root/ngs/.tox/py37/lib/python3.7/site-packages/oslo_config/cfg.py", line 2497, in __inner'
    b' result = f(self, *args, **kwargs)'
    b' File "/root/ngs/.tox/py37/lib/python3.7/site-packages/oslo_config/cfg.py", line 2877, in set_override'
    b' opt_info = self._get_opt_info(name, group)'
    b' File "/root/ngs/.tox/py37/lib/python3.7/site-packages/oslo_config/cfg.py", line 3264, in _get_opt_info'
    b' raise NoSuchOptError(opt_name, group)'
    b'oslo_config.cfg.NoSuchOptError: no such option host in group [DEFAULT]'
    b''

unittest2.loader._FailedTest.networking_generic_switch.tests.unit.test_generic_switch_mech
------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    b'Traceback (most recent call last):'
    b'ImportError: Failed to import test module: networking_generic_switch.tests.unit.test_generic_switch_mech'
    b'Traceback (most recent call last):'
    b' File "/root/ngs/.tox/py37/lib/python3.7/site-packages/unittest2/loader.py", line 456, in _find_test_path'
    b' module = self._get_module_from_name(name)'
    b' File "/root/ngs/.tox/py37/lib/python3.7/site-packages/unittest2/loader.py", line 395, in _get_module_from_name'
    b' __import__(name)'
    b' File "/root/ngs/networking_generic_switch/tests/unit/test_generic_switch_mech.py", line 19, in <module>'
    b' from neutron.db import provisioning_blocks'
    b' File "/root/ngs/.tox/py37/lib/python3.7/site-packages/neutron/db/provisioning_blocks.py", line 23, in <module>'
    b' from neutron.db import models_v2'
    b' File "/root/ngs/.tox/py37/lib/python3.7/site-packages/neutron/db/models_v2.py", line 27, in <module>'
    b' from neutron.db.network_dhcp_agent_binding import models as ndab_model'
    b' File "/root/ngs/.tox/py37/lib/python3.7/site-packages/neutron/db/network_dhcp_agent_binding/models.py", line 17, in <module>'
    b' from neutron.db.models import agent as agent_model'
    b' File "/root/ngs/.tox/py37/lib/python3.7/site-packages/neutron/db/models/agent.py", line 18, in <module>'
    b' from neutron.agent.common import utils'
    b' File "/root/ngs/.tox/py37/lib/python3.7/site-packages/neutron/agent/common/utils.py", line 23, in <module>'
    b' from neutron.conf.agent import common as config'
    b' File "/root/ngs/.tox/py37/lib/python3.7/site-packages/neutron/conf/agent/common.py", line 23, in <module>'
    b' from neutron.common import config'
    b' File "/root/ngs/.tox/py37/lib/python3.7/site-packages/neutron/common/config.py", line 32, in <module>'
    b' from neutron.conf import common as common_config'
    b' File "/root/ngs/.tox/py37/lib/python3.7/site-packages/neutron/conf/common.py", line 132, in <module>'
    b" cfg.IntOpt('global_physnet_mtu', default=constants.DEFAULT_NETWORK_MTU,"
    b"AttributeError: module 'neutron_lib.constants' has no attribute 'DEFAULT_NETWORK_MTU'"

As i noticed in tox logs, i found the depenceny version: neutron==15.0.1,neutron-lib==1.18.0, in fact, they are dismatched.
for example, if `from neutron_lib import constants`( https://opendev.org/openstack/neutron/src/tag/15.0.1/neutron/conf/common.py#L16), use neutron-lib==1.18.0 will cause a error becuase it didn't define `DEFAULT_NETWORK_MTU`, only after neutron-lib>=1.25.0, we can see this defination.(https://opendev.org/openstack/neutron-lib/src/tag/1.25.0/neutron_lib/constants.py#L543)

It seems that making upper constraints for neutron will solve the problem, for example, change ngs requirements.txt:
neutron>=13.0.0.0b1 --> neutron>=13.0.0.0b1,<14.0.0
but i'm not sure if there is a better solution.:)

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

Other bug subscribers