use of org.onosproject.openstacknetworking.api.Constants.UNSUPPORTED_VENDOR in project onos by opennetworkinglab.
the class OpenstackDirectPortAddCommand method doExecute.
@Override
protected void doExecute() {
OpenstackNetworkService osNetService = get(OpenstackNetworkService.class);
OpenstackNodeService osNodeService = get(OpenstackNodeService.class);
DeviceService deviceService = get(DeviceService.class);
Port port = osNetService.port(portId);
if (port == null) {
log.error("There's no port that matches the port ID {}", portId);
return;
}
Optional<OpenstackNode> osNode = osNodeService.completeNodes(COMPUTE).stream().filter(node -> node.hostname().equals(port.getHostId())).findAny();
if (!osNode.isPresent()) {
log.error("There's no openstackNode that matches hostname {}", port.getHostId());
return;
}
String intfName = getIntfNameFromPciAddress(port);
if (intfName == null) {
log.error("Failed to retrieve interface name from a port {}", portId);
return;
} else if (intfName.equals(UNSUPPORTED_VENDOR)) {
return;
}
if (OpenstackNetworkingUtil.hasIntfAleadyInDevice(osNode.get().intgBridge(), intfName, deviceService)) {
log.error("Interface {} is already added to the device {}", osNode.get().intgBridge());
return;
}
log.info("Adding interface {} to the device {}..", intfName, osNode.get().intgBridge());
osNodeService.addVfPort(osNode.get(), intfName);
}
Aggregations