def __init__(self,deviceConfig): self.handle=comm.ssh(deviceConfig) self.Vendor="cisco" self.Tech="router" self.Model="3600" self.DeviceType="3601" pass
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