예제 #1
0
    def get_update_pool_flow(self):
        """Create a flow to update a pool

        :returns: The flow for updating a pool
        """
        update_pool_flow = linear_flow.Flow(constants.UPDATE_POOL_FLOW)
        update_pool_flow.add(lifecycle_tasks.PoolToErrorOnRevertTask(
            requires=[constants.POOL,
                      constants.LISTENERS,
                      constants.LOADBALANCER]))
        update_pool_flow.add(database_tasks.MarkPoolPendingUpdateInDB(
            requires=constants.POOL))
        update_pool_flow.add(a10_database_tasks.GetVThunderByLoadBalancer(
            requires=constants.LOADBALANCER,
            provides=a10constants.VTHUNDER))
        update_pool = service_group_tasks.PoolUpdate(
            requires=[constants.POOL, a10constants.VTHUNDER, constants.UPDATE_DICT],
            provides=constants.POOL)
        update_pool_flow.add(*self._get_sess_pers_subflow(update_pool))
        update_pool_flow.add(virtual_port_tasks.ListenersUpdate(
            requires=[constants.LOADBALANCER, constants.LISTENERS, a10constants.VTHUNDER]))
        update_pool_flow.add(database_tasks.UpdatePoolInDB(
            requires=[constants.POOL, constants.UPDATE_DICT]))
        update_pool_flow.add(database_tasks.MarkPoolActiveInDB(
            requires=constants.POOL))
        update_pool_flow.add(database_tasks.MarkLBAndListenersActiveInDB(
            requires=[constants.LOADBALANCER, constants.LISTENERS]))

        return update_pool_flow
예제 #2
0
    def get_update_health_monitor_flow(self):
        """Create a flow to update a health monitor

        :returns: The flow for updating a health monitor
        """
        update_hm_flow = linear_flow.Flow(constants.UPDATE_HEALTH_MONITOR_FLOW)
        update_hm_flow.add(
            lifecycle_tasks.HealthMonitorToErrorOnRevertTask(requires=[
                constants.HEALTH_MON, constants.LISTENERS,
                constants.LOADBALANCER
            ]))
        update_hm_flow.add(
            database_tasks.MarkHealthMonitorPendingUpdateInDB(
                requires=constants.HEALTH_MON))
        update_hm_flow.add(
            model_tasks.UpdateAttributes(
                rebind={constants.OBJECT: constants.HEALTH_MON},
                requires=[constants.UPDATE_DICT]))
        update_hm_flow.add(
            amphora_driver_tasks.ListenersUpdate(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        update_hm_flow.add(
            database_tasks.UpdateHealthMonInDB(
                requires=[constants.HEALTH_MON, constants.UPDATE_DICT]))
        update_hm_flow.add(
            database_tasks.MarkHealthMonitorActiveInDB(
                requires=constants.HEALTH_MON))
        update_hm_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        update_hm_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))

        return update_hm_flow
예제 #3
0
    def get_create_health_monitor_flow(self):
        """Create a flow to create a health monitor

        :returns: The flow for creating a health monitor
        """
        create_hm_flow = linear_flow.Flow(constants.CREATE_HEALTH_MONITOR_FLOW)
        create_hm_flow.add(
            lifecycle_tasks.HealthMonitorToErrorOnRevertTask(requires=[
                constants.HEALTH_MON, constants.LISTENERS,
                constants.LOADBALANCER
            ]))
        create_hm_flow.add(
            database_tasks.MarkHealthMonitorPendingCreateInDB(
                requires=constants.HEALTH_MON))
        create_hm_flow.add(
            amphora_driver_tasks.ListenersUpdate(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        create_hm_flow.add(
            database_tasks.MarkHealthMonitorActiveInDB(
                requires=constants.HEALTH_MON))
        create_hm_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        create_hm_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))

        return create_hm_flow
예제 #4
0
    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.HEALTH_MON))
        delete_hm_flow.add(
            database_tasks.DecrementHealthMonitorQuota(
                requires=constants.HEALTH_MON))
        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
예제 #5
0
    def get_create_health_monitor_flow(self):
        """Create a flow to create a health monitor

        :returns: The flow for creating a health monitor
        """
        create_hm_flow = linear_flow.Flow(constants.CREATE_HEALTH_MONITOR_FLOW)
        create_hm_flow.add(
            lifecycle_tasks.HealthMonitorToErrorOnRevertTask(requires=[
                constants.HEALTH_MON, constants.LISTENERS,
                constants.LOADBALANCER
            ]))
        create_hm_flow.add(
            database_tasks.MarkHealthMonitorPendingCreateInDB(
                requires=constants.HEALTH_MON))
        create_hm_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        create_hm_flow.add(
            health_monitor_tasks.CreateAndAssociateHealthMonitor(requires=[
                constants.LISTENERS, constants.HEALTH_MON,
                a10constants.VTHUNDER
            ]))
        create_hm_flow.add(
            database_tasks.MarkHealthMonitorActiveInDB(
                requires=constants.HEALTH_MON))
        create_hm_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        create_hm_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))

        return create_hm_flow
    def get_update_member_flow(self):
        """Flow to update a member

        :returns: The flow for updating a member
        """
        update_member_flow = linear_flow.Flow(constants.UPDATE_MEMBER_FLOW)
        update_member_flow.add(
            lifecycle_tasks.MemberToErrorOnRevertTask(requires=[
                constants.MEMBER, constants.LISTENERS, constants.LOADBALANCER,
                constants.POOL
            ]))
        update_member_flow.add(
            database_tasks.MarkMemberPendingUpdateInDB(
                requires=constants.MEMBER))
        update_member_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        update_member_flow.add(
            server_tasks.MemberUpdate(requires=(constants.MEMBER,
                                                a10constants.VTHUNDER)))
        update_member_flow.add(
            database_tasks.UpdateMemberInDB(
                requires=[constants.MEMBER, constants.UPDATE_DICT]))
        update_member_flow.add(
            database_tasks.MarkMemberActiveInDB(requires=constants.MEMBER))
        update_member_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        update_member_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        update_member_flow.add(
            vthunder_tasks.WriteMemory(requires=a10constants.VTHUNDER))
        return update_member_flow
예제 #7
0
    def get_create_pool_flow(self):
        """Create a flow to create a pool

        :returns: The flow for creating a pool
        """
        create_pool_flow = linear_flow.Flow(constants.CREATE_POOL_FLOW)
        create_pool_flow.add(
            lifecycle_tasks.PoolToErrorOnRevertTask(requires=[
                constants.POOL, constants.LISTENERS, constants.LOADBALANCER
            ]))
        create_pool_flow.add(
            database_tasks.MarkPoolPendingCreateInDB(requires=constants.POOL))
        create_pool_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        create_pool = service_group_tasks.PoolCreate(
            requires=[constants.POOL, a10constants.VTHUNDER],
            provides=constants.POOL)
        create_pool_flow.add(*self._get_sess_pers_subflow(create_pool))
        create_pool_flow.add(
            virtual_port_tasks.ListenerUpdateForPool(requires=[
                constants.LOADBALANCER, constants.LISTENER,
                a10constants.VTHUNDER
            ]))
        create_pool_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        create_pool_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        create_pool_flow.add(
            vthunder_tasks.WriteMemory(requires=a10constants.VTHUNDER))

        return create_pool_flow
