LLDP tests fail with construct error

Bug #1753506 reported by Bob Fournier
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ironic Inspector
Fix Committed
Undecided
Bob Fournier

Bug Description

The ironic-inspector LLDP tests are failing in master for py27 with the construct lib error below. This problem was not happening in Queens and appears to be due to change in construct lib. This was seen with construct==2.9.35.

  Traceback (most recent call last):
    ImportError: Failed to import test module: ironic_inspector.test.unit.test_plugins_local_link_connection
    Traceback (most recent call last):
      File "/home/bfournie/workspace/ironic-inspector/.tox/py27/lib/python2.7/site-packages/unittest2/loader.py", line 456, in _find_test_path
        module = self._get_module_from_name(name)
      File "/home/bfournie/workspace/ironic-inspector/.tox/py27/lib/python2.7/site-packages/unittest2/loader.py", line 395, in _get_module_from_name
        __import__(name)
      File "ironic_inspector/test/unit/test_plugins_local_link_connection.py", line 18, in <module>
        from ironic_inspector.plugins import local_link_connection
      File "ironic_inspector/plugins/local_link_connection.py", line 23, in <module>
        from ironic_inspector.common import lldp_parsers
      File "ironic_inspector/common/lldp_parsers.py", line 22, in <module>
        from ironic_inspector.common import lldp_tlvs as tlv
      File "ironic_inspector/common/lldp_tlvs.py", line 137, in <module>
        mapping_for_switch(CHASSIS_ID_MAPPING)))
      File "/home/bfournie/workspace/ironic-inspector/.tox/py27/lib/python2.7/site-packages/construct/core.py", line 1876, in __init__
        self.subcons = mergefields(*subcons)
      File "/home/bfournie/workspace/ironic-inspector/.tox/py27/lib/python2.7/site-packages/construct/core.py", line 157, in mergefields
        result.extend(select(sc))
      File "/home/bfournie/workspace/ironic-inspector/.tox/py27/lib/python2.7/site-packages/construct/core.py", line 149, in select
        return select(sc.subcon)
      File "/home/bfournie/workspace/ironic-inspector/.tox/py27/lib/python2.7/site-packages/construct/core.py", line 149, in select
        return select(sc.subcon)
      File "/home/bfournie/workspace/ironic-inspector/.tox/py27/lib/python2.7/site-packages/construct/core.py", line 152, in select
        raise ConstructError("Embedding only works with: Struct, Sequence, FocusedSeq, Union")
    ConstructError: Embedding only works with: Struct, Sequence, FocusedSeq, Union

The error is coming from this definition:
ChassisId = core.Struct(
    'subtype' / core.Enum(core.Byte, **mapping_for_enum(
        CHASSIS_ID_MAPPING)),
    'value' /
    core.Embedded(core.Switch(construct.this.subtype,
                              mapping_for_switch(CHASSIS_ID_MAPPING)))
)

It looks like the behavior of "Embedded" has changed such that "Switch" can no longer be embedded in a Struct.

Revision history for this message
Mark Goddard (mgoddard) wrote :

Also saw this in a real environment using ironic-inspector @ master, with the lldp_basic and local_link_connection plugins enabled. It prevented inspector from starting up. Disabling these plugins allowed inspector to start.

Mark Goddard (mgoddard)
Changed in ironic-inspector:
status: New → Confirmed
Revision history for this message
Bob Fournier (bfournie) wrote :

Note the Warning in the docs for construct here for 2.9:
https://construct.readthedocs.io/en/latest/transition29.html

"Construct is undergoing heavy changes at the moment, expect unstable API until further notice."

Bob Fournier (bfournie)
Changed in ironic-inspector:
assignee: nobody → Bob Fournier (bfournie)
status: Confirmed → Fix Committed
Revision history for this message
Mark Goddard (mgoddard) wrote :

Bob's fix in requirements: https://review.openstack.org/#/c/549866/

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements rocky-eol

This issue was fixed in the openstack/requirements rocky-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements stein-eol

This issue was fixed in the openstack/requirements stein-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements yoga-eom

This issue was fixed in the openstack/requirements yoga-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements train-eol

This issue was fixed in the openstack/requirements train-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements ussuri-eol

This issue was fixed in the openstack/requirements ussuri-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements victoria-eom

This issue was fixed in the openstack/requirements victoria-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements wallaby-eom

This issue was fixed in the openstack/requirements wallaby-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements xena-eom

This issue was fixed in the openstack/requirements xena-eom 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.