Example #1
0
    def get_delete_listener_internal_flow(self, listener_name):
        """Create a flow to delete a listener and l7policies internally

           (will skip deletion on the amp and marking LB active)

        :returns: The flow for deleting a listener
        """
        delete_listener_flow = linear_flow.Flow(constants.DELETE_LISTENER_FLOW)
        # Should cascade delete all L7 policies
        delete_listener_flow.add(
            network_tasks.UpdateVIPForDelete(name='delete_update_vip_' +
                                             listener_name,
                                             requires=constants.LOADBALANCER))
        delete_listener_flow.add(
            database_tasks.DeleteListenerInDB(
                name='delete_listener_in_db_' + listener_name,
                requires=constants.LISTENER,
                rebind={constants.LISTENER: listener_name}))
        delete_listener_flow.add(
            database_tasks.DecrementListenerQuota(
                name='decrement_listener_quota_' + listener_name,
                requires=constants.LISTENER,
                rebind={constants.LISTENER: listener_name}))

        return delete_listener_flow
Example #2
0
 def get_cascade_delete_listener_internal_flow(self, listener_name,
                                               compute_flag):
     """Create a flow to delete a listener
        (will skip deletion on the amp and marking LB active)
     :returns: The flow for deleting a listener
     """
     delete_listener_flow = linear_flow.Flow(constants.DELETE_LISTENER_FLOW)
     delete_listener_flow.add(
         self.handle_ssl_cert_flow(flow_type='delete',
                                   listener_name=listener_name))
     if compute_flag:
         delete_listener_flow.add(
             network_tasks.UpdateVIPForDelete(
                 name='delete_update_vip_' + listener_name,
                 requires=constants.LOADBALANCER))
     delete_listener_flow.add(
         database_tasks.DeleteListenerInDB(
             name='delete_listener_in_db_' + listener_name,
             requires=constants.LISTENER,
             rebind={constants.LISTENER: listener_name}))
     delete_listener_flow.add(
         database_tasks.DecrementListenerQuota(
             name='decrement_listener_quota_' + listener_name,
             requires=constants.LISTENER,
             rebind={constants.LISTENER: listener_name}))
     return delete_listener_flow
 def test_update_vip_for_delete(self, mock_get_net_driver):
     mock_driver = mock.MagicMock()
     mock_get_net_driver.return_value = mock_driver
     vip = o_data_models.Vip()
     lb = o_data_models.LoadBalancer(vip=vip)
     net_task = network_tasks.UpdateVIPForDelete()
     net_task.execute(lb)
     mock_driver.update_vip.assert_called_once_with(lb, for_delete=True)
Example #4
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
Example #5
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