예제 #8
0
    def get_create_member_flow(self):
        """Create a flow to create a member

        :returns: The flow for creating a member
        """
        create_member_flow = linear_flow.Flow(constants.CREATE_MEMBER_FLOW)
        create_member_flow.add(
            lifecycle_tasks.MemberToErrorOnRevertTask(requires=[
                constants.MEMBER, constants.LISTENERS, constants.LOADBALANCER,
                constants.POOL
            ]))
        create_member_flow.add(
            database_tasks.MarkMemberPendingCreateInDB(
                requires=constants.MEMBER))
        create_member_flow.add(
            network_tasks.CalculateDelta(requires=constants.LOADBALANCER,
                                         provides=constants.DELTAS))
        create_member_flow.add(
            network_tasks.HandleNetworkDeltas(requires=constants.DELTAS,
                                              provides=constants.ADDED_PORTS))
        create_member_flow.add(
            amphora_driver_tasks.AmphoraePostNetworkPlug(
                requires=(constants.LOADBALANCER, constants.ADDED_PORTS)))
        create_member_flow.add(
            amphora_driver_tasks.ListenersUpdate(
                requires=(constants.LOADBALANCER, constants.LISTENERS)))
        create_member_flow.add(
            database_tasks.MarkMemberActiveInDB(requires=constants.MEMBER))
        create_member_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        create_member_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=(constants.LOADBALANCER, constants.LISTENERS)))

        return create_member_flow
예제 #9
0
    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
예제 #10
0
    def get_delete_member_flow(self):
        """Create a flow to delete a member

        :returns: The flow for deleting a member
        """
        delete_member_flow = linear_flow.Flow(constants.DELETE_MEMBER_FLOW)
        delete_member_flow.add(
            lifecycle_tasks.MemberToErrorOnRevertTask(requires=[
                constants.MEMBER, constants.LISTENERS, constants.LOADBALANCER,
                constants.POOL
            ]))
        delete_member_flow.add(
            database_tasks.MarkMemberPendingDeleteInDB(
                requires=constants.MEMBER))
        delete_member_flow.add(
            model_tasks.DeleteModelObject(
                rebind={constants.OBJECT: constants.MEMBER}))
        delete_member_flow.add(
            database_tasks.DeleteMemberInDB(requires=constants.MEMBER))
        delete_member_flow.add(
            amphora_driver_tasks.ListenersUpdate(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        delete_member_flow.add(
            database_tasks.DecrementMemberQuota(requires=constants.MEMBER))
        delete_member_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        delete_member_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))

        return delete_member_flow
예제 #11
0
    def get_update_pool_flow(self):
        """Create a flow to update a pool

        :returns: The flow for updating a pool
        """
        update_pool_flow = linear_flow.Flow(constants.UPDATE_POOL_FLOW)
        update_pool_flow.add(
            lifecycle_tasks.PoolToErrorOnRevertTask(requires=[
                constants.POOL, constants.LISTENERS, constants.LOADBALANCER
            ]))
        update_pool_flow.add(
            database_tasks.MarkPoolPendingUpdateInDB(requires=constants.POOL))
        update_pool_flow.add(
            model_tasks.UpdateAttributes(
                rebind={constants.OBJECT: constants.POOL},
                requires=[constants.UPDATE_DICT]))
        update_pool_flow.add(
            amphora_driver_tasks.ListenersUpdate(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        update_pool_flow.add(
            database_tasks.UpdatePoolInDB(
                requires=[constants.POOL, constants.UPDATE_DICT]))
        update_pool_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        update_pool_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))

        return update_pool_flow
예제 #12
0
    def get_create_health_monitor_flow(self, topology):
        """Create a flow to create a health monitor

        :returns: The flow for creating a health monitor
        """
        create_hm_flow = linear_flow.Flow(constants.CREATE_HEALTH_MONITOR_FLOW)
        create_hm_flow.add(
            lifecycle_tasks.HealthMonitorToErrorOnRevertTask(requires=[
                constants.HEALTH_MON, constants.LISTENERS,
                constants.LOADBALANCER
            ]))
        create_hm_flow.add(
            vthunder_tasks.VthunderInstanceBusy(
                requires=a10constants.COMPUTE_BUSY))

        create_hm_flow.add(
            database_tasks.MarkHealthMonitorPendingCreateInDB(
                requires=constants.HEALTH_MON))
        create_hm_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        if topology == constants.TOPOLOGY_ACTIVE_STANDBY:
            create_hm_flow.add(
                vthunder_tasks.GetMasterVThunder(
                    name=a10constants.GET_MASTER_VTHUNDER,
                    requires=a10constants.VTHUNDER,
                    provides=a10constants.VTHUNDER))
        create_hm_flow.add(
            a10_database_tasks.GetFlavorData(
                rebind={a10constants.LB_RESOURCE: constants.LOADBALANCER},
                provides=constants.FLAVOR))
        create_hm_flow.add(
            health_monitor_tasks.CreateAndAssociateHealthMonitor(requires=[
                constants.LISTENERS, constants.HEALTH_MON,
                a10constants.VTHUNDER, constants.FLAVOR
            ]))
        create_hm_flow.add(
            database_tasks.MarkHealthMonitorActiveInDB(
                requires=constants.HEALTH_MON))
        create_hm_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        create_hm_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        create_hm_flow.add(
            vthunder_tasks.WriteMemory(
                name=a10constants.WRITE_MEM_FOR_LOCAL_PARTITION,
                requires=(a10constants.VTHUNDER)))
        create_hm_flow.add(
            vthunder_tasks.WriteMemory(
                name=a10constants.WRITE_MEM_FOR_SHARED_PARTITION,
                requires=(a10constants.VTHUNDER,
                          a10constants.WRITE_MEM_SHARED_PART)))
        create_hm_flow.add(
            a10_database_tasks.SetThunderUpdatedAt(
                requires=(a10constants.VTHUNDER)))
        return create_hm_flow
예제 #13
0
    def get_rack_vthunder_delete_member_flow(self):
        """Flow to delete a member in Thunder devices

        :returns: The flow for deleting a member
        """
        delete_member_flow = linear_flow.Flow(constants.DELETE_MEMBER_FLOW)
        delete_member_flow.add(
            lifecycle_tasks.MemberToErrorOnRevertTask(requires=[
                constants.MEMBER, constants.LISTENERS, constants.LOADBALANCER,
                constants.POOL
            ]))
        delete_member_flow.add(
            database_tasks.MarkMemberPendingDeleteInDB(
                requires=constants.MEMBER))
        delete_member_flow.add(
            model_tasks.DeleteModelObject(
                rebind={constants.OBJECT: constants.MEMBER}))
        delete_member_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        delete_member_flow.add(
            vthunder_tasks.SetupDeviceNetworkMap(
                requires=a10constants.VTHUNDER,
                provides=a10constants.VTHUNDER))
        delete_member_flow.add(
            a10_database_tasks.CountMembersWithIP(
                requires=constants.MEMBER,
                provides=a10constants.MEMBER_COUNT_IP))
        delete_member_flow.add(
            a10_database_tasks.CountMembersWithIPPortProtocol(
                requires=(constants.MEMBER, constants.POOL),
                provides=a10constants.MEMBER_COUNT_IP_PORT_PROTOCOL))
        delete_member_flow.add(
            server_tasks.MemberDelete(
                requires=(constants.MEMBER, a10constants.VTHUNDER,
                          constants.POOL, a10constants.MEMBER_COUNT_IP,
                          a10constants.MEMBER_COUNT_IP_PORT_PROTOCOL)))
        if CONF.a10_global.network_type == 'vlan':
            delete_member_flow.add(
                vthunder_tasks.DeleteInterfaceTagIfNotInUseForMember(
                    requires=[constants.MEMBER, a10constants.VTHUNDER]))
        # Handle VRID setting
        delete_member_flow.add(self.get_delete_member_vrid_subflow())
        delete_member_flow.add(
            database_tasks.DeleteMemberInDB(requires=constants.MEMBER))
        delete_member_flow.add(
            database_tasks.DecrementMemberQuota(requires=constants.MEMBER))
        delete_member_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        delete_member_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        delete_member_flow.add(
            vthunder_tasks.WriteMemory(requires=a10constants.VTHUNDER))
        return delete_member_flow
