Esempio n. 1
0
def Gen_SSLBESvc(prefix='ssl_svc', count=1, port=443, type='SSL'):

    if not DUT.SESSION:
        raise TestException(100)
    if not DUT.SNIP:
        raise TestException(101)

    nameG = GenerateNames(prefix, count)
    numG = GenerateNumbers(port, count)

    serviceList = []

    for name in nameG:
        port = numG.next()
        ip = BESERVER

        s = NSSVC()
        s.name = name
        s.ip = ip
        s.port = port
        s.servicetype = type
        s.maxreq = 1

        serviceList.append(s)

    NSSVC.add(DUT.SESSION, serviceList)
    return serviceList
Esempio n. 2
0
 def add_service(self, client) :
     try :
         port=80
         service1 = service()
         service1.name = "svc10"
         service1.ip = "10.102.3.23"
         service1.port = port
         service1.servicetype = "http"
         service.add(client, service1)                
         print("add_service - Done")
     except nitro_exception as e :
         print("Exception::add_service::errorcode="+str(e.errorcode)+",message="+ e.message)
     except Exception as e:
         print("Exception::add_service::message="+str(e.args))
    def add_service(self, client , svc_name , port, SRVS,j) :

        try :
            svc = [service() for _ in range(j)]
            for l in range (1,j):
                svc[l].name = svc_name+"-"+SRVS+str(l)
                svc[l].servername = SRVS+str(l)
                svc[l].port = port
                svc[l].servicetype = service.Servicetype.HTTP
                service.add(client, svc[l])
                print("add_service -"+svc[l].servername+" - Done\n")
                l += 1
        except nitro_exception as e :
            print("Exception::add_service::errorcode="+str(e.errorcode)+",message="+ e.message)
        except Exception as e:
            print("Exception::add_service::message="+str(e.args))
Esempio n. 4
0
    def addServices(self):
        """Configure the services for the NetScaler"""
        try:

            #Setup the new service 1 HTTPS
            newSVC = service()
            newSVC.name = self.service1
            newSVC.ip = self.ip
            newSVC.port = "80"
            newSVC.servicetype = "http"
            #Add the new service1 and service
            service.add(self.ns_session, newSVC)

        except nitro_exception as e:
            print("Exception::errorcode=" + str(e.errorcode) + ",message=" +
                  e.message)
        except Exception as e:
            print("Exception::message=" + str(e.args))
        return
Esempio n. 5
0
def AddDelOneSvc(session, svc, type, ip, port, isdel=0):
    s = None
    try:
        s = NSSVC()
        s.name = svc
        s.ip = ip
        s.port = port
        s.servicetype = type

        if (isdel == 0):
            NSSVC.add(session, s)
        else:
            NSSVC.delete(session, s)

    except NITROEXCEPTION.nitro_exception as e:
        print 'Nitro exception:::: {0}'.format(e.message)
        s = None
        ret = e.errorcode

    return s
Esempio n. 6
0
    def addServices(self):
        """Configure the services for the NetScaler"""
        if "services" in self.cfg.keys():
            #Lets loop through all the services
            for svc in self.cfg['services']:
                try:
                    #Setup the new service
                    newSVC = service()
                    newSVC.name = svc['name']
                    newSVC.ip = svc['ip']
                    newSVC.port = svc['port']
                    newSVC.servicetype = svc['type']

                    #Add the new service
                    service.add(self.ns_session, newSVC)

                except nitro_exception as e:
                    print("Exception::errorcode=" + str(e.errorcode) +
                          ",message=" + e.message)
                except Exception as e:
                    print("Exception::message=" + str(e.args))

        return
Esempio n. 7
0
    def addServices(self):
        """Configure the services for the NetScaler"""
        if "services" in self.cfg.keys():
            #Lets loop through all the services
            for svc in self.cfg['services']:
                try:
                    #Setup the new service
                    newSVC = service()
                    newSVC.name = svc['name']
                    newSVC.ip = svc['ip']
                    newSVC.port = svc['port']
                    newSVC.servicetype = svc['type']

                    #Add the new service
                    service.add(self.ns_session, newSVC)

                except nitro_exception as e:
                    print("Exception::errorcode=" +
                          str(e.errorcode) + ",message=" + e.message)
                except Exception as e:
                    print("Exception::message=" + str(e.args))

        return
