def get_rack_vthunder_for_lb_subflow(self,
                                         vthunder_conf,
                                         prefix,
                                         role=constants.ROLE_STANDALONE):
        """ reload the loadbalancer and make entry in database"""

        sf_name = prefix + '-' + constants.GET_AMPHORA_FOR_LB_SUBFLOW

        amp_for_lb_flow = linear_flow.Flow(sf_name)

        amp_for_lb_flow.add(
            database_tasks.ReloadLoadBalancer(
                name=sf_name + '-' + 'reload_loadbalancer',
                requires=constants.LOADBALANCER_ID,
                provides=constants.LOADBALANCER))
        amp_for_lb_flow.add(
            a10_database_tasks.CreateRackVthunderEntry(
                name=sf_name + '-' + 'create_rack_vThunder_entry_in_database',
                inject={a10constants.VTHUNDER_CONFIG: vthunder_conf},
                requires=(constants.LOADBALANCER,
                          a10constants.VTHUNDER_CONFIG)))
        amp_for_lb_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        amp_for_lb_flow.add(
            vthunder_tasks.HandleACOSPartitionChange(
                name=sf_name + '-' + a10constants.CHANGE_PARTITION,
                requires=a10constants.VTHUNDER))
        return amp_for_lb_flow
 def test_create_rack_vthunder_entry_child_partition_exists(self):
     self.conf.config(group=a10constants.A10_GLOBAL_CONF_SECTION,
                      use_parent_partition=False)
     mock_lb = copy.deepcopy(LB)
     mock_lb.project_id = a10constants.MOCK_CHILD_PROJECT_ID
     mock_vthunder_config = copy.deepcopy(HW_THUNDER)
     mock_vthunder_config.hierarchical_multitenancy = "enable"
     mock_create_vthunder = task.CreateRackVthunderEntry()
     mock_create_vthunder.vthunder_repo = mock.MagicMock()
     mock_vthunder = copy.deepcopy(VTHUNDER)
     mock_vthunder.partition_name = a10constants.MOCK_CHILD_PROJECT_ID[:14]
     mock_create_vthunder.vthunder_repo.create.return_value = mock_vthunder
     vthunder = mock_create_vthunder.execute(mock_lb, mock_vthunder_config)
     self.assertEqual(vthunder.partition_name,
                      a10constants.MOCK_CHILD_PROJECT_ID[:14])