예제 #14
0
    def get_rack_vthunder_create_member_flow(self):
        """Create a flow to create a rack vthunder member

        :returns: The flow for creating a rack vthunder member
        """
        create_member_flow = linear_flow.Flow(constants.CREATE_MEMBER_FLOW)
        create_member_flow.add(
            lifecycle_tasks.MemberToErrorOnRevertTask(requires=[
                constants.MEMBER, constants.LISTENERS, constants.LOADBALANCER,
                constants.POOL
            ]))
        create_member_flow.add(
            database_tasks.MarkMemberPendingCreateInDB(
                requires=constants.MEMBER))
        create_member_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        create_member_flow.add(
            vthunder_tasks.SetupDeviceNetworkMap(
                requires=a10constants.VTHUNDER,
                provides=a10constants.VTHUNDER))
        create_member_flow.add(self.handle_vrid_for_member_subflow())
        if CONF.a10_global.network_type == 'vlan':
            create_member_flow.add(
                vthunder_tasks.TagInterfaceForMember(
                    requires=[constants.MEMBER, a10constants.VTHUNDER]))
        create_member_flow.add(
            a10_database_tasks.CountMembersWithIP(
                requires=constants.MEMBER,
                provides=a10constants.MEMBER_COUNT_IP))
        create_member_flow.add(
            a10_database_tasks.GetFlavorData(
                rebind={a10constants.LB_RESOURCE: constants.LOADBALANCER},
                provides=constants.FLAVOR))
        create_member_flow.add(self.get_create_member_snat_pool_subflow())
        create_member_flow.add(
            server_tasks.MemberCreate(requires=(constants.MEMBER,
                                                a10constants.VTHUNDER,
                                                constants.POOL,
                                                a10constants.MEMBER_COUNT_IP,
                                                constants.FLAVOR)))
        create_member_flow.add(
            database_tasks.MarkMemberActiveInDB(requires=constants.MEMBER))
        create_member_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        create_member_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=(constants.LOADBALANCER, constants.LISTENERS)))
        create_member_flow.add(
            vthunder_tasks.WriteMemory(requires=a10constants.VTHUNDER))
        create_member_flow.add(
            a10_database_tasks.SetThunderUpdatedAt(
                requires=a10constants.VTHUNDER))
        return create_member_flow
예제 #15
0
    def get_rack_vthunder_update_member_flow(self):
        """Flow to update a member in Thunder devices

        :returns: The flow for updating a member
        """
        update_member_flow = linear_flow.Flow(constants.UPDATE_MEMBER_FLOW)
        update_member_flow.add(
            lifecycle_tasks.MemberToErrorOnRevertTask(requires=[
                constants.MEMBER, constants.LISTENERS, constants.LOADBALANCER,
                constants.POOL
            ]))
        update_member_flow.add(
            database_tasks.MarkMemberPendingUpdateInDB(
                requires=constants.MEMBER))
        update_member_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        update_member_flow.add(
            vthunder_tasks.SetupDeviceNetworkMap(
                requires=a10constants.VTHUNDER,
                provides=a10constants.VTHUNDER))
        # Handle VRID settings
        update_member_flow.add(self.handle_vrid_for_member_subflow())
        update_member_flow.add(
            a10_database_tasks.GetFlavorData(
                rebind={a10constants.LB_RESOURCE: constants.LOADBALANCER},
                provides=constants.FLAVOR))
        update_member_flow.add(
            server_tasks.MemberUpdate(requires=(constants.MEMBER,
                                                a10constants.VTHUNDER,
                                                constants.POOL,
                                                constants.FLAVOR)))
        update_member_flow.add(
            database_tasks.UpdateMemberInDB(
                requires=[constants.MEMBER, constants.UPDATE_DICT]))
        if CONF.a10_global.network_type == 'vlan':
            update_member_flow.add(
                vthunder_tasks.TagInterfaceForMember(
                    requires=[constants.MEMBER, a10constants.VTHUNDER]))
        update_member_flow.add(
            database_tasks.MarkMemberActiveInDB(requires=constants.MEMBER))
        update_member_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        update_member_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        update_member_flow.add(
            vthunder_tasks.WriteMemory(requires=a10constants.VTHUNDER))
        update_member_flow.add(
            a10_database_tasks.SetThunderUpdatedAt(
                requires=a10constants.VTHUNDER))
        return update_member_flow
예제 #16
0
    def get_delete_member_flow(self):
        """Flow to delete a member on VThunder

        :returns: The flow for deleting a member
        """
        delete_member_flow = linear_flow.Flow(constants.DELETE_MEMBER_FLOW)
        delete_member_flow.add(
            lifecycle_tasks.MemberToErrorOnRevertTask(requires=[
                constants.MEMBER, constants.LISTENERS, constants.LOADBALANCER,
                constants.POOL
            ]))
        delete_member_flow.add(
            database_tasks.MarkMemberPendingDeleteInDB(
                requires=constants.MEMBER))
        delete_member_flow.add(
            model_tasks.DeleteModelObject(
                rebind={constants.OBJECT: constants.MEMBER}))
        delete_member_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        delete_member_flow.add(
            a10_database_tasks.CountMembersWithIP(
                requires=constants.MEMBER,
                provides=a10constants.MEMBER_COUNT_IP))
        delete_member_flow.add(
            a10_database_tasks.CountMembersWithIPPortProtocol(
                requires=(constants.MEMBER, constants.POOL),
                provides=a10constants.MEMBER_COUNT_IP_PORT_PROTOCOL))
        delete_member_flow.add(
            a10_database_tasks.GetFlavorData(
                rebind={a10constants.LB_RESOURCE: constants.LOADBALANCER},
                provides=constants.FLAVOR))
        delete_member_flow.add(
            server_tasks.MemberDelete(
                requires=(constants.MEMBER, a10constants.VTHUNDER,
                          constants.POOL, a10constants.MEMBER_COUNT_IP,
                          a10constants.MEMBER_COUNT_IP_PORT_PROTOCOL)))
        delete_member_flow.add(
            database_tasks.DeleteMemberInDB(requires=constants.MEMBER))
        delete_member_flow.add(
            database_tasks.DecrementMemberQuota(requires=constants.MEMBER))
        delete_member_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        delete_member_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        delete_member_flow.add(
            vthunder_tasks.WriteMemory(requires=a10constants.VTHUNDER))
        delete_member_flow.add(
            a10_database_tasks.SetThunderUpdatedAt(
                requires=a10constants.VTHUNDER))
        return delete_member_flow
    def get_delete_member_flow(self):
        """Create a flow to delete a member

        :returns: The flow for deleting a member
        """
        delete_member_flow = linear_flow.Flow(constants.DELETE_MEMBER_FLOW)
        delete_member_flow.add(
            a10_database_tasks.CountMembersInProject(
                requires=constants.MEMBER, provides=a10constants.MEMBER_COUNT))
        delete_member_flow.add(
            lifecycle_tasks.MemberToErrorOnRevertTask(requires=[
                constants.MEMBER, constants.LISTENERS, constants.LOADBALANCER,
                constants.POOL
            ]))
        delete_member_flow.add(
            database_tasks.MarkMemberPendingDeleteInDB(
                requires=constants.MEMBER))
        delete_member_flow.add(
            model_tasks.DeleteModelObject(
                rebind={constants.OBJECT: constants.MEMBER}))
        delete_member_flow.add(
            database_tasks.DeleteMemberInDB(requires=constants.MEMBER))
        delete_member_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        delete_member_flow.add(
            server_tasks.MemberDelete(requires=(constants.MEMBER,
                                                a10constants.VTHUNDER,
                                                constants.POOL)))
        delete_member_flow.add(
            database_tasks.DecrementMemberQuota(requires=constants.MEMBER))
        delete_member_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        delete_member_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        delete_member_flow.add(
            a10_database_tasks.GetVRIDForProjectMember(
                requires=constants.MEMBER, provides=a10constants.VRID))
        delete_member_flow.add(
            a10_network_tasks.DeleteMemberVRIDPort(
                requires=[
                    a10constants.VTHUNDER, a10constants.VRID,
                    a10constants.MEMBER_COUNT
                ],
                provides=a10constants.DELETE_VRID))
        delete_member_flow.add(
            a10_database_tasks.DeleteVRIDEntry(
                requires=[a10constants.VRID, a10constants.DELETE_VRID]))

        return delete_member_flow