Esempio n. 8
0
    def addlbvserver_bindings(self, client) :
        try :
            obj = lbvserver_service_binding()
            obj.name = "lb_vip"
            obj.servicename = "svc10"
            obj.weight = 77
            lbvserver_service_binding.add(client, obj)
            lbvserver_service_binding.delete(client, obj)
            print("addlbvserver_bindings - Done")
            svc = [ service() for _ in range(2)] 
            svc[0].name = "svc_1"
            svc[0].ip = "1.1.1.1"
            svc[0].port = 80
            svc[0].servicetype = service.Servicetype.HTTP

            svc[1].name = "svc_2"
            svc[1].ip = "1.1.1.1"
            svc[1].port = 81
            svc[1].servicetype = service.Servicetype.HTTP

            bindsvc = [lbvserver_service_binding() for _ in range(2)]
            bindsvc[0].name = "lb_vip"
            bindsvc[0].servicename = "svc_1"
            bindsvc[0].weight = 20

            bindsvc[1].name = "lb_vip"
            bindsvc[1].servicename = "svc_2"
            bindsvc[1].weight = 30

            service.add(client, svc)
            lbvserver_service_binding.add(client, bindsvc)			
            print("addlbvserver_bindings - Done")
        except nitro_exception as e :
            print("Exception::addlbvserver_bindings::errorcode="+str(e.errorcode)+",message="+ e.message)
        except Exception as e:
            print("Exception::addlbvserver_bindings::message="+str(e.args))
Esempio n. 9
0
# Nitro Imports
from nssrc.com.citrix.netscaler.nitro.service.nitro_service import nitro_service
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_exception
from nssrc.com.citrix.netscaler.nitro.resource.config.basic.service import service

if __name__ == '__main__':
    """Create the NetScaler session using HTTP, passing in the credentials to
    the NSIP"""
    try:  # Error Handling
        ns_session = nitro_service("192.168.1.50", "HTTP")  # Create session

        ns_session.set_credential("nsroot", "nsroot")  # Set the session creds
        ns_session.timeout = 300  # Set Timeout in seconds

        ns_session.login()  # Preform login

        newSVC = service()  # Create new Service instance
        newSVC.name = "service1"  # Define a name
        newSVC.ip = "8.8.8.8"  # Define the service IP
        newSVC.port = "80"  # Define the service port
        newSVC.servicetype = "HTTP"  # Define the service type

        #Add the new service
        service.add(ns_session, newSVC)  # Add the service to the NetScaler

    except nitro_exception as e:  # Error Handling
        print("Exception::errorcode=" +
              str(e.errorcode) + ",message=" + e.message)
    except Exception as e:
        print("Exception::message=" + str(e.args))
Esempio n. 10
0
# Nitro Imports
from nssrc.com.citrix.netscaler.nitro.service.nitro_service import nitro_service
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_exception
from nssrc.com.citrix.netscaler.nitro.resource.config.basic.service import service

if __name__ == '__main__':
    """Create the NetScaler session using HTTP, passing in the credentials to
    the NSIP"""
    try:  # Error Handling
        ns_session = nitro_service("192.168.1.50", "HTTP")  # Create session

        ns_session.set_credential("nsroot", "nsroot")  # Set the session creds
        ns_session.timeout = 300  # Set Timeout in seconds

        ns_session.login()  # Preform login

        newSVC = service()  # Create new Service instance
        newSVC.name = "service1"  # Define a name
        newSVC.ip = "8.8.8.8"  # Define the service IP
        newSVC.port = "80"  # Define the service port
        newSVC.servicetype = "HTTP"  # Define the service type

        #Add the new service
        service.add(ns_session, newSVC)  # Add the service to the NetScaler

    except nitro_exception as e:  # Error Handling
        print("Exception::errorcode=" + str(e.errorcode) + ",message=" +
              e.message)
    except Exception as e:
        print("Exception::message=" + str(e.args))