Пример #1
0
 def test_update_vip(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.UpdateVIP()
     net_task.execute(lb)
     mock_driver.update_vip.assert_called_once_with(lb)
Пример #2
0
 def test_update_vip(self, mock_get_session, mock_get_lb,
                     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)
     mock_get_lb.return_value = lb
     listeners = [{constants.LOADBALANCER_ID: lb.id}]
     net_task = network_tasks.UpdateVIP()
     net_task.execute(listeners)
     mock_driver.update_vip.assert_called_once_with(lb)
Пример #3
0
    def get_create_listener_flow(self):
        """Create a flow to create a listener

        :returns: The flow for creating a listener
        """
        create_listener_flow = linear_flow.Flow(constants.CREATE_LISTENER_FLOW)
        create_listener_flow.add(
            lifecycle_tasks.ListenersToErrorOnRevertTask(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        create_listener_flow.add(
            amphora_driver_tasks.ListenersUpdate(
                requires=constants.LOADBALANCER))
        create_listener_flow.add(
            network_tasks.UpdateVIP(requires=constants.LOADBALANCER))
        create_listener_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        return create_listener_flow
Пример #4
0
    def get_create_all_listeners_flow(self):
        """Create a flow to create all listeners

        :returns: The flow for creating all listeners
        """
        create_all_listeners_flow = linear_flow.Flow(
            constants.CREATE_LISTENERS_FLOW)
        create_all_listeners_flow.add(
            database_tasks.GetListenersFromLoadbalancer(
                requires=constants.LOADBALANCER,
                provides=constants.LISTENERS))
        create_all_listeners_flow.add(database_tasks.ReloadLoadBalancer(
            requires=constants.LOADBALANCER_ID,
            provides=constants.LOADBALANCER))
        create_all_listeners_flow.add(amphora_driver_tasks.ListenersUpdate(
            requires=[constants.LOADBALANCER, constants.LISTENERS]))
        create_all_listeners_flow.add(network_tasks.UpdateVIP(
            requires=constants.LOADBALANCER))
        return create_all_listeners_flow
Пример #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(
            lifecycle_tasks.ListenerToErrorOnRevertTask(
                requires=constants.LISTENER))
        update_listener_flow.add(
            amphora_driver_tasks.ListenersUpdate(
                requires=constants.LOADBALANCER_ID))
        update_listener_flow.add(
            network_tasks.UpdateVIP(requires=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_ID, constants.LISTENERS)))

        return update_listener_flow
Пример #6
0
    def get_create_listener_flow(self):
        """Create a flow to create a listener

        :returns: The flow for creating a listener
        """
        create_listener_flow = linear_flow.Flow(constants.CREATE_LISTENER_FLOW)
        create_listener_flow.add(lifecycle_tasks.ListenersToErrorOnRevertTask(
            requires=[constants.LOADBALANCER, constants.LISTENERS]))
        #create_listener_flow.add(amphora_driver_tasks.ListenersUpdate(
        #    requires=[constants.LOADBALANCER, constants.LISTENERS]))
        # Get VThunder details from database
        create_listener_flow.add(a10_database_tasks.GetVThunderByLoadBalancer(
            requires=constants.LOADBALANCER,
            provides=a10constants.VTHUNDER))
        create_listener_flow.add(handler_virtual_port.ListenersCreate(
            requires=[constants.LOADBALANCER, constants.LISTENERS, a10constants.VTHUNDER]))
        create_listener_flow.add(network_tasks.UpdateVIP(
            requires=constants.LOADBALANCER))
        create_listener_flow.add(database_tasks.
                                 MarkLBAndListenersActiveInDB(
                                     requires=[constants.LOADBALANCER,
                                               constants.LISTENERS]))
        return create_listener_flow