예제 #18
0
    def get_update_health_monitor_flow(self):
        """Create a flow to update a health monitor

        :returns: The flow for updating a health monitor
        """
        update_hm_flow = linear_flow.Flow(constants.UPDATE_HEALTH_MONITOR_FLOW)
        update_hm_flow.add(
            lifecycle_tasks.HealthMonitorToErrorOnRevertTask(requires=[
                constants.HEALTH_MON, constants.LISTENERS,
                constants.LOADBALANCER
            ]))
        update_hm_flow.add(
            database_tasks.MarkHealthMonitorPendingUpdateInDB(
                requires=constants.HEALTH_MON))
        update_hm_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        update_hm_flow.add(
            a10_database_tasks.GetFlavorData(
                rebind={a10constants.LB_RESOURCE: constants.LOADBALANCER},
                provides=constants.FLAVOR))
        update_hm_flow.add(
            health_monitor_tasks.UpdateHealthMonitor(requires=[
                constants.LISTENERS, constants.HEALTH_MON,
                a10constants.VTHUNDER, constants.UPDATE_DICT, constants.FLAVOR
            ]))
        update_hm_flow.add(
            database_tasks.UpdateHealthMonInDB(
                requires=[constants.HEALTH_MON, constants.UPDATE_DICT]))
        update_hm_flow.add(
            database_tasks.MarkHealthMonitorActiveInDB(
                requires=constants.HEALTH_MON))
        update_hm_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        update_hm_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        update_hm_flow.add(
            vthunder_tasks.WriteMemory(
                name=a10constants.WRITE_MEM_FOR_LOCAL_PARTITION,
                requires=(a10constants.VTHUNDER)))
        update_hm_flow.add(
            vthunder_tasks.WriteMemory(
                name=a10constants.WRITE_MEM_FOR_SHARED_PARTITION,
                requires=(a10constants.VTHUNDER,
                          a10constants.WRITE_MEM_SHARED_PART)))
        update_hm_flow.add(
            a10_database_tasks.SetThunderUpdatedAt(
                requires=(a10constants.VTHUNDER)))
        return update_hm_flow
    def get_update_member_flow(self):
        """Create a flow to update a member

        :returns: The flow for updating a member
        """
        update_member_flow = linear_flow.Flow(constants.UPDATE_MEMBER_FLOW)
        update_member_flow.add(
            lifecycle_tasks.MemberToErrorOnRevertTask(requires=[
                constants.MEMBER, constants.LISTENERS, constants.LOADBALANCER,
                constants.POOL
            ]))
        update_member_flow.add(
            database_tasks.MarkMemberPendingUpdateInDB(
                requires=constants.MEMBER))
        update_member_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        # Handle VRID settings
        update_member_flow.add(
            a10_database_tasks.GetVRIDForProjectMember(
                requires=constants.MEMBER, provides=a10constants.VRID))
        update_member_flow.add(
            a10_network_tasks.HandleVRIDFloatingIP(requires=[
                constants.MEMBER, a10constants.VTHUNDER, a10constants.VRID
            ],
                                                   provides=a10constants.PORT))
        update_member_flow.add(
            a10_database_tasks.UpdateVRIDForProjectMember(requires=[
                constants.MEMBER, a10constants.VRID, a10constants.PORT
            ]))

        update_member_flow.add(
            server_tasks.MemberUpdate(requires=(constants.MEMBER,
                                                a10constants.VTHUNDER)))
        update_member_flow.add(
            database_tasks.UpdateMemberInDB(
                requires=[constants.MEMBER, constants.UPDATE_DICT]))
        update_member_flow.add(
            database_tasks.MarkMemberActiveInDB(requires=constants.MEMBER))
        update_member_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        update_member_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))

        return update_member_flow
예제 #20
0
    def get_update_member_flow(self, topology):
        """Flow to update a member

        :returns: The flow for updating a member
        """
        update_member_flow = linear_flow.Flow(constants.UPDATE_MEMBER_FLOW)
        update_member_flow.add(lifecycle_tasks.MemberToErrorOnRevertTask(
            requires=[constants.MEMBER,
                      constants.LISTENERS,
                      constants.LOADBALANCER,
                      constants.POOL]))
        update_member_flow.add(vthunder_tasks.VthunderInstanceBusy(
            requires=a10constants.COMPUTE_BUSY))

        update_member_flow.add(database_tasks.MarkMemberPendingUpdateInDB(
            requires=constants.MEMBER))
        update_member_flow.add(a10_database_tasks.GetVThunderByLoadBalancer(
            requires=constants.LOADBALANCER,
            provides=a10constants.VTHUNDER))
        if topology == constants.TOPOLOGY_ACTIVE_STANDBY:
            update_member_flow.add(vthunder_tasks.GetMasterVThunder(
                name=a10constants.GET_MASTER_VTHUNDER,
                requires=a10constants.VTHUNDER,
                provides=a10constants.VTHUNDER))
        update_member_flow.add(self.handle_vrid_for_member_subflow())
        update_member_flow.add(a10_database_tasks.GetFlavorData(
            rebind={a10constants.LB_RESOURCE: constants.LOADBALANCER},
            provides=constants.FLAVOR))
        update_member_flow.add(server_tasks.MemberUpdate(
            requires=(constants.MEMBER, a10constants.VTHUNDER,
                      constants.POOL, constants.FLAVOR)))
        update_member_flow.add(database_tasks.UpdateMemberInDB(
            requires=[constants.MEMBER, constants.UPDATE_DICT]))
        update_member_flow.add(database_tasks.MarkMemberActiveInDB(
            requires=constants.MEMBER))
        update_member_flow.add(database_tasks.MarkPoolActiveInDB(
            requires=constants.POOL))
        update_member_flow.add(database_tasks.
                               MarkLBAndListenersActiveInDB(
                                   requires=[constants.LOADBALANCER,
                                             constants.LISTENERS]))
        update_member_flow.add(vthunder_tasks.WriteMemory(
            requires=a10constants.VTHUNDER))
        update_member_flow.add(a10_database_tasks.SetThunderUpdatedAt(
            requires=a10constants.VTHUNDER))
        return update_member_flow
