use of org.onosproject.netconf.NetconfProxyMessage in project onos by opennetworkinglab.
the class NetconfControllerImpl method pingDevice.
@Override
public <T> boolean pingDevice(DeviceId deviceId) {
NetconfProxyMessage proxyMessage = new DefaultNetconfProxyMessage(NetconfProxyMessage.SubjectType.GET_DEVICE_CAPABILITIES_SET, deviceId, null, localNodeId);
CompletableFuture<T> reply;
if (deviceService.getRole(deviceId).equals(MastershipRole.MASTER)) {
reply = handleProxyMessage(proxyMessage);
} else {
reply = relayMessageToMaster(proxyMessage);
}
try {
T deviceCapabilities = reply.get();
log.debug("Get device capabilities from device : {} -> {}", deviceId, deviceCapabilities);
} catch (InterruptedException | ExecutionException e) {
log.error("Error while getting device capabilities for device : {}", deviceId);
log.error("Error details : ", e);
return false;
}
return true;
}
use of org.onosproject.netconf.NetconfProxyMessage in project onos by opennetworkinglab.
the class NetconfSessionProxyImpl method startSubscription.
@Override
public void startSubscription(String filterSchema) throws NetconfException {
NetconfProxyMessage proxyMessage = makeProxyMessage(NetconfProxyMessage.SubjectType.START_SUBSCRIPTION, filterSchema);
executeAtMaster(proxyMessage);
}
use of org.onosproject.netconf.NetconfProxyMessage in project onos by opennetworkinglab.
the class NetconfSessionProxyImpl method setOnosCapabilities.
@Override
public void setOnosCapabilities(Iterable<String> capabilities) {
ArrayList<String> capabilitiesList = new ArrayList<>();
capabilities.spliterator().forEachRemaining(c -> capabilitiesList.add(c));
NetconfProxyMessage proxyMessage = new DefaultNetconfProxyMessage(NetconfProxyMessage.SubjectType.SET_ONOS_CAPABILITIES, deviceInfo.getDeviceId(), capabilitiesList, sessionNodeId);
try {
executeAtMaster(proxyMessage);
} catch (NetconfException e) {
log.error("Could not set onos capabilities : {}", e);
}
}
use of org.onosproject.netconf.NetconfProxyMessage in project onos by opennetworkinglab.
the class NetconfSessionProxyImpl method endSubscription.
@Override
public void endSubscription() throws NetconfException {
NetconfProxyMessage proxyMessage = makeProxyMessage(NetconfProxyMessage.SubjectType.END_SUBSCRIPTION, "");
executeAtMaster(proxyMessage);
}
use of org.onosproject.netconf.NetconfProxyMessage in project onos by opennetworkinglab.
the class NetconfControllerImpl method activate.
@Activate
public void activate(ComponentContext context) {
cfgService.registerProperties(getClass());
modified(context);
Security.addProvider(new BouncyCastleProvider());
clusterCommunicator.<NetconfProxyMessage>addSubscriber(SEND_REQUEST_SUBJECT_STRING, SERIALIZER::decode, this::handleProxyMessage, remoteRequestExecutor);
clusterCommunicator.<NetconfProxyMessage>addSubscriber(SEND_REQUEST_SUBJECT_SET_STRING, SERIALIZER::decode, this::handleProxyMessage, remoteRequestExecutor);
clusterCommunicator.<NetconfProxyMessage>addSubscriber(SEND_REPLY_SUBJECT_STRING, SERIALIZER::decode, this::handleProxyReplyMessage, remoteRequestExecutor);
clusterCommunicator.<NetconfProxyMessage>addSubscriber(SEND_REPLY_SUBJECT_SET_STRING, SERIALIZER::decode, this::handleProxyReplyMessage, remoteRequestExecutor);
localNodeId = Optional.ofNullable(clusterService.getLocalNode()).map(ControllerNode::id).orElseGet(() -> new NodeId("nullNodeId"));
log.info("Started");
}
Aggregations