Пример #1
0
def test_create_listener():
    lb_service = LoadBalancerServiceBuilder()
    listener_builder = ListenerServiceBuilder()
    bigips = [BigIP('10.190.5.7', 'admin', 'admin')]
    service = json.load(open("service.json"))["service"]

    try:
        # create partition
        lb_service.prep_service(service, bigips)

        # create BIG-IP virtual servers
        listeners = service["listeners"]
        loadbalancer = service["loadbalancer"]

        for listener in listeners:
            # create a service object in form expected by builder
            svc = {"loadbalancer": loadbalancer,
                   "listener": listener}

            # create
            listener_builder.create_listener(svc, bigips)

            # validate
            l = listener_builder.get_listener(svc, bigips[0])
            assert l.name == listener["name"]
            print "Created listener: " + l.name

            # delete
            listener_builder.delete_listener(svc, bigips)

    finally:
        lb_service.delete_partition(service, bigips)
Пример #2
0
def test_create_listener(symbols):
    lb_service = LoadBalancerServiceBuilder()
    pool_builder = PoolServiceBuilder()
    bigips = [BigIP(symbols.bigip_mgmt_ip_public, 'admin', 'admin')]
    service = json.load(open("service.json"))["service"]

    try:
        # create partition
        lb_service.prep_service(service, bigips)

        # create BIG-IP virtual servers
        pools = service["pools"]
        loadbalancer = service["loadbalancer"]

        for pool in pools:
            # create a service object in form expected by builder
            svc = {"loadbalancer": loadbalancer,
                   "pool": pool}

            # create
            pool_builder.create_pool(svc, bigips)

            # delete
            pool_builder.delete_pool(svc, bigips)

    finally:
        lb_service.delete_partition(service, bigips)
Пример #3
0
def test_create_listener():
    lb_service = LoadBalancerServiceBuilder()
    pool_builder = PoolServiceBuilder()
    bigips = [BigIP('10.190.5.7', 'admin', 'admin')]
    service = json.load(open("service.json"))["service"]

    try:
        # create partition
        lb_service.prep_service(service, bigips)

        # create BIG-IP® virtual servers
        pools = service["pools"]
        loadbalancer = service["loadbalancer"]

        for pool in pools:
            # create a service object in form expected by builder
            svc = {"loadbalancer": loadbalancer, "pool": pool}

            # create
            pool_builder.create_pool(svc, bigips)

            # delete
            pool_builder.delete_pool(svc, bigips)

    finally:
        lb_service.delete_partition(service, bigips)
Пример #4
0
def test_create_listener():
    lb_service = LoadBalancerServiceBuilder()
    listener_builder = ListenerServiceBuilder()
    bigips = [BigIP('10.190.5.7', 'admin', 'admin')]
    service = json.load(open("service.json"))["service"]

    try:
        # create partition
        lb_service.prep_service(service, bigips)

        # create BIG-IP® virtual servers
        listeners = service["listeners"]
        loadbalancer = service["loadbalancer"]

        for listener in listeners:
            # create a service object in form expected by builder
            svc = {"loadbalancer": loadbalancer, "listener": listener}

            # create
            listener_builder.create_listener(svc, bigips)

            # validate
            l = listener_builder.get_listener(svc, bigips[0])
            assert l.name == listener["name"]
            print "Created listener: " + l.name

            # delete
            listener_builder.delete_listener(svc, bigips)

    finally:
        lb_service.delete_partition(service, bigips)