aboutsummaryrefslogtreecommitdiffstats
path: root/appc-provider
diff options
context:
space:
mode:
authorPatrick Brady <pb071s@att.com>2017-02-15 23:11:26 -0800
committerPatrick Brady <pb071s@att.com>2017-02-15 23:13:06 -0800
commit1c192d2dd68724e292b6a30f463085a262e1e813 (patch)
treed0e2b3a396e169863cd0efaa835c8675e9d5aaac /appc-provider
parentc69ba05c7508aa7d7f675189a45c8c87569369ef (diff)
Moving all files to root directory
Change-Id: Ica5535fd6ec85f350fe1640b42137b49f83f10f0 Signed-off-by: Patrick Brady <pb071s@att.com>
Diffstat (limited to 'appc-provider')
-rw-r--r--appc-provider/.gitignore4
-rw-r--r--appc-provider/appc-provider-bundle/.gitignore4
-rw-r--r--appc-provider/appc-provider-bundle/pom.xml215
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/provider/impl/rev140523/AppcProviderModule.java85
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/provider/impl/rev140523/AppcProviderModuleFactory.java36
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/provider/lcm/impl/rev160108/AppcProviderLcmModule.java53
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/provider/lcm/impl/rev160108/AppcProviderLcmModuleFactory.java34
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProvider.java266
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderClient.java81
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderLcm.java828
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/ResponseHeaderBuilder.java88
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/LCMConstants.java35
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/RequestInputBuilder.java141
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/ValidationService.java91
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/topology/TopologyService.java718
-rw-r--r--appc-provider/appc-provider-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml36
-rw-r--r--appc-provider/appc-provider-bundle/src/main/resources/initial/appc-provider.xml118
-rw-r--r--appc-provider/appc-provider-bundle/src/main/resources/org/openecomp/appc/default.properties55
-rw-r--r--appc-provider/appc-provider-bundle/src/main/resources/org/openecomp/appc/logback.xml284
-rw-r--r--appc-provider/appc-provider-bundle/src/main/resources/org/openecomp/appc/org.ops4j.pax.logging.cfg144
-rw-r--r--appc-provider/appc-provider-bundle/src/main/yang/appc-provider-lcm.yang61
-rw-r--r--appc-provider/appc-provider-bundle/src/main/yang/appc-provider.yang61
-rw-r--r--appc-provider/appc-provider-bundle/src/test/java/org/openecomp/appc/AppcProviderTest.java84
-rw-r--r--appc-provider/appc-provider-features/.gitignore3
-rw-r--r--appc-provider/appc-provider-features/pom.xml143
-rw-r--r--appc-provider/appc-provider-features/src/main/resources/features.xml41
-rw-r--r--appc-provider/appc-provider-installer/.gitignore2
-rw-r--r--appc-provider/appc-provider-installer/pom.xml143
-rw-r--r--appc-provider/appc-provider-installer/src/assembly/assemble_installer_zip.xml59
-rw-r--r--appc-provider/appc-provider-installer/src/assembly/assemble_mvnrepo_zip.xml54
-rw-r--r--appc-provider/appc-provider-installer/src/main/resources/scripts/install-feature.sh40
-rw-r--r--appc-provider/appc-provider-model/.gitignore3
-rw-r--r--appc-provider/appc-provider-model/pom.xml96
-rw-r--r--appc-provider/appc-provider-model/src/main/yang/appc-provider-lcm.yang949
-rw-r--r--appc-provider/appc-provider-model/src/main/yang/appc-provider.yang620
-rw-r--r--appc-provider/features/.gitignore1
-rw-r--r--appc-provider/pom.xml24
-rw-r--r--appc-provider/provider/.gitignore1
38 files changed, 5701 insertions, 0 deletions
diff --git a/appc-provider/.gitignore b/appc-provider/.gitignore
new file mode 100644
index 000000000..0674a61a3
--- /dev/null
+++ b/appc-provider/.gitignore
@@ -0,0 +1,4 @@
+/.settings/
+/target/
+
+**/build/ \ No newline at end of file
diff --git a/appc-provider/appc-provider-bundle/.gitignore b/appc-provider/appc-provider-bundle/.gitignore
new file mode 100644
index 000000000..5ef400af7
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/.gitignore
@@ -0,0 +1,4 @@
+/target/
+/bin/
+/.settings/
+**/yang-gen-config/
diff --git a/appc-provider/appc-provider-bundle/pom.xml b/appc-provider/appc-provider-bundle/pom.xml
new file mode 100644
index 000000000..56e90fee1
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/pom.xml
@@ -0,0 +1,215 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>appc-provider</artifactId>
+ <groupId>org.openecomp.appc</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>appc-provider-bundle</artifactId>
+ <packaging>bundle</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>org.opendaylight.controller.config.yang.config.sample_provider.impl</Export-Package>
+ <Export-Package>org.openecomp.appc.provider</Export-Package>
+ <Import-Package>!groovy.lang,!javax.jms,!org.codehaus.commons.compiler,!org.codehaus.groovy.*,!org.codehaus.janino,!com.ibm.icu.*,!com.sun.faces.*,!org.apache.log,*</Import-Package>
+ <Embed-Dependency>appc-common,eelf-core,logback-core,logback-classic;scope=compile|runtime;inline=false,domain-model-lib,appc-command-executor-api,appc-request-handler-api</Embed-Dependency>
+ <Embed-Transitive>true</Embed-Transitive>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-maven-plugin</artifactId>
+ <version>${odl.yangtools.version}</version>
+ <executions>
+ <execution>
+ <id>config</id>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <codeGenerators>
+ <generator>
+ <codeGeneratorClass>org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator</codeGeneratorClass>
+ <outputBaseDir>${jmxGeneratorPath}</outputBaseDir>
+ <additionalConfiguration>
+ <namespaceToPackage1>urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang</namespaceToPackage1>
+ </additionalConfiguration>
+ </generator>
+ <generator>
+ <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
+ <outputBaseDir>${salGeneratorPath}</outputBaseDir>
+ </generator>
+ </codeGenerators>
+ <inspectDependencies>true</inspectDependencies>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>maven-sal-api-gen-plugin</artifactId>
+ <version>${odl.yangtools.version}</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>yang-jmx-generator-plugin</artifactId>
+ <version>${odl.yang.jmx.generator.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/initial/appc-provider.xml</file>
+ <type>xml</type>
+ <classifier>config</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings
+ only. It has no influence on the Maven build itself. -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <versionRange>[1.9.1,)</versionRange>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-request-handler-api</artifactId>
+ <version>1.0.0</version>
+ <type>bundle</type>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>domain-model-lib</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-common</artifactId>
+ <version>${project.version}</version>
+ <classifier>jar-with-dependencies</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-provider-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- ADDED THIS ARTIFACT TO BE ABLE TO FIND org.openecomp.appc.domainmodel.lcm -->
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>domain-model-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-config</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-common-util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ </dependency>
+ <dependency>
+ <artifactId>sal-test-model</artifactId>
+ <groupId>org.opendaylight.controller</groupId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <artifactId>sal-rest-connector</artifactId>
+ <groupId>org.opendaylight.netconf</groupId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ <classifier>tests</classifier>
+ <version>${odl.mdsal.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!-- TEMP CODE -->
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/provider/impl/rev140523/AppcProviderModule.java b/appc-provider/appc-provider-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/provider/impl/rev140523/AppcProviderModule.java
new file mode 100644
index 000000000..2b55d192c
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/provider/impl/rev140523/AppcProviderModule.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed 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,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.opendaylight.yang.gen.v1.org.openecomp.appc.provider.impl.rev140523;
+
+import org.openecomp.appc.provider.AppcProvider;
+
+/**
+ * This was generated code. It was generated into the source tree because it has to be manually modified.
+ *
+ */
+public class AppcProviderModule extends
+ org.opendaylight.yang.gen.v1.org.openecomp.appc.provider.impl.rev140523.AbstractAppcProviderModule {
+
+ /**
+ * @param identifier
+ * @param dependencyResolver
+ */
+ @SuppressWarnings("javadoc")
+ public AppcProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+ org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ /**
+ * @param identifier
+ * @param dependencyResolver
+ * @param oldModule
+ * @param oldInstance
+ */
+ @SuppressWarnings("javadoc")
+ public AppcProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+ org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+ org.opendaylight.yang.gen.v1.org.openecomp.appc.provider.impl.rev140523.AppcProviderModule oldModule,
+ java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ /**
+ * @see org.opendaylight.yang.gen.v1.org.openecomp.appc.provider.impl.rev140523.AbstractAppcProviderModule#customValidation()
+ */
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ }
+
+ /**
+ * This method is manually updated to actually invoke the provider implementation
+ *
+ * @see org.opendaylight.yang.gen.v1.org.openecomp.appc.provider.impl.rev140523.AbstractAppcProviderModule#createInstance()
+ */
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+
+ final AppcProvider provider =
+ new AppcProvider(getDataBrokerDependency(), getNotificationServiceDependency(), getRpcRegistryDependency());
+ return new AutoCloseable() {
+
+ @Override
+ public void close() throws Exception {
+ provider.close();
+ }
+ };
+
+ }
+
+}
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/provider/impl/rev140523/AppcProviderModuleFactory.java b/appc-provider/appc-provider-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/provider/impl/rev140523/AppcProviderModuleFactory.java
new file mode 100644
index 000000000..d91f057a7
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/provider/impl/rev140523/AppcProviderModuleFactory.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed 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,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/**
+ * Generated file Generated from: yang module name: appc-provider-impl yang module local name: appc-provider-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator Generated at: Tue Sep 01
+ * 13:56:34 CDT 2015 Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.yang.gen.v1.org.openecomp.appc.provider.impl.rev140523;
+
+/**
+ * Generated code
+ *
+ */
+public class AppcProviderModuleFactory extends
+ org.opendaylight.yang.gen.v1.org.openecomp.appc.provider.impl.rev140523.AbstractAppcProviderModuleFactory {
+
+}
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/provider/lcm/impl/rev160108/AppcProviderLcmModule.java b/appc-provider/appc-provider-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/provider/lcm/impl/rev160108/AppcProviderLcmModule.java
new file mode 100644
index 000000000..ac98cb894
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/provider/lcm/impl/rev160108/AppcProviderLcmModule.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed 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,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.opendaylight.yang.gen.v1.org.openecomp.appc.provider.lcm.impl.rev160108;
+
+import org.openecomp.appc.provider.AppcProviderLcm;
+
+public class AppcProviderLcmModule extends org.opendaylight.yang.gen.v1.org.openecomp.appc.provider.lcm.impl.rev160108.AbstractAppcProviderLcmModule {
+ public AppcProviderLcmModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public AppcProviderLcmModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.org.openecomp.appc.provider.lcm.impl.rev160108.AppcProviderLcmModule oldModule, java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ final AppcProviderLcm provider =
+ new AppcProviderLcm(getDataBrokerDependency(), getNotificationServiceDependency(), getRpcRegistryDependency());
+ return new AutoCloseable() {
+
+ @Override
+ public void close() throws Exception {
+ provider.close();
+ }
+ };
+ }
+
+}
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/provider/lcm/impl/rev160108/AppcProviderLcmModuleFactory.java b/appc-provider/appc-provider-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/provider/lcm/impl/rev160108/AppcProviderLcmModuleFactory.java
new file mode 100644
index 000000000..5f2c358a1
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/provider/lcm/impl/rev160108/AppcProviderLcmModuleFactory.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed 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,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*
+* Generated file
+*
+* Generated from: yang module name: appc-provider-lcm-impl yang module local name: appc-provider-lcm-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Tue Aug 16 10:40:21 IDT 2016
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.org.openecomp.appc.provider.lcm.impl.rev160108;
+public class AppcProviderLcmModuleFactory extends org.opendaylight.yang.gen.v1.org.openecomp.appc.provider.lcm.impl.rev160108.AbstractAppcProviderLcmModuleFactory {
+
+}
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProvider.java b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProvider.java
new file mode 100644
index 000000000..9826a5619
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProvider.java
@@ -0,0 +1,266 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed 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,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.provider;
+
+import com.google.common.util.concurrent.Futures;
+import org.json.JSONObject;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
+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.rev160104.*;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.common.request.header.CommonRequestHeader;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.responseattributes.StatusBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.responseheader.ResponseHeaderBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.vnf.resource.VnfResource;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.config.payload.ConfigPayload;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+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.executor.objects.LCMCommandStatus;
+import org.openecomp.appc.executor.objects.Params;
+import org.openecomp.appc.i18n.Msg;
+import org.openecomp.appc.provider.lcm.util.RequestInputBuilder;
+import org.openecomp.appc.provider.lcm.util.ValidationService;
+import org.openecomp.appc.provider.topology.TopologyService;
+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.ServiceReference;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.status.Status;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.Action;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.TimeZone;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+/* ADDED FOR FUSION SERVICE CODE */
+
+@SuppressWarnings("JavaDoc")
+/**
+ * Defines the APPC service provider.
+ * <p>
+ * The rpc definition in the YANG model is shown below. This model is used to generate code to manage the inputs and
+ * outputs of the RPC service. For example, the input is defined by a class named {@link ConfigurationOperationInput},
+ * which is generated from the name of the RPC and the "input" definition of the RPC. This class encapsulates the
+ * various objects that are passed to the RPC and is used to obtain values from the input parameters.
+ * </p>
+ * <p>
+ * Likewise, the outputs are defined by a class named {@link ConfigurationOperationOutput}. This class encapsulates the
+ * defined outputs. To make construction of the outputs easier, there are also generated builder classes that are named
+ * for the various elements of the output they "build", such as {@link ConfigurationResponseBuilder}.
+ * </p>
+ *
+ * <pre>
+ * rpc configuration-operation {
+ * description "An operation to view, change, or audit the configuration of a VM";
+ * input {
+ * uses configuration-request-header;
+ * uses configuration-request;
+ * }
+ * output {
+ * uses common-response-header;
+ * uses configuration-response;
+ * }
+ * }
+ * </pre>
+ *
+ */
+public class AppcProvider implements AutoCloseable, AppcProviderService {
+
+ // private final Logger logger = LoggerFactory.getLogger(AppcProvider.class);
+ private final EELFLogger logger = EELFManager.getInstance().getLogger(AppcProviderClient.class);
+
+ private final ExecutorService executor;
+
+ private ListenerRegistration<DataChangeListener> dclServices;
+
+ /**
+ * The ODL data store broker. Provides access to a conceptual data tree store and also provides the ability to
+ * subscribe for changes to data under a given branch of the tree.
+ */
+ protected DataBroker dataBroker;
+
+ /**
+ * ODL Notification Service that provides publish/subscribe capabilities for YANG modeled notifications.
+ */
+ protected NotificationProviderService notificationService;
+
+ /**
+ * Provides a registry for Remote Procedure Call (RPC) service implementations. The RPCs are defined in YANG models.
+ */
+ protected RpcProviderRegistry rpcRegistry;
+
+ /**
+ * Represents our RPC implementation registration
+ */
+ protected BindingAwareBroker.RpcRegistration<AppcProviderService> rpcRegistration;
+
+ /**
+ * The configuration
+ */
+ private Configuration configuration = ConfigurationFactory.getConfiguration();
+
+ /**
+ * @param dataBroker2
+ * @param notificationProviderService
+ * @param rpcProviderRegistry
+ */
+ @SuppressWarnings({
+ "javadoc", "nls"
+ })
+ public AppcProvider(DataBroker dataBroker2, NotificationProviderService notificationProviderService,
+ RpcProviderRegistry rpcProviderRegistry) {
+
+ String appName = configuration.getProperty(Constants.PROPERTY_APPLICATION_NAME);
+ logger.info(Msg.COMPONENT_INITIALIZING, appName, "provider");
+
+ executor = Executors.newFixedThreadPool(1);
+ dataBroker = dataBroker2;
+ notificationService = notificationProviderService;
+ rpcRegistry = rpcProviderRegistry;
+
+ if (rpcRegistry != null) {
+ rpcRegistration = rpcRegistry.addRpcImplementation(AppcProviderService.class, this);
+ }
+
+ logger.info(Msg.COMPONENT_INITIALIZED, appName, "provider");
+ }
+
+ /**
+ * Implements the close of the service
+ *
+ * @see java.lang.AutoCloseable#close()
+ */
+ @SuppressWarnings("nls")
+ @Override
+ public void close() throws Exception {
+ String appName = configuration.getProperty(Constants.PROPERTY_APPLICATION_NAME);
+ logger.info(Msg.COMPONENT_TERMINATING, appName, "provider");
+ executor.shutdown();
+ if (rpcRegistration != null) {
+ rpcRegistration.close();
+ }
+ logger.info(Msg.COMPONENT_TERMINATED, appName, "provider");
+ }
+
+
+public Future<RpcResult<ModifyConfigOutput>> modifyConfig(ModifyConfigInput input){
+ CommonRequestHeader hdr = input.getCommonRequestHeader();
+ ConfigPayload data = input.getConfigPayload();
+ TopologyService topology = new TopologyService(this);
+ RpcResult<ModifyConfigOutput> result = topology.modifyConfig(hdr, data);
+ return Futures.immediateFuture(result);
+}
+ /**
+ * Rebuilds a specific VNF
+ *
+ * @see org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.AppcProviderService#rebuild(org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.RebuildInput)
+ */
+ @Override
+ public Future<RpcResult<RebuildOutput>> rebuild(RebuildInput input) {
+
+ CommonRequestHeader hdr = input.getCommonRequestHeader();
+ VnfResource vnf = input.getVnfResource();
+
+ TopologyService topology = new TopologyService(this);
+ RpcResult<RebuildOutput> result = topology.rebuild(hdr, vnf);
+ return Futures.immediateFuture(result);
+ }
+
+ /**
+ * Restarts a specific VNF
+ *
+ * @see org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.AppcProviderService#restart(org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.RestartInput)
+ */
+ @Override
+ public Future<RpcResult<RestartOutput>> restart(RestartInput input) {
+ CommonRequestHeader hdr = input.getCommonRequestHeader();
+ VnfResource vnf = input.getVnfResource();
+
+ TopologyService topology = new TopologyService(this);
+ RpcResult<RestartOutput> result = topology.restart(hdr, vnf);
+ return Futures.immediateFuture(result);
+ }
+
+ /**
+ * Migrates a specific VNF
+ *
+ * @see org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.AppcProviderService#migrate(org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.MigrateInput)
+ */
+ @Override
+ public Future<RpcResult<MigrateOutput>> migrate(MigrateInput input) {
+ CommonRequestHeader hdr = input.getCommonRequestHeader();
+ VnfResource vnf = input.getVnfResource();
+
+ TopologyService topology = new TopologyService(this);
+ RpcResult<MigrateOutput> result = topology.migrate(hdr, vnf);
+ return Futures.immediateFuture(result);
+ }
+
+ /**
+ * Evacuates a specific VNF
+ *
+ * @see org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.AppcProviderService#evacuate(org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.EvacuateInput)
+ */
+ @Override
+ public Future<RpcResult<EvacuateOutput>> evacuate(EvacuateInput input) {
+ CommonRequestHeader hdr = input.getCommonRequestHeader();
+ VnfResource vnf = input.getVnfResource();
+
+ TopologyService topology = new TopologyService(this);
+ // RpcResult<RestartOutput> result = topology.restart(hdr, vnf);
+ return null;// Futures.immediateFuture(result);
+ }
+
+ /**
+ * Evacuates a specific VNF
+ *
+ * @see org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.AppcProviderService#evacuate(org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.EvacuateInput)
+ */
+ @Override
+ public Future<RpcResult<SnapshotOutput>> snapshot(SnapshotInput input) {
+ CommonRequestHeader hdr = input.getCommonRequestHeader();
+ VnfResource vnf = input.getVnfResource();
+
+ TopologyService topology = new TopologyService(this);
+ RpcResult<SnapshotOutput> result = topology.snapshot(hdr, vnf);
+ return Futures.immediateFuture(result);
+ }
+
+}
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderClient.java b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderClient.java
new file mode 100644
index 000000000..f294fd98f
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderClient.java
@@ -0,0 +1,81 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed 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,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.provider;
+
+import org.openecomp.appc.util.StringHelper;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.att.eelf.i18n.EELFResourceManager;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.provider.SvcLogicService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+
+import static com.att.eelf.configuration.Configuration.*;
+
+import java.util.Properties;
+
+public class AppcProviderClient {
+
+ //private static final Logger LOG = LoggerFactory.getLogger(AppcProviderClient.class);
+ private static EELFLogger LOG = EELFManager.getInstance().getApplicationLogger();
+ private static EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
+
+ private SvcLogicService svcLogic = null;
+
+ public AppcProviderClient() {
+ BundleContext bctx = FrameworkUtil.getBundle(SvcLogicService.class).getBundleContext();
+
+ // Get SvcLogicService reference
+ ServiceReference sref = bctx.getServiceReference(SvcLogicService.NAME);
+ if (sref != null) {
+ svcLogic = (SvcLogicService) bctx.getService(sref);
+
+ } else {
+ LOG.warn("Cannot find service reference for " + SvcLogicService.NAME);
+
+ }
+ }
+
+ public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException {
+ LOG.debug(String.format("Checking for graph. %s %s %s %s", module, rpc, version, mode));
+ return (svcLogic.hasGraph(module, rpc, version, mode));
+ }
+
+ public Properties execute(String module, String rpc, String version, String mode, Properties parms)
+ throws SvcLogicException {
+
+ LOG.debug("Parameters passed to SLI: " + StringHelper.propertiesToString(parms));
+ metricsLogger.info("Parameters passed to SLI: " + StringHelper.propertiesToString(parms));
+
+ Properties respProps = svcLogic.execute(module, rpc, version, mode, parms);
+
+ LOG.debug("Parameters returned by SLI: " + StringHelper.propertiesToString(respProps));
+ metricsLogger.info("Parameters returned by SLI: " + StringHelper.propertiesToString(respProps));
+
+ // No impact on flow. Not sure why it is here
+ // if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) { return (respProps); }
+
+ return respProps;
+ }
+}
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
new file mode 100644
index 000000000..5fe174e55
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderLcm.java
@@ -0,0 +1,828 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed 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,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.provider;
+
+import java.text.ParseException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+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.rev160108.Action;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.AppcProviderLcmService;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.AuditInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.AuditOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.AuditOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.CheckLockInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.CheckLockOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.CheckLockOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.EvacuateInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.EvacuateOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.EvacuateOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.HealthCheckInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.HealthCheckOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.HealthCheckOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.LiveUpgradeInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.LiveUpgradeOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.LiveUpgradeOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.LockInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.LockOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.LockOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.MigrateInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.MigrateOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.MigrateOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.ModifyConfigInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.ModifyConfigOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.ModifyConfigOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.RebuildInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.RebuildOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.RebuildOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.RestartInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.RestartOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.RestartOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.RollbackInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.RollbackOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.RollbackOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.SnapshotInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.SnapshotOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.SnapshotOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.SoftwareUploadInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.SoftwareUploadOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.SoftwareUploadOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.StopInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.StopOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.StopOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.SyncInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.SyncOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.SyncOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.TerminateInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.TerminateOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.TerminateOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.TestInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.TestOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.TestOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.UnlockInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.UnlockOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.UnlockOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.status.Status;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.status.StatusBuilder;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+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.ResponseContext;
+import org.openecomp.appc.domainmodel.lcm.RuntimeContext;
+import org.openecomp.appc.executor.objects.LCMCommandStatus;
+import org.openecomp.appc.executor.objects.Params;
+import org.openecomp.appc.i18n.Msg;
+import org.openecomp.appc.logging.LoggingConstants;
+import org.openecomp.appc.logging.LoggingUtils;
+import org.openecomp.appc.provider.lcm.util.RequestInputBuilder;
+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.ServiceReference;
+
+import com.google.common.util.concurrent.Futures;
+import org.slf4j.MDC;
+
+
+public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
+
+ private Configuration configuration = ConfigurationFactory.getConfiguration();
+ private final EELFLogger logger = EELFManager.getInstance().getLogger(AppcProviderLcm.class);
+
+ private final ExecutorService executor;
+
+ private final String COMMON_ERROR_MESSAGE_TEMPLATE = "Error processing %s input : %s";
+
+ /**
+ * The ODL data store broker. Provides access to a conceptual data tree store and also provides the ability to
+ * subscribe for changes to data under a given branch of the tree.
+ */
+ protected DataBroker dataBroker;
+
+ /**
+ * ODL Notification Service that provides publish/subscribe capabilities for YANG modeled notifications.
+ */
+ protected NotificationProviderService notificationService;
+
+ /**
+ * Provides a registry for Remote Procedure Call (RPC) service implementations. The RPCs are defined in YANG models.
+ */
+ protected RpcProviderRegistry rpcRegistry;
+
+ /**
+ * Represents our RPC implementation registration
+ */
+ protected BindingAwareBroker.RpcRegistration<AppcProviderLcmService> rpcRegistration;
+
+
+ /**
+ * @param dataBroker
+ * @param notificationProviderService
+ * @param rpcProviderRegistry
+ */
+ @SuppressWarnings({
+ "javadoc", "nls"
+ })
+ public AppcProviderLcm(DataBroker dataBroker, NotificationProviderService notificationProviderService,
+ RpcProviderRegistry rpcProviderRegistry) {
+
+ String appName = configuration.getProperty(Constants.PROPERTY_APPLICATION_NAME);
+ logger.info(Msg.COMPONENT_INITIALIZING, appName, "provider");
+
+ executor = Executors.newFixedThreadPool(1);
+ this.dataBroker = dataBroker;
+ this.notificationService = notificationProviderService;
+ this.rpcRegistry = rpcProviderRegistry;
+
+ if (this.rpcRegistry != null) {
+ rpcRegistration = rpcRegistry.addRpcImplementation(AppcProviderLcmService.class, this);
+ }
+
+ logger.info(Msg.COMPONENT_INITIALIZED, appName, "provider");
+ }
+
+ /**
+ * Implements the close of the service
+ *
+ * @see java.lang.AutoCloseable#close()
+ */
+ @SuppressWarnings("nls")
+ @Override
+ public void close() throws Exception {
+ String appName = configuration.getProperty(Constants.PROPERTY_APPLICATION_NAME);
+ logger.info(Msg.COMPONENT_TERMINATING, appName, "provider");
+ executor.shutdown();
+ if (rpcRegistration != null) {
+ rpcRegistration.close();
+ }
+ logger.info(Msg.COMPONENT_TERMINATED, appName, "provider");
+ }
+
+
+ /**
+ * Rebuilds a specific VNF
+ *
+ * @see org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.AppcProviderLcmService#rebuild(RebuildInput)
+ */
+ @Override
+ public Future<RpcResult<RebuildOutput>> rebuild(RebuildInput input) {
+ logger.debug("Input received : " + input.toString());
+
+ 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);
+ if(null == status) {
+ try {
+ 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()));
+ } catch (ParseException e) {
+ status = buildParsingErrorStatus(e);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<RebuildOutput> result = RpcResultBuilder.<RebuildOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+
+ }
+
+
+ /**
+ * Restarts a specific VNF
+ *
+ * @see org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.AppcProviderLcmService#restart(RestartInput)
+ */
+ @Override
+ public Future<RpcResult<RestartOutput>> restart(RestartInput input) {
+ logger.debug("Input received : " + input.toString());
+
+ 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);
+ if(null == status) {
+ try {
+ 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()));
+ } catch (ParseException e) {
+ status = buildParsingErrorStatus(e);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<RestartOutput> result = RpcResultBuilder.<RestartOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+
+
+ /**
+ * Migrates a specific VNF
+ *
+ * @see org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.AppcProviderLcmService#migrate(MigrateInput)
+ */
+ @Override
+ public Future<RpcResult<MigrateOutput>> migrate(MigrateInput input) {
+ logger.debug("Input received : " + input.toString());
+
+ 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);
+ if(null == status) {
+ try {
+ 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()));
+ } catch (ParseException e) {
+ status = buildParsingErrorStatus(e);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<MigrateOutput> result = RpcResultBuilder.<MigrateOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+
+
+ /**
+ * Evacuates a specific VNF
+ *
+ * @see org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.AppcProviderLcmService#evacuate(EvacuateInput)
+ */
+ @Override
+ public Future<RpcResult<EvacuateOutput>> evacuate(EvacuateInput input) {
+ logger.debug("Input received : " + input.toString());
+
+ EvacuateOutputBuilder outputBuilder = new EvacuateOutputBuilder();
+ String action = Action.Evacuate.toString() ;
+ String rpcName = Action.Evacuate.name().toLowerCase();
+ 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();
+ status = buildStatusWithDispatcherOutput(executeRequest(request));
+ 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);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<EvacuateOutput> result = RpcResultBuilder.<EvacuateOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+
+
+ /**
+ * Evacuates a specific VNF
+ *
+ * @see org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.AppcProviderLcmService#snapshot(SnapshotInput)
+ */
+ @Override
+ public Future<RpcResult<SnapshotOutput>> snapshot(SnapshotInput input) {
+ logger.debug("Input received : " + input.toString());
+
+ 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);
+ 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();
+ status = buildStatusWithDispatcherOutput(executeRequest(request));
+ 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);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<SnapshotOutput> result = RpcResultBuilder.<SnapshotOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+
+ @Override
+ public Future<RpcResult<RollbackOutput>> rollback(RollbackInput input) {
+ logger.debug("Input received : " + input.toString());
+
+ RollbackOutputBuilder outputBuilder = new RollbackOutputBuilder();
+ String rpcName = Action.Rollback.toString() ;
+ 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();
+ status = buildStatusWithDispatcherOutput(executeRequest(request));
+ 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);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, rpcName, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<RollbackOutput> result = RpcResultBuilder.<RollbackOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+
+ @Override
+ public Future<RpcResult<SyncOutput>> sync(SyncInput input) {
+ logger.debug("Input received : " + input.toString());
+ 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);
+ if(null == status) {
+ try {
+ RequestHandlerInput request = new RequestInputBuilder().requestContext().commonHeader(input.getCommonHeader()).actionIdentifiers(input.getActionIdentifiers()).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()));
+ } catch (ParseException e) {
+ status = buildParsingErrorStatus(e);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<SyncOutput> result = RpcResultBuilder.<SyncOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+
+ private Status buildParsingErrorStatus(ParseException e){
+ LCMCommandStatus requestParsingFailure = LCMCommandStatus.REQUEST_PARSING_FAILED;
+ String errorMessage = e.getMessage() != null ? e.getMessage() : e.toString();
+ Params params = new Params().addParam("errorMsg", errorMessage);
+ return buildStatus(requestParsingFailure.getResponseCode(), requestParsingFailure.getFormattedMessage(params));
+ }
+
+ private Status buildStatus(Integer code,String message){
+ StatusBuilder status = new StatusBuilder();
+ status.setCode(code);
+ status.setMessage(message);
+ return status.build();
+ }
+
+ private Status buildStatusWithDispatcherOutput(RequestHandlerOutput requestHandlerOutput){
+ Integer statusCode = requestHandlerOutput.getResponseContext().getStatus().getCode();
+ String statusMessage = requestHandlerOutput.getResponseContext().getStatus().getMessage();
+ return buildStatus(statusCode, statusMessage);
+ }
+
+ private RequestHandlerOutput executeRequest(RequestHandlerInput request){
+
+ RequestHandler handler = getRequestHandler();
+ RequestHandlerOutput requestHandlerOutput=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());
+
+
+ final ResponseContext responseContext = new ResponseContext();
+ requestHandlerOutput = new RequestHandlerOutput();
+ requestHandlerOutput.setResponseContext(responseContext);
+ responseContext.setCommonHeader(request.getRequestContext().getCommonHeader());
+ final org.openecomp.appc.domainmodel.lcm.Status status = new org.openecomp.appc.domainmodel.lcm.Status();
+
+ responseContext.setStatus(status);
+
+ String errorMessage = e.getMessage() != null ? e.getMessage() : e.toString();
+ Params params = new Params().addParam("errorMsg", errorMessage);
+ status.setCode(LCMCommandStatus.UNEXPECTED_ERROR.getResponseCode());
+ status.setMessage(LCMCommandStatus.UNEXPECTED_ERROR.getFormattedMessage(params));
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ reason,
+ this.getClass().getName());
+
+
+ }
+ return requestHandlerOutput;
+ }
+
+ private RequestHandler getRequestHandler(){
+ RequestHandler handler ;
+ final BundleContext context = FrameworkUtil.getBundle(RequestHandler.class).getBundleContext();
+ final ServiceReference reference = context.getServiceReference(RequestHandler.class.getName());
+
+ if (reference != null) {
+ handler = (RequestHandler) context.getService(reference);
+ } else {
+ logger.error("Cannot find service reference for " + RequestHandler.class.getName());
+ throw new RuntimeException();
+ }
+ return handler ;
+ }
+
+
+ @Override
+ public Future<RpcResult<TerminateOutput>> terminate(TerminateInput input) {
+ logger.debug("Input received : " + input.toString());
+ 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);
+ if(null == status) {
+ try {
+ 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()));
+ } catch (ParseException e) {
+
+ status = buildParsingErrorStatus(e);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<TerminateOutput> result = RpcResultBuilder.<TerminateOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+
+
+
+ @Override
+ public Future<RpcResult<ModifyConfigOutput>> modifyConfig(ModifyConfigInput input) {
+ logger.debug("Input received : " + input.toString());
+ ModifyConfigOutputBuilder outputBuilder = new ModifyConfigOutputBuilder();
+ String action = Action.ModifyConfig.toString() ;
+ String rpcName = "modify-config";
+ 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();
+ status = buildStatusWithDispatcherOutput(executeRequest(request));
+ 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);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<ModifyConfigOutput> result = RpcResultBuilder.<ModifyConfigOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+
+ @Override
+ public Future<RpcResult<TestOutput>> test(TestInput input) {
+ logger.debug("Input received : " + input.toString());
+ TestOutputBuilder outputBuilder = new TestOutputBuilder();
+ String action = Action.Test.toString() ;
+ String rpcName = Action.Test.name().toLowerCase();
+ 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();
+ status = buildStatusWithDispatcherOutput(executeRequest(request));
+ 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);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<TestOutput> result = RpcResultBuilder.<TestOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+
+
+ @Override
+ public Future<RpcResult<StopOutput>> stop(StopInput input) {
+ logger.debug("Input received : " + input.toString());
+ StopOutputBuilder outputBuilder = new StopOutputBuilder();
+ String action = Action.Stop.toString() ;
+ String rpcName = Action.Stop.name().toLowerCase();
+ 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();
+ status = buildStatusWithDispatcherOutput(executeRequest(request));
+ 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);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<StopOutput> result = RpcResultBuilder.<StopOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+
+ @Override
+ public Future<RpcResult<AuditOutput>> audit(AuditInput input) {
+ logger.debug("Input received : " + input.toString());
+ AuditOutputBuilder outputBuilder = new AuditOutputBuilder();
+ String action = Action.Audit.toString();
+ String rpcName = Action.Audit.name().toLowerCase();
+ 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()).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()));
+ } catch (ParseException e) {
+ status = buildParsingErrorStatus(e);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<AuditOutput> result = RpcResultBuilder.<AuditOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+
+ @Override
+ public Future<RpcResult<SoftwareUploadOutput>> softwareUpload(SoftwareUploadInput input) {
+ logger.debug("Input received : " + input.toString());
+ SoftwareUploadOutputBuilder outputBuilder = new SoftwareUploadOutputBuilder();
+ String action = Action.SoftwareUpload.toString() ;
+ String rpcName = convertActionNameToUrl(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();
+ status = buildStatusWithDispatcherOutput(executeRequest(request));
+ 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);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<SoftwareUploadOutput> result = RpcResultBuilder.<SoftwareUploadOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+
+ @Override
+ public Future<RpcResult<HealthCheckOutput>> healthCheck(HealthCheckInput input) {
+ logger.debug("Input received : " + input.toString());
+ HealthCheckOutputBuilder outputBuilder = new HealthCheckOutputBuilder();
+ String action = Action.HealthCheck.toString() ;
+ String rpcName = convertActionNameToUrl(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();
+ status = buildStatusWithDispatcherOutput(executeRequest(request));
+ 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);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<HealthCheckOutput> result = RpcResultBuilder.<HealthCheckOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+
+ @Override
+ public Future<RpcResult<LiveUpgradeOutput>> liveUpgrade(LiveUpgradeInput input) {
+ logger.debug("Input received : " + input.toString());
+ LiveUpgradeOutputBuilder outputBuilder = new LiveUpgradeOutputBuilder();
+ String action = Action.LiveUpgrade.toString() ;
+ String rpcName = convertActionNameToUrl(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();
+ status = buildStatusWithDispatcherOutput(executeRequest(request));
+ 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);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<LiveUpgradeOutput> result = RpcResultBuilder.<LiveUpgradeOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+
+
+ @Override
+ public Future<RpcResult<LockOutput>> lock(LockInput input) {
+ logger.debug("Input received : " + input.toString());
+ LockOutputBuilder outputBuilder = new LockOutputBuilder();
+ String action = Action.Lock.toString() ;
+ String rpcName = Action.Lock.name().toLowerCase();
+ 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();
+ status = buildStatusWithDispatcherOutput(executeRequest(request));
+ 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);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<LockOutput> result = RpcResultBuilder.<LockOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+
+
+ @Override
+ public Future<RpcResult<UnlockOutput>> unlock(UnlockInput input) {
+ logger.debug("Input received : " + input.toString());
+ UnlockOutputBuilder outputBuilder = new UnlockOutputBuilder();
+ String action = Action.Unlock.toString() ;
+ String rpcName = Action.Unlock.name().toLowerCase();
+ 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();
+ status = buildStatusWithDispatcherOutput(executeRequest(request));
+ 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);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<UnlockOutput> result = RpcResultBuilder.<UnlockOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+
+ @Override
+ public Future<RpcResult<CheckLockOutput>> checkLock(CheckLockInput input) {
+ logger.debug("Input received : " + input.toString());
+ CheckLockOutputBuilder outputBuilder = new CheckLockOutputBuilder();
+ String action = Action.CheckLock.toString() ;
+ String rpcName = Action.CheckLock.name().toLowerCase();
+ RequestHandlerOutput requestHandlerOutput=null;
+ 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()).action(action).rpcName(rpcName).build();
+ requestHandlerOutput=executeRequest(request);
+
+ status = buildStatusWithDispatcherOutput(requestHandlerOutput);
+ 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);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ if(requestHandlerOutput.getResponseContext().getStatus().getCode() == 400) {
+ outputBuilder.setLocked(CheckLockOutput.Locked.valueOf(requestHandlerOutput.getResponseContext().getAdditionalContext().get("locked").toUpperCase()));
+ }
+ RpcResult<CheckLockOutput> result = RpcResultBuilder.<CheckLockOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+
+ private String convertActionNameToUrl(String action) {
+ String regex = "([a-z])([A-Z]+)";
+ String replacement = "$1-$2";
+ return action.replaceAll(regex, replacement)
+ .toLowerCase();
+ }
+
+
+}
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/ResponseHeaderBuilder.java b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/ResponseHeaderBuilder.java
new file mode 100644
index 000000000..ea03074bd
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/ResponseHeaderBuilder.java
@@ -0,0 +1,88 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed 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,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.provider;
+
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.TIMESTAMP;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.common.response.header.CommonResponseHeader;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.common.response.header.CommonResponseHeaderBuilder;
+import org.openecomp.appc.util.Time;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+
+
+/**
+ * Builds the responses from the APP-C services according to the YANG domainmodel
+ *
+ * @since Nov 16, 2015
+ * @version $Id$
+ */
+public class ResponseHeaderBuilder {
+
+ /**
+ * The date/time formatter to format timestamps.
+ */
+ @SuppressWarnings("nls")
+ public static final DateFormat FORMATTER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSSSS");
+ public static final DateFormat ZULU_FORMATTER = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS'Z'");
+
+ /**
+ * Private default constructor prevents instantiation
+ */
+ private ResponseHeaderBuilder() {
+ }
+
+ /**
+ * This method builds the common response header and returns it to the caller for integration into the response
+ *
+ * @param success
+ * True or false indicating the outcome of the operation. True indicates that the operation was
+ * successful, false indicates it failed.
+ * @param requestId
+ * The original request id for the service
+ * @param reason
+ * The reason for the failure if the success flag is false. If success is true, the reason is not used.
+ * @param duration
+ * The duration of the request processing
+ * @return The common response header to be returned to the caller.
+ */
+ @SuppressWarnings("nls")
+ public static CommonResponseHeader buildHeader(Boolean success, String requestId, String reason, long duration) {
+ CommonResponseHeaderBuilder builder = new CommonResponseHeaderBuilder();
+
+ TIMESTAMP timestamp = new TIMESTAMP(FORMATTER.format(Time.utcDate()));
+ builder.setServiceRequestId(requestId);
+ builder.setCompleted(timestamp);
+ builder.setDuration(duration);
+ builder.setSuccess(success);
+
+ if (success.equals(Boolean.TRUE)) {
+ builder.setReason("Success");
+ } else {
+ builder.setReason(reason);
+ }
+
+ return builder.build();
+ }
+
+
+}
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/LCMConstants.java b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/LCMConstants.java
new file mode 100644
index 000000000..bcb55bc75
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/LCMConstants.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed 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,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.provider.lcm.util;
+
+public final class LCMConstants {
+ private LCMConstants() {
+ }
+
+ public static final String CODE = "Status";
+ public static final String VALUE = "Value";
+ //flags
+ public static final String FORCE = "FORCE";
+ public static final String MODE = "MODE";
+ public static final String TTL = "TTL";
+
+}
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/RequestInputBuilder.java b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/RequestInputBuilder.java
new file mode 100644
index 000000000..7af5f073d
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/RequestInputBuilder.java
@@ -0,0 +1,141 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed 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,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.provider.lcm.util;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.Payload;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.action.identifiers.ActionIdentifiers;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.common.header.CommonHeader;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.common.header.common.header.Flags;
+import org.openecomp.appc.domainmodel.lcm.RequestContext;
+import org.openecomp.appc.domainmodel.lcm.VNFOperation;
+import org.openecomp.appc.requesthandler.objects.RequestHandlerInput;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+
+
+public class RequestInputBuilder {
+ private static EELFLogger logger = EELFManager.getInstance().getApplicationLogger();
+
+ private static final String FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
+
+ private RequestContext requestContext;
+ private String rpcName;
+
+ public RequestInputBuilder() {
+ }
+
+
+ public RequestInputBuilder requestContext() {
+ this.requestContext = new RequestContext();
+ return this;
+ }
+
+ public RequestInputBuilder action(String action) {
+ this.requestContext.setAction(VNFOperation.findByString(action));
+ return this;
+ }
+
+
+ public RequestInputBuilder additionalContext(String key, String value) {
+ this.requestContext.addKeyValueToAdditionalContext(key, value);
+ return this;
+ }
+
+ public RequestInputBuilder payload(Payload payload) {
+ if (payload != null) {
+ this.requestContext.setPayload(payload.getValue());
+ }
+ return this;
+ }
+
+ public RequestHandlerInput build (){
+ RequestHandlerInput request = new RequestHandlerInput();
+ request.setRequestContext(this.requestContext);
+ request.setRpcName(rpcName);
+ return request;
+ }
+
+ public RequestInputBuilder rpcName(String rpcName) {
+ this.rpcName = rpcName;
+ return this;
+ }
+
+ public RequestInputBuilder commonHeader(CommonHeader commonHeader) throws ParseException {
+ org.openecomp.appc.domainmodel.lcm.CommonHeader header = new org.openecomp.appc.domainmodel.lcm.CommonHeader();
+ this.requestContext.setCommonHeader(header);
+
+ try {
+ if(null != commonHeader.getTimestamp()) {
+ SimpleDateFormat format = new SimpleDateFormat(FORMAT);
+ format.setLenient(false);
+ header.setTimestamp(format.parse(commonHeader.getTimestamp().getValue()));
+ }else{
+ throw new ParseException("Missing mandatory parameter : timestamp " , 0);
+ }
+ } catch (ParseException e) {
+ logger.error(String.format("DATE format is incorrect: %s", e.getMessage()));
+ throw e;
+ }
+ header.setApiVer(commonHeader.getApiVer());
+ header.setRequestId(commonHeader.getRequestId());
+ header.setOriginatorId(commonHeader.getOriginatorId());
+ header.setSubRequestId(commonHeader.getSubRequestId());
+
+ Flags inFlags = commonHeader.getFlags();
+ org.openecomp.appc.domainmodel.lcm.Flags flags = new org.openecomp.appc.domainmodel.lcm.Flags();
+ if (inFlags != null) {
+
+ if(null != inFlags.getForce()) {
+ flags.setForce(Boolean.parseBoolean(inFlags.getForce().toString().toLowerCase()));
+ }
+ if(null!=inFlags.getMode()) {
+ flags.setMode(inFlags.getMode().name());
+ }
+ if(null!= inFlags.getTtl()) {
+ flags.setTtl(inFlags.getTtl());
+ }
+
+ }
+ this.requestContext.getCommonHeader().setFlags(flags);
+ return this;
+ }
+
+ public RequestInputBuilder actionIdentifiers(ActionIdentifiers actionIdentifiers) throws ParseException {
+ if(null!= actionIdentifiers) {
+ org.openecomp.appc.domainmodel.lcm.ActionIdentifiers actionIds = new org.openecomp.appc.domainmodel.lcm.ActionIdentifiers();
+ actionIds.setServiceInstanceId(actionIdentifiers.getServiceInstanceId());
+ actionIds.setVnfcName(actionIdentifiers.getVnfcName());
+ actionIds.setvServerId(actionIdentifiers.getVserverId());
+ actionIds.setVnfId(actionIdentifiers.getVnfId());
+ this.requestContext.setActionIdentifiers(actionIds);
+ return this;
+ }else{
+ throw new ParseException("Missing action identifier" , 0);
+ }
+ }
+
+
+}
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/ValidationService.java b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/ValidationService.java
new file mode 100644
index 000000000..fe2fdc142
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/ValidationService.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed 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,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.provider.lcm.util;
+
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.Action;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.common.header.CommonHeader;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.status.Status;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.status.StatusBuilder;
+import org.openecomp.appc.Constants;
+import org.openecomp.appc.configuration.Configuration;
+import org.openecomp.appc.configuration.ConfigurationFactory;
+import org.openecomp.appc.executor.objects.LCMCommandStatus;
+import org.openecomp.appc.executor.objects.Params;
+import org.openecomp.appc.i18n.Msg;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.att.eelf.i18n.EELFResourceManager;
+
+import javax.swing.*;
+
+
+
+public class ValidationService {
+
+ private static class ValidationServiceHolder {
+ private static final ValidationService INSTANCE = new ValidationService();
+ }
+
+ private final EELFLogger logger = EELFManager.getInstance().getLogger(ValidationService.class);
+
+ private Configuration configuration = ConfigurationFactory.getConfiguration();
+
+ public static ValidationService getInstance(){
+ return ValidationServiceHolder.INSTANCE;
+ }
+
+ public Status validateInput (CommonHeader commonHeader, Action action , String rpcName) {
+ String appName = configuration.getProperty(Constants.PROPERTY_APPLICATION_NAME);
+ String reason ;
+ StringBuilder paramName = new StringBuilder("");
+ if (!isEmpty(commonHeader) && !isEmpty(commonHeader.getApiVer())&& !isEmpty(commonHeader.getTimestamp()) && !isEmpty(commonHeader.getRequestId()) && !isEmpty(action) && !isEmpty(commonHeader.getOriginatorId())){
+ if(!action.toString().equalsIgnoreCase(rpcName)) logger.warn("action in input request '" + action.toString() + "' is different from endpoint '" + rpcName + "'");
+ return null;
+ } else{
+ if(isEmpty(commonHeader)){
+ paramName.append("common-header");
+ }else{
+ if (isEmpty(commonHeader.getApiVer())) paramName.append("api-ver");
+ if (isEmpty(commonHeader.getTimestamp())) paramName.append(isEmpty(paramName) ? "timestamp" : " , timestamp" );
+ if (isEmpty(commonHeader.getRequestId())) paramName.append(isEmpty(paramName) ? "request-id" : " , request-id" );
+ if (isEmpty(commonHeader.getOriginatorId())) paramName.append(isEmpty(paramName) ? "originator-id" : " , originator-id" );
+ }
+ if (isEmpty(action)) paramName.append(isEmpty(paramName) ? "action" : " , action" );
+ }
+
+
+
+ reason = EELFResourceManager.format(Msg.NULL_OR_INVALID_ARGUMENT, appName, rpcName, paramName.toString() , "");
+ logger.info("Mandatory parameter/s" + paramName.toString() + " is/are missing");
+ logger.error(reason);
+ LCMCommandStatus lcmCommandStatus = LCMCommandStatus.MISSING_MANDATORY_PARAMETER;
+ Params params = new Params().addParam("paramName", paramName.toString());
+ StatusBuilder status = new StatusBuilder();
+ status.setCode(lcmCommandStatus.getResponseCode());
+ status.setMessage(lcmCommandStatus.getFormattedMessage(params));
+ return status.build();
+ }
+
+ private boolean isEmpty (Object object){
+ return (null == object || "".equalsIgnoreCase(object.toString()));
+ }
+}
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/topology/TopologyService.java b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/topology/TopologyService.java
new file mode 100644
index 000000000..ea88982c1
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/topology/TopologyService.java
@@ -0,0 +1,718 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed 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,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.provider.topology;
+
+import static com.att.eelf.configuration.Configuration.MDC_ALERT_SEVERITY;
+import static com.att.eelf.configuration.Configuration.MDC_INSTANCE_UUID;
+import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
+import static com.att.eelf.configuration.Configuration.MDC_REMOTE_HOST;
+import static com.att.eelf.configuration.Configuration.MDC_SERVER_FQDN;
+import static com.att.eelf.configuration.Configuration.MDC_SERVER_IP_ADDRESS;
+import static com.att.eelf.configuration.Configuration.MDC_SERVICE_INSTANCE_ID;
+import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;
+
+import java.net.InetAddress;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Properties;
+import java.util.TimeZone;
+
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.MigrateOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.ModifyConfigOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.ModifyConfigOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.MigrateOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.RebuildOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.RebuildOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.RestartOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.RestartOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.SnapshotOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.SnapshotOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.UUID;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.common.request.header.CommonRequestHeader;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.vnf.resource.VnfResource;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160104.config.payload.ConfigPayload;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+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.i18n.Msg;
+import org.openecomp.appc.provider.AppcProvider;
+import org.openecomp.appc.provider.AppcProviderClient;
+import org.openecomp.appc.provider.ResponseHeaderBuilder;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.att.eelf.i18n.EELFResourceManager;
+import org.slf4j.MDC;
+
+/**
+ * This class is used to implement the topology services API and invoke the appropriate directed graphs based on the
+ * service being requested.
+ *
+ */
+public class TopologyService {
+
+ /**
+ * The loggers we are using
+ */
+ // private static EELFLogger logger = LoggerFactory.getLogger(TopologyService.class);
+ private static EELFLogger logger = EELFManager.getInstance().getApplicationLogger();
+ private static EELFLogger securityLogger = EELFManager.getInstance().getSecurityLogger();
+ private static EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
+ private static EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
+ private static EELFLogger performanceLogger = EELFManager.getInstance().getPerformanceLogger();
+
+ /**
+ * The provider we are servicing
+ */
+ private AppcProvider provider;
+
+ /**
+ * The reason associated with the last DG call
+ */
+ private String reason;
+
+ /**
+ * The APPC configuration properties
+ */
+ private Configuration configuration = ConfigurationFactory.getConfiguration();
+
+ /**
+ * Create the topology services implementation for the specific appc provider (api) implementation
+ *
+ * @param provider
+ * The provider we are servicing
+ */
+ public TopologyService(AppcProvider provider) {
+ this.provider = provider;
+ }
+
+ // /**
+ // * Processes the topology request
+ // *
+ // * @param input
+ // * The request to be processed
+ // * @return The result of processing
+ // */
+ // public RpcResult<TopologyOperationOutput> process(TopologyOperationInput input) {
+ // RpcResult<TopologyOperationOutput> response;
+ //
+ // String appName = configuration.getProperty(Constants.PROPERTY_APPLICATION_NAME);
+ // logger.info(String.format("%s:topology operations called...", appName));
+ //
+ // /*
+ // * Properties used to pass information to the DG
+ // */
+ // Properties properties = new Properties();
+ //
+ // if (input == null || input.getTopologyRequest().getVmId() == null) {
+ // String msg =
+ // String.format("%s: topology operation failed, invalid input. Null or empty argument '%s'", appName,
+ // "vm_id");
+ // logger.debug(msg);
+ // response = generateTopologyOperationResponse(Boolean.FALSE, "UNKNOWN", msg, "UNDEFINED");
+ // } else {
+ // // CommonRequestHeader crh = input.getCommonRequestHeader();
+ // TopologyHeader hdr = input.getTopologyHeader();
+ // TopologyRequest req = input.getTopologyRequest();
+ //
+ // // String requestId = crh.getServiceRequestId();
+ // String requestId = hdr.getSvcRequestId();
+ // properties.put(Constants.CONTEXT_REQID, requestId);
+ //
+ // String infomsg = String.format("Topology request '%s' (%s) received.", requestId, hdr.getSvcAction());
+ //
+ // // switch (req.getSvcAction()) {
+ // switch (hdr.getSvcAction()) {
+ // case Restart:
+ // properties.put(Constants.CONTEXT_SERVICE, Constants.SERVICE_RESTART);
+ // response = restart(input, properties);
+ // logger.info(infomsg);
+ // break;
+ //
+ // case Rebuild:
+ // properties.put(Constants.CONTEXT_SERVICE, Constants.SERVICE_REBUILD);
+ // response = rebuild(input, properties);
+ // logger.info(infomsg);
+ // break;
+ //
+ // default:
+ // String msg = String.format("Invalid request type [%s] for request id [%s]", req, requestId);
+ // response = generateTopologyOperationResponse(Boolean.FALSE, requestId, msg, "N/A");
+ // }
+ // }
+ //
+ // return response;
+ // }
+
+ /**
+ * Restart a VM
+ *
+ * @param hdr
+ * The common request header
+ * @param vnf
+ * The identification of the VNF resource to be operated upon
+ * @return The rpc result of the restart operation
+ */
+ public RpcResult<ModifyConfigOutput> modifyConfig(CommonRequestHeader hdr, ConfigPayload data) {
+ long startTime = System.currentTimeMillis();
+ TimeZone tz = TimeZone.getTimeZone("UTC");
+ DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
+ df.setTimeZone(tz);
+ // String startTimeStr = String.valueOf(startTime);
+ String startTimeStr = df.format(new Date());
+ String requestId = hdr.getServiceRequestId();
+
+ //MDC.clear();
+ MDC.put(MDC_REMOTE_HOST, "");
+ MDC.put(MDC_KEY_REQUEST_ID, requestId);
+ MDC.put(MDC_SERVICE_NAME, "App-C Provider:Restart");
+ MDC.put(MDC_SERVICE_INSTANCE_ID, "");
+ try {
+ MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName());
+ MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ MDC.put(MDC_INSTANCE_UUID, java.util.UUID.randomUUID().toString());
+ MDC.put(MDC_ALERT_SEVERITY, "0");
+ MDC.put("startTime", Long.toString(startTime));
+ MDC.put("target", "appc");
+ logger.info(String.format("Starting RESTART for request with id [%s]", requestId));
+ metricsLogger.info(String.format("Metrics Logger: App-C Restart initiated. Start Time: [%s]. Request ID: [%s]",
+ startTime, requestId));
+
+ /*
+ * Copy any needed inputs or other values into the properties to be passed to the DG model
+ */
+ //UUID vmId = vnf.getVmId();
+ Properties properties = new Properties();
+ properties.put(Constants.CONTEXT_ACTION, "modifyConfig");
+ properties.put(Constants.CONTEXT_REQID, requestId);
+ //properties.put(Constants.CONTEXT_VMID, vmId.getValue());
+ String url = configuration.getProperty("appc.provider.vfodl.url");
+ try{
+ if(url.contains("NODE_NAME")){
+ url = url.replace("NODE_NAME", data.getConfigUrl());
+ }
+ }catch(Exception e){
+ url = configuration.getProperty("appc.provider.vfodl.url");
+ }
+ logger.trace("Final URL to VF ODL: "+url);
+ properties.put("org.openecomp.appc.configURL", url);
+ properties.put("org.openecomp.appc.configJson", data.getConfigJson());
+
+ //UUID identityUrl = vnf.getIdentityUrl();
+ //if (identityUrl != null) {
+ // properties.put(Constants.CONTEXT_IDENTITY_URL, identityUrl.getValue());
+ //}
+ /*
+ * Attempt to call the DG with the appropriate properties
+ */
+ boolean success = callGraph(properties);
+
+
+ MDC.put("target", "appc");
+ String statusStr = success ? "SUCCESS" : "FAILURE";
+ String infomsg =
+ String.format("APPC0119I ModifyConfig '%s' finished with status %s. Reason: %s", requestId, statusStr, reason);
+ logger.info(infomsg);
+
+ ModifyConfigOutputBuilder rob = new ModifyConfigOutputBuilder();
+ long endTime = System.currentTimeMillis();
+ long duration = endTime - startTime;
+ String endTimeStr = String.valueOf(endTime);
+ String durationStr = String.valueOf(duration);
+ MDC.put("endTime", endTimeStr);
+ MDC.put("duration", durationStr);
+ rob.setCommonResponseHeader(ResponseHeaderBuilder.buildHeader(success, requestId, reason, duration));
+ //rob.setVmId(new UUID(vmId));
+
+ auditLogger.info(String.format(
+ "Audit Logger: APPC0119I Restart '%s' finished with status %s. Start Time: [%s]. End Time: [%s]. Duration: [%s]. Request ID: [%s]. Reason:%s",
+ requestId, statusStr, startTime, endTime, duration, requestId, reason));
+ metricsLogger.info(String.format(
+ "Metrics Logger: APPC0119I Restart '%s' finished with status %s. Start Time: [%s]. End Time: [%s]. Duration: [%s]. Request ID: [%s]. Reason:%s",
+ requestId, statusStr, startTime, endTime, duration, requestId, reason));
+
+ // Status must be set to true to indicate that our return is expected
+ RpcResult<ModifyConfigOutput> rpcResult =
+ RpcResultBuilder.<ModifyConfigOutput> status(true).withResult(rob.build()).build();
+ return rpcResult;
+
+ }
+
+
+
+
+ /**
+ * Restart a VM
+ *
+ * @param hdr
+ * The common request header
+ * @param vnf
+ * The identification of the VNF resource to be operated upon
+ * @return The rpc result of the restart operation
+ */
+ public RpcResult<MigrateOutput> migrate(CommonRequestHeader hdr, VnfResource vnf) {
+ long startTime = System.currentTimeMillis();
+ TimeZone tz = TimeZone.getTimeZone("UTC");
+ DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
+ df.setTimeZone(tz);
+ // String startTimeStr = String.valueOf(startTime);
+ String startTimeStr = df.format(new Date());
+ String requestId = hdr.getServiceRequestId();
+
+ //MDC.clear();
+ MDC.put(MDC_REMOTE_HOST, "");
+ MDC.put(MDC_KEY_REQUEST_ID, requestId);
+ MDC.put(MDC_SERVICE_NAME, "App-C Provider:Migrate");
+ MDC.put(MDC_SERVICE_INSTANCE_ID, "");
+ try {
+ MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName());
+ MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ MDC.put(MDC_INSTANCE_UUID, java.util.UUID.randomUUID().toString());
+ MDC.put(MDC_ALERT_SEVERITY, "0");
+ MDC.put("startTime", startTimeStr);
+ MDC.put("target", "appc");
+ logger.info(String.format("Starting ANY for request with id [%s]", requestId));
+ metricsLogger.info(String.format("Metrics Logger: App-C Restart initiated. Start Time: [%s]. Request ID: [%s]",
+ startTime, requestId));
+
+ /*
+ * Copy any needed inputs or other values into the properties to be passed to the DG model
+ */
+ UUID vmId = vnf.getVmId();
+ Properties properties = new Properties();
+ properties.put(Constants.CONTEXT_ACTION, "migrate");
+ properties.put(Constants.CONTEXT_REQID, requestId);
+ properties.put(Constants.CONTEXT_VMID, vmId.getValue());
+
+ UUID identityUrl = vnf.getIdentityUrl();
+ if (identityUrl != null) {
+ properties.put(Constants.CONTEXT_IDENTITY_URL, identityUrl.getValue());
+ }
+
+ /*
+ * Attempt to call the DG with the appropriate properties
+ */
+ boolean success = callGraph(properties);
+
+ /*
+ * Generate the appropriate response
+ */
+ MDC.put("target", "appc");
+ String statusStr = success ? "SUCCESS" : "FAILURE";
+ String infomsg =
+ String.format("APPC0118I Migrate '%s' finished with status %s. Reason: %s", requestId, statusStr, reason);
+ logger.info(infomsg);
+
+ MigrateOutputBuilder mob = new MigrateOutputBuilder();
+
+ long endTime = System.currentTimeMillis();
+ long duration = endTime - startTime;
+ String endTimeStr = String.valueOf(endTime);
+ String durationStr = String.valueOf(duration);
+ MDC.put("endTime", endTimeStr);
+ MDC.put("duration", durationStr);
+ mob.setCommonResponseHeader(ResponseHeaderBuilder.buildHeader(success, requestId, reason, duration));
+ mob.setVmId(new UUID(vmId));
+
+ auditLogger.info(String.format(
+ "Audit Logger: APPC0118I Migrate '%s' finished with status %s. Start Time: [%s]. End Time: [%s]. Duration: [%s]. Request ID: [%s]. Reason:%s",
+ requestId, statusStr, startTime, endTime, duration, requestId, reason));
+ metricsLogger.info(String.format(
+ "Metrics Logger: APPC0118I Migrate '%s' finished with status %s. Start Time: [%s]. End Time: [%s]. Duration: [%s]. Request ID: [%s]. Reason:%s",
+ requestId, statusStr, startTime, endTime, duration, requestId, reason));
+
+ // Status must be set to true to indicate that our return is expected
+ RpcResult<MigrateOutput> rpcResult =
+ RpcResultBuilder.<MigrateOutput> status(true).withResult(mob.build()).build();
+ return rpcResult;
+ }
+
+ /**
+ * Restart a VM
+ *
+ * @param hdr
+ * The common request header
+ * @param vnf
+ * The identification of the VNF resource to be operated upon
+ * @return The rpc result of the restart operation
+ */
+ public RpcResult<RestartOutput> restart(CommonRequestHeader hdr, VnfResource vnf) {
+ long startTime = System.currentTimeMillis();
+ TimeZone tz = TimeZone.getTimeZone("UTC");
+ DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
+ df.setTimeZone(tz);
+ // String startTimeStr = String.valueOf(startTime);
+ String startTimeStr = df.format(new Date());
+ String requestId = hdr.getServiceRequestId();
+
+ //MDC.clear();
+ MDC.put(MDC_REMOTE_HOST, "");
+ MDC.put(MDC_KEY_REQUEST_ID, requestId);
+ MDC.put(MDC_SERVICE_NAME, "App-C Provider:Restart");
+ MDC.put(MDC_SERVICE_INSTANCE_ID, "");
+ try {
+ MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName());
+ MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ MDC.put(MDC_INSTANCE_UUID, java.util.UUID.randomUUID().toString());
+ MDC.put(MDC_ALERT_SEVERITY, "0");
+ MDC.put("startTime", Long.toString(startTime));
+ MDC.put("target", "appc");
+ logger.info(String.format("Starting RESTART for request with id [%s]", requestId));
+ metricsLogger.info(String.format("Metrics Logger: App-C Restart initiated. Start Time: [%s]. Request ID: [%s]",
+ startTime, requestId));
+
+ /*
+ * Copy any needed inputs or other values into the properties to be passed to the DG model
+ */
+ UUID vmId = vnf.getVmId();
+ Properties properties = new Properties();
+ properties.put(Constants.CONTEXT_ACTION, "restart");
+ properties.put(Constants.CONTEXT_REQID, requestId);
+ properties.put(Constants.CONTEXT_VMID, vmId.getValue());
+
+ UUID identityUrl = vnf.getIdentityUrl();
+ if (identityUrl != null) {
+ properties.put(Constants.CONTEXT_IDENTITY_URL, identityUrl.getValue());
+ }
+ /*
+ * Attempt to call the DG with the appropriate properties
+ */
+ boolean success = callGraph(properties);
+
+ /*
+ * Generate the appropriate response
+ */
+ MDC.put("target", "appc");
+ String statusStr = success ? "SUCCESS" : "FAILURE";
+ String infomsg =
+ String.format("APPC0119I Restart '%s' finished with status %s. Reason: %s", requestId, statusStr, reason);
+ logger.info(infomsg);
+
+ RestartOutputBuilder rob = new RestartOutputBuilder();
+ long endTime = System.currentTimeMillis();
+ long duration = endTime - startTime;
+ String endTimeStr = String.valueOf(endTime);
+ String durationStr = String.valueOf(duration);
+ MDC.put("endTime", endTimeStr);
+ MDC.put("duration", durationStr);
+ rob.setCommonResponseHeader(ResponseHeaderBuilder.buildHeader(success, requestId, reason, duration));
+ rob.setVmId(new UUID(vmId));
+
+ auditLogger.info(String.format(
+ "Audit Logger: APPC0119I Restart '%s' finished with status %s. Start Time: [%s]. End Time: [%s]. Duration: [%s]. Request ID: [%s]. Reason:%s",
+ requestId, statusStr, startTime, endTime, duration, requestId, reason));
+ metricsLogger.info(String.format(
+ "Metrics Logger: APPC0119I Restart '%s' finished with status %s. Start Time: [%s]. End Time: [%s]. Duration: [%s]. Request ID: [%s]. Reason:%s",
+ requestId, statusStr, startTime, endTime, duration, requestId, reason));
+
+ // Status must be set to true to indicate that our return is expected
+ RpcResult<RestartOutput> rpcResult =
+ RpcResultBuilder.<RestartOutput> status(true).withResult(rob.build()).build();
+ return rpcResult;
+ }
+
+ /**
+ * Rebuild a VM
+ *
+ * @param hdr
+ * The common request header
+ * @param vnf
+ * The identification of the VNF resource to be operated upon
+ * @return The rpc result of the rebuild operation
+ */
+ public RpcResult<RebuildOutput> rebuild(CommonRequestHeader hdr, VnfResource vnf) {
+ long startTime = System.currentTimeMillis();
+ TimeZone tz = TimeZone.getTimeZone("UTC");
+ DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
+ df.setTimeZone(tz);
+ // String startTimeStr = String.valueOf(startTime);
+ String startTimeStr = df.format(new Date());
+ String requestId = hdr.getServiceRequestId();
+
+ //MDC.clear();
+ MDC.put(MDC_REMOTE_HOST, "");
+ MDC.put(MDC_KEY_REQUEST_ID, requestId);
+ MDC.put(MDC_SERVICE_NAME, "App-C Provider:Rebuild");
+ MDC.put(MDC_SERVICE_INSTANCE_ID, "");
+ try {
+ MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName());
+ MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ MDC.put(MDC_INSTANCE_UUID, java.util.UUID.randomUUID().toString());
+ MDC.put(MDC_ALERT_SEVERITY, "0");
+ MDC.put("startTime", startTimeStr);
+ MDC.put("target", "appc");
+ logger.info(String.format("Starting REBUILD for request with id [%s]", requestId));
+ metricsLogger.info(String.format("Metrics Logger: App-C Restart initiated. Start Time: [%s]. Request ID: [%s]",
+ startTime, requestId));
+
+ /*
+ * Copy any needed inputs or other values into the properties to be passed to the DG model
+ */
+ UUID vmId = vnf.getVmId();
+ Properties properties = new Properties();
+ properties.put(Constants.CONTEXT_ACTION, "rebuild");
+ properties.put(Constants.CONTEXT_REQID, requestId);
+ properties.put(Constants.CONTEXT_VMID, vmId.getValue());
+
+ UUID identityUrl = vnf.getIdentityUrl();
+ if (identityUrl != null) {
+ properties.put(Constants.CONTEXT_IDENTITY_URL, identityUrl.getValue());
+ }
+
+ /*
+ * Attempt to call the DG with the appropriate properties
+ */
+ boolean success = callGraph(properties);
+
+ /*
+ * Generate the appropriate response
+ */
+ MDC.put("target", "appc");
+ String statusStr = success ? "SUCCESS" : "FAILURE";
+ String infomsg =
+ String.format("APPC0120I Rebuild '%s' finished with status %s. Reason: %s", requestId, statusStr, reason);
+ logger.info(infomsg);
+
+ RebuildOutputBuilder rob = new RebuildOutputBuilder();
+ long endTime = System.currentTimeMillis();
+ long duration = endTime - startTime;
+ String endTimeStr = String.valueOf(endTime);
+ String durationStr = String.valueOf(duration);
+ MDC.put("endTime", endTimeStr);
+ MDC.put("duration", durationStr);
+ rob.setCommonResponseHeader(ResponseHeaderBuilder.buildHeader(success, requestId, reason, duration));
+ rob.setOriginalVmId(new UUID(vmId));
+ rob.setNewVmId(new UUID(vmId));
+
+ auditLogger.info(String.format(
+ "Audit Logger: APPC0120I Rebuild '%s' finished with status %s. Start Time: [%s]. End Time: [%s]. Duration: [%s]. Request ID: [%s]. Reason:%s",
+ requestId, statusStr, startTime, endTime, duration, requestId, reason));
+ metricsLogger.info(String.format(
+ "Metrics Logger: APPC0120I Rebuild '%s' finished with status %s. Start Time: [%s]. End Time: [%s]. Duration: [%s]. Request ID: [%s]. Reason:%s",
+ requestId, statusStr, startTime, endTime, duration, requestId, reason));
+
+ // Status must be set to true to indicate that our return is expected
+ RpcResult<RebuildOutput> rpcResult =
+ RpcResultBuilder.<RebuildOutput> status(true).withResult(rob.build()).build();
+ return rpcResult;
+ }
+
+ /**
+ * Snapshot a VM
+ *
+ * @param hdr
+ * The common request header
+ * @param vnf
+ * The identification of the VNF resource to be operated upon
+ * @return The rpc result of the restart operation
+ */
+ public RpcResult<SnapshotOutput> snapshot(CommonRequestHeader hdr, VnfResource vnf) {
+ long startTime = System.currentTimeMillis();
+ TimeZone tz = TimeZone.getTimeZone("UTC");
+ DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
+ df.setTimeZone(tz);
+ // String startTimeStr = String.valueOf(startTime);
+ String startTimeStr = df.format(new Date());
+ String requestId = hdr.getServiceRequestId();
+
+ //MDC.clear();
+ MDC.put(MDC_REMOTE_HOST, "");
+ MDC.put(MDC_KEY_REQUEST_ID, requestId);
+ MDC.put(MDC_SERVICE_NAME, "App-C Provider:Snapshot");
+ MDC.put(MDC_SERVICE_INSTANCE_ID, "");
+ try {
+ MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName());
+ MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ MDC.put(MDC_INSTANCE_UUID, java.util.UUID.randomUUID().toString());
+ MDC.put(MDC_ALERT_SEVERITY, "0");
+ MDC.put("startTime", Long.toString(startTime));
+ MDC.put("target", "appc");
+ logger.info(String.format("Starting SNAPSHOT for request with id [%s]", requestId));
+ metricsLogger.info(String.format("Metrics Logger: App-C Snapshot initiated. Start Time: [%s]. Request ID: [%s]",
+ startTime, requestId));
+
+ /*
+ * Copy any needed inputs or other values into the properties to be passed to the DG model
+ */
+ UUID vmId = vnf.getVmId();
+ Properties properties = new Properties();
+ properties.put(Constants.CONTEXT_ACTION, "snapshot");
+ properties.put(Constants.CONTEXT_REQID, requestId);
+ properties.put(Constants.CONTEXT_VMID, vmId.getValue());
+
+ UUID identityUrl = vnf.getIdentityUrl();
+ if (identityUrl != null) {
+ properties.put(Constants.CONTEXT_IDENTITY_URL, identityUrl.getValue());
+ }
+ /*
+ * Attempt to call the DG with the appropriate properties
+ */
+ boolean success = callGraph(properties);
+
+ /*
+ * Generate the appropriate response
+ */
+ MDC.put("target", "appc");
+ String statusStr = success ? "SUCCESS" : "FAILURE";
+ String infomsg =
+ String.format("APPC0119I Snapshot '%s' finished with status %s. Reason: %s", requestId, statusStr, reason);
+ logger.info(infomsg);
+
+ SnapshotOutputBuilder sob = new SnapshotOutputBuilder();
+ long endTime = System.currentTimeMillis();
+ long duration = endTime - startTime;
+ String endTimeStr = String.valueOf(endTime);
+ String durationStr = String.valueOf(duration);
+ MDC.put("endTime", endTimeStr);
+ MDC.put("duration", durationStr);
+ sob.setCommonResponseHeader(ResponseHeaderBuilder.buildHeader(success, requestId, reason, duration));
+ sob.setVmId(new UUID(vmId));
+
+ auditLogger.info(String.format(
+ "Audit Logger: APPC0119I Snapshot '%s' finished with status %s. Start Time: [%s]. End Time: [%s]. Duration: [%s]. Request ID: [%s]. Reason:%s",
+ requestId, statusStr, startTime, endTime, duration, requestId, reason));
+ metricsLogger.info(String.format(
+ "Metrics Logger: APPC0119I Snapshot '%s' finished with status %s. Start Time: [%s]. End Time: [%s]. Duration: [%s]. Request ID: [%s]. Reason:%s",
+ requestId, statusStr, startTime, endTime, duration, requestId, reason));
+
+ // Status must be set to true to indicate that our return is expected
+ RpcResult<SnapshotOutput> rpcResult =
+ RpcResultBuilder.<SnapshotOutput> status(true).withResult(sob.build()).build();
+ return rpcResult;
+ }
+
+ private boolean callGraph(Properties props) {
+ String moduleName = configuration.getProperty(Constants.PROPERTY_MODULE_NAME);
+ String methodName = configuration.getProperty(Constants.PROPERTY_TOPOLOGY_METHOD);
+ String version = configuration.getProperty(Constants.PROPERTY_TOPOLOGY_VERSION);
+ String mode = Constants.SYNC_MODE;
+ return callGraph(moduleName, methodName, version, mode, props);
+ }
+
+ /**
+ * Calls a specified directed graph with the specified properties and returns the response
+ *
+ * @param module
+ * The module name to be used to locate the graph
+ * @param method
+ * The method name to be executed (rpc)
+ * @param version
+ * The version of the graph to be used, or null for the latest
+ * @param mode
+ * the execution mode of the graph, sync or async
+ * @param props
+ * A set of name-value properties to be passed to the graph for context variables.
+ */
+ private boolean callGraph(String module, String method, String version, String mode, Properties props) {
+ String graphName = String.format(("%s:%s:%s"), module, method, version);
+ logger.debug(String.format("Calling Graph %s", graphName));
+ metricsLogger.info(String.format("Calling Graph %s", graphName));
+
+ boolean success = false;
+ String appName = configuration.getProperty(Constants.PROPERTY_APPLICATION_NAME);
+ AppcProviderClient svcLogicClient = new AppcProviderClient();
+ try {
+ if (svcLogicClient.hasGraph(module, method, version, mode)) {
+ try {
+ Properties respProps = svcLogicClient.execute(module, method, version, mode, props);
+ success = false; // Assume it failed unless proven otherwise
+ reason = "Failed"; // Assume it failed unless proven otherwise
+
+ logger.debug(EELFResourceManager.format(Msg.DEBUG_GRAPH_RESPONSE_HEADER, appName, graphName,
+ Integer.toString(respProps.size())));
+ for (String key : respProps.stringPropertyNames()) {
+ logger.debug(EELFResourceManager.format(Msg.DEBUG_GRAPH_RESPONSE_DETAIL, appName, graphName,
+ key, (String) respProps.get(key)));
+ }
+
+ // TODO - Find docs and see if there is a better way to handle this
+ // Bad requests have errors
+ if (respProps.containsKey(Constants.ATTRIBUTE_ERROR_CODE)) {
+ // || respProps.containsKey(Constants.ATTRIBUTE_ERROR_MESSAGE)) {
+ String errorCodeProperty = respProps.getProperty(Constants.ATTRIBUTE_ERROR_CODE).trim();
+ int errorCode = 200;
+ try {
+ errorCode = Integer.parseInt(errorCodeProperty);
+ if (errorCode >= 300) {
+ reason = EELFResourceManager.format(Msg.DG_FAILED_RESPONSE, appName, graphName,
+ errorCodeProperty, respProps.getProperty(Constants.ATTRIBUTE_ERROR_MESSAGE));
+ logger.error(reason);
+ success = false;
+ } else {
+ success = true;
+ reason = "Success";
+ }
+ } catch (NumberFormatException e) {
+ reason = EELFResourceManager.format(Msg.PARAMETER_NOT_NUMERIC, appName, graphName,
+ Constants.ATTRIBUTE_ERROR_CODE, errorCodeProperty);
+ logger.error(reason);
+ success = false;
+ }
+ } else {
+ /*
+ * Added code that requires error code to now be defined in ALL cases. If not, it is an error
+ * and the response will be set to failed regardless if the DG worked or not.
+ */
+ reason = EELFResourceManager.format(Msg.PARAMETER_IS_MISSING, appName, graphName,
+ Constants.ATTRIBUTE_ERROR_CODE);
+ logger.error(reason);
+ success = false;
+ }
+ } catch (Exception e) {
+ success = false;
+ reason = EELFResourceManager.format(Msg.EXCEPTION_CALLING_DG, e, appName,
+ e.getClass().getSimpleName(), graphName, e.getMessage());
+ logger.error(reason);
+ }
+ } else {
+ success = false;
+ reason = EELFResourceManager.format(Msg.GRAPH_NOT_FOUND, appName, graphName);
+ logger.error(reason);
+ }
+ } catch (Exception e) {
+ success = false;
+ reason = EELFResourceManager.format(Msg.EXCEPTION_CALLING_DG, e, appName, e.getClass().getSimpleName(),
+ graphName, e.getMessage());
+ logger.error(reason);
+ }
+
+ return success;
+ }
+
+}
diff --git a/appc-provider/appc-provider-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/appc-provider/appc-provider-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644
index 000000000..f98d23c0f
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed 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,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<!--
+ Starter Blueprint Camel Definition appc-aai-adapter-blueprint
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+<!--<bean id="requestDispatcher" class="org.openecomp.appc.requesthandler.impl.RequestHandlerImpl" scope="singleton" >
+</bean>
+
+<service id="requestDispatcherService" interface="org.openecomp.appc.requesthandler.RequestHandler" ref="requestDispatcher"/>
+
+<reference id="aaiAdapter" availability="mandatory" activation="eager" interface="org.openecomp.appc.adapter.aai.AAIAdapter"/>-->
+
+</blueprint>
diff --git a/appc-provider/appc-provider-bundle/src/main/resources/initial/appc-provider.xml b/appc-provider/appc-provider-bundle/src/main/resources/initial/appc-provider.xml
new file mode 100644
index 000000000..524993b4c
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/resources/initial/appc-provider.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed 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,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<snapshot>
+ <configuration>
+ <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+ <module>
+
+ <!-- This xmlns:prefix should match the namespace in the *-provider-impl.yang
+ file The prefix: inside type should match the prefix of the yang file. -->
+ <type xmlns:prefix="org:openecomp:appc:provider:impl">
+ prefix:appc-provider-impl
+ </type>
+ <name>appc-provider-impl</name>
+
+ <!-- The following sections contain bindings to services defined in
+ the *-provider-impl yang file. For example the rpc-registry is required because
+ we have a dependency (or augmentation) named "rpc-registry" and which binds
+ to the md-sa-binding-registry. If you remove those dependencies from the
+ yang file then you can remove them from here. -->
+ <rpc-registry>
+ <type
+ xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
+ <name>binding-rpc-broker</name>
+ </rpc-registry>
+
+ <data-broker>
+ <type
+ xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
+ <name>binding-data-broker</name>
+ </data-broker>
+
+ <notification-service>
+ <type
+ xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
+ binding:binding-notification-service
+ </type>
+ <name>binding-notification-broker</name>
+ </notification-service>
+ </module>
+
+ <module>
+
+ <!-- This xmlns:prefix should match the namespace in the *-provider-impl.yang
+ file The prefix: inside type should match the prefix of the yang file. -->
+ <type xmlns:prefix="org:openecomp:appc:provider:lcm:impl">
+ prefix:appc-provider-lcm-impl
+ </type>
+ <name>appc-provider-lcm-impl</name>
+
+ <!-- The following sections contain bindings to services defined in
+ the *-provider-impl yang file. For example the rpc-registry is required because
+ we have a dependency (or augmentation) named "rpc-registry" and which binds
+ to the md-sa-binding-registry. If you remove those dependencies from the
+ yang file then you can remove them from here. -->
+ <rpc-registry>
+ <type
+ xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
+ <name>binding-rpc-broker</name>
+ </rpc-registry>
+
+ <data-broker>
+ <type
+ xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
+ <name>binding-data-broker</name>
+ </data-broker>
+
+ <notification-service>
+ <type
+ xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
+ binding:binding-notification-service
+ </type>
+ <name>binding-notification-broker</name>
+ </notification-service>
+ </module>
+
+
+ </modules>
+ </data>
+
+ </configuration>
+
+ <!-- Required capabilities are basically a listing of all modules that need
+ to be imported before our service can be resolved. Capabilities for dependencies
+ defined above are implied which is why we do not have define a required capability
+ for the data broker, for example. -->
+ <!-- <required-capabilities> -->
+ <!-- <capability>appc:training:sample:provider:impl?module=sample-provider-impl&amp;revision=2014-05-23</capability> -->
+ <!-- </required-capabilities> -->
+ <required-capabilities>
+ <capability>org:openecomp:appc:provider:impl?module=appc-provider-impl&amp;revision=2014-05-23
+ </capability>
+ <capability>org:openecomp:appc:provider:lcm:impl?module=appc-provider-lcm-impl&amp;revision=2016-01-08
+ </capability>
+ </required-capabilities>
+
+</snapshot>
diff --git a/appc-provider/appc-provider-bundle/src/main/resources/org/openecomp/appc/default.properties b/appc-provider/appc-provider-bundle/src/main/resources/org/openecomp/appc/default.properties
new file mode 100644
index 000000000..e9ee35ada
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/resources/org/openecomp/appc/default.properties
@@ -0,0 +1,55 @@
+###
+# ============LICENSE_START=======================================================
+# openECOMP : APP-C
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights
+# reserved.
+# ================================================================================
+# Licensed 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,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+#
+# This property file supplies the configuration defaults for the APP-C controller
+#
+# Default values are supplied so that all defined properties have well-known values and are
+# valid even if a configuration file is not supplied. This is done to ensure that a runnable,
+# stable, and defined configuration exists at all times. The reason the defaults are supplied
+# via this property file and not in the code is so that the properties can be changed
+# easily if needed in the future. Use of the "getProperty(name, default)" method is
+# discouraged because if the default value needs to be changed, everywhere in the code it
+# is used would have to be changed. By loading the defaults in this property file, all
+# values can be defined in one place and support is easier. This does mean that all
+# properties that are defined must have a default value supplied here. Which also means
+# this file documents all defined properties (not a bad thing either).
+#
+#--------------------------------------------------------------------------------------------
+# The path and file used to load user-supplied configuration settings, if any
+org.openecomp.appc.bootstrap.file=appc.properties
+org.openecomp.appc.bootstrap.path=/opt/openecomp/appc/data/properties,${user.home},.
+
+appc.application.name=APPC
+
+#
+# The path to search for logging configuration document, and the name of the document
+#
+org.openecomp.appc.logging.path=${user.home},etc,../etc,.
+org.openecomp.appc.logging.file=logback.xml
+
+#
+# The DG properties
+#
+appc.service.logic.module.name=APPC
+appc.topology.dg.method=topology-operation-all
+appc.topology.dg.version=2.0.0
+
diff --git a/appc-provider/appc-provider-bundle/src/main/resources/org/openecomp/appc/logback.xml b/appc-provider/appc-provider-bundle/src/main/resources/org/openecomp/appc/logback.xml
new file mode 100644
index 000000000..8d47c6cae
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/resources/org/openecomp/appc/logback.xml
@@ -0,0 +1,284 @@
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed 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,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<configuration scan="true" scanPeriod="3 seconds" debug="true">
+ <!--<jmxConfigurator /> -->
+ <property name="logDirectory" value="logs" />
+ <property name="debugLogDirectory" value="debug-logs" />
+ <!-- Example evaluator filter applied against console appender -->
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level
+ %-36.36logger - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <!-- ============================================================================ -->
+ <!-- CDP Appenders -->
+ <!-- ============================================================================ -->
+
+ <!-- The CDPAppender is used to record events to the general CDP application
+ log. This is the log file used by default as the application root log, if
+ no other log is defined or the application creates specialized loggers of
+ the form com.att.cdp.x.y.z where the name occupied by the "x" is NOT security,
+ perf, server, coordinator, gui, or policy. These are defined as specialization
+ loggers for various business purposes. -->
+ <appender name="CDP"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/cdp.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/cdp.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} -
+ %msg%n"</pattern> -->
+ <pattern>%d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level
+ %-36.36logger [%X{User} %X{RemoteHost} %X{RequestId} %X{Method}
+ %X{Path}] - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="asyncCDP" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="CDP" />
+ </appender>
+
+ <!-- CDP Security Appender. This appender is used to record security events
+ to the security log file. Security events are separate from other loggers
+ in CDP so that security log records can be captured and managed in a secure
+ way separate from the other logs. This appender is set to never discard any
+ events. -->
+ <appender name="CDPSecurity"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/cdp-security.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/cdp-security.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} -
+ %msg%n"</pattern> -->
+ <pattern>%d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level
+ %-36.36logger [%X{User} %X{RemoteHost} %X{RequestId} %X{Method}
+ %X{Path}] - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="asyncCDPSecurity" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <discardingThreshold>0</discardingThreshold>
+ <appender-ref ref="CDPSecurity" />
+ </appender>
+
+ <!-- CDP Performance Appender. This appender is used to record performance
+ records. -->
+ <appender name="CDPPerformance"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/cdp-performance.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/cdp-performance.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <outputPatternAsHeader>true</outputPatternAsHeader>
+ <pattern>%d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level
+ %-36.36logger [%X{User} %X{RemoteHost} %X{RequestId} %X{Method}
+ %X{Path}] - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="asyncCDPPerformance" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="CDPPerformance" />
+ </appender>
+
+ <!-- CDP Server Appender. This appender is used to record Server related
+ logging events. The Server logger and appender are specializations of the
+ CDP application root logger and appender. This can be used to segregate Server
+ events from other components, or it can be eliminated to record these events
+ as part of the application root log. -->
+ <appender name="CDPServer"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/cdp-server.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/cdp-server.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} -
+ %msg%n"</pattern> -->
+ <pattern>%d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level
+ %-36.36logger [%X{User} %X{RemoteHost} %X{RequestId} %X{Method}
+ %X{Path}] - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="asyncCDPServer" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="CDPServer" />
+ </appender>
+
+ <!-- CDP Coordinator Appender. This appender is used to record Coordinator
+ related logging events. The Coordinator logger and appender are specializations
+ of the CDP application root logger and appender. This can be used to segregate
+ Coordinator events from other components, or it can be eliminated to record
+ these events as part of the application root log. -->
+ <appender name="CDPCoordinator"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/cdp-coordinator.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/cdp-coordinator.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} -
+ %msg%n"</pattern> -->
+ <pattern>%d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level
+ %-36.36logger - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="asyncCDPCoordinator" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="CDPCoordinator" />
+ </appender>
+
+ <!-- CDP Policy Appender. This appender is used to record Policy engine
+ related logging events. The Policy logger and appender are specializations
+ of the CDP application root logger and appender. This can be used to segregate
+ Policy engine events from other components, or it can be eliminated to record
+ these events as part of the application root log. -->
+ <appender name="CDPPolicy"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/cdp-policy.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/cdp-policy.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} -
+ %msg%n"</pattern> -->
+ <pattern>%d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level
+ %-36.36logger - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="asyncCDPPolicy" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="CDPPolicy" />
+ </appender>
+ <appender name="CommandExecutor"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${debugLogDirectory}/appc-debug.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/command-executor.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <!--<Pattern>
+ %d{yyyy-MM-dd'T'HH:mm:ss.SSSZ}|%X{RequestID}|%X{ServiceInstanceID}|%thread|%X{ServerName}|%X{ServiceName}|%X{UUID}|%-5.5p|%X{Severity}|%X{ServerIPAddress}|%X{Server}|%X{IPAddress}|[%c{3}]|%X{Timer}| - %msg%n
+ </Pattern>-->
+ <Pattern>
+ %d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%t|%X{ServiceName} - %X{bundle.id} - %X{bundle.name} - %X{bundle.version}|%X{InstanceUUID}|%-5.5p|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}|%X{Timer}|[%c{3}]|%m%n
+ </Pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.openecomp.appc" level="DEBUG" additivity="false">
+ <appender-ref ref="CommandExecutor" />
+ </logger>
+
+ <!-- ============================================================================ -->
+ <!-- CDP loggers -->
+ <!-- ============================================================================ -->
+ <logger name="com.att.cdp" level="info" additivity="false">
+ <appender-ref ref="asyncCDP" />
+ </logger>
+ <logger name="com.att.cdp.security" level="info" additivity="false">
+ <appender-ref ref="asyncCDPSecurity" />
+ </logger>
+ <logger name="com.att.cdp.perf" level="info" additivity="false">
+ <appender-ref ref="asyncCDPPerformance" />
+ </logger>
+ <logger name="com.att.cdp.server" level="debug" additivity="false">
+ <appender-ref ref="asyncCDPServer" />
+ </logger>
+ <logger name="com.att.cdp.coordinator" level="info" additivity="false">
+ <appender-ref ref="asyncCDPCoordinator" />
+ </logger>
+ <logger name="com.att.cdp.policy" level="info" additivity="false">
+ <appender-ref ref="asyncCDPPolicy" />
+ </logger>
+
+ <!-- The OpenStack connector logger -->
+ <logger name="os" level="debug" additivity="false">
+ <appender-ref ref="asyncCDPServer" />
+ </logger>
+
+ <root level="WARN">
+ <appender-ref ref="STDOUT" />
+ </root>
+
+</configuration>
diff --git a/appc-provider/appc-provider-bundle/src/main/resources/org/openecomp/appc/org.ops4j.pax.logging.cfg b/appc-provider/appc-provider-bundle/src/main/resources/org/openecomp/appc/org.ops4j.pax.logging.cfg
new file mode 100644
index 000000000..be5863291
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/resources/org/openecomp/appc/org.ops4j.pax.logging.cfg
@@ -0,0 +1,144 @@
+ ################################################################################
+ #
+ # 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-provider/appc-provider-bundle/src/main/yang/appc-provider-lcm.yang b/appc-provider/appc-provider-bundle/src/main/yang/appc-provider-lcm.yang
new file mode 100644
index 000000000..ea085aba4
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/yang/appc-provider-lcm.yang
@@ -0,0 +1,61 @@
+module appc-provider-lcm-impl {
+
+ yang-version 1;
+ namespace "org:openecomp:appc:provider:lcm:impl";
+ prefix "appc-provider-lcm-impl";
+
+ import config { prefix config; revision-date 2013-04-05; }
+ import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+
+ description
+ "This module contains the base YANG definitions for
+ appc-provider-lcm implementation.";
+
+ revision "2016-01-08" {
+ description
+ "Initial revision.";
+ }
+
+ // This is the definition of the service implementation as a module identity.
+ identity appc-provider-lcm-impl {
+ base config:module-type;
+
+ // Specifies the prefix for generated java classes.
+ config:java-name-prefix AppcProviderLcm;
+ }
+
+ // Augments the 'configuration' choice node under modules/module.
+ // We consume the three main services, RPCs, DataStore, and Notifications
+ augment "/config:modules/config:module/config:configuration" {
+ case appc-provider-lcm-impl {
+ when "/config:modules/config:module/config:type = 'appc-provider-lcm-impl'";
+
+ container rpc-registry {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity mdsal:binding-rpc-registry;
+ }
+ }
+ }
+
+ container notification-service {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity mdsal:binding-notification-service;
+ }
+ }
+ }
+
+ container data-broker {
+ uses config:service-ref {
+ refine type {
+ mandatory false;
+ config:required-identity mdsal:binding-async-data-broker;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/appc-provider/appc-provider-bundle/src/main/yang/appc-provider.yang b/appc-provider/appc-provider-bundle/src/main/yang/appc-provider.yang
new file mode 100644
index 000000000..95d90adaf
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/main/yang/appc-provider.yang
@@ -0,0 +1,61 @@
+module appc-provider-impl {
+
+ yang-version 1;
+ namespace "org:openecomp:appc:provider:impl";
+ prefix "appc-provider-impl";
+
+ import config { prefix config; revision-date 2013-04-05; }
+ import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+
+ description
+ "This module contains the base YANG definitions for
+ appc-provider implementation.";
+
+ revision "2014-05-23" {
+ description
+ "Initial revision.";
+ }
+
+ // This is the definition of the service implementation as a module identity.
+ identity appc-provider-impl {
+ base config:module-type;
+
+ // Specifies the prefix for generated java classes.
+ config:java-name-prefix AppcProvider;
+ }
+
+ // Augments the 'configuration' choice node under modules/module.
+ // We consume the three main services, RPCs, DataStore, and Notifications
+ augment "/config:modules/config:module/config:configuration" {
+ case appc-provider-impl {
+ when "/config:modules/config:module/config:type = 'appc-provider-impl'";
+
+ container rpc-registry {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity mdsal:binding-rpc-registry;
+ }
+ }
+ }
+
+ container notification-service {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity mdsal:binding-notification-service;
+ }
+ }
+ }
+
+ container data-broker {
+ uses config:service-ref {
+ refine type {
+ mandatory false;
+ config:required-identity mdsal:binding-async-data-broker;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/appc-provider/appc-provider-bundle/src/test/java/org/openecomp/appc/AppcProviderTest.java b/appc-provider/appc-provider-bundle/src/test/java/org/openecomp/appc/AppcProviderTest.java
new file mode 100644
index 000000000..3915c8da0
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/test/java/org/openecomp/appc/AppcProviderTest.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed 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,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.junit.After;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.test.AbstractDataBrokerTest;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.openecomp.appc.provider.AppcProvider;
+
+/**
+ * Defines a unit test class which tests the provider. This class leverages the AbstractDataBrokerTest class which
+ * starts a real MD-SAL implementation to use inside of your unit tests. This is not an exhaustive test, but rather is
+ * used to illustrate how one can leverage the AbstractDataBrokerTest to test MD-SAL providers/listeners.
+ */
+public class AppcProviderTest extends AbstractDataBrokerTest {
+
+ private ExecutorService threadPool = Executors.newSingleThreadExecutor();
+ private AppcProvider provider;
+ private DataBroker dataBroker;
+
+ /**
+ * The @Before annotation is defined in the AbstractDataBrokerTest class. The method setupWithDataBroker is invoked
+ * from inside the @Before method and is used to initialize the databroker with objects for a test runs. In our case
+ * we use this oportunity to create an instance of our provider and initialize it (which registers it as a listener
+ * etc). This method runs before every @Test method below.
+ */
+ @Override
+ protected void setupWithDataBroker(DataBroker dataBroker) {
+ super.setupWithDataBroker(dataBroker);
+
+ this.dataBroker = dataBroker;
+ NotificationProviderService nps = null;
+ RpcProviderRegistry registry = null;
+
+ provider = new AppcProvider(dataBroker, nps, registry);
+ }
+
+ /**
+ * Shuts down our provider, testing close code. @After runs after every @Test method below.
+ */
+ @After
+ public void stop() throws Exception {
+ if (provider != null) {
+ provider.close();
+ }
+ }
+
+ /**
+ * This validates that when a task is created, the run count is initialized to 0
+ */
+ @Ignore
+ @Test
+ public void sampleUnitTest() {
+ // This is where you add your unit testing. You can access "DataBroker" as
+ // needed to create items etc.
+ // This a "Real" data broker.
+ }
+}
diff --git a/appc-provider/appc-provider-features/.gitignore b/appc-provider/appc-provider-features/.gitignore
new file mode 100644
index 000000000..2992ae832
--- /dev/null
+++ b/appc-provider/appc-provider-features/.gitignore
@@ -0,0 +1,3 @@
+/target/
+/bin/
+/.settings/
diff --git a/appc-provider/appc-provider-features/pom.xml b/appc-provider/appc-provider-features/pom.xml
new file mode 100644
index 000000000..49d3e48f0
--- /dev/null
+++ b/appc-provider/appc-provider-features/pom.xml
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>appc-provider</artifactId>
+ <groupId>org.openecomp.appc</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <name>appc-provider-features</name>
+ <artifactId>appc-provider-features</artifactId>
+
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-provider-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-provider-bundle</artifactId>
+ <classifier>config</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-provider-bundle</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>features-mdsal</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+
+ <scope>runtime</scope>
+ </dependency>
+
+
+
+ <!-- dependency for opendaylight-karaf-empty for use by testing -->
+<!-- <dependency> -->
+<!-- <groupId>org.opendaylight.controller</groupId> -->
+<!-- <artifactId>opendaylight-karaf-empty</artifactId> -->
+<!-- <type>zip</type> -->
+<!-- </dependency> -->
+
+
+<!-- <dependency> -->
+<!-- Required for launching the feature tests -->
+<!-- <groupId>org.opendaylight.yangtools</groupId> -->
+<!-- <artifactId>features-test</artifactId> -->
+<!-- <scope>test</scope> -->
+<!-- </dependency> -->
+
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>features-yangtools</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <filtering>true</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>filter</id>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <!-- launches the feature test, which validates that your karaf feature
+ can be installed inside of a karaf container. It doesn't validate that your
+ functionality works correctly, just that you have all of the dependent bundles
+ defined correctly. -->
+ <!-- Skipping ODL feature test -->
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId>
+ <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
+ <karaf.distro.version>${odl.karaf.empty.distro.version}</karaf.distro.version>
+ </systemPropertyVariables>
+ <dependenciesToScan>
+ <dependency>org.opendaylight.yangtools:features-test</dependency>
+ </dependenciesToScan>
+ <classpathDependencyExcludes>
+ <!-- The dependencies which bring in AbstractDataBrokerTest class
+ brings in a second PaxExam container which results in the feature tests failing
+ with a message similar to: "ERROR o.ops4j.pax.exam.spi.PaxExamRuntime - Ambiguous
+ TestContainer ..." This excludes the container we don't want to use. -->
+ <classpathDependencyExcludes>org.ops4j.pax.exam:pax-exam-container-native</classpathDependencyExcludes>
+ </classpathDependencyExcludes>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/${features.file}</file>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+</project>
diff --git a/appc-provider/appc-provider-features/src/main/resources/features.xml b/appc-provider/appc-provider-features/src/main/resources/features.xml
new file mode 100644
index 000000000..278fa4285
--- /dev/null
+++ b/appc-provider/appc-provider-features/src/main/resources/features.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed 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,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+
+<features name="appc-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+
+<!-- <repository>mvn:org.opendaylight.mdsal/features-mdsal/${odl.mdsal.version}/xml/features</repository> -->
+ <repository>mvn:org.opendaylight.mdsal/features-mdsal/${features-mdsal.version}/xml/features</repository>
+
+ <feature name='appc-provider' description="application controller" version='${project.version}'>
+ <!--<feature version="${project.version}">appc-aai-adapter</feature>-->
+ <!-- Most applications will have a dependency on the ODL MD-SAL Broker -->
+ <!-- <feature version="${broker-mdsal.version}">odl-mdsal-broker</feature> -->
+ <feature version="${broker-mdsal.version}">odl-mdsal-broker</feature>
+ <bundle>mvn:org.openecomp.appc/appc-provider-model/${project.version}</bundle>
+ <bundle>mvn:org.openecomp.appc/appc-provider-bundle/${project.version}</bundle>
+ <configfile finalname="etc/opendaylight/karaf/200-appc-provider.xml">mvn:org.openecomp.appc/appc-provider-bundle/${project.version}/xml/config</configfile>
+ </feature>
+
+</features>
diff --git a/appc-provider/appc-provider-installer/.gitignore b/appc-provider/appc-provider-installer/.gitignore
new file mode 100644
index 000000000..731eb433c
--- /dev/null
+++ b/appc-provider/appc-provider-installer/.gitignore
@@ -0,0 +1,2 @@
+/target/
+/.settings/
diff --git a/appc-provider/appc-provider-installer/pom.xml b/appc-provider/appc-provider-installer/pom.xml
new file mode 100644
index 000000000..cb3186fe4
--- /dev/null
+++ b/appc-provider/appc-provider-installer/pom.xml
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>appc-provider</artifactId>
+ <groupId>org.openecomp.appc</groupId>
+ <version>1.0.0</version>
+ </parent>
+
+ <artifactId>appc-provider-installer</artifactId>
+ <name>APPC Provider - Karaf Installer</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <application.name>appc-provider</application.name>
+ <features.boot>appc-provider</features.boot>
+ <features.repositories>mvn:org.openecomp.appc/appc-provider-features/${project.version}/xml/features</features.repositories>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-provider-features</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-provider-bundle</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-provider-bundle</artifactId>
+ <version>${project.version}</version>
+ <classifier>config</classifier>
+ <type>xml</type>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>maven-repo-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <appendAssemblyId>false</appendAssemblyId>
+ <attach>false</attach>
+ <finalName>stage/${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ <execution>
+ <id>installer-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <appendAssemblyId>false</appendAssemblyId>
+ <attach>true</attach>
+ <finalName>${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_installer_zip.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <transitive>false</transitive>
+ <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <useRepositoryLayout>true</useRepositoryLayout>
+ <addParentPoms>false</addParentPoms>
+ <copyPom>false</copyPom>
+ <excludeGroupIds>org.opendaylight</excludeGroupIds>
+ <scope>provided</scope>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-version</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <!-- here the phase you need -->
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>${basedir}/target/stage</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources/scripts</directory>
+ <includes>
+ <include>install-feature.sh</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/appc-provider/appc-provider-installer/src/assembly/assemble_installer_zip.xml b/appc-provider/appc-provider-installer/src/assembly/assemble_installer_zip.xml
new file mode 100644
index 000000000..8948a3302
--- /dev/null
+++ b/appc-provider/appc-provider-installer/src/assembly/assemble_installer_zip.xml
@@ -0,0 +1,59 @@
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed 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,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>controller</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level
+ as this file is suppose to be unzip on top of a karaf
+ distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target/stage/</directory>
+ <outputDirectory>${application.name}</outputDirectory>
+ <fileMode>755</fileMode>
+ <includes>
+ <include>*.sh</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/stage/</directory>
+ <outputDirectory>${application.name}</outputDirectory>
+ <fileMode>644</fileMode>
+ <excludes>
+ <exclude>*.sh</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+
+
+</assembly>
diff --git a/appc-provider/appc-provider-installer/src/assembly/assemble_mvnrepo_zip.xml b/appc-provider/appc-provider-installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100644
index 000000000..599ceafb3
--- /dev/null
+++ b/appc-provider/appc-provider-installer/src/assembly/assemble_mvnrepo_zip.xml
@@ -0,0 +1,54 @@
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed 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,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>controller</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level
+ as this file is suppose to be unzip on top of a karaf
+ distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target/assembly/</directory>
+ <outputDirectory>.</outputDirectory>
+ <excludes>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+ <files>
+ <file>
+ <source>../${feature-name}-bundle/src/main/resources/initial/${feature-name}.xml</source>
+ <destName>./etc/opendaylight/karaf/200-${feature-name}.xml</destName>
+ </file>
+ </files>
+
+</assembly>
diff --git a/appc-provider/appc-provider-installer/src/main/resources/scripts/install-feature.sh b/appc-provider/appc-provider-installer/src/main/resources/scripts/install-feature.sh
new file mode 100644
index 000000000..1d769fada
--- /dev/null
+++ b/appc-provider/appc-provider-installer/src/main/resources/scripts/install-feature.sh
@@ -0,0 +1,40 @@
+###
+# ============LICENSE_START=======================================================
+# openECOMP : APP-C
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights
+# reserved.
+# ================================================================================
+# Licensed 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,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+#!/bin/bash
+
+ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
+ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client}
+ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"}
+INSTALLERDIR=$(dirname $0)
+
+REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip
+
+if [ -f ${REPOZIP} ]
+then
+ unzip -n -d ${ODL_HOME} ${REPOZIP}
+else
+ echo "ERROR : repo zip ($REPOZIP) not found"
+ 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}
diff --git a/appc-provider/appc-provider-model/.gitignore b/appc-provider/appc-provider-model/.gitignore
new file mode 100644
index 000000000..2992ae832
--- /dev/null
+++ b/appc-provider/appc-provider-model/.gitignore
@@ -0,0 +1,3 @@
+/target/
+/bin/
+/.settings/
diff --git a/appc-provider/appc-provider-model/pom.xml b/appc-provider/appc-provider-model/pom.xml
new file mode 100644
index 000000000..8b4ebdcdb
--- /dev/null
+++ b/appc-provider/appc-provider-model/pom.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>appc-provider</artifactId>
+ <groupId>org.openecomp.appc</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>appc-provider-model</artifactId>
+ <packaging>bundle</packaging>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Import-Package>*</Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-maven-plugin</artifactId>
+ <version>${odl.yangtools.version}</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>maven-sal-api-gen-plugin</artifactId>
+ <version>${odl.yangtools.version}</version>
+ <type>jar</type>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <yangFilesRootDir>${yang.file.directory}</yangFilesRootDir>
+ <codeGenerators>
+ <generator>
+ <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
+ <outputBaseDir>${salGeneratorPath}</outputBaseDir>
+ </generator>
+ </codeGenerators>
+ <inspectDependencies>true</inspectDependencies>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.12</version>
+ <executions>
+ <execution>
+ <id>add-generated-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <!-- project.build.directory defaults to be the "target" folder -->
+ <source>${project.build.directory}/generated-sources/yang-gen-sal</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>yang-binding</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-inet-types</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-yang-types</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/appc-provider/appc-provider-model/src/main/yang/appc-provider-lcm.yang b/appc-provider/appc-provider-model/src/main/yang/appc-provider-lcm.yang
new file mode 100644
index 000000000..6f2d0b480
--- /dev/null
+++ b/appc-provider/appc-provider-model/src/main/yang/appc-provider-lcm.yang
@@ -0,0 +1,949 @@
+/*
+ * Yang model for the Application Controller (APP-C) component of ECOMP
+ *
+ * This model is used to define the data and services of the Application Controller
+ * component of ECOMP. The APP-C controller initiates the processing of directed
+ * graphs, which define the actual process implementations used. The name of the
+ * directed graph is set by properties and cannot be changed dynamically.
+ *
+ * The services exposed by this provider are:
+ *
+ * restart-vnf:
+ * Used to request a restart of a virtual network function (a VM).
+ *
+ * rebuild-vnf:
+ * Used to request a rebuild of a virtual network function (a VM).
+ *
+ */
+
+module appc-provider-lcm {
+
+ yang-version 1;
+ namespace "org:openecomp:appc";
+ prefix appc-provider-lcm;
+ organization "Copyright 2017 AT&T Intellectual Property.";
+
+ description
+ "Defines the services and request/response requirements for the ECOMP APP-C component.";
+
+ /*
+ * Note, the revision changes the package name of the generated java code. Do not
+ * change the revision unless you also update all references to the bindings.
+ */
+ revision "2016-01-08" {
+ description
+ "APP-C interface version 1.0.48";
+ }
+
+ /**********************************************************************************
+ * Data type definitions
+ *
+ * The following data type definitions are used to define common data structures,
+ * define constraints, or to impart special meanings to data objects related to the
+ * APP-C controller functions.
+ **********************************************************************************/
+
+ /*
+ * Define a common definition of a UUID
+ */
+ typedef UUID {
+ type string {
+ length "1..255";
+ }
+ description "Universally Unique ID";
+ }
+
+ /*
+ * Define the name of the provider region/LCP to connect to
+ */
+ typedef LCP {
+ type string {
+ length "1..255";
+ }
+ description "The local control plane name (OpenStack region name) of the provider";
+ }
+
+ /*
+ * Define a common definition of a time stamp (expressed as a formatted string) as follows
+ *
+ * yyyy-MM-dd HH:mm:ss.SSSSSSSS
+ *
+ * yyyy ...... exactly 4 digit year, e.g., 2015
+ * MM ........ 1 or 2 digit month of year, e.g., 7
+ * dd ........ 1 or 2 digit day of month, e.g., 29
+ * HH ........ 1 or 2 digit hour of day (24-hour clock) in UTC, e.g., 17
+ * mm ........ 1 or 2 digit minute of the hour, e.g. 31
+ * ss ........ 1 or 2 digit seconds of the minute, e.g., 28
+ * SSSSSS .... 1-6 digit microseconds
+ */
+ typedef TIMESTAMP {
+ type string {
+ length "16..28";
+ pattern "[0-9]{4}-[0-9]{1,2}-[0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]{1,6}";
+ }
+ }
+
+ typedef ZULU {
+ type string {
+ length "16..28";
+ pattern "[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]{1,6}Z";
+ }
+ }
+
+ typedef payload {
+ type string ;
+ description "The payload can be any valid JSON string value. Json escape characters need to be added when required to include an inner json within the payload to make it a valid json string value";
+ }
+
+ typedef action {
+ type enumeration {
+ enum "Restart";
+ enum "Rebuild";
+ enum "Migrate";
+ enum "Evacuate";
+ enum "Snapshot";
+ enum "Rollback";
+ enum "Sync";
+ enum "Audit";
+ enum "Stop";
+ enum "Terminate";
+ enum "SoftwareUpload";
+ enum "HealthCheck";
+ enum "LiveUpgrade";
+ enum "ModifyConfig";
+ enum "Lock";
+ enum "Unlock";
+ enum "Test";
+ enum "CheckLock";
+ }
+ description "The action to be taken by APP-C, e.g. Restart, Rebuild, Migrate";
+ }
+
+ /**********************************************************************************
+ * All requests will include this standard header
+ *
+ * The standard request header is used to define a correlation identification for
+ * the request that is returned on all responses. This correlation identifier
+ * (called the service-request-id) is meaningful to the caller and is included on
+ * all responses from the services.
+ **********************************************************************************/
+ grouping common-request-header {
+ description "A common header for all requests";
+ container common-request-header {
+ leaf service-request-id {
+ description "An identifier meaningful to the caller to correlate all responses";
+ type string;
+ mandatory true;
+ }
+
+ leaf time-to-live {
+ description "The alloted time to perform the operation, in seconds. If the
+ operation cannot be completed in this amount of time, the operation is
+ aborted. If set to zero, no timeout exists and the operation will continue
+ until it completes or fails. If omitted, the default value of 0 is used.";
+ type uint32 {
+ range "0..86400";
+ }
+ mandatory false;
+ }
+ }
+ }
+
+ /**********************************************************************************
+ * Basic manipulation of a VNF (or VM) will typically include querying the current
+ * state, restarting, rebuilding, stopping, starting, etc. In all of these basic
+ * "state"-type operations, the services require the identification of the VNF to
+ * be operated on, and the region or LCP that contains that resource. This
+ * information is used across all of these services, so it has been defined as a
+ * common structure here and is referenced in the appropriate RPC definitions.
+ **********************************************************************************/
+ grouping vnf-resource {
+ description "The data that uniquely identifies a virtual network function (or vm)";
+ container vnf-resource {
+ leaf vm-id {
+ description "The UUID of the resource. For backwards compatibility, this can be
+ the self-link URL of the VM.";
+ type UUID;
+ mandatory true;
+ }
+ leaf identity-url {
+ description "The identity url used to access the resource";
+ type UUID;
+ mandatory false;
+ }
+ leaf tenant-id {
+ description "The id of the provider tenant that owns the resource";
+ type string;
+ mandatory false;
+ }
+ }
+ }
+
+ /**********************************************************************************
+ * All responses will include this standard header
+ *
+ * The standard response header includes the time of completion as well as a
+ * success|failure indication
+ **********************************************************************************/
+ grouping common-response-header {
+ description "A common header for all responses defining success or failure
+ and the time stamp when completed";
+ container common-response-header {
+ leaf service-request-id {
+ description "An identifier meaningful to the caller to correlate all responses";
+ type string;
+ }
+ leaf success {
+ description "True indicates the request was successful";
+ type boolean;
+ }
+ leaf reason {
+ description "If success=false, the failure reason. Otherwise, undefined.";
+ type string;
+ }
+ leaf completed {
+ description "The formatted time stamp when the operation was completed.";
+ type TIMESTAMP;
+ }
+ leaf duration {
+ description "The amount of time used (in seconds) to process the request";
+ type uint32;
+ }
+ }
+ }
+
+
+ /**********************************************************************************
+ * All requests/response will include this standard header
+ *
+ * The standard common header is used to define a correlation identification for
+ * the request that is returned on all responses.
+ **********************************************************************************/
+ grouping common-header {
+ description "A common header for all APP-C requests";
+ container common-header {
+ description "A common header for all APP-C requests";
+ leaf timestamp {
+ description "timestamp is in ISO 8601 timestamp format ZULU offset";
+ type ZULU;
+ mandatory true;
+ }
+
+ leaf api-ver {
+ description "api-ver is the API version identifier. A given release of APPC should support all previous versions of APPC API (correlate with general requirements)";
+ type string {
+ pattern "[2]\.\d\d"{
+ error-message "API Version 2.XX is supported at this end point";
+ }
+ }
+ mandatory true;
+ }
+
+ leaf originator-id {
+ description "originator-id an identifier of the calling system which can be used addressing purposes, i.e. returning asynchronous response to the proper destination over DMaaP (especially in case of multiple consumers of APP-C APIs)";
+ type string;
+ mandatory true;
+ }
+
+ leaf request-id {
+ description "UUID for the request ID. An OSS/BSS identifier for the request that caused the current action. Multiple API calls may be made with the same request-id The request-id shall be recorded throughout the operations on a single request";
+ type string;
+ mandatory true;
+ }
+
+ leaf sub-request-id {
+ description "Uniquely identifies a specific LCM action. It is persistent over the life-cycle of a single request";
+ type string;
+ mandatory false;
+ }
+
+
+ /**********************************************************************************
+ * Flags are generic flags that apply to any and all commands, all are optional
+ * force = TRUE/FALSE - Execute command even if target is in unstable (i.e. locked, transiting, etc) state. Specific behaviour of forced commands varies, but implies cancellation of previous command and an override by the new command. The FALSE value is used by default.
+ * ttl = <0....N> - The timeout value for command execution, expressed in seconds
+ * mode = EXCLUSIVE/NORMAL - defines execution mode as follows:
+ * - EXCLUSIVE ? on encountering an exclusive command, the APP-C will:
+ * * Cease accepting additional command requests
+ * * Complete execution of outstanding commands
+ * * Execute the exclusive command to completion
+ * * Optionally report the result of the command
+ * * Optionally resume command acceptance and processing
+ * - NORMAL - Obverse of EXCLUSIVE, the default one.
+ **********************************************************************************/
+ container flags {
+ description "Flags are generic flags that apply to any and all commands, all are optional";
+ leaf mode {
+ type enumeration {
+ enum "EXCLUSIVE";
+ enum "NORMAL";
+ }
+ description "EXCLUSIVE (accept no queued requests on this VNF while processing) or NORMAL (queue other requests until complete)";
+ mandatory false;
+ }
+ leaf force {
+ type enumeration {
+ enum "TRUE";
+ enum "FALSE";
+ }
+ description "TRUE/FALSE - Execute action even if target is in unstable (i.e. locked, transiting, etc.) state";
+ mandatory false;
+ }
+ leaf ttl {
+ description "<0....N> - The timeout value (expressed in seconds) for action execution, between action being received by APPC and action initiation";
+ type uint16;
+ mandatory false;
+ }
+ }
+ }
+ }
+
+
+ grouping action-identifiers {
+ description "A block containing the action arguments. These are used to specify the object upon which APP-C LCM command is to operate";
+ container action-identifiers {
+ description "A block containing the action arguments. These are used to specify the object upon which APP-C LCM command is to operate";
+ leaf service-instance-id {
+ description "identifies a specific service the command refers to. When multiple APP-C instances are used and applied to a subset of services, this will become significant . The field is mandatory when the vnf-id is empty";
+ type string;
+ mandatory false;
+ }
+ leaf vnf-id {
+ description "identifies the VNF to which this action is to be applied(vnf-id uniquely identifies the service-instance referred to). Note that some actions are applied to multiple VNFs in the same service. When this is the case, vnf-id may be left out, but service-instance-id must appear. The field is mandatory when service-instance-id is empty";
+ type string;
+ mandatory false;
+ }
+ leaf vnfc-name {
+ description "identifies the VNFC to which this action is to be applied. Some actions apply only to a component within a VNF (e.g. RESTART is sometimes applied to on VM only). In such a case, the name of the VNFC is used to search for the component within the VNF";
+ type string;
+ mandatory false;
+ }
+ leaf vserver-id {
+ description "identifies a specific VM within the given service/vnf to which this action is to be applied";
+ type string;
+ mandatory false;
+ }
+ }
+ }
+
+ grouping status {
+ description "The specific response codes are to be aligned with ASDC reference doc (main table removed to avoid duplication and digression from main table). See ASDC and ECOMP Distribution Consumer Interface Agreement";
+ container status {
+ description "The specific response codes are to be aligned with ASDC reference doc (main table removed to avoid duplication and digression from main table). See ASDC and ECOMP Distribution Consumer Interface Agreement";
+ leaf code {
+ description "Response code";
+ type uint16;
+ mandatory true;
+ }
+ leaf message {
+ description "Response message";
+ type string;
+ mandatory true;
+ }
+ }
+ }
+
+
+ /**********************************************************************************
+ * NEW API ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ * All requests will include this standard header
+ *
+ * The standard request header is used to define a correlation identification for
+ * the request that is returned on all responses. This correlation identifier
+ * (called the service-request-id) is meaningful to the caller and is included on
+ * all responses from the services.
+ **********************************************************************************/
+ grouping RequestHeader {
+ container RequestHeader {
+ description "A common header for all APP-C requests";
+ leaf TimeStamp {
+ description "TimeStamp is in ISO 8601 timestamp format ZULU offset";
+ type TIMESTAMP;
+ mandatory true;
+ }
+
+ leaf APIver {
+ description "APIver is the API version identifier. A given release of APPC should support all previous versions of APPC API (correlate with general requirements)";
+ type string;
+ mandatory true;
+ }
+
+ leaf OriginatorID {
+ description "OriginatorID an identifier of the calling system which can be used addressing purposes, i.e. returning asynchronous response to the proper destination over DMaaP (especially in case of multiple consumers of APP-C APIs)";
+ type string;
+ mandatory true;
+ }
+
+ leaf TransactionID {
+ description "Identifiers that may be generated when multiple responses or handling passes are needed for a given request, allowing the request itself to be tracked";
+ type string;
+ mandatory true;
+ }
+
+ leaf-list RequestTrack {
+ description "Identifiers that may be generated when multiple responses or handling passes are needed for a given request, allowing the request itself to be tracked";
+ type string;
+ }
+
+ /**********************************************************************************
+ * Flags are generic flags that apply to any and all commands, all are optional
+ * FORCE = TRUE/FALSE - Execute command even if target is in unstable (i.e. locked, transiting, etc) state. Specific behaviour of forced commands varies, but implies cancellation of previous command and an override by the new command. The FALSE value is used by default.
+ * TTL = <0....N> - The timeout value for command execution, expressed in seconds
+ * MODE = EXCLUSIVE/NORMAL - defines execution mode as follows:
+ * - EXCLUSIVE � on encountering an exclusive command, the APP-C will:
+ * * Cease accepting additional command requests
+
+ * Complete execution of outstanding commands
+ * * Execute the exclusive command to completion
+ * * Optionally report the result of the command
+ * * Optionally resume command acceptance and processing
+ * - NORMAL - Obverse of EXCLUSIVE, the default one.
+ **********************************************************************************/
+ container Flags {
+ description "Flags are generic flags that apply to any and all commands, all are optional";
+ leaf FORCE {
+ description "TRUE/FALSE - Execute action even if target is in unstable (i.e. locked, transiting, etc) state.";
+ type string;
+ mandatory false;
+ }
+ leaf TTL {
+ description "<0....N> - The timeout value for action execution, expressed in seconds";
+ type string;
+ mandatory false;
+ }
+ leaf MODE {
+ description "EXCLUSIVE/NORMAL - defines execution mode";
+ type string;
+ mandatory false;
+ }
+ }
+ }
+ }
+
+ grouping RequestParameters {
+ description "The request contains the entry of command-specific and is opaque to the APP-C handler";
+ leaf Action {
+ description "The actual action to be taken";
+ type string;
+ mandatory true;
+ }
+ leaf TargetID {
+ description "The specific VF a component of which is to be affected";
+ type string;
+ mandatory true;
+ }
+ leaf ObjectID {
+ description "The specific VFC within a VF to be affected";
+ type string;
+ mandatory true;
+ }
+ leaf Payload {
+ description "An action-specific value opaque to the APPC handler.
+ The value can be any valid JSON type (primitive, object, collection of those two).
+ APPC will pass the value as raw JSON string to the executing LCM action.";
+ type string;
+ mandatory true;
+ }
+ }
+
+ grouping ResponseHeader {
+ description "The response to an APP-C command or control is, likewise, encoded in a JSON object. ";
+ container ResponseHeader {
+ description "The response to an APP-C command or control is, likewise, encoded in a JSON object. ";
+ leaf TimeStamp {
+ description "TimeStamp is in ISO 8601 timestamp format ZULU offset";
+ type TIMESTAMP;
+ mandatory true;
+ }
+
+ leaf APIver {
+ description "APIver is the API version identifier. A given release of APPC should support all previous versions of APPC API (correlate with general requirements)";
+ type string;
+ mandatory true;
+ }
+
+ leaf ResponseID {
+ description "ResponseID an identifier of the calling system which can be used addressing purposes, i.e. returning asynchronous response to the proper destination over DMaaP (especially in case of multiple consumers of APP-C APIs)";
+ type string;
+ mandatory true;
+ }
+
+ leaf-list SubResponseID {
+ description "Identifiers that may be generated when multiple responses or handling passes are needed for a given request, allowing the request itself to be tracked";
+ type string;
+ }
+ }
+ }
+
+ grouping ResponseAttributes {
+ description "The response contains the status of executed functionality";
+ container Status {
+ description "The specific response codes are to be aligned with ASDC reference doc (main table removed to avoid duplication and digression from main table). See ASDC and ECOMP Distribution Consumer Interface Agreement";
+ leaf Code {
+ description "Response code value";
+ type uint32;
+ mandatory true;
+ }
+ leaf Value {
+ description "Response code description";
+ type string;
+ mandatory true;
+ }
+ }
+ leaf Payload {
+ description "Payload - the entry is command-specific and is opaque to the APP-C handler.
+ The value can be any valid JSON type (primitive, object, collection of those two).
+ APP-C will pass the value as raw JSON string to appropriate addressee";
+ type string;
+ mandatory false;
+ }
+ }
+
+
+
+
+
+
+ /**********************************************************************************
+ * Define the restart service
+ **********************************************************************************/
+ rpc restart {
+ description "An operation to restart a virtual network function (or VM)";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ leaf payload {
+ type payload;
+ mandatory false;
+ }
+ }
+ output {
+ uses common-header;
+ uses status;
+ }
+ }
+
+ /**********************************************************************************
+ * Define the rebuild service
+ **********************************************************************************/
+ rpc rebuild {
+ description "An operation to rebuild a virtual network function (or VM)";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ leaf payload {
+ type payload;
+ mandatory false;
+ }
+ }
+ output {
+ uses common-header;
+ uses status;
+ }
+ }
+
+ /**********************************************************************************
+ * Define the migrate service
+ **********************************************************************************/
+ rpc migrate {
+ description "An operation to migrate a virtual network function (or VM)";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ leaf payload {
+ type payload;
+ mandatory false;
+ }
+ }
+ output {
+ uses common-header;
+ uses status;
+ }
+ }
+
+ /**********************************************************************************
+ * Define the evacuate service
+ **********************************************************************************/
+ rpc evacuate {
+ description "An operation to evacuate a virtual network function (or VM)";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ leaf payload {
+ type payload;
+ mandatory false;
+ }
+ }
+ output {
+ uses common-header;
+ uses status;
+ }
+ }
+
+
+ /**********************************************************************************
+ * Define the snapshot service
+ **********************************************************************************/
+ rpc snapshot {
+ description "An operation to create a snapshot of a virtual network function (or VM)";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ leaf payload {
+ type payload;
+ mandatory false;
+ }
+ leaf identity-url {
+ type string;
+ mandatory true;
+ }
+ }
+ output {
+ uses common-header;
+ uses status;
+ leaf snapshot-id {
+ type string;
+ }
+
+ }
+ }
+
+ /**********************************************************************************
+ * Define the rollback service
+ **********************************************************************************/
+ rpc rollback {
+ description "An operation to rollback to particular snapshot of a virtual network function (or VM)";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ leaf payload {
+ type payload;
+ mandatory false;
+ }
+ leaf identity-url {
+ type string;
+ mandatory true;
+ }
+ leaf snapshot-id {
+ type string;
+ mandatory true;
+ }
+ }
+ output {
+ uses common-header;
+ uses status;
+ }
+ }
+
+
+ /**********************************************************************************
+ * Additional RPCs added here...
+ **********************************************************************************/
+
+
+ /**********************************************************************************
+ * Define the sync service
+ **********************************************************************************/
+ rpc sync {
+ description "An operation to sync the configurations of a virtual network function (or VM)";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ }
+ output {
+ uses common-header;
+ uses status;
+ }
+ }
+
+ /**********************************************************************************
+ * Define the terminate service
+ **********************************************************************************/
+ rpc terminate {
+ description "An operation to terminate the configurations of a virtual network function (or VM)";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ leaf payload {
+ type payload;
+ mandatory false;
+ }
+ }
+ output {
+ uses common-header;
+ uses status;
+ }
+ }
+
+ /**********************************************************************************
+ * Define the modify-config service
+ **********************************************************************************/
+ rpc modify-config {
+ description "An operation to modify-config the configurations of a virtual network function (or VM)";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ leaf payload {
+ type payload;
+ mandatory false;
+ }
+ }
+ output {
+ uses common-header;
+ uses status;
+ }
+ }
+
+ /**********************************************************************************
+ * Define the test service
+ **********************************************************************************/
+ rpc test {
+ description "An operation to test the configurations of a virtual network function (or VM)";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ leaf payload {
+ type payload;
+ mandatory false;
+ }
+ }
+ output {
+ uses common-header;
+ uses status;
+ }
+ }
+
+ /**********************************************************************************
+ * Define the stop service
+ **********************************************************************************/
+ rpc stop {
+ description "An operation to stop the configurations of a virtual network function (or VM)";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ leaf payload {
+ type payload;
+ mandatory false;
+ }
+ }
+ output {
+ uses common-header;
+ uses status;
+ }
+ }
+
+ /**********************************************************************************
+ * Define the audit service
+ **********************************************************************************/
+ rpc audit {
+ description "An operation to audit the configurations of a virtual network function (or VM)";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ }
+ output {
+ uses common-header;
+ uses status;
+ }
+ }
+
+ /**********************************************************************************
+ * Define the SoftwareUpload vSCP service
+ **********************************************************************************/
+ rpc software-upload {
+ description "An operation to upload a new version of vSCP image to vSCP for updating it";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ leaf payload {
+ type payload;
+ mandatory false;
+ }
+ }
+ output {
+ uses common-header;
+ uses status;
+ }
+ }
+
+
+
+ /**********************************************************************************
+ * Define the PreHealthCheck vSCP service
+ **********************************************************************************/
+ rpc health-check {
+ description "An operation to perform health check of vSCP prior its upgrading";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ leaf payload {
+ type payload;
+ mandatory false;
+ }
+ }
+ output {
+ uses common-header;
+ uses status;
+
+ }
+ }
+
+
+ /**********************************************************************************
+ * Define the Upgrade vSCP service
+ **********************************************************************************/
+ rpc live-upgrade {
+ description "An operation to perform upgrade of vSCP";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ leaf payload {
+ type payload;
+ mandatory false;
+ }
+ }
+ output {
+ uses common-header;
+ uses status;
+ }
+ }
+
+
+ /**********************************************************************************
+ * Define the VNF lock service
+ **********************************************************************************/
+ rpc lock {
+ description "An operation to perform VNF lock operation";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ leaf payload {
+ type payload;
+ mandatory false;
+ }
+ }
+ output {
+ uses common-header;
+ uses status;
+ }
+ }
+
+ /**********************************************************************************
+ * Define the VNF unlock service
+ **********************************************************************************/
+ rpc unlock {
+ description "An operation to perform VNF unlock operation";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ leaf payload {
+ type payload;
+ mandatory false;
+ }
+ }
+ output {
+ uses common-header;
+ uses status;
+ }
+ }
+
+ /**********************************************************************************
+ * Define the VNF check lock service
+ **********************************************************************************/
+ rpc check-lock {
+ description "An operation to check VNF lock status";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ }
+ output {
+ uses common-header;
+ uses status;
+ leaf locked {
+ type enumeration {
+ enum "TRUE";
+ enum "FALSE";
+ }
+ description "TRUE/FALSE - returns TRUE when the given VNF was locked, otherwise returns FALSE";
+ mandatory false;
+ }
+ }
+ }
+
+
+ /**********************************************************************************
+ * Additional RPCs added here...
+ **********************************************************************************/
+}
diff --git a/appc-provider/appc-provider-model/src/main/yang/appc-provider.yang b/appc-provider/appc-provider-model/src/main/yang/appc-provider.yang
new file mode 100644
index 000000000..6bdccf483
--- /dev/null
+++ b/appc-provider/appc-provider-model/src/main/yang/appc-provider.yang
@@ -0,0 +1,620 @@
+/*
+ * Yang model for the Application Controller (APP-C) component of ECOMP
+ *
+ * This model is used to define the data and services of the Application Controller
+ * component of ECOMP. The APP-C controller initiates the processing of directed
+ * graphs, which define the actual process implementations used. The name of the
+ * directed graph is set by properties and cannot be changed dynamically.
+ *
+ * The services exposed by this provider are:
+ *
+ * restart-vnf:
+ * Used to request a restart of a virtual network function (a VM).
+ *
+ * rebuild-vnf:
+ * Used to request a rebuild of a virtual network function (a VM).
+ *
+ */
+
+module appc-provider {
+
+ yang-version 1;
+ namespace "org:openecomp:appc";
+ prefix appc-provider;
+ organization "Copyright 2017 AT&T Intellectual Property.";
+
+ description
+ "Defines the services and request/response requirements for the ECOMP APP-C component.";
+
+ /*
+ * Note, the revision changes the package name of the generated java code. Do not
+ * change the revision unless you also update all references to the bindings.
+ */
+ revision "2016-01-04" {
+ description
+ "APP-C interface version 1.0.48";
+ }
+
+ /**********************************************************************************
+ * Data type definitions
+ *
+ * The following data type definitions are used to define common data structures,
+ * define constraints, or to impart special meanings to data objects related to the
+ * APP-C controller functions.
+ **********************************************************************************/
+
+ /*
+ * Define a common definition of a UUID
+ */
+ typedef UUID {
+ type string {
+ length "1..255";
+ }
+ description "Universally Unique ID";
+ }
+
+ /*
+ * Define the name of the provider region/LCP to connect to
+ */
+ typedef LCP {
+ type string {
+ length "1..255";
+ }
+ description "The local control plane name (OpenStack region name) of the provider";
+ }
+
+ /*
+ * Define a common definition of a time stamp (expressed as a formatted string) as follows
+ *
+ * yyyy-MM-dd HH:mm:ss.SSSSSSSS
+ *
+ * yyyy ...... exactly 4 digit year, e.g., 2015
+ * MM ........ 1 or 2 digit month of year, e.g., 7
+ * dd ........ 1 or 2 digit day of month, e.g., 29
+ * HH ........ 1 or 2 digit hour of day (24-hour clock) in UTC, e.g., 17
+ * mm ........ 1 or 2 digit minute of the hour, e.g. 31
+ * ss ........ 1 or 2 digit seconds of the minute, e.g., 28
+ * SSSSSS .... 1-6 digit microseconds
+ */
+ typedef TIMESTAMP {
+ type string {
+ length "16..28";
+ pattern "[0-9]{4}-[0-9]{1,2}-[0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]{1,6}";
+ }
+ }
+
+ typedef ZULU {
+ type string {
+ length "16..28";
+ pattern "[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]{1,6}Z";
+ }
+ }
+
+ typedef payload {
+ type string ;
+ description "The payload can be any valid JSON string value. Json escape characters need to be added when required to include an inner json within the payload to make it a valid json string value";
+ }
+
+ typedef action {
+ type enumeration {
+ enum "Restart";
+ enum "Rebuild";
+ enum "Migrate";
+ enum "Evacuate";
+ enum "Snapshot";
+ enum "ModifyConfig";
+ }
+ description "The action to be taken by APP-C, e.g. Test, Start, Terminate";
+ }
+
+ /**********************************************************************************
+ * All requests will include this standard header
+ *
+ * The standard request header is used to define a correlation identification for
+ * the request that is returned on all responses. This correlation identifier
+ * (called the service-request-id) is meaningful to the caller and is included on
+ * all responses from the services.
+ **********************************************************************************/
+ grouping common-request-header {
+ description "A common header for all requests";
+ container common-request-header {
+ leaf service-request-id {
+ description "An identifier meaningful to the caller to correlate all responses";
+ type string;
+ mandatory true;
+ }
+
+ leaf time-to-live {
+ description "The alloted time to perform the operation, in seconds. If the
+ operation cannot be completed in this amount of time, the operation is
+ aborted. If set to zero, no timeout exists and the operation will continue
+ until it completes or fails. If omitted, the default value of 0 is used.";
+ type uint32 {
+ range "0..86400";
+ }
+ mandatory false;
+ }
+ }
+ }
+
+ /**********************************************************************************
+ * Basic manipulation of a VNF (or VM) will typically include querying the current
+ * state, restarting, rebuilding, stopping, starting, etc. In all of these basic
+ * "state"-type operations, the services require the identification of the VNF to
+ * be operated on, and the region or LCP that contains that resource. This
+ * information is used across all of these services, so it has been defined as a
+ * common structure here and is referenced in the appropriate RPC definitions.
+ **********************************************************************************/
+ grouping vnf-resource {
+ description "The data that uniquely identifies a virtual network function (or vm)";
+ container vnf-resource {
+ leaf vm-id {
+ description "The UUID of the resource. For backwards compatibility, this can be
+ the self-link URL of the VM.";
+ type UUID;
+ mandatory true;
+ }
+ leaf identity-url {
+ description "The identity url used to access the resource";
+ type UUID;
+ mandatory false;
+ }
+ leaf tenant-id {
+ description "The id of the provider tenant that owns the resource";
+ type string;
+ mandatory false;
+ }
+ }
+ }
+
+ /**********************************************************************************
+ * All responses will include this standard header
+ *
+ * The standard response header includes the time of completion as well as a
+ * success|failure indication
+ **********************************************************************************/
+ grouping common-response-header {
+ description "A common header for all responses defining success or failure
+ and the time stamp when completed";
+ container common-response-header {
+ leaf service-request-id {
+ description "An identifier meaningful to the caller to correlate all responses";
+ type string;
+ }
+ leaf success {
+ description "True indicates the request was successful";
+ type boolean;
+ }
+ leaf reason {
+ description "If success=false, the failure reason. Otherwise, undefined.";
+ type string;
+ }
+ leaf completed {
+ description "The formatted time stamp when the operation was completed.";
+ type TIMESTAMP;
+ }
+ leaf duration {
+ description "The amount of time used (in seconds) to process the request";
+ type uint32;
+ }
+ }
+ }
+
+
+ /**********************************************************************************
+ * All requests/response will include this standard header
+ *
+ * The standard common header is used to define a correlation identification for
+ * the request that is returned on all responses.
+ **********************************************************************************/
+ grouping common-header {
+ description "A common header for all APP-C requests";
+ container common-header {
+ description "A common header for all APP-C requests";
+ leaf timestamp {
+ description "timestamp is in ISO 8601 timestamp format ZULU offset";
+ type ZULU;
+ mandatory true;
+ }
+
+ leaf api-ver {
+ description "api-ver is the API version identifier. A given release of APPC should support all previous versions of APPC API (correlate with general requirements)";
+ type string;
+ mandatory true;
+ }
+
+ leaf originator-id {
+ description "originator-id an identifier of the calling system which can be used addressing purposes, i.e. returning asynchronous response to the proper destination over DMaaP (especially in case of multiple consumers of APP-C APIs)";
+ type string;
+ mandatory true;
+ }
+
+ leaf request-id {
+ description "UUID for the request ID. An OSS/BSS identifier for the request that caused the current action. Multiple API calls may be made with the same request-id The request-id shall be recorded throughout the operations on a single request";
+ type string;
+ mandatory true;
+ }
+
+ leaf sub-request-id {
+ description "Uniquely identifies a specific LCM action. It is persistent over the life-cycle of a single request";
+ type string;
+ mandatory false;
+ }
+
+
+ /**********************************************************************************
+ * Flags are generic flags that apply to any and all commands, all are optional
+ * force = TRUE/FALSE - Execute command even if target is in unstable (i.e. locked, transiting, etc) state. Specific behaviour of forced commands varies, but implies cancellation of previous command and an override by the new command. The FALSE value is used by default.
+ * ttl = <0....N> - The timeout value for command execution, expressed in seconds
+ * mode = EXCLUSIVE/NORMAL - defines execution mode as follows:
+ * - EXCLUSIVE ? on encountering an exclusive command, the APP-C will:
+ * * Cease accepting additional command requests
+ * * Complete execution of outstanding commands
+ * * Execute the exclusive command to completion
+ * * Optionally report the result of the command
+ * * Optionally resume command acceptance and processing
+ * - NORMAL - Obverse of EXCLUSIVE, the default one.
+ **********************************************************************************/
+ container flags {
+ description "Flags are generic flags that apply to any and all commands, all are optional";
+ leaf mode {
+ type enumeration {
+ enum "EXCLUSIVE";
+ enum "NORMAL";
+ }
+ description "EXCLUSIVE (accept no queued requests on this VNF while processing) or NORMAL (queue other requests until complete)";
+ mandatory false;
+ }
+ leaf force {
+ type enumeration {
+ enum "TRUE";
+ enum "FALSE";
+ }
+ description "TRUE/FALSE - Execute action even if target is in unstable (i.e. locked, transiting, etc.) state";
+ mandatory false;
+ }
+ leaf ttl {
+ description "<0....N> -Â The timeout value (expressed in seconds) for action execution, between action being received by APPC and action initiation";
+ type uint16;
+ mandatory false;
+ }
+ }
+ }
+ }
+
+ grouping config-payload {
+ description "Payload for modify config on traffic generator";
+ container config-payload {
+ description "Payload for modify config on traffic generator";
+ leaf config-url {
+ description "this is the restconf interface for vTrafficGenerator";
+ type string;
+ mandatory true;
+ }
+
+ leaf config-json {
+ description "this is the configuration data";
+ type string;
+ mandatory true;
+ }
+ }
+ }
+
+
+ grouping action-identifiers {
+ description "A block containing the action arguments. These are used to specify the object upon which APP-C LCM command is to operate";
+ container action-identifiers {
+ description "A block containing the action arguments. These are used to specify the object upon which APP-C LCM command is to operate";
+ leaf service-instance-id {
+ description "identifies a specific service the command refers to. When multiple APP-C instances are used and applied to a subset of services, this will become significant . The field is mandatory when the vnf-id is empty";
+ type string;
+ mandatory false;
+ }
+ leaf vnf-id {
+ description "identifies the VNF to which this action is to be applied(vnf-id uniquely identifies the service-instance referred to). Note that some actions are applied to multiple VNFs in the same service. When this is the case, vnf-id may be left out, but service-instance-id must appear. The field is mandatory when service-instance-id is empty";
+ type string;
+ mandatory false;
+ }
+ leaf vnfc-name {
+ description "identifies the VNFC to which this action is to be applied. Some actions apply only to a component within a VNF (e.g. RESTART is sometimes applied to on VM only). In such a case, the name of the VNFC is used to search for the component within the VNF";
+ type string;
+ mandatory false;
+ }
+ leaf vserver-id {
+ description "identifies a specific VM within the given service/vnf to which this action is to be applied";
+ type string;
+ mandatory false;
+ }
+ }
+ }
+
+ grouping status {
+ description "The specific response codes are to be aligned with ASDC reference doc (main table removed to avoid duplication and digression from main table). See ASDC and ECOMP Distribution Consumer Interface Agreement";
+ container status {
+ description "The specific response codes are to be aligned with ASDC reference doc (main table removed to avoid duplication and digression from main table). See ASDC and ECOMP Distribution Consumer Interface Agreement";
+ leaf code {
+ description "Response code";
+ type uint16;
+ mandatory true;
+ }
+ leaf message {
+ description "Response message";
+ type string;
+ mandatory true;
+ }
+ }
+ }
+
+
+ /**********************************************************************************
+ * NEW API ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ * All requests will include this standard header
+ *
+ * The standard request header is used to define a correlation identification for
+ * the request that is returned on all responses. This correlation identifier
+ * (called the service-request-id) is meaningful to the caller and is included on
+ * all responses from the services.
+ **********************************************************************************/
+ grouping RequestHeader {
+ container RequestHeader {
+ description "A common header for all APP-C requests";
+ leaf TimeStamp {
+ description "TimeStamp is in ISO 8601 timestamp format ZULU offset";
+ type TIMESTAMP;
+ mandatory true;
+ }
+
+ leaf APIver {
+ description "APIver is the API version identifier. A given release of APPC should support all previous versions of APPC API (correlate with general requirements)";
+ type string;
+ mandatory true;
+ }
+
+ leaf OriginatorID {
+ description "OriginatorID an identifier of the calling system which can be used addressing purposes, i.e. returning asynchronous response to the proper destination over DMaaP (especially in case of multiple consumers of APP-C APIs)";
+ type string;
+ mandatory true;
+ }
+
+ leaf TransactionID {
+ description "Identifiers that may be generated when multiple responses or handling passes are needed for a given request, allowing the request itself to be tracked";
+ type string;
+ mandatory true;
+ }
+
+ leaf-list RequestTrack {
+ description "Identifiers that may be generated when multiple responses or handling passes are needed for a given request, allowing the request itself to be tracked";
+ type string;
+ }
+
+ /**********************************************************************************
+ * Flags are generic flags that apply to any and all commands, all are optional
+ * FORCE = TRUE/FALSE - Execute command even if target is in unstable (i.e. locked, transiting, etc) state. Specific behaviour of forced commands varies, but implies cancellation of previous command and an override by the new command. The FALSE value is used by default.
+ * TTL = <0....N> - The timeout value for command execution, expressed in seconds
+ * MODE = EXCLUSIVE/NORMAL - defines execution mode as follows:
+ * - EXCLUSIVE � on encountering an exclusive command, the APP-C will:
+ * * Cease accepting additional command requests
+
+ * Complete execution of outstanding commands
+ * * Execute the exclusive command to completion
+ * * Optionally report the result of the command
+ * * Optionally resume command acceptance and processing
+ * - NORMAL - Obverse of EXCLUSIVE, the default one.
+ **********************************************************************************/
+ container Flags {
+ description "Flags are generic flags that apply to any and all commands, all are optional";
+ leaf FORCE {
+ description "TRUE/FALSE - Execute action even if target is in unstable (i.e. locked, transiting, etc) state.";
+ type string;
+ mandatory false;
+ }
+ leaf TTL {
+ description "<0....N> - The timeout value for action execution, expressed in seconds";
+ type string;
+ mandatory false;
+ }
+ leaf MODE {
+ description "EXCLUSIVE/NORMAL - defines execution mode";
+ type string;
+ mandatory false;
+ }
+ }
+ }
+ }
+
+ grouping RequestParameters {
+ description "The request contains the entry of command-specific and is opaque to the APP-C handler";
+ leaf Action {
+ description "The actual action to be taken";
+ type string;
+ mandatory true;
+ }
+ leaf TargetID {
+ description "The specific VF a component of which is to be affected";
+ type string;
+ mandatory true;
+ }
+ leaf ObjectID {
+ description "The specific VFC within a VF to be affected";
+ type string;
+ mandatory true;
+ }
+ leaf Payload {
+ description "An action-specific value opaque to the APPC handler.
+ The value can be any valid JSON type (primitive, object, collection of those two).
+ APPC will pass the value as raw JSON string to the executing LCM action.";
+ type string;
+ mandatory true;
+ }
+ }
+
+ grouping ResponseHeader {
+ description "The response to an APP-C command or control is, likewise, encoded in a JSON object. ";
+ container ResponseHeader {
+ description "The response to an APP-C command or control is, likewise, encoded in a JSON object. ";
+ leaf TimeStamp {
+ description "TimeStamp is in ISO 8601 timestamp format ZULU offset";
+ type TIMESTAMP;
+ mandatory true;
+ }
+
+ leaf APIver {
+ description "APIver is the API version identifier. A given release of APPC should support all previous versions of APPC API (correlate with general requirements)";
+ type string;
+ mandatory true;
+ }
+
+ leaf ResponseID {
+ description "ResponseID an identifier of the calling system which can be used addressing purposes, i.e. returning asynchronous response to the proper destination over DMaaP (especially in case of multiple consumers of APP-C APIs)";
+ type string;
+ mandatory true;
+ }
+
+ leaf-list SubResponseID {
+ description "Identifiers that may be generated when multiple responses or handling passes are needed for a given request, allowing the request itself to be tracked";
+ type string;
+ }
+ }
+ }
+
+ grouping ResponseAttributes {
+ description "The response contains the status of executed functionality";
+ container Status {
+ description "The specific response codes are to be aligned with ASDC reference doc (main table removed to avoid duplication and digression from main table). See ASDC and ECOMP Distribution Consumer Interface Agreement";
+ leaf Code {
+ description "Response code value";
+ type uint32;
+ mandatory true;
+ }
+ leaf Value {
+ description "Response code description";
+ type string;
+ mandatory true;
+ }
+ }
+ leaf Payload {
+ description "Payload - the entry is command-specific and is opaque to the APP-C handler.
+ The value can be any valid JSON type (primitive, object, collection of those two).
+ APP-C will pass the value as raw JSON string to appropriate addressee";
+ type string;
+ mandatory false;
+ }
+ }
+
+
+
+
+ /**********************************************************************************
+ * Define the restart service
+ **********************************************************************************/
+ rpc restart {
+ description "An operation to restart a virtual network function (or VM)";
+ input {
+ uses common-request-header;
+ uses vnf-resource;
+ }
+ output {
+ uses common-response-header;
+ leaf vm-id {
+ description "The UUID of the VM that was restarted";
+ type UUID;
+ }
+ }
+ }
+
+ /**********************************************************************************
+ * Define the rebuild service
+ **********************************************************************************/
+ rpc rebuild {
+ description "An operation to rebuild a virtual network function (or VM)";
+ input {
+ uses common-request-header;
+ uses vnf-resource;
+ }
+ output {
+ uses common-response-header;
+ leaf new-vm-id {
+ description "The UUID of the VM after rebuild. If the UUID was changed,
+ this contains the new UUID. If it was not changed, this contains
+ the original UUID";
+ type UUID;
+ }
+ leaf original-vm-id {
+ description "The UUID of the VM before rebuild (i.e., the original UUID)";
+ type UUID;
+ }
+ }
+ }
+
+ /**********************************************************************************
+ * Define the migrate service
+ **********************************************************************************/
+ rpc migrate {
+ description "An operation to migrate a virtual network function (or VM)";
+ input {
+ uses common-request-header;
+ uses vnf-resource;
+ }
+ output {
+ uses common-response-header;
+ leaf vm-id {
+ description "The UUID of the VM that was migrated.";
+ type UUID;
+ }
+ }
+ }
+
+ /**********************************************************************************
+ * Define the evacuate service
+ **********************************************************************************/
+ rpc evacuate {
+ description "An operation to evacuate a virtual network function (or VM)";
+ input {
+ uses common-request-header;
+ uses vnf-resource;
+ }
+ output {
+ uses common-response-header;
+ leaf vm-id {
+ description "The UUID of the VM that was evacuated";
+ type UUID;
+ }
+ }
+ }
+
+
+ /**********************************************************************************
+ * Define the snapshot service
+ **********************************************************************************/
+ rpc snapshot {
+ description "An operation to create a snapshot of a virtual network function (or VM)";
+ input {
+ uses common-request-header;
+ uses vnf-resource;
+ }
+ output {
+ uses common-response-header;
+ leaf vm-id {
+ description "The UUID of the VM that was snapshot";
+ type UUID;
+ }
+ }
+ }
+
+ rpc ModifyConfig {
+ description "An operation to modify-config the configurations of a virtual network function (or VM)";
+ input {
+ uses common-request-header;
+ uses config-payload;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ }
+ output {
+ uses common-response-header;
+ }
+ }
+
+
+}
diff --git a/appc-provider/features/.gitignore b/appc-provider/features/.gitignore
new file mode 100644
index 000000000..ae3c17260
--- /dev/null
+++ b/appc-provider/features/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/appc-provider/pom.xml b/appc-provider/pom.xml
new file mode 100644
index 000000000..9584aa23b
--- /dev/null
+++ b/appc-provider/pom.xml
@@ -0,0 +1,24 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc</artifactId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>appc-provider</artifactId>
+ <packaging>pom</packaging>
+ <name>APPC Provider</name>
+ <description>The app-c service provider bundle</description>
+ <properties>
+ <feature-name>appc-provider</feature-name>
+ </properties>
+ <!-- ================================================================================== -->
+ <!-- The modules we build -->
+ <!-- ================================================================================== -->
+ <modules>
+ <module>appc-provider-model</module>
+ <module>appc-provider-features</module>
+ <module>appc-provider-installer</module>
+ <module>appc-provider-bundle</module>
+ </modules>
+</project> \ No newline at end of file
diff --git a/appc-provider/provider/.gitignore b/appc-provider/provider/.gitignore
new file mode 100644
index 000000000..ae3c17260
--- /dev/null
+++ b/appc-provider/provider/.gitignore
@@ -0,0 +1 @@
+/bin/