diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test/groovy/org')
5 files changed, 1830 insertions, 1765 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy index 7d698f8916..914725ca1f 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy @@ -1,318 +1,306 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - 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========================================================= - */ - -package org.openecomp.mso.bpmn.common.scripts; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.* - -import org.openecomp.mso.rest.HttpHeader -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.junit.Before -import org.openecomp.mso.bpmn.common.scripts.AaiUtil; -import org.junit.Rule; -import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.Before; -import org.junit.Test; -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl -import org.camunda.bpm.engine.repository.ProcessDefinition - -@RunWith(MockitoJUnitRunner.class) -class AaiUtilTest extends MsoGroovyTest { - - @Test - public void testGetVersionDefault() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') - assertEquals('8', version) - } - - @Test - public void testGetVersionResourceSpecific() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_l3_network_version")).thenReturn('7') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') - assertEquals('7', version) - } - - @Test - public void testGetVersionFlowSpecific() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_custom_CreateAAIVfModule_aai_version")).thenReturn('6') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_l3_network_version")).thenReturn('7') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') - assertEquals('6', version) - } - - @Test(expected=java.lang.Exception.class) - public void testGetVersionNotDefined() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') - } - - @Test - public void testGetUriDefaultVersion() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getUri(mockExecution, 'l3-network') - assertEquals('/aai/v8/network/l3-networks/l3-network', uri) - } - - @Test - public void testGetUriFlowAndResourceSpecific() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_CreateAAIVfModule_aai_l3_network_uri")).thenReturn('/aai/v6/network/l3-networks/l3-network') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getUri(mockExecution, 'l3-network') - assertEquals('/aai/v6/network/l3-networks/l3-network', uri) - } - - @Test - public void testGetNetworkGenericVnfEndpoint() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_vnf_uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') - when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def endpoint = aaiUtil.getNetworkGenericVnfEndpoint(mockExecution) - assertEquals('http://localhost:28090/aai/v8/network/generic-vnfs/generic-vnf', endpoint) - } - - @Test - public void testGetNetworkGenericVnfUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_vnf_uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkGenericVnfUri(mockExecution) - assertEquals('/aai/v8/network/generic-vnfs/generic-vnf', uri) - } - - @Test - public void testGetNetworkVpnBindingUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vpn_binding_uri")).thenReturn('/aai/v8/network/vpn-bindings/vpn-binding') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkVpnBindingUri(mockExecution) - assertEquals('/aai/v8/network/vpn-bindings/vpn-binding', uri) - } - - @Test - public void testGetNetworkPolicyUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_network_policy_uri")).thenReturn('/aai/v8/network/network-policies/network-policy') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkPolicyUri(mockExecution) - assertEquals('/aai/v8/network/network-policies/network-policy', uri) - } - - @Test - public void testGetNetworkTableReferencesUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_route_table_reference_uri")).thenReturn('/aai/v8/network/route-table-references/route-table-reference') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkTableReferencesUri(mockExecution) - assertEquals('/aai/v8/network/route-table-references/route-table-reference', uri) - } - - @Test - public void testGetNetworkVceUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vce_uri")).thenReturn('/aai/v8/network/vces/vce') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkVceUri(mockExecution) - assertEquals('/aai/v8/network/vces/vce', uri) - } - - @Test - public void testGetNetworkL3NetworkUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) - assertEquals('/aai/v8/network/l3-networks/l3-network', uri) - } - - @Test - public void testGetBusinessCustomerUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_customer_uri")).thenReturn('/aai/v8/business/customers/customer') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getBusinessCustomerUri(mockExecution) - assertEquals('/aai/v8/business/customers/customer', uri) - } - - @Test - public void testGetCloudInfrastructureCloudRegionEndpoint() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic') - when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(mockExecution) - assertEquals('http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri) - } - - @Test - public void testGetCloudInfrastructureCloudRegionUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getCloudInfrastructureCloudRegionUri(mockExecution) - assertEquals('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri) - } - - @Test - public void testGetCloudInfrastructureVolumeGroupUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_volume_group_uri")).thenReturn('/aai/v8/cloud-infrastructure/volume-groups/volume-group') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getCloudInfrastructureVolumeGroupUri(mockExecution) - assertEquals('/aai/v8/cloud-infrastructure/volume-groups/volume-group', uri) - } - - @Test - public void testGetCloudInfrastructureTenantUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_tenant_uri")).thenReturn('/aai/v8/cloud-infrastructure/tenants/tenant') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getCloudInfrastructureTenantUri(mockExecution) - assertEquals('/aai/v8/cloud-infrastructure/tenants/tenant', uri) - } - - @Test - public void testGetSearchNodesQueryUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_nodes_query_uri")).thenReturn('/aai/v8/search/nodes-query') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getSearchNodesQueryUri(mockExecution) - assertEquals('/aai/v8/search/nodes-query', uri) - } - - @Test - public void testGetSearchNodesQueryEndpoint() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_nodes_query_uri")).thenReturn('/aai/v8/search/nodes-query') - when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getSearchNodesQueryEndpoint(mockExecution) - assertEquals('http://localhost:28090/aai/v8/search/nodes-query', uri) - } - - @Test - public void testGetSearchGenericQueryUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') - when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_query_uri")).thenReturn('/aai/v8/search/generic-query') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getSearchGenericQueryUri(mockExecution) - assertEquals('/aai/v8/search/generic-query', uri) - } - - @Test - public void testGetNamespaceFromUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def ns = aaiUtil.getNamespaceFromUri('/aai/v6/search/generic-query') - assertEquals('http://org.openecomp.aai.inventory/v6', ns) - } - -} +/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - 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=========================================================
+ */
+
+package org.openecomp.mso.bpmn.common.scripts;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*
+
+import org.openecomp.mso.rest.HttpHeader
+import org.mockito.MockitoAnnotations
+import org.mockito.runners.MockitoJUnitRunner
+import org.mockito.internal.debugging.MockitoDebuggerImpl
+import org.junit.Before
+import org.openecomp.mso.bpmn.common.scripts.AaiUtil;
+import org.junit.Rule;
+import org.junit.Test
+import org.junit.Ignore
+import org.junit.runner.RunWith
+import org.junit.Before;
+import org.junit.Test;
+import org.camunda.bpm.engine.ProcessEngineServices
+import org.camunda.bpm.engine.RepositoryService
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl
+import org.camunda.bpm.engine.repository.ProcessDefinition
+
+@RunWith(MockitoJUnitRunner.class)
+class AaiUtilTest extends MsoGroovyTest {
+
+ @Test
+ public void testGetVersionDefault() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule')
+ assertEquals('8', version)
+ }
+
+ @Test
+ public void testGetVersionResourceSpecific() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_l3_network_version")).thenReturn('7')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule')
+ assertEquals('7', version)
+ }
+
+ @Test
+ public void testGetVersionFlowSpecific() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_custom_CreateAAIVfModule_aai_version")).thenReturn('6')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_l3_network_version")).thenReturn('7')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule')
+ assertEquals('6', version)
+ }
+
+ @Test(expected=java.lang.Exception.class)
+ public void testGetVersionNotDefined() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule')
+ }
+
+ @Test
+ public void testGetUriDefaultVersion() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn('/aai/v8/network/l3-networks/l3-network')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def uri = aaiUtil.getUri(mockExecution, 'l3-network')
+ assertEquals('/aai/v8/network/l3-networks/l3-network', uri)
+ }
+
+ @Test
+ public void testGetUriFlowAndResourceSpecific() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_CreateAAIVfModule_aai_l3_network_uri")).thenReturn('/aai/v6/network/l3-networks/l3-network')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn('/aai/v8/network/l3-networks/l3-network')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def uri = aaiUtil.getUri(mockExecution, 'l3-network')
+ assertEquals('/aai/v6/network/l3-networks/l3-network', uri)
+ }
+
+ @Test
+ public void testGetNetworkGenericVnfEndpoint() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_vnf_uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf')
+ when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090')
+
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def endpoint = aaiUtil.getNetworkGenericVnfEndpoint(mockExecution)
+ assertEquals('http://localhost:28090/aai/v8/network/generic-vnfs/generic-vnf', endpoint)
+ }
+
+ @Test
+ public void testGetNetworkGenericVnfUri() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_vnf_uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf')
+
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def uri = aaiUtil.getNetworkGenericVnfUri(mockExecution)
+ assertEquals('/aai/v8/network/generic-vnfs/generic-vnf', uri)
+ }
+
+ @Test
+ public void testGetNetworkVpnBindingUri() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vpn_binding_uri")).thenReturn('/aai/v8/network/vpn-bindings/vpn-binding')
+
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def uri = aaiUtil.getNetworkVpnBindingUri(mockExecution)
+ assertEquals('/aai/v8/network/vpn-bindings/vpn-binding', uri)
+ }
+
+ @Test
+ public void testGetNetworkPolicyUri() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_network_policy_uri")).thenReturn('/aai/v8/network/network-policies/network-policy')
+
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def uri = aaiUtil.getNetworkPolicyUri(mockExecution)
+ assertEquals('/aai/v8/network/network-policies/network-policy', uri)
+ }
+
+ @Test
+ public void testGetNetworkTableReferencesUri() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_route_table_reference_uri")).thenReturn('/aai/v8/network/route-table-references/route-table-reference')
+
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def uri = aaiUtil.getNetworkTableReferencesUri(mockExecution)
+ assertEquals('/aai/v8/network/route-table-references/route-table-reference', uri)
+ }
+
+ @Test
+ public void testGetNetworkVceUri() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vce_uri")).thenReturn('/aai/v8/network/vces/vce')
+
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def uri = aaiUtil.getNetworkVceUri(mockExecution)
+ assertEquals('/aai/v8/network/vces/vce', uri)
+ }
+
+ @Test
+ public void testGetNetworkL3NetworkUri() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn('/aai/v8/network/l3-networks/l3-network')
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution)
+ assertEquals('/aai/v8/network/l3-networks/l3-network', uri)
+ }
+
+ @Test
+ public void testGetBusinessCustomerUri() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_customer_uri")).thenReturn('/aai/v8/business/customers/customer')
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def uri = aaiUtil.getBusinessCustomerUri(mockExecution)
+ assertEquals('/aai/v8/business/customers/customer', uri)
+ }
+
+ @Test
+ public void testGetCloudInfrastructureCloudRegionEndpoint() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic')
+ when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090')
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def uri = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(mockExecution)
+ assertEquals('http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri)
+ }
+
+ @Test
+ public void testGetCloudInfrastructureCloudRegionUri() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic')
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def uri = aaiUtil.getCloudInfrastructureCloudRegionUri(mockExecution)
+ assertEquals('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri)
+ }
+
+ @Test
+ public void testGetCloudInfrastructureTenantUri() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_tenant_uri")).thenReturn('/aai/v8/cloud-infrastructure/tenants/tenant')
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def uri = aaiUtil.getCloudInfrastructureTenantUri(mockExecution)
+ assertEquals('/aai/v8/cloud-infrastructure/tenants/tenant', uri)
+ }
+
+ @Test
+ public void testGetSearchNodesQueryUri() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_nodes_query_uri")).thenReturn('/aai/v8/search/nodes-query')
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def uri = aaiUtil.getSearchNodesQueryUri(mockExecution)
+ assertEquals('/aai/v8/search/nodes-query', uri)
+ }
+
+ @Test
+ public void testGetSearchNodesQueryEndpoint() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_nodes_query_uri")).thenReturn('/aai/v8/search/nodes-query')
+ when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090')
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def uri = aaiUtil.getSearchNodesQueryEndpoint(mockExecution)
+ assertEquals('http://localhost:28090/aai/v8/search/nodes-query', uri)
+ }
+
+ @Test
+ public void testGetSearchGenericQueryUri() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
+ when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_query_uri")).thenReturn('/aai/v8/search/generic-query')
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def uri = aaiUtil.getSearchGenericQueryUri(mockExecution)
+ assertEquals('/aai/v8/search/generic-query', uri)
+ }
+
+ @Test
+ public void testGetNamespaceFromUri() {
+ ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
+ CreateAAIVfModule myproc = new CreateAAIVfModule()
+ AaiUtil aaiUtil = new AaiUtil(myproc)
+ def ns = aaiUtil.getNamespaceFromUri('/aai/v6/search/generic-query')
+ assertEquals('http://org.openecomp.aai.inventory/v6', ns)
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy index 98bbe7181e..a011ebb335 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy @@ -1,190 +1,66 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - 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========================================================= - */ - -package org.openecomp.mso.bpmn.common.scripts - -import org.junit.Assert -import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; - - -import org.junit.Ignore; - -import static org.mockito.Mockito.* - -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.junit.Before -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.mockito.runners.MockitoJUnitRunner -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -@RunWith(MockitoJUnitRunner.class) -import org.junit.Test - - - -class ExceptionUtilTest { - - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - @Test - public void testErrorMessageDetails() { - - - - String restFault = """ - <Fault> -<requestError> -<serviceException> -<messageId>SVC3002</messageId> -<text>Error writing output performing %1 on %2 (msg=%3) (ec=%4)</text> -<variables> -<variable>PUTcustomer</variable> -<variable>SubName01</variable> -<variable>Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id]</variable> -<variable>ERR.5.4.5105</variable> -</variables> -</serviceException> -</requestError> -</Fault> - """ - def errorString = """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> - <aetgt:ErrorMessage>Received error from A&AI (Error writing output performing PUTcustomer on SubName01 (msg=Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id]) (ec=ERR.5.4.5105))</aetgt:ErrorMessage> - <aetgt:ErrorCode>5000</aetgt:ErrorCode> - </aetgt:WorkflowException>""" as String - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - - ExceptionUtil util = new ExceptionUtil() - Assert.assertEquals(errorString, util.MapAAIExceptionToWorkflowExceptionOld(restFault, mockExecution)) - } - - - @Test - public void testErrorMessage() { - String restFault = """ - <rest:RESTFault xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - errorType="transport"> - <rest:errorCode>500</rest:errorCode> - <rest:message>HTTP method: GET Internal Server Error </rest:message> - </rest:RESTFault> - """ - def errorString = """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> - <aetgt:ErrorMessage>Received error from A&AI (HTTP method: GET Internal Server Error)</aetgt:ErrorMessage> - <aetgt:ErrorCode>5000</aetgt:ErrorCode> - </aetgt:WorkflowException>""" as String - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("prefix")).thenReturn("test_") - when(mockExecution.getVariable("test_ErrorResponse")).thenReturn("HTTP method: GET Internal Server Error") - - ExceptionUtil util = new ExceptionUtil() - String msg = "HTTP method: GET Internal Server Error" - Assert.assertEquals(errorString, util.MapAAIExceptionToWorkflowExceptionOld(restFault, mockExecution)) - } - - @Test - public void testBadResponseErrorMessage() { - String restFault = "asfafasfasfd" - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("prefix")).thenReturn("test_") - when(mockExecution.getVariable("test_ErrorResponse")).thenReturn(null) - ExceptionUtil util = new ExceptionUtil() - String expected = "<aetgt:WorkflowException xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\">"+ - "\n <aetgt:ErrorMessage>Received error from A&AI ()</aetgt:ErrorMessage>"+ - "\n <aetgt:ErrorCode>5000</aetgt:ErrorCode>"+ - "\n </aetgt:WorkflowException>"; - Assert.assertEquals(expected,util.MapAAIExceptionToWorkflowExceptionOld(restFault, mockExecution)) - } - - @Test - public void testMapErrorCode5010(){ - String msg = "Connect to njcdtl20ew2988:8070 failed: Connection refused: connect" - ExceptionUtil util = new ExceptionUtil() - Assert.assertEquals("5010",util.MapErrorCode(msg)) - } - - @Test - public void testMapErrorCode5020(){ - String msg = "Connection timed out" - ExceptionUtil util = new ExceptionUtil() - Assert.assertEquals("5020",util.MapErrorCode(msg)) - } - - @Test - public void testMapCategoryToErrorCode5100 () { - String errorCategory = "OPENSTACK" - ExceptionUtil util = new ExceptionUtil() - Assert.assertEquals('5100', util.MapCategoryToErrorCode(errorCategory)) - } - - @Test - public void testMapCategoryToErrorCode5110 () { - String errorCategory = "IO" - ExceptionUtil util = new ExceptionUtil() - Assert.assertEquals('5110', util.MapCategoryToErrorCode(errorCategory)) - } - - @Test - public void testMapCategoryToErrorCode7020 () { - String errorCategory = "USERDATA" - ExceptionUtil util = new ExceptionUtil() - Assert.assertEquals('7020', util.MapCategoryToErrorCode(errorCategory)) - } - - @Test - @Ignore - public void testMapAdapterExecptionToWorkflowException_UserDataErrorMessage () { - String response = """<ns2:TenantException xmlns:ns2=\"http://org.openecomp.mso/tenant\"><category>USERDATA</category><message>Cloud Site [CHCGILNE001] not found</message></ns2:TenantException>""" as String - String expected = """WorkflowException[processKey=ExceptionUtil,errorCode=7020,errorMessage=Received error from Tenant Adapter: Cloud Site [CHCGILNE001] not found]""" as String - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("prefix")).thenReturn("test_") - when(mockExecution.getVariable("testProcessKey")).thenReturn("ExceptionUtil") - - ExceptionUtil util = new ExceptionUtil() - String actual = util.MapAdapterExecptionToWorkflowException(response, mockExecution, "Tenant Adapter") - - verify(mockExecution).setVariable("WorkflowException",expected) - } - - @Test - @Ignore - public void testMapAdapterExecptionToWorkflowException_IOErrorMessage () { - String response = """<ns2:TenantException xmlns:ns2=\"http://org.openecomp.mso/tenant\"><category>IO</category><message>[TokenAuth] Connect to test.aic.cip.att.com:5000 [test.aic.cip.att.com/300.200.100.100] failed: Connection refused</message></ns2:TenantException>""" as String - String expected = """WorkflowException[processKey=ExceptionUtil,errorCode=5110,errorMessage=Could not communicate with Platform Orchestrator]""" as String - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("prefix")).thenReturn("test_") - when(mockExecution.getVariable("testProcessKey")).thenReturn("ExceptionUtil") - - ExceptionUtil util = new ExceptionUtil() - String actual = util.MapAdapterExecptionToWorkflowException(response, mockExecution, "Tenant Adapter") - - verify(mockExecution).setVariable("WorkflowException",expected) - } - -} +/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - 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=========================================================
+ */
+
+package org.openecomp.mso.bpmn.common.scripts
+
+import org.junit.Assert
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+
+import org.junit.Ignore;
+
+import static org.mockito.Mockito.*
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.runner.RunWith
+import org.mockito.MockitoAnnotations
+import org.mockito.internal.debugging.MockitoDebuggerImpl
+import org.mockito.runners.MockitoJUnitRunner
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil;
+@RunWith(MockitoJUnitRunner.class)
+import org.junit.Test
+
+
+
+class ExceptionUtilTest {
+
+
+ @Before
+ public void init()
+ {
+ MockitoAnnotations.initMocks(this)
+ }
+
+ @Test
+ public void testMapErrorCode5010(){
+ String msg = "Connect to njcdtl20ew2988:8070 failed: Connection refused: connect"
+ ExceptionUtil util = new ExceptionUtil()
+ Assert.assertEquals("5010",util.MapErrorCode(msg))
+ }
+
+ @Test
+ public void testMapErrorCode5020(){
+ String msg = "Connection timed out"
+ ExceptionUtil util = new ExceptionUtil()
+ Assert.assertEquals("5020",util.MapErrorCode(msg))
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy index 7f691ca1b8..fcc55d0933 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy @@ -1,311 +1,311 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - 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========================================================= - */ - -package org.openecomp.mso.bpmn.common.scripts - -import org.junit.runner.RunWith; -import static org.mockito.Mockito.* -import static org.junit.Assert.*; - -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.ArgumentCaptor; -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.openecomp.mso.bpmn.common.scripts.MsoUtils; -import org.openecomp.mso.bpmn.common.scripts.FalloutHandler; - -@RunWith(MockitoJUnitRunner.class) -class FalloutHandlerTest { - - public MsoUtils utils = new MsoUtils() - - @Before - public void init() { - MockitoAnnotations.initMocks(this) - } - - private String falloutHandlerRequest = """ - <sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1" xmlns:ns7="http://org.openecomp/mso/request/types/v1"> - <ns7:request-information> - <ns7:request-id>uCPE1020_STUW105_5002</ns7:request-id> - <ns7:request-action>Layer3ServiceActivateRequest</ns7:request-action> - <ns7:request-sub-action>CANCEL</ns7:request-sub-action> - <ns7:source>OMX</ns7:source> - <ns7:order-number>10205000</ns7:order-number> - <ns7:order-version>1</ns7:order-version> - </ns7:request-information> - <sdncadapterworkflow:WorkflowException> - <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage> - <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode> - <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode> - </sdncadapterworkflow:WorkflowException> - </sdncadapterworkflow:FalloutHandlerRequest> - """ - - private String falloutHandlerResponse = """<workflow:FalloutHandlerResponse xmlns:workflow="http://org.openecomp/mso/workflow/schema/v1"> - <workflow:out>Fallout Handler Failed</workflow:out> -</workflow:FalloutHandlerResponse>""" - - @Test - public void testPreProcessRequest() { - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - - when(mockExecution.getVariable("FalloutHandlerRequest")).thenReturn(falloutHandlerRequest) - when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); - - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.preProcessRequest(mockExecution) - - /* Initialize all the process request variables in this block */ - verify(mockExecution).setVariable("prefix","FH_") - //verify(mockExecution).setVariable("getLayer3ServiceDetailsV1Response","") - - //These variables are form the input Message to the BPMN - verify(mockExecution).setVariable("FH_request_id","") - verify(mockExecution).setVariable("FH_request_action","") - verify(mockExecution).setVariable("FH_notification-url","") - verify(mockExecution).setVariable("FH_mso-bpel-name","") - verify(mockExecution).setVariable("FH_ErrorCode", "") - verify(mockExecution).setVariable("FH_ErrorMessage", "") - - verify(mockExecution).setVariable("FH_notification-url-Ok", false) - verify(mockExecution).setVariable("FH_request_id-Ok", false) - - //These variables are for Get Mso Aai Password Adapter - verify(mockExecution).setVariable("FH_deliveryStatus", true) - - //update Response Status to pending ...Adapter variables - verify(mockExecution).setVariable("FH_updateResponseStatusPayload", null) - verify(mockExecution).setVariable("FH_updateResponseStatusResponse", null) - - //update Request Gamma ...Adapter variables - verify(mockExecution).setVariable("FH_updateRequestGammaPayload", "") - verify(mockExecution).setVariable("FH_updateRequestGammaResponse", null) - verify(mockExecution).setVariable("FH_updateRequestGammaResponseCode", null) - - //update Request Infra ...Adapter variables - verify(mockExecution).setVariable("FH_updateRequestInfraPayload", "") - verify(mockExecution).setVariable("FH_updateRequestInfraResponse", null) - verify(mockExecution).setVariable("FH_updateRequestInfraResponseCode", null) - - //assign False to success variable - verify(mockExecution).setVariable("FH_success", true) - - //Set notify status to Failed variable - verify(mockExecution).setVariable("FH_NOTIFY_STATUS", "SUCCESS") - - //Set DB update variable - verify(mockExecution).setVariable("FH_updateRequestPayload", "") - verify(mockExecution).setVariable("FH_updateRequestResponse", null) - verify(mockExecution).setVariable("FH_updateRequestResponseCode", null) - - //Auth variables - verify(mockExecution).setVariable("BasicAuthHeaderValue","") - - //Response variables - verify(mockExecution).setVariable("FalloutHandlerResponse","") - verify(mockExecution).setVariable("FH_ErrorResponse", null) - verify(mockExecution).setVariable("FH_ResponseCode", "") - - verify(mockExecution).setVariable("FH_request_id-Ok",true) - verify(mockExecution).setVariable("FH_request_id","uCPE1020_STUW105_5002") - verify(mockExecution).setVariable("FH_request_action","Layer3ServiceActivateRequest") - verify(mockExecution).setVariable("FH_source","OMX") - verify(mockExecution).setVariable("FH_ErrorCode","Some Error Code - Fallout Handler") - verify(mockExecution).setVariable("FH_ErrorMessage","Some Error Message - Fallout Handler") - - } - - @Test - public void testpostProcessResponse(){ - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("FH_success")).thenReturn(false) - - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.postProcessResponse(mockExecution) - - // Capture the arguments to setVariable - ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class); - ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class); - - verify(mockExecution, times(4)).setVariable(captor1.capture(), captor2.capture()) - List<String> arg2List = captor2.getAllValues() - String payloadResponseActual = arg2List.get(1) - - assertEquals(falloutHandlerResponse.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", "")) - - verify(mockExecution).setVariable("FH_ResponseCode","500") - } - - private String updateRequestPayload = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <req:updateRequest> - <requestId>testReqId</requestId> - <lastModifiedBy>BPEL</lastModifiedBy> - <finalErrorMessage>ErrorMessage</finalErrorMessage> - <finalErrorCode>ErrorCode</finalErrorCode> - <status>FAILED</status> - <responseStatus>NotifyStatus</responseStatus> - </req:updateRequest> - </soapenv:Body> - </soapenv:Envelope> - """ - - @Test - public void testupdateRequestPayload(){ - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") - when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") - when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode") - when(mockExecution.getVariable("FH_NOTIFY_STATUS")).thenReturn("NotifyStatus") - - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.updateRequestPayload(mockExecution) - - // Capture the arguments to setVariable - ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class); - ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class); - - verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) - List<String> arg2List = captor2.getAllValues() - String payloadRequestActual = arg2List.get(0) - - assertEquals(updateRequestPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) - } - - private String updateRequestInfraPayload = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <req:updateInfraRequest> - <requestId>testReqId</requestId> - <lastModifiedBy>BPEL</lastModifiedBy> - <statusMessage>ErrorMessage</statusMessage> - <requestStatus>FAILED</requestStatus> - <progress>100</progress> - </req:updateInfraRequest> - </soapenv:Body> - </soapenv:Envelope> - """ - - @Test - public void testupdateRequestInfraPayload(){ - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") - when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") - - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.updateRequestInfraPayload(mockExecution) - - // Capture the arguments to setVariable - ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class); - ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class); - - verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) - List<String> arg2List = captor2.getAllValues() - String payloadRequestActual = arg2List.get(0) - - assertEquals(updateRequestInfraPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) - } - - private String updateRequestGammaPayload = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <req:updateRequest> - <requestId>testReqId</requestId> - <lastModifiedBy>BPEL</lastModifiedBy> - <finalErrorMessage>ErrorMessage</finalErrorMessage> - <finalErrorCode>ErrorCode</finalErrorCode> - <status>FAILED</status> - </req:updateRequest> - </soapenv:Body> - </soapenv:Envelope> - """ - - @Test - public void testupdateRequestGammaPayload(){ - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") - when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") - when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode") - - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.updateRequestGammaPayload(mockExecution) - - // Capture the arguments to setVariable - ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class); - ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class); - - verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) - List<String> arg2List = captor2.getAllValues() - String payloadRequestActual = arg2List.get(0) - - assertEquals(updateRequestGammaPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) - } - - - String updateResponseStatusPayload = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <req:updateResponseStatus> - <requestId>testReqId</requestId> - <lastModifiedBy>BPEL</lastModifiedBy> - <responseStatus>SENDING_FINAL_NOTIFY</responseStatus> - </req:updateResponseStatus> - </soapenv:Body> - </soapenv:Envelope> - """ - - @Test - public void testupdateResponseStatusPayload(){ - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") - - FalloutHandler falloutHandler = new FalloutHandler() - falloutHandler.updateResponseStatusPayload(mockExecution) - - // Capture the arguments to setVariable - ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class); - ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class); - - verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) - List<String> arg2List = captor2.getAllValues() - String payloadResponseActual = arg2List.get(0) - - assertEquals(updateResponseStatusPayload.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", "")) - } - +/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - 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=========================================================
+ */
+
+package org.openecomp.mso.bpmn.common.scripts
+
+import org.junit.runner.RunWith;
+import static org.mockito.Mockito.*
+import static org.junit.Assert.*;
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.ArgumentCaptor;
+import org.mockito.MockitoAnnotations
+import org.mockito.runners.MockitoJUnitRunner
+import org.openecomp.mso.bpmn.common.scripts.MsoUtils;
+import org.openecomp.mso.bpmn.common.scripts.FalloutHandler;
+
+@RunWith(MockitoJUnitRunner.class)
+class FalloutHandlerTest {
+
+ public MsoUtils utils = new MsoUtils()
+
+ @Before
+ public void init() {
+ MockitoAnnotations.initMocks(this)
+ }
+
+ private String falloutHandlerRequest = """
+ <sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1" xmlns:ns7="http://org.openecomp/mso/request/types/v1">
+ <ns7:request-information>
+ <ns7:request-id>uCPE1020_STUW105_5002</ns7:request-id>
+ <ns7:request-action>Layer3ServiceActivateRequest</ns7:request-action>
+ <ns7:request-sub-action>CANCEL</ns7:request-sub-action>
+ <ns7:source>OMX</ns7:source>
+ <ns7:order-number>10205000</ns7:order-number>
+ <ns7:order-version>1</ns7:order-version>
+ </ns7:request-information>
+ <sdncadapterworkflow:WorkflowException>
+ <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>
+ <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>
+ <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>
+ </sdncadapterworkflow:WorkflowException>
+ </sdncadapterworkflow:FalloutHandlerRequest>
+ """
+
+ private String falloutHandlerResponse = """<workflow:FalloutHandlerResponse xmlns:workflow="http://org.openecomp/mso/workflow/schema/v1">
+ <workflow:out>Fallout Handler Failed</workflow:out>
+</workflow:FalloutHandlerResponse>"""
+
+ @Test
+ public void testPreProcessRequest() {
+
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+
+ when(mockExecution.getVariable("FalloutHandlerRequest")).thenReturn(falloutHandlerRequest)
+ when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC");
+ when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7");
+
+ FalloutHandler falloutHandler = new FalloutHandler()
+ falloutHandler.preProcessRequest(mockExecution)
+
+ /* Initialize all the process request variables in this block */
+ verify(mockExecution).setVariable("prefix","FH_")
+ //verify(mockExecution).setVariable("getLayer3ServiceDetailsV1Response","")
+
+ //These variables are form the input Message to the BPMN
+ verify(mockExecution).setVariable("FH_request_id","")
+ verify(mockExecution).setVariable("FH_request_action","")
+ verify(mockExecution).setVariable("FH_notification-url","")
+ verify(mockExecution).setVariable("FH_mso-bpel-name","")
+ verify(mockExecution).setVariable("FH_ErrorCode", "")
+ verify(mockExecution).setVariable("FH_ErrorMessage", "")
+
+ verify(mockExecution).setVariable("FH_notification-url-Ok", false)
+ verify(mockExecution).setVariable("FH_request_id-Ok", false)
+
+ //These variables are for Get Mso Aai Password Adapter
+ verify(mockExecution).setVariable("FH_deliveryStatus", true)
+
+ //update Response Status to pending ...Adapter variables
+ verify(mockExecution).setVariable("FH_updateResponseStatusPayload", null)
+ verify(mockExecution).setVariable("FH_updateResponseStatusResponse", null)
+
+ //update Request Gamma ...Adapter variables
+ verify(mockExecution).setVariable("FH_updateRequestGammaPayload", "")
+ verify(mockExecution).setVariable("FH_updateRequestGammaResponse", null)
+ verify(mockExecution).setVariable("FH_updateRequestGammaResponseCode", null)
+
+ //update Request Infra ...Adapter variables
+ verify(mockExecution).setVariable("FH_updateRequestInfraPayload", "")
+ verify(mockExecution).setVariable("FH_updateRequestInfraResponse", null)
+ verify(mockExecution).setVariable("FH_updateRequestInfraResponseCode", null)
+
+ //assign False to success variable
+ verify(mockExecution).setVariable("FH_success", true)
+
+ //Set notify status to Failed variable
+ verify(mockExecution).setVariable("FH_NOTIFY_STATUS", "SUCCESS")
+
+ //Set DB update variable
+ verify(mockExecution).setVariable("FH_updateRequestPayload", "")
+ verify(mockExecution).setVariable("FH_updateRequestResponse", null)
+ verify(mockExecution).setVariable("FH_updateRequestResponseCode", null)
+
+ //Auth variables
+ verify(mockExecution).setVariable("BasicAuthHeaderValue","")
+
+ //Response variables
+ verify(mockExecution).setVariable("FalloutHandlerResponse","")
+ verify(mockExecution).setVariable("FH_ErrorResponse", null)
+ verify(mockExecution).setVariable("FH_ResponseCode", "")
+
+ verify(mockExecution).setVariable("FH_request_id-Ok",true)
+ verify(mockExecution).setVariable("FH_request_id","uCPE1020_STUW105_5002")
+ verify(mockExecution).setVariable("FH_request_action","Layer3ServiceActivateRequest")
+ verify(mockExecution).setVariable("FH_source","OMX")
+ verify(mockExecution).setVariable("FH_ErrorCode","Some Error Code - Fallout Handler")
+ verify(mockExecution).setVariable("FH_ErrorMessage","Some Error Message - Fallout Handler")
+
+ }
+
+ @Test
+ public void testpostProcessResponse(){
+
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
+ when(mockExecution.getVariable("FH_success")).thenReturn(false)
+
+ FalloutHandler falloutHandler = new FalloutHandler()
+ falloutHandler.postProcessResponse(mockExecution)
+
+ // Capture the arguments to setVariable
+ ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class);
+ ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class);
+
+ verify(mockExecution, times(4)).setVariable(captor1.capture(), captor2.capture())
+ List<String> arg2List = captor2.getAllValues()
+ String payloadResponseActual = arg2List.get(1)
+
+ assertEquals(falloutHandlerResponse.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", ""))
+
+ verify(mockExecution).setVariable("FH_ResponseCode","500")
+ }
+
+ private String updateRequestPayload = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <req:updateRequest>
+ <requestId>testReqId</requestId>
+ <lastModifiedBy>BPEL</lastModifiedBy>
+ <finalErrorMessage>ErrorMessage</finalErrorMessage>
+ <finalErrorCode>ErrorCode</finalErrorCode>
+ <status>FAILED</status>
+ <responseStatus>NotifyStatus</responseStatus>
+ </req:updateRequest>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+
+ @Test
+ public void testupdateRequestPayload(){
+
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+ when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId")
+ when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage")
+ when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode")
+ when(mockExecution.getVariable("FH_NOTIFY_STATUS")).thenReturn("NotifyStatus")
+
+ FalloutHandler falloutHandler = new FalloutHandler()
+ falloutHandler.updateRequestPayload(mockExecution)
+
+ // Capture the arguments to setVariable
+ ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class);
+ ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class);
+
+ verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture())
+ List<String> arg2List = captor2.getAllValues()
+ String payloadRequestActual = arg2List.get(0)
+
+ assertEquals(updateRequestPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", ""))
+ }
+
+ private String updateRequestInfraPayload = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <req:updateInfraRequest>
+ <requestId>testReqId</requestId>
+ <lastModifiedBy>BPEL</lastModifiedBy>
+ <statusMessage>ErrorMessage</statusMessage>
+ <requestStatus>FAILED</requestStatus>
+ <progress>100</progress>
+ </req:updateInfraRequest>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+
+ @Test
+ public void testupdateRequestInfraPayload(){
+
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+ when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId")
+ when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage")
+
+ FalloutHandler falloutHandler = new FalloutHandler()
+ falloutHandler.updateRequestInfraPayload(mockExecution)
+
+ // Capture the arguments to setVariable
+ ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class);
+ ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class);
+
+ verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture())
+ List<String> arg2List = captor2.getAllValues()
+ String payloadRequestActual = arg2List.get(0)
+
+ assertEquals(updateRequestInfraPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", ""))
+ }
+
+ private String updateRequestGammaPayload = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <req:updateRequest>
+ <requestId>testReqId</requestId>
+ <lastModifiedBy>BPEL</lastModifiedBy>
+ <finalErrorMessage>ErrorMessage</finalErrorMessage>
+ <finalErrorCode>ErrorCode</finalErrorCode>
+ <status>FAILED</status>
+ </req:updateRequest>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+
+ @Test
+ public void testupdateRequestGammaPayload(){
+
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+ when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId")
+ when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage")
+ when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode")
+
+ FalloutHandler falloutHandler = new FalloutHandler()
+ falloutHandler.updateRequestGammaPayload(mockExecution)
+
+ // Capture the arguments to setVariable
+ ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class);
+ ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class);
+
+ verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture())
+ List<String> arg2List = captor2.getAllValues()
+ String payloadRequestActual = arg2List.get(0)
+
+ assertEquals(updateRequestGammaPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", ""))
+ }
+
+
+ String updateResponseStatusPayload = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <req:updateResponseStatus>
+ <requestId>testReqId</requestId>
+ <lastModifiedBy>BPEL</lastModifiedBy>
+ <responseStatus>SENDING_FINAL_NOTIFY</responseStatus>
+ </req:updateResponseStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+
+ @Test
+ public void testupdateResponseStatusPayload(){
+
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+ when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId")
+
+ FalloutHandler falloutHandler = new FalloutHandler()
+ falloutHandler.updateResponseStatusPayload(mockExecution)
+
+ // Capture the arguments to setVariable
+ ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class);
+ ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class);
+
+ verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture())
+ List<String> arg2List = captor2.getAllValues()
+ String payloadResponseActual = arg2List.get(0)
+
+ assertEquals(updateResponseStatusPayload.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", ""))
+ }
+
}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy index f71e4d2516..014dba6984 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy @@ -1,948 +1,948 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - 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========================================================= - */ - -package org.openecomp.mso.bpmn.common.scripts; - -import static org.mockito.Mockito.* - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapter; - -import org.openecomp.mso.bpmn.mock.FileUtil - -@RunWith(MockitoJUnitRunner.class) -public class SDNCAdapterTest { - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - System.setProperty("jboss.qualified.host.name","myhost.att.com") - } - - - def workflowResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1" - xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <sdncadapterworkflow:response-data> - <tag0:CallbackHeader> - <tag0:RequestId>testRequestId</tag0:RequestId> - <tag0:ResponseCode>200</tag0:ResponseCode> - <tag0:ResponseMessage>OK</tag0:ResponseMessage> - </tag0:CallbackHeader> - <tag0:RequestData xsi:type="xs:string"> <layer3-service-list xmlns="com:att:sdnctl:l3api"> - <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> - <service-status> - <rpc-name>service-configuration-operation</rpc-name> - <rpc-action>activate</rpc-action> - <request-status>synccomplete</request-status> - <final-indicator>N</final-indicator> - <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> - <l3sdn-subaction>SUPP</l3sdn-subaction> - <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> - </service-status> - <service-data> - <internet-evc-access-information> - <ip-version>ds</ip-version> - <internet-evc-speed-value>8</internet-evc-speed-value> - <internet-evc-speed-units>Mbps</internet-evc-speed-units> - </internet-evc-access-information> - <vr-lan xmlns="com:att:sdnctl:l3api"> - <vr-lan-interface> - <static-routes> - <v6-static-routes> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> - <v6-static-route-prefix-length>28</v6-static-route-prefix-length> - </v6-static-routes> - <v4-static-routes> - <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-static-route-prefix-length>28</v4-static-route-prefix-length> - </v4-static-routes> - <v6-static-routes> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> - <v6-static-route-prefix-length>28</v6-static-route-prefix-length> - </v6-static-routes> - <v4-static-routes> - <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-static-route-prefix-length>28</v4-static-route-prefix-length> - </v4-static-routes> - <v4-static-routes> - <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-static-route-prefix-length>28</v4-static-route-prefix-length> - </v4-static-routes> - </static-routes> - <dhcp> - <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> - <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> - <use-v6-default-pool>N</use-v6-default-pool> - <excluded-v4-dhcp-addresses-from-default-pool> - <excluded-v4-address>192.168.1.7</excluded-v4-address> - </excluded-v4-dhcp-addresses-from-default-pool> - <excluded-v4-dhcp-addresses-from-default-pool> - <excluded-v4-address>192.168.1.8</excluded-v4-address> - </excluded-v4-dhcp-addresses-from-default-pool> - <v4-dhcp-pools> - <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> - <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.5</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.6</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> - </v4-dhcp-pools> - <v4-dhcp-pools> - <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> - <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.6</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.7</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> - </v4-dhcp-pools> - <use-v4-default-pool>Y</use-v4-default-pool> - <excluded-v6-dhcp-addresses-from-default-pool> - <excluded-v6-address>1:5</excluded-v6-address> - </excluded-v6-dhcp-addresses-from-default-pool> - <excluded-v6-dhcp-addresses-from-default-pool> - <excluded-v6-address>1:6</excluded-v6-address> - </excluded-v6-dhcp-addresses-from-default-pool> - <v6-dhcp-pools> - <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> - <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> - <excluded-v6-addresses> - <excluded-v6-address>1:1</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> - <excluded-v6-addresses> - <excluded-v6-address>2:2</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> - </v6-dhcp-pools> - <v6-dhcp-pools> - <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> - <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> - <excluded-v6-addresses> - <excluded-v6-address>1:1</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> - <excluded-v6-addresses> - <excluded-v6-address>2:2</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> - </v6-dhcp-pools> - </dhcp> - <firewall-lite> - <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> - <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> - <v4-firewall-packet-filters> - <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> - <v4-firewall-prefix-length>1</v4-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>1</port-number> - </udp-ports> - <tcp-ports> - <port-number>1</port-number> - </tcp-ports> - </v4-firewall-packet-filters> - <v4-firewall-packet-filters> - <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> - <v4-firewall-prefix-length>2</v4-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>2</port-number> - </udp-ports> - <tcp-ports> - <port-number>2</port-number> - </tcp-ports> - </v4-firewall-packet-filters> - <v6-firewall-packet-filters> - <v6-firewall-prefix>:</v6-firewall-prefix> - <v6-firewall-prefix-length>0</v6-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>3</port-number> - </udp-ports> - <tcp-ports> - <port-number>3</port-number> - </tcp-ports> - </v6-firewall-packet-filters> - <v6-firewall-packet-filters> - <v6-firewall-prefix>:</v6-firewall-prefix> - <v6-firewall-prefix-length>1</v6-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>4</port-number> - </udp-ports> - <tcp-ports> - <port-number>4</port-number> - </tcp-ports> - </v6-firewall-packet-filters> - </firewall-lite> - <pat> - <v4-pat-pools> - <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> - <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> - <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> - </v4-pat-pools> - <use-v4-default-pool>Y</use-v4-default-pool> - <v4-pat-enabled>N</v4-pat-enabled> - <v4-pat-pools> - <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> - <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> - <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> - </v4-pat-pools> - </pat> - <nat> - <v4-nat-enabled>Y</v4-nat-enabled> - <v4-nat-mapping-entries> - <v4-nat-internal>0.0.0.0</v4-nat-internal> - <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> - <v4-nat-external>0.0.0.0</v4-nat-external> - </v4-nat-mapping-entries> - <v4-nat-mapping-entries> - <v4-nat-internal>0.0.0.1</v4-nat-internal> - <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> - <v4-nat-external>0.0.0.1</v4-nat-external> - </v4-nat-mapping-entries> - </nat> - <vr-designation>primary</vr-designation> - <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> - <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> - <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> - <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> - <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> - <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> - <v4-public-lan-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.2</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.72</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.68</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - </v4-public-lan-prefixes> - <v6-public-lan-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - </v6-public-lan-prefixes> - </vr-lan-interface> - <routing-protocol>none</routing-protocol> - </vr-lan> -<ucpe-vms-service-information> - <transport-service-information> - <transport-service-type>AVPN</transport-service-type> - <access-circuit-info> - <access-circuit-id>1</access-circuit-id> - <dual-mode>Active</dual-mode> - </access-circuit-info> - <access-circuit-info> - <access-circuit-id>2</access-circuit-id> - <dual-mode>Standby</dual-mode> - </access-circuit-info> - </transport-service-information> - <ucpe-information> - <ucpe-host-name>hostname</ucpe-host-name> - <ucpe-activation-code>activecode</ucpe-activation-code> - <out-of-band-management-modem>OOB</out-of-band-management-modem> - </ucpe-information> - <vnf-list> - <vnf-information> - <vnf-instance-id>1</vnf-instance-id> - <vnf-sequence-number>1</vnf-sequence-number> - <vnf-type>ZZ</vnf-type> - <vnf-vendor>JUNIPER</vnf-vendor> - <vnf-model>MODEL1</vnf-model> - <vnf-id>1</vnf-id> - <prov-status>1</prov-status> - <operational-state>1</operational-state> - <orchestration-status>1</orchestration-status> - <equipment-role>1</equipment-role> - </vnf-information> - <vnf-information> - <vnf-instance-id>2</vnf-instance-id> - <vnf-sequence-number>2</vnf-sequence-number> - <vnf-type>HY</vnf-type> - <vnf-vendor>JUNIPER</vnf-vendor> - <vnf-model>MODEL2</vnf-model> - <vnf-id>2</vnf-id> - <prov-status>2</prov-status> - <operational-state>2</operational-state> - <orchestration-status>2</orchestration-status> - <equipment-role>2</equipment-role> - </vnf-information> - </vnf-list> - </ucpe-vms-service-information> - <request-information> - <request-action>Layer3ServiceActivateRequest</request-action> - <order-number>4281555</order-number> - <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> - <notification-url>https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> - <source>OMX</source> - <order-version>1</order-version> - </request-information> - <sdnc-request-header> - <svc-action>activate</svc-action> - <svc-notification-url>https://msojra.mtsnjdcp1.aic.cip.att.com:8443/adapters/rest/SDNCNotify</svc-notification-url> - <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> - </sdnc-request-header> - <l2-homing-information> - <topology>MultiPoint</topology> - <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> - <evc-name>AS/VLXM/003717//SW</evc-name> - </l2-homing-information> - <service-information> - <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> - <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name> - <service-type>SDN-ETHERNET-INTERNET</service-type> - </service-information> - <internet-service-change-details> - <internet-evc-speed-value>10</internet-evc-speed-value> - <internet-evc-speed-units>Kbps</internet-evc-speed-units> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>2</request-index> - <v4-next-hop-address>192.168.1.16</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - </internet-service-change-details> - </service-data> - </layer3-service-list> -</tag0:RequestData> - </sdncadapterworkflow:response-data> -</sdncadapterworkflow:SDNCAdapterWorkflowResponse>""" - - String sdncAdapterRequest = """ - <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> - <SOAP-ENV:Body> - <aetgt:SDNCAdapterRequest xmlns:aetgt="http://org.openecomp/workflow/sdnc/adapter/schema/v1" xmlns:sdncadaptersc="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> - <sdncadapter:RequestHeader xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> - <sdncadapter:RequestId>745b1b50-e39e-4685-9cc8-c71f0bde8bf0</sdncadapter:RequestId> - <sdncadapter:SvcAction>query</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET</sdncadapter:SvcOperation> - <sdncadapter:CallbackUrl>http://myhost.att.com:28080/mso/sdncAdapterCallbackServiceImpl</sdncadapter:CallbackUrl> - </sdncadapter:RequestHeader> - <sdncadaptersc:RequestData><rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - contentType="text/xml"> - <service-request xmlns="http://org.openecomp/mso/request/details/schema/v1"> - <request-information> - <request-id>12570a36-7388-4c0a-bec4-189ce3kg9956</request-id> - <request-action>GetLayer3ServiceDetailsRequest</request-action> - <source>OMX</source> - </request-information> - <service-information> - <service-type>SDN-ETHERNET-INTERNET</service-type> - <service-instance-id>PD/VLXM/003717//SW_INTERNET</service-instance-id> - </service-information> - </service-request> -</rest:payload></sdncadaptersc:RequestData></aetgt:SDNCAdapterRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>""" - -def sdncAdapterResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"> -<sdncadapterworkflow:response-data> -<tag0:CallbackHeader xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> - <tag0:RequestId>39542e39-ccc3-4d1a-8b79-04ce88526613</tag0:RequestId> - <tag0:ResponseCode>404</tag0:ResponseCode> - <tag0:ResponseMessage>Error processing request to SDNC. Not Found. - https://sdncodl.us.aic.cip.att.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. - SDNC Returned-[error-type:application, error-tag:data-missing, - error-message:Request could not be completed because the relevant - data model content does not exist.]</tag0:ResponseMessage> -</tag0:CallbackHeader> -</sdncadapterworkflow:response-data> -</sdncadapterworkflow:SDNCAdapterWorkflowResponse> -""" - -def workflowErrorResponse = """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> - <aetgt:ErrorMessage>Received error from SDN-C: Error processing request to SDNC. Not Found. - https://sdncodl.us.aic.cip.att.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. - SDNC Returned-[error-type:application, error-tag:data-missing, - error-message:Request could not be completed because the relevant - data model content does not exist.]</aetgt:ErrorMessage> - <aetgt:ErrorCode>5300</aetgt:ErrorCode> - <aetgt:SourceSystemErrorCode>404</aetgt:SourceSystemErrorCode> - </aetgt:WorkflowException>""" - -def workflowErrorResponse1 = """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> - <aetgt:ErrorMessage>Invalid Callback Response from SDNC Adapter</aetgt:ErrorMessage> - <aetgt:ErrorCode>5300</aetgt:ErrorCode> - </aetgt:WorkflowException>""" - -def enhancedCallbackRequestData = - """<tag0:RequestData xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="xs:string"> <layer3-service-list xmlns="com:att:sdnctl:l3api"> - <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> - <service-status> - <rpc-name>service-configuration-operation</rpc-name> - <rpc-action>activate</rpc-action> - <request-status>synccomplete</request-status> - <final-indicator>N</final-indicator> - <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> - <l3sdn-subaction>SUPP</l3sdn-subaction> - <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> - </service-status> - <service-data> - <internet-evc-access-information> - <ip-version>ds</ip-version> - <internet-evc-speed-value>8</internet-evc-speed-value> - <internet-evc-speed-units>Mbps</internet-evc-speed-units> - </internet-evc-access-information> - <vr-lan xmlns="com:att:sdnctl:l3api"> - <vr-lan-interface> - <static-routes> - <v6-static-routes> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> - <v6-static-route-prefix-length>28</v6-static-route-prefix-length> - </v6-static-routes> - <v4-static-routes> - <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-static-route-prefix-length>28</v4-static-route-prefix-length> - </v4-static-routes> - <v6-static-routes> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> - <v6-static-route-prefix-length>28</v6-static-route-prefix-length> - </v6-static-routes> - <v4-static-routes> - <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-static-route-prefix-length>28</v4-static-route-prefix-length> - </v4-static-routes> - <v4-static-routes> - <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-static-route-prefix-length>28</v4-static-route-prefix-length> - </v4-static-routes> - </static-routes> - <dhcp> - <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> - <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> - <use-v6-default-pool>N</use-v6-default-pool> - <excluded-v4-dhcp-addresses-from-default-pool> - <excluded-v4-address>192.168.1.7</excluded-v4-address> - </excluded-v4-dhcp-addresses-from-default-pool> - <excluded-v4-dhcp-addresses-from-default-pool> - <excluded-v4-address>192.168.1.8</excluded-v4-address> - </excluded-v4-dhcp-addresses-from-default-pool> - <v4-dhcp-pools> - <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> - <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.5</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.6</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> - </v4-dhcp-pools> - <v4-dhcp-pools> - <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> - <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.6</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> - <excluded-v4-addresses> - <excluded-v4-address>192.168.1.7</excluded-v4-address> - </excluded-v4-addresses> - <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> - </v4-dhcp-pools> - <use-v4-default-pool>Y</use-v4-default-pool> - <excluded-v6-dhcp-addresses-from-default-pool> - <excluded-v6-address>1:5</excluded-v6-address> - </excluded-v6-dhcp-addresses-from-default-pool> - <excluded-v6-dhcp-addresses-from-default-pool> - <excluded-v6-address>1:6</excluded-v6-address> - </excluded-v6-dhcp-addresses-from-default-pool> - <v6-dhcp-pools> - <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> - <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> - <excluded-v6-addresses> - <excluded-v6-address>1:1</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> - <excluded-v6-addresses> - <excluded-v6-address>2:2</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> - </v6-dhcp-pools> - <v6-dhcp-pools> - <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> - <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> - <excluded-v6-addresses> - <excluded-v6-address>1:1</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> - <excluded-v6-addresses> - <excluded-v6-address>2:2</excluded-v6-address> - </excluded-v6-addresses> - <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> - </v6-dhcp-pools> - </dhcp> - <firewall-lite> - <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> - <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> - <v4-firewall-packet-filters> - <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> - <v4-firewall-prefix-length>1</v4-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>1</port-number> - </udp-ports> - <tcp-ports> - <port-number>1</port-number> - </tcp-ports> - </v4-firewall-packet-filters> - <v4-firewall-packet-filters> - <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> - <v4-firewall-prefix-length>2</v4-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>2</port-number> - </udp-ports> - <tcp-ports> - <port-number>2</port-number> - </tcp-ports> - </v4-firewall-packet-filters> - <v6-firewall-packet-filters> - <v6-firewall-prefix>:</v6-firewall-prefix> - <v6-firewall-prefix-length>0</v6-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>3</port-number> - </udp-ports> - <tcp-ports> - <port-number>3</port-number> - </tcp-ports> - </v6-firewall-packet-filters> - <v6-firewall-packet-filters> - <v6-firewall-prefix>:</v6-firewall-prefix> - <v6-firewall-prefix-length>1</v6-firewall-prefix-length> - <allow-icmp-ping>Y</allow-icmp-ping> - <udp-ports> - <port-number>4</port-number> - </udp-ports> - <tcp-ports> - <port-number>4</port-number> - </tcp-ports> - </v6-firewall-packet-filters> - </firewall-lite> - <pat> - <v4-pat-pools> - <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> - <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> - <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> - </v4-pat-pools> - <use-v4-default-pool>Y</use-v4-default-pool> - <v4-pat-enabled>N</v4-pat-enabled> - <v4-pat-pools> - <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> - <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> - <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> - </v4-pat-pools> - </pat> - <nat> - <v4-nat-enabled>Y</v4-nat-enabled> - <v4-nat-mapping-entries> - <v4-nat-internal>0.0.0.0</v4-nat-internal> - <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> - <v4-nat-external>0.0.0.0</v4-nat-external> - </v4-nat-mapping-entries> - <v4-nat-mapping-entries> - <v4-nat-internal>0.0.0.1</v4-nat-internal> - <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> - <v4-nat-external>0.0.0.1</v4-nat-external> - </v4-nat-mapping-entries> - </nat> - <vr-designation>primary</vr-designation> - <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> - <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> - <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> - <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> - <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> - <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> - <v4-public-lan-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.2</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.72</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.68</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - </v4-public-lan-prefixes> - <v6-public-lan-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - </v6-public-lan-prefixes> - </vr-lan-interface> - <routing-protocol>none</routing-protocol> - </vr-lan> -<ucpe-vms-service-information> - <transport-service-information> - <transport-service-type>AVPN</transport-service-type> - <access-circuit-info> - <access-circuit-id>1</access-circuit-id> - <dual-mode>Active</dual-mode> - </access-circuit-info> - <access-circuit-info> - <access-circuit-id>2</access-circuit-id> - <dual-mode>Standby</dual-mode> - </access-circuit-info> - </transport-service-information> - <ucpe-information> - <ucpe-host-name>hostname</ucpe-host-name> - <ucpe-activation-code>activecode</ucpe-activation-code> - <out-of-band-management-modem>OOB</out-of-band-management-modem> - </ucpe-information> - <vnf-list> - <vnf-information> - <vnf-instance-id>1</vnf-instance-id> - <vnf-sequence-number>1</vnf-sequence-number> - <vnf-type>ZZ</vnf-type> - <vnf-vendor>JUNIPER</vnf-vendor> - <vnf-model>MODEL1</vnf-model> - <vnf-id>1</vnf-id> - <prov-status>1</prov-status> - <operational-state>1</operational-state> - <orchestration-status>1</orchestration-status> - <equipment-role>1</equipment-role> - </vnf-information> - <vnf-information> - <vnf-instance-id>2</vnf-instance-id> - <vnf-sequence-number>2</vnf-sequence-number> - <vnf-type>HY</vnf-type> - <vnf-vendor>JUNIPER</vnf-vendor> - <vnf-model>MODEL2</vnf-model> - <vnf-id>2</vnf-id> - <prov-status>2</prov-status> - <operational-state>2</operational-state> - <orchestration-status>2</orchestration-status> - <equipment-role>2</equipment-role> - </vnf-information> - </vnf-list> - </ucpe-vms-service-information> - <request-information> - <request-action>Layer3ServiceActivateRequest</request-action> - <order-number>4281555</order-number> - <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> - <notification-url>https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> - <source>OMX</source> - <order-version>1</order-version> - </request-information> - <sdnc-request-header> - <svc-action>activate</svc-action> - <svc-notification-url>https://msojra.mtsnjdcp1.aic.cip.att.com:8443/adapters/rest/SDNCNotify</svc-notification-url> - <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> - </sdnc-request-header> - <l2-homing-information> - <topology>MultiPoint</topology> - <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> - <evc-name>AS/VLXM/003717//SW</evc-name> - </l2-homing-information> - <service-information> - <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> - <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name> - <service-type>SDN-ETHERNET-INTERNET</service-type> - </service-information> - <internet-service-change-details> - <internet-evc-speed-value>10</internet-evc-speed-value> - <internet-evc-speed-units>Kbps</internet-evc-speed-units> - <t-provided-v4-lan-public-prefixes> - <request-index>1</request-index> - <v4-next-hop-address>192.168.1.15</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v4-lan-public-prefixes> - <request-index>2</request-index> - <v4-next-hop-address>192.168.1.16</v4-next-hop-address> - <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> - <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> - </t-provided-v4-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - <t-provided-v6-lan-public-prefixes> - <request-index>1</request-index> - <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> - <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> - <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> - </t-provided-v6-lan-public-prefixes> - </internet-service-change-details> - </service-data> - </layer3-service-list> -</tag0:RequestData> -""" - -def sdncAdapterResponseEmpty = -"""<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"> - <sdncadapterworkflow:response-data/> -</sdncadapterworkflow:SDNCAdapterWorkflowResponse>""" - -def sdncAdapterResponseError = -"""<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1" - xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> - <sdncadapterworkflow:response-data> - <tag0:CallbackHeader> - <tag0:RequestId>39542e39-ccc3-4d1a-8b79-04ce88526613</tag0:RequestId> - <tag0:ResponseCode>404</tag0:ResponseCode> - <tag0:ResponseMessage>Error processing request to SDNC. Not Found. - https://sdncodl.us.aic.cip.att.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. - SDNC Returned-[error-type:application, error-tag:data-missing, - error-message:Request could not be completed because the relevant - data model content does not exist.]</tag0:ResponseMessage> - </tag0:CallbackHeader> - </sdncadapterworkflow:response-data> -</sdncadapterworkflow:SDNCAdapterWorkflowResponse>""" - - - @Test - public void testPreProcessRequest() { - - String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml"); - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("sdncAdapterWorkflowRequest")).thenReturn(sdncAdapterWorkflowRequest) - when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://someurl.someting.com:28080/mso/sdncAdapterCallbackServiceImpl") - when(mockExecution.getVariable("URN_mso_use_qualified_host")).thenReturn("true") - when(mockExecution.getProcessInstanceId()).thenReturn("745b1b50-e39e-4685-9cc8-c71f0bde8bf0") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - - - SDNCAdapter sdncAdapter = new SDNCAdapter() - sdncAdapter.preProcessRequest(mockExecution) - - MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - debugger.printInvocations(mockExecution) - - - verify(mockExecution).setVariable("prefix","SDNCA_") - verify(mockExecution).setVariable("sdncAdapterResponse","") - verify(mockExecution).setVariable("asynchronousResponseTimeout",false) - verify(mockExecution).setVariable("continueListening",false) - verify(mockExecution).setVariable("BasicAuthHeaderValue","Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable("serviceConfigActivate",false) - verify(mockExecution).setVariable("SDNCA_requestId", "745b1b50-e39e-4685-9cc8-c71f0bde8bf0") - verify(mockExecution).setVariable("SDNCA_SuccessIndicator",false) - verify(mockExecution).setVariable("source","") - verify(mockExecution).setVariable("sdncAdapterRequest", sdncAdapterRequest) - } - - @Test - public void testProcessResponse() - { - String sdncAdapterCallbackResponse = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml"); - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackResponse) - SDNCAdapter sdncAdapter = new SDNCAdapter() - sdncAdapter.postProcessResponse(mockExecution) - -// MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() -// debugger.printInvocations(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") - verify(mockExecution).setVariable("sdncAdapterResponse",workflowResponse) - verify(mockExecution).setVariable("enhancedCallbackRequestData",enhancedCallbackRequestData) - verify(mockExecution).setVariable("continueListening",false) - - } - - @Test - public void testProcessResponse_ErrorCase_404() - { - String sdncAdapterCallbackErrorResponse = FileUtil.readResourceFile("sdncadaptercallbackrequest_404CallBack.xml"); - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackErrorResponse) - SDNCAdapter sdncAdapter = new SDNCAdapter() - sdncAdapter.postProcessResponse(mockExecution) - - verify(mockExecution, times(1)).getVariable("isDebugLogEnabled") - verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") - verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseError) - verify(mockExecution).setVariable("enhancedCallbackRequestData", "") - verify(mockExecution).setVariable("continueListening",false) - - } - - @Test - public void testProcessResponse_ErrorCase_InvalidCallback() - { - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn("<h1>Service Unavailable</h1>") - SDNCAdapter sdncAdapter = new SDNCAdapter() - sdncAdapter.postProcessResponse(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") - verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseEmpty) - verify(mockExecution).setVariable("enhancedCallbackRequestData", "") - verify(mockExecution).setVariable("continueListening",false) - - } - - @Test - public void postProcessResponse() - { - - String SDNCAdapterCallbackRequest = - """<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<SDNCAdapterCallbackRequest - xmlns="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> - <CallbackHeader> - <RequestId>3bb02798-b344-4d28-9bca-1f029954d1c9</RequestId> - <ResponseCode>404</ResponseCode> - <ResponseMessage>Error processing request to SDNC. Not Found. - https://sdncodl.us.infra.aic.att.net:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693. - SDNC Returned-[error-type:application, error-tag:data-missing, - error-message:Request could not be completed because the relevant - data model content does not exist ]</ResponseMessage> - </CallbackHeader> -</SDNCAdapterCallbackRequest>""" - - String sdncAdapterResponse = - """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1" - xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> - <sdncadapterworkflow:response-data> - <tag0:CallbackHeader> - <tag0:RequestId>3bb02798-b344-4d28-9bca-1f029954d1c9</tag0:RequestId> - <tag0:ResponseCode>404</tag0:ResponseCode> - <tag0:ResponseMessage>Error processing request to SDNC. Not Found. - https://sdncodl.us.infra.aic.att.net:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693. - SDNC Returned-[error-type:application, error-tag:data-missing, - error-message:Request could not be completed because the relevant - data model content does not exist ]</tag0:ResponseMessage> - </tag0:CallbackHeader> - </sdncadapterworkflow:response-data> -</sdncadapterworkflow:SDNCAdapterWorkflowResponse>""" - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(SDNCAdapterCallbackRequest) - SDNCAdapter sdncAdapter = new SDNCAdapter() - sdncAdapter.postProcessResponse(mockExecution) - - verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") - verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponse) - verify(mockExecution).setVariable("enhancedCallbackRequestData", "") - verify(mockExecution).setVariable("continueListening",false) - - } - +/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - 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=========================================================
+ */
+
+package org.openecomp.mso.bpmn.common.scripts;
+
+import static org.mockito.Mockito.*
+
+import org.camunda.bpm.engine.ProcessEngineServices
+import org.camunda.bpm.engine.RepositoryService
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.camunda.bpm.engine.repository.ProcessDefinition
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.MockitoAnnotations
+import org.mockito.runners.MockitoJUnitRunner
+import org.mockito.internal.debugging.MockitoDebuggerImpl
+import org.openecomp.mso.bpmn.common.scripts.SDNCAdapter;
+
+import org.openecomp.mso.bpmn.mock.FileUtil
+
+@RunWith(MockitoJUnitRunner.class)
+public class SDNCAdapterTest {
+
+ @Before
+ public void init()
+ {
+ MockitoAnnotations.initMocks(this)
+ System.setProperty("jboss.qualified.host.name","myhost.com")
+ }
+
+
+ def workflowResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <sdncadapterworkflow:response-data>
+ <tag0:CallbackHeader>
+ <tag0:RequestId>testRequestId</tag0:RequestId>
+ <tag0:ResponseCode>200</tag0:ResponseCode>
+ <tag0:ResponseMessage>OK</tag0:ResponseMessage>
+ </tag0:CallbackHeader>
+ <tag0:RequestData xsi:type="xs:string"> <layer3-service-list xmlns="com:att:sdnctl:l3api">
+ <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id>
+ <service-status>
+ <rpc-name>service-configuration-operation</rpc-name>
+ <rpc-action>activate</rpc-action>
+ <request-status>synccomplete</request-status>
+ <final-indicator>N</final-indicator>
+ <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action>
+ <l3sdn-subaction>SUPP</l3sdn-subaction>
+ <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp>
+ </service-status>
+ <service-data>
+ <internet-evc-access-information>
+ <ip-version>ds</ip-version>
+ <internet-evc-speed-value>8</internet-evc-speed-value>
+ <internet-evc-speed-units>Mbps</internet-evc-speed-units>
+ </internet-evc-access-information>
+ <vr-lan xmlns="com:att:sdnctl:l3api">
+ <vr-lan-interface>
+ <static-routes>
+ <v6-static-routes>
+ <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
+ <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix>
+ <v6-static-route-prefix-length>28</v6-static-route-prefix-length>
+ </v6-static-routes>
+ <v4-static-routes>
+ <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix>
+ <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
+ <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
+ </v4-static-routes>
+ <v6-static-routes>
+ <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
+ <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix>
+ <v6-static-route-prefix-length>28</v6-static-route-prefix-length>
+ </v6-static-routes>
+ <v4-static-routes>
+ <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix>
+ <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
+ <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
+ </v4-static-routes>
+ <v4-static-routes>
+ <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix>
+ <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
+ <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
+ </v4-static-routes>
+ </static-routes>
+ <dhcp>
+ <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled>
+ <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled>
+ <use-v6-default-pool>N</use-v6-default-pool>
+ <excluded-v4-dhcp-addresses-from-default-pool>
+ <excluded-v4-address>192.168.1.7</excluded-v4-address>
+ </excluded-v4-dhcp-addresses-from-default-pool>
+ <excluded-v4-dhcp-addresses-from-default-pool>
+ <excluded-v4-address>192.168.1.8</excluded-v4-address>
+ </excluded-v4-dhcp-addresses-from-default-pool>
+ <v4-dhcp-pools>
+ <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address>
+ <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length>
+ <excluded-v4-addresses>
+ <excluded-v4-address>192.168.1.5</excluded-v4-address>
+ </excluded-v4-addresses>
+ <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address>
+ <excluded-v4-addresses>
+ <excluded-v4-address>192.168.1.6</excluded-v4-address>
+ </excluded-v4-addresses>
+ <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix>
+ </v4-dhcp-pools>
+ <v4-dhcp-pools>
+ <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address>
+ <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length>
+ <excluded-v4-addresses>
+ <excluded-v4-address>192.168.1.6</excluded-v4-address>
+ </excluded-v4-addresses>
+ <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address>
+ <excluded-v4-addresses>
+ <excluded-v4-address>192.168.1.7</excluded-v4-address>
+ </excluded-v4-addresses>
+ <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix>
+ </v4-dhcp-pools>
+ <use-v4-default-pool>Y</use-v4-default-pool>
+ <excluded-v6-dhcp-addresses-from-default-pool>
+ <excluded-v6-address>1:5</excluded-v6-address>
+ </excluded-v6-dhcp-addresses-from-default-pool>
+ <excluded-v6-dhcp-addresses-from-default-pool>
+ <excluded-v6-address>1:6</excluded-v6-address>
+ </excluded-v6-dhcp-addresses-from-default-pool>
+ <v6-dhcp-pools>
+ <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address>
+ <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length>
+ <excluded-v6-addresses>
+ <excluded-v6-address>1:1</excluded-v6-address>
+ </excluded-v6-addresses>
+ <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address>
+ <excluded-v6-addresses>
+ <excluded-v6-address>2:2</excluded-v6-address>
+ </excluded-v6-addresses>
+ <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix>
+ </v6-dhcp-pools>
+ <v6-dhcp-pools>
+ <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address>
+ <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length>
+ <excluded-v6-addresses>
+ <excluded-v6-address>1:1</excluded-v6-address>
+ </excluded-v6-addresses>
+ <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address>
+ <excluded-v6-addresses>
+ <excluded-v6-address>2:2</excluded-v6-address>
+ </excluded-v6-addresses>
+ <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix>
+ </v6-dhcp-pools>
+ </dhcp>
+ <firewall-lite>
+ <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled>
+ <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled>
+ <v4-firewall-packet-filters>
+ <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix>
+ <v4-firewall-prefix-length>1</v4-firewall-prefix-length>
+ <allow-icmp-ping>Y</allow-icmp-ping>
+ <udp-ports>
+ <port-number>1</port-number>
+ </udp-ports>
+ <tcp-ports>
+ <port-number>1</port-number>
+ </tcp-ports>
+ </v4-firewall-packet-filters>
+ <v4-firewall-packet-filters>
+ <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix>
+ <v4-firewall-prefix-length>2</v4-firewall-prefix-length>
+ <allow-icmp-ping>Y</allow-icmp-ping>
+ <udp-ports>
+ <port-number>2</port-number>
+ </udp-ports>
+ <tcp-ports>
+ <port-number>2</port-number>
+ </tcp-ports>
+ </v4-firewall-packet-filters>
+ <v6-firewall-packet-filters>
+ <v6-firewall-prefix>:</v6-firewall-prefix>
+ <v6-firewall-prefix-length>0</v6-firewall-prefix-length>
+ <allow-icmp-ping>Y</allow-icmp-ping>
+ <udp-ports>
+ <port-number>3</port-number>
+ </udp-ports>
+ <tcp-ports>
+ <port-number>3</port-number>
+ </tcp-ports>
+ </v6-firewall-packet-filters>
+ <v6-firewall-packet-filters>
+ <v6-firewall-prefix>:</v6-firewall-prefix>
+ <v6-firewall-prefix-length>1</v6-firewall-prefix-length>
+ <allow-icmp-ping>Y</allow-icmp-ping>
+ <udp-ports>
+ <port-number>4</port-number>
+ </udp-ports>
+ <tcp-ports>
+ <port-number>4</port-number>
+ </tcp-ports>
+ </v6-firewall-packet-filters>
+ </firewall-lite>
+ <pat>
+ <v4-pat-pools>
+ <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix>
+ <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address>
+ <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length>
+ </v4-pat-pools>
+ <use-v4-default-pool>Y</use-v4-default-pool>
+ <v4-pat-enabled>N</v4-pat-enabled>
+ <v4-pat-pools>
+ <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix>
+ <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address>
+ <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length>
+ </v4-pat-pools>
+ </pat>
+ <nat>
+ <v4-nat-enabled>Y</v4-nat-enabled>
+ <v4-nat-mapping-entries>
+ <v4-nat-internal>0.0.0.0</v4-nat-internal>
+ <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address>
+ <v4-nat-external>0.0.0.0</v4-nat-external>
+ </v4-nat-mapping-entries>
+ <v4-nat-mapping-entries>
+ <v4-nat-internal>0.0.0.1</v4-nat-internal>
+ <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address>
+ <v4-nat-external>0.0.0.1</v4-nat-external>
+ </v4-nat-mapping-entries>
+ </nat>
+ <vr-designation>primary</vr-designation>
+ <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address>
+ <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length>
+ <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address>
+ <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix>
+ <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length>
+ <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix>
+ <v4-public-lan-prefixes>
+ <t-provided-v4-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v4-next-hop-address>192.168.1.2</v4-next-hop-address>
+ <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix>
+ <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
+ </t-provided-v4-lan-public-prefixes>
+ <t-provided-v4-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v4-next-hop-address>192.168.1.72</v4-next-hop-address>
+ <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix>
+ <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
+ </t-provided-v4-lan-public-prefixes>
+ <t-provided-v4-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v4-next-hop-address>192.168.1.68</v4-next-hop-address>
+ <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix>
+ <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
+ </t-provided-v4-lan-public-prefixes>
+ </v4-public-lan-prefixes>
+ <v6-public-lan-prefixes>
+ <t-provided-v6-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
+ <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
+ <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
+ </t-provided-v6-lan-public-prefixes>
+ <t-provided-v6-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
+ <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix>
+ <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
+ </t-provided-v6-lan-public-prefixes>
+ <t-provided-v6-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
+ <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix>
+ <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
+ </t-provided-v6-lan-public-prefixes>
+ </v6-public-lan-prefixes>
+ </vr-lan-interface>
+ <routing-protocol>none</routing-protocol>
+ </vr-lan>
+<ucpe-vms-service-information>
+ <transport-service-information>
+ <transport-service-type>AVPN</transport-service-type>
+ <access-circuit-info>
+ <access-circuit-id>1</access-circuit-id>
+ <dual-mode>Active</dual-mode>
+ </access-circuit-info>
+ <access-circuit-info>
+ <access-circuit-id>2</access-circuit-id>
+ <dual-mode>Standby</dual-mode>
+ </access-circuit-info>
+ </transport-service-information>
+ <ucpe-information>
+ <ucpe-host-name>hostname</ucpe-host-name>
+ <ucpe-activation-code>activecode</ucpe-activation-code>
+ <out-of-band-management-modem>OOB</out-of-band-management-modem>
+ </ucpe-information>
+ <vnf-list>
+ <vnf-information>
+ <vnf-instance-id>1</vnf-instance-id>
+ <vnf-sequence-number>1</vnf-sequence-number>
+ <vnf-type>ZZ</vnf-type>
+ <vnf-vendor>JUNIPER</vnf-vendor>
+ <vnf-model>MODEL1</vnf-model>
+ <vnf-id>1</vnf-id>
+ <prov-status>1</prov-status>
+ <operational-state>1</operational-state>
+ <orchestration-status>1</orchestration-status>
+ <equipment-role>1</equipment-role>
+ </vnf-information>
+ <vnf-information>
+ <vnf-instance-id>2</vnf-instance-id>
+ <vnf-sequence-number>2</vnf-sequence-number>
+ <vnf-type>HY</vnf-type>
+ <vnf-vendor>JUNIPER</vnf-vendor>
+ <vnf-model>MODEL2</vnf-model>
+ <vnf-id>2</vnf-id>
+ <prov-status>2</prov-status>
+ <operational-state>2</operational-state>
+ <orchestration-status>2</orchestration-status>
+ <equipment-role>2</equipment-role>
+ </vnf-information>
+ </vnf-list>
+ </ucpe-vms-service-information>
+ <request-information>
+ <request-action>Layer3ServiceActivateRequest</request-action>
+ <order-number>4281555</order-number>
+ <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id>
+ <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url>
+ <source>OMX</source>
+ <order-version>1</order-version>
+ </request-information>
+ <sdnc-request-header>
+ <svc-action>activate</svc-action>
+ <svc-notification-url>https://msojra.mtsnjdcp1.aic.cip.com:8443/adapters/rest/SDNCNotify</svc-notification-url>
+ <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id>
+ </sdnc-request-header>
+ <l2-homing-information>
+ <topology>MultiPoint</topology>
+ <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli>
+ <evc-name>AS/VLXM/003717//SW</evc-name>
+ </l2-homing-information>
+ <service-information>
+ <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id>
+ <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name>
+ <service-type>SDN-ETHERNET-INTERNET</service-type>
+ </service-information>
+ <internet-service-change-details>
+ <internet-evc-speed-value>10</internet-evc-speed-value>
+ <internet-evc-speed-units>Kbps</internet-evc-speed-units>
+ <t-provided-v4-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
+ <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix>
+ <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
+ </t-provided-v4-lan-public-prefixes>
+ <t-provided-v4-lan-public-prefixes>
+ <request-index>2</request-index>
+ <v4-next-hop-address>192.168.1.16</v4-next-hop-address>
+ <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix>
+ <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
+ </t-provided-v4-lan-public-prefixes>
+ <t-provided-v6-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
+ <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
+ <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
+ </t-provided-v6-lan-public-prefixes>
+ <t-provided-v6-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
+ <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
+ <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
+ </t-provided-v6-lan-public-prefixes>
+ </internet-service-change-details>
+ </service-data>
+ </layer3-service-list>
+</tag0:RequestData>
+ </sdncadapterworkflow:response-data>
+</sdncadapterworkflow:SDNCAdapterWorkflowResponse>"""
+
+ String sdncAdapterRequest = """
+ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <SOAP-ENV:Body>
+ <aetgt:SDNCAdapterRequest xmlns:aetgt="http://org.openecomp/workflow/sdnc/adapter/schema/v1" xmlns:sdncadaptersc="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
+ <sdncadapter:RequestHeader xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
+ <sdncadapter:RequestId>745b1b50-e39e-4685-9cc8-c71f0bde8bf0</sdncadapter:RequestId>
+ <sdncadapter:SvcAction>query</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>http://myhost.com:28080/mso/sdncAdapterCallbackServiceImpl</sdncadapter:CallbackUrl>
+ </sdncadapter:RequestHeader>
+ <sdncadaptersc:RequestData><rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
+ contentType="text/xml">
+ <service-request xmlns="http://org.openecomp/mso/request/details/schema/v1">
+ <request-information>
+ <request-id>12570a36-7388-4c0a-bec4-189ce3kg9956</request-id>
+ <request-action>GetLayer3ServiceDetailsRequest</request-action>
+ <source>OMX</source>
+ </request-information>
+ <service-information>
+ <service-type>SDN-ETHERNET-INTERNET</service-type>
+ <service-instance-id>PD/VLXM/003717//SW_INTERNET</service-instance-id>
+ </service-information>
+ </service-request>
+</rest:payload></sdncadaptersc:RequestData></aetgt:SDNCAdapterRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"""
+
+def sdncAdapterResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1">
+<sdncadapterworkflow:response-data>
+<tag0:CallbackHeader xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
+ <tag0:RequestId>39542e39-ccc3-4d1a-8b79-04ce88526613</tag0:RequestId>
+ <tag0:ResponseCode>404</tag0:ResponseCode>
+ <tag0:ResponseMessage>Error processing request to SDNC. Not Found.
+ https://sdncodl.us.aic.cip.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout.
+ SDNC Returned-[error-type:application, error-tag:data-missing,
+ error-message:Request could not be completed because the relevant
+ data model content does not exist.]</tag0:ResponseMessage>
+</tag0:CallbackHeader>
+</sdncadapterworkflow:response-data>
+</sdncadapterworkflow:SDNCAdapterWorkflowResponse>
+"""
+
+def workflowErrorResponse = """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
+ <aetgt:ErrorMessage>Received error from SDN-C: Error processing request to SDNC. Not Found.
+ https://sdncodl.us.aic.cip.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout.
+ SDNC Returned-[error-type:application, error-tag:data-missing,
+ error-message:Request could not be completed because the relevant
+ data model content does not exist.]</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>5300</aetgt:ErrorCode>
+ <aetgt:SourceSystemErrorCode>404</aetgt:SourceSystemErrorCode>
+ </aetgt:WorkflowException>"""
+
+def workflowErrorResponse1 = """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
+ <aetgt:ErrorMessage>Invalid Callback Response from SDNC Adapter</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>5300</aetgt:ErrorCode>
+ </aetgt:WorkflowException>"""
+
+def enhancedCallbackRequestData =
+ """<tag0:RequestData xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:type="xs:string"> <layer3-service-list xmlns="com:att:sdnctl:l3api">
+ <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id>
+ <service-status>
+ <rpc-name>service-configuration-operation</rpc-name>
+ <rpc-action>activate</rpc-action>
+ <request-status>synccomplete</request-status>
+ <final-indicator>N</final-indicator>
+ <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action>
+ <l3sdn-subaction>SUPP</l3sdn-subaction>
+ <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp>
+ </service-status>
+ <service-data>
+ <internet-evc-access-information>
+ <ip-version>ds</ip-version>
+ <internet-evc-speed-value>8</internet-evc-speed-value>
+ <internet-evc-speed-units>Mbps</internet-evc-speed-units>
+ </internet-evc-access-information>
+ <vr-lan xmlns="com:att:sdnctl:l3api">
+ <vr-lan-interface>
+ <static-routes>
+ <v6-static-routes>
+ <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
+ <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix>
+ <v6-static-route-prefix-length>28</v6-static-route-prefix-length>
+ </v6-static-routes>
+ <v4-static-routes>
+ <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix>
+ <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
+ <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
+ </v4-static-routes>
+ <v6-static-routes>
+ <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
+ <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix>
+ <v6-static-route-prefix-length>28</v6-static-route-prefix-length>
+ </v6-static-routes>
+ <v4-static-routes>
+ <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix>
+ <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
+ <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
+ </v4-static-routes>
+ <v4-static-routes>
+ <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix>
+ <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
+ <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
+ </v4-static-routes>
+ </static-routes>
+ <dhcp>
+ <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled>
+ <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled>
+ <use-v6-default-pool>N</use-v6-default-pool>
+ <excluded-v4-dhcp-addresses-from-default-pool>
+ <excluded-v4-address>192.168.1.7</excluded-v4-address>
+ </excluded-v4-dhcp-addresses-from-default-pool>
+ <excluded-v4-dhcp-addresses-from-default-pool>
+ <excluded-v4-address>192.168.1.8</excluded-v4-address>
+ </excluded-v4-dhcp-addresses-from-default-pool>
+ <v4-dhcp-pools>
+ <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address>
+ <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length>
+ <excluded-v4-addresses>
+ <excluded-v4-address>192.168.1.5</excluded-v4-address>
+ </excluded-v4-addresses>
+ <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address>
+ <excluded-v4-addresses>
+ <excluded-v4-address>192.168.1.6</excluded-v4-address>
+ </excluded-v4-addresses>
+ <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix>
+ </v4-dhcp-pools>
+ <v4-dhcp-pools>
+ <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address>
+ <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length>
+ <excluded-v4-addresses>
+ <excluded-v4-address>192.168.1.6</excluded-v4-address>
+ </excluded-v4-addresses>
+ <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address>
+ <excluded-v4-addresses>
+ <excluded-v4-address>192.168.1.7</excluded-v4-address>
+ </excluded-v4-addresses>
+ <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix>
+ </v4-dhcp-pools>
+ <use-v4-default-pool>Y</use-v4-default-pool>
+ <excluded-v6-dhcp-addresses-from-default-pool>
+ <excluded-v6-address>1:5</excluded-v6-address>
+ </excluded-v6-dhcp-addresses-from-default-pool>
+ <excluded-v6-dhcp-addresses-from-default-pool>
+ <excluded-v6-address>1:6</excluded-v6-address>
+ </excluded-v6-dhcp-addresses-from-default-pool>
+ <v6-dhcp-pools>
+ <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address>
+ <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length>
+ <excluded-v6-addresses>
+ <excluded-v6-address>1:1</excluded-v6-address>
+ </excluded-v6-addresses>
+ <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address>
+ <excluded-v6-addresses>
+ <excluded-v6-address>2:2</excluded-v6-address>
+ </excluded-v6-addresses>
+ <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix>
+ </v6-dhcp-pools>
+ <v6-dhcp-pools>
+ <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address>
+ <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length>
+ <excluded-v6-addresses>
+ <excluded-v6-address>1:1</excluded-v6-address>
+ </excluded-v6-addresses>
+ <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address>
+ <excluded-v6-addresses>
+ <excluded-v6-address>2:2</excluded-v6-address>
+ </excluded-v6-addresses>
+ <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix>
+ </v6-dhcp-pools>
+ </dhcp>
+ <firewall-lite>
+ <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled>
+ <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled>
+ <v4-firewall-packet-filters>
+ <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix>
+ <v4-firewall-prefix-length>1</v4-firewall-prefix-length>
+ <allow-icmp-ping>Y</allow-icmp-ping>
+ <udp-ports>
+ <port-number>1</port-number>
+ </udp-ports>
+ <tcp-ports>
+ <port-number>1</port-number>
+ </tcp-ports>
+ </v4-firewall-packet-filters>
+ <v4-firewall-packet-filters>
+ <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix>
+ <v4-firewall-prefix-length>2</v4-firewall-prefix-length>
+ <allow-icmp-ping>Y</allow-icmp-ping>
+ <udp-ports>
+ <port-number>2</port-number>
+ </udp-ports>
+ <tcp-ports>
+ <port-number>2</port-number>
+ </tcp-ports>
+ </v4-firewall-packet-filters>
+ <v6-firewall-packet-filters>
+ <v6-firewall-prefix>:</v6-firewall-prefix>
+ <v6-firewall-prefix-length>0</v6-firewall-prefix-length>
+ <allow-icmp-ping>Y</allow-icmp-ping>
+ <udp-ports>
+ <port-number>3</port-number>
+ </udp-ports>
+ <tcp-ports>
+ <port-number>3</port-number>
+ </tcp-ports>
+ </v6-firewall-packet-filters>
+ <v6-firewall-packet-filters>
+ <v6-firewall-prefix>:</v6-firewall-prefix>
+ <v6-firewall-prefix-length>1</v6-firewall-prefix-length>
+ <allow-icmp-ping>Y</allow-icmp-ping>
+ <udp-ports>
+ <port-number>4</port-number>
+ </udp-ports>
+ <tcp-ports>
+ <port-number>4</port-number>
+ </tcp-ports>
+ </v6-firewall-packet-filters>
+ </firewall-lite>
+ <pat>
+ <v4-pat-pools>
+ <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix>
+ <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address>
+ <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length>
+ </v4-pat-pools>
+ <use-v4-default-pool>Y</use-v4-default-pool>
+ <v4-pat-enabled>N</v4-pat-enabled>
+ <v4-pat-pools>
+ <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix>
+ <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address>
+ <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length>
+ </v4-pat-pools>
+ </pat>
+ <nat>
+ <v4-nat-enabled>Y</v4-nat-enabled>
+ <v4-nat-mapping-entries>
+ <v4-nat-internal>0.0.0.0</v4-nat-internal>
+ <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address>
+ <v4-nat-external>0.0.0.0</v4-nat-external>
+ </v4-nat-mapping-entries>
+ <v4-nat-mapping-entries>
+ <v4-nat-internal>0.0.0.1</v4-nat-internal>
+ <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address>
+ <v4-nat-external>0.0.0.1</v4-nat-external>
+ </v4-nat-mapping-entries>
+ </nat>
+ <vr-designation>primary</vr-designation>
+ <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address>
+ <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length>
+ <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address>
+ <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix>
+ <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length>
+ <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix>
+ <v4-public-lan-prefixes>
+ <t-provided-v4-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v4-next-hop-address>192.168.1.2</v4-next-hop-address>
+ <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix>
+ <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
+ </t-provided-v4-lan-public-prefixes>
+ <t-provided-v4-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v4-next-hop-address>192.168.1.72</v4-next-hop-address>
+ <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix>
+ <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
+ </t-provided-v4-lan-public-prefixes>
+ <t-provided-v4-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v4-next-hop-address>192.168.1.68</v4-next-hop-address>
+ <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix>
+ <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
+ </t-provided-v4-lan-public-prefixes>
+ </v4-public-lan-prefixes>
+ <v6-public-lan-prefixes>
+ <t-provided-v6-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
+ <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
+ <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
+ </t-provided-v6-lan-public-prefixes>
+ <t-provided-v6-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
+ <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix>
+ <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
+ </t-provided-v6-lan-public-prefixes>
+ <t-provided-v6-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
+ <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix>
+ <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
+ </t-provided-v6-lan-public-prefixes>
+ </v6-public-lan-prefixes>
+ </vr-lan-interface>
+ <routing-protocol>none</routing-protocol>
+ </vr-lan>
+<ucpe-vms-service-information>
+ <transport-service-information>
+ <transport-service-type>AVPN</transport-service-type>
+ <access-circuit-info>
+ <access-circuit-id>1</access-circuit-id>
+ <dual-mode>Active</dual-mode>
+ </access-circuit-info>
+ <access-circuit-info>
+ <access-circuit-id>2</access-circuit-id>
+ <dual-mode>Standby</dual-mode>
+ </access-circuit-info>
+ </transport-service-information>
+ <ucpe-information>
+ <ucpe-host-name>hostname</ucpe-host-name>
+ <ucpe-activation-code>activecode</ucpe-activation-code>
+ <out-of-band-management-modem>OOB</out-of-band-management-modem>
+ </ucpe-information>
+ <vnf-list>
+ <vnf-information>
+ <vnf-instance-id>1</vnf-instance-id>
+ <vnf-sequence-number>1</vnf-sequence-number>
+ <vnf-type>ZZ</vnf-type>
+ <vnf-vendor>JUNIPER</vnf-vendor>
+ <vnf-model>MODEL1</vnf-model>
+ <vnf-id>1</vnf-id>
+ <prov-status>1</prov-status>
+ <operational-state>1</operational-state>
+ <orchestration-status>1</orchestration-status>
+ <equipment-role>1</equipment-role>
+ </vnf-information>
+ <vnf-information>
+ <vnf-instance-id>2</vnf-instance-id>
+ <vnf-sequence-number>2</vnf-sequence-number>
+ <vnf-type>HY</vnf-type>
+ <vnf-vendor>JUNIPER</vnf-vendor>
+ <vnf-model>MODEL2</vnf-model>
+ <vnf-id>2</vnf-id>
+ <prov-status>2</prov-status>
+ <operational-state>2</operational-state>
+ <orchestration-status>2</orchestration-status>
+ <equipment-role>2</equipment-role>
+ </vnf-information>
+ </vnf-list>
+ </ucpe-vms-service-information>
+ <request-information>
+ <request-action>Layer3ServiceActivateRequest</request-action>
+ <order-number>4281555</order-number>
+ <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id>
+ <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url>
+ <source>OMX</source>
+ <order-version>1</order-version>
+ </request-information>
+ <sdnc-request-header>
+ <svc-action>activate</svc-action>
+ <svc-notification-url>https://msojra.mtsnjdcp1.aic.cip.com:8443/adapters/rest/SDNCNotify</svc-notification-url>
+ <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id>
+ </sdnc-request-header>
+ <l2-homing-information>
+ <topology>MultiPoint</topology>
+ <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli>
+ <evc-name>AS/VLXM/003717//SW</evc-name>
+ </l2-homing-information>
+ <service-information>
+ <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id>
+ <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name>
+ <service-type>SDN-ETHERNET-INTERNET</service-type>
+ </service-information>
+ <internet-service-change-details>
+ <internet-evc-speed-value>10</internet-evc-speed-value>
+ <internet-evc-speed-units>Kbps</internet-evc-speed-units>
+ <t-provided-v4-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
+ <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix>
+ <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
+ </t-provided-v4-lan-public-prefixes>
+ <t-provided-v4-lan-public-prefixes>
+ <request-index>2</request-index>
+ <v4-next-hop-address>192.168.1.16</v4-next-hop-address>
+ <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix>
+ <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
+ </t-provided-v4-lan-public-prefixes>
+ <t-provided-v6-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
+ <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
+ <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
+ </t-provided-v6-lan-public-prefixes>
+ <t-provided-v6-lan-public-prefixes>
+ <request-index>1</request-index>
+ <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
+ <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
+ <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
+ </t-provided-v6-lan-public-prefixes>
+ </internet-service-change-details>
+ </service-data>
+ </layer3-service-list>
+</tag0:RequestData>
+"""
+
+def sdncAdapterResponseEmpty =
+"""<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1">
+ <sdncadapterworkflow:response-data/>
+</sdncadapterworkflow:SDNCAdapterWorkflowResponse>"""
+
+def sdncAdapterResponseError =
+"""<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
+ <sdncadapterworkflow:response-data>
+ <tag0:CallbackHeader>
+ <tag0:RequestId>39542e39-ccc3-4d1a-8b79-04ce88526613</tag0:RequestId>
+ <tag0:ResponseCode>404</tag0:ResponseCode>
+ <tag0:ResponseMessage>Error processing request to SDNC. Not Found.
+ https://sdncodl.us.aic.cip.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout.
+ SDNC Returned-[error-type:application, error-tag:data-missing,
+ error-message:Request could not be completed because the relevant
+ data model content does not exist.]</tag0:ResponseMessage>
+ </tag0:CallbackHeader>
+ </sdncadapterworkflow:response-data>
+</sdncadapterworkflow:SDNCAdapterWorkflowResponse>"""
+
+
+ @Test
+ public void testPreProcessRequest() {
+
+ String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml");
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+ when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B")
+ when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7")
+ when(mockExecution.getVariable("sdncAdapterWorkflowRequest")).thenReturn(sdncAdapterWorkflowRequest)
+ when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://someurl.someting.com:28080/mso/sdncAdapterCallbackServiceImpl")
+ when(mockExecution.getVariable("URN_mso_use_qualified_host")).thenReturn("true")
+ when(mockExecution.getProcessInstanceId()).thenReturn("745b1b50-e39e-4685-9cc8-c71f0bde8bf0")
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
+
+
+ SDNCAdapter sdncAdapter = new SDNCAdapter()
+ sdncAdapter.preProcessRequest(mockExecution)
+
+ MockitoDebuggerImpl debugger = new MockitoDebuggerImpl()
+ debugger.printInvocations(mockExecution)
+
+
+ verify(mockExecution).setVariable("prefix","SDNCA_")
+ verify(mockExecution).setVariable("sdncAdapterResponse","")
+ verify(mockExecution).setVariable("asynchronousResponseTimeout",false)
+ verify(mockExecution).setVariable("continueListening",false)
+ verify(mockExecution).setVariable("BasicAuthHeaderValue","Basic cGFzc3dvcmQ=")
+ verify(mockExecution).setVariable("serviceConfigActivate",false)
+ verify(mockExecution).setVariable("SDNCA_requestId", "745b1b50-e39e-4685-9cc8-c71f0bde8bf0")
+ verify(mockExecution).setVariable("SDNCA_SuccessIndicator",false)
+ verify(mockExecution).setVariable("source","")
+ verify(mockExecution).setVariable("sdncAdapterRequest", sdncAdapterRequest)
+ }
+
+ @Test
+ public void testProcessResponse()
+ {
+ String sdncAdapterCallbackResponse = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml");
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+ when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackResponse)
+ SDNCAdapter sdncAdapter = new SDNCAdapter()
+ sdncAdapter.postProcessResponse(mockExecution)
+
+// MockitoDebuggerImpl debugger = new MockitoDebuggerImpl()
+// debugger.printInvocations(mockExecution)
+
+ verify(mockExecution).getVariable("isDebugLogEnabled")
+ verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest")
+ verify(mockExecution).setVariable("sdncAdapterResponse",workflowResponse)
+ verify(mockExecution).setVariable("enhancedCallbackRequestData",enhancedCallbackRequestData)
+ verify(mockExecution).setVariable("continueListening",false)
+
+ }
+
+ @Test
+ public void testProcessResponse_ErrorCase_404()
+ {
+ String sdncAdapterCallbackErrorResponse = FileUtil.readResourceFile("sdncadaptercallbackrequest_404CallBack.xml");
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+ when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackErrorResponse)
+ SDNCAdapter sdncAdapter = new SDNCAdapter()
+ sdncAdapter.postProcessResponse(mockExecution)
+
+ verify(mockExecution, times(1)).getVariable("isDebugLogEnabled")
+ verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest")
+ verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseError)
+ verify(mockExecution).setVariable("enhancedCallbackRequestData", "")
+ verify(mockExecution).setVariable("continueListening",false)
+
+ }
+
+ @Test
+ public void testProcessResponse_ErrorCase_InvalidCallback()
+ {
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+ when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn("<h1>Service Unavailable</h1>")
+ SDNCAdapter sdncAdapter = new SDNCAdapter()
+ sdncAdapter.postProcessResponse(mockExecution)
+
+ verify(mockExecution).getVariable("isDebugLogEnabled")
+ verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest")
+ verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseEmpty)
+ verify(mockExecution).setVariable("enhancedCallbackRequestData", "")
+ verify(mockExecution).setVariable("continueListening",false)
+
+ }
+
+ @Test
+ public void postProcessResponse()
+ {
+
+ String SDNCAdapterCallbackRequest =
+ """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<SDNCAdapterCallbackRequest
+ xmlns="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
+ <CallbackHeader>
+ <RequestId>3bb02798-b344-4d28-9bca-1f029954d1c9</RequestId>
+ <ResponseCode>404</ResponseCode>
+ <ResponseMessage>Error processing request to SDNC. Not Found.
+ https://sdncodl.us.infra.aic.net:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693.
+ SDNC Returned-[error-type:application, error-tag:data-missing,
+ error-message:Request could not be completed because the relevant
+ data model content does not exist ]</ResponseMessage>
+ </CallbackHeader>
+</SDNCAdapterCallbackRequest>"""
+
+ String sdncAdapterResponse =
+ """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
+ <sdncadapterworkflow:response-data>
+ <tag0:CallbackHeader>
+ <tag0:RequestId>3bb02798-b344-4d28-9bca-1f029954d1c9</tag0:RequestId>
+ <tag0:ResponseCode>404</tag0:ResponseCode>
+ <tag0:ResponseMessage>Error processing request to SDNC. Not Found.
+ https://sdncodl.us.infra.aic.net:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693.
+ SDNC Returned-[error-type:application, error-tag:data-missing,
+ error-message:Request could not be completed because the relevant
+ data model content does not exist ]</tag0:ResponseMessage>
+ </tag0:CallbackHeader>
+ </sdncadapterworkflow:response-data>
+</sdncadapterworkflow:SDNCAdapterWorkflowResponse>"""
+
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+ when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(SDNCAdapterCallbackRequest)
+ SDNCAdapter sdncAdapter = new SDNCAdapter()
+ sdncAdapter.postProcessResponse(mockExecution)
+
+ verify(mockExecution).getVariable("isDebugLogEnabled")
+ verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest")
+ verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponse)
+ verify(mockExecution).setVariable("enhancedCallbackRequestData", "")
+ verify(mockExecution).setVariable("continueListening",false)
+
+ }
+
}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtilTest.groovy new file mode 100644 index 0000000000..b525967569 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtilTest.groovy @@ -0,0 +1,201 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - 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=========================================================
+ */
+
+package org.openecomp.mso.bpmn.common.scripts
+
+import org.junit.Assert
+import org.junit.Ignore
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+
+
+import static org.mockito.Mockito.*
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.runner.RunWith
+import org.mockito.MockitoAnnotations
+import org.mockito.internal.debugging.MockitoDebuggerImpl
+import org.mockito.runners.MockitoJUnitRunner
+import org.openecomp.mso.bpmn.common.scripts.TrinityExceptionUtil;
+@RunWith(MockitoJUnitRunner.class)
+import org.junit.Test
+
+class TrinityExceptionUtilTest {
+
+ def aotsFault ="""<n1:Fault xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:n1="http://csi.cingular.com/CSI/Namespaces/OneTicketingSystem/InfrastructureCommon/Types/Public/SoapFault.xsd" xmlns:cer="http://csi.cingular.com/CSI/Namespaces/OneTicketingSystem/InfrastructureCommon/Types/Public/ErrorResponse.xsd" xsi:schemaLocation="http://csi.cingular.com/CSI/Namespaces/OneTicketingSystem/InfrastructureCommon/Types/Public/SoapFault.xsd SoapFault-CDM.xsd">
+ <n1:faultcode>xml:space</n1:faultcode>
+ <n1:faultstring>String</n1:faultstring>
+ <n1:faultactor>http://test.com</n1:faultactor>
+ <n1:detail>
+ <n1:CSIApplicationException>
+ <cer:Response>
+ <cer:code>400</cer:code>
+ <cer:description>bad stuff</cer:description>
+ </cer:Response>
+ <cer:ServiceProviderEntity>
+ <cer:reportingServiceEntity>String</cer:reportingServiceEntity>
+ <cer:faultDate>*** ERROR ***</cer:faultDate>
+ <cer:faultSequenceNumber>String</cer:faultSequenceNumber>
+ <cer:faultLevel>String</cer:faultLevel>
+ <cer:faultCode>String</cer:faultCode>
+ <cer:faultDescription>String</cer:faultDescription>
+ <cer:ServiceProviderRawError>
+ <cer:code>String</cer:code>
+ <cer:description>String</cer:description>
+ <cer:BISError>
+ <cer:code>String</cer:code>
+ <cer:description>String</cer:description>
+ <cer:origination>String</cer:origination>
+ <cer:severity>String</cer:severity>
+ </cer:BISError>
+ </cer:ServiceProviderRawError>
+ </cer:ServiceProviderEntity>
+ </n1:CSIApplicationException>
+ <n1:CSIInternalException>
+ <cer:reportingServiceEntity>String</cer:reportingServiceEntity>
+ <cer:faultDate>*** ERROR ***</cer:faultDate>
+ <cer:faultSequenceNumber>String</cer:faultSequenceNumber>
+ <cer:faultLevel>String</cer:faultLevel>
+ <cer:faultCode>String</cer:faultCode>
+ <cer:faultDescription>String</cer:faultDescription>
+ <cer:cingularErrorCode>String</cer:cingularErrorCode>
+ <cer:cingularErrorDescription>String</cer:cingularErrorDescription>
+ <cer:cingularErrorCategory>String</cer:cingularErrorCategory>
+ </n1:CSIInternalException>
+ </n1:detail>
+</n1:Fault>"""
+
+
+ @Before
+ public void init()
+ {
+ MockitoAnnotations.initMocks(this)
+ }
+
+ @Test
+ @Ignore
+ public void testMapAAIExceptionTCommonException() {
+
+
+
+ String restFault = """
+ <Fault>
+<requestError>
+<serviceException>
+<messageId>SVC3002</messageId>
+<text>Error writing output performing %1 on %2 (msg=%3) (ec=%4)</text>
+<variables>
+<variable>PUTcustomer</variable>
+<variable>SubName01</variable>
+<variable>Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id]</variable>
+<variable>ERR.5.4.5105</variable>
+</variables>
+</serviceException>
+</requestError>
+</Fault>
+ """
+ def errorString = """<requestError>
+<serviceException>
+<messageId>SVC3002</messageId>
+<text>Error writing output performing %1 on %2 (msg=%3) (ec=%4)</text>
+<variables>
+<variable>PUTcustomer</variable>
+<variable>SubName01</variable>
+<variable>Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id]</variable>
+<variable>ERR.5.4.5105</variable>
+</variables>
+</serviceException>
+</requestError>""" as String
+
+
+
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+
+ TrinityExceptionUtil util = new TrinityExceptionUtil()
+ Assert.assertEquals(errorString, util.mapAAIExceptionTCommonException(restFault, mockExecution))
+ }
+
+
+
+
+ @Test
+ public void testBuildException() {
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+ when(mockExecution.getVariable("prefix")).thenReturn("test_")
+ when(mockExecution.getVariable("test_ResponseCode")).thenReturn("400")
+ ArrayList msgVars = new ArrayList()
+ msgVars.add("var1")
+ msgVars.add("var2")
+ when(mockExecution.getVariable("test_errVariables")).thenReturn(msgVars)
+
+
+ TrinityExceptionUtil util = new TrinityExceptionUtil()
+ String msg = "Bad request"
+ String errorString = """<tns:requestError xmlns:tns="http://org.openecomp/mso/request/types/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://org.openecomp/mso/request/types/v1 MsoServiceInstanceTypesV1.xsd">
+ <tns:serviceException>
+ <tns:messageId>SVC2000</tns:messageId>
+ <tns:text>The following service error occurred: %1. Error code is %2.</tns:text>
+ <tns:variables>var1</tns:variables>
+ <tns:variables>var2</tns:variables>
+ </tns:serviceException>
+</tns:requestError>"""
+ Assert.assertEquals(errorString, util.buildException(msg, mockExecution))
+ }
+
+ @Test
+ public void testMapAOTSExecptionToCommonException() {
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+ when(mockExecution.getVariable("prefix")).thenReturn("test_")
+ when(mockExecution.getVariable("test_ResponseCode")).thenReturn("400")
+
+ TrinityExceptionUtil util = new TrinityExceptionUtil()
+ String errorString = """<tns:requestError xmlns:tns="http://org.openecomp/mso/request/types/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://org.openecomp/mso/request/types/v1 MsoServiceInstanceTypesV1.xsd">
+ <tns:serviceException>
+ <tns:messageId>SVC2000</tns:messageId>
+ <tns:text>The following service error occurred: %1. Error code is %2.</tns:text>
+ <tns:variables>Received error from AOTS: bad stuff</tns:variables>
+ <tns:variables>400</tns:variables>
+ </tns:serviceException>
+</tns:requestError>"""
+ Assert.assertEquals(errorString, util.mapAOTSExecptionToCommonException(aotsFault, mockExecution))
+ }
+
+
+ @Test
+ public void testParseError() {
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+ String errorString = "The following service error occurred: %1. Error code is %2."
+ ArrayList msgVars = new ArrayList()
+ msgVars.add("var1")
+ msgVars.add("var2")
+ when(mockExecution.getVariable("prefix")).thenReturn("test_")
+ when(mockExecution.getVariable("test_errTxt")).thenReturn(errorString)
+ when(mockExecution.getVariable("test_errVariables")).thenReturn(msgVars)
+
+ TrinityExceptionUtil util = new TrinityExceptionUtil()
+
+ Assert.assertEquals("The following service error occurred: var1. Error code is var2.", util.parseError(mockExecution))
+}
+
+
+
+}
|