kytos-ng / kytos-end-to-end-tests

Kytos End-to-End Tests
0 stars 10 forks source link

`test_005_liveness_goes_down` has been failing after `of_lldp` priority has been increased #248

Closed viniarck closed 11 months ago

viniarck commented 12 months ago

Since PR https://github.com/kytos-ng/of_lldp/pull/91 has landed, test_005_liveness_goes_down has been failing, turns out this test was using 30k priority to force a drop, but the default 50k is higher than this so liveness wouldn't go down, so it needs to be adapted, @Ktmi can you fix it, and make sure e2e tests are passing?

def test_005_liveness_goes_down(self) -> None:
        """Test liveness goes down."""
        polling_interval = 1
        self.set_polling_time(polling_interval)
        interface_ids = [
            "00:00:00:00:00:00:00:01:3",
            "00:00:00:00:00:00:00:02:2",
        ]
        link_id = "78282c4d5b579265f04ebadc4405ca1b49628eb1d684bb45e5d0[607](https://gitlab.ampath.net/kytos/kytos-end-to-end-tester/-/jobs/48311#L607)fa8b713d0"
        self.enable_link_liveness(interface_ids)

        # Wait just so liveness can go up
        time.sleep(polling_interval * 5)

        # Assert GET liveness/ is enabled
        api_url = f"{KYTOS_API}/of_lldp/v1/liveness/"
        response = requests.get(api_url)
        data = response.json()
        for entry in data["interfaces"]:
            assert entry["id"] in interface_ids, entry
            assert entry["status"] == "up", entry

        """
        Install a high prio LLDP flow to drop just so packet-ins
        are no longer sent. This will force hello to be missed.
        """
        s2 = self.net.net.get("s2")
        flow_entry = "cookie=0xdd00000000000000,priority=30000,dl_type=0x088cc,dl_vlan=3799,actions=drop"
        s2.dpctl("add-flow", flow_entry)

        # Wait just so hellos are missed
        time.sleep(15)
        s2 = self.net.net.get('s2')
        flows_s2 = s2.dpctl("dump-flows")
        # Expects 2x LLDP flow entries
        assert len(flows_s2.split('\r\n ')) == BASIC_FLOWS + 1, flows_s2

        # Assert GET liveness/ is enabled and down
        api_url = f"{KYTOS_API}/of_lldp/v1/liveness/?interface_id={interface_ids[1]}"
        response = requests.get(api_url)
        data = response.json()
        assert data["interfaces"], data["interfaces"]
        assert data["interfaces"][0]["id"] == interface_ids[1], data["interfaces"]
>       assert data["interfaces"][0]["status"] == "down", data["interfaces"]
E       AssertionError: [{'id': '00:00:00:00:00:00:00:02:2', 'last_hello_at': '2023-07-25T06:24:58.303295', 'status': 'up'}]
E       assert 'up' == 'down'
E         - down
E         + up