コード例 #1
0
    def get_delete_listener_flow(self, topology):
        """Flow to delete a listener"""

        delete_listener_flow = linear_flow.Flow(constants.DELETE_LISTENER_FLOW)
        delete_listener_flow.add(lifecycle_tasks.ListenerToErrorOnRevertTask(
            requires=constants.LISTENER))
        delete_listener_flow.add(vthunder_tasks.VthunderInstanceBusy(
            requires=a10constants.COMPUTE_BUSY))
        delete_listener_flow.add(a10_database_tasks.GetVThunderByLoadBalancer(
            requires=constants.LOADBALANCER,
            provides=a10constants.VTHUNDER))
        if topology == constants.TOPOLOGY_ACTIVE_STANDBY:
            delete_listener_flow.add(vthunder_tasks.GetMasterVThunder(
                name=a10constants.GET_MASTER_VTHUNDER,
                requires=a10constants.VTHUNDER,
                provides=a10constants.VTHUNDER))
        delete_listener_flow.add(self.handle_ssl_cert_flow(flow_type='delete'))
        delete_listener_flow.add(virtual_port_tasks.ListenerDelete(
            requires=[constants.LOADBALANCER, constants.LISTENER, a10constants.VTHUNDER]))
        delete_listener_flow.add(network_tasks.UpdateVIPForDelete(
            requires=constants.LOADBALANCER))
        delete_listener_flow.add(database_tasks.DeleteListenerInDB(
            requires=constants.LISTENER))
        delete_listener_flow.add(database_tasks.DecrementListenerQuota(
            requires=constants.LISTENER))
        delete_listener_flow.add(database_tasks.MarkLBActiveInDB(
            requires=constants.LOADBALANCER))
        delete_listener_flow.add(vthunder_tasks.WriteMemory(
            requires=a10constants.VTHUNDER))
        delete_listener_flow.add(a10_database_tasks.SetThunderUpdatedAt(
            requires=a10constants.VTHUNDER))
        return delete_listener_flow
コード例 #2
0
    def get_update_listener_flow(self, topology):
        """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(vthunder_tasks.VthunderInstanceBusy(
            requires=a10constants.COMPUTE_BUSY))
        update_listener_flow.add(a10_database_tasks.GetVThunderByLoadBalancer(
            requires=constants.LOADBALANCER,
            provides=a10constants.VTHUNDER))
        if topology == constants.TOPOLOGY_ACTIVE_STANDBY:
            update_listener_flow.add(vthunder_tasks.GetMasterVThunder(
                name=a10constants.GET_MASTER_VTHUNDER,
                requires=a10constants.VTHUNDER,
                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
コード例 #3
0
    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
コード例 #4
0
    def get_delete_listener_flow(self):
        """Flow to delete a listener"""

        delete_listener_flow = linear_flow.Flow(constants.DELETE_LISTENER_FLOW)
        delete_listener_flow.add(
            lifecycle_tasks.ListenerToErrorOnRevertTask(
                requires=constants.LISTENER))
        delete_listener_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        delete_listener_flow.add(self.handle_ssl_cert_flow(flow_type='delete'))
        delete_listener_flow.add(
            virtual_port_tasks.ListenerDelete(requires=[
                constants.LOADBALANCER, constants.LISTENER,
                a10constants.VTHUNDER
            ]))
        delete_listener_flow.add(
            network_tasks.UpdateVIPForDelete(requires=constants.LOADBALANCER))
        delete_listener_flow.add(
            database_tasks.DeleteListenerInDB(requires=constants.LISTENER))
        delete_listener_flow.add(
            database_tasks.DecrementListenerQuota(requires=constants.LISTENER))
        delete_listener_flow.add(
            database_tasks.MarkLBActiveInDB(requires=constants.LOADBALANCER))
        delete_listener_flow.add(
            vthunder_tasks.WriteMemory(requires=a10constants.VTHUNDER))
        return delete_listener_flow
コード例 #5
0
    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
コード例 #6
0
    def get_delete_rack_listener_flow(self):
        """Create a flow to delete a rack listener

        :returns: The flow for deleting a rack listener
        """
        delete_listener_flow = linear_flow.Flow(constants.DELETE_LISTENER_FLOW)
        delete_listener_flow.add(
            lifecycle_tasks.ListenerToErrorOnRevertTask(
                requires=constants.LISTENER))
        delete_listener_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        delete_listener_flow.add(
            virtual_port_tasks.ListenerDelete(requires=[
                constants.LOADBALANCER, constants.LISTENER,
                a10constants.VTHUNDER
            ]))
        delete_listener_flow.add(
            database_tasks.DeleteListenerInDB(requires=constants.LISTENER))
        delete_listener_flow.add(
            database_tasks.DecrementListenerQuota(requires=constants.LISTENER))
        delete_listener_flow.add(
            database_tasks.MarkLBActiveInDB(requires=constants.LOADBALANCER))

        return delete_listener_flow
コード例 #7
0
    def test_ListenerToErrorOnRevertTask(self, mock_listener_prov_status_error,
                                         mock_loadbalancer_prov_status_active):

        listener_to_error_on_revert = (
            lifecycle_tasks.ListenerToErrorOnRevertTask())

        # Execute
        listener_to_error_on_revert.execute(self.LISTENER)

        self.assertFalse(mock_listener_prov_status_error.called)

        # Revert
        listener_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)
コード例 #8
0
    def get_delete_listener_flow(self):
        """Create a flow to delete a listener

        :returns: The flow for deleting a listener
        """
        delete_listener_flow = linear_flow.Flow(constants.DELETE_LISTENER_FLOW)
        delete_listener_flow.add(
            lifecycle_tasks.ListenerToErrorOnRevertTask(
                requires=constants.LISTENER))
        delete_listener_flow.add(
            amphora_driver_tasks.ListenerDelete(
                requires=[constants.LOADBALANCER, constants.LISTENER]))
        delete_listener_flow.add(
            network_tasks.UpdateVIPForDelete(requires=constants.LOADBALANCER))
        delete_listener_flow.add(
            database_tasks.DeleteListenerInDB(requires=constants.LISTENER))
        delete_listener_flow.add(
            database_tasks.DecrementListenerQuota(requires=constants.LISTENER))
        delete_listener_flow.add(
            database_tasks.MarkLBActiveInDB(requires=constants.LOADBALANCER))

        return delete_listener_flow