예제 #21
0
    def get_update_pool_flow(self, topology):
        """Create a flow to update a pool

        :returns: The flow for updating a pool
        """
        update_pool_flow = linear_flow.Flow(constants.UPDATE_POOL_FLOW)
        update_pool_flow.add(lifecycle_tasks.PoolToErrorOnRevertTask(
            requires=[constants.POOL,
                      constants.LISTENERS,
                      constants.LOADBALANCER]))
        update_pool_flow.add(vthunder_tasks.VthunderInstanceBusy(
            requires=a10constants.COMPUTE_BUSY))

        update_pool_flow.add(database_tasks.MarkPoolPendingUpdateInDB(
            requires=constants.POOL))
        update_pool_flow.add(a10_database_tasks.GetVThunderByLoadBalancer(
            requires=constants.LOADBALANCER,
            provides=a10constants.VTHUNDER))
        if topology == constants.TOPOLOGY_ACTIVE_STANDBY:
            update_pool_flow.add(vthunder_tasks.GetMasterVThunder(
                name=a10constants.GET_MASTER_VTHUNDER,
                requires=a10constants.VTHUNDER,
                provides=a10constants.VTHUNDER))
        update_pool_flow.add(a10_database_tasks.GetFlavorData(
            rebind={a10constants.LB_RESOURCE: constants.POOL},
            provides=constants.FLAVOR))
        update_pool = service_group_tasks.PoolUpdate(
            requires=[constants.POOL, a10constants.VTHUNDER,
                      constants.UPDATE_DICT, constants.FLAVOR],
            provides=constants.POOL)
        update_pool_flow.add(*self._get_sess_pers_subflow(update_pool))
        update_pool_flow.add(virtual_port_tasks.ListenerUpdateForPool(
            requires=[constants.LOADBALANCER, constants.LISTENER, a10constants.VTHUNDER]))
        update_pool_flow.add(database_tasks.UpdatePoolInDB(
            requires=[constants.POOL, constants.UPDATE_DICT]))
        update_pool_flow.add(database_tasks.MarkPoolActiveInDB(
            requires=constants.POOL))
        update_pool_flow.add(database_tasks.MarkLBAndListenersActiveInDB(
            requires=[constants.LOADBALANCER, constants.LISTENERS]))
        update_pool_flow.add(vthunder_tasks.WriteMemory(
            requires=a10constants.VTHUNDER))
        update_pool_flow.add(a10_database_tasks.SetThunderUpdatedAt(
            requires=a10constants.VTHUNDER))

        return update_pool_flow
예제 #22
0
    def get_create_pool_flow(self):
        """Create a flow to create a pool

        :returns: The flow for creating a pool
        """
        create_pool_flow = linear_flow.Flow(constants.CREATE_POOL_FLOW)
        create_pool_flow.add(lifecycle_tasks.PoolToErrorOnRevertTask(
            requires=[constants.POOL,
                      constants.LISTENERS,
                      constants.LOADBALANCER]))
        create_pool_flow.add(database_tasks.MarkPoolPendingCreateInDB(
            requires=constants.POOL))
        create_pool_flow.add(amphora_driver_tasks.ListenersUpdate(
            requires=[constants.LOADBALANCER, constants.LISTENERS]))
        create_pool_flow.add(database_tasks.MarkPoolActiveInDB(
            requires=constants.POOL))
        create_pool_flow.add(database_tasks.MarkLBAndListenersActiveInDB(
            requires=[constants.LOADBALANCER, constants.LISTENERS]))

        return create_pool_flow
예제 #23
0
    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
예제 #24
0
    def get_create_member_flow(self, topology):
        """Create a flow to create a member

        :returns: The flow for creating a member
        """
        create_member_flow = linear_flow.Flow(constants.CREATE_MEMBER_FLOW)
        create_member_flow.add(
            lifecycle_tasks.MemberToErrorOnRevertTask(requires=[
                constants.MEMBER, constants.LISTENERS, constants.LOADBALANCER,
                constants.POOL
            ]))
        create_member_flow.add(
            database_tasks.MarkMemberPendingCreateInDB(
                requires=constants.MEMBER))
        create_member_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        create_member_flow.add(
            a10_database_tasks.GetLoadBalancerListByProjectID(
                requires=a10constants.VTHUNDER,
                provides=a10constants.LOADBALANCERS_LIST))
        create_member_flow.add(
            database_tasks.GetAmphoraeFromLoadbalancer(
                requires=constants.LOADBALANCER, provides=constants.AMPHORA))
        create_member_flow.add(
            a10_network_tasks.CalculateDelta(
                requires=(constants.LOADBALANCER,
                          a10constants.LOADBALANCERS_LIST),
                provides=constants.DELTAS))
        create_member_flow.add(
            a10_network_tasks.HandleNetworkDeltas(
                requires=constants.DELTAS, provides=constants.ADDED_PORTS))
        # managing interface additions here
        create_member_flow.add(
            vthunder_tasks.AmphoraePostMemberNetworkPlug(
                requires=(constants.LOADBALANCER, constants.ADDED_PORTS,
                          a10constants.VTHUNDER)))
        create_member_flow.add(
            vthunder_tasks.VThunderComputeConnectivityWait(
                requires=(a10constants.VTHUNDER, constants.AMPHORA)))
        create_member_flow.add(
            vthunder_tasks.EnableInterfaceForMembers(requires=[
                constants.ADDED_PORTS, constants.LOADBALANCER,
                a10constants.VTHUNDER
            ]))
        create_member_flow.add(self.handle_vrid_for_member_subflow())
        # configure member flow for HA
        if topology == constants.TOPOLOGY_ACTIVE_STANDBY:
            create_member_flow.add(
                a10_database_tasks.GetBackupVThunderByLoadBalancer(
                    name="get_backup_vThunder",
                    requires=constants.LOADBALANCER,
                    provides=a10constants.BACKUP_VTHUNDER))
            create_member_flow.add(
                vthunder_tasks.AmphoraePostMemberNetworkPlug(
                    name="backup_amphora_network_plug",
                    requires=[constants.ADDED_PORTS, constants.LOADBALANCER],
                    rebind={
                        a10constants.VTHUNDER: a10constants.BACKUP_VTHUNDER
                    }))
            create_member_flow.add(
                vthunder_tasks.VThunderComputeConnectivityWait(
                    name="backup_compute_conn_wait",
                    requires=constants.AMPHORA,
                    rebind={
                        a10constants.VTHUNDER: a10constants.BACKUP_VTHUNDER
                    }))
            create_member_flow.add(
                vthunder_tasks.EnableInterfaceForMembers(
                    name="backup_enable_interface",
                    requires=[constants.ADDED_PORTS, constants.LOADBALANCER],
                    rebind={
                        a10constants.VTHUNDER: a10constants.BACKUP_VTHUNDER
                    }))

        create_member_flow.add(
            a10_database_tasks.CountMembersWithIP(
                requires=constants.MEMBER,
                provides=a10constants.MEMBER_COUNT_IP))
        create_member_flow.add(
            a10_database_tasks.GetFlavorData(
                rebind={a10constants.LB_RESOURCE: constants.LOADBALANCER},
                provides=constants.FLAVOR))
        create_member_flow.add(self.get_create_member_snat_pool_subflow())
        create_member_flow.add(
            server_tasks.MemberCreate(requires=(constants.MEMBER,
                                                a10constants.VTHUNDER,
                                                constants.POOL,
                                                a10constants.MEMBER_COUNT_IP,
                                                constants.FLAVOR)))
        create_member_flow.add(
            database_tasks.MarkMemberActiveInDB(requires=constants.MEMBER))
        create_member_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        create_member_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=(constants.LOADBALANCER, constants.LISTENERS)))
        create_member_flow.add(
            vthunder_tasks.WriteMemory(requires=a10constants.VTHUNDER))
        create_member_flow.add(
            a10_database_tasks.SetThunderUpdatedAt(
                requires=a10constants.VTHUNDER))
        return create_member_flow
