diff options
author | 2017-04-21 17:36:30 -0400 | |
---|---|---|
committer | 2017-04-24 12:19:33 -0400 | |
commit | 60d5ee0c6d4cc32d6181c29ee55a67575669a0cd (patch) | |
tree | b0e3b96732935e21058eedf05fd766be5c673f40 /vnfapi/provider/src/main/java | |
parent | c8a9ad49965b6152a0c7f3f4b7d1f7993d52f082 (diff) |
[SDNC-5] Split listeners
Split dmaap-listener and ueb-listener to separate artifacts
Change-Id: I7b1d5b15c8ef850ace75d4da451143ba4062b817
Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'vnfapi/provider/src/main/java')
5 files changed, 42 insertions, 8 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); |