import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.OperationFailedException;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.YangError;
* A string which provides a plain text string describing the error.
*/
public RestconfDocumentedException(final String message) {
- this(message, RestconfError.ErrorType.APPLICATION, RestconfError.ErrorTag.OPERATION_FAILED);
+ this(message, ErrorType.APPLICATION, RestconfError.ErrorTag.OPERATION_FAILED);
}
/**
*/
public RestconfDocumentedException(final String message, final ErrorType errorType, final ErrorTag errorTag,
final Throwable cause) {
- this(cause, new RestconfError(errorType, errorTag, message, null,
- cause.getMessage(), null));
+ this(cause, new RestconfError(errorType, errorTag, message, null, cause.getMessage(), null));
}
/**
* The underlying exception cause.
*/
public RestconfDocumentedException(final String message, final Throwable cause) {
- this(cause, new RestconfError(RestconfError.ErrorType.APPLICATION, RestconfError.ErrorTag.OPERATION_FAILED,
+ this(cause, new RestconfError(ErrorType.APPLICATION, RestconfError.ErrorTag.OPERATION_FAILED,
message, null, cause.getMessage(), null));
}
if (!errors.isEmpty()) {
this.errors = ImmutableList.copyOf(errors);
} else {
- this.errors = ImmutableList.of(new RestconfError(RestconfError.ErrorType.APPLICATION,
+ this.errors = ImmutableList.of(new RestconfError(ErrorType.APPLICATION,
RestconfError.ErrorTag.OPERATION_FAILED, message));
}
public static void throwIfYangError(final Throwable cause) {
if (cause instanceof YangError) {
final YangError error = (YangError) cause;
- throw new RestconfDocumentedException(cause, new RestconfError(ErrorType.valueOf(error.getErrorType()),
+ throw new RestconfDocumentedException(cause, new RestconfError(error.getErrorType().toNetconf(),
// FIXME: this is a special-case until we have YangError.getTag()
cause instanceof YangInvalidValueException ? ErrorTag.INVALID_VALUE : ErrorTag.MALFORMED_MESSAGE,
error.getErrorMessage().orElse(null), error.getErrorAppTag().orElse(null)));
import java.io.Serializable;
import java.util.Locale;
-import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.slf4j.Logger;
private static final Logger LOG = LoggerFactory.getLogger(RestconfError.class);
private static final long serialVersionUID = 1L;
- // FIXME: remove this enum in favor of RpcError.ErrorType (or its equivalent)
- public enum ErrorType {
- /**
- * Errors relating to the transport layer.
- */
- TRANSPORT,
- /**
- * Errors relating to the RPC or notification layer.
- */
- RPC,
- /**
- * Errors relating to the protocol operation layer.
- */
- PROTOCOL,
- /**
- * Errors relating to the server application layer.
- */
- APPLICATION;
-
- public String getErrorTypeTag() {
- return name().toLowerCase(Locale.ROOT);
- }
-
- public static ErrorType valueOfCaseInsensitive(final String value) {
- try {
- return ErrorType.valueOf(ErrorType.class, value.toUpperCase(Locale.ROOT));
- } catch (IllegalArgumentException e) {
- return APPLICATION;
- }
- }
-
- public static @NonNull ErrorType valueOf(final RpcError.ErrorType errorType) {
- switch (errorType) {
- case PROTOCOL:
- return PROTOCOL;
- case RPC:
- return RPC;
- case TRANSPORT:
- return TRANSPORT;
- case APPLICATION:
- default:
- return APPLICATION;
- }
- }
- }
-
public enum ErrorTag {
IN_USE("in-use", 409 /* Conflict */),
INVALID_VALUE("invalid-value", 400 /* Bad Request */),
*/
public RestconfError(final RpcError rpcError) {
- this.errorType = rpcError.getErrorType() == null ? ErrorType.APPLICATION : ErrorType
- .valueOfCaseInsensitive(rpcError.getErrorType().name());
+ this.errorType = rpcError.getErrorType().toNetconf();
this.errorTag = rpcError.getTag() == null ? ErrorTag.OPERATION_FAILED : ErrorTag
.valueOfCaseInsensitive(rpcError.getTag());
@Override
public String toString() {
return "RestconfError ["
- + "error-type: " + errorType.getErrorTypeTag() + ", error-tag: " + errorTag.getTagValue()
+ + "error-type: " + errorType.elementBody() + ", error-tag: " + errorTag.getTagValue()
+ (errorAppTag != null ? ", error-app-tag: " + errorAppTag : "")
+ (errorMessage != null ? ", error-message: " + errorMessage : "")
+ (errorInfo != null ? ", error-info: " + errorInfo : "")
import java.util.Collection;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.SchemaNode;
throw new RestconfDocumentedException("Schema node " + schemaNodeName + " does not exist in module.",
ErrorType.PROTOCOL, ErrorTag.DATA_MISSING);
}
-
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.restconf.common.validation;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
+import org.opendaylight.yangtools.yang.common.ErrorType;
/**
* sal-rest-connector
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.schema.SchemaExportContext;
import org.opendaylight.restconf.common.validation.RestconfValidationUtils;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.util.RestUtil;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.patch.PatchContext;
import org.opendaylight.restconf.common.patch.PatchEditOperation;
import org.opendaylight.restconf.common.patch.PatchEntity;
import org.opendaylight.restconf.common.util.RestUtil;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
for (final RestconfError restconfError : errors) {
jsonWriter.beginObject();
- jsonWriter.name("error-type").value(restconfError.getErrorType().getErrorTypeTag());
+ jsonWriter.name("error-type").value(restconfError.getErrorType().elementBody());
jsonWriter.name("error-tag").value(restconfError.getErrorTag().getTagValue());
// optional node
for (final RestconfError restconfError : errors) {
writer.writeStartElement("error-type");
- writer.writeCharacters(restconfError.getErrorType().getErrorTypeTag());
+ writer.writeCharacters(restconfError.getErrorType().elementBody());
writer.writeEndElement();
writer.writeStartElement("error-tag");
final DataSchemaNode errTypSchemaNode = Iterables.getFirst(lsChildDataSchemaNode, null);
checkState(errTypSchemaNode instanceof LeafSchemaNode);
errNodeValues.withChild(SchemaAwareBuilders.leafBuilder((LeafSchemaNode) errTypSchemaNode)
- .withValue(error.getErrorType().getErrorTypeTag()).build());
+ .withValue(error.getErrorType().elementBody()).build());
lsChildDataSchemaNode = ControllerContext.findInstanceDataChildrenByName(
listStreamSchemaNode, "error-tag");
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.util.RestUtil;
import org.opendaylight.yangtools.util.xml.UntrustedXML;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.patch.PatchContext;
import org.opendaylight.restconf.common.patch.PatchEditOperation;
import org.opendaylight.restconf.common.patch.PatchEntity;
import org.opendaylight.restconf.common.util.RestUtil;
import org.opendaylight.yangtools.util.xml.UntrustedXML;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.common.XMLNamespace;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.patch.PatchContext;
import org.opendaylight.restconf.common.patch.PatchEditOperation;
import org.opendaylight.restconf.common.patch.PatchEntity;
import org.opendaylight.restconf.common.patch.PatchStatusEntity;
import org.opendaylight.restconf.common.util.DataChangeScope;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
patchContext.getPatchId(),
null,
false,
- ImmutableList.of(new RestconfError(
- ErrorType.APPLICATION,
- ErrorTag.OPERATION_FAILED,
- "DOM data broker service isn't available for mount point "
- + mountPoint.getIdentifier()))
+ ImmutableList.of(new RestconfError(ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED,
+ "DOM data broker service isn't available for mount point " + mountPoint.getIdentifier()))
);
}
}
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.util.RestUtil;
import org.opendaylight.yangtools.concepts.IllegalArgumentCodec;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.common.XMLNamespace;
import org.opendaylight.restconf.common.util.SimpleUriInfo;
import org.opendaylight.yangtools.yang.common.OperationFailedException;
import org.opendaylight.yangtools.yang.common.RpcError;
-import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
final RpcError[] to = new RpcError[from.size()];
int index = 0;
for (final RestconfError e: from) {
- to[index++] = RpcResultBuilder.newError(toRpcErrorType(e.getErrorType()), e.getErrorTag().getTagValue(),
+ to[index++] = RpcResultBuilder.newError(e.getErrorType().toLegacy(), e.getErrorTag().getTagValue(),
e.getErrorMessage());
}
return to;
}
-
- private static ErrorType toRpcErrorType(final RestconfError.ErrorType errorType) {
- switch (errorType) {
- case TRANSPORT: {
- return ErrorType.TRANSPORT;
- }
- case RPC: {
- return ErrorType.RPC;
- }
- case PROTOCOL: {
- return ErrorType.PROTOCOL;
- }
- default: {
- return ErrorType.APPLICATION;
- }
- }
- }
}
import org.opendaylight.restconf.common.context.WriterParameters;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
public final class QueryParametersParser {
final int depth = Integer.parseInt(param);
if (depth < 1) {
throw new RestconfDocumentedException(
- new RestconfError(RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE,
+ new RestconfError(ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE,
"Invalid depth parameter: " + depth, null,
"The depth parameter must be an integer > 1 or \"unbounded\""));
}
wpBuilder.setDepth(depth);
} catch (final NumberFormatException e) {
throw new RestconfDocumentedException(e, new RestconfError(
- RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE,
+ ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE,
"Invalid depth parameter: " + e.getMessage(), null,
"The depth parameter must be an integer > 1 or \"unbounded\""));
}
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.patch.PatchContext;
import org.opendaylight.restconf.common.patch.PatchStatusContext;
import org.opendaylight.restconf.common.util.DataChangeScope;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType;
import org.opendaylight.yangtools.yang.common.Empty;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.Revision;
Assert.fail("Test should fail due to malformed PUT operation message");
} catch (final RestconfDocumentedException exception) {
final RestconfError restconfError = exception.getErrors().get(0);
- Assert.assertEquals(RestconfError.ErrorType.PROTOCOL, restconfError.getErrorType());
+ Assert.assertEquals(ErrorType.PROTOCOL, restconfError.getErrorType());
Assert.assertEquals(RestconfError.ErrorTag.MALFORMED_MESSAGE, restconfError.getErrorTag());
}
}
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.Revision;
Assert.fail("Test should fail due to malformed PUT operation message");
} catch (final RestconfDocumentedException exception) {
final RestconfError restconfError = exception.getErrors().get(0);
- Assert.assertEquals(RestconfError.ErrorType.PROTOCOL, restconfError.getErrorType());
+ Assert.assertEquals(ErrorType.PROTOCOL, restconfError.getErrorType());
Assert.assertEquals(RestconfError.ErrorTag.MALFORMED_MESSAGE, restconfError.getErrorTag());
}
}
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.patch.PatchContext;
import org.opendaylight.restconf.common.patch.PatchStatusContext;
import org.opendaylight.restconf.common.util.DataChangeScope;
import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.yangtools.util.xml.UntrustedXML;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
}
- assertEquals("error-type", expErrorType.getErrorTypeTag(), leafMap.remove("error-type"));
+ assertEquals("error-type", expErrorType.elementBody(), leafMap.remove("error-type"));
assertEquals("error-tag", expErrorTag.getTagValue(), leafMap.remove("error-tag"));
verifyOptionalJsonLeaf(leafMap.remove("error-message"), expErrorMessage, "error-message");
throws Exception {
final String errorType = (String) ERROR_TYPE.evaluate(errorNode, XPathConstants.STRING);
- assertEquals("error-type", expErrorType.getErrorTypeTag(), errorType);
+ assertEquals("error-type", expErrorType.elementBody(), errorType);
final String errorTag = (String) ERROR_TAG.evaluate(errorNode, XPathConstants.STRING);
assertEquals("error-tag", expErrorTag.getTagValue(), errorTag);
package org.opendaylight.controller.sal.restconf.impl.test;
import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
assertEquals("in-use", ErrorTag.IN_USE.getTagValue());
}
- @Test
- public void testErrorTypeGetErrorTypeTagIsLowerCase() {
- assertEquals(ErrorType.APPLICATION.name().toLowerCase(), ErrorType.APPLICATION.getErrorTypeTag());
- }
-
- @Test
- public void testErrorTypeValueOf() {
- assertEquals(ErrorType.APPLICATION, ErrorType.valueOfCaseInsensitive(ErrorType.APPLICATION.getErrorTypeTag()));
- }
-
@Test
public void testErrorTagStatusCodes() {
Map<String, Integer> lookUpMap = new HashMap<>();
"<severity>warning</severity>", new RestconfError(rpcError));
// No fields set - edge case
- rpcError = RpcResultBuilder.newError(null, null, null, null, null, null);
+ rpcError = RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION, null, null, null, null, null);
validateRestConfError(null, ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED,
null, "<severity>error</severity>", new RestconfError(rpcError));
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.yangtools.yang.common.Empty;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.nb.rfc8040.MediaTypes;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.nb.rfc8040.MediaTypes;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
import org.opendaylight.yangtools.util.xml.UntrustedXML;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
final DataContainerNodeBuilder<NodeIdentifier, UnkeyedListEntryNode> entryBuilder =
ImmutableUnkeyedListEntryNodeBuilder.create()
.withNodeIdentifier(NodeIdentifier.create(Error.QNAME))
- .withChild(ImmutableNodes.leafNode(ERROR_TYPE_QNAME, restconfError.getErrorType().getErrorTypeTag()))
+ .withChild(ImmutableNodes.leafNode(ERROR_TYPE_QNAME, restconfError.getErrorType().elementBody()))
.withChild(ImmutableNodes.leafNode(ERROR_TAG_QNAME, restconfError.getErrorTag().getTagValue()));
// filling in optional fields
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.patch.PatchContext;
import org.opendaylight.restconf.common.patch.PatchEditOperation;
import org.opendaylight.restconf.common.patch.PatchEntity;
import org.opendaylight.restconf.nb.rfc8040.codecs.StringModuleInstanceIdentifierCodec;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
for (final RestconfError restconfError : errors) {
jsonWriter.beginObject();
- jsonWriter.name("error-type").value(restconfError.getErrorType().getErrorTypeTag());
+ jsonWriter.name("error-type").value(restconfError.getErrorType().elementBody());
jsonWriter.name("error-tag").value(restconfError.getErrorTag().getTagValue());
// optional node
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.patch.PatchContext;
import org.opendaylight.restconf.common.patch.PatchEditOperation;
import org.opendaylight.restconf.common.patch.PatchEntity;
import org.opendaylight.restconf.nb.rfc8040.codecs.StringModuleInstanceIdentifierCodec;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
import org.opendaylight.yangtools.util.xml.UntrustedXML;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.common.XMLNamespace;
for (final RestconfError restconfError : errors) {
writer.writeStartElement("error-type");
- writer.writeCharacters(restconfError.getErrorType().getErrorTypeTag());
+ writer.writeCharacters(restconfError.getErrorType().elementBody());
writer.writeEndElement();
writer.writeStartElement("error-tag");
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.util.DataChangeScope;
import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfStreamsConstants;
import org.opendaylight.restconf.nb.rfc8040.streams.listeners.ListenersBroker;
import org.opendaylight.restconf.nb.rfc8040.streams.listeners.NotificationListenerAdapter;
import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier;
import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.patch.PatchContext;
import org.opendaylight.restconf.common.patch.PatchStatusContext;
import org.opendaylight.restconf.nb.rfc8040.Rfc8040;
import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier;
import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType;
import org.opendaylight.yangtools.concepts.Immutable;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
if (node == null) {
throw new RestconfDocumentedException(
"Request could not be completed because the relevant data model content does not exist",
- RestconfError.ErrorType.PROTOCOL,
- RestconfError.ErrorTag.DATA_MISSING);
+ ErrorType.PROTOCOL, RestconfError.ErrorTag.DATA_MISSING);
}
if (parameters.getContent().equals(RestconfDataServiceConstant.ReadData.ALL)
case INSERT:
if (insertUsed) {
throw new RestconfDocumentedException("Insert parameter can be used only once.",
- RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT);
+ ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT);
}
insertUsed = true;
insert = Insert.forValue(str);
if (insert == null) {
throw new RestconfDocumentedException("Unrecognized insert parameter value '" + str + "'",
- RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT);
+ ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT);
}
break;
case POINT:
if (pointUsed) {
throw new RestconfDocumentedException("Point parameter can be used only once.",
- RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT);
+ ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT);
}
pointUsed = true;
break;
default:
throw new RestconfDocumentedException("Bad parameter for post: " + entry.getKey(),
- RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT);
+ ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT);
}
}
if (pointUsed) {
if (!insertUsed) {
throw new RestconfDocumentedException("Point parameter can't be used without Insert parameter.",
- RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT);
+ ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT);
}
if (insert != Insert.BEFORE && insert != Insert.AFTER) {
throw new RestconfDocumentedException(
"Point parameter can be used only with 'after' or 'before' values of Insert parameter.",
- RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT);
+ ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT);
}
}
}
import org.opendaylight.controller.config.threadpool.ScheduledThreadPool;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfDataStreamService;
import org.opendaylight.restconf.nb.rfc8040.streams.Configuration;
import org.opendaylight.restconf.nb.rfc8040.streams.SSESessionHandler;
import org.opendaylight.restconf.nb.rfc8040.streams.listeners.BaseListenerInterface;
import org.opendaylight.restconf.nb.rfc8040.streams.listeners.ListenersBroker;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfInvokeOperationsService;
import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfInvokeOperationsUtil;
import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfStreamsConstants;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.XMLNamespace;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.util.OperationsResourceUtils;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfOperationsService;
import org.opendaylight.restconf.nb.rfc8040.utils.RestconfConstants;
import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.slf4j.Logger;
import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.nb.rfc8040.Rfc8040;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfStreamsSubscriptionServiceImpl.HandlersHolder;
import org.opendaylight.restconf.nb.rfc8040.utils.RestconfConstants;
import org.opendaylight.restconf.nb.rfc8040.utils.mapping.RestconfMappingNodeUtil;
import org.opendaylight.restconf.nb.rfc8040.utils.parser.IdentifierCodec;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.slf4j.Logger;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.nb.rfc8040.rests.utils.DeleteDataTransactionUtil;
import org.opendaylight.restconf.nb.rfc8040.rests.utils.TransactionUtil;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
final ReadFailedException e = failure.getValue();
if (e == null) {
throw new RestconfDocumentedException("Data already exists",
- RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.DATA_EXISTS, failure.getKey());
+ ErrorType.PROTOCOL, RestconfError.ErrorTag.DATA_EXISTS, failure.getKey());
}
throw new RestconfDocumentedException(
import org.opendaylight.mdsal.common.api.CommitInfo;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy;
import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfTransaction;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
if (errorTag.equals(DocumentedException.ErrorTag.DATA_EXISTS)) {
LOG.trace("Operation via Restconf was not executed because data at {} already exists",
path);
- throw new RestconfDocumentedException(e, new RestconfError(RestconfError.ErrorType.PROTOCOL,
+ throw new RestconfDocumentedException(e, new RestconfError(ErrorType.PROTOCOL,
RestconfError.ErrorTag.DATA_EXISTS, "Data already exists", path));
} else if (errorTag.equals(DocumentedException.ErrorTag.DATA_MISSING)) {
LOG.trace("Operation via Restconf was not executed because data at {} does not exist",
path);
- throw new RestconfDocumentedException(e, new RestconfError(RestconfError.ErrorType.PROTOCOL,
+ throw new RestconfDocumentedException(e, new RestconfError(ErrorType.PROTOCOL,
RestconfError.ErrorTag.DATA_MISSING, "Data does not exist", path));
}
}
if (error instanceof NetconfDocumentedException) {
throw new RestconfDocumentedException(error.getMessage(),
- RestconfError.ErrorType.valueOfCaseInsensitive(
- ((NetconfDocumentedException) error).getErrorType().elementBody()),
+ ((NetconfDocumentedException) error).getErrorType(),
RestconfError.ErrorTag.valueOfCaseInsensitive(
((NetconfDocumentedException) error).getErrorTag().getTagValue()), e);
}
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.patch.PatchContext;
import org.opendaylight.restconf.common.patch.PatchEntity;
import org.opendaylight.restconf.common.patch.PatchStatusContext;
import org.opendaylight.restconf.common.patch.PatchStatusEntity;
import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy;
import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfTransaction;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy;
import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfTransaction;
import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfDataServiceConstant.PostPutQueryParameters.Insert;
import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
default:
throw new RestconfDocumentedException(
"Used bad value of insert parameter. Possible values are first, last, before or after, but was: "
- + insert, RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ATTRIBUTE);
+ + insert, ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ATTRIBUTE);
}
}
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
-import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy;
import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfTransaction;
import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfDataServiceConstant.PostPutQueryParameters.Insert;
import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
default:
throw new RestconfDocumentedException(
"Used bad value of insert parameter. Possible values are first, last, before or after, "
- + "but was: " + insert, RestconfError.ErrorType.PROTOCOL, ErrorTag.BAD_ATTRIBUTE);
+ + "but was: " + insert, ErrorType.PROTOCOL, ErrorTag.BAD_ATTRIBUTE);
}
}
if (dataSchemaNode instanceof ListSchemaNode) {
if (!((ListSchemaNode) dataSchemaNode).isUserOrdered()) {
throw new RestconfDocumentedException("Insert parameter can be used only with ordered-by user list.",
- RestconfError.ErrorType.PROTOCOL, ErrorTag.BAD_ELEMENT);
+ ErrorType.PROTOCOL, ErrorTag.BAD_ELEMENT);
}
return dataSchemaNode;
}
if (!((LeafListSchemaNode) dataSchemaNode).isUserOrdered()) {
throw new RestconfDocumentedException(
"Insert parameter can be used only with ordered-by user leaf-list.",
- RestconfError.ErrorType.PROTOCOL, ErrorTag.BAD_ELEMENT);
+ ErrorType.PROTOCOL, ErrorTag.BAD_ELEMENT);
}
return dataSchemaNode;
}
throw new RestconfDocumentedException("Insert parameter can be used only with list or leaf-list",
- RestconfError.ErrorType.PROTOCOL, ErrorTag.BAD_ELEMENT);
+ ErrorType.PROTOCOL, ErrorTag.BAD_ELEMENT);
}
}
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy;
import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfDataServiceConstant.ReadData.WithDefaults;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
break;
default:
throw new RestconfDocumentedException(
- new RestconfError(RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE,
+ new RestconfError(ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE,
"Invalid content parameter: " + contentValue, null,
"The content parameter value must be either config, nonconfig or all (default)"));
}
if (value == null || value < RestconfDataServiceConstant.ReadData.MIN_DEPTH
|| value > RestconfDataServiceConstant.ReadData.MAX_DEPTH) {
throw new RestconfDocumentedException(
- new RestconfError(RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE,
+ new RestconfError(ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE,
"Invalid depth parameter: " + depth, null,
"The depth parameter must be an integer between 1 and 65535 or \"unbounded\""));
} else {
final String str = withDefaults.get(0);
final WithDefaults val = WithDefaults.forValue(str);
if (val == null) {
- throw new RestconfDocumentedException(new RestconfError(RestconfError.ErrorType.PROTOCOL,
+ throw new RestconfDocumentedException(new RestconfError(ErrorType.PROTOCOL,
RestconfError.ErrorTag.INVALID_VALUE, "Invalid with-defaults parameter: " + str, null,
"The with-defaults parameter must be a string in " + WithDefaults.possibleValues()));
}
return readAllData(strategy, path, withDefa, ctx);
default:
throw new RestconfDocumentedException(
- new RestconfError(RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE,
+ new RestconfError(ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE,
"Invalid content parameter: " + valueOfContent, null,
"The content parameter value must be either config, nonconfig or all (default)"));
}
case RestconfDataServiceConstant.ReadData.ALL:
return readAllData(strategy, path, withDefa, ctx, fields);
default:
- throw new RestconfDocumentedException(new RestconfError(RestconfError.ErrorType.PROTOCOL,
+ throw new RestconfDocumentedException(new RestconfError(ErrorType.PROTOCOL,
RestconfError.ErrorTag.INVALID_VALUE, "Invalid content parameter: " + valueOfContent, null,
"The content parameter value must be either config, nonconfig or all (default)"));
}
.collect(Collectors.toSet());
throw new RestconfDocumentedException(
"Not allowed parameters for " + READ_TYPE_TX + " operation: " + notAllowedParameters,
- RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE);
+ ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE);
}
}
import org.opendaylight.mdsal.dom.api.DOMRpcService;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.YangConstants;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.schema.SchemaExportContext;
import org.opendaylight.restconf.nb.rfc8040.utils.RestconfConstants;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import java.util.Optional;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.util.RestUtil;
import org.opendaylight.restconf.common.util.RestconfSchemaUtil;
import org.opendaylight.restconf.nb.rfc8040.codecs.RestCodec;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import java.util.Map.Entry;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.yangtools.concepts.Serializer;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils;
import org.opendaylight.restconf.nb.rfc8040.jersey.providers.test.AbstractBodyReaderTest;
import org.opendaylight.restconf.nb.rfc8040.jersey.providers.test.XmlBodyReaderTest;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.Revision;
Assert.fail("Test should fail due to malformed PUT operation message");
} catch (final RestconfDocumentedException exception) {
final RestconfError restconfError = exception.getErrors().get(0);
- Assert.assertEquals(RestconfError.ErrorType.PROTOCOL, restconfError.getErrorType());
+ Assert.assertEquals(ErrorType.PROTOCOL, restconfError.getErrorType());
Assert.assertEquals(RestconfError.ErrorTag.MALFORMED_MESSAGE, restconfError.getErrorTag());
}
}
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.nb.rfc8040.MediaTypes;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.patch.PatchContext;
import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils;
import org.opendaylight.restconf.nb.rfc8040.TestUtils;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
import org.opendaylight.restconf.nb.rfc8040.jersey.providers.spi.AbstractIdentifierAwareJaxRsProvider;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils;
import org.opendaylight.restconf.nb.rfc8040.jersey.providers.XmlNormalizedNodeBodyReader;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.Revision;
Assert.fail("Test should fail due to malformed PUT operation message");
} catch (final RestconfDocumentedException exception) {
final RestconfError restconfError = exception.getErrors().get(0);
- Assert.assertEquals(RestconfError.ErrorType.PROTOCOL, restconfError.getErrorType());
+ Assert.assertEquals(ErrorType.PROTOCOL, restconfError.getErrorType());
Assert.assertEquals(RestconfError.ErrorTag.MALFORMED_MESSAGE, restconfError.getErrorTag());
}
}
import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfSchemaService;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
this.schemaService.getSchema("");
fail("Test should fail due to invalid identifier");
} catch (final RestconfDocumentedException e) {
- assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
+ assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag());
assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode());
}
this.schemaService.getSchema(MOUNT_POINT + "");
fail("Test should fail due to invalid identifier");
} catch (final RestconfDocumentedException e) {
- assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
+ assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag());
assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode());
}
this.schemaService.getSchema("01_module/2016-01-01");
fail("Test should fail due to invalid identifier");
} catch (final RestconfDocumentedException e) {
- assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
+ assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag());
assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode());
}
this.schemaService.getSchema(MOUNT_POINT + "01_module/2016-01-01");
fail("Test should fail due to invalid identifier");
} catch (final RestconfDocumentedException e) {
- assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
+ assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag());
assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode());
}
this.schemaService.getSchema("2014-01-01");
fail("Test should fail due to invalid identifier");
} catch (final RestconfDocumentedException e) {
- assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
+ assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag());
assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode());
}
this.schemaService.getSchema(MOUNT_POINT + "2014-01-01");
fail("Test should fail due to invalid identifier");
} catch (final RestconfDocumentedException e) {
- assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
+ assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag());
assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode());
}
this.schemaService.getSchema("module");
fail("Test should fail due to invalid identifier");
} catch (final RestconfDocumentedException e) {
- assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
+ assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag());
assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode());
}
this.schemaService.getSchema(MOUNT_POINT + "module");
fail("Test should fail due to invalid identifier");
} catch (final RestconfDocumentedException e) {
- assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
+ assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag());
assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode());
}
import org.opendaylight.netconf.dom.api.NetconfDataTreeService;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
-import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
import org.opendaylight.restconf.nb.rfc8040.rests.transactions.MdsalRestconfStrategy;
import org.opendaylight.restconf.nb.rfc8040.rests.transactions.NetconfRestconfStrategy;
DeleteDataTransactionUtil.deleteData(strategy, context.getInstanceIdentifier());
fail("Delete operation should fail due to missing data");
} catch (final RestconfDocumentedException e) {
- assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
+ assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
assertEquals(ErrorTag.DATA_MISSING, e.getErrors().get(0).getErrorTag());
}
}
PatchDataTransactionUtil.patchData(patchContext, strategy, this.refSchemaCtx);
assertFalse(patchStatusContext.isOk());
- assertEquals(RestconfError.ErrorType.PROTOCOL,
+ assertEquals(ErrorType.PROTOCOL,
patchStatusContext.getEditCollection().get(0).getEditErrors().get(0).getErrorType());
assertEquals(RestconfError.ErrorTag.DATA_MISSING,
patchStatusContext.getEditCollection().get(0).getEditErrors().get(0).getErrorTag());
PatchDataTransactionUtil.patchData(patchContext, strategy, this.refSchemaCtx);
assertFalse(patchStatusContext.isOk());
- assertEquals(RestconfError.ErrorType.PROTOCOL,
+ assertEquals(ErrorType.PROTOCOL,
patchStatusContext.getGlobalErrors().get(0).getErrorType());
assertEquals(RestconfError.ErrorTag.DATA_MISSING,
patchStatusContext.getGlobalErrors().get(0).getErrorTag());
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.nb.rfc8040.rests.transactions.MdsalRestconfStrategy;
import org.opendaylight.restconf.nb.rfc8040.rests.transactions.NetconfRestconfStrategy;
import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy;
import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfDataServiceConstant.ReadData;
import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfDataServiceConstant.ReadData.WithDefaults;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
-import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.schema.SchemaExportContext;
import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils;
import org.opendaylight.restconf.nb.rfc8040.utils.RestconfConstants;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> ParserIdentifier.toInstanceIdentifier("/yang-ext:mount", SCHEMA_CONTEXT,
Optional.of(this.mountPointService)));
- assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals("Not expected error tag", ErrorTag.RESOURCE_DENIED_TRANSPORT, ex.getErrors().get(0).getErrorTag());
}
public void makeQNameFromIdentifierInvalidIdentifierNegativeTest() {
RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> ParserIdentifier.makeQNameFromIdentifier(TEST_MODULE_REVISION + "/" + TEST_MODULE_NAME));
- assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals("Not expected error tag", RestconfError.ErrorTag.INVALID_VALUE,
ex.getErrors().get(0).getErrorTag());
assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode());
public void makeQNameFromIdentifierTooShortIdentifierNegativeTest() {
RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> ParserIdentifier.makeQNameFromIdentifier(TEST_MODULE_NAME));
- assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals("Not expected error tag", RestconfError.ErrorTag.INVALID_VALUE,
ex.getErrors().get(0).getErrorTag());
assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode());
RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> ParserIdentifier.makeQNameFromIdentifier(
MOUNT_POINT_IDENT + "/" + TEST_MODULE_REVISION + "/" + TEST_MODULE_NAME));
- assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals("Not expected error tag", RestconfError.ErrorTag.INVALID_VALUE,
ex.getErrors().get(0).getErrorTag());
assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode());
public void makeQNameFromIdentifierMountPointTooShortIdentifierNegativeTest() {
RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> ParserIdentifier.makeQNameFromIdentifier(MOUNT_POINT_IDENT + "/" + TEST_MODULE_NAME));
- assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals("Not expected error tag", RestconfError.ErrorTag.INVALID_VALUE,
ex.getErrors().get(0).getErrorTag());
assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode());
public void makeQNameFromIdentifierEmptyIdentifierNegativeTest() {
RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> ParserIdentifier.makeQNameFromIdentifier(""));
- assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals("Not expected error tag", RestconfError.ErrorTag.INVALID_VALUE,
ex.getErrors().get(0).getErrorTag());
assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode());
public void makeQNameFromIdentifierDoubleSlashNegativeTest() {
RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> ParserIdentifier.makeQNameFromIdentifier(TEST_MODULE_NAME + "//" + TEST_MODULE_REVISION));
- assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals("Not expected error tag", RestconfError.ErrorTag.INVALID_VALUE,
ex.getErrors().get(0).getErrorTag());
assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode());
RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> ParserIdentifier.toSchemaExportContextFromIdentifier(
SCHEMA_CONTEXT, TEST_MODULE_REVISION + "/" + TEST_MODULE_NAME, null, sourceProvider));
- assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals("Not expected error tag", RestconfError.ErrorTag.INVALID_VALUE,
ex.getErrors().get(0).getErrorTag());
assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode());
MOUNT_POINT_IDENT + "/" + TEST_MODULE_REVISION + "/" + TEST_MODULE_NAME, this.mountPointService,
sourceProvider));
- assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals("Not expected error tag", RestconfError.ErrorTag.INVALID_VALUE,
ex.getErrors().get(0).getErrorTag());
assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode());
import org.junit.Test;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.Revision;
/**
final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> ParserIdentifier.validateAndGetRevision(Collections.emptyIterator()));
- assertEquals(RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals(ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals(RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
assertEquals(400, ex.getErrors().get(0).getErrorTag().getStatusCode());
}
public void validateAndGetModulNameNotSuppliedTest() {
final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> ParserIdentifier.validateAndGetModulName(Collections.emptyIterator()));
- assertEquals(RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals(ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals(RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
assertEquals(400, ex.getErrors().get(0).getErrorTag().getStatusCode());
}
final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> ParserIdentifier.validateAndGetModulName(Iterators.singletonIterator(
"01-not-parsable-as-name-on-firts-char")));
- assertEquals(RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals(ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals(RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
assertEquals(400, ex.getErrors().get(0).getErrorTag().getStatusCode());
}
final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> ParserIdentifier.validateAndGetModulName(Iterators.singletonIterator(
"not-parsable-as-name-after-first-char*")));
- assertEquals(RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals(ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals(RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
assertEquals(400, ex.getErrors().get(0).getErrorTag().getStatusCode());
}
public void validateAndGetModuleNameNotParsableXmlTest() {
final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> ParserIdentifier.validateAndGetModulName(Iterators.singletonIterator("xMl-module-name")));
- assertEquals(RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals(ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals(RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
assertEquals(400, ex.getErrors().get(0).getErrorTag().getStatusCode());
}
public void validateAndGetModuleNameEmptyTest() {
final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> ParserIdentifier.validateAndGetModulName(Iterators.singletonIterator("")));
- assertEquals(RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals(ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals(RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
assertEquals(400, ex.getErrors().get(0).getErrorTag().getStatusCode());
}
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.common.Uint8;
public void prepareQnameNotValidContainerNameNegativeTest() {
RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> YangInstanceIdentifierDeserializer.create(SCHEMA_CONTEXT, "deserializer-test:contA/leafB"));
- assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals("Not expected error tag", RestconfError.ErrorTag.DATA_MISSING,
ex.getErrors().get(0).getErrorTag());
}
RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> YangInstanceIdentifierDeserializer.create(SCHEMA_CONTEXT,
"deserializer-test:list-no-key/disabled=false"));
- assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals("Not expected error tag", RestconfError.ErrorTag.DATA_MISSING,
ex.getErrors().get(0).getErrorTag());
}
RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> YangInstanceIdentifierDeserializer.create(SCHEMA_CONTEXT,
"deserializer-test:list-multiple-keys=%3Afoo/string-value"));
- assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals("Not expected error tag", RestconfError.ErrorTag.MISSING_ATTRIBUTE,
ex.getErrors().get(0).getErrorTag());
assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode());
public void leafListMissingKeyNegativeTest() {
RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
() -> YangInstanceIdentifierDeserializer.create(SCHEMA_CONTEXT, "deserializer-test:leaf-list-0="));
- assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals("Not expected error tag", RestconfError.ErrorTag.MISSING_ATTRIBUTE,
ex.getErrors().get(0).getErrorTag());
assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode());