aboutsummaryrefslogtreecommitdiffstats
path: root/cps-service/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'cps-service/src/main')
-rwxr-xr-xcps-service/src/main/java/org/onap/cps/api/CpsAdminService.java11
-rwxr-xr-xcps-service/src/main/java/org/onap/cps/api/impl/CpsAdminServiceImpl.java6
-rwxr-xr-xcps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java9
-rw-r--r--cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java7
4 files changed, 30 insertions, 3 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/api/CpsAdminService.java b/cps-service/src/main/java/org/onap/cps/api/CpsAdminService.java
index 0379ac21d6..1e4c9c7354 100755
--- a/cps-service/src/main/java/org/onap/cps/api/CpsAdminService.java
+++ b/cps-service/src/main/java/org/onap/cps/api/CpsAdminService.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 Pantheon.tech
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,9 +63,17 @@ public interface CpsAdminService {
* Get an anchor in the given dataspace using the anchor name.
*
* @param dataspaceName dataspace name
- * @param anchorName anchor name
+ * @param anchorName anchor name
* @return an anchor
*/
@NonNull
Anchor getAnchor(@NonNull String dataspaceName, @NonNull String anchorName);
+
+ /**
+ * Delete anchor by name in given dataspace.
+ *
+ * @param dataspaceName dataspace name
+ * @param anchorName anchor name
+ */
+ void deleteAnchor(@NonNull String dataspaceName, @NonNull String anchorName);
}
diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsAdminServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsAdminServiceImpl.java
index 09550f1936..25185731b3 100755
--- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsAdminServiceImpl.java
+++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsAdminServiceImpl.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 Pantheon.tech
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,4 +53,9 @@ public class CpsAdminServiceImpl implements CpsAdminService {
public Anchor getAnchor(final String dataspaceName, final String anchorName) {
return cpsAdminPersistenceService.getAnchor(dataspaceName, anchorName);
}
+
+ @Override
+ public void deleteAnchor(final String dataspaceName, final String anchorName) {
+ cpsAdminPersistenceService.deleteAnchor(dataspaceName, anchorName);
+ }
} \ No newline at end of file
diff --git a/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java b/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java
index f47af5f976..35e07f83ba 100755
--- a/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java
+++ b/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation. All rights reserved.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 Pantheon.tech
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -67,4 +68,12 @@ public interface CpsAdminPersistenceService {
*/
@NonNull
Anchor getAnchor(@NonNull String dataspaceName, @NonNull String anchorName);
+
+ /**
+ * Delete anchor by name in given dataspace.
+ *
+ * @param dataspaceName dataspace name
+ * @param anchorName anchor name
+ */
+ void deleteAnchor(@NonNull String dataspaceName, @NonNull String anchorName);
} \ No newline at end of file
diff --git a/cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java b/cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java
index ea0626c2b2..cf79ad7e0b 100644
--- a/cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java
+++ b/cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java
@@ -30,6 +30,7 @@ import java.util.Set;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import org.onap.cps.utils.YangUtils;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
@@ -150,8 +151,10 @@ public class DataNodeBuilder {
}
private static void addYangContainer(final DataNode currentDataNode, final DataContainerNode<?> dataContainerNode) {
- final DataNode dataContainerDataNode = createAndAddChildDataNode(currentDataNode,
- YangUtils.buildXpath(dataContainerNode.getIdentifier()));
+ final DataNode dataContainerDataNode =
+ (dataContainerNode.getIdentifier() instanceof YangInstanceIdentifier.AugmentationIdentifier)
+ ? currentDataNode
+ : createAndAddChildDataNode(currentDataNode, YangUtils.buildXpath(dataContainerNode.getIdentifier()));
final Collection<DataContainerChild<?, ?>> normalizedChildNodes = dataContainerNode.getValue();
for (final NormalizedNode<?, ?> normalizedNode : normalizedChildNodes) {
addDataNodeFromNormalizedNode(dataContainerDataNode, normalizedNode);