use of org.onosproject.openstacknetworking.api.Constants.DIRECT in project onos by opennetworkinglab.
the class OpenstackDirectPortListCommand method doExecute.
@Override
protected void doExecute() {
OpenstackNetworkService service = get(OpenstackNetworkService.class);
List<Port> ports = service.ports().stream().filter(port -> port.getvNicType().equals(DIRECT)).collect(Collectors.toList());
print(FORMAT, "ID", "Network", "MAC", "FIXED IPs", "PCI Slot", "Interface");
for (Port port : ports) {
List<String> fixedIps = port.getFixedIps().stream().map(IP::getIpAddress).collect(Collectors.toList());
Network osNet = service.network(port.getNetworkId());
if (port.getVifType().equals(UNBOUND)) {
print(FORMAT, port.getId(), deriveResourceName(osNet), port.getMacAddress(), fixedIps.isEmpty() ? "" : fixedIps, UNBOUND, UNBOUND);
} else {
print(FORMAT, port.getId(), deriveResourceName(osNet), port.getMacAddress(), fixedIps.isEmpty() ? "" : fixedIps, port.getProfile().containsKey(PCISLOT) ? port.getProfile().get(PCISLOT).toString() : "", getIntfNameFromPciAddress(port));
}
}
}
Aggregations