From 60d5ee0c6d4cc32d6181c29ee55a67575669a0cd Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Fri, 21 Apr 2017 17:36:30 -0400 Subject: [SDNC-5] Split listeners Split dmaap-listener and ueb-listener to separate artifacts Change-Id: I7b1d5b15c8ef850ace75d4da451143ba4062b817 Signed-off-by: Dan Timoney --- .../impl/rev140523/VnfapiProviderModule.java | 2 +- .../rev140523/VnfapiProviderModuleFactory.java | 2 +- .../sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java | 2 +- .../java/org/openecomp/sdnc/vnfapi/VnfSdnUtil.java | 2 +- .../org/openecomp/sdnc/vnfapi/vnfapiProvider.java | 42 +++++++++++++++++++--- .../src/main/resources/initial/vnfapi-provider.xml | 2 +- .../openecomp/sdnc/vnfapi/TestPropertyList.java | 2 +- .../src/test/resources/proplist.properties | 2 +- .../src/test/resources/simplelogger.properties | 2 +- 9 files changed, 46 insertions(+), 12 deletions(-) (limited to 'vnfapi/provider/src') 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 vnfListIdBuilder = + InstanceIdentifier.builder(Vnfs.class) + .child(VnfList.class, entry.getKey()); + InstanceIdentifier 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. diff --git a/vnfapi/provider/src/test/java/org/openecomp/sdnc/vnfapi/TestPropertyList.java b/vnfapi/provider/src/test/java/org/openecomp/sdnc/vnfapi/TestPropertyList.java index b131f834..320f30d3 100644 --- a/vnfapi/provider/src/test/java/org/openecomp/sdnc/vnfapi/TestPropertyList.java +++ b/vnfapi/provider/src/test/java/org/openecomp/sdnc/vnfapi/TestPropertyList.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/test/resources/proplist.properties b/vnfapi/provider/src/test/resources/proplist.properties index 203d5654..556de910 100644 --- a/vnfapi/provider/src/test/resources/proplist.properties +++ b/vnfapi/provider/src/test/resources/proplist.properties @@ -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/test/resources/simplelogger.properties b/vnfapi/provider/src/test/resources/simplelogger.properties index 9b10afdb..96a105c0 100644 --- a/vnfapi/provider/src/test/resources/simplelogger.properties +++ b/vnfapi/provider/src/test/resources/simplelogger.properties @@ -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. -- cgit 1.2.3-korg