예제 #1
0
    def get_new_LB_networking_subflow(self):
        """Create a sub-flow to setup networking.

        :returns: The flow to setup networking for a new amphora
        """
        LOG.info("Inside network subflow")
        new_LB_net_subflow = linear_flow.Flow(
            constants.LOADBALANCER_NETWORKING_SUBFLOW)
        new_LB_net_subflow.add(
            network_tasks.AllocateVIP(requires=constants.LOADBALANCER,
                                      provides=constants.VIP))
        new_LB_net_subflow.add(
            database_tasks.UpdateVIPAfterAllocation(
                requires=(constants.LOADBALANCER_ID, constants.VIP),
                provides=constants.LOADBALANCER))
        new_LB_net_subflow.add(
            network_tasks.PlugVIP(requires=constants.LOADBALANCER,
                                  provides=constants.AMPS_DATA))
        LOG.info("After plugging the VIP")
        new_LB_net_subflow.add(
            network_tasks.ApplyQos(requires=(constants.LOADBALANCER,
                                             constants.AMPS_DATA,
                                             constants.UPDATE_DICT)))
        new_LB_net_subflow.add(
            database_tasks.UpdateAmphoraVIPData(requires=constants.AMPS_DATA))
        new_LB_net_subflow.add(
            database_tasks.ReloadLoadBalancer(
                name=constants.RELOAD_LB_AFTER_PLUG_VIP,
                requires=constants.LOADBALANCER_ID,
                provides=constants.LOADBALANCER))
        new_LB_net_subflow.add(
            network_tasks.GetAmphoraeNetworkConfigs(
                requires=constants.LOADBALANCER,
                provides=constants.AMPHORAE_NETWORK_CONFIG))
        new_LB_net_subflow.add(
            database_tasks.GetAmphoraeFromLoadbalancer(
                requires=constants.LOADBALANCER, provides=constants.AMPHORA))
        #new_LB_net_subflow.add(amphora_driver_tasks.AmphoraePostVIPPlug(
        #    requires=(constants.LOADBALANCER,
        #              constants.AMPHORAE_NETWORK_CONFIG)))

        # Get VThunder details from database
        #new_LB_net_subflow.add(a10_database_tasks.GetVThunderByLoadBalancer(
        #    requires=constants.LOADBALANCER,
        #    provides=a10constants.VTHUNDER))
        new_LB_net_subflow.add(
            vthunder_tasks.AmphoraePostVIPPlug(
                requires=(constants.LOADBALANCER, a10constants.VTHUNDER)))
        new_LB_net_subflow.add(
            vthunder_tasks.VThunderComputeConnectivityWait(
                requires=(a10constants.VTHUNDER, constants.AMPHORA)))
        new_LB_net_subflow.add(
            vthunder_tasks.EnableInterface(requires=a10constants.VTHUNDER))

        LOG.info("AT the end of subflow")

        return new_LB_net_subflow
예제 #2
0
 def test_EnableInterface_execute_for_active_standby_topology(self):
     thunder = copy.deepcopy(VTHUNDER)
     added_ports = {'amphora_id': ''}
     thunder.topology = "ACTIVE_STANDBY"
     mock_task = task.EnableInterface()
     mock_task.loadbalancer_repo = mock.MagicMock()
     mock_task.loadbalancer_repo.check_lb_exists_in_project.return_value = True
     mock_task.axapi_client = self.client_mock
     self.client_mock.interface.get_list.return_value = INTERFACES
     mock_task.execute(thunder, LB, added_ports)
     self.client_mock.system.action.setInterface.assert_not_called()
    def get_new_lb_networking_subflow(self, topology):
        """Subflow to setup networking for amphora"""

        new_LB_net_subflow = linear_flow.Flow(
            constants.LOADBALANCER_NETWORKING_SUBFLOW)
        new_LB_net_subflow.add(
            a10_network_tasks.PlugVIP(requires=constants.LOADBALANCER,
                                      provides=constants.AMPS_DATA))
        new_LB_net_subflow.add(
            a10_network_tasks.ApplyQos(requires=(constants.LOADBALANCER,
                                                 constants.AMPS_DATA,
                                                 constants.UPDATE_DICT)))
        new_LB_net_subflow.add(
            database_tasks.UpdateAmphoraeVIPData(requires=constants.AMPS_DATA))
        new_LB_net_subflow.add(
            database_tasks.ReloadLoadBalancer(
                name=constants.RELOAD_LB_AFTER_PLUG_VIP,
                requires=constants.LOADBALANCER_ID,
                provides=constants.LOADBALANCER))
        new_LB_net_subflow.add(
            a10_network_tasks.GetAmphoraeNetworkConfigs(
                requires=constants.LOADBALANCER,
                provides=constants.AMPHORAE_NETWORK_CONFIG))
        new_LB_net_subflow.add(
            database_tasks.GetAmphoraeFromLoadbalancer(
                requires=constants.LOADBALANCER, provides=constants.AMPHORA))
        new_LB_net_subflow.add(
            vthunder_tasks.VThunderComputeConnectivityWait(
                name=a10constants.MASTER_CONNECTIVITY_WAIT,
                requires=(a10constants.VTHUNDER, constants.AMPHORA)))
        new_LB_net_subflow.add(
            vthunder_tasks.EnableInterface(requires=a10constants.VTHUNDER))
        new_LB_net_subflow.add(
            a10_database_tasks.MarkVThunderStatusInDB(
                name=a10constants.MARK_VTHUNDER_MASTER_ACTIVE_IN_DB,
                requires=a10constants.VTHUNDER,
                inject={a10constants.STATUS: constants.ACTIVE}))
        if topology == constants.TOPOLOGY_ACTIVE_STANDBY:
            new_LB_net_subflow.add(
                vthunder_tasks.CreateHealthMonitorOnVThunder(
                    name=a10constants.CREATE_HEALTH_MONITOR_ON_VTHUNDER_MASTER,
                    requires=a10constants.VTHUNDER))
            new_LB_net_subflow.add(
                a10_database_tasks.GetBackupVThunderByLoadBalancer(
                    name=a10constants.GET_BACKUP_VTHUNDER_BY_LB,
                    requires=constants.LOADBALANCER,
                    provides=a10constants.BACKUP_VTHUNDER))
            new_LB_net_subflow.add(
                vthunder_tasks.VThunderComputeConnectivityWait(
                    name=a10constants.BACKUP_CONNECTIVITY_WAIT,
                    rebind={
                        a10constants.VTHUNDER: a10constants.BACKUP_VTHUNDER
                    },
                    requires=constants.AMPHORA))
            new_LB_net_subflow.add(
                vthunder_tasks.EnableInterface(
                    name=a10constants.BACKUP_ENABLE_INTERFACE,
                    rebind={
                        a10constants.VTHUNDER: a10constants.BACKUP_VTHUNDER
                    }))
            new_LB_net_subflow.add(
                a10_database_tasks.MarkVThunderStatusInDB(
                    name=a10constants.MARK_VTHUNDER_BACKUP_ACTIVE_IN_DB,
                    rebind={
                        a10constants.VTHUNDER: a10constants.BACKUP_VTHUNDER
                    },
                    inject={a10constants.STATUS: constants.ACTIVE}))
        return new_LB_net_subflow