import org.opendaylight.netconf.api.NetconfDocumentedException;
import org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps;
import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
+import org.opendaylight.yangtools.yang.common.ErrorSeverity;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
@Override
public synchronized void put(final LogicalDatastoreType store, final YangInstanceIdentifier path,
- final NormalizedNode<?, ?> data) {
+ final NormalizedNode data) {
checkEditable(store);
// Trying to write only mixin nodes (not visible when serialized).
return;
}
- final DataContainerChild<?, ?> editStructure = netOps.createEditConfigStrcture(Optional.ofNullable(data),
+ final DataContainerChild editStructure = netOps.createEditConfigStrcture(Optional.ofNullable(data),
Optional.of(ModifyAction.REPLACE), path);
editConfig(path, Optional.ofNullable(data), editStructure, Optional.empty(), "put");
}
@Override
public synchronized void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path,
- final NormalizedNode<?, ?> data) {
+ final NormalizedNode data) {
checkEditable(store);
// Trying to write only mixin nodes (not visible when serialized).
return;
}
- final DataContainerChild<?, ?> editStructure = netOps.createEditConfigStrcture(Optional.ofNullable(data),
+ final DataContainerChild editStructure = netOps.createEditConfigStrcture(Optional.ofNullable(data),
Optional.empty(), path);
editConfig(path, Optional.ofNullable(data), editStructure, Optional.empty(), "merge");
}
/**
* Check whether the data to be written consists only from mixins.
*/
- private static boolean containsOnlyNonVisibleData(final YangInstanceIdentifier path,
- final NormalizedNode<?, ?> data) {
+ private static boolean containsOnlyNonVisibleData(final YangInstanceIdentifier path, final NormalizedNode data) {
// There's only one such case:top level list (pathArguments == 1 && data is Mixin)
// any other mixin nodes are contained by a "regular" node thus visible when serialized
return path.getPathArguments().size() == 1 && data instanceof MixinNode;
@Override
public synchronized void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
checkEditable(store);
- final DataContainerChild<?, ?> editStructure = netOps.createEditConfigStrcture(Optional.empty(),
+ final DataContainerChild editStructure = netOps.createEditConfigStrcture(Optional.empty(),
Optional.of(ModifyAction.DELETE), path);
editConfig(path, Optional.empty(), editStructure, Optional.of(ModifyAction.NONE), "delete");
}
"Can edit only configuration data, not %s", store);
}
- protected abstract void editConfig(YangInstanceIdentifier path, Optional<NormalizedNode<?, ?>> data,
- DataContainerChild<?, ?> editStructure,
+ protected abstract void editConfig(YangInstanceIdentifier path, Optional<NormalizedNode> data,
+ DataContainerChild editStructure,
Optional<ModifyAction> defaultOperation, String operation);
protected ListenableFuture<RpcResult<Void>> resultsToTxStatus() {
new Exception(throwable),
DocumentedException.ErrorType.APPLICATION,
DocumentedException.ErrorTag.OPERATION_FAILED,
- DocumentedException.ErrorSeverity.ERROR);
+ ErrorSeverity.ERROR);
transformed.setException(exception);
}
}, MoreExecutors.directExecutor());
private void extractResult(final List<DOMRpcResult> domRpcResults,
final SettableFuture<RpcResult<Void>> transformed) {
DocumentedException.ErrorType errType = DocumentedException.ErrorType.APPLICATION;
- DocumentedException.ErrorSeverity errSeverity = DocumentedException.ErrorSeverity.ERROR;
+ ErrorSeverity errSeverity = ErrorSeverity.ERROR;
StringBuilder msgBuilder = new StringBuilder();
boolean errorsEncouneterd = false;
String errorTag = "operation-failed";
errType = DocumentedException.ErrorType.APPLICATION;
break;
}
- final RpcError.ErrorSeverity severity = error.getSeverity();
- switch (severity) {
- case ERROR:
- errSeverity = DocumentedException.ErrorSeverity.ERROR;
- break;
- case WARNING:
- errSeverity = DocumentedException.ErrorSeverity.WARNING;
- break;
- default:
- errSeverity = DocumentedException.ErrorSeverity.ERROR;
- break;
- }
+
+ errSeverity = error.getSeverity().toNetconf();
msgBuilder.append(error.getMessage());
msgBuilder.append(error.getInfo());
errorTag = error.getTag();