diff options
Diffstat (limited to 'ms')
42 files changed, 1973 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/.gitignore b/ms/blueprintsprocessor/.gitignore new file mode 100644 index 000000000..8dd19d0d3 --- /dev/null +++ b/ms/blueprintsprocessor/.gitignore @@ -0,0 +1,28 @@ +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +.classpath +.settings/ + +# Target dirs in all projects +**/target-ide/* +**/target/* +**/logs/* +**/tokens/* + +# Added for Intellij IDEA IDE +**/debug-logs/* +**/.idea/* +**/*.iml +**/*.project +**/.springBeans + +**/*versionsBackup +**/blackDuckHub* +**/*.jsonld
\ No newline at end of file diff --git a/ms/blueprintsprocessor/application/pom.xml b/ms/blueprintsprocessor/application/pom.xml new file mode 100644 index 000000000..ea422600a --- /dev/null +++ b/ms/blueprintsprocessor/application/pom.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ 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. + --> +<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.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>parent</artifactId> + <version>0.0.3-SNAPSHOT</version> + <relativePath>../parent</relativePath> + </parent> + <artifactId>application</artifactId> + <packaging>jar</packaging> + <name>Blueprints Processor Application</name> + <description>Blueprints Processor Application</description> + + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-devtools</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>resource-api</artifactId> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>selfservice-api</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> +</project> diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplication.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplication.java new file mode 100644 index 000000000..2a13f9293 --- /dev/null +++ b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplication.java @@ -0,0 +1,39 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.web.reactive.config.EnableWebFlux;
+
+/**
+ * BlueprintProcessorApplication
+ *
+ * @author Brinda Santh 8/14/2018
+ */
+@SpringBootApplication
+@EnableAutoConfiguration
+@EnableWebFlux
+@ComponentScan(basePackages = {"org.onap.ccsdk.apps.controllerblueprints",
+ "org.onap.ccsdk.apps.blueprintsprocessor"})
+public class BlueprintProcessorApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(BlueprintProcessorApplication.class, args);
+ }
+}
diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/SwaggerConfig.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/SwaggerConfig.java new file mode 100644 index 000000000..0b5f62278 --- /dev/null +++ b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/SwaggerConfig.java @@ -0,0 +1,72 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.bind.annotation.RequestMapping;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * SwaggerConfig
+ *
+ * @author Brinda Santh 8/13/2018
+ */
+@Configuration
+@EnableSwagger2
+public class SwaggerConfig {
+ private static final Set<String> DEFAULT_PRODUCES_AND_CONSUMES =
+ new HashSet<String>(Arrays.asList("application/json",
+ "application/xml"));
+ private static Logger log = LoggerFactory.getLogger(SwaggerConfig.class);
+
+ @Bean
+ public Docket api() {
+ return new Docket(DocumentationType.SWAGGER_2)
+ .select()
+ .apis(RequestHandlerSelectors.any())
+ .paths(PathSelectors.any())
+ .build()
+ .apiInfo(apiInfo());
+ }
+
+ private ApiInfo apiInfo() {
+ return new ApiInfo(
+ "Blueprints Processor API",
+ "Controller blueprints processor API for VNF Selfservice.",
+ "1.0.0",
+ "Terms of service",
+ new Contact("Brinda Santh", "www.onap.com", "bs2796@onap.com"),
+ "Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0", Collections.emptyList());
+ }
+
+
+}
diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/WebConfig.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/WebConfig.java new file mode 100644 index 000000000..f1b8f9d6f --- /dev/null +++ b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/WebConfig.java @@ -0,0 +1,39 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.format.FormatterRegistry;
+import org.springframework.web.reactive.config.*;
+
+/**
+ * WebConfig
+ *
+ * @author Brinda Santh 8/13/2018
+ */
+@Configuration
+public class WebConfig extends WebFluxConfigurationSupport {
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ registry.addResourceHandler("swagger-ui.html")
+ .addResourceLocations("classpath:/META-INF/resources/");
+
+ registry.addResourceHandler("/webjars/**")
+ .addResourceLocations("classpath:/META-INF/resources/webjars/");
+ }
+}
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application.properties b/ms/blueprintsprocessor/application/src/main/resources/application.properties new file mode 100644 index 000000000..f30a7f12e --- /dev/null +++ b/ms/blueprintsprocessor/application/src/main/resources/application.properties @@ -0,0 +1,15 @@ +#
+# Copyright © 2017-2018 AT&T Intellectual Property.
+#
+# 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.
+#
\ No newline at end of file diff --git a/ms/blueprintsprocessor/application/src/main/resources/logback.xml b/ms/blueprintsprocessor/application/src/main/resources/logback.xml new file mode 100644 index 000000000..a97bb8c3d --- /dev/null +++ b/ms/blueprintsprocessor/application/src/main/resources/logback.xml @@ -0,0 +1,36 @@ +<!--
+ ~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~
+ ~ 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.
+ -->
+
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+
+ <logger name="org.springframework" level="info"/>
+ <logger name="org.springframework.web" level="info"/>
+ <logger name="org.hibernate" level="error"/>
+ <logger name="org.onap.ccsdk.apps" level="info"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
diff --git a/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplicationTest.java b/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplicationTest.java new file mode 100644 index 000000000..3cba1f9e5 --- /dev/null +++ b/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplicationTest.java @@ -0,0 +1,55 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor;
+
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+/**
+ * BlueprintProcessorApplicationTest
+ *
+ * @author Brinda Santh
+ * DATE : 8/14/2018
+ */
+
+@RunWith(SpringRunner.class)
+@ContextConfiguration(classes = BlueprintProcessorApplication.class)
+//@SpringBootTest(classes = BlueprintProcessorApplication.class,
+// webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+public class BlueprintProcessorApplicationTest {
+
+ @Autowired
+ private ApplicationContext context;
+
+ @Before
+ public void setUp() {
+
+ }
+
+ @Test
+ public void testSample(){
+ Assert.assertNotNull("Failed to create Application Context ", context);
+ }
+
+}
diff --git a/ms/blueprintsprocessor/modules/commons/adaptors/pom.xml b/ms/blueprintsprocessor/modules/commons/adaptors/pom.xml new file mode 100644 index 000000000..efd7d74b3 --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/adaptors/pom.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ 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. + --> +<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.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>commons</artifactId> + <version>0.0.3-SNAPSHOT</version> + </parent> + + <artifactId>adaptors</artifactId> + <packaging>pom</packaging> + <name>Blueprints Processor Adaptors POM</name> + <description>Blueprints Processor Adaptors</description> + <modules> + + </modules> + +</project> diff --git a/ms/blueprintsprocessor/modules/commons/core/pom.xml b/ms/blueprintsprocessor/modules/commons/core/pom.xml new file mode 100644 index 000000000..a601560bb --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/core/pom.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ 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. + --> +<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.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>commons</artifactId> + <version>0.0.3-SNAPSHOT</version> + </parent> + + <artifactId>core</artifactId> + <packaging>jar</packaging> + <name>Blueprints Processor Core</name> + <description>Blueprints Processor Core</description> + + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>db-lib</artifactId> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>rest-lib</artifactId> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.apps</groupId> + <artifactId>controllerblueprints-resource-dict</artifactId> + </dependency> + </dependencies> +</project> diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt new file mode 100644 index 000000000..4836cd243 --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt @@ -0,0 +1,131 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.core.api.data
+
+import com.fasterxml.jackson.annotation.JsonFormat
+import com.fasterxml.jackson.databind.node.ObjectNode
+import io.swagger.annotations.ApiModelProperty
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
+
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+/**
+ * BlueprintProcessorData
+ * @author Brinda Santh
+ * DATE : 8/15/2018
+ */
+
+open class ResourceResolutionInput {
+ @get:ApiModelProperty(required=true)
+ lateinit var commonHeader: CommonHeader
+ @get:ApiModelProperty(required=true)
+ lateinit var actionIdentifiers: ActionIdentifiers
+ @get:ApiModelProperty(required=true)
+ lateinit var resourceAssignments: List<ResourceAssignment>
+ @get:ApiModelProperty(required=true )
+ lateinit var payload: ObjectNode
+}
+
+open class ResourceResolutionOutput {
+ @get:ApiModelProperty(required=true)
+ lateinit var commonHeader: CommonHeader
+ @get:ApiModelProperty(required=true)
+ lateinit var actionIdentifiers: ActionIdentifiers
+ @get:ApiModelProperty(required=true)
+ lateinit var status: Status
+ @get:ApiModelProperty(required=true)
+ lateinit var resourceAssignments: List<ResourceAssignment>
+}
+
+open class ExecutionServiceInput {
+ @get:ApiModelProperty(required=true)
+ lateinit var commonHeader: CommonHeader
+ @get:ApiModelProperty(required=true)
+ lateinit var actionIdentifiers: ActionIdentifiers
+ @get:ApiModelProperty(required=true)
+ lateinit var payload: ObjectNode
+}
+
+open class ExecutionServiceOutput {
+ @get:ApiModelProperty(required=true)
+ lateinit var commonHeader: CommonHeader
+ @get:ApiModelProperty(required=true)
+ lateinit var actionIdentifiers: ActionIdentifiers
+ @get:ApiModelProperty(required=true)
+ lateinit var status: Status
+ @get:ApiModelProperty(required=true)
+ lateinit var payload: ObjectNode
+}
+
+open class ActionIdentifiers {
+ @get:ApiModelProperty(required=false)
+ lateinit var blueprintName: String
+ @get:ApiModelProperty(required=false)
+ lateinit var blueprintVersion: String
+ @get:ApiModelProperty(required=true)
+ lateinit var actionName: String
+ @get:ApiModelProperty(required=true, allowableValues = "sync, async")
+ lateinit var mode: String
+}
+
+open class CommonHeader {
+ @get:ApiModelProperty(required=true, example = "2012-04-23T18:25:43.511Z")
+ @get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
+ lateinit var timestamp: String
+ @get:ApiModelProperty(required=true)
+ lateinit var originatorId: String
+ @get:ApiModelProperty(required=true)
+ lateinit var requestId: String
+ @get:ApiModelProperty(required=true)
+ lateinit var subRequestId: String
+ @get:ApiModelProperty(required=false)
+ var flags: Flags? = null
+}
+
+open class Flags {
+ var isForce: Boolean = false
+ @get:ApiModelProperty(value = "3600")
+ var ttl: Int = 3600
+}
+
+open class Status {
+ @get:ApiModelProperty(required=true)
+ var code: Int = 200
+ @get:ApiModelProperty(required=false)
+ var errorMessage: String? = null
+ @get:ApiModelProperty(required=true)
+ lateinit var message: String
+}
+
+
+
+
+
diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorException.kt b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorException.kt new file mode 100644 index 000000000..df4d67038 --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorException.kt @@ -0,0 +1,48 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.core.api.data
+
+/**
+ * BlueprintProcessorException
+ * @author Brinda Santh
+ * DATE : 8/15/2018
+ */
+open class BlueprintProcessorException : Exception {
+ var code: Int = 100
+
+ constructor(cause: Throwable) : super(cause)
+ constructor(message: String) : super(message)
+ constructor(message: String, cause: Throwable) : super(message, cause)
+ constructor(cause: Throwable, message: String, vararg args: Any?) : super(String.format(message, *args), cause)
+
+ constructor(code: Int, cause: Throwable) : super(cause) {
+ this.code = code
+ }
+
+ constructor(code: Int, message: String) : super(message) {
+ this.code = code
+ }
+
+ constructor(code: Int, message: String, cause: Throwable) : super(message, cause) {
+ this.code = code
+ }
+
+ constructor(code: Int, cause: Throwable, message: String, vararg args: Any?)
+ : super(String.format(message, *args), cause) {
+ this.code = code
+ }
+}
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/resources/application.properties b/ms/blueprintsprocessor/modules/commons/core/src/main/resources/application.properties new file mode 100644 index 000000000..2ce871476 --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/core/src/main/resources/application.properties @@ -0,0 +1,16 @@ +#
+# Copyright © 2017-2018 AT&T Intellectual Property.
+#
+# 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.
+#
+
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml new file mode 100644 index 000000000..31abb40df --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ 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. + --> +<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.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>commons</artifactId> + <version>0.0.3-SNAPSHOT</version> + </parent> + + <artifactId>db-lib</artifactId> + <packaging>jar</packaging> + <name>Blueprints Processor DB Lib</name> + <description>Blueprints Processor DB Lib</description> + + <dependencies> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + </dependency> + <dependency> + <groupId>javax.validation</groupId> + <artifactId>validation-api</artifactId> + </dependency> + + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-testing</artifactId> + <scope>test</scope> + </dependency> + + </dependencies> + +</project> diff --git a/ms/blueprintsprocessor/modules/commons/pom.xml b/ms/blueprintsprocessor/modules/commons/pom.xml new file mode 100644 index 000000000..83a3cb8b6 --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/pom.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ 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. + --> +<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.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>modules</artifactId> + <version>0.0.3-SNAPSHOT</version> + </parent> + + <artifactId>commons</artifactId> + <packaging>pom</packaging> + <name>Blueprints Processor Commons POM</name> + <description>Blueprints Processor Commons</description> + + <modules> + <module>db-lib</module> + <module>rest-lib</module> + <module>adaptors</module> + <module>core</module> + </modules> + <dependencies> + <dependency> + <groupId>com.fasterxml.jackson.module</groupId> + <artifactId>jackson-module-kotlin</artifactId> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-stdlib-jdk8</artifactId> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-reflect</artifactId> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.projectreactor</groupId> + <artifactId>reactor-test</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + +</project> diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml new file mode 100644 index 000000000..d671f120e --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ 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. + --> +<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.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>commons</artifactId> + <version>0.0.3-SNAPSHOT</version> + </parent> + + <artifactId>rest-lib</artifactId> + <packaging>jar</packaging> + <name>Blueprints Processor Rest Lib</name> + <description>Blueprints Processor Rest Lib</description> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-webflux</artifactId> + </dependency> + </dependencies> + +</project> diff --git a/ms/blueprintsprocessor/modules/inbounds/pom.xml b/ms/blueprintsprocessor/modules/inbounds/pom.xml new file mode 100644 index 000000000..1b9d2782c --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/pom.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ 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. + --> +<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.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>modules</artifactId> + <version>0.0.3-SNAPSHOT</version> + </parent> + + <artifactId>inbounds</artifactId> + <packaging>pom</packaging> + <name>Blueprints Processor Inbounds POM</name> + <description>Blueprints Processor Inbounds</description> + + <modules> + <module>resource-api</module> + <module>selfservice-api</module> + </modules> + <dependencies> + + + + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>execution-service</artifactId> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>resolution-service</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-actuator</artifactId> + </dependency> + </dependencies> +</project> diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml new file mode 100644 index 000000000..6ed7c9da2 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ 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. + --> +<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.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>inbounds</artifactId> + <version>0.0.3-SNAPSHOT</version> + </parent> + + <artifactId>resource-api</artifactId> + <packaging>jar</packaging> + <name>Blueprints Processor Resource API</name> + <description>Blueprints Processor Resource API</description> + +</project> diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/resource/api/ResourceResolutionController.java b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/resource/api/ResourceResolutionController.java new file mode 100644 index 000000000..8aeb41531 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/resource/api/ResourceResolutionController.java @@ -0,0 +1,56 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.resource.api;
+
+import io.swagger.annotations.ApiOperation;
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionInput;
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionOutput;
+import org.onap.ccsdk.apps.blueprintsprocessor.services.resolution.ResourceResolutionService;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+import reactor.core.publisher.Mono;
+
+/**
+ * ResourceResolutionController
+ *
+ * @author Brinda Santh Date : 8/13/2018
+ */
+
+@RestController
+@RequestMapping("/api/v1/resource")
+public class ResourceResolutionController {
+
+ private ResourceResolutionService resourceResolutionService;
+
+ public ResourceResolutionController(ResourceResolutionService resourceResolutionService) {
+ this.resourceResolutionService = resourceResolutionService;
+ }
+
+ @RequestMapping(path = "/ping", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public @ResponseBody
+ Mono<String> ping() {
+ return Mono.just("Success");
+ }
+
+ @RequestMapping(path = "/resolve-mapping", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
+ @ApiOperation(value = "Resolve Resource Mappings",
+ notes = "Also returns a link to retrieve all students with rel - all-students")
+ public @ResponseBody
+ Mono<ResourceResolutionOutput> resolveResource(@RequestBody ResourceResolutionInput resourceResolutionInput) {
+ return Mono.just(resourceResolutionService.resolveResource(resourceResolutionInput));
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml new file mode 100644 index 000000000..a777c08c1 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ 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. + --> +<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.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>inbounds</artifactId> + <version>0.0.3-SNAPSHOT</version> + </parent> + + <artifactId>selfservice-api</artifactId> + <packaging>jar</packaging> + <name>Blueprints Processor Selfservice API</name> + <description>Blueprints Processor Selfservice API</description> + +</project> diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.java b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.java new file mode 100644 index 000000000..75407c520 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.java @@ -0,0 +1,55 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api;
+
+import io.swagger.annotations.ApiOperation;
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput;
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput;
+import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.ExecutionService;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+import reactor.core.publisher.Mono;
+
+/**
+ * ExecutionServiceController
+ *
+ * @author Brinda Santh 8/14/2018
+ */
+@RestController
+@RequestMapping("/api/v1/execution-service")
+public class ExecutionServiceController {
+
+ private ExecutionService executionService;
+
+ public ExecutionServiceController(ExecutionService executionService) {
+ this.executionService = executionService;
+ }
+
+ @RequestMapping(path = "/ping", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public @ResponseBody
+ Mono<String> ping() {
+ return Mono.just("Success");
+ }
+
+ @RequestMapping(path = "/process", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
+ @ApiOperation(value = "Resolve Resource Mappings",
+ notes = "Takes the blueprint information and process as per the payload")
+ public @ResponseBody
+ Mono<ExecutionServiceOutput> process(@RequestBody ExecutionServiceInput executionServiceInput) {
+ return Mono.just(executionService.process(executionServiceInput));
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/outbounds/pom.xml b/ms/blueprintsprocessor/modules/outbounds/pom.xml new file mode 100644 index 000000000..213e516b1 --- /dev/null +++ b/ms/blueprintsprocessor/modules/outbounds/pom.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ 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. + --> +<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.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>modules</artifactId> + <version>0.0.3-SNAPSHOT</version> + </parent> + + <artifactId>outbounds</artifactId> + <packaging>pom</packaging> + <name>Blueprints Processor Outbounds POM</name> + <description>Blueprints Processor Outbounds</description> + +</project> diff --git a/ms/blueprintsprocessor/modules/pom.xml b/ms/blueprintsprocessor/modules/pom.xml new file mode 100644 index 000000000..68447436e --- /dev/null +++ b/ms/blueprintsprocessor/modules/pom.xml @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ 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. + --> +<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.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>parent</artifactId> + <version>0.0.3-SNAPSHOT</version> + <relativePath>../parent</relativePath> + </parent> + + <artifactId>modules</artifactId> + <packaging>pom</packaging> + <name>Blueprints Processor Modules POM</name> + <description>Blueprints Processor Modules</description> + + <modules> + <module>commons</module> + <module>outbounds</module> + <module>services</module> + <module>inbounds</module> + </modules> + + <properties> + <kotlin.version>1.2.60</kotlin.version> + </properties> + + <dependencies> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-stdlib-jdk8</artifactId> + <version>${kotlin.version}</version> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-test</artifactId> + <version>${kotlin.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-maven-plugin</artifactId> + <version>${kotlin.version}</version> + <executions> + <execution> + <id>compile</id> + <phase>compile</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + <execution> + <id>test-compile</id> + <phase>test-compile</phase> + <goals> + <goal>test-compile</goal> + </goals> + </execution> + </executions> + <configuration> + <jvmTarget>1.8</jvmTarget> + </configuration> + </plugin> + </plugins> + </build> + + +</project> diff --git a/ms/blueprintsprocessor/modules/services/db-service/pom.xml b/ms/blueprintsprocessor/modules/services/db-service/pom.xml new file mode 100644 index 000000000..b11ba6d0e --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/db-service/pom.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ 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. + --> +<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.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>services</artifactId> + <version>0.0.3-SNAPSHOT</version> + </parent> + + <artifactId>db-service</artifactId> + <packaging>jar</packaging> + <name>Blueprints Processor DB Service</name> + <description>Blueprints Processor DB Service</description> + + <dependencies> + </dependencies> +</project> diff --git a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml new file mode 100644 index 000000000..c49476fd7 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ 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. + --> +<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.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>services</artifactId> + <version>0.0.3-SNAPSHOT</version> + </parent> + + <artifactId>execution-service</artifactId> + <packaging>jar</packaging> + <name>Blueprints Processor Execution Service</name> + <description>Blueprints Processor Execution Service</description> + + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>db-service</artifactId> + </dependency> + </dependencies> +</project> diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionService.kt new file mode 100644 index 000000000..75b26bb55 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionService.kt @@ -0,0 +1,46 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.services.execution
+
+
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
+import org.springframework.stereotype.Service
+import com.fasterxml.jackson.databind.node.ObjectNode
+
+/**
+ * ExecutionService
+ * @author Brinda Santh
+ * 8/14/2018
+ */
+@Service
+class ExecutionService {
+
+ fun process(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
+ val executionServiceOutput = ExecutionServiceOutput()
+ executionServiceOutput.actionIdentifiers = executionServiceInput.actionIdentifiers
+ executionServiceOutput.commonHeader = executionServiceInput.commonHeader
+ executionServiceOutput.payload = JacksonUtils.jsonNode("{}") as ObjectNode
+ val status = Status()
+ status.code = 200
+ status.message = "Success"
+ executionServiceOutput.status = status
+ return executionServiceOutput
+ }
+}
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionServiceTest.java b/ms/blueprintsprocessor/modules/services/execution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionServiceTest.java new file mode 100644 index 000000000..0df95d2d3 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionServiceTest.java @@ -0,0 +1,70 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.services.execution;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.apache.commons.io.FileUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput;
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.io.File;
+import java.nio.charset.Charset;
+
+
+/**
+ * ExecutionServiceTest
+ *
+ * @author Brinda Santh
+ * DATE : 8/15/2018
+ */
+@RunWith(SpringRunner.class)
+@ContextConfiguration(classes = ExecutionService.class)
+public class ExecutionServiceTest {
+ private static Logger log = LoggerFactory.getLogger(ExecutionServiceTest.class);
+
+ @Autowired
+ private ExecutionService executionService;
+
+ @Test
+ public void testExecutionService() throws Exception {
+
+ Assert.assertNotNull("failed to create ResourceResolutionService", executionService);
+
+ String resourceResolutionInputContent = FileUtils.readFileToString(
+ new File("src/test/resources/payload/requests/sample-execution-request.json"), Charset.defaultCharset());
+
+ ExecutionServiceInput executionServiceInput = JacksonUtils.readValue(resourceResolutionInputContent, ExecutionServiceInput.class );
+ Assert.assertNotNull("failed to populate executionServiceInput request ",executionServiceInput);
+
+ ObjectNode inputContent = (ObjectNode)JacksonUtils.jsonNodeFromFile("src/test/resources/payload/inputs/input.json");
+ Assert.assertNotNull("failed to populate input payload ",inputContent);
+ executionServiceInput.setPayload(inputContent);
+
+ ExecutionServiceOutput executionServiceOutput = executionService.process(executionServiceInput);
+ Assert.assertNotNull("failed to populate output",executionServiceOutput);
+
+ }
+}
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/inputs/input.json b/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/inputs/input.json new file mode 100644 index 000000000..cd6fac128 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/inputs/input.json @@ -0,0 +1,18 @@ +{
+ "api-ver": "2.00",
+ "originator-id": "MSO",
+ "request-id": "123456",
+ "service-instance-id": "ibcx0001vm001",
+ "service-type": "AVPN",
+ "vnf-type": "vUSP - vDBE-IPX HUB",
+ "vnf-id": 123456,
+ "service-template-name": "VRR-baseconfiguration",
+ "service-template-version": "1.0.0",
+ "action-name": "resource-assignment-action",
+ "group-name": "sample group name",
+ "bundle-id": "sample bundle id",
+ "bundle-mac": [
+ "Sample bundle mac",
+ "Sample bundle mac"
+ ]
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/requests/sample-execution-request.json b/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/requests/sample-execution-request.json new file mode 100644 index 000000000..b28ac5a29 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/requests/sample-execution-request.json @@ -0,0 +1,20 @@ +{
+ "actionIdentifiers": {
+ "actionName": "sample-action",
+ "blueprintName": "sample-blurprint",
+ "blueprintVersion": "1.0.0",
+ "mode": "sync"
+ },
+ "commonHeader": {
+ "flags": {
+ "force": true,
+ "ttl": 3600
+ },
+ "originatorId": "sdnc",
+ "requestId": "123456-1000",
+ "subRequestId": "sub-123456-1000",
+ "timestamp": "2012-04-23T18:25:43.511Z"
+ },
+ "payload": {
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/services/pom.xml b/ms/blueprintsprocessor/modules/services/pom.xml new file mode 100644 index 000000000..4ab8d00dc --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/pom.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ 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. + --> +<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.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>modules</artifactId> + <version>0.0.3-SNAPSHOT</version> + </parent> + + <artifactId>services</artifactId> + <name>Blueprints Processor Service POM</name> + <description>Blueprints Processor Service</description> + <packaging>pom</packaging> + + <modules> + <module>db-service</module> + <module>resolution-service</module> + <module>execution-service</module> + </modules> + + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>core</artifactId> + </dependency> + </dependencies> +</project> diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/pom.xml b/ms/blueprintsprocessor/modules/services/resolution-service/pom.xml new file mode 100644 index 000000000..581dd14d1 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/resolution-service/pom.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ 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. + --> +<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.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>services</artifactId> + <version>0.0.3-SNAPSHOT</version> + </parent> + <artifactId>resolution-service</artifactId> + <packaging>jar</packaging> + <name>Blueprints Processor Resolution Service</name> + <description>Blueprints Processor Resolution Service</description> + + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>db-service</artifactId> + </dependency> + </dependencies> +</project> diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionService.kt b/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionService.kt new file mode 100644 index 000000000..14ab7842e --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionService.kt @@ -0,0 +1,46 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.services.resolution
+
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionInput
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionOutput
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status
+import org.springframework.stereotype.Service
+
+/**
+ * ResourceResolutionService
+ * @author Brinda Santh
+ * 8/14/2018
+ */
+
+@Service
+class ResourceResolutionService {
+
+ fun resolveResource(resourceResolutionInput: ResourceResolutionInput): ResourceResolutionOutput {
+ val resourceResolutionOutput = ResourceResolutionOutput()
+ resourceResolutionOutput.actionIdentifiers = resourceResolutionInput.actionIdentifiers
+ resourceResolutionOutput.commonHeader = resourceResolutionInput.commonHeader
+ resourceResolutionOutput.resourceAssignments = resourceResolutionInput.resourceAssignments
+
+ val status = Status()
+ status.code = 200
+ status.message = "Success"
+ resourceResolutionOutput.status = status
+
+ return resourceResolutionOutput
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionServiceTest.java b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionServiceTest.java new file mode 100644 index 000000000..633599082 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionServiceTest.java @@ -0,0 +1,80 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.services.resolution;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.io.FileUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionInput;
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionOutput;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.io.File;
+import java.nio.charset.Charset;
+import java.util.List;
+
+/**
+ * ResourceResolutionServiceTest
+ *
+ * @author Brinda Santh DATE : 8/15/2018
+ */
+@RunWith(SpringRunner.class)
+@ContextConfiguration(classes = ResourceResolutionService.class)
+public class ResourceResolutionServiceTest {
+ private static Logger log = LoggerFactory.getLogger(ResourceResolutionServiceTest.class);
+
+ @Autowired
+ private ResourceResolutionService resourceResolutionService;
+
+ @Test
+ public void testResolveResource() throws Exception {
+
+ Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService);
+
+ String resourceResolutionInputContent = FileUtils.readFileToString(
+ new File("src/test/resources/payload/requests/sample-resourceresolution-request.json"), Charset.defaultCharset());
+
+ ResourceResolutionInput resourceResolutionInput = JacksonUtils.readValue(resourceResolutionInputContent, ResourceResolutionInput.class );
+ Assert.assertNotNull("failed to populate resourceResolutionInput request ",resourceResolutionInput);
+
+ String resourceAssignmentContent = FileUtils.readFileToString(
+ new File("src/test/resources/mapping/db/resource-assignments-simple.json"), Charset.defaultCharset());
+ List<ResourceAssignment> batchResourceAssignment =
+ JacksonUtils.getListFromJson(resourceAssignmentContent, ResourceAssignment.class);
+
+ Assert.assertTrue("failed to create ResourceAssignment from file", CollectionUtils.isNotEmpty(batchResourceAssignment));
+ resourceResolutionInput.setResourceAssignments(batchResourceAssignment);
+
+ ObjectNode inputContent = (ObjectNode)JacksonUtils.jsonNodeFromFile("src/test/resources/payload/inputs/input.json");
+ Assert.assertNotNull("failed to populate input payload ",inputContent);
+ resourceResolutionInput.setPayload(inputContent);
+ log.info("ResourceResolutionInput : {}", JacksonUtils.getJson(resourceResolutionInput, true));
+
+ ResourceResolutionOutput resourceResolutionOutput = resourceResolutionService.resolveResource(resourceResolutionInput);
+ Assert.assertNotNull("failed to populate output",resourceResolutionOutput);
+
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-array.json b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-array.json new file mode 100644 index 000000000..679b92db4 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-array.json @@ -0,0 +1,35 @@ +{
+ "locations": {
+ "name": "locations",
+ "data-type": "list",
+ "entry-schema": "dt-location",
+ "source": {
+ "db": {
+ "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
+ "input-key-mapping": {
+ "profile_name": "profile_name"
+ },
+ "output-key-mapping": {
+ "db-country": "country",
+ "db-state": "state"
+ }
+ }
+ },
+ "candidate-dependency": {
+ "db": {
+ "names": [
+ "profile_name"
+ ]
+ }
+ }
+ },
+ "profile_name": {
+ "name": "profile_name",
+ "data-type": "string",
+ "source": {
+ "input": {
+
+ }
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-complex.json b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-complex.json new file mode 100644 index 000000000..32d04b690 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-complex.json @@ -0,0 +1,27 @@ +{
+ "location": {
+ "name": "location",
+ "data-type": "dt-location",
+ "source": {
+ "db": {
+ "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
+ "input-key-mapping": {
+ "profile_name": "profile_name"
+ },
+ "output-key-mapping": {
+ "db-country": "country",
+ "db-state": "state"
+ }
+ }
+ }
+ },
+ "profile_name": {
+ "name": "profile_name",
+ "data-type": "string",
+ "source": {
+ "input": {
+
+ }
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-simple.json b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-simple.json new file mode 100644 index 000000000..841404f22 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/db-simple.json @@ -0,0 +1,26 @@ +{
+ "country": {
+ "name": "country",
+ "data-type": "string",
+ "source": {
+ "db": {
+ "query": "SELECT country FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
+ "input-key-mapping": {
+ "profile_name": "profile_name"
+ },
+ "output-key-mapping": {
+ "country": "country"
+ }
+ }
+ }
+ },
+ "profile_name": {
+ "name": "profile_name",
+ "data-type": "string",
+ "source": {
+ "input": {
+
+ }
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/dt-location.json b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/dt-location.json new file mode 100644 index 000000000..52e0a7967 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/dt-location.json @@ -0,0 +1,15 @@ +{
+ "version": "1.0.0",
+ "description": "test Data Type",
+ "properties": {
+ "country": {
+ "required": true,
+ "type": "string"
+ },
+ "state": {
+ "required": false,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+}
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/resource-assignments-simple.json b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/resource-assignments-simple.json new file mode 100644 index 000000000..02ce68be4 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/resource-assignments-simple.json @@ -0,0 +1,12 @@ +[
+ {
+ "name": "country",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "country",
+ "dictionary-source": "db",
+ "dependencies": []
+ }
+]
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/payload/inputs/input.json b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/payload/inputs/input.json new file mode 100644 index 000000000..cd6fac128 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/payload/inputs/input.json @@ -0,0 +1,18 @@ +{
+ "api-ver": "2.00",
+ "originator-id": "MSO",
+ "request-id": "123456",
+ "service-instance-id": "ibcx0001vm001",
+ "service-type": "AVPN",
+ "vnf-type": "vUSP - vDBE-IPX HUB",
+ "vnf-id": 123456,
+ "service-template-name": "VRR-baseconfiguration",
+ "service-template-version": "1.0.0",
+ "action-name": "resource-assignment-action",
+ "group-name": "sample group name",
+ "bundle-id": "sample bundle id",
+ "bundle-mac": [
+ "Sample bundle mac",
+ "Sample bundle mac"
+ ]
+}
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/payload/requests/sample-resourceresolution-request.json b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/payload/requests/sample-resourceresolution-request.json new file mode 100644 index 000000000..e8830a8a2 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/payload/requests/sample-resourceresolution-request.json @@ -0,0 +1,22 @@ +{
+ "actionIdentifiers": {
+ "actionName": "sample-action",
+ "blueprintName": "sample-blurprint",
+ "blueprintVersion": "1.0.0",
+ "mode": "sync"
+ },
+ "commonHeader": {
+ "flags": {
+ "force": true,
+ "ttl": 3600
+ },
+ "originatorId": "sdnc",
+ "requestId": "123456-1000",
+ "subRequestId": "sub-123456-1000",
+ "timestamp": "2012-04-23T18:25:43.511Z"
+ },
+ "payload": {
+ },
+ "resourceAssignments": [
+ ]
+}
diff --git a/ms/blueprintsprocessor/parent/pom.xml b/ms/blueprintsprocessor/parent/pom.xml new file mode 100644 index 000000000..b6c8e0c37 --- /dev/null +++ b/ms/blueprintsprocessor/parent/pom.xml @@ -0,0 +1,232 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ 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. + --> +<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"> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <version>0.0.3-SNAPSHOT</version> + <modelVersion>4.0.0</modelVersion> + <artifactId>parent</artifactId> + <packaging>pom</packaging> + <name>Blueprints Processor Parent</name> + <description>Blueprints Processor Parent</description> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <maven.compiler.target>1.8</maven.compiler.target> + <maven.compiler.source>1.8</maven.compiler.source> + <java.version>1.8</java.version> + <controllerblueprints.version>0.3.0-SNAPSHOT</controllerblueprints.version> + <spring.boot.version>2.0.4.RELEASE</spring.boot.version> + <kotlin.version>1.2.60</kotlin.version> + <springfox.swagger2.version>2.9.2</springfox.swagger2.version> + <h2database.version>1.4.197</h2database.version> + </properties> + <dependencyManagement> + <dependencies> + <!-- Application Module Dependencies --> + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>db-lib</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>rest-lib</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>db-service</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>execution-service</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>resolution-service</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>resource-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> + <artifactId>selfservice-api</artifactId> + <version>${project.version}</version> + </dependency> + + <!-- Application Component Dependency --> + <dependency> + <groupId>org.onap.ccsdk.apps</groupId> + <artifactId>controllerblueprints-resource-dict</artifactId> + <version>${controllerblueprints.version}</version> + </dependency> + + <!--Swagger Dependencies --> + <dependency> + <groupId>io.springfox</groupId> + <artifactId>springfox-swagger2</artifactId> + <version>${springfox.swagger2.version}</version> + </dependency> + <dependency> + <groupId>io.springfox</groupId> + <artifactId>springfox-swagger-ui</artifactId> + <version>${springfox.swagger2.version}</version> + </dependency> + + <!-- Spring Boot --> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-parent</artifactId> + <version>${spring.boot.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-stdlib-jdk8</artifactId> + <version>${kotlin.version}</version> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-reflect</artifactId> + <version>${kotlin.version}</version> + </dependency> + <!-- Database --> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <version>${h2database.version}</version> + </dependency> + <!-- Test Dependency --> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-test</artifactId> + <version>${kotlin.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.2.1</version> + </dependency> + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + <version>3.2.2</version> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>2.6</version> + </dependency> + <dependency> + <groupId>org.apache.velocity</groupId> + <artifactId>velocity</artifactId> + <version>1.7</version> + </dependency> + + <dependency> + <groupId>io.springfox</groupId> + <artifactId>springfox-swagger2</artifactId> + </dependency> + <dependency> + <groupId>io.springfox</groupId> + <artifactId>springfox-swagger-ui</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-test</artifactId> + <version>${kotlin.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.projectreactor</groupId> + <artifactId>reactor-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-stdlib-jdk8</artifactId> + <version>${kotlin.version}</version> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-maven-plugin</artifactId> + <version>${kotlin.version}</version> + <executions> + <execution> + <id>compile</id> + <goals> + <goal>compile</goal> + </goals> + <configuration> + <sourceDirs> + <sourceDir>${project.basedir}/src/main/kotlin</sourceDir> + <sourceDir>${project.basedir}/src/main/java</sourceDir> + </sourceDirs> + </configuration> + </execution> + <execution> + <id>test-compile</id> + <goals> + <goal>test-compile</goal> + </goals> + <configuration> + <sourceDirs> + <sourceDir>${project.basedir}/src/test/kotlin</sourceDir> + <sourceDir>${project.basedir}/src/test/java</sourceDir> + </sourceDirs> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.5.1</version> + <configuration> + <source>${maven.compiler.source}</source> + <target>${maven.compiler.target}</target> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/ms/blueprintsprocessor/pom.xml b/ms/blueprintsprocessor/pom.xml new file mode 100644 index 000000000..6c980be03 --- /dev/null +++ b/ms/blueprintsprocessor/pom.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ 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. + --> + +<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.onap.ccsdk.apps</groupId> + <artifactId>ccsdk-apps</artifactId> + <version>0.3.0-SNAPSHOT</version> + </parent> + <artifactId>blueprintsprocessor</artifactId> + <packaging>pom</packaging> + <name>Blueprints Processor POM</name> + <description>Blueprints Processor POM</description> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.target>1.8</maven.compiler.target> + <maven.compiler.source>1.8</maven.compiler.source> + <kotlin.version>1.2.60</kotlin.version> + </properties> + + <modules> + <module>parent</module> + <module>modules</module> + <module>application</module> + </modules> + +</project> |