def vserver_add(v_name, v_ip, v_port, v_type, **connection_args): ''' Add a new lb vserver CLI Example: .. code-block:: bash salt '*' netscaler.vserver_add 'vserverName' 'vserverIP' 'vserverPort' 'vserverType' salt '*' netscaler.vserver_add 'alex.patate.chaude.443' '1.2.3.4' '443' 'SSL' ''' ret = True if vserver_exists(v_name, **connection_args): return False nitro = _connect(**connection_args) if nitro is None: return False vserver = NSLBVServer() vserver.set_name(v_name) vserver.set_ipv46(v_ip) vserver.set_port(v_port) vserver.set_servicetype(v_type.upper()) try: NSLBVServer.add(nitro, vserver) except NSNitroError, e: log.debug('netscaler module error - NSLBVServer.add() failed: {0}'.format(e.message)) ret = False
def vserver_add(v_name, v_ip, v_port, v_type, **connection_args): ''' Add a new lb vserver CLI Example: .. code-block:: bash salt '*' netscaler.vserver_add 'vserverName' 'vserverIP' 'vserverPort' 'vserverType' salt '*' netscaler.vserver_add 'alex.patate.chaude.443' '1.2.3.4' '443' 'SSL' ''' ret = True if vserver_exists(v_name, **connection_args): return False nitro = _connect(**connection_args) if nitro is None: return False vserver = NSLBVServer() vserver.set_name(v_name) vserver.set_ipv46(v_ip) vserver.set_port(v_port) vserver.set_servicetype(v_type.upper()) try: NSLBVServer.add(nitro, vserver) except NSNitroError as e: log.debug( 'netscaler module error - NSLBVServer.add() failed: {0}'.format( e.message)) ret = False _disconnect(nitro) return ret
def lbvserver_add(lbvs_name, lbvs_type, persistype, backupvs, ip, port, clttimeout, timeout, **connection_args): """ Add lb vs server CLI Example: .. code-block:: bash salt '*' netscaler.lbvserver_add 'lbvsName' 'lbvsType' """ ret = True nitro = _connect(**connection_args) if nitro is None: return False lbvs = NSLBVServer() lbvs.set_name(lbvs_name) lbvs.set_servicetype(lbvs_type) lbvs.set_ipv46(ip) lbvs.set_port(port) lbvs.set_persistencetype(persistype) lbvs.set_backupvserver(backupvs) lbvs.set_clttimeout(clttimeout) lbvs.set_timeout(timeout) try: NSLBVServer.add(nitro, lbvs) except NSNitroError as error: log.debug("netscaler module error - NSLBVServer.add() failed: %s", error) ret = False _disconnect(nitro) return ret
def action_addlbvserver(args, nitro): lbvserver = NSLBVServer() lbvserver.set_name(args.lbvserver) lbvserver.set_ipv46(args.ip) lbvserver.set_port(args.port) lbvserver.set_clttimeout(args.clttimeout) lbvserver.set_persistencetype(args.persistencetype) lbvserver.set_servicetype(args.servicetype) NSLBVServer.add(nitro, lbvserver) print "lb vserver %s (%s:%d/%s) was added" % (args.lbvserver, args.ip, args.port, args.servicetype)
print "unbound server %s from service group %s on port %s" % (args.servername, args.servicegroupname, args.serviceport) except nsnitro.nsexceptions.nsexceptions.NSNitroNserrNoent as e: print "Error: ", e.message finally: nitro.logout() sys.exit(0) if args.addlbvserver: if not args.port or not args.ip: print "--ip and --port are required for adding LB Vserver" nitro.logout() sys.exit(0) lbvserver = NSLBVServer() lbvserver.set_name(args.addlbvserver) lbvserver.set_ipv46(args.ip) lbvserver.set_port(args.port) lbvserver.set_clttimeout(args.clttimeout) lbvserver.set_persistencetype(args.persistencetype) lbvserver.set_servicetype(args.servicetype) NSLBVServer.add(nitro, lbvserver) print "lb vserver %s (%s:%d/%s) was added" % (args.addlbvserver, args.ip, args.port, args.servicetype) nitro.logout() sys.exit(0) if args.enablelbvserver: lbvserver = NSLBVServer() lbvserver.set_name(args.enablelbvserver) NSLBVServer.enable(nitro, lbvserver) print "Enabled lb vserver: %s" % args.enablelbvserver nitro.logout()