def get_create_listener_flow(self): """Create a flow to create a listener :returns: The flow for creating a listener """ create_listener_flow = linear_flow.Flow(constants.CREATE_LISTENER_FLOW) create_listener_flow.add( lifecycle_tasks.ListenersToErrorOnRevertTask( requires=[constants.LOADBALANCER, constants.LISTENERS])) create_listener_flow.add( amphora_driver_tasks.ListenersUpdate( requires=constants.LOADBALANCER)) create_listener_flow.add( network_tasks.UpdateVIP(requires=constants.LOADBALANCER)) create_listener_flow.add( database_tasks.MarkLBAndListenersActiveInDB( requires=[constants.LOADBALANCER, constants.LISTENERS])) return create_listener_flow
def test_ListenersToErrorOnRevertTask( self, mock_listener_prov_status_error, mock_loadbalancer_prov_status_active): listeners_to_error_on_revert = ( lifecycle_tasks.ListenersToErrorOnRevertTask()) # Execute listeners_to_error_on_revert.execute([self.LISTENER]) self.assertFalse(mock_listener_prov_status_error.called) # Revert listeners_to_error_on_revert.revert([self.LISTENER]) mock_listener_prov_status_error.assert_called_once_with( self.LISTENER_ID) mock_loadbalancer_prov_status_active.assert_called_once_with( self.LOADBALANCER_ID)
def get_update_listener_flow(self): """Create a flow to update a listener :returns: The flow for updating a listener """ update_listener_flow = linear_flow.Flow(constants.UPDATE_LISTENER_FLOW) update_listener_flow.add( lifecycle_tasks.ListenersToErrorOnRevertTask( requires=[constants.LOADBALANCER, constants.LISTENERS])) update_listener_flow.add( amphora_driver_tasks.ListenersUpdate( requires=[constants.LOADBALANCER, constants.LISTENERS])) update_listener_flow.add( database_tasks.UpdateListenerInDB( requires=[constants.LISTENER, constants.UPDATE_DICT])) update_listener_flow.add( database_tasks.MarkLBAndListenersActiveInDB( requires=[constants.LOADBALANCER, constants.LISTENERS])) return update_listener_flow
def get_create_listener_flow(self): """Create a flow to create a listener :returns: The flow for creating a listener """ create_listener_flow = linear_flow.Flow(constants.CREATE_LISTENER_FLOW) create_listener_flow.add(lifecycle_tasks.ListenersToErrorOnRevertTask( requires=[constants.LOADBALANCER, constants.LISTENERS])) #create_listener_flow.add(amphora_driver_tasks.ListenersUpdate( # requires=[constants.LOADBALANCER, constants.LISTENERS])) # Get VThunder details from database create_listener_flow.add(a10_database_tasks.GetVThunderByLoadBalancer( requires=constants.LOADBALANCER, provides=a10constants.VTHUNDER)) create_listener_flow.add(handler_virtual_port.ListenersCreate( requires=[constants.LOADBALANCER, constants.LISTENERS, a10constants.VTHUNDER])) create_listener_flow.add(network_tasks.UpdateVIP( requires=constants.LOADBALANCER)) create_listener_flow.add(database_tasks. MarkLBAndListenersActiveInDB( requires=[constants.LOADBALANCER, constants.LISTENERS])) return create_listener_flow
def get_update_listener_flow(self): """Create a flow to update a listener :returns: The flow for updating a listener """ update_listener_flow = linear_flow.Flow(constants.UPDATE_LISTENER_FLOW) update_listener_flow.add(lifecycle_tasks.ListenersToErrorOnRevertTask( requires=[constants.LOADBALANCER, constants.LISTENERS])) #update_listener_flow.add(amphora_driver_tasks.ListenersUpdate( # requires=[constants.LOADBALANCER, constants.LISTENERS])) update_listener_flow.add(a10_database_tasks.GetVThunderByLoadBalancer( requires=constants.LOADBALANCER, provides=a10constants.VTHUNDER)) update_listener_flow.add(handler_virtual_port.ListenersUpdate( requires=[constants.LOADBALANCER, constants.LISTENER, a10constants.VTHUNDER])) update_listener_flow.add(database_tasks.UpdateListenerInDB( requires=[constants.LISTENER, constants.UPDATE_DICT])) update_listener_flow.add(database_tasks. MarkLBAndListenersActiveInDB( requires=[constants.LOADBALANCER, constants.LISTENERS])) return update_listener_flow