def get_create_listener_flow(self): """Flow to create a listener""" create_listener_flow = linear_flow.Flow(constants.CREATE_LISTENER_FLOW) create_listener_flow.add( lifecycle_tasks.ListenerToErrorOnRevertTask( requires=[constants.LISTENER])) create_listener_flow.add( a10_database_tasks.GetVThunderByLoadBalancer( requires=constants.LOADBALANCER, provides=a10constants.VTHUNDER)) create_listener_flow.add(self.handle_ssl_cert_flow(flow_type='create')) create_listener_flow.add( virtual_port_tasks.ListenerCreate(requires=[ constants.LOADBALANCER, constants.LISTENER, a10constants.VTHUNDER ])) create_listener_flow.add( a10_network_tasks.UpdateVIP(requires=constants.LOADBALANCER)) create_listener_flow.add( a10_database_tasks.MarkLBAndListenerActiveInDB( requires=[constants.LOADBALANCER, constants.LISTENER])) create_listener_flow.add( vthunder_tasks.WriteMemory(requires=a10constants.VTHUNDER)) return create_listener_flow
def get_rack_vthunder_create_listener_flow(self, project_id): """Create a flow to create a rack listener""" create_listener_flow = linear_flow.Flow(constants.CREATE_LISTENER_FLOW) create_listener_flow.add( lifecycle_tasks.ListenerToErrorOnRevertTask( requires=[constants.LISTENER])) create_listener_flow.add( a10_database_tasks.GetVThunderByLoadBalancer( requires=constants.LOADBALANCER, provides=a10constants.VTHUNDER)) create_listener_flow.add(self.handle_ssl_cert_flow(flow_type='create')) create_listener_flow.add( a10_database_tasks.GetFlavorData( rebind={a10constants.LB_RESOURCE: constants.LISTENER}, provides=constants.FLAVOR_DATA)) create_listener_flow.add( nat_pool_tasks.NatPoolCreate(requires=(constants.LOADBALANCER, a10constants.VTHUNDER, constants.FLAVOR_DATA))) create_listener_flow.add( virtual_port_tasks.ListenerCreate(requires=[ constants.LOADBALANCER, constants.LISTENER, a10constants.VTHUNDER, constants.FLAVOR_DATA ])) create_listener_flow.add( a10_database_tasks.MarkLBAndListenerActiveInDB( requires=[constants.LOADBALANCER, constants.LISTENER])) create_listener_flow.add( vthunder_tasks.WriteMemory(requires=a10constants.VTHUNDER)) create_listener_flow.add( a10_database_tasks.SetThunderUpdatedAt( requires=a10constants.VTHUNDER)) return create_listener_flow
def get_update_listener_flow(self): """Flow to update a listener""" update_listener_flow = linear_flow.Flow(constants.UPDATE_LISTENER_FLOW) update_listener_flow.add( lifecycle_tasks.ListenerToErrorOnRevertTask( requires=[constants.LISTENER])) update_listener_flow.add( a10_database_tasks.GetVThunderByLoadBalancer( requires=constants.LOADBALANCER, provides=a10constants.VTHUNDER)) update_listener_flow.add(self.handle_ssl_cert_flow(flow_type='update')) update_listener_flow.add( a10_database_tasks.GetFlavorData( rebind={a10constants.LB_RESOURCE: constants.LISTENER}, provides=constants.FLAVOR_DATA)) update_listener_flow.add( virtual_port_tasks.ListenerUpdate(requires=[ constants.LOADBALANCER, constants.LISTENER, a10constants. VTHUNDER, constants.FLAVOR_DATA, constants.UPDATE_DICT ])) update_listener_flow.add( database_tasks.UpdateListenerInDB( requires=[constants.LISTENER, constants.UPDATE_DICT])) update_listener_flow.add( a10_database_tasks.MarkLBAndListenerActiveInDB( requires=[constants.LOADBALANCER, constants.LISTENER])) update_listener_flow.add( vthunder_tasks.WriteMemory(requires=a10constants.VTHUNDER)) update_listener_flow.add( a10_database_tasks.SetThunderUpdatedAt( requires=a10constants.VTHUNDER)) return update_listener_flow
def get_create_listener_flow(self, topology): """Flow to create a listener""" create_listener_flow = linear_flow.Flow(constants.CREATE_LISTENER_FLOW) create_listener_flow.add( lifecycle_tasks.ListenerToErrorOnRevertTask( requires=[constants.LISTENER])) create_listener_flow.add( vthunder_tasks.VthunderInstanceBusy( requires=a10constants.COMPUTE_BUSY)) create_listener_flow.add( a10_database_tasks.GetVThunderByLoadBalancer( requires=constants.LOADBALANCER, provides=a10constants.VTHUNDER)) if topology == constants.TOPOLOGY_ACTIVE_STANDBY: create_listener_flow.add( vthunder_tasks.GetMasterVThunder( name=a10constants.GET_MASTER_VTHUNDER, requires=a10constants.VTHUNDER, provides=a10constants.VTHUNDER)) create_listener_flow.add(self.handle_ssl_cert_flow(flow_type='create')) create_listener_flow.add( a10_database_tasks.GetFlavorData( rebind={a10constants.LB_RESOURCE: constants.LISTENER}, provides=constants.FLAVOR_DATA)) create_listener_flow.add( nat_pool_tasks.NatPoolCreate(requires=(constants.LOADBALANCER, a10constants.VTHUNDER, constants.FLAVOR_DATA))) create_listener_flow.add( virtual_port_tasks.ListenerCreate(requires=[ constants.LOADBALANCER, constants.LISTENER, a10constants.VTHUNDER, constants.FLAVOR_DATA ])) create_listener_flow.add( a10_network_tasks.UpdateVIP(requires=constants.LOADBALANCER)) create_listener_flow.add( a10_database_tasks.MarkLBAndListenerActiveInDB( requires=[constants.LOADBALANCER, constants.LISTENER])) create_listener_flow.add( vthunder_tasks.WriteMemory(requires=a10constants.VTHUNDER)) create_listener_flow.add( a10_database_tasks.SetThunderUpdatedAt( requires=a10constants.VTHUNDER)) return create_listener_flow