def get_delete_health_monitor_flow(self, topology): """Create a flow to delete a health monitor :returns: The flow for deleting a health monitor """ delete_hm_flow = linear_flow.Flow(constants.DELETE_HEALTH_MONITOR_FLOW) delete_hm_flow.add( lifecycle_tasks.HealthMonitorToErrorOnRevertTask(requires=[ constants.HEALTH_MON, constants.LISTENERS, constants.LOADBALANCER ])) delete_hm_flow.add( vthunder_tasks.VthunderInstanceBusy( requires=a10constants.COMPUTE_BUSY)) delete_hm_flow.add( database_tasks.MarkHealthMonitorPendingDeleteInDB( requires=constants.HEALTH_MON)) delete_hm_flow.add( model_tasks.DeleteModelObject( rebind={constants.OBJECT: constants.HEALTH_MON})) delete_hm_flow.add( a10_database_tasks.GetVThunderByLoadBalancer( requires=constants.LOADBALANCER, provides=a10constants.VTHUNDER)) if topology == constants.TOPOLOGY_ACTIVE_STANDBY: delete_hm_flow.add( vthunder_tasks.GetMasterVThunder( name=a10constants.GET_MASTER_VTHUNDER, requires=a10constants.VTHUNDER, provides=a10constants.VTHUNDER)) delete_hm_flow.add(self.get_delete_health_monitor_vthunder_subflow()) delete_hm_flow.add( database_tasks.DeleteHealthMonitorInDB( requires=constants.HEALTH_MON)) delete_hm_flow.add( database_tasks.DecrementHealthMonitorQuota( requires=constants.HEALTH_MON)) delete_hm_flow.add( database_tasks.UpdatePoolMembersOperatingStatusInDB( requires=constants.POOL, inject={constants.OPERATING_STATUS: constants.NO_MONITOR})) delete_hm_flow.add( database_tasks.MarkPoolActiveInDB(requires=constants.POOL)) delete_hm_flow.add( database_tasks.MarkLBAndListenersActiveInDB( requires=[constants.LOADBALANCER, constants.LISTENERS])) delete_hm_flow.add( vthunder_tasks.WriteMemory( name=a10constants.WRITE_MEM_FOR_LOCAL_PARTITION, requires=(a10constants.VTHUNDER))) delete_hm_flow.add( vthunder_tasks.WriteMemory( name=a10constants.WRITE_MEM_FOR_SHARED_PARTITION, requires=(a10constants.VTHUNDER, a10constants.WRITE_MEM_SHARED_PART))) delete_hm_flow.add( a10_database_tasks.SetThunderUpdatedAt( requires=(a10constants.VTHUNDER))) return delete_hm_flow
def get_delete_health_monitor_flow(self): """Create a flow to delete a health monitor :returns: The flow for deleting a health monitor """ delete_hm_flow = linear_flow.Flow(constants.DELETE_HEALTH_MONITOR_FLOW) delete_hm_flow.add(lifecycle_tasks.HealthMonitorToErrorOnRevertTask( requires=[constants.HEALTH_MON, constants.LISTENERS, constants.LOADBALANCER])) delete_hm_flow.add(database_tasks.MarkHealthMonitorPendingDeleteInDB( requires=constants.HEALTH_MON)) delete_hm_flow.add(model_tasks. DeleteModelObject(rebind={constants.OBJECT: constants.HEALTH_MON})) delete_hm_flow.add(amphora_driver_tasks.ListenersUpdate( requires=[constants.LOADBALANCER, constants.LISTENERS])) delete_hm_flow.add(database_tasks.DeleteHealthMonitorInDB( requires=constants.POOL_ID)) delete_hm_flow.add(database_tasks.DecrementHealthMonitorQuota( requires=constants.HEALTH_MON)) delete_hm_flow.add(database_tasks.MarkLBAndListenersActiveInDB( requires=[constants.LOADBALANCER, constants.LISTENERS])) return delete_hm_flow
def test_delete_health_monitor_in_db( self, mock_health_mon_repo_delete, mock_generate_uuid, mock_LOG, mock_get_session, mock_loadbalancer_repo_update, mock_listener_repo_update, mock_amphora_repo_update, mock_amphora_repo_delete): delete_health_mon = database_tasks.DeleteHealthMonitorInDB() delete_health_mon.execute(POOL_ID) repo.HealthMonitorRepository.delete.assert_called_once_with( 'TEST', pool_id=POOL_ID) # Test the revert mock_health_mon_repo_delete.reset_mock() delete_health_mon.revert(POOL_ID)
def get_delete_health_monitor_flow(self): """Create a flow to delete a health monitor :returns: The flow for deleting a health monitor """ delete_hm_flow = linear_flow.Flow(constants.DELETE_HEALTH_MONITOR_FLOW) delete_hm_flow.add(model_tasks. DeleteModelObject(rebind={constants.OBJECT: constants.HEALTH_MON})) delete_hm_flow.add(amphora_driver_tasks.ListenerUpdate( requires=[constants.LISTENER, constants.VIP])) delete_hm_flow.add(database_tasks.DeleteHealthMonitorInDB( requires=constants.POOL_ID)) delete_hm_flow.add(database_tasks.MarkLBAndListenerActiveInDB( requires=[constants.LOADBALANCER, constants.LISTENER])) return delete_hm_flow
def get_delete_health_monitor_flow(self): """Create a flow to delete a health monitor :returns: The flow for deleting a health monitor """ delete_hm_flow = linear_flow.Flow(constants.DELETE_HEALTH_MONITOR_FLOW) delete_hm_flow.add( lifecycle_tasks.HealthMonitorToErrorOnRevertTask(requires=[ constants.HEALTH_MON, constants.LISTENERS, constants.LOADBALANCER ])) delete_hm_flow.add( database_tasks.MarkHealthMonitorPendingDeleteInDB( requires=constants.HEALTH_MON)) delete_hm_flow.add( model_tasks.DeleteModelObject( rebind={constants.OBJECT: constants.HEALTH_MON})) delete_hm_flow.add( a10_database_tasks.GetVThunderByLoadBalancer( requires=constants.LOADBALANCER, provides=a10constants.VTHUNDER)) delete_hm_flow.add( health_monitor_tasks.DeleteHealthMonitor( requires=[constants.HEALTH_MON, a10constants.VTHUNDER])) delete_hm_flow.add( database_tasks.DeleteHealthMonitorInDB( requires=constants.HEALTH_MON)) delete_hm_flow.add( database_tasks.DecrementHealthMonitorQuota( requires=constants.HEALTH_MON)) delete_hm_flow.add( database_tasks.UpdatePoolMembersOperatingStatusInDB( requires=constants.POOL, inject={constants.OPERATING_STATUS: constants.NO_MONITOR})) delete_hm_flow.add( database_tasks.MarkPoolActiveInDB(requires=constants.POOL)) delete_hm_flow.add( database_tasks.MarkLBAndListenersActiveInDB( requires=[constants.LOADBALANCER, constants.LISTENERS])) return delete_hm_flow