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

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

`test_005_enable_pipeline` has been failing after `of_lldp` priority has been increased #249

Closed viniarck closed 1 year ago

viniarck commented 1 year ago

test_005_enable_pipeline relied on the order of the flows, since 50k priority of_lldp has been de default it impacted on it.

@Alopalao or @Ktmi could either of you fix this? I've also tagged @Ktmi to take a look on issue #248.

def test_005_enable_pipeline(self):
        """Test if there is any error with enabling and disabling pipeline"""
        pipeline = {
            "multi_table": [
                {
                    "table_id": 0,
                    "description": "First table for miss flow entry",
                    "table_miss_flow": {
                        "priority": 0,
                        "instructions": [{
                            "instruction_type": "goto_table",
                            "table_id": 1
                        }]
                    },
                },
                {
                    "table_id": 1,
                    "description": "Second table for coloring",
                    "napps_table_groups": {
                        "coloring": ["base"]
                    },
                    "table_miss_flow": {
                        "priority": 0,
                        "instructions": [{
                            "instruction_type": "goto_table",
                            "table_id": 2
                        }]
                    },
                },
                {
                    "table_id": 2,
                    "description": "Third table for of_lldp",
                    "napps_table_groups": {
                        "of_lldp": ["base"]
                    },
                    "table_miss_flow": {
                        "priority": 0,
                        "instructions": [{
                            "instruction_type": "goto_table",
                            "table_id": 3
                        }]
                    },
                },
                {
                    "table_id": 3,
                    "description": "Fourth table for mef_eline evpl",
                    "napps_table_groups": {
                        "mef_eline": ["evpl"],
                    },
                    "table_miss_flow": {
                        "priority": 0,
                        "instructions": [{
                            "instruction_type": "goto_table",
                            "table_id": 4
                        }]
                    },
                },
                {
                    "table_id": 4,
                    "description": "Fifth table for mef_eline epl",
                    "napps_table_groups": {
                        "mef_eline": ["epl"]
                    },
                },
            ]
        }
        evc = {
            "name": "evc01",
            "enabled": True,
            "dynamic_backup_path": True,
            "uni_a": {
                "interface_id": "00:00:00:00:00:00:00:01:1",
                "tag": {"tag_type": 1, "value": 100}
            },
            "uni_z": {
                "interface_id": "00:00:00:00:00:00:00:01:2"
            }
        }

        # Add circuit
        api_url = f"{KYTOS_API}/mef_eline/v2/evc/"
        response = requests.post(api_url, json=evc)
        assert response.status_code == 201, response.text
        data = response.json()
        assert 'circuit_id' in data
        time.sleep(10)

        # Add pipeline
        api_url = f"{KYTOS_API}{OF_MULTI_TABLE_API}"
        response = requests.post(api_url, json=pipeline)
        data = response.json()
        assert response.status_code == 201, response.text
        assert 'id' in data

        # Enabled pipeline
        api_url = f"{KYTOS_API}{OF_MULTI_TABLE_API}/{data['id']}/enable"
        response = requests.post(api_url)
        assert response.status_code == 200, response.text
        time.sleep(10)

        # Get pipeline dictionary
        api_url = f"{KYTOS_API}{OF_MULTI_TABLE_API}/{data['id']}"
        response = requests.get(api_url)
        pipeline_data = response.json()
        assert response.status_code == 200, response.text
        assert pipeline_data["status"] == "enabled"

        # Assert installed flows
        s1 = self.net.net.get('s1')
        flows_s1 = s1.dpctl('dump-flows').splitlines()
        assert len(flows_s1) == 9, flows_s1
        assert "table=0" in flows_s1[0]
        assert 'priority=0 actions=resubmit(,1)' in flows_s1[0] or \
               'priority=0 actions=goto_table:1' in flows_s1[0]
        assert "table=1" in flows_s1[1]
        assert 'actions=CONTROLLER:65535' in flows_s1[1]
        assert "table=1" in flows_s1[2]
        assert 'actions=CONTROLLER:65535' in flows_s1[2]
        assert "table=1" in flows_s1[3]
        assert 'priority=0 actions=resubmit(,2)' in flows_s1[3] or \
               'priority=0 actions=goto_table:2' in flows_s1[3]
        assert "table=2" in flows_s1[4]
        assert 'dl_type=0x88cc actions=CONTROLLER:65535' in flows_s1[4]
        assert "table=2" in flows_s1[5]
        assert 'priority=0 actions=resubmit(,3)' in flows_s1[5] or \
               'priority=0 actions=goto_table:3' in flows_s1[5]
        assert "table=3" in flows_s1[6]
        assert 'dl_vlan=100 actions=output:"s1-eth2"' in flows_s1[6]
        assert "table=3" in flows_s1[7]
        assert 'priority=0 actions=resubmit(,4)' in flows_s1[7] or \
               'priority=0 actions=goto_table:4' in flows_s1[7]
        assert "table=4" in flows_s1[8]
        assert 'actions=mod_vlan_vid:100,output:"s1-eth1"' in flows_s1[8]

        self.net.start_controller(clean_config=False)
        self.net.wait_switches_connect()
        time.sleep(10)

        # Assert installed flows
        s1 = self.net.net.get('s1')
        flows_s1 = s1.dpctl('dump-flows').splitlines()
        assert len(flows_s1) == 9, flows_s1
        assert "table=0" in flows_s1[0]
        assert 'priority=0 actions=resubmit(,1)' in flows_s1[0] or \
               'priority=0 actions=goto_table:1' in flows_s1[0]
        assert "table=1" in flows_s1[1]
        assert 'actions=CONTROLLER:65535' in flows_s1[1]
        assert "table=1" in flows_s1[2]
        assert 'actions=CONTROLLER:65535' in flows_s1[2]
        assert "table=1" in flows_s1[3]
        assert 'priority=0 actions=resubmit(,2)' in flows_s1[3] or \
               'priority=0 actions=goto_table:2' in flows_s1[3]
        assert "table=2" in flows_s1[4]
        assert 'dl_type=0x88cc actions=CONTROLLER:65535' in flows_s1[4]
        assert "table=2" in flows_s1[5]
        assert 'priority=0 actions=resubmit(,3)' in flows_s1[5] or \
               'priority=0 actions=goto_table:3' in flows_s1[5]
        assert "table=3" in flows_s1[6]
        assert 'dl_vlan=100 actions=output:"s1-eth2"' in flows_s1[6]
        assert "table=3" in flows_s1[7]
        assert 'priority=0 actions=resubmit(,4)' in flows_s1[7] or \
               'priority=0 actions=goto_table:4' in flows_s1[7]
        assert "table=4" in flows_s1[8]
        assert 'actions=mod_vlan_vid:100,output:"s1-eth1"' in flows_s1[8]

        # Return to default pipeline
        # Disabled pipeline
        api_url = f"{KYTOS_API}{OF_MULTI_TABLE_API}/{data['id']}/disable"
        response = requests.post(api_url)
        assert response.status_code == 200, response.text
        time.sleep(10)

        s1 = self.net.net.get('s1')
        flows_s1 = s1.dpctl('dump-flows').splitlines()
        assert len(flows_s1) == 5, flows_s1
        for flow in flows_s1:
            assert 'table=0' in flow
        assert 'actions=CONTROLLER:65535' in flows_s1[0]
        assert 'actions=CONTROLLER:65535' in flows_s1[1]
>       assert 'dl_vlan=100 actions=output:"s1-eth2"' in flows_s1[2]
E       assert 'dl_vlan=100 actions=output:"s1-eth2"' in ' cookie=0xac00000000000001, duration=8.717s, table=0, n_packets=0, n_bytes=0, priority=50000,dl_src=ee:ee:ee:ee:ee:02 actions=CONTROLLER:65535'
tests/test_e2e_60_of_multi_table.py:214: AssertionError
tests/test_e2e_31_of_lldp.py::TestE2EOfLLDP::test_005_liveness_goes_down: 2023-07-27,06:25:37.051[939](https://gitlab.ampath.net/kytos/kytos-end-to-end-tester/-/jobs/48400#L939) - 2023-07-27,06:25:57.166444
tests/test_e2e_60_of_multi_table.py::TestE2EOfMultiTable::test_005_enable_pipeline: 2023-07-27,07:05:14.200853 - 2023-07-27,07:06:20.041780