aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test')
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java90
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/EmbeddedMariaDbConfig.java60
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/HealthCheckHandlerTest.java47
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/TestRestTemplateFactory.java50
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/BpelRestClientTest.java55
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefSeqTest.java36
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefTest.java39
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRouteTest.java41
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java40
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java533
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java265
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java282
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionBeanTest.java41
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionTest.java50
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/MsoTenantAdapterImplTest.java73
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java254
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java32
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java47
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java49
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java116
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java101
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java54
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java158
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java562
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java319
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java167
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java108
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VfRollbackTest.java70
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java560
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java189
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java184
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java134
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java485
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduBlueprintTest.java77
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduInfoTest.java89
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.json42
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml17
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_Fail_If_Exist_True.xml17
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_InvalidCloudSiteId.xml17
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_NEUTRON_Mode.xml17
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_NEUTRON_Mode_Fail_If_Exist_True.xml17
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/DeleteNetwork.xml15
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/META-INF/services/com.woorea.openstack.base.client.OpenStackClientConnector1
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/QueryNetwork.xml13
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/UpdateNetwork.xml23
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkRequest.xml49
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse.json25
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse2.json25
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json16
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json15
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/CreateVfModuleResponse.json26
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/DeleteNetworkResponse.json6
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/DeleteTenantResponse_Failed.json5
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/DeleteTenantResponse_Success.json5
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/DeleteVfModuleResponse.json7
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/GetNeutronNetwork.json45
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackCreateNeutronNetworkResponse.json11
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackGetNeutronNetworks.json22
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackRequest_Tenant.json7
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Access.json40
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Access_Admin.json27
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Access_queryNetwork.json27
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Metadata.json5
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Roles.json10
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json17
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_StackId.json14
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created.json17
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json17
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json17
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Failed_VfModule.json17
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_UpdateComplete.json17
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Updating_VfModule.json17
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Tenant.json8
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_User.json11
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json12
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfStackId.json20
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/RollbackVfModuleResponse.json5
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/UpdateNetworkResponse.json8
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/UpdateVfModuleResponse.json5
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/ValetCreateRequest.json9
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/ValetDeleteRequest.json6
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/application-test.yaml137
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/cloud_config.json258
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/data.sql145
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/logback-test.xml52
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/mso.properties27
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/schema.sql784
87 files changed, 7629 insertions, 0 deletions
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java
new file mode 100644
index 0000000000..7aa86da237
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java
@@ -0,0 +1,90 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so;
+
+import com.openpojo.reflection.PojoClass;
+import com.openpojo.reflection.PojoClassFilter;
+import com.openpojo.reflection.filters.FilterEnum;
+import com.openpojo.reflection.filters.FilterNonConcrete;
+import com.openpojo.reflection.filters.FilterPackageInfo;
+import com.openpojo.validation.Validator;
+import com.openpojo.validation.ValidatorBuilder;
+import com.openpojo.validation.rule.impl.*;
+import com.openpojo.validation.test.impl.*;
+import org.junit.Test;
+import org.onap.so.openpojo.rules.ToStringTester;
+import org.springframework.stereotype.Component;
+
+
+public class BeansTest {
+
+ private final PojoClassFilter filterTestClasses = new FilterTestClasses();
+
+ private final PojoClassFilter enumFilter = new FilterEnum();
+
+ private final PojoClassFilter noNestedClasses = new FilterTestNestedClasses();
+
+
+
+ @Test
+ public void pojoStructure() {
+ test("org.onap.so.adapters.network.async.client");
+ test("org.onap.so.adapters.vnf.async.client");
+ test("org.onap.so.adapters.network");
+ test("org.onap.so.adapters.vnf");
+ test("org.onap.so.adapters.valet");
+ test("org.onap.so.adapters.valet.beans");
+ test("org.onap.so.vdu.utils");
+ }
+
+ private void test(String pojoPackage) {
+ Validator validator = ValidatorBuilder.create()
+ .with(new NoStaticExceptFinalRule())
+ .with(new SerializableMustHaveSerialVersionUIDRule())
+ .with(new NoPublicFieldsExceptStaticFinalRule())
+ .with(new SetterTester())
+ .with(new GetterTester())
+ .with(new ToStringTester())
+
+ .build();
+
+
+ validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses,enumFilter,new FilterNonConcrete(), noNestedClasses, new FilterBeans());
+ }
+ private static class FilterTestClasses implements PojoClassFilter {
+ public boolean include(PojoClass pojoClass) {
+ return !pojoClass.getSourcePath().contains("/test-classes/");
+ }
+ }
+
+ private static class FilterTestNestedClasses implements PojoClassFilter {
+ public boolean include(PojoClass pojoClass) {
+ return !pojoClass.isNestedClass();
+ }
+ }
+
+ private static class FilterBeans implements PojoClassFilter {
+ public boolean include(PojoClass pojoClass) {
+ return pojoClass.getAnnotations().stream().filter(o -> o instanceof Component).count() <= 0;
+ }
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/EmbeddedMariaDbConfig.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/EmbeddedMariaDbConfig.java
new file mode 100644
index 0000000000..f1ee0eae78
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/EmbeddedMariaDbConfig.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so.adapters.msoopenstackadapters;
+import ch.vorburger.exec.ManagedProcessException;
+import ch.vorburger.mariadb4j.DBConfigurationBuilder;
+import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import javax.sql.DataSource;
+
+@Configuration
+@Profile({"test"})
+public class EmbeddedMariaDbConfig {
+
+ @Bean
+ MariaDB4jSpringService mariaDB4jSpringService() {
+ return new MariaDB4jSpringService();
+ }
+
+ @Bean
+ DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService,
+ @Value("${mariaDB4j.databaseName}") String databaseName,
+ @Value("${spring.datasource.username}") String datasourceUsername,
+ @Value("${spring.datasource.password}") String datasourcePassword,
+ @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException {
+ //Create our database with default root user and no password
+ mariaDB4jSpringService.getDB().createDB(databaseName);
+
+ DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration();
+
+ return DataSourceBuilder
+ .create()
+ .username(datasourceUsername)
+ .password(datasourcePassword)
+ .url(config.getURL(databaseName))
+ .driverClassName(datasourceDriver)
+ .build();
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/HealthCheckHandlerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/HealthCheckHandlerTest.java
new file mode 100644
index 0000000000..4df9a7af6d
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/HealthCheckHandlerTest.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.adapters.msoopenstackadapters;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.ws.rs.core.Response;
+
+import org.json.JSONException;
+import org.junit.Test;
+import org.onap.so.adapters.vnf.BaseRestTestUtils;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+public class HealthCheckHandlerTest extends BaseRestTestUtils {
+
+ @Test
+ public void testHealthcheckVnf() throws JSONException {
+
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+
+ ResponseEntity<String> response = restTemplate.exchange(createURLWithPort("/manage/health"),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/TestRestTemplateFactory.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/TestRestTemplateFactory.java
new file mode 100644
index 0000000000..be76a9e365
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/TestRestTemplateFactory.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so.adapters.msoopenstackadapters;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.onap.so.client.policy.JettisonStyleMapperProvider;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+
+@Configuration
+public class TestRestTemplateFactory {
+
+ @Autowired
+ private JettisonStyleMapperProvider objectMapper;
+
+ @Bean("JettisonStyle")
+ public TestRestTemplate createRestTemplate() {
+ TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
+ List<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
+ MappingJackson2HttpMessageConverter jsonMessageConverter = new MappingJackson2HttpMessageConverter();
+ jsonMessageConverter.setObjectMapper(objectMapper.getMapper());
+ restTemplate.getRestTemplate().getMessageConverters().removeIf(m -> m.getClass().getName().equals(MappingJackson2HttpMessageConverter.class.getName()));
+ restTemplate.getRestTemplate().getMessageConverters().add(jsonMessageConverter);
+ return restTemplate;
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/BpelRestClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/BpelRestClientTest.java
new file mode 100644
index 0000000000..845155f7f0
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/BpelRestClientTest.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.adapters.network;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.inject.Provider;
+
+import org.junit.Test;
+import org.onap.so.adapters.vnf.BaseRestTestUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.embedded.LocalServerPort;
+
+public class BpelRestClientTest extends BaseRestTestUtils {
+
+
+ @LocalServerPort
+ private int port;
+ @Autowired
+ @Qualifier("NetworkBpel")
+ private Provider<BpelRestClient> clientProvider;
+
+ @Test
+ public void verifyPropertiesRead() {
+ BpelRestClient client = clientProvider.get();
+
+ assertEquals(5, client.getRetryCount());
+ assertEquals(5, client.getConnectTimeout());
+ assertEquals("test:test", client.getCredentials());
+ assertEquals(5, client.getSocketTimeout());
+ assertEquals("408, 429, 500, 502, 503, 504, 900", client.getRetryList());
+ assertEquals(-15, client.getRetryInterval());
+
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefSeqTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefSeqTest.java
new file mode 100644
index 0000000000..46bf21722c
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefSeqTest.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.adapters.network;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class ContrailPolicyRefSeqTest {
+ @Test
+ public void ContrailPolicyRefSeqJson_Test()
+ {
+ ContrailPolicyRefSeq cprs = new ContrailPolicyRefSeq("majorVersion 1","minorVersion 0.02");
+ assertTrue(cprs.toString().contains("majorVersion 1"));
+ assertTrue(cprs.toString().contains("minorVersion 0.02"));
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefTest.java
new file mode 100644
index 0000000000..7a0f3d0551
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefTest.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.adapters.network;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class ContrailPolicyRefTest {
+
+ @Test
+ public void ContrailPolicyRef_Test()
+ {
+ ContrailPolicyRef ref = new ContrailPolicyRef();
+ ref.populate("majorVersion 1", "minorVersion 0.02");
+ String strJson = ref.toJsonString();
+ assertTrue(strJson.contains("majorVersion 1"));
+ assertTrue(strJson.contains("minorVersion 0.02"));
+ }
+
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRouteTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRouteTest.java
new file mode 100644
index 0000000000..ca8a45e8dc
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRouteTest.java
@@ -0,0 +1,41 @@
+/*
+* ============LICENSE_START=======================================================
+ * ONAP : SO
+ * ================================================================================
+ * Copyright (C) 2018 TechMahindra
+ * ================================================================================
+ * 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.onap.so.adapters.network;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.so.openstack.beans.HostRoute;
+
+public class ContrailSubnetHostRouteTest {
+
+ private ContrailSubnetHostRoute cshr = new ContrailSubnetHostRoute();
+ HostRoute hr = new HostRoute();
+ @Test
+ public void testContrailSubnetHostRoute() {
+
+ cshr.setPrefix("prefix");
+ cshr.setNextHop("nextHop");
+ assertEquals("prefix", cshr.getPrefix());
+ assertEquals("nextHop", cshr.getNextHop());
+ assert (cshr.toString() != null);
+ cshr.populateWith(hr);
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java
new file mode 100644
index 0000000000..fd17c37e6d
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java
@@ -0,0 +1,40 @@
+/*
+* ============LICENSE_START=======================================================
+ * ONAP : SO
+ * ================================================================================
+ * Copyright (C) 2018 TechMahindra
+ * ================================================================================
+ * 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.onap.so.adapters.network;
+
+import static org.junit.Assert.*;
+
+import java.util.List;
+
+import org.junit.Test;
+
+public class ContrailSubnetHostRoutesTest {
+
+ ContrailSubnetHostRoutes cshr = new ContrailSubnetHostRoutes();
+ List<ContrailSubnetHostRoute> host_routes;
+ StringBuilder buf = new StringBuilder();
+ @Test
+ public void testContrailSubnetHostRoutes() {
+ cshr.setHost_routes(host_routes);
+ assertEquals(cshr.getHost_routes(), host_routes);
+ assert (cshr.toString() != null);
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
new file mode 100644
index 0000000000..e473c4c76a
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
@@ -0,0 +1,533 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so.adapters.network;
+
+import org.apache.http.HttpStatus;
+import org.junit.Test;
+import org.onap.so.adapters.vnf.BaseRestTestUtils;
+import org.onap.so.cloud.CloudConfig;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.util.UriComponentsBuilder;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import static org.junit.Assert.assertEquals;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteNeutronNetwork;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteStack_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteStack_500;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetAllNeutronNetworks_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetAllNeutronNetworks_404;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetNeutronNetwork;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetNeutronNetwork_404;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreated_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackDeleteOrUpdateComplete_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStack_404;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStack_500;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostNeutronNetwork_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostStack_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutNeutronNetwork;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutNeutronNetwork_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStack;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackGet;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackPost;
+
+public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
+
+ public static final String NETWORK_ID = "43173f6a-d699-414b-888f-ab243dda6dfe";
+ public static final String NETWORK_NAME = "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0";
+
+ @Autowired
+ private CloudConfig cloudConfig;
+
+ @Test
+ public void createNetworkByModelNameNeutronModeGetNetworkException() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenstackGet("/mockPublicUrl/v2.0/networks",HttpStatus.SC_INTERNAL_SERVER_ERROR);
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode.xml"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void createNetworkByModelNameNeutronModeCreateNetworkException() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetNeutronNetwork_404("dvspg-VCE_VPE-mtjnj40avbc");
+
+ mockOpenStackGetAllNeutronNetworks_404();
+
+ mockOpenstackPost("/mockPublicUrl/v2.0/networks", HttpStatus.SC_INTERNAL_SERVER_ERROR);
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode.xml"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void createNetworkByModelNameNeutronMode() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetNeutronNetwork_404("dvspg-VCE_VPE-mtjnj40avbc");
+
+ mockOpenStackGetAllNeutronNetworks_404();
+
+ mockOpenStackPostNeutronNetwork_200("OpenstackCreateNeutronNetworkResponse.json");
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode.xml"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void createNetworkByModelNameAlreadyExistNeutronMode() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetAllNeutronNetworks_200("OpenstackGetNeutronNetworks.json");
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode.xml"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void createNetworkByModelNameAlreadyExistNeutronModeFailIfExistTrue() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetAllNeutronNetworks_200("OpenstackGetNeutronNetworks.json");
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode_Fail_If_Exist_True.xml"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void createNetworkByModelNameHeatMode() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetStack_404("dvspg-VCE_VPE-mtjnj40avbc");
+
+ mockOpenStackPostStack_200("OpenstackResponse_Stack.json");
+
+ mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc/stackId");
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork.xml"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void createNetworkByModelNameAlreadyExistHeatMode() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackPostStack_200("OpenstackResponse_Stack.json");
+
+ mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc");
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork.xml"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void createNetworkByModelNameAlreadyExistHeatModeFailIfExistTrue() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc");
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork_Fail_If_Exist_True.xml"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+
+ @Test
+ public void createNetworkByModelNameHeatModeQueryNetworkException() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenstackGet("/mockPublicUrl/stacks/dvspg-VCE_VPE-mtjnj40avbc",HttpStatus.SC_INTERNAL_SERVER_ERROR);
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork.xml"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void createNetworkByModelNameHeatModeCreateNetworkException() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetStack_404("dvspg-VCE_VPE-mtjnj40avbc");
+
+ mockOpenstackPost("/mockPublicUrl/stacks",HttpStatus.SC_INTERNAL_SERVER_ERROR);
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork.xml"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void createNetworkByModelNameCloudSiteNotPresentError() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackPostStack_200("OpenstackResponse_Stack.json");
+
+ mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc");
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork_InvalidCloudSiteId.xml"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void deleteNetworkHeatModeSuccess() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_DeleteComplete.json");
+
+ mockOpenStackDeleteStack_200();
+
+ mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/DeleteNetwork.xml"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void deleteNetworkDeleteStackException() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_DeleteComplete.json");
+
+ mockOpenStackDeleteStack_500();
+
+ mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/DeleteNetwork.xml"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void deleteNetworkError() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_DeleteComplete.json");
+
+ mockOpenStackDeleteStack_200();
+
+ mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/DeleteNetwork.xml").replace("mtn13",""), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+
+ @Test
+ public void deleteNetworkNeureonMode() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
+
+ mockOpenStackDeleteNeutronNetwork(NETWORK_ID,HttpStatus.SC_OK);
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/DeleteNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void deleteNetworkNeutronModeDeleteStackException() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
+
+ mockOpenStackDeleteNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR);
+
+ //mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", NETWORK_ID);
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/DeleteNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void updateNetworkNeutronModeSuccess() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
+ mockOpenStackPutNeutronNetwork_200("OpenstackCreateNeutronNetworkResponse.json",NETWORK_ID);
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/UpdateNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void updateNetworkNeutronUpdateException() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
+ mockOpenStackPutNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR);
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/UpdateNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void updateNetworkHeatUpdateException() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", NETWORK_NAME);
+
+ mockOpenStackPutStack(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR);
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/UpdateNetwork.xml"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void updateNetworkHeatQueryException() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetStack_500(NETWORK_NAME);
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/UpdateNetwork.xml"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void updateNetworkHeatStackNotFound() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetStack_404(NETWORK_NAME);
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/UpdateNetwork.xml"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void updateNetworkNeutronQueryException() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR);
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/UpdateNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void updateNetworkNeutronStackNotFound() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetNeutronNetwork(NETWORK_ID,HttpStatus.SC_NOT_FOUND);
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/UpdateNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void queryNetworkHeatModesuccess() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", NETWORK_ID);
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/QueryNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void queryNetworkHeatModeQueryException() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetStack_500(NETWORK_ID);
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/QueryNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void queryNetworkNeutronModeSuccess() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/QueryNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void queryNetworkNeutronModeException() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR);
+
+ String uri = "/services/NetworkAdapter";
+ headers.set("X-ECOMP-RequestID", "123456789456127");
+ ResponseEntity<String> response = sendXMLRequest(inputStream("/QueryNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+ public ResponseEntity<String> sendXMLRequest(String requestJson, String uriPath, HttpMethod reqMethod){
+ headers.set("Accept", MediaType.APPLICATION_XML);
+ headers.set("Content-Type", MediaType.APPLICATION_XML);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(uriPath));
+
+ HttpEntity<String> request = new HttpEntity<String>(requestJson, headers);
+ ResponseEntity<String> response = restTemplate.exchange(builder.toUriString(),
+ reqMethod, request, String.class);
+
+ return response;
+ }
+
+ public String inputStream(String JsonInput)throws IOException{
+ JsonInput = "src/test/resources/" + JsonInput;
+ String input = new String(Files.readAllBytes(Paths.get(JsonInput)));
+ return input;
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java
new file mode 100644
index 0000000000..094d308221
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java
@@ -0,0 +1,265 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.onap.so.adapters.network;
+
+import org.apache.http.HttpStatus;
+import org.junit.Test;
+import org.onap.so.adapters.vnf.BaseRestTestUtils;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.beans.NetworkRollback;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.containing;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static org.onap.so.bpmn.mock.StubOpenStack.getBodyFromFile;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreatedVUSP_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreated_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackDeleteOrUpdateComplete_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostStacks_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccessQueryNetwork;
+
+public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
+ @Autowired
+ MsoNetworkAdapterAsyncImpl impl;
+
+ @Test
+ public void healthCheckATest() {
+ MsoNetworkAdapterAsyncImpl mNAAimpl = new MsoNetworkAdapterAsyncImpl();
+ mNAAimpl.healthCheckA();
+ }
+
+ @Test
+ public void rollbackNetworkATest() throws IOException {
+ stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ .withRequestBody(containing("tenantId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(post(urlPathEqualTo("/notificationUrl"))
+ .withRequestBody(containing("<completed>true</completed>"))
+ .willReturn(aResponse()
+ .withBody("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" +
+ " <soapenv:Header/>\n" +
+ " <soapenv:Body>\n" +
+ " <net:rollbackNetworkNotificationResponse>\n" +
+ " </net:rollbackNetworkNotificationResponse>\n" +
+ " </soapenv:Body>\n" +
+ "</soapenv:Envelope>")
+ .withStatus(HttpStatus.SC_OK)));
+ NetworkRollback nrb = getNetworkRollback("mtn13");
+ impl.rollbackNetworkA(nrb, "messageId", "http://localhost:"+wireMockPort+"/notificationUrl");
+ }
+
+ @Test
+ public void rollbackNetworkATest_NotifyException() throws IOException {
+ stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ .withRequestBody(containing("tenantId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(post(urlPathEqualTo("/notificationUrl"))
+ .withRequestBody(containing("<completed>true</completed>"))
+ .willReturn(aResponse()
+ .withStatus(HttpStatus.SC_NOT_FOUND)));
+ NetworkRollback nrb = getNetworkRollback("mtn13");
+ impl.rollbackNetworkA(nrb, "messageId", "http://localhost:"+wireMockPort+"/notificationUrl");
+ }
+
+ private NetworkRollback getNetworkRollback(String cloudId) {
+ NetworkRollback nrb = new NetworkRollback();
+ nrb.setCloudId(cloudId);
+ nrb.setMsoRequest(new MsoRequest());
+ nrb.setModelCustomizationUuid("3bdbb104-476c-483e-9f8b-c095b3d3068c");
+ nrb.setNetworkCreated(true);
+ nrb.setNetworkId("networkId");
+ nrb.setNetworkName("networkName");
+ nrb.setNetworkStackId("networkStackId");
+ nrb.setNetworkType("networkType");
+ nrb.setNeutronNetworkId("neutronNetworkId");
+ nrb.setPhysicalNetwork("physicalNetwork");
+ nrb.setTenantId("tenantId");
+ nrb.setVlans(new ArrayList<>());
+ return nrb;
+ }
+
+ @Test
+ public void rollbackNetworkATestNetworkException() {
+ NetworkRollback nrb = getNetworkRollback("cloudId");
+
+ impl.rollbackNetworkA(nrb, "messageId", "http://localhost");
+ }
+
+ @Test
+ public void noRollbackNetworkATest() {
+ impl.rollbackNetworkA(null, "messageId", "http://localhost");
+ }
+
+
+ @Test
+ public void deleteNetworkATest() throws IOException {
+ stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ .withRequestBody(containing("tenantId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(post(urlPathEqualTo("/notificationUrl"))
+ .withRequestBody(containing("<completed>true</completed>"))
+ .willReturn(aResponse()
+ .withBody("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" +
+ " <soapenv:Header/>\n" +
+ " <soapenv:Body>\n" +
+ " <net:deleteNetworkNotificationResponse>\n" +
+ " </net:deleteNetworkNotificationResponse>\n" +
+ " </soapenv:Body>\n" +
+ "</soapenv:Envelope>")
+ .withStatus(HttpStatus.SC_OK)));
+ impl.deleteNetworkA("mtn13", "tenantId", "networkType", "modelCustomizationUuid", "networkId",
+ "messageId", new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl");
+ }
+
+ @Test
+ public void deleteNetworkATest_NotifyException() throws IOException {
+ stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ .withRequestBody(containing("tenantId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(post(urlPathEqualTo("/notificationUrl"))
+ .withRequestBody(containing("<completed>true</completed>"))
+ .willReturn(aResponse()
+ .withStatus(HttpStatus.SC_NOT_FOUND)));
+ impl.deleteNetworkA("mtn13", "tenantId", "networkType", "modelCustomizationUuid", "networkId",
+ "messageId", new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl");
+ }
+
+ @Test
+ public void deleteNetworkATest_NetworkException() {
+ impl.deleteNetworkA("cloudSiteId", "tenantId", "networkType", "modelCustomizationUuid", "networkId",
+ "messageId", new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl");
+ }
+
+ @Test
+ public void updateNetworkATest() throws IOException {
+ stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ .withRequestBody(containing("tenantId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
+ .withStatus(HttpStatus.SC_OK)));
+ mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc");
+ mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_UpdateComplete.json");
+ mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200();
+ stubFor(post(urlPathEqualTo("/notificationUrl"))
+ .withRequestBody(containing("updateNetworkNotification"))
+ .willReturn(aResponse()
+ .withBody("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" +
+ " <soapenv:Header/>\n" +
+ " <soapenv:Body>\n" +
+ " <net:updateNetworkNotificationResponse>\n" +
+ " </net:updateNetworkNotificationResponse>\n" +
+ " </soapenv:Body>\n" +
+ "</soapenv:Envelope>")
+ .withStatus(HttpStatus.SC_OK)));
+ impl.updateNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "dvspg-VCE_VPE-mtjnj40avbc",
+ "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<>(), "messageId",
+ new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl");
+ }
+
+ @Test
+ public void updateNetworkATest_NotifyExcpetion() throws IOException {
+ stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ .withRequestBody(containing("tenantId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
+ .withStatus(HttpStatus.SC_OK)));
+ mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc");
+ mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_UpdateComplete.json");
+ mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200();
+ impl.updateNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "dvspg-VCE_VPE-mtjnj40avbc",
+ "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<>(), "messageId",
+ new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl"); }
+
+ @Test
+ public void updateNetworkATest_NetworkException() {
+ impl.updateNetworkA("cloudSiteId", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "networkId",
+ "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<>(), "messageId",
+ new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl");
+ }
+
+ @Test
+ public void queryNetworkATest() throws IOException {
+ mockOpenStackResponseAccessQueryNetwork(wireMockPort);
+ impl.queryNetworkA("mtn13", "tenantId", "networkId", "messageId", new MsoRequest(),
+ "http://localhost:"+wireMockPort+"/notificationUrl");
+ }
+
+ @Test
+ public void createNetworkATest() throws IOException {
+ stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ .withRequestBody(containing("tenantId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(post(urlPathEqualTo("/notificationUrl"))
+ .withRequestBody(containing("createNetworkNotification"))
+ .willReturn(aResponse()
+ .withBody("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" +
+ " <soapenv:Header/>\n" +
+ " <soapenv:Body>\n" +
+ " <net:createNetworkNotificationResponse>\n" +
+ " </net:createNetworkNotificationResponse>\n" +
+ " </soapenv:Body>\n" +
+ "</soapenv:Envelope>")
+ .withStatus(HttpStatus.SC_OK)));
+ mockOpenStackGetStackCreatedVUSP_200();
+ mockOpenStackPostStacks_200();
+ impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0",
+ "physicalNetworkName", new ArrayList<>(), false, false, new ArrayList<>(), "messageId",
+ new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl");
+ }
+
+ @Test
+ public void createNetworkATest_NotifyException() throws IOException {
+ stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ .withRequestBody(containing("tenantId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
+ .withStatus(HttpStatus.SC_OK)));
+ mockOpenStackGetStackCreatedVUSP_200();
+ mockOpenStackPostStacks_200();
+ impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0",
+ "physicalNetworkName", new ArrayList<>(), false, false, new ArrayList<>(), "messageId",
+ new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl");
+ }
+
+ @Test
+ public void createNetworkATest_NetworkException() {
+ impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0",
+ "physicalNetworkName", new ArrayList<>(), false, false, new ArrayList<>(), "messageId",
+ new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl");
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
new file mode 100644
index 0000000000..a29f2df96a
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
@@ -0,0 +1,282 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.adapters.network;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeletePublicUrlStackByNameAndID_204;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetPublicUrlStackByNameAndID_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetPublicUrlStackByNameAndID_204;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackAppC_404;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreatedAppC_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreatedVUSP_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVUSP_404;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostPublicUrlWithBodyFile_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPublicUrlStackByID_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPublicUrlStackByName_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutPublicUrlStackByNameAndID_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.json.JSONException;
+import org.junit.Test;
+import org.onap.so.adapters.nwrest.CreateNetworkRequest;
+import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
+import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
+import org.onap.so.adapters.nwrest.NetworkTechnology;
+import org.onap.so.adapters.nwrest.QueryNetworkError;
+import org.onap.so.adapters.nwrest.QueryNetworkResponse;
+import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
+import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
+import org.onap.so.adapters.vnf.BaseRestTestUtils;
+import org.onap.so.client.policy.JettisonStyleMapperProvider;
+import org.onap.so.cloud.CloudConfig;
+import org.onap.so.entity.MsoRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+
+public class NetworkAdapterRestTest extends BaseRestTestUtils {
+
+ @Autowired
+ private CloudConfig cloudConfig;
+ @Autowired
+ private JettisonStyleMapperProvider jettisonTypeObjectMapper;
+ private static final String CLOUDSITE_ID = "mtn13";
+ private static final String TENANT_ID = "ba38bc24a2ef4fb2ad2810c894f1938f";
+ private static final String NETWORK_ID = "da886914-efb2-4917-b335-c8381528d90b";
+ private static final String NETWORK_TYPE = "CONTRAIL30_BASIC";
+ private static final String MODEL_CUSTOMIZATION_UUID = "3bdbb104-476c-483e-9f8b-c095b3d308ac";
+ private static final String MSO_SERVICE_INSTANCE_ID = "05869d5f-47df-4b45-bbfc-4f03ce0a50bf";
+ private static final String MSO_REQUEST_ID = "requestId";
+ private static final String NETWORK_NAME = "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0";
+
+ @Test
+ public void testCreateNetwork() throws JSONException, JsonParseException, JsonMappingException, IOException {
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+ CreateNetworkRequest request = new CreateNetworkRequest();
+ request.setBackout(true);
+ request.setSkipAAI(true);
+ request.setFailIfExists(false);
+ MsoRequest msoReq = new MsoRequest();
+ NetworkTechnology networkTechnology = NetworkTechnology.CONTRAIL;
+
+ msoReq.setRequestId(MSO_REQUEST_ID);
+ msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
+ request.setMsoRequest(msoReq);
+ request.setCloudSiteId(CLOUDSITE_ID);
+ request.setTenantId(TENANT_ID);
+ request.setNetworkId(NETWORK_ID);
+ request.setNetworkName(NETWORK_NAME);
+ request.setNetworkType(NETWORK_TYPE);
+ request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
+ request.setNetworkTechnology(networkTechnology);
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackPostPublicUrlWithBodyFile_200();
+
+ mockOpenStackGetStackCreatedVUSP_200();
+
+ mockOpenStackGetStackVUSP_404();
+
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+ HttpEntity<CreateNetworkRequest> entity = new HttpEntity<CreateNetworkRequest>(request, headers);
+ ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class);
+
+ CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
+ new File("src/test/resources/__files/CreateNetworkResponse.json"), CreateNetworkResponse.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(response.getBody(), sameBeanAs(expectedResponse));
+ }
+
+ @Test
+ public void testCreateNetwork_JSON() throws JSONException, JsonParseException, JsonMappingException, IOException {
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackPostPublicUrlWithBodyFile_200();
+
+ mockOpenStackGetStackCreatedAppC_200();
+
+ mockOpenStackGetStackAppC_404();
+
+ headers.add("Content-Type", MediaType.APPLICATION_JSON);
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+
+ String request = readJsonFileAsString("src/test/resources/CreateNetwork.json");
+ HttpEntity<String> entity = new HttpEntity<String>(request, headers);
+
+ ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class);
+
+ CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
+ new File("src/test/resources/__files/CreateNetworkResponse2.json"), CreateNetworkResponse.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(response.getBody(), sameBeanAs(expectedResponse));
+ }
+
+ @Test
+ public void testDeleteNetwork() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+ DeleteNetworkRequest request = new DeleteNetworkRequest();
+
+ MsoRequest msoReq = new MsoRequest();
+
+ msoReq.setRequestId(MSO_REQUEST_ID);
+ msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
+ request.setMsoRequest(msoReq);
+ request.setCloudSiteId(CLOUDSITE_ID);
+ request.setTenantId(TENANT_ID);
+ request.setNetworkId(NETWORK_ID);
+ request.setNetworkType(NETWORK_TYPE);
+ request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
+ request.setNetworkStackId(NETWORK_ID);
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackPublicUrlStackByID_200(wireMockPort);
+
+ mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockPort);
+
+ mockOpenStackDeletePublicUrlStackByNameAndID_204();
+
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+
+ HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(request, headers);
+
+ ResponseEntity<DeleteNetworkResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.DELETE, entity, DeleteNetworkResponse.class);
+
+ DeleteNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
+ new File("src/test/resources/__files/DeleteNetworkResponse.json"), DeleteNetworkResponse.class);
+
+ assertThat(response.getBody(), sameBeanAs(expectedResponse));
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+
+ }
+
+ @Test
+ public void testQueryNetwork_Exception() throws IOException{
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+ MsoRequest msoReq = new MsoRequest();
+ msoReq.setRequestId(MSO_REQUEST_ID);
+ msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+
+ HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(headers);
+
+ ResponseEntity<QueryNetworkError> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.GET,
+ entity, QueryNetworkError.class);
+
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+
+ }
+
+ @Test
+ public void testQueryNetwork() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_200();
+
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+ HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(headers);
+
+ ResponseEntity<QueryNetworkResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"+"?cloudSiteId=" + CLOUDSITE_ID + "&tenantId=" + TENANT_ID
+ + "&aaiNetworkId=aaiNetworkId"), HttpMethod.GET,
+ entity, QueryNetworkResponse.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
+
+ }
+
+ @Test
+ public void testUpdateNetwork() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+ UpdateNetworkRequest request = new UpdateNetworkRequest();
+
+ MsoRequest msoReq = new MsoRequest();
+
+ msoReq.setRequestId(MSO_REQUEST_ID);
+ msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
+ request.setMsoRequest(msoReq);
+ request.setCloudSiteId(CLOUDSITE_ID);
+ request.setTenantId(TENANT_ID);
+ request.setNetworkId(NETWORK_ID);
+ request.setNetworkName(NETWORK_NAME);
+ request.setNetworkType(NETWORK_TYPE);
+ request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
+ request.setNetworkStackId(NETWORK_ID);
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackPublicUrlStackByName_200(wireMockPort);
+
+ mockOpenStackPublicUrlStackByID_200(wireMockPort);
+
+ mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockPort);
+
+ mockOpenStackPutPublicUrlStackByNameAndID_200();
+
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+
+ HttpEntity<UpdateNetworkRequest> entity = new HttpEntity<UpdateNetworkRequest>(request, headers);
+
+ ResponseEntity<UpdateNetworkResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.PUT, entity, UpdateNetworkResponse.class);
+
+ UpdateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
+ new File("src/test/resources/__files/UpdateNetworkResponse.json"), UpdateNetworkResponse.class);
+
+ assertThat(response.getBody(), sameBeanAs(expectedResponse));
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Override
+ protected String readJsonFileAsString(String fileLocation) throws JsonParseException, JsonMappingException, IOException{
+ return new String(Files.readAllBytes(Paths.get(fileLocation)));
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionBeanTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionBeanTest.java
new file mode 100644
index 0000000000..a1e0a16819
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionBeanTest.java
@@ -0,0 +1,41 @@
+/*
+* ============LICENSE_START=======================================================
+ * ONAP : SO
+ * ================================================================================
+ * Copyright (C) 2018 TechMahindra
+ * ================================================================================
+ * 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.onap.so.adapters.network.exceptions;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.so.openstack.exceptions.MsoExceptionCategory;
+
+public class NetworkExceptionBeanTest {
+
+ NetworkExceptionBean neb=new NetworkExceptionBean();
+ MsoExceptionCategory msc=MsoExceptionCategory.INTERNAL;
+
+ @Test
+ public void test() {
+ neb.setRolledBack(true);
+ neb.setMessage("message");
+ neb.setCategory(msc);
+ assertEquals("message", neb.getMessage());
+ assertEquals(msc, neb.getCategory());
+ assertEquals(true, neb.isRolledBack());
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionTest.java
new file mode 100644
index 0000000000..bd5b07de1f
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionTest.java
@@ -0,0 +1,50 @@
+/*
+* ============LICENSE_START=======================================================
+ * ONAP : SO
+ * ================================================================================
+ * Copyright (C) 2018 TechMahindra
+ * ================================================================================
+ * 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.onap.so.adapters.network.exceptions;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.exceptions.MsoExceptionCategory;
+
+public class NetworkExceptionTest{
+
+ NetworkException ne=new NetworkException("msg");
+ NetworkExceptionBean neb =new NetworkExceptionBean();
+ MsoException msoException= new MsoException("msoException") {
+ private static final long serialVersionUID = 1L;
+ };
+ MsoExceptionCategory msc=MsoExceptionCategory.INTERNAL;
+ NetworkException ne1=new NetworkException(msoException);
+ NetworkException ne2=new NetworkException(ne);
+ NetworkException ne3=new NetworkException("msg", ne);
+ NetworkException ne4=new NetworkException("msg", msoException);
+ NetworkException ne5=new NetworkException("msg", msc);
+ NetworkException ne6=new NetworkException("msg", msc, ne);
+
+ @Test
+ public void test() {
+ ne.setFaultInfo(neb);
+ assertEquals(ne.getFaultInfo(), neb);
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/MsoTenantAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/MsoTenantAdapterImplTest.java
new file mode 100644
index 0000000000..8a55177f1e
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/MsoTenantAdapterImplTest.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.onap.so.adapters.tenant;
+
+import java.util.HashMap;
+
+import javax.xml.ws.Holder;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.adapters.tenantrest.TenantRollback;
+import org.onap.so.cloud.CloudConfig;
+import org.onap.so.entity.MsoRequest;
+
+@RunWith(MockitoJUnitRunner.class)
+public class MsoTenantAdapterImplTest {
+
+ @Mock
+ private CloudConfig cloudConfig;
+
+ @Spy
+ @InjectMocks
+ private MsoTenantAdapterImpl msoTenantAdapter;
+
+ @Test
+ public void healthCheck() throws Exception {
+ msoTenantAdapter.healthCheck();
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void createTenant() throws Exception {
+ msoTenantAdapter.createTenant("site", "tenant", new HashMap<>(),
+ true, true, new MsoRequest(), new Holder<String>(), new Holder<TenantRollback>());
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void queryTenant() throws Exception {
+ msoTenantAdapter.queryTenant("site", "tenant", new MsoRequest(),
+ new Holder<>(), new Holder<>(), new Holder<>());
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void deleteTenant() throws Exception {
+ msoTenantAdapter.deleteTenant("cloud", "tenant", new MsoRequest(), new Holder<Boolean>());
+ }
+
+ @Test
+ public void rollbackTenant() throws Exception {
+ msoTenantAdapter.rollbackTenant(new TenantRollback());
+ }
+
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java
new file mode 100644
index 0000000000..acfe6568af
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java
@@ -0,0 +1,254 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.adapters.tenant;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteTenantById_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetMetadata_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetRoles_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetTenantById_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetTenantById_404;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetTenantByName_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetTenantByName_404;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetUser_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostMetadata_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostTenantWithBodyFile_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostTenant_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutRolesAdmin_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccessAdmin;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.adapters.tenantrest.CreateTenantRequest;
+import org.onap.so.adapters.tenantrest.CreateTenantResponse;
+import org.onap.so.adapters.tenantrest.DeleteTenantRequest;
+import org.onap.so.adapters.tenantrest.DeleteTenantResponse;
+import org.onap.so.adapters.vnf.BaseRestTestUtils;
+import org.onap.so.client.policy.JettisonStyleMapperProvider;
+import org.onap.so.cloud.CloudConfig;
+import org.onap.so.entity.MsoRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+
+public class TenantAdapterRestTest extends BaseRestTestUtils {
+
+ @Autowired
+ private CloudConfig cloudConfig;
+ @Autowired
+ private JettisonStyleMapperProvider jettisonTypeObjectMapper;
+
+ @Test
+ public void testCreateTenantCreated() throws JsonParseException, JsonMappingException, IOException {
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+ CreateTenantRequest request = new CreateTenantRequest();
+ String cloudSiteId = "mtn13";
+ String requestId = "62265093-277d-4388-9ba6-449838ade586";
+ String serviceInstanceId = "4147e06f-1b89-49c5-b21f-4faf8dc9805a";
+ String tenantName = "testingTenantName";
+ boolean failIfExists = true;
+ boolean backout = true;
+ Map<String, String> metaData = new HashMap<>();
+ metaData.put("key1", "value2");
+ MsoRequest msoReq = new MsoRequest();
+ msoReq.setRequestId(requestId);
+ msoReq.setServiceInstanceId(serviceInstanceId);
+
+ request.setCloudSiteId(cloudSiteId);
+ request.setMsoRequest(msoReq);
+ request.setTenantName(tenantName);
+ request.setMetadata(metaData);
+ request.setBackout(backout);
+ request.setFailIfExists(failIfExists);
+
+ mockOpenStackResponseAccessAdmin(wireMockPort);
+
+ mockOpenStackGetTenantByName_404(tenantName);
+
+ mockOpenStackPostTenantWithBodyFile_200();
+
+ mockOpenStackGetUser_200("m93945");
+
+ mockOpenStackGetRoles_200("OS-KSADM");
+
+ mockOpenStackPutRolesAdmin_200("OS-KSADM");
+
+ mockOpenStackPostMetadata_200();
+
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+ HttpEntity<CreateTenantRequest> entity = new HttpEntity<CreateTenantRequest>(request, headers);
+
+ ResponseEntity<CreateTenantResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/tenants"), HttpMethod.POST,
+ entity, CreateTenantResponse.class);
+
+ CreateTenantResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
+ new File("src/test/resources/__files/CreateTenantResponse_Created.json"), CreateTenantResponse.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(response.getBody(), sameBeanAs(expectedResponse));
+ }
+
+ @Test
+ public void testCreateTenantExists() throws JsonParseException, JsonMappingException, IOException {
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+ CreateTenantRequest request = new CreateTenantRequest();
+ String cloudSiteId = "mtn13";
+ String requestId = "62265093-277d-4388-9ba6-449838ade586";
+ String serviceInstanceId = "4147e06f-1b89-49c5-b21f-4faf8dc9805a";
+ String tenantName = "testingTenantName";
+ boolean failIfExists = false;
+ boolean backout = true;
+ Map<String, String> metadata = new HashMap<>();
+
+ MsoRequest msoReq = new MsoRequest();
+ msoReq.setRequestId(requestId);
+ msoReq.setServiceInstanceId(serviceInstanceId);
+
+ request.setCloudSiteId(cloudSiteId);
+ request.setMsoRequest(msoReq);
+ request.setTenantName(tenantName);
+ request.setMetadata(metadata);
+ request.setBackout(backout);
+ request.setFailIfExists(failIfExists);
+
+ mockOpenStackResponseAccessAdmin(wireMockPort);
+
+ mockOpenStackGetTenantByName_200(tenantName);
+
+ mockOpenStackPostTenant_200();
+
+ mockOpenStackGetMetadata_200();
+
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+ HttpEntity<CreateTenantRequest> entity = new HttpEntity<CreateTenantRequest>(request, headers);
+
+ ResponseEntity<CreateTenantResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/tenants"), HttpMethod.POST,
+ entity, CreateTenantResponse.class);
+
+ CreateTenantResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
+ new File("src/test/resources/__files/CreateTenantResponse_Exists.json"), CreateTenantResponse.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(response.getBody(), sameBeanAs(expectedResponse));
+ }
+
+ @Test
+ public void testDeleteTenant() throws IOException {
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+ DeleteTenantRequest request = new DeleteTenantRequest();
+ String cloudSiteId = "mtn13";
+ String tenantId = "tenantId";
+ String requestId = "ra1";
+ String serviceInstanceId = "sa1";
+
+ MsoRequest msoReq = new MsoRequest();
+ msoReq.setRequestId(requestId);
+ msoReq.setServiceInstanceId(serviceInstanceId);
+
+ request.setCloudSiteId(cloudSiteId);
+ request.setTenantId(tenantId);
+ request.setMsoRequest(msoReq);
+
+ mockOpenStackResponseAccessAdmin(wireMockPort);
+
+ mockOpenStackGetTenantById_200(tenantId);
+
+ mockOpenStackDeleteTenantById_200(tenantId);
+
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+ HttpEntity<DeleteTenantRequest> entity = new HttpEntity<DeleteTenantRequest>(request, headers);
+
+ ResponseEntity<DeleteTenantResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/tenants/tenantId"), HttpMethod.DELETE,
+ entity, DeleteTenantResponse.class);
+
+ DeleteTenantResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
+ new File("src/test/resources/__files/DeleteTenantResponse_Success.json"), DeleteTenantResponse.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(response.getBody(), sameBeanAs(expectedResponse));
+ }
+
+ //@Ignore
+ @Test
+ public void testDeleteTenantFails() throws IOException {
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+ DeleteTenantRequest request = new DeleteTenantRequest();
+ String cloudSiteId = "mtn13";
+ String tenantId = "tenantId";
+ String requestId = "ra1";
+ String serviceInstanceId = "sa1";
+
+ MsoRequest msoReq = new MsoRequest();
+ msoReq.setRequestId(requestId);
+ msoReq.setServiceInstanceId(serviceInstanceId);
+
+ request.setCloudSiteId(cloudSiteId);
+ request.setTenantId(tenantId);
+ request.setMsoRequest(msoReq);
+
+ mockOpenStackResponseAccessAdmin(wireMockPort);
+
+ mockOpenStackGetTenantById_404(tenantId);
+
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+ HttpEntity<DeleteTenantRequest> entity = new HttpEntity<DeleteTenantRequest>(request, headers);
+
+ ResponseEntity<DeleteTenantResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/tenants/tenantId"), HttpMethod.DELETE,
+ entity, DeleteTenantResponse.class);
+
+ DeleteTenantResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
+ new File("src/test/resources/__files/DeleteTenantResponse_Failed.json"), DeleteTenantResponse.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(response.getBody(), sameBeanAs(expectedResponse));
+ }
+
+ @Ignore
+ @Test
+ public void testQuaryTenant() {
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java
new file mode 100644
index 0000000000..6288dc9573
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java
@@ -0,0 +1,32 @@
+/*
+* ============LICENSE_START=======================================================
+ * ONAP : SO
+ * ================================================================================
+ * Copyright (C) 2018 TechMahindra
+ * ================================================================================
+ * 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.onap.so.adapters.tenant.exceptions;
+
+import org.junit.Test;
+
+public class TenantAlreadyExistsTest {
+
+ @Test
+ public void test() {
+ TenantAlreadyExists tar= new TenantAlreadyExists("name", "cloudId", "tenantId");
+ assert(tar!=null);
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java
new file mode 100644
index 0000000000..178495105b
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java
@@ -0,0 +1,47 @@
+/*
+* ============LICENSE_START=======================================================
+ * ONAP : SO
+ * ================================================================================
+ * Copyright (C) 2018 TechMahindra
+ * ================================================================================
+ * 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.onap.so.adapters.tenant.exceptions;
+
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.onap.so.openstack.exceptions.MsoExceptionCategory;
+
+public class TenantExceptionBeanTest {
+
+@Mock
+private MsoExceptionCategory mec;
+
+@InjectMocks
+private TenantExceptionBean teb;
+
+@Test
+ public void test() {
+ teb =new TenantExceptionBean("message",mec);
+ teb.setMessage("message");
+ teb.setCategory(MsoExceptionCategory.INTERNAL);
+ teb.setCategory(MsoExceptionCategory.IO);
+ teb.setCategory(MsoExceptionCategory.OPENSTACK);
+ teb.setCategory(MsoExceptionCategory.USERDATA);
+ assert(teb.getMessage().equals("message"));
+ assert(teb.getCategory()!=null);
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java
new file mode 100644
index 0000000000..73614a3628
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java
@@ -0,0 +1,49 @@
+/*
+* ============LICENSE_START=======================================================
+ * ONAP : SO
+ * ================================================================================
+ * Copyright (C) 2018 TechMahindra
+ * ================================================================================
+ * 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.onap.so.adapters.tenant.exceptions;
+
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.onap.so.openstack.exceptions.MsoExceptionCategory;
+
+public class TenantExceptionTest {
+
+ @Mock
+ private TenantExceptionBean teb;
+
+ @Mock
+ private MsoExceptionCategory mec;
+
+ @InjectMocks
+ private TenantException te;
+
+ @Test
+ public void test() {
+ teb=new TenantExceptionBean("message");
+ teb.setMessage("message");
+ teb.setCategory(MsoExceptionCategory.INTERNAL);
+ te = new TenantException("message", mec);
+ te.setFaultInfo(teb);
+ assert(te.getFaultInfo()!=null);
+ assert(te.getFaultInfo().equals(teb));
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java
new file mode 100644
index 0000000000..141be6bd7c
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java
@@ -0,0 +1,116 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so.adapters.valet;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockValetConfirmPutRequest_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockValetCreatePostResponse_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockValetCreatePutResponse_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockValetDeleteDeleteResponse_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockValetRollbackPutRequest_200;
+
+import java.io.File;
+
+import org.apache.http.HttpStatus;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.adapters.valet.beans.ValetConfirmResponse;
+import org.onap.so.adapters.valet.beans.ValetCreateResponse;
+import org.onap.so.adapters.valet.beans.ValetDeleteResponse;
+import org.onap.so.adapters.valet.beans.ValetRollbackResponse;
+import org.onap.so.adapters.valet.beans.ValetUpdateResponse;
+import org.onap.so.adapters.vnf.BaseRestTestUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class ValetClientTest extends BaseRestTestUtils {
+ @Autowired
+ protected ValetClient client;
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @Before
+ public void init() {
+ client.baseUrl = "http://localhost:" + wireMockPort;
+ }
+
+ @Test
+ public void testCallValetCreateRequest() throws Exception {
+ ValetCreateResponse vcr = mapper.readValue(new File("src/test/resources/__files/ValetCreateRequest.json"), ValetCreateResponse.class);
+ GenericValetResponse<ValetCreateResponse> expected = new GenericValetResponse<ValetCreateResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vcr);
+
+ mockValetCreatePostResponse_200("requestId", mapper.writeValueAsString(vcr));
+
+ GenericValetResponse<ValetCreateResponse> actual = client.callValetCreateRequest("requestId", "regionId", "tenantId", "serviceInstanceId", "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void testCallValetUpdateRequest() throws Exception {
+ ValetUpdateResponse vur = mapper.readValue(new File("src/test/resources/__files/ValetCreateRequest.json"), ValetUpdateResponse.class);
+ GenericValetResponse<ValetUpdateResponse> expected = new GenericValetResponse<ValetUpdateResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vur);
+
+ mockValetCreatePutResponse_200("requestId", mapper.writeValueAsString(vur));
+
+ GenericValetResponse<ValetUpdateResponse> actual = client.callValetUpdateRequest("requestId", "regionId", "tenantId", "serviceInstanceId", "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void testCallValetDeleteRequest() throws Exception {
+ ValetDeleteResponse vdr = mapper.readValue(new File("src/test/resources/__files/ValetDeleteRequest.json"), ValetDeleteResponse.class);
+ GenericValetResponse<ValetDeleteResponse> expected = new GenericValetResponse<ValetDeleteResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vdr);
+
+ mockValetDeleteDeleteResponse_200("requestId", mapper.writeValueAsString(vdr));
+
+ GenericValetResponse<ValetDeleteResponse> actual = client.callValetDeleteRequest("requestId", "regionId", "tenantId", "vfModuleId", "vfModuleName");
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void testCallValetConfirmRequest() throws Exception {
+ ValetConfirmResponse vcr = new ValetConfirmResponse();
+ GenericValetResponse<ValetConfirmResponse> expected = new GenericValetResponse<ValetConfirmResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vcr);
+
+ mockValetConfirmPutRequest_200("requestId", "{}");
+
+ GenericValetResponse<ValetConfirmResponse> actual = client.callValetConfirmRequest("requestId", "stackId");
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void testCallValetRollbackRequest() throws Exception {
+ ValetRollbackResponse vrr = new ValetRollbackResponse();
+ GenericValetResponse<ValetRollbackResponse> expected = new GenericValetResponse<ValetRollbackResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vrr);
+
+ mockValetRollbackPutRequest_200("requestId", "{}");
+
+ GenericValetResponse<ValetRollbackResponse> actual = client.callValetRollbackRequest("requestId", "stackId", true, "error");
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
new file mode 100644
index 0000000000..a2faaaff78
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.adapters.vnf;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.adapters.openstack.MsoOpenstackAdaptersApplication;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.embedded.LocalServerPort;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
+import org.springframework.http.HttpHeaders;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.reset;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = MsoOpenstackAdaptersApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+@AutoConfigureWireMock(port = 0)
+public class BaseRestTestUtils {
+ @Value("${wiremock.server.port}")
+ protected int wireMockPort;
+
+ @Autowired
+ @Qualifier("JettisonStyle")
+ protected TestRestTemplate restTemplate;
+
+ protected HttpHeaders headers = new HttpHeaders();
+
+ @LocalServerPort
+ private int port;
+
+ protected String readJsonFileAsString(String fileLocation) throws JsonParseException, JsonMappingException, IOException{
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode jsonNode = mapper.readTree(new File(fileLocation));
+ return jsonNode.asText();
+ }
+
+ protected String createURLWithPort(String uri) {
+ return "http://localhost:" + port + uri;
+ }
+
+ protected String readFile(String fileName) throws IOException {
+ try (BufferedReader br = new BufferedReader(new FileReader(fileName))) {
+ StringBuilder sb = new StringBuilder();
+ String line = br.readLine();
+
+ while (line != null) {
+ sb.append(line);
+ sb.append("\n");
+ line = br.readLine();
+ }
+ return sb.toString();
+ }
+ }
+
+ @Before
+ public void setUp(){
+ reset();
+ }
+
+ @Test
+ public void testNothing(){
+
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java
new file mode 100644
index 0000000000..1038299190
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.adapters.vnf;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.inject.Provider;
+
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.embedded.LocalServerPort;
+
+public class BpelRestClientTest extends BaseRestTestUtils{
+
+
+ @LocalServerPort
+ private int port;
+ @Autowired
+ @Qualifier("VnfBpel")
+ private Provider<BpelRestClient> clientProvider;
+
+ @Test
+ public void verifyPropertiesRead() {
+ BpelRestClient client = clientProvider.get();
+
+ assertEquals(5, client.getRetryCount());
+ assertEquals(30, client.getConnectTimeout());
+ assertEquals("test:test", client.getCredentials());
+ assertEquals(30, client.getSocketTimeout());
+ assertEquals("408, 429, 500, 502, 503, 504, 900", client.getRetryList());
+ assertEquals(-15, client.getRetryInterval());
+
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java
new file mode 100644
index 0000000000..d0425371bb
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java
@@ -0,0 +1,158 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.adapters.vnf;
+
+
+import org.apache.http.HttpStatus;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onap.so.adapters.vnf.exceptions.VnfException;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.beans.VnfRollback;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.mock.mockito.SpyBean;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.containing;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.verify;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
+
+public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
+
+ @Autowired
+ MsoVnfAdapterAsyncImpl instance;
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Test
+ public void healthCheckVNFTest() {
+ instance.healthCheckA();
+ }
+
+ @Test
+ public void createVNFTest() throws Exception {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_200();
+ stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody
+ (containing("messageId"))
+ .willReturn(aResponse().withStatus(HttpStatus.SC_OK)));
+
+ String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId";
+ String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest";
+ instance.createVnfA("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId|1", new HashMap<String, String>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, "messageId",
+ msoRequest, notificationUrl);
+
+ verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")));
+ }
+
+ @Test
+ public void createVNFTest_Exception() throws Exception {
+ String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest";
+ instance.createVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ "volumeGroupHeatStackId|1", new HashMap<String, String>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, "messageId",
+ null, notificationUrl);
+
+ verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")));
+
+ }
+
+ @Test
+ public void updateVnfTest() throws Exception{
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody
+ (containing("messageId"))
+ .willReturn(aResponse().withStatus(HttpStatus.SC_OK)));
+ String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest";
+ instance.updateVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ "volumeGroupHeatStackId|1", map, "messageId", msoRequest,
+ notificationUrl);
+ }
+
+ @Test
+ public void updateVnfTest_Exception() throws Exception{
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody
+ (containing("messageId"))
+ .willReturn(aResponse().withStatus(HttpStatus.SC_OK)));
+ String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest";
+ instance.updateVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ "volumeGroupHeatStackId|1", map, "messageId", msoRequest,
+ notificationUrl);
+ verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")));
+ }
+
+ @Test
+ public void queryVnfTest() {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+ instance.queryVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest,
+ "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest");
+ }
+
+ @Test
+ public void deleteVnfTest() {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+ instance.deleteVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest,
+ "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest");
+ }
+
+ @Test
+ public void rollbackVnfTest() {
+ VnfRollback vnfRollBack = new VnfRollback();
+ vnfRollBack.setCloudSiteId("mdt1");
+ vnfRollBack.setTenantId("88a6ca3ee0394ade9403f075db23167e");
+ vnfRollBack.setVnfId("ff5256d1-5a33-55df-13ab-12abad84e7ff");
+ instance.rollbackVnfA(vnfRollBack, "messageId",
+ "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest");
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
new file mode 100644
index 0000000000..0ce3683a1e
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
@@ -0,0 +1,562 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.adapters.vnf;
+
+
+import com.github.tomakehurst.wiremock.client.WireMock;
+import org.apache.http.HttpStatus;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.mockito.MockitoAnnotations;
+import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists;
+import org.onap.so.adapters.vnf.exceptions.VnfException;
+import org.onap.so.adapters.vnf.exceptions.VnfNotFound;
+import org.onap.so.db.catalog.beans.HeatEnvironment;
+import org.onap.so.db.catalog.beans.HeatTemplate;
+import org.onap.so.db.catalog.beans.HeatTemplateParam;
+import org.onap.so.db.catalog.beans.VfModule;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.beans.HeatStatus;
+import org.onap.so.openstack.beans.StackInfo;
+import org.onap.so.openstack.beans.VnfRollback;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.utils.MsoHeatUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.mock.mockito.MockBean;
+
+import javax.xml.ws.Holder;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStack;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackGetWithResponse;
+
+
+public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Autowired
+ private MsoHeatUtils heatUtils;
+
+ @Autowired
+ MsoVnfAdapterImpl instance;
+
+ String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId";
+
+ @Before
+ public void before() {
+ MockitoAnnotations.initMocks(this);
+ WireMock.reset();
+ }
+
+ @Test
+ @Ignore
+ public void healthCheckVNFTest() {
+ MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl();
+ instance.healthCheck();
+ }
+
+ @Test
+ public void createVnfTest() throws Exception {
+ StackInfo info = new StackInfo();
+ info.setStatus(HeatStatus.CREATED);
+
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_200();
+
+ MsoRequest msoRequest = getMsoRequest();
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void createVnfTest_HeatStatusUpdating() throws Exception {
+ expectedException.expect(VnfAlreadyExists.class);
+ mockOpenStackResponseAccess(wireMockPort);
+
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_Stack_Updating_VfModule.json")
+ .withStatus(HttpStatus.SC_OK)));
+
+ MsoRequest msoRequest = getMsoRequest();
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void createVnfTest_HeatStatusUpdated() throws Exception {
+ expectedException.expect(VnfAlreadyExists.class);
+ mockOpenStackResponseAccess(wireMockPort);
+
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_StackId.json")
+ .withStatus(HttpStatus.SC_OK)));
+
+ MsoRequest msoRequest = getMsoRequest();
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void createVnfTest_HeatStatusFailed() throws Exception {
+ expectedException.expect(VnfAlreadyExists.class);
+ mockOpenStackResponseAccess(wireMockPort);
+
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_Stack_Failed_VfModule.json")
+ .withStatus(HttpStatus.SC_OK)));
+
+ MsoRequest msoRequest = getMsoRequest();
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void createVnfTest_HeatStatusCreated() throws Exception {
+ expectedException.expect(VnfAlreadyExists.class);
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetStackVfModule_200();
+
+ MsoRequest msoRequest = getMsoRequest();
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
+ Boolean.TRUE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+
+ @Test
+ public void createVnfTest_ExceptionInGettingHeat() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = getMsoRequest();
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void createVnfTest_NestedHeatStatusNotFound() throws Exception {
+ expectedException.expect(VnfException.class);
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_404();
+
+ MsoRequest msoRequest = getMsoRequest();
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void createVnfTest_ExceptionInGettingNestedHeat() throws Exception {
+ expectedException.expect(VnfException.class);
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_404();
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
+
+ MsoRequest msoRequest = getMsoRequest();
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void createVnfTest_NestedBaseHeatStatus_NotFound() throws Exception {
+ expectedException.expect(VnfException.class);
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_404();
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json")
+ .withStatus(HttpStatus.SC_OK)));
+
+ MsoRequest msoRequest = getMsoRequest();
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void createVnfTest_ExceptionInGettingBaseNestedHeat() throws Exception {
+ expectedException.expect(VnfException.class);
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_404();
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
+
+ MsoRequest msoRequest = getMsoRequest();
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void createVnfTest_ExceptionInCreateStack() throws Exception {
+ expectedException.expect(VnfException.class);
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_404();
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ VfModule vfModule = new VfModule();
+ vfModule.setIsBase(false);
+
+ HeatTemplate heatTemplate = new HeatTemplate();
+ heatTemplate.setTemplateBody("");
+ heatTemplate.setTimeoutMinutes(200);
+ vfModule.setModuleHeatTemplate(heatTemplate);
+ vfModuleCustomization.setVfModule(vfModule);
+
+ HeatEnvironment heatEnvironment = new HeatEnvironment();
+ heatEnvironment.setEnvironment("ist");
+ vfModuleCustomization.setHeatEnvironment(heatEnvironment);
+
+ MsoRequest msoRequest = getMsoRequest();
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void createVnfTest_ModelCustUuidIsNull() throws Exception {
+ expectedException.expect(VnfException.class);
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_404();
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ VfModule vfModule = new VfModule();
+ vfModule.setIsBase(false);
+
+ HeatTemplate heatTemplate = new HeatTemplate();
+ heatTemplate.setTemplateBody("");
+ heatTemplate.setTimeoutMinutes(200);
+ vfModule.setModuleHeatTemplate(heatTemplate);
+ vfModuleCustomization.setVfModule(vfModule);
+
+ HeatEnvironment heatEnvironment = new HeatEnvironment();
+ heatEnvironment.setEnvironment("ist");
+ vfModuleCustomization.setHeatEnvironment(heatEnvironment);
+
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setAicVersionMin("1");
+ vnfResource.setAicVersionMin("3");
+
+
+ MsoRequest msoRequest = getMsoRequest();
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "XVFMOD",
+ "volumeGroupHeatStackId", "baseVfHeatStackId", null, map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void createVnfTest_HeatEnvironment_ContainsParameters() throws Exception {
+ expectedException.expect(VnfException.class);
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_404();
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
+
+ MsoRequest msoRequest = getMsoRequest();
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ private MsoRequest getMsoRequest() {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+ return msoRequest;
+ }
+
+ @Test
+ public void updateVnfTest_CloudSiteIdNotFound() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = getMsoRequest();
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.updateVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ "volumeGroupHeatStackId|1", "baseVfHeatStackId", "vfModuleStackId",
+ "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void updateVnfTest_HeatStackNotFound() throws Exception {
+ expectedException.expect(VnfNotFound.class);
+ MsoRequest msoRequest = getMsoRequest();
+ mockOpenStackResponseAccess(wireMockPort);
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
+ "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void updateVnfTest_ExceptionInGettingNestedHeatStack() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = getMsoRequest();
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_200();
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
+ "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void updateVnfTest_NestedHeatStackNotFound() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = getMsoRequest();
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_200();
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(HttpStatus.SC_NOT_FOUND)));
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
+ "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void updateVnfTest_ExceptionInGettingNestedBaseHeatStack() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = getMsoRequest();
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_200();
+ mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
+ mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_INTERNAL_SERVER_ERROR,"OpenstackResponse_Stack_Created_VfModule.json");
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
+ "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void updateVnfTest_NestedBaseHeatStackNotFound() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = getMsoRequest();
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_200();
+ mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
+ mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_NOT_FOUND,"OpenstackResponse_Stack_Created_VfModule.json");
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
+ "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void updateVnfTest_MissingParams() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = getMsoRequest();
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_200();
+ mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
+ mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
+ "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void updateVnfTest_UpdateStackException() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = getMsoRequest();
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_200();
+ mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
+ mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
+
+ VfModuleCustomization vfModuleCustomization = getVfModuleCustomization();
+ vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>());
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
+ "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void updateVnfTest() throws Exception {
+ MsoRequest msoRequest = getMsoRequest();
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenstackGetWithResponse("/mockPublicUrl/stacks/"+vnfName,HttpStatus.SC_OK,"OpenstackResponse_Stack_UpdateComplete.json");
+ mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
+ mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
+ mockOpenStackPutStack("null/stackId", HttpStatus.SC_OK);
+ mockOpenstackGetWithResponse("/mockPublicUrl/stacks/null/stackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_UpdateComplete.json");
+
+ VfModuleCustomization vfModuleCustomization = getVfModuleCustomization();
+ vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>());
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
+ "b4ea86b4-253f-11e7-93ae-92361f002671", map, msoRequest, new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ @Ignore
+ public void deleteVnfTest() throws MsoException {
+
+ Map<String, Object> outputs = new HashMap<>();
+ outputs.put("Key1", "value1");
+ when(heatUtils.queryStackForOutputs("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12")).thenReturn(outputs);
+
+ MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl();
+ MsoRequest msoRequest = getMsoRequest();
+ try {
+ instance.deleteVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest,
+ new Holder<Map<String, String>>());
+ } catch (Exception e) {
+
+ }
+ }
+
+ private VfModuleCustomization getVfModuleCustomization() {
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ VfModule vfModule = new VfModule();
+ vfModule.setIsBase(false);
+
+ HeatTemplate heatTemplate = new HeatTemplate();
+ heatTemplate.setTemplateBody("");
+ heatTemplate.setTimeoutMinutes(200);
+ HeatTemplateParam heatTemplateParam = new HeatTemplateParam();
+ heatTemplateParam.setParamAlias("ParamAlias");
+ heatTemplateParam.setRequired(true);
+ heatTemplateParam.setParamName("test");
+ Set set = new HashSet();
+ set.add(heatTemplateParam);
+ heatTemplate.setParameters(set);
+ vfModule.setModuleHeatTemplate(heatTemplate);
+ vfModuleCustomization.setVfModule(vfModule);
+
+ HeatEnvironment heatEnvironment = new HeatEnvironment();
+ heatEnvironment.setEnvironment("parameters:ist");
+ vfModuleCustomization.setHeatEnvironment(heatEnvironment);
+ return vfModuleCustomization;
+ }
+
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java
new file mode 100644
index 0000000000..6f2c6cf86d
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java
@@ -0,0 +1,319 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Huawei 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.onap.so.adapters.vnf;
+
+import org.apache.http.HttpStatus;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onap.so.adapters.vnf.exceptions.VnfException;
+import org.onap.so.cloud.CloudConfig;
+import org.onap.so.cloud.CloudifyManager;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.beans.VnfRollback;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import javax.xml.ws.Holder;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+
+public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Autowired
+ private MsoVnfCloudifyAdapterImpl instance;
+
+ @Autowired
+ private CloudConfig cloudConfig;
+
+ @Before
+ public void before(){
+ super.setUp();
+ CloudifyManager cloudifyManager = new CloudifyManager();
+ cloudifyManager.setId("mtn13");
+ cloudifyManager.setCloudifyUrl("http://localhost:"+wireMockPort+"/v2.0");
+ cloudifyManager.setUsername("m93945");
+ cloudifyManager.setPassword("93937EA01B94A10A49279D4572B48369");
+ cloudConfig.getCloudifyManagers().put("mtn13",cloudifyManager);
+ }
+
+ @After
+ public void after(){
+ cloudConfig.getCloudifyManagers().clear();
+ }
+
+ @Test
+ public void queryVnfNullPointerExceptionTest() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ instance.queryVnf("siteid", "1234", "vfname",
+ msoRequest, new Holder<>(), new Holder<>(), new Holder<>(),
+ new Holder<>());
+ }
+
+ @Test
+ public void queryVnfTest() throws Exception {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+ stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse()
+ .withBody("{ \"id\": \"123\" }")
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse()
+ .withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }")
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
+ .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ")
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse()
+ .withBodyFile("OpenstackResponse_Access.json")
+ .withStatus(HttpStatus.SC_OK)));
+
+ instance.queryVnf("mtn13", "1234", "vfname",
+ msoRequest, new Holder<>(), new Holder<>(), new Holder<>(),
+ new Holder<>());
+ }
+
+ @Test
+ public void deleteVfModuleTest_ExceptionWhileQueryDeployment() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ instance.deleteVfModule("mtn13", "1234", "vfname", msoRequest, new Holder<>());
+ }
+
+ @Test
+ public void deleteVfModuleTest_ExceptionWhileDeleteDeployment() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+ stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse()
+ .withBody("{ \"id\": \"123\" }")
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse()
+ .withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }")
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
+ .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ")
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse()
+ .withBodyFile("OpenstackResponse_Access.json")
+ .withStatus(HttpStatus.SC_OK)));
+
+ instance.deleteVfModule("mtn13", "1234", "vfname", msoRequest, new Holder<>());
+ }
+
+ @Test
+ public void deleteVnfVnfExceptionTest() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ instance.deleteVnf("12344", "234", "vnfname", msoRequest);
+
+ }
+
+ @Test
+ public void rollbackVnf() throws Exception {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ VnfRollback vnfRollback = new VnfRollback();
+ vnfRollback.setModelCustomizationUuid("1234");
+ vnfRollback.setVfModuleStackId("2134");
+ vnfRollback.setVnfId("123");
+ vnfRollback.setModelCustomizationUuid("1234");
+
+ instance.rollbackVnf(vnfRollback);
+ }
+
+ @Test
+ public void rollbackVnf_Created() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ VnfRollback vnfRollback = new VnfRollback();
+ vnfRollback.setModelCustomizationUuid("1234");
+ vnfRollback.setVfModuleStackId("2134");
+ vnfRollback.setVnfId("123");
+ vnfRollback.setModelCustomizationUuid("1234");
+ vnfRollback.setVnfCreated(true);
+
+ instance.rollbackVnf(vnfRollback);
+ }
+
+ @Test
+ public void createVfModuleVnfException() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ instance.createVfModule("123", "123", "vf", "v1", "module-005", "create", "3245", "234", "123", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
+ }
+
+ @Test
+ public void createVfModule_ModelCustUuidIsNull() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ instance.createVfModule("123", "123", "vf", "v1", "module-005", "create", "3245", "234", null, new
+ HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
+ }
+
+ @Test
+ public void createVfModule_CloudSiteIdNotFound() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ instance.createVfModule("123", "123", "vf", "v1", "module-005", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
+ }
+
+ @Test
+ public void createVfModule_MsoCloudifyManagerNotFound() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ instance.createVfModule("mtn13", "123", "vf", "v1", "module-005", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
+ }
+
+ @Test
+ public void createVfModule() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse()
+ .withBody("{ \"id\": \"123\" }")
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse()
+ .withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }")
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
+ .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ")
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse()
+ .withBodyFile("OpenstackResponse_Access.json")
+ .withStatus(HttpStatus.SC_OK)));
+
+ instance.createVfModule("mtn13", "123", "vf", "v1", "vfname", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
+ }
+
+ @Test
+ public void updateVfModuleVnfException() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ instance.updateVfModule("123", "1234", "fw", "v2", "vnf1", "create", "123", "12", "233", "234", new HashMap<>(), msoRequest, new Holder<>(), new Holder<>());
+ }
+
+ @Test
+ public void healthCheckVNFTest() {
+ instance.healthCheck();
+ }
+
+ @Test
+ public void createVnfTest() {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ try {
+ instance.createVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ "volumeGroupHeatStackId|1", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.TRUE, msoRequest, new Holder<>(), new Holder<>(),
+ new Holder<>());
+ } catch (Exception e) {
+ }
+ }
+
+ @Test
+ public void updateVnfTest() {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ Map<String, String> map = new HashMap<>();
+
+ map.put("key1", "value1");
+ try {
+ instance.updateVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ "volumeGroupHeatStackId|1", map, msoRequest, new Holder<>(),
+ new Holder<>());
+ } catch (Exception e) {
+
+ }
+ }
+
+ @Test
+ public void deleteVnfTest() {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+ try {
+ instance.deleteVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest);
+ } catch (Exception e) {
+
+ }
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
new file mode 100644
index 0000000000..b21f1f3db2
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
@@ -0,0 +1,167 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so.adapters.vnf;
+
+import org.apache.http.HttpStatus;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onap.so.adapters.vnf.exceptions.VnfException;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.beans.VnfRollback;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import javax.xml.ws.Holder;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
+
+public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Autowired
+ MsoVnfPluginAdapterImpl msoVnfPluginAdapter;
+
+ String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId";
+
+ @Test
+ public void createVfModule_ModelCustUuidIsNull() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = getMsoRequest();
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId|1", "baseVfHeatStackId", null, map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void createVfModule_ModelCustUuidIsNotFound() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = getMsoRequest();
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void createVfModule_VduException() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = getMsoRequest();
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId|1", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void createVfModule_INSTANTIATED() throws Exception {
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_200();
+ MsoRequest msoRequest = getMsoRequest();
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId|1", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void createVfModule_queryVduNotFoundWithVolumeGroupId() throws Exception {
+ expectedException.expect(VnfException.class);
+ mockOpenStackResponseAccess(wireMockPort);
+ MsoRequest msoRequest = getMsoRequest();
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId|1", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void createVfModule_CreateVduException() throws Exception {
+ expectedException.expect(VnfException.class);
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_404();
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json")
+ .withStatus(HttpStatus.SC_OK)));
+ MsoRequest msoRequest = getMsoRequest();
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ "volumeGroupHeatStackId", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ @Test
+ public void deleteVfModule_QueryVduException() throws Exception {
+ expectedException.expect(VnfException.class);
+ MsoRequest msoRequest = getMsoRequest();
+ msoVnfPluginAdapter.deleteVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest,
+ new Holder<Map<String, String>>());
+ }
+
+ @Test
+ public void deleteVfModule_DeleteVduException() throws Exception {
+ expectedException.expect(VnfException.class);
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_200();
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vSAMP12"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json")
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
+ MsoRequest msoRequest = getMsoRequest();
+ msoVnfPluginAdapter.deleteVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest,
+ new Holder<Map<String, String>>());
+ }
+
+ private MsoRequest getMsoRequest() {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+ return msoRequest;
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java
new file mode 100644
index 0000000000..d6cdbdfccd
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java
@@ -0,0 +1,108 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 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.onap.so.adapters.vnf;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.Matchers.hasProperty;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+
+import java.util.Map;
+
+import javax.xml.ws.Holder;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.adapters.vnf.exceptions.VnfException;
+import org.onap.so.openstack.beans.HeatStatus;
+import org.onap.so.openstack.beans.StackInfo;
+import org.onap.so.openstack.beans.VnfStatus;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.exceptions.MsoOpenstackException;
+import org.onap.so.openstack.utils.MsoHeatUtils;
+
+@RunWith(MockitoJUnitRunner.class)
+public class QueryTest {
+
+ @Mock
+ private MsoHeatUtils heat;
+ @InjectMocks
+ private MsoVnfAdapterImpl vnfAdapter = new MsoVnfAdapterImpl();
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+ @Test
+ public void testQueryCreatedVnf() throws VnfException, MsoException {
+ StackInfo info = new StackInfo("stackName", HeatStatus.CREATED);
+ when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info);
+ String cloudId = "MT";
+ String tenantId = "MSO_Test";
+ String vnfName = "VNF_TEST1";
+ Holder<Boolean> vnfExists = new Holder<>();
+ Holder<String> vnfId = new Holder<>();
+ Holder<VnfStatus> status = new Holder<>();
+ Holder<Map<String, String>> outputs = new Holder<>();
+
+ vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs);
+
+ assertTrue(vnfExists.value);
+ }
+
+ @Test
+ public void testQueryNotFoundVnf() throws VnfException, MsoException {
+ StackInfo info = new StackInfo("stackName", HeatStatus.NOTFOUND);
+ when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info);
+ String cloudId = "MT";
+ String tenantId = "MSO_Test";
+ String vnfName = "VNF_TEST1";
+ Holder<Boolean> vnfExists = new Holder<>();
+ Holder<String> vnfId = new Holder<>();
+ Holder<VnfStatus> status = new Holder<>();
+ Holder<Map<String, String>> outputs = new Holder<>();
+
+ vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs);
+
+ assertFalse(vnfExists.value);
+ }
+
+ @Test()
+ // @Ignore // 1802 merge
+ public void testQueryVnfWithException() throws VnfException, MsoException {
+ String cloudId = "MT";
+ String tenantId = "MSO_Test";
+ String vnfName = "VNF_TEST1";
+ Holder<Boolean> vnfExists = new Holder<>();
+ Holder<String> vnfId = new Holder<>();
+ Holder<VnfStatus> status = new Holder<>();
+ Holder<Map<String, String>> outputs = new Holder<>();
+ thrown.expect(VnfException.class);
+ thrown.expectCause(hasProperty("context", is("QueryVNF")));
+ when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any())).thenThrow(new MsoOpenstackException(1, "test messsage", "test detail"));
+ vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs);
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VfRollbackTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VfRollbackTest.java
new file mode 100644
index 0000000000..a59de7695c
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VfRollbackTest.java
@@ -0,0 +1,70 @@
+/*
+* ============LICENSE_START=======================================================
+ * ONAP : SO
+ * ================================================================================
+ * Copyright (C) 2018 TechMahindra
+ * ================================================================================
+ * 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.onap.so.adapters.vnf;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+public class VfRollbackTest {
+ private VfRollback vfRollback = new VfRollback();
+
+ @Test
+ public void test() {
+ vfRollback.setVnfId("vnfId");
+ vfRollback.setTenantId("tenantId");
+ vfRollback.setCloudSiteId("cloudId");
+ vfRollback.setTenantCreated(true);
+ vfRollback.setVnfCreated(true);
+ vfRollback.setMsoRequest(null);
+ vfRollback.setVolumeGroupName("volumeGroupName");
+ vfRollback.setVolumeGroupId("volumeGroupId");
+ vfRollback.setRequestType("requestType");
+ vfRollback.setVolumeGroupHeatStackId("volumeGroupHeatStackId");
+ vfRollback.setBaseGroupHeatStackId("baseGroupHeatStackId");
+ vfRollback.setIsBase(true);
+ vfRollback.setVfModuleStackId("vfModuleStackId");
+ assert(vfRollback.getVnfId() != null);
+ assert(vfRollback.getTenantId() != null);
+ assert(vfRollback.getCloudSiteId() != null);
+ assert(vfRollback.getVolumeGroupName() != null);
+ assert(vfRollback.getVolumeGroupId() != null);
+ assert(vfRollback.getRequestType() != null);
+ assert(vfRollback.getVolumeGroupHeatStackId() != null);
+ assert(vfRollback.getBaseGroupHeatStackId() != null);
+ assert(vfRollback.getVfModuleStackId() != null);
+ assertEquals("vnfId", vfRollback.getVnfId());
+ assertEquals("tenantId", vfRollback.getTenantId());
+ assertEquals("cloudId", vfRollback.getCloudSiteId());
+ assertEquals(true, vfRollback.getTenantCreated());
+ assertEquals(true, vfRollback.getVnfCreated());
+ assertEquals(null, vfRollback.getMsoRequest());
+ assertEquals("volumeGroupName", vfRollback.getVolumeGroupName());
+ assertEquals("volumeGroupId", vfRollback.getVolumeGroupId());
+ assertEquals("requestType", vfRollback.getRequestType());
+ assertEquals("volumeGroupHeatStackId", vfRollback.getVolumeGroupHeatStackId());
+ assertEquals("baseGroupHeatStackId", vfRollback.getBaseGroupHeatStackId());
+ assertEquals(true, vfRollback.isBase());
+ assertEquals("vfModuleStackId", vfRollback.getVfModuleStackId());
+ }
+
+ @Test
+ public void testtoString() {
+ assert(vfRollback.toString() != null);
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java
new file mode 100644
index 0000000000..93841a5037
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java
@@ -0,0 +1,560 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.adapters.vnf;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import org.json.JSONException;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse;
+import org.onap.so.adapters.vnfrest.QueryVfModuleResponse;
+import org.onap.so.adapters.vnfrest.RollbackVfModuleRequest;
+import org.onap.so.adapters.vnfrest.RollbackVfModuleResponse;
+import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse;
+import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse;
+import org.onap.so.adapters.vnfrest.VfModuleRollback;
+import org.onap.so.client.policy.JettisonStyleMapperProvider;
+import org.onap.so.cloud.CloudConfig;
+import org.onap.so.entity.MsoRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeletePublicUrlStackByNameAndID_204;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteStacks;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetPublicUrlStackByNameAndID_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksBaseStack_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksStackId_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksStackId_404;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksVUSP_404;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksVfModuleWithLocationHeader_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksVfModule_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksWithBody_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksWithBody_404;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacks_404;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostStacks_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStacks_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
+
+public class VnfAdapterRestTest extends BaseRestTestUtils {
+
+ @Autowired
+ private CloudConfig cloudConfig;
+ @Autowired
+ private JettisonStyleMapperProvider jettisonTypeObjectMapper;
+ private static final String MESSAGE_ID = "62265093-277d-4388-9ba6-449838ade586-1517252396874";
+ private static final String AAI_VNF_ID = "c93e0d34-5b63-45de-bbae-b0fe49dd3bd9";
+ private static final String MSO_REQUEST_ID = "62265093-277d-4388-9ba6-449838ade586";
+ private static final String MSO_SERVICE_INSTANCE_ID = "4147e06f-1b89-49c5-b21f-4faf8dc9805a";
+ private static final String CLOUDSITE_ID = "mtn13";
+ private static final String TENANT_ID = "0422ffb57ba042c0800a29dc85ca70f8";
+ private static final String VNF_TYPE = "MSOTADevInfra_vSAMP10a_Service/vSAMP10a 1";
+ private static final String VNF_NAME = "MSO-DEV-VNF-1802-it3-pwt3-vSAMP10a-1XXX-Replace";
+ private static final String VNF_VERSION = "1.0";
+ private static final String VF_MODULE_ID = "1d48aaec-b7f3-4c24-ba4a-4e798ed3223c";
+ private static final String VF_MODULE_NAME = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001";
+ private static final String VF_MODULE_TYPE = "vSAMP10aDEV::PCM::module-2";
+ private static final String MODEL_CUSTOMIZATION_UUID = "cb82ffd8-252a-11e7-93ae-92361f002671";
+ private static final String BASE_VF_MODULE_ID = "3d7ff7b4-720b-4604-be0a-1974fc58ed96";
+ // vfModuleParams specific variables
+ private static final String NETWORK_NAME = "Dev-vSAMP10a-ntwk-1802-pwt3-v6-Replace-1001";
+ private static final String SERVER_NAME = "Dev-vSAMP10a-addon2-1802-pwt3-v6-Replace-1001";
+ private static final String IMAGE = "ubuntu_14.04_IPv6";
+ private static final String EXN_DIRECT_NET_FQDN = "direct";
+ private static final String EXN_HSL_NET_FQDN = "hsl";
+ private static final String AVAILABILITY_ZONE_0 = "nova";
+ private static final String VF_MODULE_INDEX = "0";
+ private static final String REQUEST_TYPE = "";
+
+ @Test
+ public void testCreateVfModule() throws JSONException, JsonParseException, JsonMappingException, IOException {
+
+ CreateVfModuleRequest request = populateCreateVfModuleRequest();
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetStackVfModule_404();
+
+ mockOpenStackPostStacks_200();
+
+ mockOpenStackGetStackVfModule_200();
+
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+ HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers);
+
+ ResponseEntity<CreateVfModuleResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST,
+ entity, CreateVfModuleResponse.class);
+
+ ResponseEntity<CreateVfModuleResponse> responseV2 = restTemplate.exchange(
+ createURLWithPort("/services/rest/v2/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST,
+ entity, CreateVfModuleResponse.class);
+
+ CreateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
+ new File("src/test/resources/__files/CreateVfModuleResponse.json"), CreateVfModuleResponse.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(response.getBody(), sameBeanAs(expectedResponse));
+
+ assertEquals(Response.Status.OK.getStatusCode(), responseV2.getStatusCode().value());
+ assertThat(responseV2.getBody(), sameBeanAs(expectedResponse));
+ }
+
+ @Test
+ public void testCreateVfModuleAsyncCall() throws Exception {
+ CreateVfModuleRequest request = populateCreateVfModuleRequest();
+ request.setNotificationUrl( createURLWithPort("/mso/WorkflowMesssage"));
+
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStackVfModule_404();
+ mockOpenStackPostStacks_200();
+ mockOpenStackGetStackVfModule_200();
+
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+ HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers);
+
+ ResponseEntity<CreateVfModuleResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST,
+ entity, CreateVfModuleResponse.class);
+
+ CreateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
+ new File("src/test/resources/__files/CreateVfModuleResponse.json"), CreateVfModuleResponse.class);
+
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testCreateVfModuleWithEnableBridgeNull()
+ throws JSONException, JsonParseException, JsonMappingException, IOException {
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+ CreateVfModuleRequest request = new CreateVfModuleRequest();
+ request.setBackout(true);
+ request.setSkipAAI(true);
+ request.setFailIfExists(false);
+ MsoRequest msoReq = new MsoRequest();
+ boolean failIfExists = true;
+ Boolean enableBridge = null;
+ Map<String, String> vfModuleParams = new HashMap<String, String>();
+
+
+ vfModuleParams.put("vf_module_id", VF_MODULE_ID);
+ vfModuleParams.put("vnf_id", AAI_VNF_ID);
+ vfModuleParams.put("network_name", NETWORK_NAME);
+ vfModuleParams.put("vnf_name", VNF_NAME);
+ vfModuleParams.put("environment_context", "");
+ vfModuleParams.put("server_name", SERVER_NAME);
+ vfModuleParams.put("image", IMAGE);
+ vfModuleParams.put("workload_context", "");
+ vfModuleParams.put("vf_module_index", VF_MODULE_INDEX);
+ vfModuleParams.put("vf_module_name", VF_MODULE_NAME);
+ vfModuleParams.put("availability_zone_0", AVAILABILITY_ZONE_0);
+ vfModuleParams.put("exn_direct_net_fqdn", EXN_DIRECT_NET_FQDN);
+ vfModuleParams.put("exn_hsl_net_fqdn", EXN_HSL_NET_FQDN);
+
+ msoReq.setRequestId(MSO_REQUEST_ID);
+ msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
+ request.setMsoRequest(msoReq);
+ request.setRequestType(REQUEST_TYPE);
+ request.setCloudSiteId(CLOUDSITE_ID);
+ request.setTenantId(TENANT_ID);
+ request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
+ request.setVnfId(AAI_VNF_ID);
+ request.setVnfVersion(VNF_VERSION);
+ request.setVfModuleId(VF_MODULE_ID);
+ request.setVfModuleName(VF_MODULE_NAME);
+ request.setBaseVfModuleId(BASE_VF_MODULE_ID);
+ request.setFailIfExists(failIfExists);
+ request.setEnableBridge(enableBridge);
+ request.setVfModuleParams(vfModuleParams);
+ request.setMessageId(MESSAGE_ID);
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetStackVfModule_404();
+
+ mockOpenStackPostStacks_200();
+
+ mockOpenStackGetStackVfModule_200();
+
+
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+ HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers);
+
+ ResponseEntity<CreateVfModuleResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST,
+ entity, CreateVfModuleResponse.class);
+
+ CreateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
+ new File("src/test/resources/__files/CreateVfModuleResponse.json"), CreateVfModuleResponse.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(response.getBody(), sameBeanAs(expectedResponse));
+ }
+
+ @Test
+ public void testCreateVfModuleFail() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+ CreateVfModuleRequest request = new CreateVfModuleRequest();
+ request.setBackout(true);
+ request.setSkipAAI(true);
+ request.setFailIfExists(false);
+ MsoRequest msoReq = new MsoRequest();
+ boolean failIfExists = true;
+ boolean enableBridge = false;
+ Map<String, String> vfModuleParams = new HashMap<String, String>();
+
+ vfModuleParams.put("vf_module_id", VF_MODULE_ID);
+ vfModuleParams.put("vnf_id", AAI_VNF_ID);
+ vfModuleParams.put("network_name", NETWORK_NAME);
+ vfModuleParams.put("vnf_name", VNF_NAME);
+ vfModuleParams.put("environment_context", "");
+ vfModuleParams.put("server_name", SERVER_NAME);
+ vfModuleParams.put("image", IMAGE);
+ vfModuleParams.put("workload_context", "");
+ vfModuleParams.put("vf_module_index", VF_MODULE_INDEX);
+ vfModuleParams.put("vf_module_name", VF_MODULE_NAME);
+ vfModuleParams.put("availability_zone_0", AVAILABILITY_ZONE_0);
+ vfModuleParams.put("exn_direct_net_fqdn", EXN_DIRECT_NET_FQDN);
+ vfModuleParams.put("exn_hsl_net_fqdn", EXN_HSL_NET_FQDN);
+
+ msoReq.setRequestId(MSO_REQUEST_ID);
+ msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
+ request.setMsoRequest(msoReq);
+ request.setRequestType(REQUEST_TYPE);
+ request.setCloudSiteId(CLOUDSITE_ID);
+ request.setTenantId(TENANT_ID);
+ request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
+ request.setVnfId(AAI_VNF_ID);
+ request.setVnfType(VNF_TYPE);
+ request.setVnfVersion(VNF_VERSION);
+ request.setVfModuleId(VF_MODULE_ID);
+ request.setVfModuleName(VF_MODULE_NAME);
+ request.setVfModuleType(VF_MODULE_TYPE);
+ request.setBaseVfModuleStackId(BASE_VF_MODULE_ID);
+ request.setFailIfExists(failIfExists);
+ request.setEnableBridge(enableBridge);
+ request.setVfModuleParams(vfModuleParams);
+ request.setMessageId(MESSAGE_ID);
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetStackVfModule_404();
+
+ mockOpenStackGetStacks_404();
+
+ mockOpenStackPostStacks_200();
+
+ mockOpenStackGetStackVfModule_200();
+
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+ HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers);
+
+ ResponseEntity<VfModuleExceptionResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST,
+ entity, VfModuleExceptionResponse.class);
+
+ assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
+
+ mockOpenStackGetStacksWithBody_200("DELETE_IN_PROGRESS");
+
+ response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST,
+ entity, VfModuleExceptionResponse.class);
+
+ assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
+
+ mockOpenStackGetStacksWithBody_200("DELETE_FAILED");
+
+ response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST,
+ entity, VfModuleExceptionResponse.class);
+
+ assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
+
+ mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE");
+
+ response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST,
+ entity, VfModuleExceptionResponse.class);
+
+ assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
+
+ mockOpenStackGetStacksWithBody_404();
+
+ response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST,
+ entity, VfModuleExceptionResponse.class);
+
+ assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
+
+ }
+
+ @Test
+ public void testDeleteVfModule() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+ DeleteVfModuleRequest request = new DeleteVfModuleRequest();
+ MsoRequest msoRequest = new MsoRequest();
+ String vfModuleStackId = "stackId";
+
+ msoRequest.setRequestId(MSO_REQUEST_ID);
+ msoRequest.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
+ request.setCloudSiteId(CLOUDSITE_ID);
+ request.setTenantId(TENANT_ID);
+ request.setVfModuleId(VF_MODULE_ID);
+ request.setVfModuleStackId(vfModuleStackId);
+ request.setVnfId(AAI_VNF_ID);
+ request.setMsoRequest(msoRequest);
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackPostStacks_200();
+
+ mockOpenStackGetStacksStackId_404();
+
+ mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockPort);
+
+ mockOpenStackDeletePublicUrlStackByNameAndID_204();
+
+
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+ HttpEntity<DeleteVfModuleRequest> entity = new HttpEntity<DeleteVfModuleRequest>(request, headers);
+
+ ResponseEntity<DeleteVfModuleResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID), HttpMethod.DELETE,
+ entity, DeleteVfModuleResponse.class);
+
+ ResponseEntity<DeleteVfModuleResponse> responseV2 = restTemplate.exchange(
+ createURLWithPort("/services/rest/v2/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID), HttpMethod.DELETE,
+ entity, DeleteVfModuleResponse.class);
+
+
+ DeleteVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
+ new File("src/test/resources/__files/DeleteVfModuleResponse.json"), DeleteVfModuleResponse.class);
+
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(response.getBody(), sameBeanAs(expectedResponse));
+
+ assertEquals(Response.Status.OK.getStatusCode(), responseV2.getStatusCode().value());
+ assertThat(responseV2.getBody(), sameBeanAs(expectedResponse));
+ }
+
+ @Test
+ public void testUpdateVfModule() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+ UpdateVfModuleRequest request = new UpdateVfModuleRequest();
+ MsoRequest msoRequest = new MsoRequest();
+ String vfModuleStackId = "vfModuleStackId";
+ Boolean failIfExists = false;
+ Boolean backout = false;
+ msoRequest.setRequestId(MSO_REQUEST_ID);
+ msoRequest.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
+
+ Map<String, String> vfModuleParams = new HashMap<String, String>();
+
+ vfModuleParams.put("exn_direct_net_fqdn", EXN_DIRECT_NET_FQDN);
+ vfModuleParams.put("exn_hsl_net_fqdn", EXN_HSL_NET_FQDN);
+
+ Map<String, String> vfModuleOutputs = new HashMap<String, String>();
+
+ vfModuleOutputs.put("output name", "output value");
+
+ request.setBackout(backout);
+ request.setCloudSiteId(CLOUDSITE_ID);
+ request.setFailIfExists(failIfExists);
+ request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
+ request.setMsoRequest(msoRequest);
+ request.setRequestType(REQUEST_TYPE);
+ request.setTenantId(TENANT_ID);
+ request.setVfModuleId(VF_MODULE_ID);
+ request.setVfModuleName(VF_MODULE_NAME);
+ request.setVfModuleStackId(vfModuleStackId);
+ request.setBackout(backout);
+ request.setVfModuleParams(vfModuleParams);
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetStacksVfModuleWithLocationHeader_200(wireMockPort);
+
+ mockOpenStackGetStacksVfModule_200(wireMockPort);
+
+ mockOpenStackGetStacksBaseStack_200(wireMockPort);
+
+ mockOpenStackPutStacks_200();
+
+ UpdateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
+ new File("src/test/resources/__files/UpdateVfModuleResponse.json"), UpdateVfModuleResponse.class);
+ expectedResponse.setVfModuleOutputs(vfModuleOutputs);
+
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+ HttpEntity<UpdateVfModuleRequest> entity = new HttpEntity<UpdateVfModuleRequest>(request, headers);
+
+ ResponseEntity<UpdateVfModuleResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_TYPE), HttpMethod.PUT,
+ entity, UpdateVfModuleResponse.class);
+
+ ResponseEntity<UpdateVfModuleResponse> responseV2 = restTemplate.exchange(
+ createURLWithPort("/services/rest/v2/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_TYPE), HttpMethod.PUT,
+ entity, UpdateVfModuleResponse.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(response.getBody(), sameBeanAs(expectedResponse));
+
+ assertEquals(Response.Status.OK.getStatusCode(), responseV2.getStatusCode().value());
+ assertThat(responseV2.getBody(), sameBeanAs(expectedResponse));
+
+ }
+
+ @Test
+ public void testRollbackVfModule() throws IOException {
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId(MSO_REQUEST_ID);
+ msoRequest.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
+
+ VfModuleRollback vfModuleRollback = new VfModuleRollback(AAI_VNF_ID, VF_MODULE_ID,
+ "StackId", false, TENANT_ID, CLOUDSITE_ID, msoRequest, "messageId");
+
+ RollbackVfModuleRequest request = new RollbackVfModuleRequest();
+ request.setVfModuleRollback(vfModuleRollback);
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackGetStacksStackId_200(wireMockPort);
+
+ mockOpenStackDeleteStacks();
+
+ mockOpenStackGetStacksVUSP_404();
+
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+ HttpEntity<RollbackVfModuleRequest> entity = new HttpEntity<RollbackVfModuleRequest>(request, headers);
+
+ ResponseEntity<RollbackVfModuleResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID + "/rollback"), HttpMethod.DELETE,
+ entity, RollbackVfModuleResponse.class);
+
+ RollbackVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
+ new File("src/test/resources/__files/RollbackVfModuleResponse.json"),RollbackVfModuleResponse.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(response.getBody(), sameBeanAs(expectedResponse));
+
+ }
+
+ @Ignore
+ @Test
+ public void testQueryVfModule() throws IOException{
+
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+ String testUrl = createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID);
+ String testUri = UriBuilder.fromPath("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID )
+ .host("localhost").port(wireMockPort).scheme("http")
+ //.queryParam("cloudSiteId", CLOUDSITE_ID).queryParam("tenantId", TENANT_ID)
+ .build().toString();
+ System.out.println(testUri);
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+ //HttpEntity entity = new HttpEntity(null, headers);
+ ResponseEntity<QueryVfModuleResponse> response = restTemplate.getForEntity(testUri, QueryVfModuleResponse.class);
+ //System.out.println(response);
+
+ QueryVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
+ new File("src/test/resources/__files/QueryVfModuleResponse.json"),QueryVfModuleResponse.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(response.getBody(), sameBeanAs(expectedResponse));
+ }
+
+ private CreateVfModuleRequest populateCreateVfModuleRequest(){
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+ CreateVfModuleRequest request = new CreateVfModuleRequest();
+ request.setBackout(true);
+ request.setSkipAAI(true);
+ request.setFailIfExists(false);
+ MsoRequest msoReq = new MsoRequest();
+ boolean failIfExists = true;
+ boolean enableBridge = false;
+ Map<String, String> vfModuleParams = new HashMap<String, String>();
+
+ vfModuleParams.put("vf_module_id", VF_MODULE_ID);
+ vfModuleParams.put("vnf_id", AAI_VNF_ID);
+ vfModuleParams.put("network_name", NETWORK_NAME);
+ vfModuleParams.put("vnf_name", VNF_NAME);
+ vfModuleParams.put("environment_context", "");
+ vfModuleParams.put("server_name", SERVER_NAME);
+ vfModuleParams.put("image", IMAGE);
+ vfModuleParams.put("workload_context", "");
+ vfModuleParams.put("vf_module_index", VF_MODULE_INDEX);
+ vfModuleParams.put("vf_module_name", VF_MODULE_NAME);
+ vfModuleParams.put("availability_zone_0", AVAILABILITY_ZONE_0);
+ vfModuleParams.put("exn_direct_net_fqdn", EXN_DIRECT_NET_FQDN);
+ vfModuleParams.put("exn_hsl_net_fqdn", EXN_HSL_NET_FQDN);
+
+ msoReq.setRequestId(MSO_REQUEST_ID);
+ msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
+ request.setMsoRequest(msoReq);
+ request.setRequestType(REQUEST_TYPE);
+ request.setCloudSiteId(CLOUDSITE_ID);
+ request.setTenantId(TENANT_ID);
+ request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
+ request.setVnfId(AAI_VNF_ID);
+ request.setVnfType(VNF_TYPE);
+ request.setVnfVersion(VNF_VERSION);
+ request.setVfModuleId(VF_MODULE_ID);
+ request.setVfModuleName(VF_MODULE_NAME);
+ request.setVfModuleType(VF_MODULE_TYPE);
+ request.setBaseVfModuleId(BASE_VF_MODULE_ID);
+ request.setFailIfExists(failIfExists);
+ request.setEnableBridge(enableBridge);
+ request.setVfModuleParams(vfModuleParams);
+ request.setMessageId(MESSAGE_ID);
+
+ return request;
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java
new file mode 100644
index 0000000000..f602690a10
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java
@@ -0,0 +1,189 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so.adapters.vnf;
+
+import org.junit.Test;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.QueryVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.VolumeGroupExceptionResponse;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import java.io.IOException;
+import static org.junit.Assert.assertEquals;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackWithBody_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksWithBody_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostStacks_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStack;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
+
+public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon {
+
+ @Test
+ public void testCreateVNFVolumes() throws IOException {
+
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackPostStacks_200();
+ mockOpenStackGetStackVfModule_200();
+ CreateVolumeGroupRequest request = buildCreateVfModuleRequest();
+
+ HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
+ ResponseEntity<CreateVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/volume-groups"), HttpMethod.POST,
+ entity, CreateVolumeGroupResponse.class);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testCreateVNFVolumesAsync() throws IOException {
+
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackPostStacks_200();
+ mockOpenStackGetStackVfModule_200();
+ CreateVolumeGroupRequest request = buildCreateVfModuleRequest();
+ request.setNotificationUrl("http://localhost:8080");
+
+ HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
+ ResponseEntity<CreateVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/volume-groups"), HttpMethod.POST,
+ entity, CreateVolumeGroupResponse.class);
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testDeleteVNFVolumes() throws IOException {
+ mockOpenStackResponseAccess(wireMockPort);
+ DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest();
+ HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
+ ResponseEntity<DeleteVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/volume-groups/"+VOLUME_GROUP_ID), HttpMethod.DELETE,
+ entity, DeleteVolumeGroupResponse.class);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testDeleteVNFVolumesAsync() throws IOException {
+ mockOpenStackResponseAccess(wireMockPort);
+ DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest();
+ request.setNotificationUrl("http://localhost:8080");
+ HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
+ ResponseEntity<DeleteVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/volume-groups/"+VOLUME_GROUP_ID), HttpMethod.DELETE,
+ entity, DeleteVolumeGroupResponse.class);
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testRollbackVNFVolumes() throws IOException {
+ mockOpenStackResponseAccess(wireMockPort);
+ RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest();
+ HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
+ ResponseEntity<RollbackVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/volume-groups/"+VOLUME_GROUP_ID+"/rollback"), HttpMethod.DELETE,
+ entity, RollbackVolumeGroupResponse.class);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testRollbackVNFVolumesAsync() throws IOException {
+ mockOpenStackResponseAccess(wireMockPort);
+ RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest();
+ request.setNotificationUrl("http://localhost:8080");
+ HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
+ ResponseEntity<RollbackVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/volume-groups/"+VOLUME_GROUP_ID+"/rollback"), HttpMethod.DELETE,
+ entity, RollbackVolumeGroupResponse.class);
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testQueryVNFVolumes() throws IOException{
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE");
+ javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID);
+ builder.queryParam("cloudSiteId", CLOUDSITE_ID).queryParam("tenantId", TENANT_ID)
+ .queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true)
+ .queryParam("msoRequest.requestId", MSO_REQUEST_ID)
+ .queryParam("msoRequest.serviceInstanceId", MSO_SERVICE_INSTANCE_ID);
+
+ ResponseEntity<QueryVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort(builder.build().toString()), HttpMethod.GET,
+ null,QueryVolumeGroupResponse.class);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testQueryVNFVolumesError() throws IOException{
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE");
+ javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID);
+ builder.queryParam("tenantId", TENANT_ID)
+ .queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true)
+ .queryParam("msoRequest.requestId", MSO_REQUEST_ID)
+ .queryParam("msoRequest.serviceInstanceId", MSO_SERVICE_INSTANCE_ID);
+
+ ResponseEntity<VolumeGroupExceptionResponse> response = restTemplate.exchange(
+ createURLWithPort(builder.build().toString()), HttpMethod.GET,
+ null,VolumeGroupExceptionResponse.class);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testUpdateVNFVolumes() throws IOException {
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStacksWithBody_200("CREATE_COMPLETE");
+ mockOpenStackPutStack(VOUME_GROUP_NAME+"/stackId",200);
+ mockOpenStackGetStackWithBody_200("UPDATE_COMPLETE");
+ UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest();
+ HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
+ ResponseEntity<UpdateVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/volume-groups/"+VOLUME_GROUP_ID), HttpMethod.PUT,
+ entity,UpdateVolumeGroupResponse.class);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testUpdateVNFVolumesAsync() throws IOException {
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStacksWithBody_200("CREATE_COMPLETE");
+ mockOpenStackPutStack(VOUME_GROUP_NAME+"/stackId",200);
+ mockOpenStackGetStackWithBody_200("UPDATE_COMPLETE");
+ UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest();
+ request.setNotificationUrl("http://localhost:8080");
+ HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
+ ResponseEntity<UpdateVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v1/volume-groups/"+VOLUME_GROUP_ID), HttpMethod.PUT,
+ entity,UpdateVolumeGroupResponse.class);
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ }
+
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java
new file mode 100644
index 0000000000..dba169c311
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java
@@ -0,0 +1,184 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so.adapters.vnf;
+
+import org.junit.Test;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.QueryVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.VolumeGroupExceptionResponse;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import java.io.IOException;
+import static org.junit.Assert.assertEquals;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackWithBody_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksWithBody_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostStacks_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStack;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
+
+public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon {
+
+ @Test
+ public void testCreateVNFVolumes() throws IOException {
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackPostStacks_200();
+ mockOpenStackGetStackVfModule_200();
+ CreateVolumeGroupRequest request = buildCreateVfModuleRequest();
+
+ HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
+ ResponseEntity<CreateVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v2/volume-groups"), HttpMethod.POST,
+ entity, CreateVolumeGroupResponse.class);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testCreateVNFVolumesAsync() throws IOException {
+
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackPostStacks_200();
+ mockOpenStackGetStackVfModule_200();
+ CreateVolumeGroupRequest request = buildCreateVfModuleRequest();
+ request.setNotificationUrl("http://localhost:8080");
+ HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
+ ResponseEntity<CreateVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v2/volume-groups"), HttpMethod.POST,
+ entity, CreateVolumeGroupResponse.class);
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testDeleteVNFVolumes() throws IOException {
+ mockOpenStackResponseAccess(wireMockPort);
+ DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest();
+ HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
+ ResponseEntity<DeleteVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v2/volume-groups/"+VOLUME_GROUP_ID), HttpMethod.DELETE,
+ entity, DeleteVolumeGroupResponse.class);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testDeleteVNFVolumesAsync() throws IOException {
+ mockOpenStackResponseAccess(wireMockPort);
+ DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest();
+ request.setNotificationUrl("http://localhost:8080");
+ HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
+ ResponseEntity<DeleteVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v2/volume-groups/"+VOLUME_GROUP_ID), HttpMethod.DELETE,
+ entity, DeleteVolumeGroupResponse.class);
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testRollbackVNFVolumes() throws IOException {
+ mockOpenStackResponseAccess(wireMockPort);
+ RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest();
+ HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
+ ResponseEntity<RollbackVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v2/volume-groups/"+VOLUME_GROUP_ID+"/rollback"), HttpMethod.DELETE,
+ entity, RollbackVolumeGroupResponse.class);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testRollbackVNFVolumesAsync() throws IOException {
+ mockOpenStackResponseAccess(wireMockPort);
+ RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest();
+ request.setNotificationUrl("http://localhost:8080");
+ HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
+ ResponseEntity<RollbackVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v2/volume-groups/"+VOLUME_GROUP_ID+"/rollback"), HttpMethod.DELETE,
+ entity, RollbackVolumeGroupResponse.class);
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testQueryVNFVolumes() throws IOException{
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE");
+ javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID);
+ builder.queryParam("cloudSiteId", CLOUDSITE_ID).queryParam("tenantId", TENANT_ID)
+ .queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true)
+ .queryParam("msoRequest.requestId", MSO_REQUEST_ID)
+ .queryParam("msoRequest.serviceInstanceId", MSO_SERVICE_INSTANCE_ID);
+
+ ResponseEntity<QueryVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort(builder.build().toString()), HttpMethod.GET,
+ null,QueryVolumeGroupResponse.class);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testQueryVNFVolumesError() throws IOException{
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE");
+ javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID);
+ builder.queryParam("tenantId", TENANT_ID)
+ .queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true)
+ .queryParam("msoRequest.requestId", MSO_REQUEST_ID)
+ .queryParam("msoRequest.serviceInstanceId", MSO_SERVICE_INSTANCE_ID);
+
+ ResponseEntity<VolumeGroupExceptionResponse> response = restTemplate.exchange(
+ createURLWithPort(builder.build().toString()), HttpMethod.GET,
+ null,VolumeGroupExceptionResponse.class);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ }
+ @Test
+ public void testUpdateVNFVolumes() throws IOException {
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStacksWithBody_200("CREATE_COMPLETE");
+ mockOpenStackPutStack(VOUME_GROUP_NAME+"/stackId",200);
+ mockOpenStackGetStackWithBody_200("UPDATE_COMPLETE");
+ UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest();
+ HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
+ ResponseEntity<UpdateVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v2/volume-groups/"+VOLUME_GROUP_ID), HttpMethod.PUT,
+ entity,UpdateVolumeGroupResponse.class);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testUpdateVNFVolumesAsync() throws IOException {
+ mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackGetStacksWithBody_200("CREATE_COMPLETE");
+ mockOpenStackPutStack(VOUME_GROUP_NAME+"/stackId",200);
+ mockOpenStackGetStackWithBody_200("UPDATE_COMPLETE");
+ UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest();
+ request.setNotificationUrl("http://localhost:8080");
+ HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
+ ResponseEntity<UpdateVolumeGroupResponse> response = restTemplate.exchange(
+ createURLWithPort("/services/rest/v2/volume-groups/"+VOLUME_GROUP_ID), HttpMethod.PUT,
+ entity,UpdateVolumeGroupResponse.class);
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java
new file mode 100644
index 0000000000..d8177363f4
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java
@@ -0,0 +1,134 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so.adapters.vnf;
+
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.VolumeGroupRollback;
+import org.onap.so.cloud.CloudConfig;
+import org.onap.so.entity.MsoRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class VolumeGroupAdapterCommon extends BaseRestTestUtils {
+
+ @Autowired
+ protected CloudConfig cloudConfig;
+
+ protected static final String MSO_REQUEST_ID = "62265093-277d-4388-9ba6-449838ade586";
+ protected static final String MSO_SERVICE_INSTANCE_ID = "4147e06f-1b89-49c5-b21f-4faf8dc9805a";
+ protected static final String CLOUDSITE_ID = "mtn13";
+ protected static final String TENANT_ID = "0422ffb57ba042c0800a29dc85ca70f8";
+ protected static final String VOUME_GROUP_NAME = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001";
+ protected static final String VOLUME_GROUP_ID = "0422ffb57ba042c0800a29dc85ca70v1";
+ protected static final String VNF_TYPE = "TestVnfType";
+ protected static final String VNF_VERSION = "1.0";
+ protected static final String VF_MODULE_TYPE = "TestModule-0";
+ protected static final String MODEL_CUSTOMIZATION_UUID = "9b339a61-69ca-465f-86b8-1c72c582b8e8";
+
+ protected UpdateVolumeGroupRequest buildUpdateVolumeGroupRequest() {
+ UpdateVolumeGroupRequest request = new UpdateVolumeGroupRequest();
+ request.setCloudSiteId(CLOUDSITE_ID);
+ request.setTenantId(TENANT_ID);
+ request.setVolumeGroupId(VOLUME_GROUP_ID);
+ request.setVnfType(VNF_TYPE);
+ request.setVnfVersion(VNF_VERSION);
+ request.setVfModuleType(VF_MODULE_TYPE);
+ request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
+ request.setSkipAAI(true);
+ request.setVolumeGroupStackId(VOUME_GROUP_NAME);
+ Map<String, String> volumeGroupParams = getVolumeGroupParamsMap();
+ request.setVolumeGroupParams(volumeGroupParams);
+ MsoRequest msoReq = getMsoRequest();
+ request.setMsoRequest(msoReq);
+ return request;
+ }
+
+ protected RollbackVolumeGroupRequest buildRollbackVolumeGroupRequest() {
+ RollbackVolumeGroupRequest request = new RollbackVolumeGroupRequest();
+ VolumeGroupRollback volumeGroupRollback = new VolumeGroupRollback();
+ volumeGroupRollback.setCloudSiteId(CLOUDSITE_ID);
+ volumeGroupRollback.setMessageId(MSO_REQUEST_ID);
+ volumeGroupRollback.setTenantId(TENANT_ID);
+ MsoRequest msoReq = getMsoRequest();
+ volumeGroupRollback.setVolumeGroupCreated(true);
+ volumeGroupRollback.setVolumeGroupId(VOLUME_GROUP_ID);
+ volumeGroupRollback.setVolumeGroupStackId(VOLUME_GROUP_ID);
+ volumeGroupRollback.setMsoRequest(msoReq);
+ request.setVolumeGroupRollback(volumeGroupRollback);
+ return request;
+ }
+
+ protected DeleteVolumeGroupRequest buildDeleteVolumeGroupRequest() {
+ DeleteVolumeGroupRequest request = new DeleteVolumeGroupRequest();
+ request.setCloudSiteId(CLOUDSITE_ID);
+ request.setTenantId(TENANT_ID);
+ request.setVolumeGroupStackId("testStackId");
+ request.setVolumeGroupId(VOLUME_GROUP_ID);
+ MsoRequest msoReq = getMsoRequest();
+ request.setMsoRequest(msoReq);
+ return request;
+ }
+
+ protected CreateVolumeGroupRequest buildCreateVfModuleRequest() {
+ cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+ CreateVolumeGroupRequest request = new CreateVolumeGroupRequest();
+ request.setCloudSiteId(CLOUDSITE_ID);
+ request.setTenantId(TENANT_ID);
+ request.setVolumeGroupName(VOUME_GROUP_NAME);
+ request.setVolumeGroupId(VOLUME_GROUP_ID);
+ request.setVnfType(VNF_TYPE);
+ request.setVnfVersion(VNF_VERSION);
+ request.setVfModuleType(VF_MODULE_TYPE);
+ request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
+ request.setSkipAAI(true);
+ request.setFailIfExists(false);
+ request.setFailIfExists(true);
+ request.setEnableBridge(false);
+ request.setSuppressBackout(true);
+ Map<String, String> volumeGroupParams = getVolumeGroupParamsMap();
+ request.setVolumeGroupParams(volumeGroupParams);
+ MsoRequest msoReq = getMsoRequest();
+ request.setMsoRequest(msoReq);
+
+ return request;
+ }
+
+ private Map<String, String> getVolumeGroupParamsMap() {
+ Map<String, String> volumeGroupParams = new HashMap<>();
+ volumeGroupParams.put("fsb_volume_type_0","volume_type");
+ volumeGroupParams.put("fsb_volume_image_name_1","vol_img_1");
+ volumeGroupParams.put("fsb_volume_image_name_0","vol_img_0");
+ volumeGroupParams.put("fsb_volume_size_0","100");
+ return volumeGroupParams;
+ }
+
+ private MsoRequest getMsoRequest() {
+ MsoRequest msoReq = new MsoRequest();
+ msoReq.setRequestId(MSO_REQUEST_ID);
+ msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
+ return msoReq;
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java
new file mode 100644
index 0000000000..98d5f7eb5f
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java
@@ -0,0 +1,485 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so.bpmn.mock;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.containing;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+
+import org.apache.http.HttpStatus;
+
+public class StubOpenStack {
+ private static final String NETWORK_NAME = "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0";
+ private static final String NETWORK_ID = "da886914-efb2-4917-b335-c8381528d90b";
+ private static final String NETWORK_NAME_2 = "stackname";
+ private static final String NETWORK_ID_2 = "stackId";
+
+ public static void mockOpenStackResponseAccess(int port) throws IOException {
+ stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(getBodyFromFile("OpenstackResponse_Access.json", port, "/mockPublicUrl"))
+ .withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackResponseAccessQueryNetwork(int port) throws IOException {
+ stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ .withRequestBody(containing("tenantId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(getBodyFromFile("OpenstackResponse_Access_queryNetwork.json", port, "/mockPublicUrl"))
+ .withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackResponseAccessAdmin(int port) throws IOException {
+ stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(getBodyFromFile("OpenstackResponse_Access_Admin.json", port, "/mockPublicUrl"))
+ .withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackPublicUrlStackByName_200(int port) throws IOException {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME)).willReturn(aResponse()
+ .withHeader("X-Openstack-Request-Id", "openstackRquest")
+ .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/"+NETWORK_NAME)
+ .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/" + NETWORK_NAME))
+ .withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackPublicUrlStackByID_200(int port) throws IOException {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_ID)).willReturn(aResponse()
+ .withHeader("X-Openstack-Request-Id", "openstackRquest")
+ .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/"+NETWORK_NAME)
+ .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/" + NETWORK_NAME))
+ .withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetPublicUrlStackByNameAndID_200(int port) throws IOException {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse()
+ .withHeader("X-Openstack-Request-Id", "openstackRquest")
+ .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/"+NETWORK_NAME)
+ .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/" + NETWORK_NAME))
+ .withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetPublicUrlStackByNameAndID_204(int port) throws IOException {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse()
+ .withHeader("X-Openstack-Request-Id", "openstackRquest")
+ .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)
+ .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/" + NETWORK_NAME))
+ .withStatus(HttpStatus.SC_NOT_FOUND)));
+ }
+
+ public static void mockOpenStackPutPublicUrlStackByNameAndID_200() {
+ stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200() {
+ stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME_2+"/"+NETWORK_ID_2)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackDeletePublicUrlStackByNameAndID_204() {
+ stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NO_CONTENT)));
+ }
+
+ public static void mockOpenStackPostPublicUrlWithBodyFile_200() {
+ stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_Stack.json").withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetStackCreatedAppC_200() {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3/stackId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_Stack_Created.json").withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetStackAppC_404() {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3"))
+ .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND)));
+ }
+
+ public static void mockOpenStackGetStackCreatedVUSP_200() {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/stackId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_Stack_Created.json").withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetStackVUSP_404() {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0"))
+ .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND)));
+ }
+
+ public static void mockOpenStackPostStack_200(String filename) {
+ stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile(filename).withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackPostNeutronNetwork_200(String filename) {
+ stubFor(post(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile(filename).withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackPutNeutronNetwork_200(String filename,String networkId) {
+ stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkId)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile(filename).withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackPutNeutronNetwork(String networkId, int responseCode) {
+ stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkId)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withStatus(responseCode)));
+ }
+
+ public static void mockOpenStackGetAllNeutronNetworks_200(String filename){
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile(filename).withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetNeutronNetwork_404(String networkName) {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkName)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withStatus(HttpStatus.SC_NOT_FOUND)));
+ }
+
+ public static void mockOpenStackGetAllNeutronNetworks_404() {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withStatus(HttpStatus.SC_NOT_FOUND)));
+ }
+
+ public static void mockOpenstackGetWithResponse(String url,int responseCode, String responseFile) {
+ stubFor(get(urlPathEqualTo(url)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile(responseFile)
+ .withStatus(responseCode)));
+ }
+
+ public static void mockOpenstackPostWithResponse(String url,int responseCode, String responseFile) {
+ stubFor(post(urlPathEqualTo(url)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile(responseFile)
+ .withStatus(responseCode)));
+ }
+
+ public static void mockOpenstackGet(String url,int responseCode) {
+ stubFor(get(urlPathEqualTo(url)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withStatus(responseCode)));
+ }
+
+ public static void mockOpenstackPost(String url,int responseCode) {
+ stubFor(post(urlPathEqualTo(url)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withStatus(responseCode)));
+ }
+
+ public static void mockOpenStackGetStackVfModule_200() {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json")
+ .withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetStackVfModule_404() {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(HttpStatus.SC_NOT_FOUND)));
+ }
+
+ public static void mockOpenStackPostStacks_200() {
+ stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_Stack.json").withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetStacks_404() {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/3d7ff7b4-720b-4604-be0a-1974fc58ed96"))
+ .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND)));
+ }
+
+ public static void mockOpenStackGetStacksWithBody_200(String replaceWith) throws IOException {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(getBodyFromFileVnfAdapter(replaceWith))
+ .withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetStackWithBody_200(String replaceWith) throws IOException {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(getBodyFromFileVnfAdapter(replaceWith))
+ .withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetStacksWithBody_404() throws IOException {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(getBodyFromFileVnfAdapter(null))
+ .withStatus(HttpStatus.SC_NOT_FOUND)));
+ }
+
+ public static void mockOpenStackGetStacksStackId_404() {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/stackId"))
+ .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND)));
+ }
+
+ public static void mockOpenStackGetStacksVfModule_200(int port) throws IOException {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse()
+ .withHeader("X-Openstack-Request-Id", "openstackRquest")
+ .withBody(getBodyFromFile("OpenstackResponse_VnfStackId.json", port, "/mockPublicUrl/stacks/stackId")).withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetStacksVfModuleWithLocationHeader_200(int port) throws IOException {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse()
+ .withHeader("X-Openstack-Request-Id", "openstackRquest")
+ .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")
+ .withBody(getBodyFromFile("OpenstackResponse_VnfStackId.json", port, "/mockPublicUrl/stacks/stackId")).withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetStacksBaseStack_200(int port) throws IOException {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfModuleStackId")).willReturn(aResponse()
+ .withHeader("X-Openstack-Request-Id", "openstackRquest")
+ .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/baseVfModuleStackId")
+ .withBody(getBodyFromFile("OpenstackResponse_VnfBaseStackId.json", port, "/mockPublicUrl/stacks/stackId")).withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackPutStacks_200() {
+ stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackPutStack(String networkId,int responseCode) {
+ stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+networkId))
+ .willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withStatus(responseCode)));
+ }
+
+ public static void mockOpenStackGetStacksStackId_200(int port) throws IOException {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/StackId")).willReturn(aResponse()
+ .withHeader("X-Openstack-Request-Id", "openstackRquest")
+ .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/stackId")
+ .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/stackId")).withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackDeleteStacks() {
+ stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/da886914-efb2-4917-b335-c8381528d90b"))
+ .willReturn(aResponse().withHeader("X-Openstack-Request-Id", "openstackRquest")));
+ }
+
+ public static void mockOpenStackGetStacksVUSP_404() {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/da886914-efb2-4917-b335-c8381528d90b"))
+ .willReturn(aResponse()
+ .withHeader("X-Openstack-Request-Id", "openstackRquest")
+ .withStatus(HttpStatus.SC_NOT_FOUND)));
+ }
+
+ public static void mockOpenStackGetStackCreated_200(String filename, String networkName) {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile(filename).withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetStack_404(String networkName) {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(HttpStatus.SC_NOT_FOUND)));
+ }
+
+ public static void mockOpenStackGetStack_500(String networkName) {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
+ }
+
+ public static void mockOpenStackGetStackDeleteOrUpdateComplete_200(String filename) {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile(filename).withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetNeutronNetwork(String filename,String networkId,int status) {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile(filename).withStatus(status)));
+ }
+
+ public static void mockOpenStackGetNeutronNetwork(String networkId,int status) {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(status)));
+ }
+
+ public static void mockOpenStackDeleteStack_200() {
+ stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2))
+ .willReturn(aResponse().withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackDeleteStack_500() {
+ stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2))
+ .willReturn(aResponse().withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
+ }
+
+ public static void mockOpenStackDeleteNeutronNetwork(String networkId,int responseCode) {
+ stubFor(delete(urlPathEqualTo("/mockPublicUrl/v2.0/networks/" + networkId))
+ .willReturn(aResponse().withStatus(responseCode)));
+ }
+
+ public static void mockOpenStackPostMetadata_200() {
+ stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/metadata")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_Metadata.json").withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetMetadata_200() {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/metadata")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_Metadata.json").withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackPostTenantWithBodyFile_200() throws IOException {
+ stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants"))
+ .withRequestBody(equalToJson(readFile("src/test/resources/__files/OpenstackRequest_Tenant.json"))).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackPostTenant_200() throws IOException {
+ stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetTenantByName_200(String tenantName) {
+ stubFor(get(urlEqualTo("/mockPublicUrl/tenants/?name=" + tenantName)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetTenantByName_404(String tenantName) {
+ stubFor(get(urlEqualTo("/mockPublicUrl/tenants/?name=" + tenantName)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND)));
+ }
+
+ public static void mockOpenStackGetTenantById_200(String tenantId) {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetTenantById_404(String tenantId) {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND)));
+ }
+
+ public static void mockOpenStackDeleteTenantById_200(String tenantId) {
+ stubFor(delete(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetUser_200(String user) {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/users/" + user)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_User.json").withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackGetRoles_200(String roleFor) {
+ stubFor(get(urlPathEqualTo("/mockPublicUrl/" + roleFor + "/roles")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_Roles.json").withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockOpenStackPutRolesAdmin_200(String roleFor) {
+ stubFor(put(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/users/msoId/roles/" + roleFor + "/admin")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withBody("").withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockValetCreatePostResponse_200(String requestId, String body) {
+ stubFor(post(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(body).withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockValetCreatePutResponse_200(String requestId, String body) {
+ stubFor(put(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(body).withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockValetDeleteDeleteResponse_200(String requestId, String body) {
+ stubFor(delete(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(body).withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockValetConfirmPutRequest_200(String requestId, String body) {
+ stubFor(put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/confirm/"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(body).withStatus(HttpStatus.SC_OK)));
+ }
+
+ public static void mockValetRollbackPutRequest_200(String requestId, String body) {
+ stubFor(put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/rollback/"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(body).withStatus(HttpStatus.SC_OK)));
+ }
+
+ private static String getBodyFromFileVnfAdapter(String replaceWith) throws IOException {
+ String temp = readFile("src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json");
+ if (replaceWith == null) {
+ return temp;
+ }
+ return temp.replaceAll("CREATE_COMPLETE", replaceWith);
+ }
+
+ private static String readFile(String fileName) throws IOException {
+ try (BufferedReader br = new BufferedReader(new FileReader(fileName))) {
+ StringBuilder sb = new StringBuilder();
+ String line = br.readLine();
+
+ while (line != null) {
+ sb.append(line);
+ sb.append("\n");
+ line = br.readLine();
+ }
+ return sb.toString();
+ }
+ }
+
+ public static String getBodyFromFile(String fileName, int port, String urlPath) throws IOException {
+ return readFile("src/test/resources/__files/" + fileName).replaceAll("port", "http://localhost:" + port + urlPath);
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduBlueprintTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduBlueprintTest.java
new file mode 100644
index 0000000000..b382b6bcf8
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduBlueprintTest.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 TechMahindra
+ * ================================================================================
+ * 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.onap.so.vdu.utils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class VduBlueprintTest {
+
+ private VduBlueprint vduBlueprint;
+
+ private Map<String, byte[]> templateFiles;
+ private Map<String, byte[]> attachedFiles;
+
+ @Before
+ public void setUp() {
+ vduBlueprint = new VduBlueprint();
+ }
+
+ @Test
+ public void testGetVduModelId() {
+ vduBlueprint.setVduModelId("vduModelId");
+ Assert.assertNotNull(vduBlueprint.getVduModelId());
+ Assert.assertEquals("vduModelId", vduBlueprint.getVduModelId());
+ }
+
+ @Test
+ public void testGetMainTemplateName() {
+ vduBlueprint.setMainTemplateName("MainTemplateName");
+ Assert.assertNotNull(vduBlueprint.getMainTemplateName());
+ Assert.assertEquals("MainTemplateName", vduBlueprint.getMainTemplateName());
+ }
+
+ @Test
+ public void testGetTemplateFiles() {
+ byte[] templateFileData = "some template file data".getBytes();
+ templateFiles = new HashMap<>();
+ templateFiles.put("templateKey1", templateFileData);
+ vduBlueprint.setTemplateFiles(templateFiles);
+ Assert.assertNotNull(vduBlueprint.getTemplateFiles());
+ Assert.assertTrue(vduBlueprint.getTemplateFiles().containsKey("templateKey1"));
+ Assert.assertTrue(vduBlueprint.getTemplateFiles().containsValue(templateFileData));
+ }
+
+ @Test
+ public void testGetAttachedFiles() {
+ byte[] attachedFileData = "some file data".getBytes();
+ attachedFiles = new HashMap<>();
+ attachedFiles.put("attachedKey1", attachedFileData);
+ vduBlueprint.setAttachedFiles(attachedFiles);
+ Assert.assertNotNull(vduBlueprint.getAttachedFiles());
+ Assert.assertTrue(vduBlueprint.getAttachedFiles().containsKey("attachedKey1"));
+ Assert.assertTrue(vduBlueprint.getAttachedFiles().containsValue(attachedFileData));
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduInfoTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduInfoTest.java
new file mode 100644
index 0000000000..6331563362
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduInfoTest.java
@@ -0,0 +1,89 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 TechMahindra
+ * ================================================================================
+ * 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.onap.so.vdu.utils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class VduInfoTest {
+
+ private VduInfo vduInfo;
+ private VduStatus status = VduStatus.NOTFOUND;
+ private Map<String, Object> outputs;
+ private Map<String, Object> inputs;
+
+ @Before
+ public void setUp() {
+ vduInfo = new VduInfo();
+ }
+
+ @Test
+ public void testGetVnfInstanceId() {
+ String vnfInstanceId = "vnfInstanceId";
+ vduInfo.setVnfInstanceId(vnfInstanceId);
+ Assert.assertNotNull(vduInfo.getVnfInstanceId());
+ Assert.assertEquals("vnfInstanceId", vduInfo.getVnfInstanceId());
+ }
+
+ @Test
+ public void testGetVnfInstanceName() {
+ String vnfInstanceName = "vnfInstanceName";
+ vduInfo.setVnfInstanceName(vnfInstanceName);
+ Assert.assertNotNull(vduInfo.getVnfInstanceName());
+ Assert.assertEquals("vnfInstanceName", vduInfo.getVnfInstanceName());
+ }
+
+ @Test
+ public void testGetStatus() {
+ vduInfo.setStatus(status);
+ Assert.assertNotNull(vduInfo.getStatus());
+ Assert.assertEquals(status, vduInfo.getStatus());
+ }
+
+ @Test
+ public void testGetOutputs() {
+ Object obj = new Object();
+ String str = "some text";
+ outputs = new HashMap<>();
+ outputs.put(str, obj);
+ vduInfo.setOutputs(outputs);
+ Assert.assertNotNull(vduInfo.getOutputs());
+ Assert.assertTrue(vduInfo.getOutputs().containsKey(str));
+ Assert.assertTrue(vduInfo.getOutputs().containsValue(obj));
+ }
+
+ @Test
+ public void testGetInputs() {
+ Object obj = new Object();
+ String str = "some text";
+ inputs = new HashMap<>();
+ inputs.put(str, obj);
+ vduInfo.setInputs(inputs);
+ Assert.assertNotNull(vduInfo.getInputs());
+ Assert.assertTrue(vduInfo.getInputs().containsKey(str));
+ Assert.assertTrue(vduInfo.getInputs().containsValue(obj));
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.json b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.json
new file mode 100644
index 0000000000..2b6256dc16
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.json
@@ -0,0 +1,42 @@
+{
+ "createNetworkRequest": {
+ "skipAAI": true,
+ "messageId": "c4c44af4-4310-4d8b-a1eb-656fc99fe709",
+ "synchronous": true,
+ "cloudSiteId": "mtn13",
+ "tenantId": "ba38bc24a2ef4fb2ad2810c894f1938f",
+ "networkId": "da886914-efb2-4917-b335-c8381528d90b",
+ "networkName": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3",
+ "networkType": "CONTRAIL30_BASIC",
+ "modelCustomizationUuid": "3bdbb104-476c-483e-9f8b-c095b3d308ac",
+ "networkTechnology": "NEUTRON",
+ "subnets": [{
+ "subnetName": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3_subnet_1",
+ "subnetId": "da60501d-9aa8-48d2-99b7-26644fa01093",
+ "cidr": "20",
+ "gatewayIp": "",
+ "ipVersion": "4",
+ "enableDHCP": false,
+ "addrFromStart": true,
+ "hostRoutes": []
+ }],
+ "providerVlanNetwork": {
+ "physicalNetworkName": "FALSE",
+ "vlans": []
+ },
+ "contrailNetwork": {
+ "shared": "false",
+ "external": "false",
+ "routeTargets": [],
+ "policyFqdns": [],
+ "routeTableFqdns": []
+ },
+ "failIfExists": true,
+ "backout": false,
+ "msoRequest": {
+ "requestId": "5349f419-b3e9-4546-b3a1-094bd568d6b7",
+ "serviceInstanceId": "cf965caf-a003-4189-abf9-e0ed77056dd6"
+ },
+ "contrailRequest": false
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml
new file mode 100644
index 0000000000..b9fc419a65
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml
@@ -0,0 +1,17 @@
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <SOAP-ENV:Body>
+ <aetgt:createNetwork xmlns:aetgt="http://org.onap.so/network" xmlns:NetworkAdapter="http://org.onap.so/network">
+ <cloudSiteId>mtn13</cloudSiteId>
+ <tenantId>bef254252c5d44e6bcec65c180180ab5</tenantId>
+ <networkType>CONTRAIL30_GNDIRECT</networkType>
+ <networkName>dvspg-VCE_VPE-mtjnj40avbc</networkName>
+ <physicalNetworkName>dvs-mtjnj-01</physicalNetworkName>
+ <vlans>3014</vlans>
+ <failIfExists>false</failIfExists>
+ <request>
+ <requestId>9733c8d1-2668-4e5f-8b51-2cacc9b662c0</requestId>
+ <serviceInstanceId>MIS/1806/25009/SW_INTERNET</serviceInstanceId>
+ </request>
+ </aetgt:createNetwork>
+ </SOAP-ENV:Body>
+ </SOAP-ENV:Envelope> \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_Fail_If_Exist_True.xml b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_Fail_If_Exist_True.xml
new file mode 100644
index 0000000000..be0e748da2
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_Fail_If_Exist_True.xml
@@ -0,0 +1,17 @@
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <SOAP-ENV:Body>
+ <aetgt:createNetwork xmlns:aetgt="http://org.onap.so/network" xmlns:NetworkAdapter="http://org.onap.so/network>
+ <cloudSiteId>mtn13</cloudSiteId>
+ <tenantId>bef254252c5d44e6bcec65c180180ab5</tenantId>
+ <networkType>CONTRAIL30_GNDIRECT</networkType>
+ <networkName>dvspg-VCE_VPE-mtjnj40avbc</networkName>
+ <physicalNetworkName>dvs-mtjnj-01</physicalNetworkName>
+ <vlans>3014</vlans>
+ <failIfExists>true</failIfExists>
+ <request>
+ <requestId>9733c8d1-2668-4e5f-8b51-2cacc9b662c0</requestId>
+ <serviceInstanceId>MIS/1806/25009/SW_INTERNET</serviceInstanceId>
+ </request>
+ </aetgt:createNetwork>
+ </SOAP-ENV:Body>
+ </SOAP-ENV:Envelope> \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_InvalidCloudSiteId.xml b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_InvalidCloudSiteId.xml
new file mode 100644
index 0000000000..ba924885fc
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_InvalidCloudSiteId.xml
@@ -0,0 +1,17 @@
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <SOAP-ENV:Body>
+ <aetgt:createNetwork xmlns:aetgt="http://org.onap.so/network" xmlns:NetworkAdapter="http://org.onap.so/network">
+ <cloudSiteId>mtn14</cloudSiteId>
+ <tenantId>bef254252c5d44e6bcec65c180180ab5</tenantId>
+ <networkType>CONTRAIL30_GNDIRECT</networkType>
+ <networkName>dvspg-VCE_VPE-mtjnj40avbc</networkName>
+ <physicalNetworkName>dvs-mtjnj-01</physicalNetworkName>
+ <vlans>3014</vlans>
+ <failIfExists>false</failIfExists>
+ <request>
+ <requestId>9733c8d1-2668-4e5f-8b51-2cacc9b662c0</requestId>
+ <serviceInstanceId>MIS/1806/25009/SW_INTERNET</serviceInstanceId>
+ </request>
+ </aetgt:createNetwork>
+ </SOAP-ENV:Body>
+ </SOAP-ENV:Envelope> \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_NEUTRON_Mode.xml b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_NEUTRON_Mode.xml
new file mode 100644
index 0000000000..c62f7a573e
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_NEUTRON_Mode.xml
@@ -0,0 +1,17 @@
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <SOAP-ENV:Body>
+ <aetgt:createNetwork xmlns:aetgt="http://org.onap.so/network" xmlns:NetworkAdapter="http://org.onap.so/network">
+ <cloudSiteId>mtn13</cloudSiteId>
+ <tenantId>bef254252c5d44e6bcec65c180180ab5</tenantId>
+ <networkType>CONTRAIL31_GNDIRECT</networkType>
+ <networkName>dvspg-VCE_VPE-mtjnj40avbc</networkName>
+ <physicalNetworkName>dvs-mtjnj-01</physicalNetworkName>
+ <vlans>3014</vlans>
+ <failIfExists>false</failIfExists>
+ <request>
+ <requestId>9733c8d1-2668-4e5f-8b51-2cacc9b662c0</requestId>
+ <serviceInstanceId>MIS/1806/25009/SW_INTERNET</serviceInstanceId>
+ </request>
+ </aetgt:createNetwork>
+ </SOAP-ENV:Body>
+ </SOAP-ENV:Envelope> \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_NEUTRON_Mode_Fail_If_Exist_True.xml b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_NEUTRON_Mode_Fail_If_Exist_True.xml
new file mode 100644
index 0000000000..2e27bec5f7
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_NEUTRON_Mode_Fail_If_Exist_True.xml
@@ -0,0 +1,17 @@
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <SOAP-ENV:Body>
+ <aetgt:createNetwork xmlns:aetgt="http://org.onap.so/network" xmlns:NetworkAdapter="http://org.onap.so/network">
+ <cloudSiteId>mtn13</cloudSiteId>
+ <tenantId>bef254252c5d44e6bcec65c180180ab5</tenantId>
+ <networkType>CONTRAIL31_GNDIRECT</networkType>
+ <networkName>dvspg-VCE_VPE-mtjnj40avbc</networkName>
+ <physicalNetworkName>dvs-mtjnj-01</physicalNetworkName>
+ <vlans>3014</vlans>
+ <failIfExists>true</failIfExists>
+ <request>
+ <requestId>9733c8d1-2668-4e5f-8b51-2cacc9b662c0</requestId>
+ <serviceInstanceId>MIS/1806/25009/SW_INTERNET</serviceInstanceId>
+ </request>
+ </aetgt:createNetwork>
+ </SOAP-ENV:Body>
+ </SOAP-ENV:Envelope> \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/DeleteNetwork.xml b/adapters/mso-openstack-adapters/src/test/resources/DeleteNetwork.xml
new file mode 100644
index 0000000000..2e188a1bc1
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/DeleteNetwork.xml
@@ -0,0 +1,15 @@
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <SOAP-ENV:Body>
+ <aetgt:deleteNetwork xmlns:aetgt="http://org.onap.so/network" xmlns:NetworkAdapter="http://org.onap.so/network">
+ <cloudSiteId>mtn13</cloudSiteId>
+ <tenantId>2871503957144f72b3cf481b379828ec</tenantId>
+ <networkType>CONTRAIL30_BASIC</networkType>
+ <modelCustomizationUuid/>
+ <networkId>43173f6a-d699-414b-888f-ab243dda6dfe</networkId>
+ <request>
+ <requestId>5a29d907-b8c7-47bf-85f3-3940c0cce0f7</requestId>
+ <serviceInstanceId>ab652f96-1fc3-4fdd-8e1b-4af629bc22c0</serviceInstanceId>
+ </request>
+ </aetgt:deleteNetwork>
+ </SOAP-ENV:Body>
+</SOAP-ENV:Envelope> \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/META-INF/services/com.woorea.openstack.base.client.OpenStackClientConnector b/adapters/mso-openstack-adapters/src/test/resources/META-INF/services/com.woorea.openstack.base.client.OpenStackClientConnector
new file mode 100644
index 0000000000..1281d32948
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/META-INF/services/com.woorea.openstack.base.client.OpenStackClientConnector
@@ -0,0 +1 @@
+com.woorea.openstack.connector.HttpClientConnector \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/QueryNetwork.xml b/adapters/mso-openstack-adapters/src/test/resources/QueryNetwork.xml
new file mode 100644
index 0000000000..7ce043295f
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/QueryNetwork.xml
@@ -0,0 +1,13 @@
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <SOAP-ENV:Body>
+ <aetgt:queryNetwork xmlns:aetgt="http://org.onap.so/network" xmlns:NetworkAdapter="http://org.onap.so/network">
+ <cloudSiteId>mtn13</cloudSiteId>
+ <tenantId>2871503957144f72b3cf481b379828ec</tenantId>
+ <networkNameOrId>43173f6a-d699-414b-888f-ab243dda6dfe</networkNameOrId>
+ <request>
+ <requestId>5a29d907-b8c7-47bf-85f3-3940c0cce0f7</requestId>
+ <serviceInstanceId>ab652f96-1fc3-4fdd-8e1b-4af629bc22c0</serviceInstanceId>
+ </request>
+ </aetgt:queryNetwork>
+ </SOAP-ENV:Body>
+</SOAP-ENV:Envelope> \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/UpdateNetwork.xml b/adapters/mso-openstack-adapters/src/test/resources/UpdateNetwork.xml
new file mode 100644
index 0000000000..9d00a77321
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/UpdateNetwork.xml
@@ -0,0 +1,23 @@
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <SOAP-ENV:Body>
+ <aetgt:updateNetwork xmlns:aetgt="http://org.onap.so/network" xmlns:NetworkAdapter="http://org.onap.so/network">
+ <cloudSiteId>mtn13</cloudSiteId>
+ <tenantId>2871503957144f72b3cf481b379828ec</tenantId>
+ <networkType>CONTRAIL30_BASIC</networkType>
+ <modelCustomizationUuid/>
+ <networkId>43173f6a-d699-414b-888f-ab243dda6dfe</networkId>
+ <networkName>vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0</networkName>
+ <physicalNetworkName>TestPhysicalNetwork</physicalNetworkName>
+ <vlans>
+ 1
+ </vlans>
+ <vlans>
+ 2
+ </vlans>
+ <request>
+ <requestId>5a29d907-b8c7-47bf-85f3-3940c0cce0f7</requestId>
+ <serviceInstanceId>ab652f96-1fc3-4fdd-8e1b-4af629bc22c0</serviceInstanceId>
+ </request>
+ </aetgt:updateNetwork>
+ </SOAP-ENV:Body>
+</SOAP-ENV:Envelope> \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkRequest.xml b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkRequest.xml
new file mode 100644
index 0000000000..294a2672dd
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkRequest.xml
@@ -0,0 +1,49 @@
+<createNetworkRequest>
+ <cloudSiteId>dpa2b</cloudSiteId>
+ <tenantId>ba38bc24a2ef4fb2ad2810c894f1938f</tenantId>
+ <networkId>da886914-efb2-4917-b335-c8381528d90b</networkId>
+ <networkName>vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0</networkName>
+ <networkType>CONTRAIL30_BASIC</networkType>
+ <modelCustomizationUuid>1fd47fd4-d5f0-461e-a133-5f3ad4b263ba</modelCustomizationUuid>
+ <networkTechnology>CONTRAIL</networkTechnology>
+ <providerVlanNetwork>
+ <physicalNetworkName>tbd</physicalNetworkName>
+ <vlans/>
+ </providerVlanNetwork>
+ <contrailNetwork>
+ <shared>false</shared>
+ <external>false</external>
+ <routeTargets>
+ <routeTarget>13979:105735</routeTarget>
+ <routeTargetRole>BOTH</routeTargetRole>
+ </routeTargets>
+ <policyFqdns/>
+ <routeTableFqdns/>
+ </contrailNetwork>
+ <subnets>
+ <allocationPools>
+ <start>2001:1890:1001:22DB:ffff:ffff:ffff:0</start>
+ <end>2001:1890:1001:22DB:ffff:ffff:ffff:fffe</end>
+ </allocationPools>
+ <cidr>2001:1890:1001:22DB::/64</cidr>
+ <enableDHCP>true</enableDHCP>
+ <gatewayIp>2001:1890:1001:22DB::1</gatewayIp>
+ <ipVersion>6</ipVersion>
+ <subnetId>5f28e204-77ab-49d9-bf77-7e2dceb59457</subnetId>
+ <subnetName>vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0_IPv6_Subnet1</subnetName>
+ <addrFromStart>true</addrFromStart>
+ <hostRoutes>
+ <prefix>2001:1890:1001:22DB::0/64</prefix>
+ <nextHop>2001:1890:1001:22DB::1</nextHop>
+ </hostRoutes>
+ </subnets>
+ <skipAAI>true</skipAAI>
+ <backout>true</backout>
+ <failIfExists>false</failIfExists>
+ <msoRequest>
+ <requestId>2e6fd7b5-f8fa-495b-b535-2ddcb4120917</requestId>
+ <serviceInstanceId>05869d5f-47df-4b45-bbfc-4f03ce0a50bf</serviceInstanceId>
+ </msoRequest>
+ <messageId>c454c9c5-a308-44e7-94fc-77c8715af0cb</messageId>
+ <notificationUrl/>
+</createNetworkRequest> \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse.json
new file mode 100644
index 0000000000..1f2015abe1
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse.json
@@ -0,0 +1,25 @@
+{
+ "createNetworkResponse": {
+ "messageId": null,
+ "networkId": "da886914-efb2-4917-b335-c8381528d90b",
+ "neutronNetworkId": null,
+ "networkStackId": "stackname/stackId",
+ "networkFqdn": null,
+ "networkCreated": true,
+ "subnetMap": {
+
+ },
+ "rollback": {
+ "networkStackId": "stackname/stackId",
+ "tenantId": "ba38bc24a2ef4fb2ad2810c894f1938f",
+ "cloudId": "mtn13",
+ "networkType": "CONTRAIL30_BASIC",
+ "modelCustomizationUuid": "3bdbb104-476c-483e-9f8b-c095b3d308ac",
+ "networkCreated": true,
+ "msoRequest": {
+ "requestId": "requestId",
+ "serviceInstanceId": "05869d5f-47df-4b45-bbfc-4f03ce0a50bf"
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse2.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse2.json
new file mode 100644
index 0000000000..b93003e8b2
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse2.json
@@ -0,0 +1,25 @@
+{
+ "createNetworkResponse": {
+ "networkId": "da886914-efb2-4917-b335-c8381528d90b",
+ "neutronNetworkId": null,
+ "networkStackId": "stackname/stackId",
+ "networkFqdn": null,
+ "networkCreated": true,
+ "subnetMap": {
+
+ },
+ "rollback": {
+ "networkStackId": "stackname/stackId",
+ "tenantId": "ba38bc24a2ef4fb2ad2810c894f1938f",
+ "cloudId": "mtn13",
+ "networkType": "CONTRAIL30_BASIC",
+ "modelCustomizationUuid": "3bdbb104-476c-483e-9f8b-c095b3d308ac",
+ "networkCreated": true,
+ "msoRequest": {
+ "requestId": "5349f419-b3e9-4546-b3a1-094bd568d6b7",
+ "serviceInstanceId": "cf965caf-a003-4189-abf9-e0ed77056dd6"
+ }
+ },
+ "messageId": "c4c44af4-4310-4d8b-a1eb-656fc99fe709"
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json
new file mode 100644
index 0000000000..934e075220
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json
@@ -0,0 +1,16 @@
+{
+ "createTenantResponse": {
+ "cloudSiteId": "mtn13",
+ "tenantId": "tenantId",
+ "tenantCreated": true,
+ "tenantRollback": {
+ "tenantId": "tenantId",
+ "cloudId": "mtn13",
+ "tenantCreated": true,
+ "msoRequest": {
+ "requestId": "62265093-277d-4388-9ba6-449838ade586",
+ "serviceInstanceId": "4147e06f-1b89-49c5-b21f-4faf8dc9805a"
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json
new file mode 100644
index 0000000000..6f81ebcd36
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json
@@ -0,0 +1,15 @@
+{
+ "createTenantResponse": {
+ "cloudSiteId": "mtn13",
+ "tenantId": "tenantId",
+ "tenantCreated": false,
+ "tenantRollback": {
+ "cloudId": "mtn13",
+ "tenantCreated": false,
+ "msoRequest": {
+ "requestId": "62265093-277d-4388-9ba6-449838ade586",
+ "serviceInstanceId": "4147e06f-1b89-49c5-b21f-4faf8dc9805a"
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateVfModuleResponse.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateVfModuleResponse.json
new file mode 100644
index 0000000000..7c97163ab4
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateVfModuleResponse.json
@@ -0,0 +1,26 @@
+{
+ "createVfModuleResponse": {
+ "messageId": "62265093-277d-4388-9ba6-449838ade586-1517252396874",
+ "vnfId": "c93e0d34-5b63-45de-bbae-b0fe49dd3bd9",
+ "vfModuleId": "1d48aaec-b7f3-4c24-ba4a-4e798ed3223c",
+ "vfModuleStackId": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId",
+ "vfModuleCreated": true,
+ "vfModuleOutputs": {
+
+ },
+ "rollback": {
+ "vnfId": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId",
+ "vfModuleId": "1d48aaec-b7f3-4c24-ba4a-4e798ed3223c",
+ "vfModuleStackId": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId",
+ "vfModuleCreated": true,
+ "tenantId": "0422ffb57ba042c0800a29dc85ca70f8",
+ "cloudSiteId": "mtn13",
+ "msoRequest": {
+ "requestId": "62265093-277d-4388-9ba6-449838ade586",
+ "serviceInstanceId": "4147e06f-1b89-49c5-b21f-4faf8dc9805a"
+ },
+ "messageId": "62265093-277d-4388-9ba6-449838ade586-1517252396874",
+ "mode": "HEAT"
+ }
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/DeleteNetworkResponse.json b/adapters/mso-openstack-adapters/src/test/resources/__files/DeleteNetworkResponse.json
new file mode 100644
index 0000000000..5d32bec3b6
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/DeleteNetworkResponse.json
@@ -0,0 +1,6 @@
+{
+ "deleteNetworkResponse": {
+ "networkDeleted": true,
+ "networkId": "da886914-efb2-4917-b335-c8381528d90b"
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/DeleteTenantResponse_Failed.json b/adapters/mso-openstack-adapters/src/test/resources/__files/DeleteTenantResponse_Failed.json
new file mode 100644
index 0000000000..a1f0eec219
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/DeleteTenantResponse_Failed.json
@@ -0,0 +1,5 @@
+{
+ "deleteTenantResponse": {
+ "tenantDeleted": false
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/DeleteTenantResponse_Success.json b/adapters/mso-openstack-adapters/src/test/resources/__files/DeleteTenantResponse_Success.json
new file mode 100644
index 0000000000..c4458efe9e
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/DeleteTenantResponse_Success.json
@@ -0,0 +1,5 @@
+{
+ "deleteTenantResponse": {
+ "tenantDeleted": true
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/DeleteVfModuleResponse.json b/adapters/mso-openstack-adapters/src/test/resources/__files/DeleteVfModuleResponse.json
new file mode 100644
index 0000000000..120b47970f
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/DeleteVfModuleResponse.json
@@ -0,0 +1,7 @@
+{
+ "deleteVfModuleResponse": {
+ "vfModuleId" : "1d48aaec-b7f3-4c24-ba4a-4e798ed3223c",
+ "vfModuleDeleted" : true,
+ "vnfId" : "c93e0d34-5b63-45de-bbae-b0fe49dd3bd9"
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/GetNeutronNetwork.json b/adapters/mso-openstack-adapters/src/test/resources/__files/GetNeutronNetwork.json
new file mode 100644
index 0000000000..822f87f427
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/GetNeutronNetwork.json
@@ -0,0 +1,45 @@
+{
+ "network": {
+ "admin_state_up": true,
+ "availability_zone_hints": [],
+ "availability_zones": [
+ "nova"
+ ],
+ "created_at": "2016-03-08T20:19:41",
+ "dns_domain": "my-domain.org.",
+ "id": "43173f6a-d699-414b-888f-ab243dda6dfe",
+ "ipv4_address_scope": null,
+ "ipv6_address_scope": null,
+ "l2_adjacency": false,
+ "mtu": 1500,
+ "name": "net1",
+ "port_security_enabled": true,
+ "project_id": "9bacb3c5d39d41a79512987f338cf177",
+ "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
+ "revision_number": 1,
+ "router:external": false,
+ "segments": [
+ {
+ "provider:network_type": "vlan",
+ "provider:physical_network": "public",
+ "provider:segmentation_id": 2
+ },
+ {
+ "provider:network_type": "flat",
+ "provider:physical_network": "default",
+ "provider:segmentation_id": 0
+ }
+ ],
+ "shared": false,
+ "status": "ACTIVE",
+ "subnets": [
+ "54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
+ ],
+ "tags": ["tag1,tag2"],
+ "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
+ "updated_at": "2016-03-08T20:19:41",
+ "vlan_transparent": false,
+ "description": "",
+ "is_default": false
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackCreateNeutronNetworkResponse.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackCreateNeutronNetworkResponse.json
new file mode 100644
index 0000000000..d92f92a873
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackCreateNeutronNetworkResponse.json
@@ -0,0 +1,11 @@
+{
+ "network":
+ {
+ "status": "ACTIVE",
+ "subnets": [],
+ "name": "net-name",
+ "admin_state_up": true,
+ "tenant_id": "388a70781bae4ca895f17b7f6293eb70",
+ "shared": false, "id": "2a4017ef-31ff-496a-9294-e96ecc3bc9c9"
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackGetNeutronNetworks.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackGetNeutronNetworks.json
new file mode 100644
index 0000000000..91910b0e71
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackGetNeutronNetworks.json
@@ -0,0 +1,22 @@
+{
+ "networks": [
+ {
+ "status": "ACTIVE",
+ "subnets": [],
+ "name": "network_1",
+ "admin_state_up": true,
+ "tenant_id": "c1210485b2424d48804aad5d39c61b8f",
+ "id": "3a06dfc7-d239-4aad-9a57-21cd171c72e5",
+ "shared": false
+ },
+ {
+ "status": "ACTIVE",
+ "subnets": [],
+ "name": "dvspg-VCE_VPE-mtjnj40avbc",
+ "admin_state_up": true,
+ "tenant_id": "c1210485b2424d48804aad5d39c61b8f",
+ "id": "7db8c5a4-6eb0-478d-856b-7cfda2b25e13",
+ "shared": false
+ }
+ ]
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackRequest_Tenant.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackRequest_Tenant.json
new file mode 100644
index 0000000000..883f0a395d
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackRequest_Tenant.json
@@ -0,0 +1,7 @@
+{
+ "tenant": {
+ "name": "testingTenantName",
+ "description": "SDN Tenant (via MSO)",
+ "enabled": true
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Access.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Access.json
new file mode 100644
index 0000000000..70a0914bf9
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Access.json
@@ -0,0 +1,40 @@
+{
+ "access": {
+ "token": {
+ "id": "tokenId1234",
+ "issued_at": null,
+ "expires": "1517418429142",
+ "tenant": null
+ },
+ "serviceCatalog": [
+ {
+ "type": "orchestration",
+ "name": null,
+ "endpoints": [
+ {
+ "region": "mtn13",
+ "publicURL": "port",
+ "internalURL": null,
+ "adminURL": null
+ }
+ ],
+ "endpointsLinks": null
+ },
+ {
+ "type": "network",
+ "name": null,
+ "endpoints": [
+ {
+ "region": "mtn13",
+ "publicURL": "port",
+ "internalURL": null,
+ "adminURL": null
+ }
+ ],
+ "endpointsLinks": null
+ }
+ ],
+ "user": null,
+ "metadata": null
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Access_Admin.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Access_Admin.json
new file mode 100644
index 0000000000..845ea26f62
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Access_Admin.json
@@ -0,0 +1,27 @@
+{
+ "access": {
+ "token": {
+ "id": "tokenId1234",
+ "issued_at": null,
+ "expires": "1517418429142",
+ "tenant": null
+ },
+ "serviceCatalog": [
+ {
+ "type": "identity",
+ "name": null,
+ "endpoints": [
+ {
+ "region": "mtn13",
+ "publicURL": "port",
+ "internalURL": null,
+ "adminURL": null
+ }
+ ],
+ "endpointsLinks": null
+ }
+ ],
+ "user": null,
+ "metadata": null
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Access_queryNetwork.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Access_queryNetwork.json
new file mode 100644
index 0000000000..b25acb8393
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Access_queryNetwork.json
@@ -0,0 +1,27 @@
+{
+ "access": {
+ "token": {
+ "id": "tokenId1234",
+ "issued_at": null,
+ "expires": "1517418429142",
+ "tenant": null
+ },
+ "serviceCatalog": [
+ {
+ "type": "network",
+ "name": null,
+ "endpoints": [
+ {
+ "region": "mtn13",
+ "publicURL": "port",
+ "internalURL": null,
+ "adminURL": null
+ }
+ ],
+ "endpointsLinks": null
+ }
+ ],
+ "user": null,
+ "metadata": null
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Metadata.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Metadata.json
new file mode 100644
index 0000000000..fbfda76c23
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Metadata.json
@@ -0,0 +1,5 @@
+{
+ "metadata" : {
+ "key1" : "value1"
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Roles.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Roles.json
new file mode 100644
index 0000000000..47ae4488cd
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Roles.json
@@ -0,0 +1,10 @@
+{
+ "roles": [
+ {
+ "id": "admin",
+ "name": "admin",
+ "description": null,
+ "enabled": null
+ }
+ ]
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json
new file mode 100644
index 0000000000..af63ca7de4
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json
@@ -0,0 +1,17 @@
+{
+ "stack": {
+ "description": null,
+ "links": null,
+ "stackStatusReason": null,
+ "stackName": null,
+ "updatedTime": null,
+ "creationTime": null,
+ "stackStatus": "NOT_FOUND",
+ "id": "stackId",
+ "files": null,
+ "outputs": null,
+ "parameters": {
+
+ }
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_StackId.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_StackId.json
new file mode 100644
index 0000000000..161080a7c6
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_StackId.json
@@ -0,0 +1,14 @@
+{
+ "stack": {
+ "id": "da886914-efb2-4917-b335-c8381528d90b",
+ "links" : [
+ {
+ "href" : "port",
+ "rel" : "self"
+ }
+ ],
+ "stack_name": "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0",
+ "stack_status": "UPDATE_COMPLETE"
+
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created.json
new file mode 100644
index 0000000000..477acadf81
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created.json
@@ -0,0 +1,17 @@
+{
+ "stack": {
+ "description": null,
+ "links": null,
+ "stack_status_reason": null,
+ "stack_name": "stackname",
+ "updated_time": null,
+ "creation_time": null,
+ "stack_status": "CREATE_COMPLETE",
+ "id": "stackId",
+ "files": null,
+ "outputs": null,
+ "parameters": {
+
+ }
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json
new file mode 100644
index 0000000000..29893ccb7b
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json
@@ -0,0 +1,17 @@
+{
+ "stack": {
+ "description": null,
+ "links": null,
+ "stack_status_reason": null,
+ "stack_name": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001",
+ "updated_time": null,
+ "creation_time": null,
+ "stack_status": "CREATE_COMPLETE",
+ "id": "stackId",
+ "files": null,
+ "outputs": null,
+ "parameters": {
+
+ }
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json
new file mode 100644
index 0000000000..8612258eee
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json
@@ -0,0 +1,17 @@
+{
+ "stack": {
+ "description": null,
+ "links": null,
+ "stackStatusReason": null,
+ "stackName": null,
+ "updatedTime": null,
+ "creationTime": null,
+ "stack_status": "DELETE_COMPLETE",
+ "id": "stackId",
+ "files": null,
+ "outputs": null,
+ "parameters": {
+
+ }
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Failed_VfModule.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Failed_VfModule.json
new file mode 100644
index 0000000000..5f667f70af
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Failed_VfModule.json
@@ -0,0 +1,17 @@
+{
+ "stack": {
+ "description": null,
+ "links": null,
+ "stack_status_reason": null,
+ "stack_name": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001",
+ "updated_time": null,
+ "creation_time": null,
+ "stack_status": "CREATE_FAILED",
+ "id": "stackId",
+ "files": null,
+ "outputs": null,
+ "parameters": {
+
+ }
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_UpdateComplete.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_UpdateComplete.json
new file mode 100644
index 0000000000..63673cc069
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_UpdateComplete.json
@@ -0,0 +1,17 @@
+{
+ "stack": {
+ "description": null,
+ "links": null,
+ "stackStatusReason": null,
+ "stackName": "stackname",
+ "updatedTime": null,
+ "creationTime": null,
+ "stack_status": "UPDATE_COMPLETE",
+ "id": "stackId",
+ "files": null,
+ "outputs": null,
+ "parameters": {
+
+ }
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Updating_VfModule.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Updating_VfModule.json
new file mode 100644
index 0000000000..edd0ec72aa
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Updating_VfModule.json
@@ -0,0 +1,17 @@
+{
+ "stack": {
+ "description": null,
+ "links": null,
+ "stack_status_reason": null,
+ "stack_name": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001",
+ "updated_time": null,
+ "creation_time": null,
+ "stack_status": "UPDATE_IN_PROGRESS",
+ "id": "stackId",
+ "files": null,
+ "outputs": null,
+ "parameters": {
+
+ }
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Tenant.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Tenant.json
new file mode 100644
index 0000000000..e8eebbbf7c
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Tenant.json
@@ -0,0 +1,8 @@
+{
+ "tenant": {
+ "id": "tenantId",
+ "name": "testingTenantName",
+ "description": null,
+ "enabled": null
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_User.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_User.json
new file mode 100644
index 0000000000..d2f3ea2b0e
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_User.json
@@ -0,0 +1,11 @@
+{
+ "user": {
+ "id": "msoId",
+ "username": "admin",
+ "password": null,
+ "tenantId": "tenantId",
+ "name": "testingTenantName",
+ "email": null,
+ "enabled": null
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json
new file mode 100644
index 0000000000..f4a3c520ba
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json
@@ -0,0 +1,12 @@
+{
+ "stack": {
+ "id": "baseVfModuleStackId",
+ "links" : [
+ {
+ "href" : "port",
+ "rel" : "self"
+ }
+ ],
+ "stack_name": "vnfBaseStack"
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfStackId.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfStackId.json
new file mode 100644
index 0000000000..1d8f00ceb3
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfStackId.json
@@ -0,0 +1,20 @@
+{
+ "stack": {
+ "id": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001",
+ "links" : [
+ {
+ "href" : "port",
+ "rel" : "self"
+ }
+ ],
+ "stack_name": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001",
+ "stack_status": "UPDATE_COMPLETE",
+ "outputs": [
+ {
+ "output_key": "output name",
+ "output_value": "output value",
+ "description": "output description"
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/RollbackVfModuleResponse.json b/adapters/mso-openstack-adapters/src/test/resources/__files/RollbackVfModuleResponse.json
new file mode 100644
index 0000000000..56c3402af1
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/RollbackVfModuleResponse.json
@@ -0,0 +1,5 @@
+{
+ "rollbackVfModuleResponse" : {
+ "vfModuleRolledback" : true
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/UpdateNetworkResponse.json b/adapters/mso-openstack-adapters/src/test/resources/__files/UpdateNetworkResponse.json
new file mode 100644
index 0000000000..cca18394e1
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/UpdateNetworkResponse.json
@@ -0,0 +1,8 @@
+{
+ "updateNetworkResponse": {
+ "networkId": "da886914-efb2-4917-b335-c8381528d90b",
+ "subnetMap": {
+
+ }
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/UpdateVfModuleResponse.json b/adapters/mso-openstack-adapters/src/test/resources/__files/UpdateVfModuleResponse.json
new file mode 100644
index 0000000000..b3b251b856
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/UpdateVfModuleResponse.json
@@ -0,0 +1,5 @@
+{
+ "updateVfModuleResponse" : {
+ "vfModuleId" : "1d48aaec-b7f3-4c24-ba4a-4e798ed3223c"
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/ValetCreateRequest.json b/adapters/mso-openstack-adapters/src/test/resources/__files/ValetCreateRequest.json
new file mode 100644
index 0000000000..d7ecca9aba
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/ValetCreateRequest.json
@@ -0,0 +1,9 @@
+{
+ "status": {
+ "status": "200",
+ "message": "CREATE - test message"
+ },
+ "parameters": {
+ "key": "value"
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/ValetDeleteRequest.json b/adapters/mso-openstack-adapters/src/test/resources/__files/ValetDeleteRequest.json
new file mode 100644
index 0000000000..dadb77803b
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/ValetDeleteRequest.json
@@ -0,0 +1,6 @@
+{
+ "status": {
+ "status": "200",
+ "message": "DELETE - test message"
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
new file mode 100644
index 0000000000..97eecc2423
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
@@ -0,0 +1,137 @@
+# will be used as entry in DB to say SITE OFF/ON for healthcheck
+# MSO Properties go here
+org:
+ onap:
+ so:
+ adapters:
+ default_keystone_url_version: /v2.0
+ default_keystone_reg_ex: "/[vV][0-9]"
+ vnf:
+ bpelauth: 481E6A95CE97E393A53363750D5E1E75
+ checkRequiredParameters: true
+ addGetFilesOnVolumeReq: false
+ sockettimeout: 30
+ connecttimeout: 30
+ retrycount: 5
+ retryinterval: -15
+ retrylist: 408,429,500,502,503,504,900
+ network:
+ bpelauth: 481E6A95CE97E393A53363750D5E1E75
+ sockettimeout: 5
+ connecttimeout: 5
+ retrycount: 5
+ retryinterval: -15
+ retrylist: 408,429,500,502,503,504,900
+ tenant:
+ default_x_aic_orm_client_string: ONAP-SO
+ default_keystone_url_version: /v2.0
+ default_keystone_reg_ex: "/[vV][0-9]"
+ default_tenant_description: ECOMP Tenant
+ default_region_type: single
+ default_user_role: admin
+ default_success_status_string: Success
+ default_no_regions_status_string: no regions
+ default_orm_request_path: /v1/orm/customers/
+ default_orm_url_replace_this: 8080
+ default_orm_url_replace_with_this: 7080
+ default_quota_value: 10
+ set_default_quota: false
+ valet:
+ base_url: http://localhost:${wiremock.server.port}
+ base_path: /api/valet/placement/v1/
+ valet_auth:
+ecomp:
+ mso:
+ adapters:
+ po:
+ retryCodes: 504
+ retryDelay: 5
+ retryCount: 3
+ vnf:
+ heat:
+ create:
+ pollInterval: 15
+ delete:
+ pollTimeout: 7500
+ pollInterval: 15
+ network:
+ heat:
+ create:
+ pollInterval: 15
+ delete:
+ pollTimeout: 300
+ pollInterval: 15
+
+server-port: 8080
+ssl-enable: false
+tomcat:
+ max-threads: 50
+mso:
+ logPath: logs
+ catalog:
+ db:
+ spring:
+ endpoint: "http://localhost:"
+ db:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ site-name: localDevEnv
+ async:
+ core-pool-size: 50
+ max-pool-size: 50
+ queue-capacity: 500
+spring:
+ datasource:
+ url: jdbc:mariadb://localhost:3307/catalogdb
+ username: root
+ password: password
+ driver-class-name: org.mariadb.jdbc.Driver
+ initialize: true
+ initialization-mode: never
+ jpa:
+ generate-ddl: false
+ show-sql: false
+ hibernate:
+ ddl-auto: none
+ naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
+ enable-lazy-load-no-trans: true
+ database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+ security:
+ usercredentials:
+ -
+ username: test
+ password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu'
+ role: MSO-Client
+
+mariaDB4j:
+ dataDir:
+ port: 3308
+ databaseName: catalogdb
+
+
+#Actuator
+management:
+ endpoints:
+ enabled-by-default: false
+ endpoint:
+ info:
+ enabled: true
+
+cloud_config:
+ identity_services:
+ MTN13:
+ identity_url: "http://localhost:${wiremock.server.port}/v2.0"
+ mso_id: "m93945"
+ mso_pass: "93937EA01B94A10A49279D4572B48369"
+ admin_tenant: "admin"
+ member_role: "admin"
+ tenant_metadata: true
+ identity_server_type: "KEYSTONE"
+ identity_authentication_type: "USERNAME_PASSWORD"
+ cloud_sites:
+ mtn13:
+ region_id: "mtn13"
+ clli: "MDT13"
+ aic_version: "3.0"
+ identity_service_id: "MTN13"
+ orchestrator: "orchestrator"
+ cloudify_id: "mtn13"
diff --git a/adapters/mso-openstack-adapters/src/test/resources/cloud_config.json b/adapters/mso-openstack-adapters/src/test/resources/cloud_config.json
new file mode 100644
index 0000000000..15d60ab48b
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/cloud_config.json
@@ -0,0 +1,258 @@
+{
+ "cloud_config": {
+ "identity_services": {
+ "MT_KEYSTONE": {
+ "identity_url": "http://localhost:5000/v2.0",
+ "mso_id": "john",
+ "mso_pass": "FD205490A48D48475607C36B9AD902BF",
+ "admin_tenant": "admin",
+ "member_role": "_member_",
+ "tenant_metadata": false,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "DAN_KEYSTONE": {
+ "identity_url": "http://192.168.170.21:5000/v2.0",
+ "mso_id": "jc1348",
+ "mso_pass": "BC59F80E38208A42ABB81ECCDD4FB3E4",
+ "admin_tenant": "service",
+ "member_role": "_member_",
+ "tenant_metadata": false,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "MTINJVCC101_DCP": {
+ "identity_url": "http://192.168.27.7:5000/v2.0",
+ "mso_id": "m93909",
+ "mso_pass": "95604B9EAAC4D77D74786FAE54177206",
+ "admin_tenant": "service",
+ "member_role": "admin",
+ "tenant_metadata": true,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "MTSNJA3DCP1": {
+ "identity_url": "https://localhost:5000/v2.0",
+ "mso_id": "m93954",
+ "mso_pass": "A1C56E1776686AB1B9B21B0E1B089187",
+ "admin_tenant": "service",
+ "member_role": "admin",
+ "tenant_metadata": true,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "MDCP1": {
+ "identity_url": "http://192.168.27.26:5000/v2.0",
+ "mso_id": "admin",
+ "mso_pass": "43DF28471936B8EFB6BDCF651A2A0785",
+ "admin_tenant": "admin",
+ "member_role": "admin",
+ "tenant_metadata": false,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "ALEXZ": {
+ "identity_url": "http://192.168.125.5:5000/v2.0",
+ "mso_id": "jc",
+ "mso_pass": "5E34F1F7C1A80A101F2BF1F41F629479",
+ "admin_tenant": "jc",
+ "member_role": "admin",
+ "tenant_metadata": false,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "sdcp": {
+ "identity_url": "https://localhost:5000/v2.0",
+ "mso_id": "m96730",
+ "mso_pass": "4B36EA2603159918BDE7800A8A4CEFD2",
+ "admin_tenant": "service",
+ "member_role": "admin",
+ "tenant_metadata": true,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "gdcp1": {
+ "identity_url": "https://localhost:5000/v2.0",
+ "mso_id": "m96730",
+ "mso_pass": "4B36EA2603159918BDE7800A8A4CEFD2",
+ "admin_tenant": "service",
+ "member_role": "admin",
+ "tenant_metadata": true,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "CRAIG1": {
+ "identity_url": "http://192.168.125.102:5000/v2.0",
+ "mso_id": "mso-team",
+ "mso_pass": "34813879BF7DB11F87BEA3862C94D5EE",
+ "admin_tenant": "mso-team",
+ "member_role": "admin",
+ "tenant_metadata": false,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "MTN17": {
+ "identity_url": "https://localhost:5000/v2.0",
+ "mso_id": "m96730",
+ "mso_pass": "4B36EA2603159918BDE7800A8A4CEFD2",
+ "admin_tenant": "admin",
+ "member_role": "admin",
+ "tenant_metadata": true,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "MDT3": {
+ "identity_url": "https://localhost:5000/v2.0",
+ "mso_id": "m93945",
+ "mso_pass": "93937EA01B94A10A49279D4572B48369",
+ "admin_tenant": "admin",
+ "member_role": "admin",
+ "tenant_metadata": true,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "MTN6": {
+ "identity_url": "https://localhost:5000/v2.0",
+ "mso_id": "m93945",
+ "mso_pass": "9E5B5CD92BBC529D12C399B980C8992E",
+ "admin_tenant": "admin",
+ "member_role": "admin",
+ "tenant_metadata": true,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "RDM3": {
+ "identity_url": "https://localhost:5000/v2.0",
+ "mso_id": "m96928",
+ "mso_pass": "7F7FAC9A8AFF10F15FA4C951EE22C72C",
+ "admin_tenant": "admin",
+ "member_role": "admin",
+ "tenant_metadata": true,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "MTN13": {
+ "identity_url": "https://localhost:5000/v2.0",
+ "mso_id": "m93945",
+ "mso_pass": "93937EA01B94A10A49279D4572B48369",
+ "admin_tenant": "admin",
+ "member_role": "admin",
+ "tenant_metadata": true,
+ "identity_server_type": "KEYSTONE",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "ORDM3": {
+ "identity_url": "http://192.168.38.220:8080",
+ "mso_id": "m96928",
+ "mso_pass": "7F7FAC9A8AFF10F15FA4C951EE22C72C",
+ "admin_tenant": "admin",
+ "member_role": "admin",
+ "tenant_metadata": true,
+ "identity_server_type": "ORM",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ },
+ "OMTN6": {
+ "identity_url": "http://192.168.155.143:8080",
+ "mso_id": "m93945",
+ "mso_pass": "93937EA01B94A10A49279D4572B48369",
+ "admin_tenant": "admin",
+ "member_role": "admin",
+ "tenant_metadata": true,
+ "identity_server_type": "ORM",
+ "identity_authentication_type": "USERNAME_PASSWORD"
+ }
+ },
+ "cloud_sites": {
+ "regionOne": {
+ "region_id": "regionOne",
+ "clli": "MT",
+ "aic_version": "2.5",
+ "identity_service_id": "MT_KEYSTONE"
+ },
+ "DAN": {
+ "region_id": "RegionOne",
+ "clli": "DAN",
+ "aic_version": "2.5",
+ "identity_service_id": "DAN_KEYSTONE"
+ },
+ "regionTwo": {
+ "region_id": "regionTwo",
+ "clli": "MTINJVCC101",
+ "aic_version": "2.5",
+ "identity_service_id": "MTINJVCC101_DCP"
+ },
+ "mtsnjlcp1": {
+ "region_id": "mtsnjlcp1",
+ "clli": "MTSNJA4LCP1",
+ "aic_version": "2.5",
+ "identity_service_id": "MTSNJA3DCP1"
+ },
+ "mlcp1": {
+ "region_id": "mlcp1",
+ "clli": "MLCP1",
+ "aic_version": "2.5",
+ "identity_service_id": "MDCP1"
+ },
+ "mlcp2": {
+ "region_id": "mlcp2",
+ "clli": "MLCP2",
+ "aic_version": "2.5",
+ "identity_service_id": "MDCP1"
+ },
+ "ALEXZ": {
+ "region_id": "RegionOne",
+ "clli": "ALEXZ",
+ "aic_version": "2.5",
+ "identity_service_id": "ALEXZ"
+ },
+ "mtn5": {
+ "region_id": "mtn5",
+ "clli": "MDTWNJ21",
+ "aic_version": "2.5",
+ "identity_service_id": "sdcp"
+ },
+ "AAIAIC25": {
+ "region_id": "RegionOne",
+ "clli": "JCRAIG",
+ "aic_version": "3.0",
+ "identity_service_id": "CRAIG1"
+ },
+ "mtn17": {
+ "region_id": "mtn17",
+ "clli": "MTN17",
+ "aic_version": "3.0",
+ "identity_service_id": "MTN17"
+ },
+ "mdt3": {
+ "region_id": "mdt3",
+ "clli": "MDT3",
+ "aic_version": "3.0",
+ "identity_service_id": "MDT3"
+ },
+ "mtn6": {
+ "region_id": "mtn6",
+ "clli": "NJMIDN1",
+ "aic_version": "3.0",
+ "identity_service_id": "MTN6"
+ },
+ "mtn13": {
+ "region_id": "mtn13",
+ "clli": "MDT13",
+ "aic_version": "3.0",
+ "identity_service_id": "MTN13"
+ },
+ "rdm3": {
+ "region_id": "rdm3",
+ "clli": "RDM3",
+ "aic_version": "3.0",
+ "identity_service_id": "ORDM3"
+ },
+ "DEFAULT": {
+ "region_id": "",
+ "clli": "MTN6",
+ "aic_version": "3.0",
+ "identity_service_id": "ORDM3"
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/data.sql b/adapters/mso-openstack-adapters/src/test/resources/data.sql
new file mode 100644
index 0000000000..5fabec6c8a
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/data.sql
@@ -0,0 +1,145 @@
+
+insert into heat_files(artifact_uuid, name, version, description, body, artifact_checksum, creation_timestamp) values
+('00535bdd-0878-4478-b95a-c575c742bfb0', 'nimbus-ethernet-gw', '1', 'created from csar', 'DEVICE=$dev\nBOOTPROTO=none\nNM_CONTROLLED=no\nIPADDR=$ip\nNETMASK=$netmask\nGATEWAY=$gateway\n', 'MANUAL RECORD', '2017-01-21 23:56:43');
+
+
+insert into tosca_csar(artifact_uuid, name, version, description, artifact_checksum, url, creation_timestamp) values
+('0513f839-459d-46b6-aa3d-2edfef89a079', 'service-Ciservicee3756aea561a-csar.csar', '1', 'TOSCA definition package of the asset', 'YTk1MmY2MGVlNzVhYTU4YjgzYjliMjNjMmM3NzU1NDc=', '/sdc/v1/catalog/services/Ciservicee3756aea561a/1.0/artifacts/service-Ciservicee3756aea561a-csar.csar', '2017-11-27 11:38:27');
+
+insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values
+('5df8b6de-2083-11e7-93ae-92361f002671', 'MSOTADevInfra_vSAMP10a_Service', '9647dfc4-2083-11e7-93ae-92361f002671', '1.0', 'MSO aLaCarte Vfmodule with addon', '2017-04-14 13:42:39', '0513f839-459d-46b6-aa3d-2edfef89a079', 'NA', 'NA', 'Luna', 'Oxygen');
+
+insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values
+('5df8b6de-2083-11e7-93ae-92361f002672', 'MSOTADevInfra_vSAMP10a_Service', '9647dfc4-2083-11e7-93ae-92361f002671', '2.0', 'MSO aLaCarte Vfmodule with addon', '2017-04-14 13:42:39', null, 'NA', 'NA', 'Luna', 'Oxygen');
+
+INSERT INTO `heat_template` (`ARTIFACT_UUID`, `NAME`, `VERSION`, `DESCRIPTION`, `BODY`, `TIMEOUT_MINUTES`, `ARTIFACT_CHECKSUM`, `CREATION_TIMESTAMP`) VALUES ('aa874603-4222-11e7-9252-005056850d2e', 'module_mns_zrdm3frwl01exn_01_rgvm_1.yml', '1', 'created from csar', 'heat_template_version: 2013-05-23 description: heat template that creates TEST VNF parameters: TEST_server_name: type: string label: TEST server name description: TEST server name TEST_image_name: type: string label: image name description: TEST image name TEST_flavor_name: type: string label: TEST flavor name description: flavor name of TEST instance TEST_Role_net_name: type: string label: TEST network name description: TEST network name TEST_vnf_id: type: string label: TEST VNF Id description: TEST VNF Id resources:TEST: type: OS::Nova::Server properties: name: { get_param: TEST_server_name } image: { get_param: TEST_image_name } flavor: { get_param: TEST_flavor_name } networks: - port: { get_resource: TEST_port_0} metadata: vnf_id: {get_param: TEST_vnf_id} TEST_port_0: type: OS::Neutron::Port properties: network: { get_param: TEST_Role_net_name }', 60, 'MANUAL RECORD', '2017-01-21 23:26:56');
+INSERT INTO `heat_template` (`ARTIFACT_UUID`, `NAME`, `VERSION`, `DESCRIPTION`, `BODY`, `TIMEOUT_MINUTES`, `ARTIFACT_CHECKSUM`, `CREATION_TIMESTAMP`) VALUES ('ff874603-4222-11e7-9252-005056850d2e', 'module_mns_zrdm3frwl01exn_01_rgvm_1.yml', '1', 'created from csar', 'heat_template_version: 2013-05-23 description: heat template that creates TEST VNF parameters: TEST_server_name: type: string label: TEST server name description: TEST server name TEST_image_name: type: string label: image name description: TEST image name TEST_flavor_name: type: string label: TEST flavor name description: flavor name of TEST instance TEST_Role_net_name: type: string label: TEST network name description: TEST network name TEST_vnf_id: type: string label: TEST VNF Id description: TEST VNF Id resources:TEST: type: OS::Nova::Server properties: name: { get_param: TEST_server_name } image: { get_param: TEST_image_name } flavor: { get_param: TEST_flavor_name } networks: - port: { get_resource: TEST_port_0} metadata: vnf_id: {get_param: TEST_vnf_id} TEST_port_0: type: OS::Neutron::Port properties: network: { get_param: TEST_Role_net_name }', 60, 'MANUAL RECORD', '2017-01-21 23:26:56');
+INSERT INTO `heat_template` (`ARTIFACT_UUID`, `NAME`, `VERSION`, `DESCRIPTION`, `BODY`, `TIMEOUT_MINUTES`, `ARTIFACT_CHECKSUM`, `CREATION_TIMESTAMP`) VALUES ('ff87482f-4222-11e7-9252-005056850d2e', 'module_mns_zrdm3frwl01exn_01_rgvm_1.yml', '1', 'created from csar', 'heat_template_version: 2013-05-23 description: heat template that creates TEST VNF parameters: TEST_server_name: type: string label: TEST server name description: TEST server name TEST_image_name: type: string label: image name description: TEST image name TEST_flavor_name: type: string label: TEST flavor name description: flavor name of TEST instance TEST_Role_net_name: type: string label: TEST network name description: TEST network name TEST_vnf_id: type: string label: TEST VNF Id description: TEST VNF Id resources:TEST: type: OS::Nova::Server properties: name: { get_param: TEST_server_name } image: { get_param: TEST_image_name } flavor: { get_param: TEST_flavor_name } networks: - port: { get_resource: TEST_port_0} metadata: vnf_id: {get_param: TEST_vnf_id} TEST_port_0: type: OS::Neutron::Port properties: network: { get_param: TEST_Role_net_name }', 60, 'MANUAL RECORD', '2017-01-21 23:26:56');
+
+
+insert into heat_template_params(heat_template_artifact_uuid, param_name, is_required, param_type, param_alias) values
+('ff874603-4222-11e7-9252-005056850d2e', 'availability_zone_0', 1, 'string', ''),
+('ff874603-4222-11e7-9252-005056850d2e', 'exn_direct_net_fqdn',1, 'string', ''),
+('ff874603-4222-11e7-9252-005056850d2e', 'exn_hsl_net_fqdn', 1, 'string', '');
+
+insert into heat_environment(artifact_uuid, name, version, description, body, artifact_checksum, creation_timestamp) values
+('fefb1601-4222-11e7-9252-005056850d2e', 'module_nso.env', '2', 'Auto-generated HEAT Environment deployment artifact', 'parameters:\n availability_zone_0: \"alln-zone-1\"\n nso_flavor_name: \"citeis.1vCPUx2GB\"\n nso_image_name: \"RHEL-6.8-BASE-20160912\"\n nso_name_0: \"zrdm3vamp01nso001\"\n nso_oam_ip_0: \"172.18.25.175\"\n nso_oam_net_gw: \"172.18.25.1\"\n nso_oam_net_mask: \"255.255.255.0\"\n nso_sec_grp_id: \"36f48d82-f099-4437-bfbc-70d9e5d420d1\"\n nso_srv_grp_id: \"e431c477-5bd1-476a-bfa9-e4ce16b8356b\"\n oam_net_id: \"nso_oam\"\n vf_module_id: \"145cd730797234b4a40aa99335abc143\"\n vnf_id: \"730797234b4a40aa99335157b02871cd\"\n vnf_name: \"Mobisupport\"\n', 'MWI2ODY0Yjc1NDJjNWU1NjdkMTAyMjVkNzFmZDU0MzA=', '2017-11-27 08:42:58'),
+('fefb1751-4333-11e7-9252-005056850d2e', 'module_nso.env', '2', 'Auto-generated HEAT Environment deployment artifact', 'parameters:\n availability_zone_0: \"alln-zone-1\"\n nso_flavor_name: \"citeis.1vCPUx2GB\"\n nso_image_name: \"RHEL-6.8-BASE-20160912\"\n nso_name_0: \"zrdm3vamp01nso001\"\n nso_oam_ip_0: \"172.18.25.175\"\n nso_oam_net_gw: \"172.18.25.1\"\n nso_oam_net_mask: \"255.255.255.0\"\n nso_sec_grp_id: \"36f48d82-f099-4437-bfbc-70d9e5d420d1\"\n nso_srv_grp_id: \"e431c477-5bd1-476a-bfa9-e4ce16b8356b\"\n oam_net_id: \"nso_oam\"\n vf_module_id: \"145cd730797234b4a40aa99335abc143\"\n vnf_id: \"730797234b4a40aa99335157b02871cd\"\n vnf_name: \"Mobisupport\"\n', 'MWI2ODY0Yjc1NDJjNWU1NjdkMTAyMjVkNzFmZDU0MzA=', '2017-11-27 08:42:58');
+
+insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values
+('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002671', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '1.0', 'vSAMP10a', 'VF', null);
+
+insert into vnf_resource_customization(model_customization_uuid, model_instance_name, min_instances, max_instances, availability_zone_max_count, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, vnf_resource_model_uuid, multi_stage_design) values
+('68dc9a92-214c-11e7-93ae-92361f002671', 'vSAMP10a 1', '0', '0', '0', 'vSAMP', 'vSAMP', 'vSAMP', 'vSAMP', '2017-05-26 15:08:24', 'ff2ae348-214a-11e7-93ae-92361f002671', null);
+
+
+insert into vf_module(model_uuid, model_invariant_uuid, model_version, model_name, description, is_base, heat_template_artifact_uuid, vol_heat_template_artifact_uuid, creation_timestamp, vnf_resource_model_uuid) values
+
+('20c4431c-246d-11e7-93ae-92361f002671', '78ca26d0-246d-11e7-93ae-92361f002671', '2', 'vSAMP10aDEV::base::module-0', 'vSAMP10a DEV Base', '1', 'ff874603-4222-11e7-9252-005056850d2e', null, '2016-09-14 18:19:56', 'ff2ae348-214a-11e7-93ae-92361f002671'),
+('066de97e-253e-11e7-93ae-92361f002671', '64efd51a-2544-11e7-93ae-92361f002671', '2', 'vSAMP10aDEV::PCM::module-1', 'vSAMP10a DEV PCM', '0', 'ff87482f-4222-11e7-9252-005056850d2e', null, '2016-09-14 18:19:56', 'ff2ae348-214a-11e7-93ae-92361f002671');
+
+insert into vf_module_customization(model_customization_uuid, label, initial_count, min_instances, max_instances, availability_zone_count, heat_environment_artifact_uuid, vol_environment_artifact_uuid, creation_timestamp, vf_module_model_uuid) values
+('cb82ffd8-252a-11e7-93ae-92361f002671', 'base', '1', '0', '0', '0', 'fefb1601-4222-11e7-9252-005056850d2e', null, '2017-05-26 15:08:23', '20c4431c-246d-11e7-93ae-92361f002671'),
+('b4ea86b4-253f-11e7-93ae-92361f002671', 'PCM', '0', '0', '0', '0', 'fefb1751-4333-11e7-9252-005056850d2e', null, '2017-05-26 15:08:23', '066de97e-253e-11e7-93ae-92361f002671');
+
+
+insert into vnf_res_custom_to_vf_module_custom(vnf_resource_cust_model_customization_uuid, vf_module_cust_model_customization_uuid, creation_timestamp) values
+('68dc9a92-214c-11e7-93ae-92361f002671', 'cb82ffd8-252a-11e7-93ae-92361f002671', '2017-05-26 15:08:24'),
+('68dc9a92-214c-11e7-93ae-92361f002671', 'b4ea86b4-253f-11e7-93ae-92361f002671', '2017-05-26 15:08:24');
+
+insert into allotted_resource(model_uuid, model_invariant_uuid, model_version, model_name, tosca_node_type, subcategory, description, creation_timestamp) values
+('f6b7d4c6-e8a4-46e2-81bc-31cad5072842', 'b7a1b78e-6b6b-4b36-9698-8c9530da14af', '1.0', 'Tunnel_Xconn', '', '', '', '2017-05-26 15:08:24');
+
+insert into allotted_resource_customization(model_customization_uuid, model_instance_name, providing_service_model_invariant_uuid, target_network_role, nf_type, nf_role, nf_function, nf_naming_code, min_instances, max_instances, ar_model_uuid, creation_timestamp) values
+('367a8ba9-057a-4506-b106-fbae818597c6', 'Sec_Tunnel_Xconn 11', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'f6b7d4c6-e8a4-46e2-81bc-31cad5072842', TIMESTAMP '2017-01-20 16:14:20.0');
+
+
+insert into temp_network_heat_template_lookup(network_resource_model_name, heat_template_artifact_uuid, aic_version_min, aic_version_max) values
+('CONTRAIL30_GNDIRECT', 'ff874603-4222-11e7-9252-005056850d2e', '3', '3'),
+('CONTRAIL30_BASIC', 'ff874603-4222-11e7-9252-005056850d2e', '3', '3'),
+('CONTRAIL31_BASIC', 'ff874603-4222-11e7-9252-005056850d2e', '3', '3'),
+('CONTRAIL31_GNDIRECT', 'ff874603-4222-11e7-9252-005056850d2e', '3', '3');
+
+insert into network_resource(model_uuid, model_name, model_invariant_uuid, description, heat_template_artifact_uuid, neutron_network_type, model_version, tosca_node_type, aic_version_min, aic_version_max, orchestration_mode, creation_timestamp) values
+('10b36f65-f4e6-4be6-ae49-9596dc1c47fc', 'CONTRAIL30_GNDIRECT', 'ce4ff476-9641-4e60-b4d5-b4abbec1271d', 'Contrail 30 GNDIRECT NW', 'aa874603-4222-11e7-9252-005056850d2e', 'BASIC', '1.0', '', '3.0', '', 'HEAT', '2017-01-17 20:35:05'),
+('10b36f65-f4e6-4be6-ae49-9596dc1c47fd', 'CONTRAIL31_GNDIRECT', 'ce4ff476-9641-4e60-b4d5-b4abbec1271d', 'Contrail 31 GNDIRECT NW', 'aa874603-4222-11e7-9252-005056850d2e', 'PROVIDER', '1.0', '', '3.0', '', 'NEUTRON', '2017-01-17 20:35:05'),
+('10b36f65-f4e6-4be6-ae49-9596dc1c4789', 'CONTRAIL30_BASIC', 'ce4ff476-9641-4e60-b4d5-b4abbec1271d', 'Contrail 30 GNDIRECT NW', 'aa874603-4222-11e7-9252-005056850d2e', 'BASIC', '1.0', '', '3.0', '', 'HEAT', '2017-01-17 20:35:05'),
+('10b36f65-f4e6-4be6-ae49-9596dc1c4790', 'CONTRAIL31_BASIC', 'ce4ff476-9641-4e60-b4d5-b4abbec1271d', 'Contrail 30 GNDIRECT NW', 'aa874603-4222-11e7-9252-005056850d2e', 'BASIC', '2.0', '', '3.0', '', 'HEAT', '2017-01-17 20:35:05');
+
+insert into network_resource_customization(model_customization_uuid, model_instance_name, network_technology, network_type, network_role, network_scope, creation_timestamp, network_resource_model_uuid) values
+('3bdbb104-476c-483e-9f8b-c095b3d308ac', 'CONTRAIL30_GNDIRECT 9', '', '', '', '', '2017-04-19 14:28:32', '10b36f65-f4e6-4be6-ae49-9596dc1c47fc'),
+('3bdbb104-476c-483e-9f8b-c095b3d30844', 'CONTRAIL30_BASIC', '', 'CONTRAIL30_BASIC', '', '', '2017-04-19 14:28:32', '10b36f65-f4e6-4be6-ae49-9596dc1c4789'),
+('3bdbb104-476c-483e-9f8b-c095b3d3068c', 'CONTRAIL31_BASIC', '', 'CONTRAIL31_BASIC', '', '', '2017-04-19 14:28:32', '10b36f65-f4e6-4be6-ae49-9596dc1c4790');
+
+insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values
+('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002672', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '2.0', 'vSAMP10a', 'VF', null);
+
+insert into vnf_resource_customization(model_customization_uuid, model_instance_name, min_instances, max_instances, availability_zone_max_count, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, vnf_resource_model_uuid, multi_stage_design) values
+('68dc9a92-214c-11e7-93ae-92361f002672', 'vSAMP10a 2', '0', '0', '0', 'vSAMP', 'vSAMP', 'vSAMP', 'vSAMP', '2017-05-26 15:08:24', 'ff2ae348-214a-11e7-93ae-92361f002672', null);
+
+insert into vf_module(model_uuid, model_invariant_uuid, model_version, model_name, description, is_base, heat_template_artifact_uuid, vol_heat_template_artifact_uuid, creation_timestamp, vnf_resource_model_uuid) values
+
+('20c4431c-246d-11e7-93ae-92361f002672', '78ca26d0-246d-11e7-93ae-92361f002671', '2', 'vSAMP10aDEV::base::module-0', 'vSAMP10a DEV Base', '1', 'ff874603-4222-11e7-9252-005056850d2e', null, '2016-09-14 18:19:56', 'ff2ae348-214a-11e7-93ae-92361f002671'),
+('066de97e-253e-11e7-93ae-92361f002672', '64efd51a-2544-11e7-93ae-92361f002671', '2', 'vSAMP10aDEV::PCM::module-1', 'vSAMP10a DEV PCM', '0', 'ff87482f-4222-11e7-9252-005056850d2e', null, '2016-09-14 18:19:56', 'ff2ae348-214a-11e7-93ae-92361f002671');
+
+insert into vf_module_customization(model_customization_uuid, label, initial_count, min_instances, max_instances, availability_zone_count, heat_environment_artifact_uuid, vol_environment_artifact_uuid, creation_timestamp, vf_module_model_uuid) values
+('cb82ffd8-252a-11e7-93ae-92361f002672', 'base', '1', '0', '0', '0', 'fefb1601-4222-11e7-9252-005056850d2e', null, '2017-05-26 15:08:23', '20c4431c-246d-11e7-93ae-92361f002672'),
+('b4ea86b4-253f-11e7-93ae-92361f002672', 'PCM', '0', '0', '0', '0', 'fefb1751-4333-11e7-9252-005056850d2e', null, '2017-05-26 15:08:23', '066de97e-253e-11e7-93ae-92361f002672');
+
+
+insert into vnf_res_custom_to_vf_module_custom(vnf_resource_cust_model_customization_uuid, vf_module_cust_model_customization_uuid, creation_timestamp) values
+('68dc9a92-214c-11e7-93ae-92361f002672', 'cb82ffd8-252a-11e7-93ae-92361f002672', '2017-05-26 15:08:24'),
+('68dc9a92-214c-11e7-93ae-92361f002672', 'b4ea86b4-253f-11e7-93ae-92361f002672', '2017-05-26 15:08:24');
+
+
+insert into vf_module_to_heat_files(vf_module_model_uuid, heat_files_artifact_uuid) values
+('20c4431c-246d-11e7-93ae-92361f002671', '00535bdd-0878-4478-b95a-c575c742bfb0'),
+('066de97e-253e-11e7-93ae-92361f002671', '00535bdd-0878-4478-b95a-c575c742bfb0');
+
+
+insert into network_resource_customization_to_service(service_model_uuid, resource_model_customization_uuid) values
+('5df8b6de-2083-11e7-93ae-92361f002671', '3bdbb104-476c-483e-9f8b-c095b3d308ac'),
+('5df8b6de-2083-11e7-93ae-92361f002672', '3bdbb104-476c-483e-9f8b-c095b3d308ac');
+
+
+insert into vnf_resource_customization_to_service(service_model_uuid, resource_model_customization_uuid) values
+('5df8b6de-2083-11e7-93ae-92361f002671', '68dc9a92-214c-11e7-93ae-92361f002671'),
+('5df8b6de-2083-11e7-93ae-92361f002672', '68dc9a92-214c-11e7-93ae-92361f002672');
+
+insert into allotted_resource_customization_to_service(service_model_uuid, resource_model_customization_uuid) values
+('5df8b6de-2083-11e7-93ae-92361f002671', '367a8ba9-057a-4506-b106-fbae818597c6' ),
+('5df8b6de-2083-11e7-93ae-92361f002672', '367a8ba9-057a-4506-b106-fbae818597c6');
+
+
+ INSERT INTO `vnf_resource` (`ORCHESTRATION_MODE`, `DESCRIPTION`, `CREATION_TIMESTAMP`, `MODEL_UUID`, `AIC_VERSION_MIN`, `AIC_VERSION_MAX`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `MODEL_NAME`, `TOSCA_NODE_TYPE`, `HEAT_TEMPLATE_ARTIFACT_UUID`, `resource_category`, `resource_sub_category`)
+ VALUES ('HEAT', '0513_vsp_Lital', '2018-05-13 12:12:09', 'c5efeb55-4ade-49b8-815c-6a6391f6c46b', NULL, NULL, 'cc6f0156-dad5-4ea3-949e-74473742baf2', '2.0', '0513_vsp_Lital1', 'org.openecomp.resource.vf.0513VspLital1', NULL, NULL, NULL);
+
+INSERT INTO `heat_template` (`ARTIFACT_UUID`, `NAME`, `VERSION`, `DESCRIPTION`, `BODY`, `TIMEOUT_MINUTES`, `ARTIFACT_CHECKSUM`, `CREATION_TIMESTAMP`) VALUES ('d187c228-71c6-4c6d-8f33-cd1243442d0a', 'base_vmme.yml', '2', 'created from csar', 'heat_template_version: 2015-04-30\n\ndescription: >\n Base HOT template to create vmme 2 fsb 2 ncb\n\nparameters:\n vnf_name:\n type: string\n description: Unique name of this VNF instance\n domain_name:\n type: string\n description: Unique name of vMME contrail domain\n vf_module_id:\n type: string\n description: the vf_module_id for this instance. UUID provided by ECOMP\n vnf_id:\n type: string\n description: the vf_id for this instance. UUID provided by ECOMP\n fsb_volume_id_0:\n type: string\n description: ID of Ubuntu Cinder Volume for FSB1\n fsb_volume_id_1:\n type: string\n description: ID of Ubuntu Cinder Volume for FSB2\n fsb_oam_ip_0:\n type: string\n description: IP address of OAM vNIC for FSB1\n fsb_oam_ip_1:\n type: string\n description: IP address of OAM vNIC for FSB2\n fsb_name_0:\n type: string\n description: Name of fsb1\n fsb_name_1:\n type: string\n description: Name of fsb1\n ncb_name_0:\n type: string\n description: Name of ncb1\n ncb_name_1:\n type: string\n description: Name of ncb2\n availability_zone_0:\n type: string\n description: cluster for spawnning fsb instances\n availability_zone_1:\n type: string\n description: cluster for spawnning ncb instances\n availability_zone_2:\n type: string\n description: cluster for spawnning vlc instances\n availability_zone_3:\n type: string\n description: cluster for spawnning gpb instances\n fsb_flavor_name:\n type: string\n description: Flavor to use for servers fsb1\n oam_net_fqdn:\n type: string\n description: FQDN for OAM network\n gtp_net_fqdn:\n type: string\n description: FQDN for GTP network\n sctp_a_net_fqdn:\n type: string\n description: FQDN for SCTPA network\n sctp_b_net_fqdn:\n type: string\n description: FQDN for SCTPB network\n fsb1_Internal1_mac:\n type: string\n description: static mac address assigned to fsb1_Internal1\n fsb1_Internal2_mac:\n type: string\n description: static mac address assigned to fsb1_Internal2\n fsb2_Internal1_mac:\n type: string\n description: static mac address assigned to fsb2_Internal1\n fsb2_Internal2_mac:\n type: string\n description: static mac address assigned to fsb2_Internal2\n pxe_image_name:\n type: string\n description: Name of image to use for server ncb\n ncb_flavor_name:\n type: string\n description: Flavor to use for servers ncb\n ncb1_Internal1_mac:\n type: string\n description: static mac address assigned to ncb1_Internal1\n ncb1_Internal2_mac:\n type: string\n description: static mac address assigned to ncb1_Internal2\n ncb2_Internal1_mac:\n type: string\n description: static mac address assigned to ncb2_Internal1\n ncb2_Internal2_mac:\n type: string\n description: static mac address assigned to ncb2_Internal2\n oam_net_name:\n type: string\n description: name of oam network\n gtp_net_name:\n type: string\n description: name of GTP network\n sctp_a_net_name:\n type: string\n description: name of SCTPA network\n sctp_b_net_name:\n type: string\n description: name of SCTPB network\n Internal1_net_cidr: \n type: string\n description: CIDR for internal-1 network\n Internal1_net_cidr_len: \n type: string\n description: CIDR length for internal-1 network\n Internal1_net_gateway:\n type: string\n description: gateway for internal-1 network\n Internal1_allow_transit:\n type: string\n description: Allow/disallow transit internal-1 network\n Internal1_forwarding_mode:\n type: string\n description: L2 or L3 forwarding mode for internal-1 network\n Internal1_shared: \n type: string\n description: Whether Shared or private internal-1 network\n Internal1_dhcp: \n type: string\n description: Whether DHCP/static IP addressing on internal-1 network\n Internal1_rpf:\n type: string \n description: Reverse Path Forwarding Enabled/Disabled internal-1 network\n Internal2_net_cidr:\n type: string\n description: CIDR for internal-2 network\n Internal2_net_cidr_len:\n type: string\n description: CIDR length for internal-2 network\n Internal2_net_gateway:\n type: string\n description: gateway for internal-2 network\n Internal2_allow_transit:\n type: string\n description: Allow/disallow transit internal-2 network\n Internal2_forwarding_mode:\n type: string\n description: L2 or L3 forwarding mode for internal-2 network\n Internal2_shared:\n type: string\n description: Whether Shared or private internal-2 network\n Internal2_dhcp:\n type: string\n description: Whether DHCP/static IP addressing on internal-2 network\n Internal2_rpf:\n type: string\n description: Reverse Path Forwarding Enabled/Disabled internal-2 network\n vlc_st_version:\n type: string\n description: Indicates service version\n vlc_st_service_mode:\n type: string\n description: service mode\n vlc_st_service_type:\n type: string\n description: service type\n vlc_st_interface_type_oam:\n type: string\n description: service_interface_type for the ServiceTemplate\n vlc_st_interface_type_sctp_a:\n type: string\n description: service_interface_type for the ServiceTemplate\n vlc_st_interface_type_sctp_b:\n type: string\n description: service_interface_type for the ServiceTemplate\n vlc_st_interface_type_gtp:\n type: string\n description: service_interface_type for the ServiceTemplate\n vlc_st_interface_type_int1:\n type: string \n description: service_interface_type for the ServiceTemplate\n vlc_st_interface_type_int2:\n type: string\n description: service_interface_type for the ServiceTemplate\n vlc_st_availability_zone:\n type: string\n description: Indicates availability zone is enabled\n vlc_st_virtualization_type:\n type: string\n description: Indicates virtualization type\n\n# Interface Static Prefix\n vlc_sctp_a_route_prefixes: \n type: json\n description: Route prefixes for static routing on SCTPA\n vlc_sctp_b_route_prefixes:\n type: json\n description: Route prefixes for static routing on SCTPB\n vlc_gtp_route_prefixes: \n type: json\n description: Route prefixes for static routing on GTP\n vlc_oam_route_prefixes:\n type: json\n description: Route prefixes for static routing on OAM\n\n# Security Groups\n gtp_sec_group_name:\n type: string\n description: SecurityGroup name for GTP\n int1_sec_group_name:\n type: string\n description: SecurityGroup name for internal-1\n int2_sec_group_name:\n type: string\n description: SecurityGroup name for internal-2\n oam_sec_group_name:\n type: string\n description: SecurityGroup name for OAM\n sctp-a-ingress_rule_protocol:\n type: string\n description: protocol for the SecurityGroup\n sctp_rule_protocol:\n type: string\n description: protocol for the SecurityGroup\n sctp-a-ingress-src_start_port:\n type: number\n description: start_port for the SecurityGroup\n sctp-a-ingress-src_end_port:\n type: number\n description: end_port for the SecurityGroup\n sctp-a-ingress_rule_application:\n type: string\n description: application for the SecurityGroup\n sctp-a-ingress-dst_start_port:\n type: number\n description: start_port for the SecurityGroup\n sctp-a-ingress-dst_end_port:\n type: number\n description: end_port for the SecurityGroup\n sctp-a-ingress_ethertype:\n type: string\n description: ethertype for the SecurityGroup\n sctp-a-ingress_dst_addresses:\n type: string\n description: security_group for the SecurityGroup\n sctp-a-ingress-src_subnet_prefix:\n type: string\n description: ip_prefix for the SecurityGroup\n sctp-a-src_subnet_prefix_v6:\n type: string\n description: ip_prefix for the SecurityGroup\n sctp-a-ingress-src_subnet_prefix_len:\n type: number\n description: ip_prefix_len for the SecurityGroup\n sctp-a-ingress_action:\n type: string\n description: simple_action for the SecurityGroup\n\n# sctp-a-egress Rule\n\n sctp-a-egress_rule_protocol:\n type: string\n description: protocol for the SecurityGroup\n sctp-a-egress-src_start_port:\n type: number\n description: start_port for the SecurityGroup\n sctp-a-egress-src_end_port:\n type: number\n description: end_port for the SecurityGroup\n sctp-a-egress_rule_application:\n type: string\n description: application for the SecurityGroup\n sctp-a-egress-dst_start_port:\n type: number\n description: start_port for the SecurityGroup\n sctp-a-egress-dst_end_port:\n type: number\n description: end_port for the SecurityGroup\n sctp-a-egress_dst_subnet_prefix:\n type: string\n description: ip_prefix for the SecurityGroup\n sctp-a-dst_subnet_prefix_v6:\n type: string\n description: ip_prefix for the SecurityGroup\n sctp-a-egress_dst_subnet_prefix_len:\n type: number\n description: ip_prefix_len for the SecurityGroup\n sctp-a-egress_ethertype:\n type: string\n description: ethertype for the SecurityGroup\n sctp-a-egress_src_addresses:\n type: string\n description: security_group for the SecurityGroup\n sctp-a-egress_action:\n type: string\n description: simple_action for the SecurityGroup\n# IPv6 Rule\n sctp-a-ipv6-ingress_rule_protocol:\n type: string\n description: IPV6 Rule-protocol\n sctp-a-ipv6-ingress_rule_application:\n type: string\n description: IPV6 Rule-application\n sctp-a-ipv6-ingress-dst_start_port:\n type: string \n description: IPV6 starting port for destination\n sctp-a-ipv6-ingress_ethertype:\n type: string\n description: IPV6 ethertype\n sctp-a-ipv6-ingress_dst_addresses:\n type: string\n description: IPV6 destination\n sctp-a-ipv6-ingress_action: \n type: string\n description: IPV6 action \n sctp-a-ipv6-egress_rule_protocol:\n type: string\n description: IPV6 Rule-protocol\n sctp-a-ipv6-ingress-src_start_port: \n type: number\n description: IPV6 start port\n sctp-a-ipv6-ingress-src_end_port:\n type: number\n description: IPV6 ending port for destination\n sctp-a-ipv6-egress_rule_application:\n type: string\n description: IPV6 Rule-application\n sctp-a-ipv6-egress_dst_subnet_prefix:\n type: string\n description: IPV6 subnet prefix\n sctp-a-ipv6-egress_dst_subnet_prefix_len:\n type: string\n description: IPV6 subnet prefix\n sctp-a-ipv6-egress_ethertype:\n type: string\n description: IPV6 ethertype\n sctp-a-ipv6-egress_src_addresses:\n type: string\n description: IPV6 source\n sctp-a-ipv6-egress_action:\n type: string\n description: IPV6 action \n# sctp-a-dst_subnet_prefix_v6:\n# type: string\n# description: IPV6 subnet prefix\n sctp-a-ipv6-egress_src_start_port:\n type: string\n description: IPV6 subnet prefix\n sctp-a-ipv6-ingress_src_subnet_prefix_len: \n type: string\n description: IPV6 subnet prefix length\n sctp-a-IPv6_ethertype:\n type: string\n description: IPV6 ethertype\n sctp-a-ipv6-egress_src_end_port:\n type: string\n description: IPV6 end port\n sctp-a-ipv6-ingress-dst_end_port: \n type: string\n description: IPV6 end port\n sctp-a-ipv6-ingress_src_subnet_prefix:\n type: string\n description: IPV6 subnet prefix\n sctp-a-ipv6-egress_dst_end_port:\n type: string\n description: IPV6 end port\n sctp-a-ipv6-egress-dst_start_port:\n type: string\n description: IPV6 start port\n# Ingress Rule\n\n sctp-b-ingress_rule_protocol:\n type: string\n description: protocol for the SecurityGroup\n# sctp_rule_protocol:\n# type: string\n# description: protocol for the SecurityGroup\n sctp-b-ingress-src_start_port:\n type: number\n description: start_port for the SecurityGroup\n sctp-b-ingress-src_end_port:\n type: number\n description: end_port for the SecurityGroup\n sctp-b-ingress_rule_application:\n type: string\n description: application for the SecurityGroup\n sctp-b-ingress-dst_start_port:\n type: number\n description: start_port for the SecurityGroup\n sctp-b-ingress-dst_end_port:\n type: number\n description: end_port for the SecurityGroup\n sctp-b-ingress_ethertype:\n type: string\n description: ethertype for the SecurityGroup\n sctp-b-ingress_dst_addresses:\n type: string\n description: security_group for the SecurityGroup\n sctp-b-ingress-src_subnet_prefix:\n type: string\n description: ip_prefix for the SecurityGroup\n sctp-b-src_subnet_prefix_v6:\n type: string\n description: ip_prefix for the SecurityGroup\n sctp-b-ingress-src_subnet_prefix_len:\n type: number\n description: ip_prefix_len for the SecurityGroup\n sctp-b-ingress_action:\n type: string\n description: simple_action for the SecurityGroup\n\n# sctp-b-egress Rule\n\n sctp-b-egress_rule_protocol:\n type: string\n description: protocol for the SecurityGroup\n sctp-b-egress-src_start_port:\n type: number\n description: start_port for the SecurityGroup\n sctp-b-egress-src_end_port:\n type: number\n description: end_port for the SecurityGroup\n sctp-b-egress_rule_application:\n type: string\n description: application for the SecurityGroup\n sctp-b-egress-dst_start_port:\n type: number\n description: start_port for the SecurityGroup\n sctp-b-egress-dst_end_port:\n type: number\n description: end_port for the SecurityGroup\n sctp-b-egress_dst_subnet_prefix:\n type: string\n description: ip_prefix for the SecurityGroup\n sctp-b-dst_subnet_prefix_v6:\n type: string\n description: ip_prefix for the SecurityGroup\n sctp-b-egress_dst_subnet_prefix_len:\n type: number\n description: ip_prefix_len for the SecurityGroup\n sctp-b-egress_ethertype:\n type: string\n description: ethertype for the SecurityGroup\n sctp-b-egress_src_addresses:\n type: string\n description: security_group for the SecurityGroup\n sctp-b-egress_action:\n type: string\n description: simple_action for the SecurityGroup\n# IPv6 Rule\n sctp-b-ipv6-ingress_rule_protocol:\n type: string\n description: IPV6 Rule-protocol\n sctp-b-ipv6-ingress_rule_application:\n type: string\n description: IPV6 Rule-application\n sctp-b-ipv6-ingress-dst_start_port:\n type: string \n description: IPV6 starting port for destination\n sctp-b-ipv6-ingress_ethertype:\n type: string\n description: IPV6 ethertype\n sctp-b-ipv6-ingress_dst_addresses:\n type: string\n description: IPV6 destination\n sctp-b-ipv6-ingress_action: \n type: string\n description: IPV6 action \n sctp-b-ipv6-egress_rule_protocol:\n type: string\n description: IPV6 Rule-protocol\n sctp-b-ipv6-ingress-src_start_port: \n type: number\n description: IPV6 start port\n sctp-b-ipv6-ingress-src_end_port:\n type: number\n description: IPV6 ending port for destination\n sctp-b-ipv6-egress_rule_application:\n type: string\n description: IPV6 Rule-application\n sctp-b-ipv6-egress_dst_subnet_prefix:\n type: string\n description: IPV6 subnet prefix\n sctp-b-ipv6-egress_dst_subnet_prefix_len:\n type: string\n description: IPV6 subnet prefix\n sctp-b-ipv6-egress_ethertype:\n type: string\n description: IPV6 ethertype\n sctp-b-ipv6-egress_src_addresses:\n type: string\n description: IPV6 source\n sctp-b-ipv6-egress_action:\n type: string\n description: IPV6 action \n# sctp-b-dst_subnet_prefix_v6:\n# type: string\n# description: IPV6 subnet prefix\n sctp-b-ipv6-egress_src_start_port:\n type: string\n description: IPV6 subnet prefix\n sctp-b-ipv6-ingress_src_subnet_prefix_len: \n type: string\n description: IPV6 subnet prefix length\n sctp-b-IPv6_ethertype:\n type: string\n description: IPV6 ethertype\n sctp-b-ipv6-egress_src_end_port:\n type: string\n description: IPV6 end port\n sctp-b-ipv6-ingress-dst_end_port: \n type: string\n description: IPV6 end port\n sctp-b-ipv6-ingress_src_subnet_prefix:\n type: string\n description: IPV6 subnet prefix\n sctp-b-ipv6-egress_dst_end_port:\n type: string\n description: IPV6 end port\n sctp-b-ipv6-egress-dst_start_port:\n type: string\n description: IPV6 start port\n sctp-b-name:\n type: string\n description: name for the SecurityGroup\n sctp-b-display_name:\n type: string\n description: display_name for the SecurityGroup\n sctp-a-name:\n type: string\n description: name for the SecurityGroup\n sctp-a-display_name:\n type: string\n description: display_name for the SecurityGroup\n \n\nresources:\n \n\n# VM_Affinity:\n# type: OS::Nova::ServerGroup\n# properties:\n# policies: ["anti-affinity"]\n\n# Security Groups\n gtp_security_group:\n type: OS::Neutron::SecurityGroup\n properties:\n name:\n str_replace:\n template: $VNF_NAME_$SECGROUPNAME\n params: \n $VNF_NAME: {get_param: vnf_name}\n $SECGROUPNAME: {get_param: gtp_sec_group_name}\n rules: \n - {"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": egress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": ingress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}\n\n oam_security_group:\n type: OS::Neutron::SecurityGroup\n properties:\n name:\n str_replace:\n template: $VNF_NAME_$SECGROUPNAME\n params: \n $VNF_NAME: {get_param: vnf_name}\n $SECGROUPNAME: {get_param: oam_sec_group_name}\n rules: \n - {"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": egress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": ingress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}\n\n int1_sec_group:\n type: OS::Neutron::SecurityGroup\n properties:\n name:\n str_replace:\n template: $VNF_NAME_$SECGROUPNAME\n params: \n $VNF_NAME: {get_param: vnf_name}\n $SECGROUPNAME: {get_param: int1_sec_group_name}\n rules: \n - {"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": egress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": ingress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}\n\n int2_sec_group:\n type: OS::Neutron::SecurityGroup\n properties:\n name:\n str_replace:\n template: $VNF_NAME_$SECGROUPNAME\n params: \n $VNF_NAME: {get_param: vnf_name}\n $SECGROUPNAME: {get_param: int2_sec_group_name}\n rules: \n - {"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": egress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}\n - {"direction": ingress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}\n\n SCTP_A_SecurityGroup:\n type: OS::ContrailV2::SecurityGroup\n properties:\n name:\n str_replace:\n template: $VNF_NAME_$SECGROUPNAME\n params: \n $VNF_NAME: {get_param: vnf_name}\n $SECGROUPNAME: {get_param: sctp-a-name}\n display_name:\n str_replace:\n template: $VNF_NAME_$SECGROUPNAME\n params: \n $VNF_NAME: {get_param: vnf_name}\n $SECGROUPNAME: {get_param: sctp-a-display_name}\n security_group_entries:\n {\n security_group_entries_policy_rule:\n [{\n security_group_entries_policy_rule_protocol: { get_param: sctp-a-ingress_rule_protocol },\n security_group_entries_policy_rule_src_addresses:\n [{\n security_group_entries_policy_rule_src_addresses_subnet:\n {\n security_group_entries_policy_rule_src_addresses_subnet_ip_prefix: { get_param: sctp-a-ingress-src_subnet_prefix },\n security_group_entries_policy_rule_src_addresses_subnet_ip_prefix_len: { get_param: sctp-a-ingress-src_subnet_prefix_len },\n },\n }],\n security_group_entries_policy_rule_src_ports:\n [{\n security_group_entries_policy_rule_src_ports_start_port: { get_param: sctp-a-ingress-src_start_port },\n security_group_entries_policy_rule_src_ports_end_port: { get_param: sctp-a-ingress-src_end_port },\n }],\n security_group_entries_policy_rule_application: [{ get_param: sctp-a-ingress_rule_application }],\n security_group_entries_policy_rule_dst_addresses:\n [{\n security_group_entries_policy_rule_dst_addresses_security_group: { get_param: sctp-a-ingress_dst_addresses },\n }],\n security_group_entries_policy_rule_dst_ports:\n [{\n security_group_entries_policy_rule_dst_ports_start_port: { get_param: sctp-a-ingress-dst_start_port },\n security_group_entries_policy_rule_dst_ports_end_port: { get_param: sctp-a-ingress-dst_end_port },\n }],\n security_group_entries_policy_rule_action_list:\n {\n security_group_entries_policy_rule_action_list_simple_action: { get_param: sctp-a-ingress_action },\n },\n security_group_entries_policy_rule_ethertype: { get_param: sctp-a-ingress_ethertype },\n },\n {\n security_group_entries_policy_rule_protocol: { get_param: sctp-a-egress_rule_protocol },\n security_group_entries_policy_rule_src_addresses:\n [{\n security_group_entries_policy_rule_src_addresses_security_group: { get_param: sctp-a-egress_src_addresses },\n }],\n security_group_entries_policy_rule_src_ports:\n [{\n security_group_entries_policy_rule_src_ports_start_port: { get_param: sctp-a-egress-src_start_port },\n security_group_entries_policy_rule_src_ports_end_port: { get_param: sctp-a-egress-src_end_port },\n }],\n security_group_entries_policy_rule_application: [{ get_param: sctp-a-egress_rule_application }],\n security_group_entries_policy_rule_dst_addresses:\n [{\n security_group_entries_policy_rule_dst_addresses_subnet:\n {\n security_group_entries_policy_rule_dst_addresses_subnet_ip_prefix: { get_param: sctp-a-egress_dst_subnet_prefix },\n security_group_entries_policy_rule_dst_addresses_subnet_ip_prefix_len: { get_param: sctp-a-egress_dst_subnet_prefix_len },\n },\n }],\n security_group_entries_policy_rule_dst_ports:\n [{\n security_group_entries_policy_rule_dst_ports_start_port: { get_param: sctp-a-egress-dst_start_port },\n security_group_entries_policy_rule_dst_ports_end_port: { get_param: sctp-a-egress-dst_end_port },\n }],\n security_group_entries_policy_rule_action_list:\n {\n security_group_entries_policy_rule_action_list_simple_action: { get_param: sctp-a-egress_action },\n },\n security_group_entries_policy_rule_ethertype: { get_param: sctp-a-egress_ethertype },\n },\n# SCTP Rule\n {\n security_group_entries_policy_rule_protocol: { get_param: sctp_rule_protocol },\n security_group_entries_policy_rule_src_addresses:\n [{\n security_group_entries_policy_rule_src_addresses_subnet:\n {\n security_group_entries_policy_rule_src_addresses_subnet_ip_prefix: { get_param: sctp-a-ingress-src_subnet_prefix },\n security_group_entries_policy_rule_src_addresses_subnet_ip_prefix_len: { get_param: sctp-a-ingress-src_subnet_prefix_len },\n },\n }],\n security_group_entries_policy_rule_src_ports:\n [{\n security_group_entries_policy_rule_src_ports_start_port: { get_param: sctp-a-ingress-src_start_port },\n security_group_entries_policy_rule_src_ports_end_port: { get_param: sctp-a-ingress-src_end_port },\n }],\n security_group_entries_policy_rule_application: [{ get_param: sctp-a-ingress_rule_application }],\n security_group_entries_policy_rule_dst_addresses:\n [{\n security_group_entries_policy_rule_dst_addresses_security_group: { get_param: sctp-a-ingress_dst_addresses },\n }],\n security_group_entries_policy_rule_dst_ports:\n [{\n security_group_entries_policy_rule_dst_ports_start_port: { get_param: sctp-a-ingress-dst_start_port },\n security_group_entries_policy_rule_dst_ports_end_port: { get_param: sctp-a-ingress-dst_end_port },\n }],\n security_group_entries_policy_rule_action_list:\n {\n security_group_entries_policy_rule_action_list_simple_action: { get_param: sctp-a-ingress_action },\n },\n security_group_entries_policy_rule_ethertype: { get_param: sctp-a-ingress_ethertype },\n },\n {\n security_group_entries_policy_rule_protocol: { get_param: sctp_rule_protocol },\n security_group_entries_policy_rule_src_addresses:\n [{\n security_group_entries_policy_rule_src_addresses_security_group: { get_param: sctp-a-egress_src_addresses },\n }],\n security_group_entries_policy_rule_src_ports:\n [{\n security_group_entries_policy_rule_src_ports_start_port: { get_param: sctp-a-egress-src_start_port },\n security_group_entries_policy_rule_src_ports_end_port: { get_param: sctp-a-egress-src_end_port },\n }],\n security_group_entries_policy_rule_application: [{ get_param: sctp-a-egress_rule_application }],\n security_group_entries_policy_rule_dst_addresses:\n [{\n security_group_entries_policy_rule_dst_addresses_subnet:\n {\n security_group_entries_policy_rule_dst_addresses_subnet_ip_prefix: { get_param: sctp-a-egress_dst_subnet_prefix },\n security_group_entries_policy_rule_dst_addresses_subnet_ip_prefix_len: { get_param: sctp-a-egress_dst_subnet_prefix_len },\n },\n }],\n security_group_entries_policy_rule_dst_ports:\n [{\n security_group_entries_policy_rule_dst_ports_start_port: { get_param: sctp-a-egress-dst_start_port },\n security_group_entries_policy_rule_dst_ports_end_port: { get_param: sctp-a-egress-dst_end_port },\n }],\n security_group_entries_policy_rule_action_list:\n {\n security_group_entries_policy_rule_action_list_simple_action: { get_param: sctp-a-egress_action },\n },\n security_group_entries_policy_rule_ethertype: { get_param: sctp-a-egress_ethertype },\n },\n#IPv6 Rule\n {\n security_group_entries_policy_rule_protocol: { get_param: sctp-a-ipv6-ingress_rule_protocol },\n security_group_entries_policy_rule_src_addresses:\n [{\n security_group_entries_policy_rule_src_addresses_subnet:\n {\n security_group_entries_policy_rule_src_addresses_subnet_ip_prefix: { get_param: sctp-a-src_subnet_prefix_v6 },\n security_group_entries_policy_rule_src_addresses_subnet_ip_prefix_len: { get_param: sctp-a-ipv6-ingress_src_subnet_prefix_len },\n },\n }],\n security_group_entries_policy_rule_src_ports:\n [{\n security_group_entries_policy_rule_src_ports_start_port: { get_param: sctp-a-ipv6-ingress-src_start_port},\n security_group_entries_policy_rule_src_ports_end_port: { get_param: sctp-a-ipv6-ingress-src_end_port },\n }],\n security_group_entries_policy_rule_application: [{ get_param: sctp-a-ipv6-ingress_rule_application }],\n security_group_entries_policy_rule_dst_addresses:\n [{\n security_group_entries_policy_rule_dst_addresses_security_group: { get_param: sctp-a-ipv6-ingress_dst_addresses },\n }],\n security_group_entries_policy_rule_dst_ports:\n [{\n security_group_entries_policy_rule_dst_ports_start_port: { get_param: sctp-a-ipv6-ingress-dst_start_port },\n security_group_entries_policy_rule_dst_ports_end_port: { get_param: sctp-a-ipv6-ingress-dst_end_port },\n }],\n security_group_entries_policy_rule_action_list:\n {\n security_group_entries_policy_rule_action_list_simple_action: { get_param: sctp-a-ipv6-ingress_action },\n },\n security_group_entries_policy_rule_ethertype: { get_param: sctp-a-IPv6_ethertype },\n },\n {\n security_group_entries_policy_rule_protocol: { get_param: sctp-a-ipv6-egress_rule_protocol },\n security_group_entries_policy_rule_src_addresses:\n [{\n security_group_entries_policy_rule_src_addresses_security_group: { get_param: sctp-a-ipv6-egress_src_addresses },\n }],\n security_group_entries_policy_rule_src_ports:\n [{\n security_group_entries_policy_rule_src_ports_start_port: { get_param: sctp-a-ipv6-egress_src_start_port },\n security_group_entries_policy_rule_src_ports_end_port: { get_param: sctp-a-ipv6-egress_src_end_port },\n }],\n security_group_entries_policy_rule_application: [{ get_param: sctp-a-ipv6-egress_rule_application }],\n security_group_entries_policy_rule_dst_addresses:\n [{\n security_group_entries_policy_rule_dst_addresses_subnet:\n {\n security_group_entries_policy_rule_dst_addresses_subnet_ip_prefix: { get_param: sctp-a-dst_subnet_prefix_v6 },\n security_group_entries_policy_rule_dst_addresses_subnet_ip_prefix_len: { get_param: sctp-a-ipv6-egress_dst_subnet_prefix_len },\n },\n }],\n security_group_entries_policy_rule_dst_ports:\n [{\n security_group_entries_policy_rule_dst_ports_start_port: { get_param: sctp-a-ipv6-egress-dst_start_port },\n security_group_entries_policy_rule_dst_ports_end_port: { get_param: sctp-a-ipv6-egress_dst_end_port },\n }],\n security_group_entries_policy_rule_action_list:\n {\n security_group_entries_policy_rule_action_list_simple_action: { get_param: sctp-a-ipv6-egress_action },\n },\n security_group_entries_policy_rule_ethertype: { get_param: sctp-a-IPv6_ethertype },\n }],\n }\n\n\n SCTP_B_SecurityGroup:\n type: OS::ContrailV2::SecurityGroup\n properties:\n name:\n str_replace:\n template: $VNF_NAME_$SECGROUPNAME\n params: \n $VNF_NAME: {get_param: vnf_name}\n $SECGROUPNAME: {get_param: sctp-b-name}\n display_name:\n str_replace:\n template: $VNF_NAME_$SECGROUPNAME\n params: \n $VNF_NAME: {get_param: vnf_name}\n $SECGROUPNAME: {get_param: sctp-b-display_name}\n security_group_entries:\n {\n security_group_entries_policy_rule:\n [{\n security_group_entries_policy_rule_protocol: { get_param: sctp-b-ingress_rule_protocol },\n security_group_entries_policy_rule_src_addresses:\n [{\n security_group_entries_policy_rule_src_addresses_subnet:\n {\n security_group_entries_policy_rule_src_addresses_subnet_ip_prefix: { get_param: sctp-b-ingress-src_subnet_prefix },\n security_group_entries_policy_rule_src_addresses_subnet_ip_prefix_len: { get_param: sctp-b-ingress-src_subnet_prefix_len },\n },\n }],\n security_group_entries_policy_rule_src_ports:\n [{\n security_group_entries_policy_rule_src_ports_start_port: { get_param: sctp-b-ingress-src_start_port },\n security_group_entries_policy_rule_src_ports_end_port: { get_param: sctp-b-ingress-src_end_port },\n }],\n security_group_entries_policy_rule_application: [{ get_param: sctp-b-ingress_rule_application }],\n security_group_entries_policy_rule_dst_addresses:\n [{\n security_group_entries_policy_rule_dst_addresses_security_group: { get_param: sctp-b-ingress_dst_addresses },\n }],\n security_group_entries_policy_rule_dst_ports:\n [{\n security_group_entries_policy_rule_dst_ports_start_port: { get_param: sctp-b-ingress-dst_start_port },\n security_group_entries_policy_rule_dst_ports_end_port: { get_param: sctp-b-ingress-dst_end_port },\n }],\n security_group_entries_policy_rule_action_list:\n {\n security_group_entries_policy_rule_action_list_simple_action: { get_param: sctp-b-ingress_action },\n },\n security_group_entries_policy_rule_ethertype: { get_param: sctp-b-ingress_ethertype },\n },\n {\n security_group_entries_policy_rule_protocol: { get_param: sctp-b-egress_rule_protocol },\n security_group_entries_policy_rule_src_addresses:\n [{\n security_group_entries_policy_rule_src_addresses_security_group: { get_param: sctp-b-egress_src_addresses },\n }],\n security_group_entries_policy_rule_src_ports:\n [{\n security_group_entries_policy_rule_src_ports_start_port: { get_param: sctp-b-egress-src_start_port },\n security_group_entries_policy_rule_src_ports_end_port: { get_param: sctp-b-egress-src_end_port },\n }],\n security_group_entries_policy_rule_application: [{ get_param: sctp-b-egress_rule_application }],\n security_group_entries_policy_rule_dst_addresses:\n [{\n security_group_entries_policy_rule_dst_addresses_subnet:\n {\n security_group_entries_policy_rule_dst_addresses_subnet_ip_prefix: { get_param: sctp-b-egress_dst_subnet_prefix },\n security_group_entries_policy_rule_dst_addresses_subnet_ip_prefix_len: { get_param: sctp-b-egress_dst_subnet_prefix_len },\n },\n }],\n security_group_entries_policy_rule_dst_ports:\n [{\n security_group_entries_policy_rule_dst_ports_start_port: { get_param: sctp-b-egress-dst_start_port },\n security_group_entries_policy_rule_dst_ports_end_port: { get_param: sctp-b-egress-dst_end_port },\n }],\n security_group_entries_policy_rule_action_list:\n {\n security_group_entries_policy_rule_action_list_simple_action: { get_param: sctp-b-egress_action },\n },\n security_group_entries_policy_rule_ethertype: { get_param: sctp-b-egress_ethertype },\n },\n# SCTP Rule\n {\n security_group_entries_policy_rule_protocol: { get_param: sctp_rule_protocol },\n security_group_entries_policy_rule_src_addresses:\n [{\n security_group_entries_policy_rule_src_addresses_subnet:\n {\n security_group_entries_policy_rule_src_addresses_subnet_ip_prefix: { get_param: sctp-b-ingress-src_subnet_prefix },\n security_group_entries_policy_rule_src_addresses_subnet_ip_prefix_len: { get_param: sctp-b-ingress-src_subnet_prefix_len },\n },\n }],\n security_group_entries_policy_rule_src_ports:\n [{\n security_group_entries_policy_rule_src_ports_start_port: { get_param: sctp-b-ingress-src_start_port },\n security_group_entries_policy_rule_src_ports_end_port: { get_param: sctp-b-ingress-src_end_port },\n }],\n security_group_entries_policy_rule_application: [{ get_param: sctp-b-ingress_rule_application }],\n security_group_entries_policy_rule_dst_addresses:\n [{\n security_group_entries_policy_rule_dst_addresses_security_group: { get_param: sctp-b-ingress_dst_addresses },\n }],\n security_group_entries_policy_rule_dst_ports:\n [{\n security_group_entries_policy_rule_dst_ports_start_port: { get_param: sctp-b-ingress-dst_start_port },\n security_group_entries_policy_rule_dst_ports_end_port: { get_param: sctp-b-ingress-dst_end_port },\n }],\n security_group_entries_policy_rule_action_list:\n {\n security_group_entries_policy_rule_action_list_simple_action: { get_param: sctp-b-ingress_action },\n },\n security_group_entries_policy_rule_ethertype: { get_param: sctp-b-ingress_ethertype },\n },\n {\n security_group_entries_policy_rule_protocol: { get_param: sctp_rule_protocol },\n security_group_entries_policy_rule_src_addresses:\n [{\n security_group_entries_policy_rule_src_addresses_security_group: { get_param: sctp-b-egress_src_addresses },\n }],\n security_group_entries_policy_rule_src_ports:\n [{\n security_group_entries_policy_rule_src_ports_start_port: { get_param: sctp-b-egress-src_start_port },\n security_group_entries_policy_rule_src_ports_end_port: { get_param: sctp-b-egress-src_end_port },\n }],\n security_group_entries_policy_rule_application: [{ get_param: sctp-b-egress_rule_application }],\n security_group_entries_policy_rule_dst_addresses:\n [{\n security_group_entries_policy_rule_dst_addresses_subnet:\n {\n security_group_entries_policy_rule_dst_addresses_subnet_ip_prefix: { get_param: sctp-b-egress_dst_subnet_prefix },\n security_group_entries_policy_rule_dst_addresses_subnet_ip_prefix_len: { get_param: sctp-b-egress_dst_subnet_prefix_len },\n },\n }],\n security_group_entries_policy_rule_dst_ports:\n [{\n security_group_entries_policy_rule_dst_ports_start_port: { get_param: sctp-b-egress-dst_start_port },\n security_group_entries_policy_rule_dst_ports_end_port: { get_param: sctp-b-egress-dst_end_port },\n }],\n security_group_entries_policy_rule_action_list:\n {\n security_group_entries_policy_rule_action_list_simple_action: { get_param: sctp-b-egress_action },\n },\n security_group_entries_policy_rule_ethertype: { get_param: sctp-b-egress_ethertype },\n },\n#IPv6 Rule\n {\n security_group_entries_policy_rule_protocol: { get_param: sctp-b-ipv6-ingress_rule_protocol },\n security_group_entries_policy_rule_src_addresses:\n [{\n security_group_entries_policy_rule_src_addresses_subnet:\n {\n security_group_entries_policy_rule_src_addresses_subnet_ip_prefix: { get_param: sctp-b-src_subnet_prefix_v6 },\n security_group_entries_policy_rule_src_addresses_subnet_ip_prefix_len: { get_param: sctp-b-ipv6-ingress_src_subnet_prefix_len },\n },\n }],\n security_group_entries_policy_rule_src_ports:\n [{\n security_group_entries_policy_rule_src_ports_start_port: { get_param: sctp-b-ipv6-ingress-src_start_port},\n security_group_entries_policy_rule_src_ports_end_port: { get_param: sctp-b-ipv6-ingress-src_end_port },\n }],\n security_group_entries_policy_rule_application: [{ get_param: sctp-b-ipv6-ingress_rule_application }],\n security_group_entries_policy_rule_dst_addresses:\n [{\n security_group_entries_policy_rule_dst_addresses_security_group: { get_param: sctp-b-ipv6-ingress_dst_addresses },\n }],\n security_group_entries_policy_rule_dst_ports:\n [{\n security_group_entries_policy_rule_dst_ports_start_port: { get_param: sctp-b-ipv6-ingress-dst_start_port },\n security_group_entries_policy_rule_dst_ports_end_port: { get_param: sctp-b-ipv6-ingress-dst_end_port },\n }],\n security_group_entries_policy_rule_action_list:\n {\n security_group_entries_policy_rule_action_list_simple_action: { get_param: sctp-b-ipv6-ingress_action },\n },\n security_group_entries_policy_rule_ethertype: { get_param: sctp-b-IPv6_ethertype },\n },\n {\n security_group_entries_policy_rule_protocol: { get_param: sctp-b-ipv6-egress_rule_protocol },\n security_group_entries_policy_rule_src_addresses:\n [{\n security_group_entries_policy_rule_src_addresses_security_group: { get_param: sctp-b-ipv6-egress_src_addresses },\n }],\n security_group_entries_policy_rule_src_ports:\n [{\n security_group_entries_policy_rule_src_ports_start_port: { get_param: sctp-b-ipv6-egress_src_start_port },\n security_group_entries_policy_rule_src_ports_end_port: { get_param: sctp-b-ipv6-egress_src_end_port },\n }],\n security_group_entries_policy_rule_application: [{ get_param: sctp-b-ipv6-egress_rule_application }],\n security_group_entries_policy_rule_dst_addresses:\n [{\n security_group_entries_policy_rule_dst_addresses_subnet:\n {\n security_group_entries_policy_rule_dst_addresses_subnet_ip_prefix: { get_param: sctp-b-dst_subnet_prefix_v6 },\n security_group_entries_policy_rule_dst_addresses_subnet_ip_prefix_len: { get_param: sctp-b-ipv6-egress_dst_subnet_prefix_len },\n },\n }],\n security_group_entries_policy_rule_dst_ports:\n [{\n security_group_entries_policy_rule_dst_ports_start_port: { get_param: sctp-b-ipv6-egress-dst_start_port },\n security_group_entries_policy_rule_dst_ports_end_port: { get_param: sctp-b-ipv6-egress_dst_end_port },\n }],\n security_group_entries_policy_rule_action_list:\n {\n security_group_entries_policy_rule_action_list_simple_action: { get_param: sctp-b-ipv6-egress_action },\n },\n security_group_entries_policy_rule_ethertype: { get_param: sctp-b-IPv6_ethertype },\n }],\n } \n\n# VMs and Networks \n\n template_NetworkIpam_Internal1:\n type: OS::ContrailV2::NetworkIpam\n properties:\n name:\n str_replace:\n template: $VNF_NAME_int_net_1\n params: \n $VNF_NAME: {get_param: vnf_name}\n\n Internal1_net:\n type: OS::ContrailV2::VirtualNetwork\n depends_on: [ template_NetworkIpam_Internal1 ]\n properties:\n name:\n str_replace:\n template: $VNF_NAME_int_net_1\n params: \n $VNF_NAME: {get_param: vnf_name}\n virtual_network_properties:\n {\n virtual_network_properties_allow_transit: { get_param: Internal1_allow_transit },\n virtual_network_properties_forwarding_mode: { get_param: Internal1_forwarding_mode },\n virtual_network_properties_rpf: { get_param: Internal1_rpf }\n }\n is_shared: { get_param: Internal1_shared }\n network_ipam_refs: [{ get_resource: template_NetworkIpam_Internal1 }]\n network_ipam_refs_data:\n [{\n network_ipam_refs_data_ipam_subnets:\n [{\n network_ipam_refs_data_ipam_subnets_subnet:\n {\n network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: { get_param: Internal1_net_cidr },\n network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: { get_param: Internal1_net_cidr_len }\n },\n network_ipam_refs_data_ipam_subnets_default_gateway: { get_param: Internal1_net_gateway },\n network_ipam_refs_data_ipam_subnets_enable_dhcp: { get_param: Internal1_dhcp },\n }]\n }]\n\n template_NetworkIpam_Internal2:\n type: OS::ContrailV2::NetworkIpam\n properties:\n name:\n str_replace:\n template: $VNF_NAME_int_net_2\n params: \n $VNF_NAME: {get_param: vnf_name}\n\n Internal2_net:\n type: OS::ContrailV2::VirtualNetwork\n depends_on: [ template_NetworkIpam_Internal2 ]\n properties:\n name:\n str_replace:\n template: $VNF_NAME_int_net_2\n params: \n $VNF_NAME: {get_param: vnf_name}\n virtual_network_properties:\n {\n virtual_network_properties_allow_transit: { get_param: Internal2_allow_transit },\n virtual_network_properties_forwarding_mode: { get_param: Internal2_forwarding_mode },\n virtual_network_properties_rpf: { get_param: Internal2_rpf }\n }\n is_shared: { get_param: Internal2_shared }\n network_ipam_refs: [{ get_resource: template_NetworkIpam_Internal2 }]\n network_ipam_refs_data:\n [{\n network_ipam_refs_data_ipam_subnets:\n [{\n network_ipam_refs_data_ipam_subnets_subnet:\n {\n network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: { get_param: Internal2_net_cidr },\n network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: { get_param: Internal2_net_cidr_len }\n },\n network_ipam_refs_data_ipam_subnets_default_gateway: { get_param: Internal2_net_gateway },\n network_ipam_refs_data_ipam_subnets_enable_dhcp: { get_param: Internal2_dhcp },\n }]\n }]\n\n template_ServiceTemplate_VLC:\n type: OS::ContrailV2::ServiceTemplate\n properties:\n name:\n str_replace:\n template: $VNF_NAME_ServiceTemplate\n params: \n $VNF_NAME: {get_param: vnf_name}\n service_template_properties:\n {\n service_template_properties_version: { get_param: vlc_st_version },\n service_template_properties_service_mode: { get_param: vlc_st_service_mode },\n service_template_properties_service_type: { get_param: vlc_st_service_type },\n service_template_properties_interface_type:\n [\n {\n service_template_properties_interface_type_service_interface_type: { get_param: vlc_st_interface_type_int1 }\n },\n {\n service_template_properties_interface_type_service_interface_type: { get_param: vlc_st_interface_type_int2 }\n },\n {\n service_template_properties_interface_type_service_interface_type: { get_param: vlc_st_interface_type_oam}\n },\n {\n service_template_properties_interface_type_service_interface_type: { get_param: vlc_st_interface_type_sctp_a }\n },\n {\n service_template_properties_interface_type_service_interface_type: { get_param: vlc_st_interface_type_sctp_b }\n },\n {\n service_template_properties_interface_type_service_interface_type: { get_param: vlc_st_interface_type_gtp }\n }\n ],\n service_template_properties_service_virtualization_type: { get_param: vlc_st_virtualization_type }\n }\n domain: { get_param: domain_name }\n\n template_ServiceInstance_VLC:\n type: OS::ContrailV2::ServiceInstance\n depends_on: [ template_ServiceTemplate_VLC ]\n properties:\n name:\n str_replace:\n template: $VNF_NAME_ServiceTemplate\n params: \n $VNF_NAME: {get_param: vnf_name}\n service_instance_properties:\n {\n service_instance_properties_interface_list:\n [\n {\n service_instance_properties_interface_list_virtual_network: { get_resource: Internal1_net }\n },\n {\n service_instance_properties_interface_list_virtual_network: { get_resource: Internal2_net }\n },\n {\n service_instance_properties_interface_list_virtual_network: {get_param: oam_net_fqdn}\n },\n {\n service_instance_properties_interface_list_virtual_network: {get_param: sctp_a_net_fqdn}\n },\n {\n service_instance_properties_interface_list_virtual_network: {get_param: sctp_b_net_fqdn}\n },\n {\n service_instance_properties_interface_list_virtual_network: {get_param: gtp_net_fqdn}\n }\n ]\n }\n service_template_refs: [{ get_resource: template_ServiceTemplate_VLC }]\n\n template_InterfaceRouteTable_GTP:\n type: OS::ContrailV2::InterfaceRouteTable\n depends_on: [ template_ServiceInstance_VLC ]\n properties:\n name:\n str_replace:\n template: $VNF_NAME_GTP\n params: \n $VNF_NAME: {get_param: vnf_name}\n display_name: \n str_replace:\n template: $VNF_NAME_GTP\n params: \n $VNF_NAME: {get_param: vnf_name}\n interface_route_table_routes:\n {\n interface_route_table_routes_route: { get_param: vlc_gtp_route_prefixes }\n }\n service_instance_refs: \n value: { get_attr: [ template_ServiceInstance_VLC, fq_name ] } \n service_instance_refs_data:\n [{\n service_instance_refs_data_interface_type: { get_param: vlc_st_interface_type_gtp }\n }]\n\n template_InterfaceRouteTable_SCTP_A:\n type: OS::ContrailV2::InterfaceRouteTable\n depends_on: [ template_ServiceInstance_VLC ]\n properties:\n name:\n str_replace:\n template: $VNF_NAME_SCTP-A\n params: \n $VNF_NAME: {get_param: vnf_name}\n display_name: \n str_replace:\n template: $VNF_NAME_SCTP-A\n params: \n $VNF_NAME: {get_param: vnf_name}\n interface_route_table_routes:\n {\n interface_route_table_routes_route: { get_param: vlc_sctp_a_route_prefixes }\n }\n service_instance_refs: \n value: { get_attr: [ template_ServiceInstance_VLC, fq_name ] } \n service_instance_refs_data:\n [{\n service_instance_refs_data_interface_type: { get_param: vlc_st_interface_type_sctp_a }\n }]\n\n template_InterfaceRouteTable_SCTP_B:\n type: OS::ContrailV2::InterfaceRouteTable\n depends_on: [ template_ServiceInstance_VLC ]\n properties:\n name:\n str_replace:\n template: $VNF_NAME_SCTP-B\n params: \n $VNF_NAME: {get_param: vnf_name}\n display_name: \n str_replace:\n template: $VNF_NAME_SCTP-B\n params: \n $VNF_NAME: {get_param: vnf_name}\n interface_route_table_routes:\n {\n interface_route_table_routes_route: { get_param: vlc_sctp_b_route_prefixes }\n }\n service_instance_refs: \n value: { get_attr: [ template_ServiceInstance_VLC, fq_name ] } \n service_instance_refs_data:\n [{\n service_instance_refs_data_interface_type: { get_param: vlc_st_interface_type_sctp_b }\n }]\n\n template_InterfaceRouteTable_OAM:\n type: OS::ContrailV2::InterfaceRouteTable\n depends_on: [ template_ServiceInstance_VLC ]\n properties:\n name:\n str_replace:\n template: $VNF_NAME_OAM\n params: \n $VNF_NAME: {get_param: vnf_name}\n display_name: \n str_replace:\n template: $VNF_NAME_OAM\n params: \n $VNF_NAME: {get_param: vnf_name}\n interface_route_table_routes:\n {\n interface_route_table_routes_route: { get_param: vlc_oam_route_prefixes }\n }\n service_instance_refs: \n value: { get_attr: [ template_ServiceInstance_VLC, fq_name ] } \n service_instance_refs_data:\n [{\n service_instance_refs_data_interface_type: { get_param: vlc_st_interface_type_oam }\n }]\n\n FSB_1:\n type: OS::Nova::Server\n properties:\n name: { get_param: fsb_name_0 }\n block_device_mapping: [\n { delete_on_termination: "false",\n device_name: "vda",\n volume_id: { get_param: fsb_volume_id_0 } }\n ]\n flavor: { get_param: fsb_flavor_name }\n #scheduler_hints: { group: { get_resource: VM_Affinity } }\n availability_zone: { get_param: availability_zone_0}\n networks:\n - port: { get_resource: FSB1_Internal1 }\n - port: { get_resource: FSB1_Internal2 }\n - port: { get_resource: FSB1_OAM }\n metadata:\n vnf_id: { get_param: vnf_id }\n vf_module_id: { get_param: vf_module_id }\n\n FSB1_Internal1:\n type: OS::Neutron::Port\n properties:\n network_id: { get_resource: Internal1_net }\n mac_address: { get_param: fsb1_Internal1_mac }\n replacement_policy: AUTO\n\n FSB1_Internal2:\n type: OS::Neutron::Port\n properties:\n network_id: { get_resource: Internal2_net }\n mac_address: { get_param: fsb1_Internal2_mac }\n replacement_policy: AUTO\n\n FSB1_OAM:\n type: OS::Neutron::Port\n properties:\n network: { get_param: oam_net_name }\n fixed_ips:\n - ip_address: { get_param: fsb_oam_ip_0 }\n replacement_policy: AUTO\n\n FSB_2:\n type: OS::Nova::Server\n properties:\n name: { get_param: fsb_name_1 }\n block_device_mapping: [\n { delete_on_termination: "false",\n device_name: "vda",\n volume_id: { get_param: fsb_volume_id_1 } }\n ]\n flavor: { get_param: fsb_flavor_name }\n #scheduler_hints: { group: { get_resource: VM_Affinity } }\n availability_zone: { get_param: availability_zone_0}\n networks:\n - port: { get_resource: FSB2_Internal1 }\n - port: { get_resource: FSB2_Internal2 }\n - port: { get_resource: FSB2_OAM }\n metadata:\n vnf_id: { get_param: vnf_id }\n vf_module_id: { get_param: vf_module_id }\n\n FSB2_Internal1:\n type: OS::Neutron::Port\n properties:\n network_id: { get_resource: Internal1_net }\n mac_address: { get_param: fsb2_Internal1_mac }\n replacement_policy: AUTO\n\n FSB2_Internal2:\n type: OS::Neutron::Port\n properties:\n network_id: { get_resource: Internal2_net }\n mac_address: { get_param: fsb2_Internal2_mac }\n replacement_policy: AUTO\n\n FSB2_OAM:\n type: OS::Neutron::Port\n properties:\n network: { get_param: oam_net_name }\n fixed_ips:\n - ip_address: { get_param: fsb_oam_ip_1 }\n replacement_policy: AUTO\n\n NCB_1:\n type: OS::Nova::Server\n properties:\n name: { get_param: ncb_name_0 }\n image: { get_param: pxe_image_name }\n flavor: { get_param: ncb_flavor_name }\n# scheduler_hints: { group: { get_resource: VM_Affinity } }\n availability_zone: { get_param: availability_zone_1}\n networks:\n - port: { get_resource: NCB1_Internal1 }\n - port: { get_resource: NCB1_Internal2 }\n metadata:\n vnf_id: { get_param: vnf_id }\n vf_module_id: { get_param: vf_module_id }\n\n NCB1_Internal1:\n type: OS::Neutron::Port\n properties:\n network_id: { get_resource: Internal1_net }\n mac_address: { get_param: ncb1_Internal1_mac }\n replacement_policy: AUTO\n\n NCB1_Internal2:\n type: OS::Neutron::Port\n properties:\n network_id: { get_resource: Internal2_net }\n mac_address: { get_param: ncb1_Internal2_mac }\n replacement_policy: AUTO\n\n NCB_2:\n type: OS::Nova::Server\n properties:\n name: { get_param: ncb_name_1 }\n image: { get_param: pxe_image_name }\n flavor: { get_param: ncb_flavor_name }\n availability_zone: { get_param: availability_zone_1 }\n networks:\n - port: { get_resource: NCB2_Internal1 }\n - port: { get_resource: NCB2_Internal2 }\n metadata:\n vnf_id: { get_param: vnf_id }\n vf_module_id: { get_param: vf_module_id }\n\n NCB2_Internal1:\n type: OS::Neutron::Port\n properties:\n network_id: { get_resource: Internal1_net }\n mac_address: { get_param: ncb2_Internal1_mac }\n replacement_policy: AUTO\n\n NCB2_Internal2:\n type: OS::Neutron::Port\n properties:\n network_id: { get_resource: Internal2_net }\n mac_address: { get_param: ncb2_Internal2_mac }\n replacement_policy: AUTO\n\noutputs:\n internal_net_id_0: \n description: ID of Internal1_net\n value: {get_resource: Internal1_net}\n\n internal_net_id_1: \n description: ID of Internal2_net\n value: {get_resource: Internal2_net}\n \n service_instance_id_0: \n description: ID of Service Instance used for vLCs\n value: {get_resource: template_ServiceInstance_VLC}\n\n security_group_gtp_id:\n description: ID of GTP security group\n value: {get_resource: gtp_security_group}\n\n security_group_sctp_a_id:\n description: ID of SCTP_A security group\n value: {get_resource: SCTP_A_SecurityGroup}\n\n security_group_sctp_b_id:\n description: ID of SCTP_B security group\n value: {get_resource: SCTP_B_SecurityGroup}\n\n security_group_oam_id:\n description: ID of OAM security group\n value: {get_resource: oam_security_group}\n\n security_group_int1_id:\n description: ID of Internal1_net security group\n value: {get_resource: int1_sec_group}\n\n security_group_int2_id:\n description: ID of Internal2_net security group\n value: {get_resource: int2_sec_group} \n', 120, 'MjFlYTY5MGRiOWFiODczODFhOWRiYTM0MWQyZmI4Y2E=', '2018-05-13 12:12:09');
+
+
+ INSERT INTO `heat_template` (`ARTIFACT_UUID`, `NAME`, `VERSION`, `DESCRIPTION`, `BODY`, `TIMEOUT_MINUTES`, `ARTIFACT_CHECKSUM`, `CREATION_TIMESTAMP`) VALUES
+ ('97b73b0f-2860-49e5-b9c5-b6f91e4ee4a8', 'base_vmme_volume.yml', '2', 'created from csar', 'heat_template_version: 2013-05-23\r\n\r\ndescription: HOT template for vMME Cinder Volumes\r\n\r\nparameters:\r\n\r\n fsb_volume_type_0:\r\n type: string\r\n label: volume type\r\n description: volume type SolidFire\r\n\r\n fsb_volume_size_0:\r\n type: number\r\n label: volume size\r\n description: my volume size 320GB\r\n\r\n fsb_volume_image_name_0:\r\n type: string\r\n label: MME_FSB1\r\n description: MME_FSB1_16ACP04_GA\r\n\r\n fsb_volume_image_name_1:\r\n type: string\r\n label: MME_FSB2\r\n description: MME_FSB2_16ACP04_GA\r\n\r\nresources:\r\n\r\n fsb_volume_type_0:\r\n type: OS::Cinder::Volume\r\n properties:\r\n size: {get_param: fsb_volume_size_0}\r\n volume_type: {get_param: fsb_volume_type_0}\r\n name: \r\n list_join: [\'_\', [{get_param: \'OS::stack_name\'}, \'FSB1_Vol_1\']]\r\n image: {get_param: fsb_volume_image_name_0}\r\n\r\n fsb_volume_type_1:\r\n type: OS::Cinder::Volume\r\n properties:\r\n size: {get_param: fsb_volume_size_0}\r\n volume_type: {get_param: fsb_volume_type_0}\r\n name: \r\n list_join: [\'_\', [{get_param: \'OS::stack_name\'}, \'FSB2_Vol_1\']]\r\n image: {get_param: fsb_volume_type_0}\r\n\r\noutputs:\r\n fsb_volume_id_0: \r\n description: ID of Cinder Volume for FSB1\r\n value: {get_resource: fsb_volume_type_0}\r\n\r\n fsb_volume_id_1: \r\n description: ID of Cinder Volume for FSB2\r\n value: {get_resource: fsb_volume_type_1}\r\n', 120, 'NzYyMWYxY2NjODFiNTYxNjVhYmM3NjdhMTdiZDExMGY=', '2018-05-13 12:12:09');
+
+INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`)
+VALUES ('97b73b0f-2860-49e5-b9c5-b6f91e4ee4a8', 'fsb_volume_image_name_0', b'1', 'string', NULL),
+('97b73b0f-2860-49e5-b9c5-b6f91e4ee4a8', 'fsb_volume_image_name_1', b'1', 'string', NULL),
+('97b73b0f-2860-49e5-b9c5-b6f91e4ee4a8', 'fsb_volume_size_0', b'1', 'number', NULL),
+ ('97b73b0f-2860-49e5-b9c5-b6f91e4ee4a8', 'fsb_volume_type_0', b'1', 'string', NULL);
+
+ INSERT INTO `vf_module` (`MODEL_UUID`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `MODEL_NAME`, `DESCRIPTION`, `IS_BASE`, `HEAT_TEMPLATE_ARTIFACT_UUID`, `VOL_HEAT_TEMPLATE_ARTIFACT_UUID`, `CREATION_TIMESTAMP`, `VNF_RESOURCE_MODEL_UUID`)
+ VALUES ('207fe0dc-4c89-4e5d-9a78-345e99ef7fbe', '547e9ac6-0489-41b6-8289-a7705f6e5c9d', '1', 'TestVnfType::TestModule-0', NULL, 1, 'd187c228-71c6-4c6d-8f33-cd1243442d0a', '97b73b0f-2860-49e5-b9c5-b6f91e4ee4a8', '2018-05-13 12:12:09', 'c5efeb55-4ade-49b8-815c-6a6391f6c46b');
+INSERT INTO `heat_environment` (`ARTIFACT_UUID`, `NAME`, `VERSION`, `DESCRIPTION`, `BODY`, `ARTIFACT_CHECKSUM`, `CREATION_TIMESTAMP`) VALUES ('f4a21b58-5654-4cf6-9c50-de42004fe2b4', 'base_vmme.env', '2', 'Auto-generated HEAT Environment deployment artifact', 'parameters:\n Internal1_allow_transit: "True"\n Internal1_dhcp: "False"\n Internal1_forwarding_mode: "l2"\n Internal1_net_cidr: "169.253.0.0"\n Internal1_net_cidr_len: "17"\n Internal1_net_gateway: "169.253.0.3"\n Internal1_rpf: "disable"\n Internal1_shared: "False"\n Internal2_allow_transit: "True"\n Internal2_dhcp: "False"\n Internal2_forwarding_mode: "l2"\n Internal2_net_cidr: "169.255.0.0"\n Internal2_net_cidr_len: "17"\n Internal2_net_gateway: "169.255.0.3"\n Internal2_rpf: "disable"\n Internal2_shared: "False"\n domain_name: "default-domain"\n fsb1_Internal1_mac: "00:80:37:0E:0B:12"\n fsb1_Internal2_mac: "00:80:37:0E:0B:12"\n fsb2_Internal1_mac: "00:80:37:0E:0D:12"\n fsb2_Internal2_mac: "00:80:37:0E:0D:12"\n fsb_flavor_name: "nv.c20r64d1"\n gtp_sec_group_name: "gtp-sec-group"\n int1_sec_group_name: "int1-sec-group"\n int2_sec_group_name: "int2-sec-group"\n ncb1_Internal1_mac: "00:80:37:0E:09:12"\n ncb1_Internal2_mac: "00:80:37:0E:09:12"\n ncb2_Internal1_mac: "00:80:37:0E:0F:12"\n ncb2_Internal2_mac: "00:80:37:0E:0F:12"\n ncb_flavor_name: "nv.c20r64d1"\n oam_sec_group_name: "oam-sec-group"\n pxe_image_name: "MME_PXE-Boot_16ACP04_GA.qcow2"\n sctp-a-IPv6_ethertype: "IPv6"\n sctp-a-display_name: "epc-sctp-a-ipv4v6-sec-group"\n sctp-a-dst_subnet_prefix_v6: "::"\n sctp-a-egress-dst_end_port: 65535\n sctp-a-egress-dst_start_port: 0\n sctp-a-egress-src_end_port: 65535\n sctp-a-egress-src_start_port: 0\n sctp-a-egress_action: "pass"\n sctp-a-egress_dst_subnet_prefix: "0.0.0.0"\n sctp-a-egress_dst_subnet_prefix_len: 0\n sctp-a-egress_ethertype: "IPv4"\n sctp-a-egress_rule_application: "any"\n sctp-a-egress_rule_protocol: "icmp"\n sctp-a-egress_src_addresses: "local"\n sctp-a-ingress-dst_end_port: 65535\n sctp-a-ingress-dst_start_port: 0\n sctp-a-ingress-src_end_port: 65535\n sctp-a-ingress-src_start_port: 0\n sctp-a-ingress-src_subnet_prefix: "0.0.0.0"\n sctp-a-ingress-src_subnet_prefix_len: 0\n sctp-a-ingress_action: "pass"\n sctp-a-ingress_dst_addresses: "local"\n sctp-a-ingress_ethertype: "IPv4"\n sctp-a-ingress_rule_application: "any"\n sctp-a-ingress_rule_protocol: "icmp"\n sctp-a-ipv6-egress-dst_start_port: "0"\n sctp-a-ipv6-egress_action: "pass"\n sctp-a-ipv6-egress_dst_end_port: "65535"\n sctp-a-ipv6-egress_dst_subnet_prefix: "0.0.0.0"\n sctp-a-ipv6-egress_dst_subnet_prefix_len: "0"\n sctp-a-ipv6-egress_ethertype: "IPv4"\n sctp-a-ipv6-egress_rule_application: "any"\n sctp-a-ipv6-egress_rule_protocol: "any"\n sctp-a-ipv6-egress_src_addresses: "local"\n sctp-a-ipv6-egress_src_end_port: "65535"\n sctp-a-ipv6-egress_src_start_port: "0"\n sctp-a-ipv6-ingress-dst_end_port: "65535"\n sctp-a-ipv6-ingress-dst_start_port: "0"\n sctp-a-ipv6-ingress-src_end_port: 65535\n sctp-a-ipv6-ingress-src_start_port: 0\n sctp-a-ipv6-ingress_action: "pass"\n sctp-a-ipv6-ingress_dst_addresses: "local"\n sctp-a-ipv6-ingress_ethertype: "IPv4"\n sctp-a-ipv6-ingress_rule_application: "any"\n sctp-a-ipv6-ingress_rule_protocol: "any"\n sctp-a-ipv6-ingress_src_subnet_prefix: "0.0.0.0"\n sctp-a-ipv6-ingress_src_subnet_prefix_len: "0"\n sctp-a-name: "epc-sctp-a-ipv4v6-sec-group"\n sctp-a-src_subnet_prefix_v6: "::"\n sctp-b-IPv6_ethertype: "IPv6"\n sctp-b-display_name: "epc-sctp-b-ipv4v6-sec-group"\n sctp-b-dst_subnet_prefix_v6: "::"\n sctp-b-egress-dst_end_port: 65535\n sctp-b-egress-dst_start_port: 0\n sctp-b-egress-src_end_port: 65535\n sctp-b-egress-src_start_port: 0\n sctp-b-egress_action: "pass"\n sctp-b-egress_dst_subnet_prefix: "0.0.0.0"\n sctp-b-egress_dst_subnet_prefix_len: 0\n sctp-b-egress_ethertype: "IPv4"\n sctp-b-egress_rule_application: "any"\n sctp-b-egress_rule_protocol: "icmp"\n sctp-b-egress_src_addresses: "local"\n sctp-b-ingress-dst_end_port: 65535\n sctp-b-ingress-dst_start_port: 0\n sctp-b-ingress-src_end_port: 65535\n sctp-b-ingress-src_start_port: 0\n sctp-b-ingress-src_subnet_prefix: "0.0.0.0"\n sctp-b-ingress-src_subnet_prefix_len: 0\n sctp-b-ingress_action: "pass"\n sctp-b-ingress_dst_addresses: "local"\n sctp-b-ingress_ethertype: "IPv4"\n sctp-b-ingress_rule_application: "any"\n sctp-b-ingress_rule_protocol: "icmp"\n sctp-b-ipv6-egress-dst_start_port: "0"\n sctp-b-ipv6-egress_action: "pass"\n sctp-b-ipv6-egress_dst_end_port: "65535"\n sctp-b-ipv6-egress_dst_subnet_prefix: "0.0.0.0"\n sctp-b-ipv6-egress_dst_subnet_prefix_len: "0"\n sctp-b-ipv6-egress_ethertype: "IPv4"\n sctp-b-ipv6-egress_rule_application: "any"\n sctp-b-ipv6-egress_rule_protocol: "any"\n sctp-b-ipv6-egress_src_addresses: "local"\n sctp-b-ipv6-egress_src_end_port: "65535"\n sctp-b-ipv6-egress_src_start_port: "0"\n sctp-b-ipv6-ingress-dst_end_port: "65535"\n sctp-b-ipv6-ingress-dst_start_port: "0"\n sctp-b-ipv6-ingress-src_end_port: 65535\n sctp-b-ipv6-ingress-src_start_port: 0\n sctp-b-ipv6-ingress_action: "pass"\n sctp-b-ipv6-ingress_dst_addresses: "local"\n sctp-b-ipv6-ingress_ethertype: "IPv4"\n sctp-b-ipv6-ingress_rule_application: "any"\n sctp-b-ipv6-ingress_rule_protocol: "any"\n sctp-b-ipv6-ingress_src_subnet_prefix: "0.0.0.0"\n sctp-b-ipv6-ingress_src_subnet_prefix_len: "0"\n sctp-b-name: "epc-sctp-b-ipv4v6-sec-group"\n sctp-b-src_subnet_prefix_v6: "::"\n sctp_rule_protocol: "132"\n vlc_st_availability_zone: "True"\n vlc_st_interface_type_gtp: "other0"\n vlc_st_interface_type_int1: "other1"\n vlc_st_interface_type_int2: "other2"\n vlc_st_interface_type_oam: "management"\n vlc_st_interface_type_sctp_a: "left"\n vlc_st_interface_type_sctp_b: "right"\n vlc_st_service_mode: "in-network-nat"\n vlc_st_service_type: "firewall"\n vlc_st_version: "2"\n vlc_st_virtualization_type: "virtual-machine"\n availability_zone_0: \n availability_zone_1: \n availability_zone_2: \n availability_zone_3: \n fsb_name_0: \n fsb_name_1: \n fsb_oam_ip_0: \n fsb_oam_ip_1: \n fsb_volume_id_0: \n fsb_volume_id_1: \n gtp_net_fqdn: \n gtp_net_name: \n ncb_name_0: \n ncb_name_1: \n oam_net_fqdn: \n oam_net_name: \n sctp_a_net_fqdn: \n sctp_a_net_name: \n sctp_b_net_fqdn: \n sctp_b_net_name: \n vf_module_id: \n vlc_gtp_route_prefixes: \n vlc_oam_route_prefixes: \n vlc_sctp_a_route_prefixes: \n vlc_sctp_b_route_prefixes: \n vnf_id: \n vnf_name: \n', 'MGJjYzM2ZWY1ODBjYzc1MzBiMGQxZmI4N2MyZmFkY2E=', '2018-05-13 12:12:09');
+
+INSERT INTO `heat_environment` (`ARTIFACT_UUID`, `NAME`, `VERSION`, `DESCRIPTION`, `BODY`, `ARTIFACT_CHECKSUM`, `CREATION_TIMESTAMP`) VALUES ('3375f64b-4709-4802-8713-7a164763f9cd', 'base_vDB_11032016_volume.env', '1', 'Auto-generated HEAT Environment deployment artifact', '#_______________________________________________________________________________________________________________________________________\n #| AT&T Proprietary (Restricted) |\n #| Only for use by authorized individuals or any above-designated team(s) |\n #| within the AT&T companies and not for general distribution |\n #|_______________________________________________________________________________________________________________________________________|\nparameters:\n oam_volume_size: "10"\n prx_volume_size: "10"\n rdn_volume_size: "10"\n#_______________________________________________________________________________________________________________________________________\n #| AT&T Proprietary (Restricted) |\n #| Only for use by authorized individuals or any above-designated team(s) |\n #| within the AT&T companies and not for general distribution |\n #|_______________________________________________________________________________________________________________________________________|\n', 'NGE2YTZjM2YzZDkyNWEzNTljMjQwYzkyNTIyMDU3ZDQ=', '2017-01-26 16:01:40');
+
+
+
+ INSERT INTO `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`, `LABEL`, `INITIAL_COUNT`, `MIN_INSTANCES`, `MAX_INSTANCES`, `AVAILABILITY_ZONE_COUNT`, `HEAT_ENVIRONMENT_ARTIFACT_UUID`, `VOL_ENVIRONMENT_ARTIFACT_UUID`, `CREATION_TIMESTAMP`, `VF_MODULE_MODEL_UUID`) VALUES ('9b339a61-69ca-465f-86b8-1c72c582b8e8', 'base_vmme', 1, 1, 1, NULL, 'f4a21b58-5654-4cf6-9c50-de42004fe2b4', '3375f64b-4709-4802-8713-7a164763f9cd', '2018-05-13 12:12:09', '207fe0dc-4c89-4e5d-9a78-345e99ef7fbe');
+
+
+
+
+
+
+
+
diff --git a/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml b/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
new file mode 100644
index 0000000000..0611e62f3d
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
@@ -0,0 +1,52 @@
+<!--
+ ============LICENSE_START=======================================================
+ ECOMP MSO
+ ================================================================================
+ 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 >
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level
+ %logger{1024} - %msg%n
+ </pattern>
+ </encoder>
+ </appender>
+
+
+ <logger name="com.att.eelf.audit" level="INFO" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="com.att.eelf.metrics" level="INFO" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="com.att.eelf.error" level="WARN" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <root level="WARN">
+ <appender-ref ref="STDOUT" />
+ </root>
+
+</configuration>
diff --git a/adapters/mso-openstack-adapters/src/test/resources/mso.properties b/adapters/mso-openstack-adapters/src/test/resources/mso.properties
new file mode 100644
index 0000000000..d58521f1db
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/mso.properties
@@ -0,0 +1,27 @@
+###
+# ============LICENSE_START=======================================================
+# ECOMP MSO
+# ================================================================================
+# 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=========================================================
+###
+
+ecomp.mso.cloud.1.cloudId=MT
+ecomp.mso.cloud.1.keystoneUrl=http://localhost:5000/v2.0
+ecomp.mso.cloud.1.msoId=John
+ecomp.mso.cloud.1.publicNetId=FD205490A48D48475607C36B9AD902BF
+ecomp.mso.cloud.1.test=1234
+ecomp.mso.cloud.1.boolean=true
+ecomp.mso.cloud.1.enum=enum1
diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
new file mode 100644
index 0000000000..d24d16d577
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
@@ -0,0 +1,784 @@
+
+create table `allotted_resource` (
+ `model_uuid` varchar(200) not null,
+ `model_invariant_uuid` varchar(200) not null,
+ `model_version` varchar(20) not null,
+ `model_name` varchar(200) not null,
+ `tosca_node_type` varchar(200) default null,
+ `subcategory` varchar(200) default null,
+ `description` varchar(1200) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`model_uuid`)
+) engine=innodb default charset=latin1;
+
+
+
+
+create table `allotted_resource_customization` (
+ `model_customization_uuid` varchar(200) not null,
+ `model_instance_name` varchar(200) not null,
+ `providing_service_model_uuid` varchar(200) default null,
+ `providing_service_model_invariant_uuid` varchar(200) default null,
+ `providing_service_model_name` varchar(200) default null,
+ `target_network_role` varchar(200) default null,
+ `nf_type` varchar(200) default null,
+ `nf_role` varchar(200) default null,
+ `nf_function` varchar(200) default null,
+ `nf_naming_code` varchar(200) default null,
+ `min_instances` int(11) default null,
+ `max_instances` int(11) default null,
+ `ar_model_uuid` varchar(200) not null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`model_customization_uuid`),
+ key `fk_allotted_resource_customization__allotted_resource1_idx` (`ar_model_uuid`),
+ constraint `fk_allotted_resource_customization__allotted_resource1` foreign key (`ar_model_uuid`) references `allotted_resource` (`model_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+
+create table `heat_environment` (
+ `artifact_uuid` varchar(200) not null,
+ `name` varchar(100) not null,
+ `version` varchar(20) not null,
+ `description` varchar(1200) default null,
+ `body` longtext not null,
+ `artifact_checksum` varchar(200) not null default 'manual record',
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`artifact_uuid`)
+) engine=innodb default charset=latin1;
+
+
+
+create table `heat_files` (
+ `artifact_uuid` varchar(200) not null,
+ `name` varchar(200) not null,
+ `version` varchar(20) not null,
+ `description` varchar(1200) default null,
+ `body` longtext not null,
+ `artifact_checksum` varchar(200) not null default 'manual record',
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`artifact_uuid`)
+) engine=innodb default charset=latin1;
+
+
+
+
+create table `heat_template` (
+ `artifact_uuid` varchar(200) not null,
+ `name` varchar(200) not null,
+ `version` varchar(20) not null,
+ `description` varchar(1200) default null,
+ `body` longtext not null,
+ `timeout_minutes` int(11) default null,
+ `artifact_checksum` varchar(200) not null default 'manual record',
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`artifact_uuid`)
+) engine=innodb default charset=latin1;
+
+
+
+create table `heat_nested_template` (
+ `parent_heat_template_uuid` varchar(200) not null,
+ `child_heat_template_uuid` varchar(200) not null,
+ `provider_resource_file` varchar(100) default null,
+ primary key (`parent_heat_template_uuid`,`child_heat_template_uuid`),
+ key `fk_heat_nested_template__heat_template2_idx` (`child_heat_template_uuid`),
+ constraint `fk_heat_nested_template__child_heat_temp_uuid__heat_template1` foreign key (`child_heat_template_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade,
+ constraint `fk_heat_nested_template__parent_heat_temp_uuid__heat_template1` foreign key (`parent_heat_template_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+
+create table `heat_template_params` (
+ `heat_template_artifact_uuid` varchar(200) not null,
+ `param_name` varchar(100) not null,
+ `is_required` bit(1) not null,
+ `param_type` varchar(20) default null,
+ `param_alias` varchar(45) default null,
+ primary key (`heat_template_artifact_uuid`,`param_name`),
+ constraint `fk_heat_template_params__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+create table `network_recipe` (
+ `id` int(11) not null auto_increment,
+ `model_name` varchar(20) not null,
+ `action` varchar(50) not null,
+ `description` varchar(1200) default null,
+ `orchestration_uri` varchar(256) not null,
+ `network_param_xsd` varchar(2048) default null,
+ `recipe_timeout` int(11) default null,
+ `service_type` varchar(45) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ `version_str` varchar(20) not null,
+ primary key (`id`),
+ unique key `uk_rl4f296i0p8lyokxveaiwkayi` (`model_name`,`action`,`version_str`)
+) engine=innodb auto_increment=178 default charset=latin1;
+
+
+
+
+create table `temp_network_heat_template_lookup` (
+ `network_resource_model_name` varchar(200) not null,
+ `heat_template_artifact_uuid` varchar(200) not null,
+ `aic_version_min` varchar(20) not null,
+ `aic_version_max` varchar(20) default null,
+ primary key (`network_resource_model_name`),
+ key `fk_temp_network_heat_template_lookup__heat_template1_idx` (`heat_template_artifact_uuid`),
+ constraint `fk_temp_network_heat_template_lookup__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete no action on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+create table `network_resource` (
+ `model_uuid` varchar(200) not null,
+ `model_name` varchar(200) not null,
+ `model_invariant_uuid` varchar(200) default null,
+ `description` varchar(1200) default null,
+ `heat_template_artifact_uuid` varchar(200) not null,
+ `neutron_network_type` varchar(20) default null,
+ `model_version` varchar(20) default null,
+ `tosca_node_type` varchar(200) default null,
+ `aic_version_min` varchar(20) not null,
+ `aic_version_max` varchar(20) default null,
+ `orchestration_mode` varchar(20) default 'heat',
+ `resource_category` varchar(20) default null,
+ `resource_sub_category` varchar(20) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`model_uuid`),
+ key `fk_network_resource__temp_network_heat_template_lookup1_idx` (`model_name`),
+ key `fk_network_resource__heat_template1_idx` (`heat_template_artifact_uuid`),
+ constraint `fk_network_resource__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete no action on update cascade,
+ constraint `fk_network_resource__temp_network_heat_template_lookup__mod_nm1` foreign key (`model_name`) references `temp_network_heat_template_lookup` (`network_resource_model_name`) on delete no action on update no action
+) engine=innodb default charset=latin1;
+
+
+
+
+
+create table `network_resource_customization` (
+ `model_customization_uuid` varchar(200) not null,
+ `model_instance_name` varchar(200) not null,
+ `network_technology` varchar(45) default null,
+ `network_type` varchar(45) default null,
+ `network_role` varchar(200) default null,
+ `network_scope` varchar(45) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ `network_resource_model_uuid` varchar(200) not null,
+ primary key (`model_customization_uuid`),
+ key `fk_network_resource_customization__network_resource1_idx` (`network_resource_model_uuid`),
+ constraint `fk_network_resource_customization__network_resource1` foreign key (`network_resource_model_uuid`) references `network_resource` (`model_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+
+
+create table `tosca_csar` (
+ `artifact_uuid` varchar(200) not null,
+ `name` varchar(200) not null,
+ `version` varchar(20) not null,
+ `description` varchar(1200) default null,
+ `artifact_checksum` varchar(200) not null,
+ `url` varchar(200) not null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`artifact_uuid`)
+) engine=innodb default charset=latin1;
+
+
+
+
+create table `service` (
+ `model_uuid` varchar(200) not null,
+ `model_name` varchar(200) not null,
+ `model_invariant_uuid` varchar(200) not null,
+ `model_version` varchar(20) not null,
+ `description` varchar(1200) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ `tosca_csar_artifact_uuid` varchar(200) default null,
+ `service_type` varchar(200) default null,
+ `service_role` varchar(200) default null,
+ `environment_context` varchar(200) default null,
+ `workload_context` varchar(200) default null,
+ primary key (`model_uuid`),
+ key `fk_service__tosca_csar1_idx` (`tosca_csar_artifact_uuid`),
+ constraint `fk_service__tosca_csar1` foreign key (`tosca_csar_artifact_uuid`) references `tosca_csar` (`artifact_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+create table `service_recipe` (
+ `id` int(11) not null auto_increment,
+ `action` varchar(50) not null,
+ `version_str` varchar(20) default null,
+ `description` varchar(1200) default null,
+ `orchestration_uri` varchar(256) not null,
+ `service_param_xsd` varchar(2048) default null,
+ `recipe_timeout` int(11) default null,
+ `service_timeout_interim` int(11) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ `service_model_uuid` varchar(200) not null,
+ primary key (`id`),
+ unique key `uk_7fav5dkux2v8g9d2i5ymudlgc` (`service_model_uuid`,`action`),
+ key `fk_service_recipe__service1_idx` (`service_model_uuid`),
+ constraint `fk_service_recipe__service1` foreign key (`service_model_uuid`) references `service` (`model_uuid`) on delete cascade on update cascade
+) engine=innodb auto_increment=86 default charset=latin1;
+
+
+
+create table `vnf_resource` (
+ `orchestration_mode` varchar(20) not null default 'heat',
+ `description` varchar(1200) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ `model_uuid` varchar(200) not null,
+ `aic_version_min` varchar(20) default null,
+ `aic_version_max` varchar(20) default null,
+ `model_invariant_uuid` varchar(200) default null,
+ `model_version` varchar(20) not null,
+ `model_name` varchar(200) default null,
+ `tosca_node_type` varchar(200) default null,
+ `resource_category` varchar(200) default null,
+ `resource_sub_category` varchar(200) default null,
+ `heat_template_artifact_uuid` varchar(200) default null,
+ primary key (`model_uuid`),
+ key `fk_vnf_resource__heat_template1` (`heat_template_artifact_uuid`),
+ constraint `fk_vnf_resource__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+
+create table `vf_module` (
+ `model_uuid` varchar(200) not null,
+ `model_invariant_uuid` varchar(200) default null,
+ `model_version` varchar(20) not null,
+ `model_name` varchar(200) not null,
+ `description` varchar(1200) default null,
+ `is_base` int(11) not null,
+ `heat_template_artifact_uuid` varchar(200) default null,
+ `vol_heat_template_artifact_uuid` varchar(200) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ `vnf_resource_model_uuid` varchar(200) not null,
+ primary key (`model_uuid`,`vnf_resource_model_uuid`),
+ key `fk_vf_module__vnf_resource1_idx` (`vnf_resource_model_uuid`),
+ key `fk_vf_module__heat_template_art_uuid__heat_template1_idx` (`heat_template_artifact_uuid`),
+ key `fk_vf_module__vol_heat_template_art_uuid__heat_template2_idx` (`vol_heat_template_artifact_uuid`),
+ constraint `fk_vf_module__heat_template_art_uuid__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade,
+ constraint `fk_vf_module__vnf_resource1` foreign key (`vnf_resource_model_uuid`) references `vnf_resource` (`model_uuid`) on delete cascade on update cascade,
+ constraint `fk_vf_module__vol_heat_template_art_uuid__heat_template2` foreign key (`vol_heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+/*!40101 set @saved_cs_client = @@character_set_client */;
+/*!40101 set character_set_client = utf8 */;
+create table `vf_module_customization` (
+ `model_customization_uuid` varchar(200) not null,
+ `label` varchar(200) default null,
+ `initial_count` int(11) default '0',
+ `min_instances` int(11) default '0',
+ `max_instances` int(11) default null,
+ `availability_zone_count` int(11) default null,
+ `heat_environment_artifact_uuid` varchar(200) default null,
+ `vol_environment_artifact_uuid` varchar(200) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ `vf_module_model_uuid` varchar(200) not null,
+ primary key (`model_customization_uuid`),
+ key `fk_vf_module_customization__vf_module1_idx` (`vf_module_model_uuid`),
+ key `fk_vf_module_customization__heat_env__heat_environment1_idx` (`heat_environment_artifact_uuid`),
+ key `fk_vf_module_customization__vol_env__heat_environment2_idx` (`vol_environment_artifact_uuid`),
+ constraint `fk_vf_module_customization__heat_env__heat_environment1` foreign key (`heat_environment_artifact_uuid`) references `heat_environment` (`artifact_uuid`) on delete cascade on update cascade,
+ constraint `fk_vf_module_customization__vf_module1` foreign key (`vf_module_model_uuid`) references `vf_module` (`model_uuid`) on delete cascade on update cascade,
+ constraint `fk_vf_module_customization__vol_env__heat_environment2` foreign key (`vol_environment_artifact_uuid`) references `heat_environment` (`artifact_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+/*!40101 set character_set_client = @saved_cs_client */;
+
+
+
+
+
+create table `vf_module_to_heat_files` (
+ `vf_module_model_uuid` varchar(200) not null,
+ `heat_files_artifact_uuid` varchar(200) not null,
+ primary key (`vf_module_model_uuid`,`heat_files_artifact_uuid`),
+ key `fk_vf_module_to_heat_files__heat_files__artifact_uuid1_idx` (`heat_files_artifact_uuid`),
+ constraint `fk_vf_module_to_heat_files__heat_files__artifact_uuid1` foreign key (`heat_files_artifact_uuid`) references `heat_files` (`artifact_uuid`) on delete cascade on update cascade,
+ constraint `fk_vf_module_to_heat_files__vf_module__model_uuid1` foreign key (`vf_module_model_uuid`) references `vf_module` (`model_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1 comment='il fait ce qu''il dit';
+
+
+
+
+create table `vnf_components` (
+ `vnf_id` int(11) not null,
+ `component_type` varchar(20) not null,
+ `heat_template_id` int(11) default null,
+ `heat_environment_id` int(11) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`vnf_id`,`component_type`)
+) engine=innodb default charset=latin1;
+
+
+
+
+create table `vnf_components_recipe` (
+ `id` int(11) not null auto_increment,
+ `vnf_type` varchar(200) default null,
+ `vnf_component_type` varchar(45) not null,
+ `action` varchar(50) not null,
+ `service_type` varchar(45) default null,
+ `version` varchar(20) not null,
+ `description` varchar(1200) default null,
+ `orchestration_uri` varchar(256) not null,
+ `vnf_component_param_xsd` varchar(2048) default null,
+ `recipe_timeout` int(11) default null,
+ `creation_timestamp` datetime default current_timestamp,
+ `vf_module_model_uuid` varchar(200) default null,
+ primary key (`id`),
+ unique key `uk_4dpdwddaaclhc11wxsb7h59ma` (`vf_module_model_uuid`,`vnf_component_type`,`action`,`version`)
+) engine=innodb auto_increment=26 default charset=latin1;
+
+
+
+
+create table `vnf_recipe` (
+ `id` int(11) not null auto_increment,
+ `vnf_type` varchar(200) default null,
+ `action` varchar(50) not null,
+ `service_type` varchar(45) default null,
+ `version_str` varchar(20) not null,
+ `description` varchar(1200) default null,
+ `orchestration_uri` varchar(256) not null,
+ `vnf_param_xsd` varchar(2048) default null,
+ `recipe_timeout` int(11) default null,
+ `creation_timestamp` datetime default current_timestamp,
+ `vf_module_id` varchar(100) default null,
+ primary key (`id`),
+ unique key `uk_f3tvqau498vrifq3cr8qnigkr` (`vf_module_id`,`action`,`version_str`)
+) engine=innodb auto_increment=10006 default charset=latin1;
+
+
+ALTER TABLE `catalogdb`.`vnf_recipe`
+CHANGE COLUMN `VNF_TYPE` `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL ;
+
+
+
+
+
+create table `vnf_resource_customization` (
+ `model_customization_uuid` varchar(200) not null,
+ `model_instance_name` varchar(200) not null,
+ `min_instances` int(11) default null,
+ `max_instances` int(11) default null,
+ `availability_zone_max_count` int(11) default null,
+ `nf_type` varchar(200) default null,
+ `nf_role` varchar(200) default null,
+ `nf_function` varchar(200) default null,
+ `nf_naming_code` varchar(200) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ `vnf_resource_model_uuid` varchar(200) not null,
+ `multi_stage_design` varchar(20) default null,
+ primary key (`model_customization_uuid`),
+ key `fk_vnf_resource_customization__vnf_resource1_idx` (`vnf_resource_model_uuid`),
+ constraint `fk_vnf_resource_customization__vnf_resource1` foreign key (`vnf_resource_model_uuid`) references `vnf_resource` (`model_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+
+create table `vnf_res_custom_to_vf_module_custom` (
+ `vnf_resource_cust_model_customization_uuid` varchar(200) not null,
+ `vf_module_cust_model_customization_uuid` varchar(200) not null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`vnf_resource_cust_model_customization_uuid`,`vf_module_cust_model_customization_uuid`),
+ key `fk_vnf_res_custom_to_vf_module_custom__vf_module_customizat_idx` (`vf_module_cust_model_customization_uuid`),
+ constraint `fk_vnf_res_custom_to_vf_module_custom__vf_module_customization1` foreign key (`vf_module_cust_model_customization_uuid`) references `vf_module_customization` (`model_customization_uuid`) on delete cascade on update cascade,
+ constraint `fk_vnf_res_custom_to_vf_module_custom__vnf_resource_customiza1` foreign key (`vnf_resource_cust_model_customization_uuid`) references `vnf_resource_customization` (`model_customization_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+create table if not exists external_service_to_internal_model_mapping (
+id int(11) not null,
+service_name varchar(200) not null,
+product_flavor varchar(200) null,
+subscription_service_type varchar(200) not null,
+service_model_uuid varchar(200) not null,
+primary key (id),
+unique index uk_external_service_to_internal_model_mapping
+(service_name asc, product_flavor asc, service_model_uuid asc));
+
+create table if not exists `collection_resource` (
+ model_uuid varchar(200) not null,
+ model_name varchar(200) not null,
+ model_invariant_uuid varchar(200) not null,
+ model_version varchar(20) not null,
+ tosca_node_type varchar(200) not null,
+ description varchar(200),
+ creation_timestamp datetime not null default current_timestamp,
+ primary key (`model_uuid`)
+)engine=innodb default charset=latin1;
+
+create table if not exists `collection_resource_customization` (
+ model_customization_uuid varchar(200) not null,
+ model_instance_name varchar(200) not null,
+ role varchar(200) NULL,
+ object_type varchar(200) not null,
+ function varchar(200) NULL,
+ collection_resource_type varchar(200) NULL,
+ creation_timestamp datetime not null default current_timestamp,
+ cr_model_uuid varchar(200) not null,
+ primary key (`model_customization_uuid`)
+)engine=innodb default charset=latin1;
+
+create table if not exists `instance_group` (
+ model_uuid varchar(200) not null,
+ model_name varchar(200) not null,
+ model_invariant_uuid varchar(200) not null,
+ model_version varchar(20) not null,
+ tosca_node_type varchar(200) NULL,
+ role varchar(200) not null,
+ object_type varchar(200) not null,
+ creation_timestamp datetime not null default current_timestamp,
+ cr_model_uuid varchar(200) not null,
+ instance_group_type varchar(200) not null,
+ primary key (`model_uuid`)
+)engine=innodb default charset=latin1;
+
+create table if not exists `collection_resource_instance_group_customization` (
+ `collection_resource_customization_model_uuid` varchar(200) not null,
+ `instance_group_model_uuid` varchar(200) not null,
+ `function` varchar(200) null,
+ `description` varchar(1200) null,
+ `subinterface_network_quantity` int(11) null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`collection_resource_customization_model_uuid`, `instance_group_model_uuid`),
+ index `fk_collection_resource_instance_group_customization__instan_idx` (`instance_group_model_uuid` asc),
+ constraint `fk_collection_resource_instance_group_customization__collecti1`
+ foreign key (`collection_resource_customization_model_uuid`)
+ references `collection_resource_customization` (`model_customization_uuid`)
+ on delete cascade
+ on update cascade,
+ constraint `fk_collection_resource_instance_group_customization__instance1`
+ foreign key (`instance_group_model_uuid`)
+ references `instance_group` (`model_uuid`)
+ on delete cascade
+ on update cascade)
+engine = innodb
+default character set = latin1;
+
+create table if not exists `vnfc_instance_group_customization` (
+ `vnf_resource_customization_model_uuid` varchar(200) not null,
+ `instance_group_model_uuid` varchar(200) not null,
+ `function` varchar(200) null,
+ `description` varchar(1200) null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`vnf_resource_customization_model_uuid`, `instance_group_model_uuid`),
+ index `fk_vnfc_instance_group_customization__instance_group1_idx` (`instance_group_model_uuid` asc),
+ constraint `fk_vnfc_instance_group_customization__vnf_resource_customizat1`
+ foreign key (`vnf_resource_customization_model_uuid`)
+ references `vnf_resource_customization` (`model_customization_uuid`)
+ on delete cascade
+ on update cascade,
+ constraint `fk_vnfc_instance_group_customization__instance_group1`
+ foreign key (`instance_group_model_uuid`)
+ references `instance_group` (`model_uuid`)
+ on delete cascade
+ on update cascade)
+engine = innodb
+default character set = latin1;
+
+ create table if not exists `configuration`
+ ( `model_uuid` varchar(200) not null,
+ `model_invariant_uuid` varchar(200) not null,
+ `model_version` varchar(20) not null,
+ `model_name` varchar(200) not null,
+ `tosca_node_type` varchar(200) not null,
+ `description` varchar(1200) null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`model_uuid`))
+ engine = innodb auto_increment = 20654
+ default character set = latin1;
+
+ create table if not exists `service_proxy` (
+ `model_uuid` varchar(200) not null,
+ `model_invariant_uuid` varchar(200) not null,
+ `model_version` varchar(20) not null,
+ `model_name` varchar(200) not null,
+ `description` varchar(1200) null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`model_uuid`))
+ engine = innodb auto_increment = 20654
+ default character set = latin1;
+
+create table if not exists `service_proxy_customization` (
+`model_customization_uuid` varchar(200) not null,
+`model_instance_name` varchar(200) not null,
+`tosca_node_type` varchar(200) not null,
+`source_service_model_uuid` varchar(200) not null,
+`creation_timestamp` datetime not null default current_timestamp,
+`service_proxy_model_uuid` varchar(200) not null,
+primary key (`model_customization_uuid`),
+index `fk_service_proxy_customization__service_proxy1_idx` (`service_proxy_model_uuid` asc),
+index `fk_service_proxy_customization__service1_idx` (`source_service_model_uuid` asc),
+constraint`fk_spr_customization__service_proxy_resource1`
+foreign key (`service_proxy_model_uuid`) references `service_proxy` (`model_uuid`)
+on delete cascade on update cascade,
+constraint `fk_service_proxy_resource_customization__service1`
+foreign key (`source_service_model_uuid`) references `service`
+(`model_uuid`) on delete cascade on update cascade)
+engine = innodb
+auto_increment = 20654
+default character set = latin1;
+
+create table if not exists `configuration_customization` (
+`model_customization_uuid` varchar(200) not null,
+`model_instance_name` varchar(200) not null,
+`configuration_type` varchar(200) null,
+`configuration_role` varchar(200) null,
+`configuration_function` varchar(200) null,
+`creation_timestamp` datetime not null default current_timestamp,
+`configuration_model_uuid` varchar(200) not null,
+`service_proxy_customization_model_customization_uuid` varchar(200) null,
+`configuration_customization_model_customization_uuid` varchar(200) null,
+primary key (`model_customization_uuid`),
+index `fk_configuration_customization__configuration_idx` (`configuration_model_uuid` asc),
+index `fk_configuration_customization__service_proxy_customization_idx`
+(`service_proxy_customization_model_customization_uuid` asc),
+index `fk_configuration_customization__configuration_customization_idx`
+(`configuration_customization_model_customization_uuid` asc),
+constraint `fk_configuration_resource_customization__configuration_resour1`
+foreign key (`configuration_model_uuid`) references `configuration` (`model_uuid`)
+on delete cascade on update cascade,
+constraint `fk_configuration_customization__service_proxy_customization1` foreign
+key (`service_proxy_customization_model_customization_uuid`) references
+`service_proxy_customization` (`model_customization_uuid`)
+on delete cascade on update cascade, constraint
+`fk_configuration_customization__configuration_customization1` foreign
+key (`configuration_customization_model_customization_uuid`) references
+`configuration_customization` (`model_customization_uuid`)
+on delete cascade on update cascade)
+engine = innodb
+auto_increment =20654
+default character set = latin1;
+
+
+create table `service_proxy_customization_to_service` (
+ `service_model_uuid` varchar(200) not null,
+ `resource_model_customization_uuid` varchar(200) not null,
+ primary key (`service_model_uuid`,`resource_model_customization_uuid`)
+)engine=innodb default charset=latin1;
+
+
+create table `configuration_customization_to_service` (
+ `service_model_uuid` varchar(200) not null,
+ `resource_model_customization_uuid` varchar(200) not null,
+ primary key (`service_model_uuid`,`resource_model_customization_uuid`)
+)engine=innodb default charset=latin1;
+
+
+create table if not exists `collection_resource_customization_to_service` (
+ `service_model_uuid` varchar(200) not null,
+ `resource_model_customization_uuid` varchar(200) not null,
+ primary key (`service_model_uuid`,`resource_model_customization_uuid`)
+)engine=innodb default charset=latin1;
+
+
+create table `network_resource_customization_to_service` (
+ `service_model_uuid` varchar(200) not null,
+ `resource_model_customization_uuid` varchar(200) not null,
+ primary key (`service_model_uuid`,`resource_model_customization_uuid`)
+)engine=innodb default charset=latin1;
+
+create table `vnf_resource_customization_to_service` (
+ `service_model_uuid` varchar(200) not null,
+ `resource_model_customization_uuid` varchar(200) not null,
+ primary key (`service_model_uuid`,`resource_model_customization_uuid`)
+)engine=innodb default charset=latin1;
+
+create table `allotted_resource_customization_to_service` (
+ `service_model_uuid` varchar(200) not null,
+ `resource_model_customization_uuid` varchar(200) not null,
+ primary key (`service_model_uuid`,`resource_model_customization_uuid`)
+)engine=innodb default charset=latin1;
+
+
+alter table collection_resource_customization
+add foreign key ( cr_model_uuid)
+references collection_resource(model_uuid)
+on delete cascade;
+
+alter table vnf_resource_customization
+add column
+instance_group_model_uuid varchar(200);
+
+alter table network_resource_customization
+add column
+instance_group_model_uuid varchar(200);
+
+
+alter table network_resource_customization
+add foreign key ( instance_group_model_uuid)
+references instance_group(model_uuid)
+on delete cascade;
+
+alter table collection_resource_customization_to_service
+add foreign key (service_model_uuid)
+references service(model_uuid)
+on delete cascade;
+
+alter table allotted_resource_customization_to_service
+add foreign key (service_model_uuid)
+references service(model_uuid)
+on delete cascade;
+
+
+alter table vnf_resource_customization_to_service
+add foreign key (service_model_uuid)
+references service(model_uuid)
+on delete cascade;
+
+
+alter table network_resource_customization_to_service
+add foreign key (service_model_uuid)
+references service(model_uuid)
+on delete cascade;
+
+
+alter table network_resource_customization_to_service
+add foreign key (resource_model_customization_uuid)
+references network_resource_customization(model_customization_uuid)
+on delete cascade;
+
+alter table vnf_resource_customization_to_service
+add foreign key (resource_model_customization_uuid)
+references vnf_resource_customization(model_customization_uuid)
+on delete cascade;
+
+alter table allotted_resource_customization_to_service
+add foreign key (resource_model_customization_uuid)
+references allotted_resource_customization(model_customization_uuid)
+on delete cascade;
+
+alter table collection_resource_customization_to_service
+add foreign key (resource_model_customization_uuid)
+references collection_resource_customization(model_customization_uuid)
+on delete cascade;
+
+create table ar_recipe (
+ ID INT(11) not null auto_increment,
+ MODEL_NAME VARCHAR(200) NOT NULL,
+ `ACTION` VARCHAR(200) NOT NULL,
+ VERSION_STR VARCHAR(200) NOT NULL,
+ SERVICE_TYPE VARCHAR(200),
+ DESCRIPTION VARCHAR(200),
+ ORCHESTRATION_URI VARCHAR(200) NOT NULL,
+ AR_PARAM_XSD VARCHAR(200),
+ RECIPE_TIMEOUT INT(10),
+ CREATION_TIMESTAMP DATETIME NOT NULL default current_timestamp,
+ primary key (ID),
+ unique key `uk_ar_recipe` (`model_name`,`action`,`version_str`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+create table if not exists `collection_network_resource_customization` (
+`model_customization_uuid` varchar(200) not null,
+`model_instance_name` varchar(200) not null,
+`network_technology` varchar(45) null,
+`network_type` varchar(45) null,
+`network_role` varchar(200) null,
+`network_scope` varchar(45) null,
+`creation_timestamp` datetime not null default current_timestamp,
+`network_resource_model_uuid` varchar(200) not null, `instance_group_model_uuid` varchar(200) null,
+`crc_model_customization_uuid` varchar(200) not null, primary key
+(`model_customization_uuid`, `crc_model_customization_uuid`),
+index `fk_collection_net_resource_customization__network_resource1_idx`
+(`network_resource_model_uuid` asc), index
+`fk_collection_net_resource_customization__instance_group1_idx`
+(`instance_group_model_uuid` asc), index
+`fk_col_net_res_customization__collection_res_customization_idx`
+(`crc_model_customization_uuid` asc), constraint
+`fk_collection_net_resource_customization__network_resource10` foreign
+key (`network_resource_model_uuid`) references
+`network_resource` (`model_uuid`) on delete cascade on
+update cascade, constraint
+`fk_collection_net_resource_customization__instance_group10` foreign key
+(`instance_group_model_uuid`) references `instance_group`
+(`model_uuid`) on delete cascade on update cascade, constraint
+`fk_collection_network_resource_customization__collection_reso1` foreign
+key (`crc_model_customization_uuid`) references
+`collection_resource_customization`
+(`model_customization_uuid`) on delete cascade on update cascade) engine
+= innodb default character set = latin1;
+
+CREATE TABLE IF NOT EXISTS `northbound_request_ref_lookup` (
+`id` INT(11) NOT NULL AUTO_INCREMENT,
+`REQUEST_SCOPE` VARCHAR(200) NOT NULL,
+`ACTION` VARCHAR(200) NOT NULL,
+`MACRO_ACTION` VARCHAR(200) NOT NULL,
+`IS_ALACARTE` TINYINT(1) NOT NULL DEFAULT 0,
+`IS_TOPLEVELFLOW` TINYINT(1) NOT NULL DEFAULT 0,
+`MIN_API_VERSION` DOUBLE NOT NULL,
+`MAX_API_VERSION` DOUBLE NULL,
+PRIMARY KEY (`id`),
+UNIQUE INDEX `UK_northbound_request_ref_lookup` (`MIN_API_VERSION` ASC, `REQUEST_SCOPE` ASC, `ACTION` ASC, `IS_ALACARTE` ASC))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `orchestration_flow_reference` (
+`id` INT(11) NOT NULL AUTO_INCREMENT,
+`COMPOSITE_ACTION` VARCHAR(200) NOT NULL,
+`SEQ_NO` INT(11) NOT NULL,
+`FLOW_NAME` VARCHAR(200) NOT NULL,
+`FLOW_VERSION` DOUBLE NOT NULL,
+`NB_REQ_REF_LOOKUP_ID` INT(11) NOT NULL,
+PRIMARY KEY (`id`),
+INDEX `fk_orchestration_flow_reference__northbound_req_ref_look_idx` (`NB_REQ_REF_LOOKUP_ID` ASC),
+UNIQUE INDEX `UK_orchestration_flow_reference` (`COMPOSITE_ACTION` ASC, `FLOW_NAME` ASC, `SEQ_NO` ASC, `NB_REQ_REF_LOOKUP_ID` ASC),
+CONSTRAINT `fk_orchestration_flow_reference__northbound_request_ref_look1`
+FOREIGN KEY (`NB_REQ_REF_LOOKUP_ID`) REFERENCES `northbound_request_ref_lookup` (`id`)
+ON DELETE CASCADE ON UPDATE CASCADE)
+ENGINE = InnoDB DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `rainy_day_handler_macro` (
+`id` INT(11) NOT NULL AUTO_INCREMENT,
+`FLOW_NAME` VARCHAR(200) NOT NULL,
+`SERVICE_TYPE` VARCHAR(200) NOT NULL,
+`VNF_TYPE` VARCHAR(200) NOT NULL,
+`ERROR_CODE` VARCHAR(200) NOT NULL,
+`WORK_STEP` VARCHAR(200) NOT NULL,
+`POLICY` VARCHAR(200) NOT NULL,
+PRIMARY KEY (`id`))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+create table if not exists model_recipe (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `MODEL_ID` INT(11),
+ `ACTION` VARCHAR(40),
+ `SCHEMA_VERSION` VARCHAR(40),
+ `DESCRIPTION` VARCHAR(40),
+ `ORCHESTRATION_URI` VARCHAR(20),
+ `MODEL_PARAM_XSD` VARCHAR(20),
+ `RECIPE_TIMEOUT` INT(11),
+ `CREATION_TIMESTAMP` datetime not null default current_timestamp,
+ PRIMARY KEY (`ID`),
+ CONSTRAINT uk1_model_recipe UNIQUE (`MODEL_ID`, `ACTION`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+create table if not exists model (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `MODEL_CUSTOMIZATION_ID` VARCHAR(40),
+ `MODEL_CUSTOMIZATION_NAME` VARCHAR(40),
+ `MODEL_INVARIANT_ID` VARCHAR(40),
+ `MODEL_NAME` VARCHAR(40),
+ `MODEL_TYPE` VARCHAR(20),
+ `MODEL_VERSION` VARCHAR(20),
+ `MODEL_VERSION_ID` VARCHAR(40),
+ `CREATION_TIMESTAMP` datetime not null default current_timestamp,
+ `RECIPE` INT(11),
+ PRIMARY KEY (`ID`),
+ CONSTRAINT uk1_model UNIQUE (`MODEL_TYPE`, `MODEL_VERSION_ID`),
+ FOREIGN KEY (`RECIPE`) REFERENCES `model_recipe` (`MODEL_ID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file