예제 #25
0
    def get_delete_member_flow(self, topology):
        """Flow to delete a member on VThunder

        :returns: The flow for deleting a member
        """
        delete_member_flow = linear_flow.Flow(constants.DELETE_MEMBER_FLOW)
        delete_member_flow.add(lifecycle_tasks.MemberToErrorOnRevertTask(
            requires=[constants.MEMBER,
                      constants.LISTENERS,
                      constants.LOADBALANCER,
                      constants.POOL]))
        delete_member_flow.add(vthunder_tasks.VthunderInstanceBusy(
            requires=a10constants.COMPUTE_BUSY))

        delete_member_flow.add(database_tasks.MarkMemberPendingDeleteInDB(
            requires=constants.MEMBER))
        delete_member_flow.add(model_tasks.
                               DeleteModelObject(rebind={constants.OBJECT:
                                                         constants.MEMBER}))
        delete_member_flow.add(database_tasks.GetAmphoraeFromLoadbalancer(
            requires=constants.LOADBALANCER,
            provides=constants.AMPHORA))
        delete_member_flow.add(a10_database_tasks.GetVThunderByLoadBalancer(
            requires=constants.LOADBALANCER,
            provides=a10constants.VTHUNDER))
        delete_member_flow.add(a10_database_tasks.CountMembersWithIP(
            requires=constants.MEMBER, provides=a10constants.MEMBER_COUNT_IP))
        delete_member_flow.add(
            a10_database_tasks.CountMembersWithIPPortProtocol(
                requires=(
                    constants.MEMBER,
                    constants.POOL),
                provides=a10constants.MEMBER_COUNT_IP_PORT_PROTOCOL))
        delete_member_flow.add(a10_database_tasks.GetFlavorData(
            rebind={a10constants.LB_RESOURCE: constants.LOADBALANCER},
            provides=constants.FLAVOR))
        delete_member_flow.add(a10_database_tasks.GetLoadBalancerListByProjectID(
            requires=a10constants.VTHUNDER,
            provides=a10constants.LOADBALANCERS_LIST))
        delete_member_flow.add(a10_network_tasks.CalculateDelta(
            requires=(constants.LOADBALANCER, a10constants.LOADBALANCERS_LIST),
            provides=constants.DELTAS))
        delete_member_flow.add(a10_network_tasks.HandleNetworkDeltas(
            requires=constants.DELTAS, provides=constants.ADDED_PORTS))
        delete_member_flow.add(
            vthunder_tasks.AmphoraePostNetworkUnplug(
                requires=(
                    constants.LOADBALANCER,
                    constants.ADDED_PORTS,
                    a10constants.VTHUNDER)))
        delete_member_flow.add(vthunder_tasks.VThunderComputeConnectivityWait(
            name=a10constants.VTHUNDER_CONNECTIVITY_WAIT,
            requires=(a10constants.VTHUNDER, constants.AMPHORA)))
        if topology == constants.TOPOLOGY_ACTIVE_STANDBY:
            delete_member_flow.add(
                a10_database_tasks.GetBackupVThunderByLoadBalancer(
                    name=a10constants.GET_BACKUP_VTHUNDER_BY_LB,
                    requires=(constants.LOADBALANCER, a10constants.VTHUNDER),
                    provides=a10constants.BACKUP_VTHUNDER))
            delete_member_flow.add(
                vthunder_tasks.VThunderComputeConnectivityWait(
                    name=a10constants.BACKUP_CONNECTIVITY_WAIT + "-before-unplug",
                    requires=constants.AMPHORA,
                    rebind={a10constants.VTHUNDER: a10constants.BACKUP_VTHUNDER}))
            delete_member_flow.add(
                vthunder_tasks.AmphoraePostNetworkUnplug(
                    name=a10constants.AMPHORA_POST_NETWORK_UNPLUG_FOR_BACKUP_VTHUNDER,
                    requires=(constants.LOADBALANCER, constants.ADDED_PORTS),
                    rebind={a10constants.VTHUNDER: a10constants.BACKUP_VTHUNDER}))
            delete_member_flow.add(
                vthunder_tasks.VThunderComputeConnectivityWait(
                    name=a10constants.BACKUP_CONNECTIVITY_WAIT,
                    requires=constants.AMPHORA,
                    rebind={a10constants.VTHUNDER: a10constants.BACKUP_VTHUNDER}))
            delete_member_flow.add(vthunder_tasks.VCSSyncWait(
                name='member-unplug-' + a10constants.VCS_SYNC_WAIT,
                requires=a10constants.VTHUNDER))
            delete_member_flow.add(vthunder_tasks.GetMasterVThunder(
                name=a10constants.GET_VTHUNDER_MASTER,
                requires=a10constants.VTHUNDER,
                provides=a10constants.VTHUNDER))
        delete_member_flow.add(server_tasks.MemberFindNatPool(
            requires=[constants.MEMBER, a10constants.VTHUNDER, constants.POOL,
                      constants.FLAVOR], provides=a10constants.NAT_FLAVOR))
        delete_member_flow.add(a10_database_tasks.GetNatPoolEntry(
            requires=[constants.MEMBER, a10constants.NAT_FLAVOR],
            provides=a10constants.NAT_POOL))
        delete_member_flow.add(a10_network_tasks.ReleaseSubnetAddressForMember(
            requires=[constants.MEMBER, a10constants.NAT_FLAVOR, a10constants.NAT_POOL]))
        delete_member_flow.add(a10_database_tasks.DeleteNatPoolEntry(
            requires=a10constants.NAT_POOL))
        delete_member_flow.add(
            server_tasks.MemberDelete(
                requires=(
                    constants.MEMBER,
                    a10constants.VTHUNDER,
                    constants.POOL,
                    a10constants.MEMBER_COUNT_IP,
                    a10constants.MEMBER_COUNT_IP_PORT_PROTOCOL)))
        delete_member_flow.add(self.get_delete_member_vrid_subflow())
        delete_member_flow.add(database_tasks.DeleteMemberInDB(
            requires=constants.MEMBER))
        delete_member_flow.add(database_tasks.DecrementMemberQuota(
            requires=constants.MEMBER))
        delete_member_flow.add(database_tasks.MarkPoolActiveInDB(
            requires=constants.POOL))
        delete_member_flow.add(database_tasks.MarkLBAndListenersActiveInDB(
            requires=[constants.LOADBALANCER, constants.LISTENERS]))
        delete_member_flow.add(vthunder_tasks.WriteMemory(
            requires=a10constants.VTHUNDER))
        delete_member_flow.add(a10_database_tasks.SetThunderUpdatedAt(
            requires=a10constants.VTHUNDER))
        return delete_member_flow
