aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--appc-common/src/main/java/org/openecomp/appc/configuration/ConfigurationFactory.java8
-rw-r--r--appc-common/src/main/java/org/openecomp/appc/i18n/Msg.java46
-rw-r--r--appc-common/src/main/resources/org/openecomp/appc/i18n/MessageResources.properties54
-rw-r--r--appc-common/src/main/resources/org/openecomp/appc/org.ops4j.pax.logging.cfg4
-rw-r--r--appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/AppcEventListenerActivator.java40
-rw-r--r--appc-oam/appc-oam-bundle/src/main/resources/org/openecomp/appc/default.properties38
-rw-r--r--appc-oam/appc-oam-bundle/src/main/resources/org/openecomp/appc/org.ops4j.pax.logging.cfg144
-rw-r--r--appc-oam/appc-oam-installer/src/main/resources/scripts/install-feature.sh28
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderLcm.java325
9 files changed, 410 insertions, 277 deletions
diff --git a/appc-common/src/main/java/org/openecomp/appc/configuration/ConfigurationFactory.java b/appc-common/src/main/java/org/openecomp/appc/configuration/ConfigurationFactory.java
index a2dd55702..fa8b5ee0b 100644
--- a/appc-common/src/main/java/org/openecomp/appc/configuration/ConfigurationFactory.java
+++ b/appc-common/src/main/java/org/openecomp/appc/configuration/ConfigurationFactory.java
@@ -116,14 +116,14 @@ public final class ConfigurationFactory {
/**
* The default properties resource to be loaded
*/
- private static final String DEFAULT_PROPERTIES = "/opt/openecomp/appc/data/properties/appc.properties";
+ private static final String DEFAULT_PROPERTIES = "org/openecomp/appc/default.properties";
/**
* This collection allows for special configurations to be created and maintained, organized by some identification
* (such as an object reference to the StackBuilder to which they apply), and then obtained from the configuration
* factory when needed.
*/
- private static HashMap<Object, Configuration> localConfigs = new HashMap<Object, Configuration>();
+ private static HashMap<Object, Configuration> localConfigs = new HashMap<>();
/**
* The reentrant shared lock used to serialize access to the properties.
@@ -355,7 +355,9 @@ public final class ConfigurationFactory {
logger.error(EELFResourceManager.format(e));
} finally {
try {
- stream.close();
+ if (stream != null) {
+ stream.close();
+ }
} catch (IOException e) {
// not much we can do since logger may not be configured
// yet
diff --git a/appc-common/src/main/java/org/openecomp/appc/i18n/Msg.java b/appc-common/src/main/java/org/openecomp/appc/i18n/Msg.java
index 7306b4c5d..5f0aa3258 100644
--- a/appc-common/src/main/java/org/openecomp/appc/i18n/Msg.java
+++ b/appc-common/src/main/java/org/openecomp/appc/i18n/Msg.java
@@ -756,28 +756,60 @@ public enum Msg implements EELFResolvableErrorEnum {
OAM_OPERATION_EXCEPTION,
/**
- * Application {0} is stopping... Waiting for {1} LCM request to complete
+ * Application {0} is {1}
+ */
+ OAM_OPERATION_ENTERING_MAINTENANCE_MODE,
+
+ /**
+ * Application {0} is in {1}
+ */
+ OAM_OPERATION_MAINTENANCE_MODE,
+
+ /**
+ * Application {0} is {1}
+ */
+ OAM_OPERATION_STARTING,
+
+ /**
+ * Application {0} is {1}
+ */
+ OAM_OPERATION_STARTED,
+
+ /**
+ * Application {0} is {1}
*/
OAM_OPERATION_STOPPING,
/**
- * Application {0} is stopped
+ * Application {0} is {1}
*/
OAM_OPERATION_STOPPED,
+ /**
+ * A {1} API is not allowed when {0} is in the {2} state
+ */
+ INVALID_STATE_TRANSITION,
+ /**
+ * Application {0} was unable to find the Request Handler service
+ */
+ REQUEST_HANDLER_UNAVAILABLE,
/**
- * Application {0} is started
+ * Application {0} is {1}
*/
- OAM_OPERATION_STARTING,
+ OAM_OPERATION_RESTARTING,
/**
- * Application {0} is started
+ * Application {0} is {1} for restart
*/
- OAM_OPERATION_STARTED,
+ OAM_OPERATION_RESTARTED,
- ;
/**
+ * {0}
+ */
+ OAM_OPERATION_INVALID_INPUT
+ ;
+ /*
* Static initializer to ensure the resource bundles for this class are loaded...
*/
static {
diff --git a/appc-common/src/main/resources/org/openecomp/appc/i18n/MessageResources.properties b/appc-common/src/main/resources/org/openecomp/appc/i18n/MessageResources.properties
index 28971c7b0..86d9b5515 100644
--- a/appc-common/src/main/resources/org/openecomp/appc/i18n/MessageResources.properties
+++ b/appc-common/src/main/resources/org/openecomp/appc/i18n/MessageResources.properties
@@ -956,24 +956,58 @@ OAM_OPERATION_EXCEPTION=APPC0153E|\
state of the thread at the time of the exception.|\
Correct the cause of the exception and rerun.
-OAM_OPERATION_STOPPING=APPC0154W|\
- Application {0} is stopping... |\
+OAM_OPERATION_ENTERING_MAINTENANCE_MODE=APPC0154W|\
+ Application {0} is {1}|\
No recovery required|\
The APPC will no longer accept new LCM requests. Previously accepted LCM requests will be allowed to complete.
-OAM_OPERATION_STOPPED=APPC0155W|\
- Application {0} is stopped|\
+OAM_OPERATION_MAINTENANCE_MODE=APPC0155W|\
+ Application {0} is in {1}|\
No recovery required|\
- The APPC is not accepting new LCM requests and all previously accepted LCM requests have completed.
+ The APPC is not accepting new LCM requests and all previously accepted LCM requests have completed.
OAM_OPERATION_STARTING=APPC0156I|\
- Application {0} is starting...|\
+ Application {0} is {1}|\
No recovery required|\
- The APPC has initiated its startup procedure. Its internal components are coming online. Once completed it will start accepting LCM requests. \
-
+ The APPC has initiated its startup procedure. Its internal components are coming online. Once completed it will start accepting LCM requests.
+
OAM_OPERATION_STARTED=APPC0157I|\
- Application {0} is started|\
+ Application {0} is {1}|\
+ No recovery required|\
+ The APPC will now accept new LCM requests for processing.
+
+INVALID_STATE_TRANSITION=APPC0158E|\
+ A {1} API is not allowed when {0} in the {2} state|\
+ No recovery required|\
+ The Operation requested cannot be performed as per the current state of APPC.
+
+OAM_OPERATION_STOPPING=APPC0159W|\
+ Application {0} is {1}|\
+ No recovery required|\
+ The APPC has initiated its stop procedure. Its internal LCM bundles are stopping.
+
+OAM_OPERATION_STOPPED=APPC0160W|\
+ Application {0} is {1}|\
+ No recovery required|\
+ The APPC LCM bundles have now stopped.
+
+REQUEST_HANDLER_UNAVAILABLE=APPC0161E|\
+ Application {0} was unable to find the Request Handler service |\
+ The application controller attempted to get a handle on Request Handler service \
+ but was unable to locate it in the OSGi Service Registry.|\
+ Verify if the Request Handler bundle is running.
+
+OAM_OPERATION_RESTARTING=APPC0162W|\
+ Application {0} is {1}|\
No recovery required|\
- The APPC will now accept new LCM requests for processing.
+ The APPC has initiated its restart procedure. Its internal LCM bundles are stopping and will then start again.
+OAM_OPERATION_RESTARTED=APPC0163W|\
+ Application {0} is {1} for restart|\
+ No recovery required|\
+ The APPC LCM bundles have been restared (stopped and then started).
+OAM_OPERATION_INVALID_INPUT=APPC0162E|\
+ {0}|\
+ No recovery required|\
+ Fix the input parameter and retry.
diff --git a/appc-common/src/main/resources/org/openecomp/appc/org.ops4j.pax.logging.cfg b/appc-common/src/main/resources/org/openecomp/appc/org.ops4j.pax.logging.cfg
index 78b50cf55..a3a3f5837 100644
--- a/appc-common/src/main/resources/org/openecomp/appc/org.ops4j.pax.logging.cfg
+++ b/appc-common/src/main/resources/org/openecomp/appc/org.ops4j.pax.logging.cfg
@@ -110,6 +110,10 @@
#Store to the same log file messages from upper level appender or not
log4j.additivity.org.openecomp=false
+ #org.openecomp logger
+ log4j.logger.org.openecomp=TRACE, debug, error
+ log4j.additivity.org.openecomp=false
+
#EELFManager loggers
#EELF parent logger
log4j.logger.com.att.eelf=TRACE, debug
diff --git a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/AppcEventListenerActivator.java b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/AppcEventListenerActivator.java
index 86abd6057..b8cfa2ef7 100644
--- a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/AppcEventListenerActivator.java
+++ b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/AppcEventListenerActivator.java
@@ -43,8 +43,8 @@ import java.util.Set;
* <p>
* The DMaaP listener is responsible for listening to a topic on the Universal Event Bus and reading in messages that
* conform to the DCAE message format for APPC. These messages will then be parsed and passed along to the APPC Provider
- * to take action on. The listener will also send messages out on DMaaP during critical phases. The messages sent out will
- * have a status of:
+ * to take action on. The listener will also send messages out on DMaaP during critical phases. The messages sent out
+ * will have a status of:
* <ul>
* <li><i>PENDING</i> - The listener has read the message off of DMaaP and has put it in the queue to be processed</li>
* <li><i>ACTIVE</i> - The listener has begun actually processing the request and is waiting on the appc provider to
@@ -119,29 +119,28 @@ public class AppcEventListenerActivator implements BundleActivator {
Properties props = configuration.getProperties();
- Set<ListenerProperties> listeners = new HashSet<ListenerProperties>();
+ Set<ListenerProperties> listeners = new HashSet<>();
// Configure event listener for the demo use case
ListenerProperties demoProps = new ListenerProperties("appc.demo", props);
demoProps.setListenerClass(org.openecomp.appc.listener.demo.impl.ListenerImpl.class);
listeners.add(demoProps);
- // ===========================================================================
+ // ===========================================================================
ListenerProperties clLCMProps = new ListenerProperties("appc.LCM", props);
clLCMProps.setListenerClass(org.openecomp.appc.listener.LCM.impl.ListenerImpl.class);
listeners.add(clLCMProps);
- //Configure the OAM properties
- clLCMProps = new ListenerProperties("appc.OAM", props);
- clLCMProps.setListenerClass(org.openecomp.appc.listener.LCM.impl.ListenerImpl.class);
- listeners.add(clLCMProps);
-
-/*
- ListenerProperties clLCMProps1607 = new ListenerProperties("appc.LCM1607", props);
- clLCMProps1607.setListenerClass(org.openecomp.appc.listener.LCM1607.impl.ListenerImpl.class);
- listeners.add(clLCMProps1607);
-*/
+ // Configure the OAM properties
+ String oamPropKeyPrefix = "appc.OAM";
+ ListenerProperties oamProps = new ListenerProperties(oamPropKeyPrefix, props);
+ if (isAppcOamPropsListenerEnabled(oamProps)) {
+ oamProps.setListenerClass(org.openecomp.appc.listener.LCM.impl.ListenerImpl.class);
+ listeners.add(oamProps);
+ } else {
+ LOG.warn(String.format("The listener %s is disabled and will not be run", oamPropKeyPrefix));
+ }
adapter = new ControllerImpl(listeners);
if (ctx != null && registration == null) {
@@ -186,4 +185,17 @@ public class AppcEventListenerActivator implements BundleActivator {
return "DMaaP Listener";
}
+ /**
+ * Check if AppcOam props disable listener or not
+ *
+ * @param listenerProperties of ListenerProperties objext
+ * @return false only if AppcOam disabled key is defined and equal to true. Otherwise, return true.
+ */
+ private boolean isAppcOamPropsListenerEnabled(ListenerProperties listenerProperties) {
+ final Properties appcOamProperties = listenerProperties.getProperties();
+
+ return appcOamProperties == null
+ || !Boolean.parseBoolean(appcOamProperties.getProperty(
+ ListenerProperties.KEYS.DISABLED.getPropertySuffix()));
+ }
}
diff --git a/appc-oam/appc-oam-bundle/src/main/resources/org/openecomp/appc/default.properties b/appc-oam/appc-oam-bundle/src/main/resources/org/openecomp/appc/default.properties
index dc84b8be2..e9b78cc30 100644
--- a/appc-oam/appc-oam-bundle/src/main/resources/org/openecomp/appc/default.properties
+++ b/appc-oam/appc-oam-bundle/src/main/resources/org/openecomp/appc/default.properties
@@ -50,3 +50,41 @@ org.openecomp.appc.logging.path=${user.home},etc,../etc,.
org.openecomp.appc.logging.file=logback.xml
+#
+# The properties would be used by OAM's Stop/Start APIs to stop/start the bundles
+#
+appc.OAM.ToStop.properties=appc.OAM.AppcBundlesToStop\
+,appc.OAM.OtherBundlesToStop
+appc.OAM.ToNotStop.properties=appc.OAM.AppcBundlesToNotStop\
+,appc.OAM.OtherBundlesToNotStop
+
+# These following properties represent the Regular-Expression which would be evaluated against the
+# running Bundles's Symbolic-Name:
+# - appc.OAM.AppcBundlesToStop
+# - appc.OAM.OtherBundlesToStop
+# - appc.OAM.AppcBundlesToNotStop
+# - appc.OAM.OtherBundlesToNotStop
+appc.OAM.AppcBundlesToStop=.*appc.*\
+,domain-model-lib\
+,execution-queue-management-lib\
+,lock-manager-impl\
+,org.openecomp.sdnc.config.params\
+,org.openecomp.sdnc.config.audit\
+,org.openecomp.sdnc.config.generator\
+,org.openecomp.sdnc.dg.loader\
+,transaction-recorder
+
+appc.OAM.OtherBundlesToStop=.*app-cntrl.*\
+,com.att.sdnctl.sli.adaptor.asyncresponse
+
+appc.OAM.AppcBundlesToNotStop=.*appc.oam.*\
+,appc-common\
+,appc-command-executor-api\
+,appc-lifecycle-management-api\
+,appc-lifecycle-management-core\
+,appc-metric-bundle\
+,org.openecomp.appc.listener\
+,state-machine-lib
+
+appc.OAM.OtherBundlesToNotStop=app-cntrl-message-adapter-factory\
+,app-cntrl-aaf-filters
diff --git a/appc-oam/appc-oam-bundle/src/main/resources/org/openecomp/appc/org.ops4j.pax.logging.cfg b/appc-oam/appc-oam-bundle/src/main/resources/org/openecomp/appc/org.ops4j.pax.logging.cfg
deleted file mode 100644
index be5863291..000000000
--- a/appc-oam/appc-oam-bundle/src/main/resources/org/openecomp/appc/org.ops4j.pax.logging.cfg
+++ /dev/null
@@ -1,144 +0,0 @@
- ################################################################################
- #
- # Licensed to the Apache Software Foundation (ASF) under one or more
- # contributor license agreements. See the NOTICE file distributed with
- # this work for additional information regarding copyright ownership.
- # The ASF licenses this file to You under the Apache License, Version 2.0
- # (the "License"); you may not use this file except in compliance with
- # the License. You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITH WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- #
- ################################################################################
-
- # Root
- #log4j.rootLogger=TRACE, osgi:VmLogAppender
- log4j.rootLogger=TRACE, out, sift, osgi:*
- log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer
-
- # CONSOLE appender not used by default
- log4j.appender.stdout=org.apache.log4j.ConsoleAppender
- log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
- log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
-
- # Async appender forwarding to file appender
- log4j.appender.async=org.apache.log4j.AsyncAppender
- log4j.appender.async.appenders=out
-
- # Karaf appenders
- # File appender
- log4j.appender.out=org.apache.log4j.RollingFileAppender
- log4j.appender.out.layout=org.apache.log4j.PatternLayout
- log4j.appender.out.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
- log4j.appender.out.file=${karaf.data}/log/karaf.log
- log4j.appender.out.append=true
- log4j.appender.out.maxFileSize=10MB
- log4j.appender.out.maxBackupIndex=100
-
-
- # Sift appender
- log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender
- log4j.appender.sift.key=bundle.name
- log4j.appender.sift.default=karaf
- log4j.appender.sift.appender=org.apache.log4j.RollingFileAppender
- log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout
- log4j.appender.sift.appender.layout.ConversionPattern=%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%t|%X{ServiceName} - %X{bundle.id} - %X{bundle.name} - %X{bundle.version}|%-5.5p|%X{AlertSeverity}|%X{ServerFQDN}|%X{ServerIPAddress}|[%c{3}]|%m%n
- log4j.appender.sift.appender.file=${karaf.data}/log/eelf/karaf.log
- log4j.appender.sift.appender.append=true
-
- log4j.category.org.opendaylight.controller.netconf.persist.impl.osgi.ConfigPusherImpl=DEBUG
- log4j.category.org.opendaylight.controller.netconf.persist.impl.osgi.ConfigPersisterActivator=DEBUG
-
-
- #ECOMP Debug appender
- log4j.appender.debug=org.apache.log4j.RollingFileAppender
- log4j.appender.debug.key=bundle.name
- log4j.appender.debug.default=karaf
-
- log4j.appender.debug.appName=EELFDebug
- log4j.appender.debug.layout=org.apache.log4j.PatternLayout
- log4j.appender.debug.layout.ConversionPattern=%d{yyyy-MM-dd'T'hh:mm:ss.SSSXXX}|%X{RequestId}|%m%n
- #log4j.appender.debug.filter.f1=org.apache.log4j.varia.LevelRangeFilter
- #log4j.appender.debug.filter.f1.LevelMax=WARN
- #log4j.appender.debug.filter.f1.LevelMin=TRACE
-
-
- log4j.appender.debug.file=${karaf.data}/log/APPC/appc-debug.log
- log4j.appender.debug.append=true
- log4j.appender.debug.maxFileSize=100MB
- log4j.appender.debug.maxBackupIndex=10
-
-
- #Error appender
- log4j.appender.error=org.apache.log4j.RollingFileAppender
- log4j.appender.error.appName=EELFError
- log4j.appender.error.File=${karaf.data}/log/APPC/appc-error.log
- log4j.appender.error.Threshold=ERROR
- log4j.appender.error.MaxBackupIndex=1
- log4j.appender.error.MaxFileSize=100MB
- log4j.appender.error.layout=org.apache.log4j.PatternLayout
- log4j.appender.error.layout.ConversionPattern=%d{yyyy-MM-dd'T'hh:mm:ss.SSSXXX}|%X{RequestId}|%t|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%-5.5p|%X{ErrorCode}|%X{ErrorDescription}|%m%n
-
- #Metrics appender
- log4j.appender.metric=org.apache.log4j.RollingFileAppender
- log4j.appender.metric.appName=EELFMetrics
- log4j.appender.metric.File=${karaf.data}/log/APPC/appc-metric.log
- log4j.appender.metric.MaxBackupIndex=1
- log4j.appender.metric.MaxFileSize=100MB
- log4j.appender.metric.layout=org.apache.log4j.PatternLayout
- log4j.appender.metric.layout.ConversionPattern=%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%t|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%-5.5p|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{ClientIPAddress}|%X{ClassName}||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%m%n
-
- #Audit appender
- log4j.appender.audit=org.apache.log4j.RollingFileAppender
- log4j.appender.audit.appName=EELFAudit
- log4j.appender.audit.File=${karaf.data}/log/APPC/appc-audit.log
- log4j.appender.audit.MaxBackupIndex=1
- log4j.appender.audit.MaxFileSize=100MB
- log4j.appender.audit.layout=org.apache.log4j.PatternLayout
- log4j.appender.audit.layout.ConversionPattern=%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%t|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%-5.5p|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{ClientIPAddress}|%X{ClassName}||%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%m%n
-
- #Loggers
- #Routing of all messages from root logger
- log4j.logger.com.att=TRACE, debug, error
- #Store to the same log file messages from upper level appender or not
- log4j.additivity.com.att=false
-
- #EELFManager loggers
- #EELF parent logger
- log4j.logger.com.att.eelf=TRACE, debug
- log4j.additivity.com.att.eelf=false
-
- #Audit logger routing
- log4j.logger.com.att.eelf.audit=DEBUG, audit
- log4j.additivity.com.att.eelf.audit=false
-
- #Metric logger routing
- log4j.logger.com.att.eelf.metrics=DEBUG, metric
- log4j.additivity.com.att.eelf.metrics=false
-
- #Performance logger routing
- log4j.logger.com.att.eelf.perf=DEBUG, metric
- log4j.additivity.com.att.eelf.perf=false
-
- #Server logger routing
- log4j.logger.com.att.eelf.server=DEBUG, debug
- log4j.additivity.com.att.eelf.server=false
-
- #Policy logger routing
- log4j.logger.com.att.eelf.policy=DEBUG, debug
- log4j.additivity.com.att.eelf.policy=false
-
- #Error logger routing
- log4j.logger.com.att.eelf.error=DEBUG, error
- log4j.additivity.com.att.eelf.error=false
-
- #Debug logger routing
- log4j.logger.com.att.eelf.debug=DEBUG, debug
- log4j.additivity.com.att.eelf.debug=false
-
diff --git a/appc-oam/appc-oam-installer/src/main/resources/scripts/install-feature.sh b/appc-oam/appc-oam-installer/src/main/resources/scripts/install-feature.sh
index 05b4ae373..8de5e5714 100644
--- a/appc-oam/appc-oam-installer/src/main/resources/scripts/install-feature.sh
+++ b/appc-oam/appc-oam-installer/src/main/resources/scripts/install-feature.sh
@@ -39,5 +39,29 @@ else
exit 1
fi
-${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories}
-${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot}
+#${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories}
+#${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot}
+
+
+COUNT=0
+while [ $COUNT -lt 10 ]; do
+ ${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} 2> /tmp/installErr
+ cat /tmp/installErr
+ if grep -q 'Failed to get the session' /tmp/installErr; then
+ sleep 10
+ else
+ let COUNT=10
+ fi
+ let COUNT=COUNT+1
+done
+COUNT=0
+while [ $COUNT -lt 10 ]; do
+ ${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot} 2> /tmp/installErr
+ cat /tmp/installErr
+ if grep -q 'Failed to get the session' /tmp/installErr; then
+ sleep 10
+ else
+ let COUNT=10
+ fi
+ let COUNT=COUNT+1
+done
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderLcm.java b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderLcm.java
index 90097aea8..292496958 100644
--- a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderLcm.java
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderLcm.java
@@ -24,18 +24,91 @@
package org.openecomp.appc.provider;
-import java.text.ParseException;
-import java.util.Collection;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.att.eelf.i18n.EELFResourceManager;
+import com.google.common.util.concurrent.Futures;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.common.header.CommonHeader;
-import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.*;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.Action;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.AppcProviderLcmService;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.AuditInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.AuditOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.AuditOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.CheckLockInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.CheckLockOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.CheckLockOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigBackupDeleteInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigBackupDeleteOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigBackupDeleteOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigBackupInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigBackupOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigBackupOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigExportInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigExportOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigExportOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigModifyInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigModifyOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigModifyOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigRestoreInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigRestoreOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigRestoreOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigScaleoutInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigScaleoutOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigScaleoutOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigureInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigureOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.ConfigureOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.EvacuateInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.EvacuateOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.EvacuateOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.HealthCheckInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.HealthCheckOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.HealthCheckOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.LiveUpgradeInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.LiveUpgradeOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.LiveUpgradeOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.LockInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.LockOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.LockOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.MigrateInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.MigrateOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.MigrateOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.RebuildInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.RebuildOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.RebuildOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.RestartInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.RestartOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.RestartOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.RollbackInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.RollbackOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.RollbackOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.SnapshotInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.SnapshotOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.SnapshotOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.SoftwareUploadInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.SoftwareUploadOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.SoftwareUploadOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.StartInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.StartOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.StartOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.StopInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.StopOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.StopOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.SyncInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.SyncOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.SyncOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.TerminateInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.TerminateOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.TerminateOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.TestInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.TestOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.TestOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.UnlockInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.UnlockOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.UnlockOutputBuilder;
import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.status.Status;
import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.status.StatusBuilder;
import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -43,9 +116,8 @@ import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.openecomp.appc.Constants;
import org.openecomp.appc.configuration.Configuration;
import org.openecomp.appc.configuration.ConfigurationFactory;
-import org.openecomp.appc.domainmodel.lcm.ActionLevel;
import org.openecomp.appc.domainmodel.lcm.ResponseContext;
-import org.openecomp.appc.domainmodel.lcm.RuntimeContext;
+import org.openecomp.appc.exceptions.APPCException;
import org.openecomp.appc.executor.objects.LCMCommandStatus;
import org.openecomp.appc.executor.objects.Params;
import org.openecomp.appc.i18n.Msg;
@@ -56,17 +128,14 @@ import org.openecomp.appc.provider.lcm.util.ValidationService;
import org.openecomp.appc.requesthandler.RequestHandler;
import org.openecomp.appc.requesthandler.objects.RequestHandlerInput;
import org.openecomp.appc.requesthandler.objects.RequestHandlerOutput;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.att.eelf.i18n.EELFResourceManager;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
-import com.google.common.util.concurrent.Futures;
-import org.slf4j.MDC;
-
+import java.text.ParseException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
@@ -146,7 +215,7 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
/**
* Rebuilds a specific VNF
*
- * @see org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.AppcProviderLcmService#rebuild(RebuildInput)
+ * @see AppcProviderLcmService#rebuild(RebuildInput)
*/
@Override
public Future<RpcResult<RebuildOutput>> rebuild(RebuildInput input) {
@@ -155,12 +224,17 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
RebuildOutputBuilder outputBuilder = new RebuildOutputBuilder();
String action = Action.Rebuild.toString() ;
String rpcName = Action.Rebuild.name().toLowerCase();
- Status status = ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
+ Status status =
+ ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
if(null == status) {
try {
- RequestHandlerInput request = new RequestInputBuilder().requestContext().commonHeader(input.getCommonHeader()).actionIdentifiers(input.getActionIdentifiers()).payload(input.getPayload()).action(action).rpcName(rpcName).build();
+ RequestHandlerInput request = new RequestInputBuilder().requestContext()
+ .commonHeader(input.getCommonHeader())
+ .actionIdentifiers(input.getActionIdentifiers())
+ .payload(input.getPayload()).action(action).rpcName(rpcName).build();
status = buildStatusWithDispatcherOutput(executeRequest(request));
- logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s", input.getActionIdentifiers(), status.getCode(), status.getMessage()));
+ logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s",
+ input.getActionIdentifiers(), status.getCode(), status.getMessage()));
} catch (ParseException e) {
status = buildParsingErrorStatus(e);
@@ -175,10 +249,8 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
outputBuilder.setStatus(status);
RpcResult<RebuildOutput> result = RpcResultBuilder.<RebuildOutput> status(true).withResult(outputBuilder.build()).build();
return Futures.immediateFuture(result);
-
}
-
/**
* Restarts a specific VNF
*
@@ -191,7 +263,8 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
RestartOutputBuilder outputBuilder = new RestartOutputBuilder();
String action = Action.Restart.toString() ;
String rpcName = Action.Restart.name().toLowerCase();
- Status status = ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
+ Status status =
+ ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
if(null == status) {
try {
RequestHandlerInput request = new RequestInputBuilder().requestContext()
@@ -203,7 +276,8 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
.build();
status = buildStatusWithDispatcherOutput(executeRequest(request));
- logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s", input.getActionIdentifiers(), status.getCode(), status.getMessage()));
+ logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s",
+ input.getActionIdentifiers(), status.getCode(), status.getMessage()));
} catch (ParseException e) {
status = buildParsingErrorStatus(e);
@@ -220,11 +294,10 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
return Futures.immediateFuture(result);
}
-
/**
* Migrates a specific VNF
*
- * @see org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.AppcProviderLcmService#migrate(MigrateInput)
+ * @see AppcProviderLcmService#migrate(MigrateInput)
*/
@Override
public Future<RpcResult<MigrateOutput>> migrate(MigrateInput input) {
@@ -233,12 +306,17 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
MigrateOutputBuilder outputBuilder = new MigrateOutputBuilder();
String action = Action.Migrate.toString() ;
String rpcName = Action.Migrate.name().toLowerCase();
- Status status = ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
+ Status status =
+ ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
if(null == status) {
try {
- RequestHandlerInput request = new RequestInputBuilder().requestContext().commonHeader(input.getCommonHeader()).actionIdentifiers(input.getActionIdentifiers()).payload(input.getPayload()).action(action).rpcName(rpcName).build();
+ RequestHandlerInput request = new RequestInputBuilder().requestContext()
+ .commonHeader(input.getCommonHeader())
+ .actionIdentifiers(input.getActionIdentifiers())
+ .payload(input.getPayload()).action(action).rpcName(rpcName).build();
status = buildStatusWithDispatcherOutput(executeRequest(request));
- logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s", input.getActionIdentifiers(), status.getCode(), status.getMessage()));
+ logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s",
+ input.getActionIdentifiers(), status.getCode(), status.getMessage()));
} catch (ParseException e) {
status = buildParsingErrorStatus(e);
@@ -255,11 +333,10 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
return Futures.immediateFuture(result);
}
-
/**
* Evacuates a specific VNF
*
- * @see org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.AppcProviderLcmService#evacuate(EvacuateInput)
+ * @see AppcProviderLcmService#evacuate(EvacuateInput)
*/
@Override
public Future<RpcResult<EvacuateOutput>> evacuate(EvacuateInput input) {
@@ -294,7 +371,7 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
/**
* Evacuates a specific VNF
*
- * @see org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.AppcProviderLcmService#snapshot(SnapshotInput)
+ * @see AppcProviderLcmService#snapshot(SnapshotInput)
*/
@Override
public Future<RpcResult<SnapshotOutput>> snapshot(SnapshotInput input) {
@@ -303,13 +380,19 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
SnapshotOutputBuilder outputBuilder = new SnapshotOutputBuilder();
String action = Action.Snapshot.toString() ;
String rpcName = Action.Snapshot.name().toLowerCase();
- Status status = ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
+ Status status =
+ ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
String identityUrl = input.getIdentityUrl();
if(null == status) {
try {
- RequestHandlerInput request = new RequestInputBuilder().requestContext().commonHeader(input.getCommonHeader()).actionIdentifiers(input.getActionIdentifiers()).payload(input.getPayload()).action(action).rpcName(rpcName).additionalContext("identity-url", identityUrl).build();
+ RequestHandlerInput request = new RequestInputBuilder().requestContext()
+ .commonHeader(input.getCommonHeader())
+ .actionIdentifiers(input.getActionIdentifiers())
+ .payload(input.getPayload()).action(action).rpcName(rpcName)
+ .additionalContext("identity-url", identityUrl).build();
status = buildStatusWithDispatcherOutput(executeRequest(request));
- logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s", input.getActionIdentifiers(), status.getCode(), status.getMessage()));
+ logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s",
+ input.getActionIdentifiers(), status.getCode(), status.getMessage()));
} catch (ParseException e) {
status = buildParsingErrorStatus(e);
@@ -331,14 +414,20 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
RollbackOutputBuilder outputBuilder = new RollbackOutputBuilder();
String rpcName = Action.Rollback.toString() ;
- Status status = ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), rpcName);
+ Status status =
+ ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), rpcName);
String identityUrl = input.getIdentityUrl();
String snapshotId = input.getSnapshotId();
if(null == status) {
try {
- RequestHandlerInput request = new RequestInputBuilder().requestContext().commonHeader(input.getCommonHeader()).actionIdentifiers(input.getActionIdentifiers()).payload(input.getPayload()).additionalContext("identity-url", identityUrl).additionalContext("snapshot-id", snapshotId).action(rpcName).build();
+ RequestHandlerInput request = new RequestInputBuilder().requestContext()
+ .commonHeader(input.getCommonHeader())
+ .actionIdentifiers(input.getActionIdentifiers())
+ .payload(input.getPayload()).additionalContext("identity-url", identityUrl)
+ .additionalContext("snapshot-id", snapshotId).action(rpcName).build();
status = buildStatusWithDispatcherOutput(executeRequest(request));
- logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s", input.getActionIdentifiers(), status.getCode(), status.getMessage()));
+ logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s",
+ input.getActionIdentifiers(), status.getCode(), status.getMessage()));
} catch (ParseException e) {
status = buildParsingErrorStatus(e);
@@ -361,12 +450,17 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
SyncOutputBuilder outputBuilder = new SyncOutputBuilder();
String action = Action.Sync.toString() ;
String rpcName = Action.Sync.name().toLowerCase();
- Status status = ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
+ Status status =
+ ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
if(null == status) {
try {
- RequestHandlerInput request = new RequestInputBuilder().requestContext().commonHeader(input.getCommonHeader()).actionIdentifiers(input.getActionIdentifiers()).payload(input.getPayload()).action(action).rpcName(rpcName).build();
+ RequestHandlerInput request = new RequestInputBuilder().requestContext()
+ .commonHeader(input.getCommonHeader())
+ .actionIdentifiers(input.getActionIdentifiers())
+ .payload(input.getPayload()).action(action).rpcName(rpcName).build();
status = buildStatusWithDispatcherOutput(executeRequest(request));
- logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s", input.getActionIdentifiers(), status.getCode(), status.getMessage()));
+ logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s",
+ input.getActionIdentifiers(), status.getCode(), status.getMessage()));
} catch (ParseException e) {
status = buildParsingErrorStatus(e);
@@ -404,56 +498,63 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
}
private RequestHandlerOutput executeRequest(RequestHandlerInput request){
-
- RequestHandler handler = getRequestHandler(request.getRequestContext().getActionLevel());
+ RequestHandler handler = getRequestHandler();
RequestHandlerOutput requestHandlerOutput;
+ if (handler != null) {
try {
requestHandlerOutput = handler.handleRequest(request);
} catch (Exception e) {
-
- final String appName = configuration.getProperty(Constants.PROPERTY_APPLICATION_NAME);
- final String reason = EELFResourceManager.format(Msg.EXCEPTION_CALLING_DG, e, appName, e.getClass().getSimpleName(), "", e.getMessage());
-
logger.info("UNEXPECTED FAILURE while executing " + request.getRequestContext().getAction().name());
+ requestHandlerOutput = createErrorRequestHandlerObj(request,
+ LCMCommandStatus.UNEXPECTED_ERROR, Msg.EXCEPTION_CALLING_DG, e);
+ }
+ } else {
+ String errorMsg = "LCM request cannot be processed at the moment because APPC isn't running";
+ requestHandlerOutput = createErrorRequestHandlerObj(request,
+ LCMCommandStatus.REJECTED, Msg.REQUEST_HANDLER_UNAVAILABLE, new APPCException(errorMsg));
+ }
+ return requestHandlerOutput;
+ }
+ private RequestHandlerOutput createErrorRequestHandlerObj(RequestHandlerInput request,
+ LCMCommandStatus cmdStatus,
+ Msg msg,
+ Exception e) {
+ final String appName = configuration.getProperty(Constants.PROPERTY_APPLICATION_NAME);
+ final String reason = EELFResourceManager.format(msg, e,
+ appName, e.getClass().getSimpleName(), "", e.getMessage());
- final ResponseContext responseContext = new ResponseContext();
- requestHandlerOutput = new RequestHandlerOutput();
- requestHandlerOutput.setResponseContext(responseContext);
- responseContext.setCommonHeader(request.getRequestContext().getCommonHeader());
- String errorMessage = e.getMessage() != null ? e.getMessage() : e.toString();
- Params params = new Params().addParam("errorMsg", errorMessage);
- responseContext.setStatus(LCMCommandStatus.UNEXPECTED_ERROR.toStatus(params));
+ RequestHandlerOutput requestHandlerOutput = new RequestHandlerOutput();
+ final ResponseContext responseContext = new ResponseContext();
+ requestHandlerOutput.setResponseContext(responseContext);
+ responseContext.setCommonHeader(request.getRequestContext().getCommonHeader());
- LoggingUtils.logErrorMessage(
- LoggingConstants.TargetNames.APPC_PROVIDER,
- reason,
- this.getClass().getName());
+ String errorMessage = e.getMessage() != null ? e.getMessage() : e.toString();
+ Params params = new Params().addParam("errorMsg", errorMessage);
+ responseContext.setStatus(cmdStatus.toStatus(params));
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ reason,
+ this.getClass().getName());
- }
return requestHandlerOutput;
}
- private RequestHandler getRequestHandler(ActionLevel actionLevel){
- RequestHandler handler ;
+ private RequestHandler getRequestHandler(){
final BundleContext context = FrameworkUtil.getBundle(RequestHandler.class).getBundleContext();
- String filter = "(level=" + actionLevel.name() + ")";
- try {
- Collection<ServiceReference<RequestHandler>> serviceReferences = context.getServiceReferences(RequestHandler.class, filter);
- if (serviceReferences.size() != 1) {
- logger.error("Cannot find service reference for " + RequestHandler.class.getName());
- throw new RuntimeException();
- }
- ServiceReference<RequestHandler> serviceReference = serviceReferences.iterator().next();
- handler = context.getService(serviceReference);
- } catch (InvalidSyntaxException e) {
- logger.error("Cannot find service reference for " + RequestHandler.class.getName() + ": Invalid Syntax " + filter, e);
- throw new RuntimeException(e);
+ if (context == null) {
+ return null;
}
- return handler ;
- }
+ final ServiceReference reference = context.getServiceReference(RequestHandler.class.getName());
+ if (reference == null) {
+ logger.error("Cannot find service reference for " + RequestHandler.class.getName());
+ throw new RuntimeException();
+ }
+
+ return (RequestHandler) context.getService(reference);
+ }
@Override
public Future<RpcResult<TerminateOutput>> terminate(TerminateInput input) {
@@ -461,12 +562,17 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
TerminateOutputBuilder outputBuilder = new TerminateOutputBuilder();
String action = Action.Terminate.toString() ;
String rpcName = Action.Terminate.name().toLowerCase();
- Status status = ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
+ Status status =
+ ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
if(null == status) {
try {
- RequestHandlerInput request = new RequestInputBuilder().requestContext().commonHeader(input.getCommonHeader()).actionIdentifiers(input.getActionIdentifiers()).payload(input.getPayload()).action(action).rpcName(rpcName).build();
+ RequestHandlerInput request = new RequestInputBuilder().requestContext()
+ .commonHeader(input.getCommonHeader())
+ .actionIdentifiers(input.getActionIdentifiers())
+ .payload(input.getPayload()).action(action).rpcName(rpcName).build();
status = buildStatusWithDispatcherOutput(executeRequest(request));
- logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s", input.getActionIdentifiers(), status.getCode(), status.getMessage()));
+ logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s",
+ input.getActionIdentifiers(), status.getCode(), status.getMessage()));
} catch (ParseException e) {
status = buildParsingErrorStatus(e);
@@ -481,7 +587,8 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
}
outputBuilder.setCommonHeader(input.getCommonHeader());
outputBuilder.setStatus(status);
- RpcResult<TerminateOutput> result = RpcResultBuilder.<TerminateOutput> status(true).withResult(outputBuilder.build()).build();
+ RpcResult<TerminateOutput> result =
+ RpcResultBuilder.<TerminateOutput> status(true).withResult(outputBuilder.build()).build();
return Futures.immediateFuture(result);
}
@@ -491,12 +598,17 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
ConfigureOutputBuilder outputBuilder = new ConfigureOutputBuilder();
String action = Action.Configure.toString() ;
String rpcName = "configure";
- Status status = ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
+ Status status =
+ ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
if(null == status) {
try {
- RequestHandlerInput request = new RequestInputBuilder().requestContext().commonHeader(input.getCommonHeader()).actionIdentifiers(input.getActionIdentifiers()).payload(input.getPayload()).action(action).rpcName(rpcName).build();
+ RequestHandlerInput request = new RequestInputBuilder().requestContext()
+ .commonHeader(input.getCommonHeader())
+ .actionIdentifiers(input.getActionIdentifiers())
+ .payload(input.getPayload()).action(action).rpcName(rpcName).build();
status = buildStatusWithDispatcherOutput(executeRequest(request));
- logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s", input.getActionIdentifiers(), status.getCode(), status.getMessage()));
+ logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s",
+ input.getActionIdentifiers(), status.getCode(), status.getMessage()));
} catch (ParseException e) {
status = buildParsingErrorStatus(e);
@@ -509,7 +621,8 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
}
outputBuilder.setCommonHeader(input.getCommonHeader());
outputBuilder.setStatus(status);
- RpcResult<ConfigureOutput> result = RpcResultBuilder.<ConfigureOutput> status(true).withResult(outputBuilder.build()).build();
+ RpcResult<ConfigureOutput> result =
+ RpcResultBuilder.<ConfigureOutput> status(true).withResult(outputBuilder.build()).build();
return Futures.immediateFuture(result);
}
@@ -519,12 +632,17 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
ConfigModifyOutputBuilder outputBuilder = new ConfigModifyOutputBuilder();
String action = Action.ConfigModify.toString() ;
String rpcName = "config-modify";
- Status status = ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
+ Status status =
+ ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
if(null == status) {
try {
- RequestHandlerInput request = new RequestInputBuilder().requestContext().commonHeader(input.getCommonHeader()).actionIdentifiers(input.getActionIdentifiers()).payload(input.getPayload()).action(action).rpcName(rpcName).build();
+ RequestHandlerInput request = new RequestInputBuilder().requestContext()
+ .commonHeader(input.getCommonHeader())
+ .actionIdentifiers(input.getActionIdentifiers())
+ .payload(input.getPayload()).action(action).rpcName(rpcName).build();
status = buildStatusWithDispatcherOutput(executeRequest(request));
- logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s", input.getActionIdentifiers(), status.getCode(), status.getMessage()));
+ logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s",
+ input.getActionIdentifiers(), status.getCode(), status.getMessage()));
} catch (ParseException e) {
status = buildParsingErrorStatus(e);
@@ -537,7 +655,8 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
}
outputBuilder.setCommonHeader(input.getCommonHeader());
outputBuilder.setStatus(status);
- RpcResult<ConfigModifyOutput> result = RpcResultBuilder.<ConfigModifyOutput> status(true).withResult(outputBuilder.build()).build();
+ RpcResult<ConfigModifyOutput> result =
+ RpcResultBuilder.<ConfigModifyOutput> status(true).withResult(outputBuilder.build()).build();
return Futures.immediateFuture(result);
}
@@ -547,12 +666,17 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
ConfigScaleoutOutputBuilder outputBuilder = new ConfigScaleoutOutputBuilder();
String action = Action.ConfigScaleOut.toString() ;
String rpcName = "config-scaleout";
- Status status = ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
+ Status status =
+ ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
if(null == status) {
try {
- RequestHandlerInput request = new RequestInputBuilder().requestContext().commonHeader(input.getCommonHeader()).actionIdentifiers(input.getActionIdentifiers()).payload(input.getPayload()).action(action).rpcName(rpcName).build();
+ RequestHandlerInput request = new RequestInputBuilder().requestContext()
+ .commonHeader(input.getCommonHeader())
+ .actionIdentifiers(input.getActionIdentifiers())
+ .payload(input.getPayload()).action(action).rpcName(rpcName).build();
status = buildStatusWithDispatcherOutput(executeRequest(request));
- logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s", input.getActionIdentifiers(), status.getCode(), status.getMessage()));
+ logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s",
+ input.getActionIdentifiers(), status.getCode(), status.getMessage()));
} catch (ParseException e) {
status = buildParsingErrorStatus(e);
@@ -565,7 +689,8 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
}
outputBuilder.setCommonHeader(input.getCommonHeader());
outputBuilder.setStatus(status);
- RpcResult<ConfigScaleoutOutput> result = RpcResultBuilder.<ConfigScaleoutOutput> status(true).withResult(outputBuilder.build()).build();
+ RpcResult<ConfigScaleoutOutput> result =
+ RpcResultBuilder.<ConfigScaleoutOutput> status(true).withResult(outputBuilder.build()).build();
return Futures.immediateFuture(result);
}
@@ -575,12 +700,17 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
ConfigRestoreOutputBuilder outputBuilder = new ConfigRestoreOutputBuilder();
String action = Action.ConfigRestore.toString() ;
String rpcName = "config-restore";
- Status status = ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
+ Status status =
+ ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
if(null == status) {
try {
- RequestHandlerInput request = new RequestInputBuilder().requestContext().commonHeader(input.getCommonHeader()).actionIdentifiers(input.getActionIdentifiers()).payload(input.getPayload()).action(action).rpcName(rpcName).build();
+ RequestHandlerInput request = new RequestInputBuilder().requestContext()
+ .commonHeader(input.getCommonHeader())
+ .actionIdentifiers(input.getActionIdentifiers())
+ .payload(input.getPayload()).action(action).rpcName(rpcName).build();
status = buildStatusWithDispatcherOutput(executeRequest(request));
- logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s", input.getActionIdentifiers(), status.getCode(), status.getMessage()));
+ logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s",
+ input.getActionIdentifiers(), status.getCode(), status.getMessage()));
} catch (ParseException e) {
status = buildParsingErrorStatus(e);
@@ -593,7 +723,8 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
}
outputBuilder.setCommonHeader(input.getCommonHeader());
outputBuilder.setStatus(status);
- RpcResult<ConfigRestoreOutput> result = RpcResultBuilder.<ConfigRestoreOutput> status(true).withResult(outputBuilder.build()).build();
+ RpcResult<ConfigRestoreOutput> result =
+ RpcResultBuilder.<ConfigRestoreOutput> status(true).withResult(outputBuilder.build()).build();
return Futures.immediateFuture(result);
}
@@ -657,7 +788,7 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
/**
* Starts a specific VNF
*
- * @see org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.AppcProviderLcmService#start(StartInput)
+ * @see AppcProviderLcmService#start(StartInput)
*/
@Override
public Future<RpcResult<StartOutput>> start(StartInput input) {