summaryrefslogtreecommitdiffstats
path: root/vnfapi/provider/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'vnfapi/provider/src/main')
-rw-r--r--vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModule.java2
-rw-r--r--vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModuleFactory.java2
-rw-r--r--vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java2
-rw-r--r--vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VnfSdnUtil.java2
-rw-r--r--vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/vnfapiProvider.java42
-rw-r--r--vnfapi/provider/src/main/resources/initial/vnfapi-provider.xml2
6 files changed, 43 insertions, 9 deletions
diff --git a/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModule.java b/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModule.java
index 56a1b186..4302a175 100644
--- a/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModule.java
+++ b/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModule.java
@@ -3,7 +3,7 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModuleFactory.java b/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModuleFactory.java
index 2df2bfa9..4b07aabe 100644
--- a/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModuleFactory.java
+++ b/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModuleFactory.java
@@ -3,7 +3,7 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java
index e15a9864..e356baa9 100644
--- a/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java
+++ b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java
@@ -3,7 +3,7 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VnfSdnUtil.java b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VnfSdnUtil.java
index 74359630..4a41aacd 100644
--- a/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VnfSdnUtil.java
+++ b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VnfSdnUtil.java
@@ -3,7 +3,7 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/vnfapiProvider.java b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/vnfapiProvider.java
index 0d31c071..92ba08d0 100644
--- a/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/vnfapiProvider.java
+++ b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/vnfapiProvider.java
@@ -3,7 +3,7 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -797,7 +797,37 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
}
}
}
+
}
+ private void DeleteVnfList (final VnfList entry, LogicalDatastoreType storeType) throws IllegalStateException {
+ // Each entry will be identifiable by a unique key, we have to create that identifier
+ InstanceIdentifier.InstanceIdentifierBuilder<VnfList> vnfListIdBuilder =
+ InstanceIdentifier.<Vnfs>builder(Vnfs.class)
+ .child(VnfList.class, entry.getKey());
+ InstanceIdentifier<VnfList> path = vnfListIdBuilder.toInstance();
+
+ int tries = 2;
+ while (true) {
+ try {
+ WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
+ tx.delete(storeType, path);
+ tx.submit().checkedGet();
+ log.debug("DataStore delete succeeded");
+ break;
+ } catch (final TransactionCommitFailedException e) {
+ if (e instanceof OptimisticLockFailedException) {
+ if (--tries <= 0) {
+ log.debug("Got OptimisticLockFailedException on last try - failing ");
+ throw new IllegalStateException(e);
+ }
+ log.debug("Got OptimisticLockFailedException - trying again ");
+ } else {
+ log.debug("Delete DataStore failed");
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+ }
//1610 vnf-instance
private void SaveVnfInstanceList (final VnfInstanceList entry, boolean merge, LogicalDatastoreType storeType) throws IllegalStateException {
@@ -1630,12 +1660,16 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null)
{
// Only update operational tree on Delete or Activate
- if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Delete) ||
- input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate))
- {
+ if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) {
log.info("Updating OPERATIONAL tree.");
SaveVnfList (vnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
}
+ else if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Delete) ||
+ input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Rollback)) {
+ log.info("Delete OPERATIONAL tree.");
+ DeleteVnfList (vnfListBuilder.build(), LogicalDatastoreType.CONFIGURATION);
+ DeleteVnfList (vnfListBuilder.build(), LogicalDatastoreType.OPERATIONAL);
+ }
}
VnfInformationBuilder vnfInformationBuilder = new VnfInformationBuilder();
vnfInformationBuilder.setVnfId(siid);
diff --git a/vnfapi/provider/src/main/resources/initial/vnfapi-provider.xml b/vnfapi/provider/src/main/resources/initial/vnfapi-provider.xml
index eebba0c4..01f156d3 100644
--- a/vnfapi/provider/src/main/resources/initial/vnfapi-provider.xml
+++ b/vnfapi/provider/src/main/resources/initial/vnfapi-provider.xml
@@ -4,7 +4,7 @@
openECOMP : SDN-C
================================================================================
Copyright (C) 2017 AT&T Intellectual Property. All rights
- reserved.
+ reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.