예제 #26
0
    def get_delete_member_flow(self):
        """Flow to delete a member on VThunder

        :returns: The flow for deleting a member
        """
        delete_member_flow = linear_flow.Flow(constants.DELETE_MEMBER_FLOW)
        delete_member_flow.add(
            lifecycle_tasks.MemberToErrorOnRevertTask(requires=[
                constants.MEMBER, constants.LISTENERS, constants.LOADBALANCER,
                constants.POOL
            ]))
        delete_member_flow.add(
            database_tasks.MarkMemberPendingDeleteInDB(
                requires=constants.MEMBER))
        delete_member_flow.add(
            model_tasks.DeleteModelObject(
                rebind={constants.OBJECT: constants.MEMBER}))
        delete_member_flow.add(
            database_tasks.GetAmphoraeFromLoadbalancer(
                requires=constants.LOADBALANCER, provides=constants.AMPHORA))
        delete_member_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        delete_member_flow.add(
            a10_database_tasks.CountMembersWithIP(
                requires=constants.MEMBER,
                provides=a10constants.MEMBER_COUNT_IP))
        delete_member_flow.add(
            a10_database_tasks.CountMembersWithIPPortProtocol(
                requires=(constants.MEMBER, constants.POOL),
                provides=a10constants.MEMBER_COUNT_IP_PORT_PROTOCOL))
        delete_member_flow.add(
            a10_database_tasks.GetFlavorData(
                rebind={a10constants.LB_RESOURCE: constants.LOADBALANCER},
                provides=constants.FLAVOR))
        delete_member_flow.add(
            database_tasks.DeleteMemberInDB(requires=constants.MEMBER))
        delete_member_flow.add(
            a10_database_tasks.GetLoadBalancerListByProjectID(
                requires=a10constants.VTHUNDER,
                provides=a10constants.LOADBALANCERS_LIST))
        delete_member_flow.add(
            a10_network_tasks.CalculateDelta(
                requires=(constants.LOADBALANCER,
                          a10constants.LOADBALANCERS_LIST),
                provides=constants.DELTAS))
        delete_member_flow.add(
            a10_network_tasks.HandleNetworkDeltas(
                requires=constants.DELTAS, provides=constants.ADDED_PORTS))
        delete_member_flow.add(
            vthunder_tasks.AmphoraePostNetworkUnplug(
                requires=(constants.LOADBALANCER, constants.ADDED_PORTS,
                          a10constants.VTHUNDER)))
        delete_member_flow.add(
            vthunder_tasks.VThunderComputeConnectivityWait(
                requires=(a10constants.VTHUNDER, constants.AMPHORA)))
        delete_member_flow.add(
            server_tasks.MemberFindNatPool(requires=[
                constants.MEMBER, a10constants.VTHUNDER, constants.POOL,
                constants.FLAVOR
            ],
                                           provides=a10constants.NAT_FLAVOR))
        delete_member_flow.add(
            a10_database_tasks.GetNatPoolEntry(
                requires=[constants.MEMBER, a10constants.NAT_FLAVOR],
                provides=a10constants.NAT_POOL))
        delete_member_flow.add(
            a10_network_tasks.ReleaseSubnetAddressForMember(requires=[
                constants.MEMBER, a10constants.NAT_FLAVOR,
                a10constants.NAT_POOL
            ]))
        delete_member_flow.add(
            a10_database_tasks.DeleteNatPoolEntry(
                requires=a10constants.NAT_POOL))
        delete_member_flow.add(
            server_tasks.MemberDelete(
                requires=(constants.MEMBER, a10constants.VTHUNDER,
                          constants.POOL, a10constants.MEMBER_COUNT_IP,
                          a10constants.MEMBER_COUNT_IP_PORT_PROTOCOL)))
        delete_member_flow.add(self.get_delete_member_vrid_subflow())
        delete_member_flow.add(
            database_tasks.DecrementMemberQuota(requires=constants.MEMBER))
        delete_member_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        delete_member_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        delete_member_flow.add(
            vthunder_tasks.WriteMemory(requires=a10constants.VTHUNDER))
        delete_member_flow.add(
            a10_database_tasks.SetThunderUpdatedAt(
                requires=a10constants.VTHUNDER))
        return delete_member_flow
예제 #27
0
    def get_create_member_flow(self, topology):
        """Create a flow to create a member

        :returns: The flow for creating a member
        """
        create_member_flow = linear_flow.Flow(constants.CREATE_MEMBER_FLOW)
        create_member_flow.add(lifecycle_tasks.MemberToErrorOnRevertTask(
            requires=[constants.MEMBER,
                      constants.LISTENERS,
                      constants.LOADBALANCER,
                      constants.POOL]))
        create_member_flow.add(vthunder_tasks.VthunderInstanceBusy(
            requires=a10constants.COMPUTE_BUSY))

        create_member_flow.add(database_tasks.MarkMemberPendingCreateInDB(
            requires=constants.MEMBER))
        create_member_flow.add(a10_database_tasks.GetVThunderByLoadBalancer(
            requires=constants.LOADBALANCER,
            provides=a10constants.VTHUNDER))
        create_member_flow.add(a10_database_tasks.GetLoadBalancerListByProjectID(
            requires=a10constants.VTHUNDER,
            provides=a10constants.LOADBALANCERS_LIST))
        create_member_flow.add(database_tasks.GetAmphoraeFromLoadbalancer(
            requires=constants.LOADBALANCER,
            provides=constants.AMPHORA))
        create_member_flow.add(a10_network_tasks.CalculateDelta(
            requires=(constants.LOADBALANCER, a10constants.LOADBALANCERS_LIST),
            provides=constants.DELTAS))
        create_member_flow.add(a10_network_tasks.HandleNetworkDeltas(
            requires=constants.DELTAS, provides=constants.ADDED_PORTS))
        # managing interface additions here
        if topology == constants.TOPOLOGY_SINGLE:
            create_member_flow.add(
                vthunder_tasks.AmphoraePostMemberNetworkPlug(
                    requires=(
                        constants.LOADBALANCER,
                        constants.ADDED_PORTS,
                        a10constants.VTHUNDER)))
            create_member_flow.add(vthunder_tasks.VThunderComputeConnectivityWait(
                name=a10constants.VTHUNDER_CONNECTIVITY_WAIT,
                requires=(a10constants.VTHUNDER, constants.AMPHORA)))
            create_member_flow.add(
                vthunder_tasks.EnableInterfaceForMembers(
                    requires=[
                        constants.ADDED_PORTS,
                        constants.LOADBALANCER,
                        a10constants.VTHUNDER]))
        # configure member flow for HA
        if topology == constants.TOPOLOGY_ACTIVE_STANDBY:
            create_member_flow.add(
                a10_database_tasks.GetBackupVThunderByLoadBalancer(
                    name="get_backup_vThunder",
                    requires=(constants.LOADBALANCER, a10constants.VTHUNDER),
                    provides=a10constants.BACKUP_VTHUNDER))
            create_member_flow.add(vthunder_tasks.VThunderComputeConnectivityWait(
                name="backup_compute_conn_wait_before_probe_device",
                requires=constants.AMPHORA,
                rebind={a10constants.VTHUNDER: a10constants.BACKUP_VTHUNDER}))
            create_member_flow.add(vthunder_tasks.VCSSyncWait(
                name="vcs_sync_wait_before_probe_device",
                requires=a10constants.VTHUNDER))
            create_member_flow.add(
                vthunder_tasks.AmphoraePostMemberNetworkPlug(
                    requires=(
                        constants.LOADBALANCER,
                        constants.ADDED_PORTS,
                        a10constants.VTHUNDER)))
            create_member_flow.add(
                vthunder_tasks.AmphoraePostMemberNetworkPlug(
                    name="backup_amphora_network_plug", requires=[
                        constants.ADDED_PORTS, constants.LOADBALANCER], rebind={
                        a10constants.VTHUNDER: a10constants.BACKUP_VTHUNDER}))
            create_member_flow.add(vthunder_tasks.VThunderComputeConnectivityWait(
                name=a10constants.MASTER_CONNECTIVITY_WAIT,
                requires=(a10constants.VTHUNDER, constants.AMPHORA)))
            create_member_flow.add(vthunder_tasks.VThunderComputeConnectivityWait(
                name=a10constants.BACKUP_CONNECTIVITY_WAIT,
                requires=constants.AMPHORA,
                rebind={a10constants.VTHUNDER: a10constants.BACKUP_VTHUNDER}))
            create_member_flow.add(vthunder_tasks.VCSSyncWait(
                name="backup-plug-wait-vcs-ready",
                requires=a10constants.VTHUNDER))
            create_member_flow.add(vthunder_tasks.GetMasterVThunder(
                name=a10constants.GET_MASTER_VTHUNDER,
                requires=a10constants.VTHUNDER,
                provides=a10constants.VTHUNDER))
            create_member_flow.add(a10_database_tasks.GetBackupVThunderByLoadBalancer(
                name="get_backup_vThunder_after_get_master",
                requires=(constants.LOADBALANCER, a10constants.VTHUNDER),
                provides=a10constants.BACKUP_VTHUNDER))
            create_member_flow.add(
                vthunder_tasks.EnableInterfaceForMembers(
                    name=a10constants.ENABLE_MASTER_VTHUNDER_INTERFACE,
                    requires=[
                        constants.ADDED_PORTS,
                        constants.LOADBALANCER,
                        a10constants.VTHUNDER]))
            create_member_flow.add(vthunder_tasks.AmphoraePostMemberNetworkPlug(
                name="amphorae-post-member-network-plug-for-master",
                requires=(constants.LOADBALANCER, constants.ADDED_PORTS,
                          a10constants.VTHUNDER)))
            create_member_flow.add(
                vthunder_tasks.VThunderComputeConnectivityWait(
                    name=a10constants.CONNECTIVITY_WAIT_FOR_MASTER_VTHUNDER,
                    requires=(a10constants.VTHUNDER, constants.AMPHORA)))
            create_member_flow.add(
                vthunder_tasks.VThunderComputeConnectivityWait(
                    name=a10constants.CONNECTIVITY_WAIT_FOR_BACKUP_VTHUNDER,
                    rebind={
                        a10constants.VTHUNDER: a10constants.BACKUP_VTHUNDER},
                    requires=constants.AMPHORA))
            create_member_flow.add(vthunder_tasks.VCSSyncWait(
                name="member_enable_interface_vcs_sync_wait",
                requires=a10constants.VTHUNDER))
            create_member_flow.add(vthunder_tasks.GetMasterVThunder(
                name=a10constants.GET_VTHUNDER_MASTER,
                requires=a10constants.VTHUNDER,
                provides=a10constants.VTHUNDER))
            create_member_flow.add(
                vthunder_tasks.EnableInterfaceForMembers(
                    requires=[
                        constants.ADDED_PORTS,
                        constants.LOADBALANCER,
                        a10constants.VTHUNDER]))
        create_member_flow.add(self.handle_vrid_for_member_subflow())
        create_member_flow.add(a10_database_tasks.CountMembersWithIP(
            requires=constants.MEMBER, provides=a10constants.MEMBER_COUNT_IP
        ))
        create_member_flow.add(vthunder_tasks.AllowLoadbalancerForwardWithAnySource(
            name=a10constants.ALLOW_NO_SNAT,
            requires=(constants.MEMBER, constants.AMPHORA)))
        create_member_flow.add(a10_database_tasks.GetFlavorData(
            rebind={a10constants.LB_RESOURCE: constants.LOADBALANCER},
            provides=constants.FLAVOR))
        create_member_flow.add(self.get_create_member_snat_pool_subflow())
        create_member_flow.add(server_tasks.MemberCreate(
            requires=(constants.MEMBER, a10constants.VTHUNDER, constants.POOL,
                      a10constants.MEMBER_COUNT_IP, constants.FLAVOR)))
        create_member_flow.add(database_tasks.MarkMemberActiveInDB(
            requires=constants.MEMBER))
        create_member_flow.add(database_tasks.MarkPoolActiveInDB(
            requires=constants.POOL))
        create_member_flow.add(database_tasks.
                               MarkLBAndListenersActiveInDB(
                                   requires=(constants.LOADBALANCER,
                                             constants.LISTENERS)))
        create_member_flow.add(vthunder_tasks.WriteMemory(
            requires=a10constants.VTHUNDER))
        create_member_flow.add(a10_database_tasks.SetThunderUpdatedAt(
            requires=a10constants.VTHUNDER))
        return create_member_flow
