def nitro_ns_savec(devdetails=None, mgmtip=None): """uses nitro to login to a NS, saving the current configuration. Takes a list as argument (containing IP, name, params)""" ip_addr,id_name,params = 0,1,2 #english indexing if mgmtip = None: ns_session = nssvc(devdetails[ip_addr],'https') username = devdetails[params].split(':')[1] password = devdetails[params].split(':')[2]
enumstream = json.load(urllib2.urlopen(enum_req,context=_self.context)) for ns in enumstream['ns']: if ns['vm_state'] == 'Running': self.retlist.append(ns['ns_ip_address']) return self.retlist def nitro_ns_savec(devdetails=None, mgmtip=None): """uses nitro to login to a NS, saving the current configuration. Takes a list as argument (containing IP, name, params)""" ip_addr,id_name,params = 0,1,2 #english indexing if mgmtip = None: ns_session = nssvc(devdetails[ip_addr],'https') username = devdetails[params].split(':')[1] password = devdetails[params].split(':')[2] else: ns_session = nssvc(mgmtip,'https') username,password = '******','nsroot' ns_session.certvalidation = False ns_session.hostnameverification = False ns_session.login(username,password,3600) confobj = nsconfig confobj.save(ns_session) def discover_svm_ip(devdetails): """Uses paramiko to ssh to XS, then relay to 169.x address of svm, and issues show networkconfig, plucking the SVM IP and returning it as a string""" ip_addr,id_name,params = 0,1,2 #english indexing user = devdetails[params].split(':')[1] passwd = devdetails[params].split(':')[2] ssh_conn = paramiko.SSHClient()