Esempio n. 1
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
    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(
            virtual_port_tasks.ListenerUpdate(requires=[
                constants.LOADBALANCER, constants.LISTENER,
                a10constants.VTHUNDER
            ]))
        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))
        return update_listener_flow
    def get_update_listener_flow(self):
        """Create a flow to update a listener

        :returns: The flow for updating a listener
        """
        update_listener_flow = linear_flow.Flow(constants.UPDATE_LISTENER_FLOW)
        update_listener_flow.add(
            lifecycle_tasks.ListenersToErrorOnRevertTask(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        update_listener_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        update_listener_flow.add(
            virtual_port_tasks.ListenersUpdate(requires=[
                constants.LOADBALANCER, constants.LISTENERS,
                a10constants.VTHUNDER
            ]))

        update_listener_flow.add(
            database_tasks.UpdateListenerInDB(
                requires=[constants.LISTENER, constants.UPDATE_DICT]))
        update_listener_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))

        return update_listener_flow
Esempio n. 4
0
    def get_update_listener_flow(self):
        """Create a flow to update a listener

        :returns: The flow for updating a listener
        """
        update_listener_flow = linear_flow.Flow(constants.UPDATE_LISTENER_FLOW)
        update_listener_flow.add(
            lifecycle_tasks.ListenersToErrorOnRevertTask(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        update_listener_flow.add(
            amphora_driver_tasks.ListenersUpdate(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        update_listener_flow.add(
            database_tasks.UpdateListenerInDB(
                requires=[constants.LISTENER, constants.UPDATE_DICT]))
        update_listener_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))

        return update_listener_flow
Esempio n. 5
0
    def get_update_listener_flow(self):
        """Create a flow to update a listener

        :returns: The flow for updating a listener
        """
        update_listener_flow = linear_flow.Flow(constants.UPDATE_LISTENER_FLOW)
        update_listener_flow.add(
            model_tasks.UpdateAttributes(
                rebind={constants.OBJECT: constants.LISTENER},
                requires=[constants.UPDATE_DICT]))
        update_listener_flow.add(
            amphora_driver_tasks.ListenerUpdate(
                requires=[constants.LISTENER, constants.VIP]))
        update_listener_flow.add(
            database_tasks.UpdateListenerInDB(
                requires=[constants.LISTENER, constants.UPDATE_DICT]))
        update_listener_flow.add(
            database_tasks.MarkLBAndListenerActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENER]))

        return update_listener_flow
Esempio n. 6
0
    def test_update_listener_in_db(
            self, mock_listner_repo_update, mock_generate_uuid, mock_LOG,
            mock_get_session, mock_loadbalancer_repo_update,
            mock_listener_repo_update, mock_amphora_repo_update,
            mock_amphora_repo_delete):

        update_listener = database_tasks.UpdateListenerInDB()
        update_listener.execute(self.listener_mock, {
            'name': 'test',
            'description': 'test2'
        })

        repo.ListenerRepository.update.assert_called_once_with(
            'TEST', LISTENER_ID, name='test', description='test2')

        # Test the revert

        mock_listener_repo_update.reset_mock()
        update_listener.revert(self.listener_mock)

        # TODO(johnsom) fix this to set the upper ojects to ERROR
        repo.ListenerRepository.update.assert_called_once_with('TEST',
                                                               LISTENER_ID,
                                                               enabled=0)