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

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

Increase sleep time in test_e2e_20_flow_manager.py: test_040_replace_action_flow to allow consistency check to run #189

Closed italovalcy closed 1 year ago

italovalcy commented 1 year ago

Hi,

I was troubleshooting the issues that occurred in yesterday's e2e below:

rerun: 0
tests/test_e2e_20_flow_manager.py::TestE2EFlowManager::test_040_replace_action_flow: 2022-12-01,06:11:21.855076 - 2022-12-01,06:11:46.884125
self = <tests.test_e2e_20_flow_manager.TestE2EFlowManager object at 0x7f36d4a82220>

   def test_040_replace_action_flow(self):
     self.replace_action_flow()

tests/test_e2e_20_flow_manager.py:446: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_e2e_20_flow_manager.TestE2EFlowManager object at 0x7f36d4a82220>
restart_kytos = False

   def replace_action_flow(self, restart_kytos=False):

       payload = {
           "flows": [
               {
                   "priority": 10,
                   "idle_timeout": 360,
                   "hard_timeout": 1200,
                   "match": {
                       "in_port": 1
                   },
                   "actions": [
                       {
                           "action_type": "output",
                           "port": 2
                       }
                   ]
               }
           ]
       }

       api_url = KYTOS_API + '/flow_manager/v2/flows/00:00:00:00:00:00:00:01'
       requests.post(api_url, data=json.dumps(payload),
                     headers={'Content-type': 'application/json'})

       # wait for the flow to be installed
       time.sleep(10)

       # Verify the flow
       s1 = self.net.net.get('s1')
       flows_s1 = s1.dpctl('dump-flows')
       assert len(flows_s1.split('\r\n ')) == BASIC_FLOWS + 1, flows_s1
       assert 'in_port="s1-eth1' in flows_s1

       # Modify the actions and verify its modification
       s1.dpctl('mod-flows', 'actions=output:3')
       flows_s1 = s1.dpctl('dump-flows')
       assert 'actions=output:"s1-eth2"' not in flows_s1
       assert 'actions=output:"s1-eth3"' in flows_s1

       if restart_kytos:
           # restart controller keeping configuration
           self.net.start_controller(enable_all=True)
           self.net.wait_switches_connect()
       else:
           self.net.reconnect_switches()

       time.sleep(10)

       # Check that the flow keeps the original setting
       s1 = self.net.net.get('s1')
       flows_s1 = s1.dpctl('dump-flows')
     assert len(flows_s1.split('\r\n ')) == BASIC_FLOWS + 1, flows_s1
E       AssertionError:  cookie=0xab00000000000001, duration=14.026s, table=0, n_packets=8, n_bytes=336, priority=1000,dl_vlan=3799,dl_type=0x88cc actions=CONTROLLER:65535
E         
E       assert 1 == (3 + 1)
E        +  where 1 = len([' cookie=0xab00000000000001, duration=14.026s, table=0, n_packets=8, n_bytes=336, priority=1000,dl_vlan=3799,dl_type=0x88cc actions=CONTROLLER:65535\r\n'])
E        +    where [' cookie=0xab00000000000001, duration=14.026s, table=0, n_packets=8, n_bytes=336, priority=1000,dl_vlan=3799,dl_type=0x88cc actions=CONTROLLER:65535\r\n'] = <built-in method split of str object at 0x7f36b05bc100>('\r\n ')
E        +      where <built-in method split of str object at 0x7f36b05bc100> = ' cookie=0xab00000000000001, duration=14.026s, table=0, n_packets=8, n_bytes=336, priority=1000,dl_vlan=3799,dl_type=0x88cc actions=CONTROLLER:65535\r\n'.split

tests/test_e2e_20_flow_manager.py:441: AssertionError

Besides the issue reported in #188 , the problem above will also be triggered if, eventually, the delay in running the OF Flow Stats Requests is greater than the sleep time above. With the recent change on the STATS_INTERVAL, the stats request may not happen within the sleep time above, which may result in the wrong flows (wrong actions in the case above).

We may need to adapt the sleep times for this testing function, as well as others that modify the flows, and wait for the consistency to run and fix them.

CCing @viniarck to hear his opinion on this.