- private void registerRpcsToSal(final RpcImplementation deviceRpc) {
- final MountProvisionInstance mountInstance = salProvider.getMountInstance();
-
- final Map<QName, String> failedRpcs = Maps.newHashMap();
- for (final RpcDefinition rpcDef : mountInstance.getSchemaContext().getOperations()) {
- try {
- salRegistrations.add(mountInstance.addRpcImplementation(rpcDef.getQName(), deviceRpc));
- logger.debug("{}: Rpc {} from netconf registered successfully", id, rpcDef.getQName());
- } catch (final Exception e) {
- // Only debug per rpc, warn for all of them at the end to pollute log a little less (e.g. routed rpcs)
- logger.debug("{}: Unable to register rpc {} from netconf device. This rpc will not be available", id,
- rpcDef.getQName(), e);
- failedRpcs.put(rpcDef.getQName(), e.getClass() + ":" + e.getMessage());
- }
- }
-
- if (failedRpcs.isEmpty() == false) {
- if (logger.isDebugEnabled()) {
- logger.warn("{}: Some rpcs from netconf device were not registered: {}", id, failedRpcs);
- } else {
- logger.warn("{}: Some rpcs from netconf device were not registered: {}", id, failedRpcs.keySet());
- }
- }
- }
-
- private void registerDataHandlersToSal(final RpcImplementation deviceRpc,
- final NetconfSessionCapabilities netconfSessionPreferences) {
- final NetconfDeviceDataReader dataReader = new NetconfDeviceDataReader(id, deviceRpc);
- final NetconfDeviceCommitHandler commitHandler = new NetconfDeviceCommitHandler(id, deviceRpc,
- netconfSessionPreferences.isRollbackSupported());
-
- final MountProvisionInstance mountInstance = salProvider.getMountInstance();
- salRegistrations.add(mountInstance.registerConfigurationReader(ROOT_PATH, dataReader));
- salRegistrations.add(mountInstance.registerOperationalReader(ROOT_PATH, dataReader));
- salRegistrations.add(mountInstance.registerCommitHandler(ROOT_PATH, commitHandler));