コード例 #1
0
ファイル: Devices.py プロジェクト: konfirmix/konfirmix_server
 def __init__(self,deviceConfig):
     self.handle=comm.ssh(deviceConfig)
     self.Vendor="cisco"
     self.Tech="router"
     self.Model="3600"
     self.DeviceType="3601"
     pass
コード例 #2
0
 def initializeDevices(self,devices):
     print 'initializing devices'
     self.devices = dict()
     for i in range(0,len(self.transcript)):
         step = self.transcript[i]
         if(step['command']['type'] == 'cliCommand'):
             deviceName = step['command']['arguments']['device']
             device =table.getRowFromTable(devices,'deviceName',deviceName)
             if(deviceName in self.devices.keys()):
                 print 'Device already connected '+deviceName
             else:
                 try:
                     print 'Connecting device '+deviceName
                     self.devices[deviceName] = comm.ssh(device)
                     self.devices[deviceName].connectDevice()
                     if(self.devices[deviceName].handle.before == ''):
                         raise Exception
                 except:
                    #print self.devices[deviceName].handle
                    print 'could not connect device '+ deviceName
                    return False
     return True