use of org.onosproject.ovsdb.controller.OvsdbController in project onos by opennetworkinglab.
the class DefaultOpenstackNodeHandler method isDpdkIntfsCreated.
private boolean isDpdkIntfsCreated(OpenstackNode osNode, Collection<DpdkInterface> dpdkInterfaces) {
OvsdbClientService client = getOvsdbClient(osNode, ovsdbPortNum, ovsdbController);
if (client == null) {
log.info("Failed to get ovsdb client");
return false;
}
Set<OvsdbPort> ports = client.getPorts();
for (DpdkInterface dpdkIntf : dpdkInterfaces) {
Optional<OvsdbPort> port = ports.stream().filter(ovsdbPort -> ovsdbPort.portName().value().equals(dpdkIntf.intf())).findAny();
if (!port.isPresent()) {
return false;
}
Interface intf = client.getInterface(dpdkIntf.intf());
if (intf == null) {
return false;
}
OvsdbSet mtu = (OvsdbSet) intf.getMtuColumn().data();
if (mtu == null) {
return false;
}
OvsdbMap option = (OvsdbMap) intf.getOptionsColumn().data();
if (option == null) {
return false;
}
if (!mtu.set().contains(dpdkIntf.mtu().intValue()) || !option.toString().contains(dpdkIntf.pciAddress())) {
log.trace("The dpdk interface {} was created but mtu or " + "pci address is different from the config.");
return false;
}
}
return true;
}
use of org.onosproject.ovsdb.controller.OvsdbController in project onos by opennetworkinglab.
the class OvsdbControllerConfig method getOvsdbClientService.
// Used for getting OvsdbClientService.
private OvsdbClientService getOvsdbClientService(DriverHandler handler) {
OvsdbController ovsController = handler.get(OvsdbController.class);
DeviceService deviceService = handler.get(DeviceService.class);
DeviceId ofDeviceId = handler.data().deviceId();
String[] mgmtAddress = deviceService.getDevice(ofDeviceId).annotations().value(AnnotationKeys.MANAGEMENT_ADDRESS).split(":");
String targetIp = mgmtAddress[0];
TpPort targetPort = null;
if (mgmtAddress.length > 1) {
targetPort = TpPort.tpPort(Integer.parseInt(mgmtAddress[1]));
}
List<OvsdbNodeId> nodeIds = ovsController.getNodeIds().stream().filter(nodeId -> nodeId.getIpAddress().equals(targetIp)).collect(Collectors.toList());
if (nodeIds.isEmpty()) {
// TODO decide what port?
ovsController.connect(IpAddress.valueOf(targetIp), targetPort == null ? TpPort.tpPort(OvsdbConstant.OVSDBPORT) : targetPort);
// FIXME... connect is async
delay(1000);
}
List<OvsdbClientService> clientServices = ovsController.getNodeIds().stream().filter(nodeId -> nodeId.getIpAddress().equals(targetIp)).map(ovsController::getOvsdbClient).filter(cs -> cs.getBridges().stream().anyMatch(b -> dpidMatches(b, ofDeviceId))).collect(Collectors.toList());
checkState(!clientServices.isEmpty(), "No clientServices found");
// FIXME add connection to management address if null --> done ?
return !clientServices.isEmpty() ? clientServices.get(0) : null;
}
use of org.onosproject.ovsdb.controller.OvsdbController in project onos by opennetworkinglab.
the class OvsdbInterfaceConfig method getOvsdbClient.
private OvsdbClientService getOvsdbClient(DriverHandler handler) {
OvsdbController ovsController = handler.get(OvsdbController.class);
OvsdbNodeId nodeId = changeDeviceIdToNodeId(handler.data().deviceId());
return ovsController.getOvsdbClient(nodeId);
}
use of org.onosproject.ovsdb.controller.OvsdbController in project onos by opennetworkinglab.
the class OvsdbPortConfig method getOvsdbClient.
private OvsdbClientService getOvsdbClient(DriverHandler handler) {
OvsdbController ovsController = handler.get(OvsdbController.class);
OvsdbNodeId nodeId = changeDeviceIdToNodeId(handler.data().deviceId());
return ovsController.getOvsdbClient(nodeId);
}
use of org.onosproject.ovsdb.controller.OvsdbController in project onos by opennetworkinglab.
the class OvsdbQueueConfig method getOvsdbClient.
private OvsdbClientService getOvsdbClient(DriverHandler handler) {
OvsdbController ovsController = handler.get(OvsdbController.class);
OvsdbNodeId nodeId = changeDeviceIdToNodeId(handler.data().deviceId());
return ovsController.getOvsdbClient(nodeId);
}
Aggregations