예제 #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
예제 #2
0
 def test_UpdateNatPoolDB_update(self):
     db_task = task.UpdateNatPoolDB()
     db_task.nat_pool_repo = self.nat_pool_repo
     flavor = {
         "pool_name": "p1",
         "start_address": "1.1.1.1",
         "end_address": "1.1.1.2"
     }
     NAT_POOL.member_ref_count = 1
     db_task.execute(MEMBER_1, flavor, NAT_POOL, None)
     self.nat_pool_repo.update.assert_called_with(mock.ANY,
                                                  mock.ANY,
                                                  member_ref_count=2)
예제 #3
0
 def test_UpdateNatPoolDB_create(self):
     db_task = task.UpdateNatPoolDB()
     db_task.nat_pool_repo = self.nat_pool_repo
     flavor = {
         "pool_name": "p1",
         "start_address": "1.1.1.1",
         "end_address": "1.1.1.2"
     }
     port = mock.Mock(id="1")
     db_task.execute(MEMBER_1, flavor, None, port)
     self.nat_pool_repo.create.assert_called_with(
         mock.ANY,
         id=mock.ANY,
         name="p1",
         subnet_id=MEMBER_1.subnet_id,
         start_address="1.1.1.1",
         end_address="1.1.1.2",
         member_ref_count=1,
         port_id="1")
예제 #4
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