Example #1
0
def vserver_servicegroup_add(v_name, sg_name, **connection_args):
    """
    Bind a servicegroup to a vserver

    CLI Example:

    .. code-block:: bash

        salt '*' netscaler.vserver_servicegroup_add 'vserverName' 'serviceGroupName'
    """
    ret = True
    if vserver_servicegroup_exists(v_name, sg_name, **connection_args):
        return False
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    vsg = NSLBVServerServiceGroupBinding()
    vsg.set_name(v_name)
    vsg.set_servicegroupname(sg_name)
    try:
        NSLBVServerServiceGroupBinding.add(nitro, vsg)
    except NSNitroError as error:
        log.debug("netscaler module error - NSLBVServerServiceGroupBinding.add() failed: {0}".format(error))
        ret = False
    _disconnect(nitro)
    return ret
Example #2
0
def vserver_servicegroup_add(v_name, sg_name, **connection_args):
    '''
    Bind a servicegroup to a vserver

    CLI Example:

    .. code-block:: bash

        salt '*' netscaler.vserver_servicegroup_add 'vserverName' 'serviceGroupName'
    '''
    ret = True
    if vserver_servicegroup_exists(v_name, sg_name, **connection_args):
        return False
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    vsg = NSLBVServerServiceGroupBinding()
    vsg.set_name(v_name)
    vsg.set_servicegroupname(sg_name)
    try:
        NSLBVServerServiceGroupBinding.add(nitro, vsg)
    except NSNitroError as e:
        log.debug(
            'netscaler module error - NSLBVServerServiceGroupBinding.add() failed: {0}'
            .format(e.message))
        ret = False
    _disconnect(nitro)
    return ret
Example #3
0
def lbvsbindingtosg_add(lbvs_name, sg_name, **connection_args):
    """
    Bind sg to a lbvs
    CLI Example:
    .. code-block:: bash
        salt '*' netscaler.lbvsbindingtosg_add 'monitorName' 'servicegroupName'
    """
    ret = True
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    lbvssg = NSLBVServerServiceGroupBinding()
    lbvssg.set_name(lbvs_name)
    lbvssg.set_servicegroupname(sg_name)
    print(lbvssg)
    try:
        NSLBVServerServiceGroupBinding.add(nitro, lbvssg)
    except NSNitroError as error:
        log.debug(
            "netscaler module error - NSLBVServerServiceGroupBinding.add() failed: %s",
            error)
        ret = False
    _disconnect(nitro)
    return ret