final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);
out.format(fmt_devices, dev.getId(), api.getAddress(), api.getMTU(),
api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP));
}
} else {
final Device dev = argDevice.getValue();
final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);
if (!argIPAddress.isSet()) {
// Print IP address(es) for device
out.format(fmt_ip, dev.getId(), api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP));
} else {
// Set IP address for device
final IPv4Address ip = argIPAddress.getValue();
final IPv4Address mask = argSubnetMask.getValue();
final IPv4ConfigurationService cfg = InitialNaming.lookup(IPv4ConfigurationService.NAME);
cfg.configureDeviceStatic(dev, ip, mask, true);
// FIXME ... this doesn't show the device's new address because the
// IPv4 ConfigurationServiceImpl calls processor.apply with the
// waitUntilReady parameter == false. (The comment in the code
// talks about avoiding deadlocks.)
out.format(fmt_set_ip, dev.getId(), api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP));
}
}
}