def _testGetNetworkDevice1(self): nc = NetConfig(self.conf_file) swh = nc.get('swh-b050f1') assert type(swh) == CiscoIOSSwitch, 'could not get a device ' + str( type(swh)) assert swh.connect() == True, 'could not connect to device' res = swh.disconnect() assert res == None, 'could not disconnect to device ' + str(res)
'--enable' : 'enter_enable', '--profile' : 'profile=', '-f' : 'profile=', '-v' : 'verbose', '--verbose' : 'verbose' } args, options = util.parseArgs( args ) host = args.pop(0) if options.has_key( 'verbose' ) and options['verbose'] == 1: logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)-8s %(module)-25s %(funcName)-20s %(lineno)-5d %(message)s', datefmt='%a, %d %b %Y %H:%M:%S') else: logging.basicConfig(level=logging.INFO) if options.has_key( 'help' ) and options['help'] == 1: usage() sys.exit() # create object netconfig = NetConfig( config_file ) device = netconfig.get( host, options=options ) netconfig.connect( device, options ) for d in device.ports.filter(): print( "%s" % d ) device.disconnect()
def testForceProbe(self): nc = NetConfig(self.conf_file) swh = nc.get('swh-b050f1', options={'profile': 'auto'}) assert type(swh) == CiscoIOSSwitch, 'could not get a device ' + str( type(swh))