def main(): if mounted(device_name): print('Preparation.') print('device_dismount(', device_name, sep='', end=')\n') device_dismount(device_name) time.sleep(1) print() print('Verify absence of unreachable device.') in_inventory = device_name in inventory() in_mounted = device_name in inventory_mounted() print(device_name + ' in inventory', in_inventory, sep=': ') print(device_name + ' is mounted', in_mounted, sep=': ') assert not in_inventory assert not in_mounted del in_inventory, in_mounted print() print('Discover effect of mounting unreachable device.') print('device_mount(' + device_name, device_address, device_port, sep=', ', end=')\n') device_mount(device_name, device_address, device_port, device_username, device_password) time.sleep(1) in_connected = device_name in inventory_connected() in_mounted = device_name in inventory_mounted() print(device_name + ' is connected', in_connected, sep=': ') print(device_name + ' is mounted', in_mounted, sep=': ') assert not in_connected assert in_mounted
def demonstrate(device_name): device_config = config['network_device'][device_name] print('device_mount(' + device_name, *device_config.values(), sep=', ', end=')\n') device_mount(device_name, device_config['address'], device_config['port'], device_config['username'], device_config['password'])
def mount_from_settings(device_name): """Mount the specified device with the configured settings.""" device_config = config['network_device'][device_name] print('device_mount(' + device_name, *device_config.values(), sep=', ', end=')\n') device_mount(device_name, device_config['address'], device_config['port'], device_config['username'], device_config['password'])
def demonstrate(device_name): device_config = config['network_device'][device_name] print('device_mount(' + device_name, *device_config.values(), sep=', ', end=')\n') device_mount( device_name, device_config['address'], device_config['port'], device_config['username'], device_config['password'])
def mount_from_settings(device_name): """Mount the specified device with the configured settings.""" device_config = config['network_device'][device_name] print('device_mount(' + device_name, *device_config.values(), sep=', ', end=')\n') device_mount( device_name, device_config['address'], device_config['port'], device_config['username'], device_config['password'])
def mount_from_settings(device_name): """ Mount the specified device using the configured settings. Return a DeviceControl representation of the configured settings. """ device_config = network_device_dict[device_name] control = DeviceControl(device_name=device_name, **device_config) device_mount(control.device_name, control.address, control.port, control.username, control.password) return control
def mount_from_settings(device_name): """ Mount the specified device using the configured settings. Return a DeviceControl representation of the configured settings. """ device_config = network_device_dict[device_name] control = DeviceControl(device_name=device_name, **device_config) device_mount( control.device_name, control.address, control.port, control.username, control.password) return control
def setUp(self): unmounted_list = inventory_unmounted() for device_name in unmounted_list: device_config = self.network_device_config[device_name] print('setup: device_mount(' + device_name, *device_config.values(), sep=', ', end=')\n') device_mount( device_name, device_config['address'], device_config['port'], device_config['username'], device_config['password']) if unmounted_list: print('Sleep to allow Controller to update...') time.sleep(2) self.assertTrue(inventory_mounted(), 'Not mounted: ' + str(inventory_unmounted()))
def main(): print(plain(doc(device_mount))) unmounted_list = inventory_unmounted() if not unmounted_list: print('There are no (configured) devices unmounted.') else: configured = settings.config['network_device'] for device_name in unmounted_list: device_config = configured[device_name] print('device_mount(' + device_name, *device_config.values(), sep=', ', end=')\n') device_mount( device_name, device_config['address'], device_config['port'], device_config['username'], device_config['password'])
def setUp(self): unmounted_list = inventory_unmounted() for device_name in unmounted_list: device_config = self.network_device_config[device_name] print('setup: device_mount(' + device_name, *device_config.values(), sep=', ', end=')\n') device_mount(device_name, device_config['address'], device_config['port'], device_config['username'], device_config['password']) if unmounted_list: print('Sleep to allow Controller to update...') time.sleep(2) self.assertTrue(inventory_mounted(), 'Not mounted: ' + str(inventory_unmounted()))
def test_mount_device(self): self.assertTrue(self.network_device_config, 'One or more devices must be configured.') unmounted_list = inventory_unmounted() self.assertTrue(unmounted_list, 'One or more devices must be unmounted.') for device_name in unmounted_list: device_config = self.network_device_config[device_name] print('test: device_mount(' + device_name, *device_config.values(), sep=', ', end=')\n') device_mount( device_name, device_config['address'], device_config['port'], device_config['username'], device_config['password']) print('Sleep to allow Controller to update...') time.sleep(2) for device_name in unmounted_list: self.assertTrue(mounted(device_name), 'Not mounted: ' + device_name)
def test_mount_device(self): self.assertTrue(self.network_device_config, 'One or more devices must be configured.') unmounted_list = inventory_unmounted() self.assertTrue(unmounted_list, 'One or more devices must be unmounted.') for device_name in unmounted_list: device_config = self.network_device_config[device_name] print('test: device_mount(' + device_name, *device_config.values(), sep=', ', end=')\n') device_mount(device_name, device_config['address'], device_config['port'], device_config['username'], device_config['password']) print('Sleep to allow Controller to update...') time.sleep(2) for device_name in unmounted_list: self.assertTrue(mounted(device_name), 'Not mounted: ' + device_name)