Skip to content

Generation Tests Vlans fails, intermittent fail with Interfaces #334

@wojtek0806

Description

@wojtek0806

It seems that the generation returned in the JSON, does not match the current generation that the stored object has, which leads to failure in VLAN and Interface testing:

Interface

FAILED
self = <test.functional.net.test_interface.TestInterface object at 0x03AD3BB0>
request = <FixtureRequest for <Function 'test_RUL'>>
bigip = <f5.bigip.BigIP object at 0x03AD3CB0>

    def test_RUL(self, request, bigip):
        cleanup_test(request, bigip)
        # We can't create or delete interfaces so we will load them to start
        ifc1 = bigip.net.interfaces.interface.load(name='1.1')
        ifc2 = bigip.net.interfaces.interface.load(name='1.1')
        assert ifc1.generation == ifc2.generation
        assert ifc1.name == ifc2.name

        # Update by disabling the interface
        ifc1.disabled = True
        ifc1.update()
        assert ifc1.disabled is True
        assert not hasattr(ifc1, 'enabled')
        assert ifc1.generation != ifc2.generation

        # Refresh ifc2
        ifc2.refresh()
        assert ifc2.disabled is True
        assert not hasattr(ifc2, 'enabled')
>       assert ifc1.generation == ifc2.generation
E       assert 3387 == 3388
E        +  where 3387 = <f5.bigip.net.interface.Interface object at 0x0338D8F0>.generation
E        +  and   3388 = <f5.bigip.net.interface.Interface object at 0x0338D250>.generation```

Vlan


FAILED
self = <test.functional.net.test_vlan.TestVLAN object at 0x03AD3B70>
request = <FixtureRequest for <Function 'test_CURDL'>>
bigip = <f5.bigip.BigIP object at 0x03AD3E30>

    def test_CURDL(self, request, bigip):
        setup_vlan_collection_get_test(request, bigip)
        # Create a VLAN and verify some of the attributes
        v1 = bigip.net.vlans.vlan
        v1.create(name='v1', partition='Common')
        i1 = v1.interfaces_s.interfaces
        i1.create(name='1.1', tagged=True)
        v1_ifcs = v1.interfaces_s.get_collection()
        gen1 = v1.generation
        assert v1.name == 'v1'
        assert hasattr(v1, 'generation') and isinstance(v1.generation, int)
        assert len(v1_ifcs) == 1
        assert v1_ifcs[0].name == '1.1'

        # Update it
        v1.description = DESCRIPTION
>       v1.update()
(...)
self = <f5.bigip.net.vlan.Vlan object at 0x03D5C5B0>

    def _check_generation(self):
        '''Check that the generation on the BIG-IP® matches the object

            This will do a get to the objects URI and check that the generation
            returned in the JSON matches the one the object currently has.  If it
            does not it will raise the `GenerationMismatch` exception.
            '''

        session = self._meta_data['bigip']._meta_data['icr_session']
        response = session.get(self._meta_data['uri'])
        current_gen = response.json().get('generation', None)
        if current_gen is not None and current_gen != self.generation:
            error_message = ("The generation of the object on the BigIP " +
                             "(" + str(current_gen) + ")" +
                             " does not match the current object" +
                             "(" + str(self.generation) + ")")
>           raise GenerationMismatch(error_message)
E           GenerationMismatch: The generation of the object on the BigIP (3478) does not match the current object(3477)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions