예제 #1
0
 def get_create_member_snat_pool_subflow(self):
     create_member_snat_subflow = linear_flow.Flow(
         a10constants.CREATE_MEMBER_SNAT_POOL_SUBFLOW)
     create_member_snat_subflow.add(
         server_tasks.MemberFindNatPool(requires=[
             constants.MEMBER, a10constants.VTHUNDER, constants.POOL,
             constants.FLAVOR
         ],
                                        provides=a10constants.NAT_FLAVOR))
     create_member_snat_subflow.add(
         a10_database_tasks.GetNatPoolEntry(
             requires=[constants.MEMBER, a10constants.NAT_FLAVOR],
             provides=a10constants.NAT_POOL))
     create_member_snat_subflow.add(
         a10_network_tasks.ReserveSubnetAddressForMember(
             requires=[
                 constants.MEMBER, a10constants.NAT_FLAVOR,
                 a10constants.NAT_POOL
             ],
             provides=a10constants.SUBNET_PORT))
     create_member_snat_subflow.add(
         a10_database_tasks.UpdateNatPoolDB(requires=[
             constants.MEMBER, a10constants.NAT_FLAVOR,
             a10constants.NAT_POOL, a10constants.SUBNET_PORT
         ]))
     return create_member_snat_subflow
 def test_reserve_subnet_addr_for_member(self, mock_utils):
     mock_network_task = a10_network_tasks.ReserveSubnetAddressForMember()
     mock_network_task.network_driver = self.client_mock
     mock_network_task.execute(MEMBER, NAT_FLAVOR)
     self.client_mock.reserve_subnet_addresses.assert_called_with(
         MEMBER.subnet_id, ["1.1.1.1", "1.1.1.2"], mock.ANY)
예제 #3
0
    def get_rack_vthunder_create_member_flow(self):
        """Create a flow to create a rack vthunder member

        :returns: The flow for creating a rack vthunder member
        """
        create_member_flow = linear_flow.Flow(constants.CREATE_MEMBER_FLOW)
        create_member_flow.add(
            lifecycle_tasks.MemberToErrorOnRevertTask(requires=[
                constants.MEMBER, constants.LISTENERS, constants.LOADBALANCER,
                constants.POOL
            ]))
        create_member_flow.add(
            database_tasks.MarkMemberPendingCreateInDB(
                requires=constants.MEMBER))
        create_member_flow.add(
            a10_database_tasks.GetVThunderByLoadBalancer(
                requires=constants.LOADBALANCER,
                provides=a10constants.VTHUNDER))
        create_member_flow.add(
            vthunder_tasks.SetupDeviceNetworkMap(
                requires=a10constants.VTHUNDER,
                provides=a10constants.VTHUNDER))
        create_member_flow.add(self.handle_vrid_for_member_subflow())
        if CONF.a10_global.network_type == 'vlan':
            create_member_flow.add(
                vthunder_tasks.TagInterfaceForMember(
                    requires=[constants.MEMBER, a10constants.VTHUNDER]))
        create_member_flow.add(
            a10_database_tasks.CountMembersWithIP(
                requires=constants.MEMBER,
                provides=a10constants.MEMBER_COUNT_IP))
        create_member_flow.add(
            a10_database_tasks.GetFlavorData(
                rebind={a10constants.LB_RESOURCE: constants.LOADBALANCER},
                provides=constants.FLAVOR))
        create_member_flow.add(
            server_tasks.MemberFindNatPool(requires=[
                constants.MEMBER, a10constants.VTHUNDER, constants.POOL,
                constants.FLAVOR
            ],
                                           provides=a10constants.NAT_FLAVOR))
        create_member_flow.add(
            a10_database_tasks.GetNatPoolEntry(
                requires=[constants.MEMBER, a10constants.NAT_FLAVOR],
                provides=a10constants.NAT_POOL))
        create_member_flow.add(
            a10_network_tasks.ReserveSubnetAddressForMember(
                requires=[
                    constants.MEMBER, a10constants.NAT_FLAVOR,
                    a10constants.NAT_POOL
                ],
                provides=a10constants.SUBNET_PORT))
        create_member_flow.add(
            a10_database_tasks.UpdateNatPoolDB(requires=[
                constants.MEMBER, a10constants.NAT_FLAVOR,
                a10constants.NAT_POOL, a10constants.SUBNET_PORT
            ]))
        create_member_flow.add(
            server_tasks.MemberCreate(requires=(constants.MEMBER,
                                                a10constants.VTHUNDER,
                                                constants.POOL,
                                                a10constants.MEMBER_COUNT_IP,
                                                constants.FLAVOR)))
        create_member_flow.add(
            database_tasks.MarkMemberActiveInDB(requires=constants.MEMBER))
        create_member_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        create_member_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=(constants.LOADBALANCER, constants.LISTENERS)))
        create_member_flow.add(
            vthunder_tasks.WriteMemory(requires=a10constants.VTHUNDER))
        create_member_flow.add(
            a10_database_tasks.SetThunderUpdatedAt(
                requires=a10constants.VTHUNDER))
        return create_member_flow