Module slb :: Class ServiceGroup
[hide private]
[frames] | no frames]

Class ServiceGroup

source code

   object --+    
            |    
base.AxObject --+
                |
               ServiceGroup


Implementation of the aXAPI slb.service_group.* method to 
manage the SLB service groups as getAll/create/delete/update 

Usage:
    # Service group with parameters:
    # name         (required) service group name.
    # protocol     (required) service group type, either TCP(2) or UDP(3).
    # lb_method     desired load-balancing algorithm on the service group with:
    #     0    RoundRobin (default)
    #     1    WeightedRoundRobin
    #     2    LeastConnection
    #     3    WeightedLeastConnection
    #     4    LeastConnectionOnServicePort
    #     5    WeightedLeastConnectionOnServicePort 
    #     6    FastResponseTime
    #     7    LeastRequest
    #     8    StrictRoundRobin
    #     9    StateLessSourceIPHash
    #     10    StateLessSourceIPHashOnly
    #     11    StateLessDestinationIPHash
    #     12    StateLessSourceDestinationIPHash
    #     13    StateLessPerPacketRoundRobin
    # health_monitor      health monitor method used at the service group member.
    # min_active_member   min active members.
    # status              status of min active members, enabled(1) or disabled(0)
    # number              number of min active members.
    # priority_set        priority option of min active members: 
    #     0    Do nothing
    #     1    Skip Priority Set
    #     2    Dynamic PriorityRequired, please fill in a valid number.(1 - 63)
    # client_reset    send client reset when server selection fail enabled(1) or disabled(0)
    # stats_data            stats data, either enabled(1) or disabled(0)
    # extended_stats        extended stats, either enabled(1) or disabled(0)
    # member_list     tag for service group members
    #     server      server name (or IPv4, IPv6 address) of this member
    #     port        server port number
    #     template    server port template name
    #     priority    member priority
    #     stats_data  member stats data, either enabled(1) or disabled(0)
    
    # Example: 
    # retrieve all service groups
    svc_group_list = ServiceGroup.getAll()
    for sg in svc_group_list:
        # work sg
        print sg
    # search for service group with name, g1    
    svc = ServiceGroup.searchByName("g1")
    #  check svc.name, svc.health_monitor, svc.member_list
    
    # create a service group, g3 with members:
    #    1.1.1.2:80 
    #    1.1.1.3:80
    svc2 = ServiceGroup()
    svc2.name = "g3" 
    svc2.protocol = AxAPI.PROTO_TCP
    svc2.lb_method = AxAPI.LB_LEAST_CONNECTED_ON_SERVICE_PORT
    svc2.member_list = [{"server":"1.1.1.2", "port": 80, "status": AxAPI.STATUS_ENABLED}, {"server":"1.1.1.3", "port": 80}]
    svc2.create()
    # disable g3 member 1.1.1.2:80
    svc2.member_list = [{"server":"1.1.1.2", "port": 80, "status": AxAPI.STATUS_DISABLED}]
    svc2.update()  

Instance Methods [hide private]
 
create(self)
method: slb.service_group.create Create the service group.
source code
 
delete(self)
method: slb.service_group.delete Delete the service group.
source code
 
update(self)
method: slb.service_group.update Update the service group.
source code

Inherited from base.AxObject: __getattr__, __getitem__, __init__, __repr__, __setattr__, __setitem__, __str__, dump, get, getInfo, getObjectDict, getRequestPostDataJson, getRequestPostDataXml

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __sizeof__, __subclasshook__

Static Methods [hide private]
 
getAll()
method :slb.service_group.getAll Returns a list of service groups in ServiceGroup instance.
source code
 
searchByName(name)
method: slb.service_group.search Search the service group by given name.
source code
Class Variables [hide private]
  __display__ = ['name', 'protocol', 'lb_method']
  __obj_name__ = 'service_group'
  __xml_convrt__ = {'member_list': 'member', 'service_group_list...

Inherited from base.AxObject: __obj_readonly__

Properties [hide private]

Inherited from object: __class__

Class Variable Details [hide private]

__xml_convrt__

Value:
{'member_list': 'member', 'service_group_list': 'service_group'}