예제 #28
0
    def get_batch_update_members_flow(self, old_members, new_members,
                                      updated_members):
        """Create a flow to batch update members

        :returns: The flow for batch updating members
        """
        batch_update_members_flow = linear_flow.Flow(
            constants.BATCH_UPDATE_MEMBERS_FLOW)
        unordered_members_flow = unordered_flow.Flow(
            constants.UNORDERED_MEMBER_UPDATES_FLOW)
        unordered_members_active_flow = unordered_flow.Flow(
            constants.UNORDERED_MEMBER_ACTIVE_FLOW)

        # Delete old members
        unordered_members_flow.add(
            lifecycle_tasks.MembersToErrorOnRevertTask(
                inject={constants.MEMBERS: old_members},
                name='{flow}-deleted'.format(
                    flow=constants.MEMBER_TO_ERROR_ON_REVERT_FLOW)))
        for m in old_members:
            unordered_members_flow.add(
                model_tasks.DeleteModelObject(
                    inject={constants.OBJECT: m},
                    name='{flow}-{id}'.format(
                        id=m.id, flow=constants.DELETE_MODEL_OBJECT_FLOW)))
            unordered_members_flow.add(
                database_tasks.DeleteMemberInDB(
                    inject={constants.MEMBER: m},
                    name='{flow}-{id}'.format(
                        id=m.id, flow=constants.DELETE_MEMBER_INDB)))
            unordered_members_flow.add(
                database_tasks.DecrementMemberQuota(
                    inject={constants.MEMBER: m},
                    name='{flow}-{id}'.format(
                        id=m.id, flow=constants.DECREMENT_MEMBER_QUOTA_FLOW)))

        # Create new members
        unordered_members_flow.add(
            lifecycle_tasks.MembersToErrorOnRevertTask(
                inject={constants.MEMBERS: new_members},
                name='{flow}-created'.format(
                    flow=constants.MEMBER_TO_ERROR_ON_REVERT_FLOW)))
        for m in new_members:
            unordered_members_active_flow.add(
                database_tasks.MarkMemberActiveInDB(
                    inject={constants.MEMBER: m},
                    name='{flow}-{id}'.format(
                        id=m.id, flow=constants.MARK_MEMBER_ACTIVE_INDB)))

        # Update existing members
        unordered_members_flow.add(
            lifecycle_tasks.MembersToErrorOnRevertTask(
                # updated_members is a list of (obj, dict), only pass `obj`
                inject={constants.MEMBERS: [m[0] for m in updated_members]},
                name='{flow}-updated'.format(
                    flow=constants.MEMBER_TO_ERROR_ON_REVERT_FLOW)))
        for m, um in updated_members:
            um.pop('id', None)
            unordered_members_flow.add(
                model_tasks.UpdateAttributes(
                    inject={
                        constants.OBJECT: m,
                        constants.UPDATE_DICT: um
                    },
                    name='{flow}-{id}'.format(
                        id=m.id, flow=constants.UPDATE_ATTRIBUTES_FLOW)))
            unordered_members_flow.add(
                database_tasks.UpdateMemberInDB(
                    inject={
                        constants.MEMBER: m,
                        constants.UPDATE_DICT: um
                    },
                    name='{flow}-{id}'.format(
                        id=m.id, flow=constants.UPDATE_MEMBER_INDB)))
            unordered_members_active_flow.add(
                database_tasks.MarkMemberActiveInDB(
                    inject={constants.MEMBER: m},
                    name='{flow}-{id}'.format(
                        id=m.id, flow=constants.MARK_MEMBER_ACTIVE_INDB)))

        batch_update_members_flow.add(unordered_members_flow)

        # Done, do real updates
        batch_update_members_flow.add(
            network_tasks.CalculateDelta(requires=constants.LOADBALANCER,
                                         provides=constants.DELTAS))
        batch_update_members_flow.add(
            network_tasks.HandleNetworkDeltas(requires=constants.DELTAS,
                                              provides=constants.ADDED_PORTS))
        batch_update_members_flow.add(
            amphora_driver_tasks.AmphoraePostNetworkPlug(
                requires=(constants.LOADBALANCER, constants.ADDED_PORTS)))

        # Update the Listener (this makes the changes active on the Amp)
        batch_update_members_flow.add(
            amphora_driver_tasks.ListenersUpdate(
                requires=(constants.LOADBALANCER, constants.LISTENERS)))

        # Mark all the members ACTIVE here, then pool then LB/Listeners
        batch_update_members_flow.add(unordered_members_active_flow)
        batch_update_members_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        batch_update_members_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=(constants.LOADBALANCER, constants.LISTENERS)))

        return batch_update_members_flow