def main(): print('config.network_devices: ', settings.config['network_device'].keys()) print('mounted: ', topology.mounted_nodes()) print('unmounted: ', topology.unmounted_nodes()) print('connected: ', topology.connected_nodes()) print('disconnected: ', topology.disconnected_nodes())
def main(): print(pydoc.plain(pydoc.render_doc(topology.mount))) try: device_name = topology.unmounted_nodes()[0] mount_device(device_name) except IndexError: print('All configured devices are mounted. Demonstration cancelled.')
def main(): print(pydoc.plain(pydoc.render_doc(topology.mount))) unmounted_list = topology.unmounted_nodes() if unmounted_list: for device_name in unmounted_list: mount_device(device_name) else: print('There are no (configured) devices unmounted.')
def connected_all_devices(): print(pydoc.plain(pydoc.render_doc(topology.mount))) unmounted_list = topology.unmounted_nodes() if unmounted_list: for device_name in unmounted_list: mount_device(device_name) # time.sleep(15) else: print('There are no (configured) devices unmounted.') print(pydoc.plain(pydoc.render_doc(topology.connected))) print('connected: ', topology.connected_nodes())
def main(): device_list=settings.config['network_device'] #dismount each nodes mounted_list = topology.mounted_nodes() if mounted_list: for device_name in mounted_list: topology.dismount(device_name) print('all devices dismount.') #mount each nodes unmounted_list = topology.unmounted_nodes() if unmounted_list: for device_name in unmounted_list: mount_device(device_name) print('mount %s' % device_name) time.sleep(1) print('mount each nodes.') time.sleep(5) connected_list = topology.connected_nodes() print('connected: ', connected_list) #mount each disconnected nodes mounted_list = topology.mounted_nodes() while len(device_list)!=len(connected_list): print('%s devices connected' % len(connected_list)) for device_name in device_list: if device_name in connected_list: continue else: if device_name in mounted_list: topology.dismount(device_name) print('dismount %s' % device_name) time.sleep(1) mount_device(device_name) print('mount %s' % device_name) time.sleep(3) if device_name in topology.connected_nodes(): print('connected %s success' % device_name) else: print('connected %s failed' % device_name) connected_list = topology.connected_nodes() print('all devices are connected!', connected_list)
def main(): print("config.network_devices: ", settings.config["network_device"].keys()) print("mounted: ", topology.mounted_nodes()) print("unmounted: ", topology.unmounted_nodes()) print("connected: ", topology.connected_nodes()) print("disconnected: ", topology.disconnected_nodes())