Exemplo n.º 1
0
 def execute(self,State,cmd=""):
     """
     Simulate Linux server
     """
     self.init(State)
     if self.logflag== True:
         self.logger.log(self.info)
          
     # 1.connect to Linux machine
     self = Command.getClient(self)
     if self.stat == self.FAILED:
         return self.FAILED
     
     # record time
     starttime = time.time()
     duration = 0
     binpath = Command.checkPath(self.buildInstallPath)+self.buildNo+"/"+self.buildVersion+"/BIN/"+self.OS+"/bin/"
     getStatusCommnad = binpath+"mstrctl -s IntelligenceServer gs"
     statusInfo = Command.executeSshNull(getStatusCommnad,self.client)
     xmlInfo = xml.dom.minidom.parseString(statusInfo)
     root=xmlInfo.documentElement   
     state = ""
     node= root.getElementsByTagName('state')[0]
     for node in node.childNodes:
         state = node.data
         
     if state.lower().find("running") == -1:
         self.stat = self.FAILED
         self.info ="iserver is not started, please start iserver before running"
         if self.logflag == True:
             self.logger.log(self.info)
         return self.FAILED
     
     Command.executeScreenSshNull(cmd,self.client, self.server)
     time.sleep(5)
     print self.getScreenInfo()
     
     self.stat=self.PASS
     self.info="Simulate Linux iserver task has completed!"
     if self.logflag == True:
         self.logger.log(self.info)
     return self.PASS  
     
     
     
Exemplo n.º 2
0
 def getScreenInfo(self):
     """
     get screenlog info   
     """
     screenlog = Command.executeSshNull("tail -50 " + Command.checkPath(self.screenlogpath) + "screen_" + self.server+".log", self.client)
     return screenlog