diff options
20 files changed, 1827 insertions, 1778 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java index f39962b2ce..ccdcf92953 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java @@ -228,7 +228,13 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ if (logger.isDebugEnabled()) { logger.debug("Multicloud Create Response Body: {}", multicloudResponseBody); } - return getStackStatus(cloudSiteId, cloudOwner, tenantId, canonicalName, pollForCompletion, timeoutMinutes, backout); + StackInfo stackStatus = getStackStatus(cloudSiteId, cloudOwner, tenantId, canonicalName, pollForCompletion, timeoutMinutes, backout); + + if (HeatStatus.CREATED.equals(stackStatus.getStatus())) { + multicloudAaiUpdate(cloudSiteId, cloudOwner, tenantId, genericVnfId, vfModuleId, multicloudResponseBody.getWorkloadId(), pollForCompletion, timeoutMinutes); + } + + return stackStatus; } StringBuilder stackErrorStatusReason = new StringBuilder(response.getStatusInfo().getReasonPhrase()); if (null != multicloudResponseBody) { @@ -287,7 +293,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ if (multicloudClient != null) { Response response = multicloudClient.get(); if (logger.isDebugEnabled()) { - logger.debug (String.format("Mulicloud GET Response: %s", response.toString())); + logger.debug (String.format("Multicloud GET Response: %s", response.toString())); } MulticloudQueryResponse multicloudQueryBody = null; @@ -371,6 +377,81 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ return HeatStatus.UNKNOWN; } + private void multicloudAaiUpdate(String cloudSiteId, String cloudOwner, String tenantId, String genericVnfId, String vfModuleId, String workloadId, + boolean pollForCompletion, int timeoutMinutes) { + + MulticloudRequest multicloudRequest= new MulticloudRequest(); + + multicloudRequest.setGenericVnfId(genericVnfId); + multicloudRequest.setVfModuleId(vfModuleId); + + String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, workloadId); + RestClient multicloudClient = getMulticloudClient(multicloudEndpoint); + + if (multicloudClient == null) { + if (logger.isDebugEnabled()) + logger.debug("Multicloud client could not be initialized"); + } + + Response response = multicloudClient.post(multicloudRequest); + if (response.getStatus() != Response.Status.ACCEPTED.getStatusCode()) { + if (logger.isDebugEnabled()) + logger.debug("Multicloud AAI update request failed: " + response.getStatus() + response.getStatusInfo()); + return; + } + + if (!pollForCompletion) { + return; + } + + int updatePollInterval = Integer.parseInt(this.environment.getProperty(createPollIntervalProp, createPollIntervalDefault)); + int pollTimeout = (timeoutMinutes * 60) + updatePollInterval; + boolean updateTimedOut = false; + logger.debug("updatePollInterval=" + updatePollInterval + ", pollTimeout=" + pollTimeout); + + StackInfo stackInfo = null; + while (true) { + try { + stackInfo = queryStack(cloudSiteId, cloudOwner, tenantId, workloadId); + if (logger.isDebugEnabled()) + logger.debug (stackInfo.getStatus() + " (" + workloadId + ")"); + + if (HeatStatus.UPDATING.equals(stackInfo.getStatus())) { + if (pollTimeout <= 0) { + // Note that this should not occur, since there is a timeout specified + // in the Openstack (multicloud?) call. + if (logger.isDebugEnabled()) + logger.debug("Multicloud AAI update timeout failure: {} {} {} {}", cloudOwner, cloudSiteId, tenantId, workloadId); + updateTimedOut = true; + break; + } + + sleep(updatePollInterval * 1000L); + + pollTimeout -= updatePollInterval; + if (logger.isDebugEnabled()) + logger.debug("pollTimeout remaining: " + pollTimeout); + } else { + break; + } + } catch (MsoException me) { + if (logger.isDebugEnabled()) + logger.debug("Multicloud AAI update exception: {} {} {} {}", cloudOwner, cloudSiteId, tenantId, workloadId, me); + return; + } + } + if (updateTimedOut) { + if (logger.isDebugEnabled()) + logger.debug("Multicloud AAI update request failed: {} {}", response.getStatus(), response.getStatusInfo().toString()); + } else if (!HeatStatus.UPDATED.equals(stackInfo.getStatus())) { + if (logger.isDebugEnabled()) + logger.debug("Multicloud AAI update request failed: {} {}", response.getStatus(), response.getStatusInfo().toString()); + } else { + if (logger.isDebugEnabled()) + logger.debug("Multicloud AAI update successful: {} {}", response.getStatus(), response.getStatusInfo().toString()); + } + } + private StackInfo getStackStatus(String cloudSiteId, String cloudOwner, String tenantId, String instanceId) throws MsoException { return getStackStatus(cloudSiteId, cloudOwner, tenantId, instanceId, false, 0, false); } @@ -596,7 +677,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ return null; } - private String getMulticloudEndpoint(String cloudSiteId, String cloudOwner, String workloadId) throws MsoCloudSiteNotFound { + private String getMulticloudEndpoint(String cloudSiteId, String cloudOwner, String workloadId) { String msbIp = System.getenv().get(ONAP_IP); if (null == msbIp || msbIp.isEmpty()) { msbIp = environment.getProperty("mso.msb-ip", DEFAULT_MSB_IP); diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java index fbe532d1fe..669e47f94d 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java @@ -23,6 +23,7 @@ package org.onap.so.openstack.utils; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static org.junit.Assert.assertEquals; @@ -36,6 +37,7 @@ import java.util.HashMap; import java.util.Optional; import org.apache.http.HttpStatus; +import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.mockito.InjectMocks; @@ -67,18 +69,43 @@ public class MsoMulticloudUtilsTest extends BaseTest { private static final String CREATE_STACK_RESPONSE = "{\"template_type\": \"TEST-template\", \"workload_id\": " + "\"TEST-workload\", \"template_response\": {\"stack\": {\"id\": \"TEST-stack\", \"links\": []}}}"; + private static final String UPDATE_STACK_RESPONSE = "{\"template_type\": \"TEST-template\", \"workload_id\": " + + "\"TEST-workload\"}"; + private static final String GET_CREATE_STACK_RESPONSE = "{\"template_type\": \"TEST-template\", \"workload_id\": " + + "\"TEST-workload\", \"workload_status\": \"CREATE_COMPLETE\"}"; + private static final String GET_UPDATE_STACK_RESPONSE = "{\"template_type\": \"TEST-template\", \"workload_id\": " + + "\"TEST-workload\", \"workload_status\": \"UPDATE_COMPLETE\"}"; - private static final String MULTICLOUD_PATH = "/api/multicloud/v1/CloudOwner/MTN14/infra_workload"; + private static final String MULTICLOUD_CREATE_PATH = "/api/multicloud/v1/CloudOwner/MTN14/infra_workload"; + private static final String MULTICLOUD_UPDATE_PATH = "/api/multicloud/v1/CloudOwner/MTN14/infra_workload/TEST-workload"; + private static final String MULTICLOUD_GET_PATH = "/api/multicloud/v1/CloudOwner/MTN14/infra_workload/TEST-workload"; @Test public void createStackSuccess() throws MsoException, IOException { - wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_PATH)) + wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_CREATE_PATH)).inScenario("CREATE") .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(CREATE_STACK_RESPONSE) - .withStatus(HttpStatus.SC_CREATED))); + .withStatus(HttpStatus.SC_CREATED)) + .willSetStateTo("CREATING")); + wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH)) + .inScenario("CREATE").whenScenarioStateIs("CREATING") + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(GET_CREATE_STACK_RESPONSE) + .withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_UPDATE_PATH)).inScenario("CREATE") + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(UPDATE_STACK_RESPONSE) + .withStatus(HttpStatus.SC_ACCEPTED)) + .willSetStateTo("UPDATING")); + wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH)) + .inScenario("CREATE").whenScenarioStateIs("UPDATING") + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(GET_UPDATE_STACK_RESPONSE) + .withStatus(HttpStatus.SC_OK))); StackInfo result = multicloudUtils.createStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(), - "TEST-heat", new HashMap<>(), false, 200, "TEST-env", + "TEST-heat", new HashMap<>(), true, 200, "TEST-env", new HashMap<>(), new HashMap<>(), false); + wireMockServer.resetScenarios(); assertNotNull(result); assertEquals("TEST-stack", result.getName()); } @@ -131,7 +158,7 @@ public class MsoMulticloudUtilsTest extends BaseTest { @Test public void createStackBadRequest() { try { - wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_PATH)) + wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_CREATE_PATH)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withStatus(HttpStatus.SC_BAD_REQUEST))); multicloudUtils.createStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(), @@ -146,7 +173,7 @@ public class MsoMulticloudUtilsTest extends BaseTest { @Test public void createStackEmptyResponseEntity() throws MsoException { - wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_PATH)) + wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_CREATE_PATH)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withStatus(HttpStatus.SC_CREATED))); StackInfo result = multicloudUtils.createStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(), diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java index aafcb1c600..349aa78d44 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java @@ -28,6 +28,7 @@ import javax.jws.WebParam; import javax.jws.WebParam.Mode; import javax.jws.WebService; import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import javax.xml.ws.Holder; import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists; @@ -35,6 +36,7 @@ import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.entity.MsoRequest; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; +import org.onap.so.openstack.mappers.MapAdapter; @WebService (name="VnfAdapter", targetNamespace="http://org.onap.so/vnf") public interface MsoVnfAdapter @@ -51,7 +53,7 @@ public interface MsoVnfAdapter @WebParam(name="vnfName") @XmlElement(required=true) String vnfName, @WebParam(name="requestType") @XmlElement(required=false) String requestType, @WebParam(name="volumeGroupHeatStackId") @XmlElement(required=false) String volumeGroupHeatStackId, - @WebParam(name="inputs") Map<String,Object> inputs, + @WebParam(name="inputs") @XmlJavaTypeAdapter(MapAdapter.class) Map<String,Object> inputs, @WebParam(name="failIfExists") Boolean failIfExists, @WebParam(name="backout") Boolean backout, @WebParam(name="enableBridge") Boolean enableBridge, @@ -70,7 +72,7 @@ public interface MsoVnfAdapter @WebParam(name="vnfName") @XmlElement(required=true) String vnfName, @WebParam(name="requestType") @XmlElement(required=false) String requestType, @WebParam(name="volumeGroupHeatStackId") @XmlElement(required=false) String volumeGroupHeatStackId, - @WebParam(name="inputs") Map<String,Object> inputs, + @WebParam(name="inputs") @XmlJavaTypeAdapter(MapAdapter.class) Map<String,Object> inputs, @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="outputs", mode=Mode.OUT) Holder<Map<String,String>> outputs, @WebParam(name="rollback", mode=Mode.OUT) Holder<VnfRollback> rollback ) @@ -114,7 +116,7 @@ public interface MsoVnfAdapter @WebParam(name="volumeGroupHeatStackId") @XmlElement(required=false) String volumeGroupHeatStackId, @WebParam(name="baseVfHeatStackId") @XmlElement(required=false) String baseVfHeatStackId, @WebParam(name = "modelCustomizationUuid") @XmlElement(required = false) String modelCustomizationUuid, - @WebParam(name="inputs") Map<String,Object> inputs, + @WebParam(name="inputs") @XmlJavaTypeAdapter(MapAdapter.class) Map<String,Object> inputs, @WebParam(name="failIfExists") Boolean failIfExists, @WebParam(name="backout") Boolean backout, @WebParam(name="enableBridge") Boolean enableBridge, @@ -145,7 +147,7 @@ public interface MsoVnfAdapter @WebParam(name="baseVfHeatStackId") @XmlElement(required=false) String baseVfHeatStackId, @WebParam(name="vfModuleStackId") @XmlElement(required=false) String vfModuleStackId, @WebParam(name = "modelCustomizationUuid") @XmlElement(required = false) String modelCustomizationUuid, - @WebParam(name="inputs") Map<String,Object> inputs, + @WebParam(name="inputs") @XmlJavaTypeAdapter(MapAdapter.class) Map<String,Object> inputs, @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="outputs", mode=Mode.OUT) Holder<Map<String,String>> outputs, @WebParam(name="rollback", mode=Mode.OUT) Holder<VnfRollback> rollback ) diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java index 70afb1c69c..5642e01a72 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java @@ -28,9 +28,11 @@ import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebService; import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.onap.so.entity.MsoRequest; import org.onap.so.openstack.beans.VnfRollback; +import org.onap.so.openstack.mappers.MapAdapter; /** * This webservice defines the Asynchronous versions of VNF adapter calls. @@ -54,7 +56,7 @@ public interface MsoVnfAdapterAsync @WebParam(name="vnfName") @XmlElement(required=true) String vnfName, @WebParam(name="requestType") @XmlElement(required=false) String requestType, @WebParam(name="volumeGroupHeatStackId") @XmlElement(required=false) String volumeGroupHeatStackId, - @WebParam(name="inputs") Map<String,Object> inputs, + @WebParam(name="inputs") @XmlJavaTypeAdapter(MapAdapter.class) Map<String,Object> inputs, @WebParam(name="failIfExists") Boolean failIfExists, @WebParam(name="backout") Boolean backout, @WebParam(name="enableBridge") Boolean enableBridge, @@ -72,7 +74,7 @@ public interface MsoVnfAdapterAsync @WebParam(name="vnfName") @XmlElement(required=true) String vnfName, @WebParam(name="requestType") @XmlElement(required=false) String requestType, @WebParam(name="volumeGroupHeatStackId") @XmlElement(required=false) String volumeGroupHeatStackId, - @WebParam(name="inputs") Map<String,Object> inputs, + @WebParam(name="inputs") @XmlJavaTypeAdapter(MapAdapter.class) Map<String,Object> inputs, @WebParam(name="messageId") @XmlElement(required=true) String messageId, @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="notificationUrl") @XmlElement(required=true) String notificationUrl ); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java index 72b3795053..141dd4fe50 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java @@ -25,6 +25,7 @@ import org.openstack4j.api.OSClient.OSClientV2; import org.openstack4j.api.OSClient.OSClientV3; import org.openstack4j.api.exceptions.AuthenticationException; import org.openstack4j.openstack.OSFactory; +import org.openstack4j.model.common.Identifier; public class OpenstackClientFactoryImpl implements OpenstackClientFactory { @@ -35,12 +36,14 @@ public class OpenstackClientFactoryImpl implements OpenstackClientFactory { Preconditions.checkNotNull(osAccess.getPassword(), "Keystone-v3 Auth: password not set."); Preconditions.checkNotNull(osAccess.getDomainNameIdentifier(), "Keystone-v3 Auth: domain not set."); Preconditions.checkNotNull(osAccess.getRegion(), "Keystone-v3 Auth: region not set."); + Preconditions.checkNotNull(osAccess.getTenantId(), "Keystone-v3 Auth: tenant-id not set."); OSClientV3 client; try { client = OSFactory.builderV3() .endpoint(osAccess.getUrl()) .credentials(osAccess.getUser(), osAccess.getPassword(), osAccess.getDomainNameIdentifier()) + .scopeToProject(Identifier.byId(osAccess.getTenantId())) .authenticate() .useRegion(osAccess.getRegion()); return new OpenstackV3ClientImpl(client); @@ -54,7 +57,7 @@ public class OpenstackClientFactoryImpl implements OpenstackClientFactory { Preconditions.checkNotNull(osAccess.getUrl(), "Keystone-v2 Auth: endpoint not set."); Preconditions.checkNotNull(osAccess.getUser(), "Keystone-v2 Auth: username not set."); Preconditions.checkNotNull(osAccess.getPassword(), "Keystone-v2 Auth: password not set."); - Preconditions.checkNotNull(osAccess.getTenantId(), "Keystone-v2 Auth: domain not set."); + Preconditions.checkNotNull(osAccess.getTenantId(), "Keystone-v2 Auth: tenant-id not set."); Preconditions.checkNotNull(osAccess.getRegion(), "Keystone-v2 Auth: region not set."); OSClientV2 client; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java index 5868da563c..d2651e6055 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java @@ -21,6 +21,7 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; +import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -39,6 +40,14 @@ public class LineOfBusiness implements Serializable, ShallowCopy<LineOfBusiness> @JsonProperty("line-of-business-name") private String lineOfBusinessName; + public LineOfBusiness() { + } + + + public LineOfBusiness(String lineOfBusinessName) { + this.lineOfBusinessName = lineOfBusinessName; + } + public String getLineOfBusinessName() { return lineOfBusinessName; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Platform.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Platform.java index 642417fa56..d13707deb4 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Platform.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Platform.java @@ -38,6 +38,14 @@ public class Platform implements Serializable, ShallowCopy<Platform> { @Id @JsonProperty("platform-name") private String platformName; + + public Platform() { + } + + + public Platform(String platformName) { + this.platformName = platformName; + } public String getPlatformName() { return platformName; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java index 80d8d928aa..80625dd4d5 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java @@ -552,6 +552,21 @@ public class StubResponseAAI { .withBodyFile(responseFile))); } + public static void MockPostNetwork(WireMockServer wireMockServer, String networkId) { + wireMockServer.stubFor(post(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId)) + .willReturn(aResponse() + .withStatus(201) + .withHeader("Content-Type", "text/xml"))); + } + + public static void MockPostNetworkSubnet(WireMockServer wireMockServer, String networkId, String subnetId) { + wireMockServer.stubFor(post(urlMatching( + "/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "/subnets/subnet/" + subnetId)) + .willReturn(aResponse() + .withStatus(201) + .withHeader("Content-Type", "text/xml"))); + } + public static void MockGetNetworkName(WireMockServer wireMockServer, String networkPolicyName, String responseFile, int statusCode) { wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName)) .willReturn(aResponse() @@ -560,13 +575,19 @@ public class StubResponseAAI { .withBodyFile(responseFile))); } - public static void MockGetNetworkVpnBinding(WireMockServer wireMockServer, String responseFile, String vpnBinding) { - wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/"+vpnBinding + "[?]depth=all")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); - } + public static void MockGetNetworkVpnBinding(WireMockServer wireMockServer, String responseFile, String vpnBinding) { + MockGetNetworkVpnBindingWithDepth(wireMockServer, responseFile, vpnBinding, "all"); + } + + public static void MockGetNetworkVpnBindingWithDepth(WireMockServer wireMockServer, String responseFile, + String vpnBinding, String depth) { + wireMockServer.stubFor( + get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + vpnBinding + "[?]depth=" + depth)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } public static void MockGetNetworkPolicy(WireMockServer wireMockServer, String responseFile, String policy) { wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/"+policy + "[?]depth=all")) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy index 6acf2223b0..c419f0dc7d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy @@ -170,7 +170,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{ execution.setVariable(prefix+'volumeGroupHeatStackId', heatStackId) logger.debug('Heat stack id from AAI response: ' + heatStackId) - AAIResultWrapper wrapper = getAAIClient().get(uri); + AAIResultWrapper wrapper = getAAIClient().get(resourceUri); Optional<Relationships> relationships = wrapper.getRelationships() String volumeGroupTenantId = null diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy index 430c16bbef..6162780b27 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy @@ -782,7 +782,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String source = execution.getVariable(Prefix + "source") String requestInput = execution.getVariable(Prefix + "networkRequest") - String queryIdResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") + L3Network queryIdResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") String cloudRegionId = execution.getVariable(Prefix + "cloudRegionPo") String backoutOnFailure = execution.getVariable(Prefix + "rollbackEnabled") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy index ab7b659b51..0344206145 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy @@ -297,6 +297,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { public void prepVnfAdapterRest(DelegateExecution execution, isDebugLogEnabled) { def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') + def cloudOwner = execution.getVariable("UPDVfModVol_cloudRegion") def tenantId = execution.getVariable('UPDVfModVol_tenantId') def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy index eab1b89e10..2885d6919e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -26,21 +28,25 @@ import org.camunda.bpm.engine.RepositoryService import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.After +import org.junit.AfterClass import org.junit.Assert import org.junit.Before -import org.junit.Ignore +import org.junit.BeforeClass import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentCaptor import org.mockito.Captor +import org.mockito.Mock import org.mockito.Mockito import org.mockito.MockitoAnnotations import org.mockito.Spy -import org.mockito.runners.MockitoJUnitRunner +import org.mockito.junit.MockitoJUnitRunner import org.onap.aai.domain.yang.VolumeGroup import org.onap.so.bpmn.common.scripts.MsoGroovyTest import org.onap.so.bpmn.common.scripts.utils.XmlComparator +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.mock.FileUtil import org.onap.so.client.aai.AAIObjectType @@ -48,73 +54,111 @@ import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException +import org.springframework.core.env.Environment +import org.springframework.mock.env.MockEnvironment import javax.ws.rs.NotFoundException import static com.github.tomakehurst.wiremock.client.WireMock.* import static org.mockito.Mockito.* -@RunWith(MockitoJUnitRunner.class) +@RunWith(MockitoJUnitRunner.Silent.class) class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{ + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090) + @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) @Spy - DoDeleteVfModuleVolumeV2 deleteVfModuleVolumeV2; + DoDeleteVfModuleVolumeV2 deleteVfModuleVolumeV2 + + @Mock + Environment mockEnvironment + + private String Prefix = "DDVMV_" + private RepositoryService mockRepositoryService + + + @After + void cleanupEnv() { + UrnPropertiesReader urnPropertiesReader = new UrnPropertiesReader() + urnPropertiesReader.setEnvironment(null) + } @Before public void init() throws IOException { super.init("DoDeleteVfModuleVolumeV2") MockitoAnnotations.initMocks(this); when(deleteVfModuleVolumeV2.getAAIClient()).thenReturn(client) - + when(mockEnvironment.getProperty("mso.workflow.global.default.aai.version")).thenReturn("14") + when(mockEnvironment.getProperty("mso.workflow.global.default.aai.namespace")).thenReturn("defaultTestNamespace") + when(mockEnvironment.getProperty("aai.endpoint")).thenReturn("http://localhost:8090") + UrnPropertiesReader urnPropertiesReader = new UrnPropertiesReader() + urnPropertiesReader.setEnvironment(mockEnvironment) } @Test public void testCallRESTQueryAAICloudRegion() { ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn("DDVMV_") + when(mockExecution.getVariable("prefix")).thenReturn(Prefix) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("12345") - when(mockExecution.getVariable("mso.workflow.DoDeleteVfModuleVolumeV2.aai.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + mockSuccessfulCloudData() - mockData() DoDeleteVfModuleVolumeV2 obj = new DoDeleteVfModuleVolumeV2() obj.callRESTQueryAAICloudRegion(mockExecution, "true") Mockito.verify(mockExecution).setVariable("DDVMV_queryCloudRegionReturnCode", "200") Mockito.verify(mockExecution).setVariable("DDVMV_aicCloudRegion", "RDM2WAGPLCP") } - @Test + @Test(expected = GroovyRuntimeException.class) public void testCallRESTQueryAAICloudRegionAAiEndpointNull() { ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn("DDVMV_") + when(mockExecution.getVariable("prefix")).thenReturn(Prefix) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("12345") - when(mockExecution.getVariable("mso.workflow.DoDeleteVfModuleVolumeV2.aai.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region") - when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockEnvironment.getProperty("aai.endpoint")).thenReturn(null) - mockData() + mockSuccessfulCloudData() try { DoDeleteVfModuleVolumeV2 obj = new DoDeleteVfModuleVolumeV2() obj.callRESTQueryAAICloudRegion(mockExecution, "true") } catch (Exception ex) { - println " Test End - Handle catch-throw BpmnError()! " + println " Test End - Handle catch-throw Exception! " + Mockito.verify(mockExecution).getVariable(eq("lcpCloudRegionId")) + Assert.assertEquals(GroovyRuntimeException.class, ex.class) + throw ex } - Mockito.verify(mockExecution,atLeastOnce()).setVariable(captor.capture(),captor.capture()) - WorkflowException workflowException = captor.getValue() - Assert.assertEquals(9999, workflowException.getErrorCode()) + } + + @Test + public void testCallRESTQueryAAICloudRegionNotFound() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(Prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("12345") + when(mockExecution.getVariable(Prefix + "queryCloudRegionReturnCode")).thenReturn("404") + + wireMockRule.stubFor( + get(urlMatching(".*/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/12345")) + .willReturn(aResponse() + .withStatus(404))) + + DoDeleteVfModuleVolumeV2 obj = new DoDeleteVfModuleVolumeV2() + obj.callRESTQueryAAICloudRegion(mockExecution, "true") + + Mockito.verify(mockExecution).getVariable(eq("lcpCloudRegionId")) + Mockito.verify(mockExecution).setVariable(eq(Prefix + "queryCloudRegionReturnCode"), eq("404")) + Mockito.verify(mockExecution).setVariable(eq(Prefix + "aicCloudRegion"), eq("AAIAIC25")) } @Test public void testPrepareVnfAdapterDeleteRequest() { ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn("DDVMV_") + when(mockExecution.getVariable("prefix")).thenReturn(Prefix) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("aicCloudRegion")).thenReturn("RegionOne") when(mockExecution.getVariable("tenantId")).thenReturn("12345") @@ -139,8 +183,10 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{ when(mockExecution.getVariable("volumeGroupId")).thenReturn("VolumeGroup123") when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1") AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123") - Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/aai/VolumeGroupWithTenant.json"); + Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/AAI/VolumeGroupWithTenant.json"); when(client.get(VolumeGroup.class,resourceUri)).thenReturn(volumeGroup) + when(client.get(resourceUri)).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/AAI/VolumeGroupWithTenant.json"))) deleteVfModuleVolumeV2.callRESTQueryAAIForVolumeGroup(mockExecution,"true") Mockito.verify(mockExecution).setVariable("DDVMV_queryAAIVolGrpResponse", volumeGroup.get()) Mockito.verify(mockExecution).setVariable("DDVMV_volumeGroupHeatStackId", volumeGroup.get().getHeatStackId()) @@ -167,7 +213,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{ when(mockExecution.getVariable("volumeGroupId")).thenReturn("VolumeGroup123") when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1") AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123") - Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/aai/VolumeGroupWithTenant.json"); + Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/AAI/VolumeGroupWithTenant.json"); when(client.get(VolumeGroup.class,resourceUri)).thenReturn(volumeGroup) try { deleteVfModuleVolumeV2.callRESTQueryAAIForVolumeGroup(mockExecution, "true") @@ -248,30 +294,20 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{ private ExecutionEntity setupMock() { - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("DoDeleteVfModuleVolumeV2") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoDeleteVfModuleVolumeV2") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + mockRepositoryService = mock(RepositoryService.class) ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(this.mockRepositoryService) ExecutionEntity mockExecution = mock(ExecutionEntity.class) // Initialize prerequisite variables - - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("DoDeleteVfModuleVolumeV2") - when(mockExecution.getProcessInstanceId()).thenReturn("DoDeleteVfModuleVolumeV2") when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) return mockExecution } - private void mockData() { - stubFor(get(urlMatching(".*/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/12345")) + private void mockSuccessfulCloudData() { + wireMockRule.stubFor(get(urlMatching(".*/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/12345")) .willReturn(aResponse() .withStatus(200).withHeader("Content-Type", "text/xml") .withBodyFile("DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml"))) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy index 68a9ed659e..19bb7c86b4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -20,33 +22,34 @@ package org.onap.so.bpmn.infrastructure.scripts - -import static org.mockito.Mockito.* -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkByIdWithDepth; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion_404; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkVpnBinding; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkTableReference; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkPolicy; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutNetworkIdWithDepth; +import com.github.tomakehurst.wiremock.client.WireMock +import com.github.tomakehurst.wiremock.junit.WireMockRule import org.camunda.bpm.engine.ProcessEngineServices import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.camunda.bpm.engine.repository.ProcessDefinition -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.junit.Before -import org.junit.Rule -import org.junit.Test +import org.junit.* import org.junit.runner.RunWith import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner +import org.mockito.junit.MockitoJUnitRunner +import org.onap.aai.domain.yang.* import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException - -import com.github.tomakehurst.wiremock.client.WireMock -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.apache.commons.lang3.* - +import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.springframework.mock.env.MockEnvironment + +import static org.mockito.ArgumentMatchers.eq +import static org.mockito.ArgumentMatchers.isA +import static org.mockito.ArgumentMatchers.refEq +import static org.mockito.Mockito.atLeast +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.when +import static org.onap.so.bpmn.mock.StubResponseAAI.* @RunWith(MockitoJUnitRunner.class) class DoUpdateNetworkInstanceTest { @@ -200,24 +203,6 @@ String expectedNetworkInputMissingCloudRegion = <sdncVersion>null</sdncVersion> </network-inputs>""" - String networkInputsMissingName = - """<network-inputs xmlns="http://org.onap/so/infra/vnf-request/v1"> - <network-name/> - <network-type>CONTRAIL_EXTERNAL</network-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region> - <tenant-id>e81d842d3e8b45c5a59f57cd76af3aaf</tenant-id> - </network-inputs>""" - -String networkInputsMissingCloudRegion = -"""<network-inputs xmlns="http://org.onap/so/infra/vnf-request/v1"> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <aic-cloud-region/> - <tenant-id>e81d842d3e8b45c5a59f57cd76af3aaf</tenant-id> -</network-inputs>""" - // expectedNetworkRequest String expectedNetworkRequest = """<network-request xmlns="http://www.w3.org/2001/XMLSchema"> @@ -384,619 +369,6 @@ String expectedNetworkInputsMissingNetworkId = </vnfreq:network-params> </vnfreq:network-request>""" - // expectedNetworkRequest - String expectedNetworkRequest_Outputs = - """<vnfreq:network-request xmlns:vnfreq="http://org.onap/so/infra/vnf-request/v1"> - <vnfreq:request-info> - <vnfreq:request-id>1ef47428-cade-45bd-a103-0751e8b2deb0</vnfreq:request-id> - <vnfreq:action>UPDATE</vnfreq:action> - <vnfreq:source>PORTAL</vnfreq:source> - </vnfreq:request-info> - <vnfreq:network-inputs> - <vnfreq:network-name>MNS-25180-L-01-dmz_direct_net_1</vnfreq:network-name> - <vnfreq:network-type>CONTRAIL_EXTERNAL</vnfreq:network-type> - <vnfreq:service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</vnfreq:service-id> - <vnfreq:aic-cloud-region>RDM2WAGPLCP</vnfreq:aic-cloud-region> - <vnfreq:tenant-id>7dd5365547234ee8937416c65507d266</vnfreq:tenant-id> - </vnfreq:network-inputs> - <vnfreq:network-outputs> - <vnfreq:network-name>MNS-25180-L-01-dmz_direct_net_1</vnfreq:network-name> - <vnfreq:network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</vnfreq:network-id> - </vnfreq:network-outputs> - <vnfreq:network-params> - <param name="shared">1</param> - <param name="external">0</param> - </vnfreq:network-params> -</vnfreq:network-request>""" - - - String networkInputs = - """<network-inputs xmlns="http://org.onap/so/infra/vnf-request/v1"> - <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region> - <tenant-id>e81d842d3e8b45c5a59f57cd76af3aaf</tenant-id> -</network-inputs>""" - - String networkOutputs = - """<network-outputs> - <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - </network-outputs>""" - - String queryAAIResponse = - """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - statusCode="200"> - <rest:headers> - <rest:header name="Transfer-Encoding" value="chunked"/> - <rest:header name="Date" value="Thu,10 Mar 2016 00:01:18 GMT"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:502-132671"/> - <rest:header name="Content-Type" value="application/xml"/> - <rest:header name="Server" value="Apache-Coyote/1.1"/> - <rest:header name="Cache-Control" value="private"/> - </rest:headers> - <rest:payload contentType="text/xml"> - <l3-network xmlns="http://org.openecomp.aai.inventory/v3"> - <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <network-role>dmz_direct</network-role> - <network-technology>contrail</network-technology> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <network-role-instance>0</network-role-instance> - <orchestration-status>pending-delete</orchestration-status> - <subnets> - <subnet> - <subnet-id>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</subnet-id> - <gateway-address>107.239.52.1</gateway-address> - <network-start-address>107.239.52.0</network-start-address> - <cidr-mask>24</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>pending-delete</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <relationship-list/> - </subnet> - </subnets> - <relationship-list> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>85f015d0-2e32-4c30-96d2-87a1a27f8017</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>c980a6ef-3b88-49f0-9751-dbad8608d0a6</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>tenant</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/</related-link> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>7dd5365547234ee8937416c65507d266</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </l3-network> - </rest:payload> -</rest:RESTResponse>""" - - String queryIdAIIResponse = - """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - statusCode="200"> - <rest:headers> - <rest:header name="Transfer-Encoding" value="chunked"/> - <rest:header name="Date" value="Thu,10 Mar 2016 00:01:18 GMT"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:502-132671"/> - <rest:header name="Content-Type" value="application/xml"/> - <rest:header name="Server" value="Apache-Coyote/1.1"/> - <rest:header name="Cache-Control" value="private"/> - </rest:headers> - <rest:payload contentType="text/xml"> - <l3-network xmlns="http://org.openecomp.aai.inventory/v6"> - <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <network-role>dmz_direct</network-role> - <network-technology>contrail</network-technology> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <network-role-instance>0</network-role-instance> - <resource-version>l3-version</resource-version> - <orchestration-status>pending-delete</orchestration-status> - <heat-stack-id>ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326</heat-stack-id> - <physical-network-name>networkName</physical-network-name> - <is-provider-network>false</is-provider-network> - <is-shared-network>true</is-shared-network> - <is-external-network>false</is-external-network> - <subnets> - <subnet> - <subnet-id>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</subnet-id> - <gateway-address>107.239.52.1</gateway-address> - <network-start-address>107.239.52.0</network-start-address> - <cidr-mask>24</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>pending-update</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <subnet-name>subnetName</subnet-name> - <subnet-role>ECOMP</subnet-role> - <ip-assignment-direction>true</ip-assignment-direction> - <host-routes> - <host-route> - <host-route-id>400d286b-7e44-4514-b9b3-f70f7360ff32</host-route-id> - <route-prefix>172.20.1.0/24</route-prefix> - <next-hop>10.102.200.1</next-hop> - <next-hop-type>ip-address</next-hop-type> - <resource-version>1505857300987</resource-version> - </host-route> - <host-route> - <host-route-id>6f038013-8b15-4eb8-914b-507489fbc8ee</host-route-id> - <route-prefix>10.102.0.0/16</route-prefix> - <next-hop>10.102.200.1</next-hop> - <next-hop-type>ip-address</next-hop-type> - <resource-version>1505857301151</resource-version> - </host-route> - <host-route> - <host-route-id>8811c5f8-f1ed-4fa0-a505-e1be60396e28</host-route-id> - <route-prefix>192.168.2.0/25</route-prefix> - <next-hop>10.102.200.1</next-hop> - <resource-version>1505857301954</resource-version> - </host-route> - </host-routes> - <relationship-list/> - </subnet> - <subnet> - <subnet-id>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</subnet-id> - <gateway-address>107.239.52.1</gateway-address> - <network-start-address>107.239.52.0</network-start-address> - <cidr-mask>24</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>pending-delete</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <subnet-name>subnetName</subnet-name> - <ip-assignment-direction>true</ip-assignment-direction> - <host-routes> - <host-route> - <host-route-id>400d286b-7e44-4514-b9b3-f70f7360ff32</host-route-id> - <route-prefix>172.20.1.0/24</route-prefix> - <next-hop>10.102.200.1</next-hop> - <resource-version>1505857300987</resource-version> - </host-route> - </host-routes> - <relationship-list/> - </subnet> - </subnets> - <segmentation-assignments> - <segmentation-id>414</segmentation-id> - <resource-version>4132176</resource-version> - </segmentation-assignments> - <segmentation-assignments> - <segmentation-id>415</segmentation-id> - <resource-version>4132176</resource-version> - </segmentation-assignments> - <ctag-assignments> - <ctag-assignment> - <vlan-id-inner>inner</vlan-id-inner> - <resource-version>ctag-version</resource-version> - <relationship-list> - <relationship> - <related-to>tenant</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/</related-link> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>897deadc2b954a6bac6d3c197fb3525e</relationship-value> - </relationship-data> - <related-to-property> - <property-key>tenant.tenant-name</property-key> - <property-value>MSOTest1</property-value> - </related-to-property> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>a290b841-f672-44dd-b9cd-6f8c20d7d8c8</relationship-value> - </relationship-data> - <related-to-property> - <property-key>vpn-binding.vpn-name</property-key> - <property-value>oam_protected_net_6_MTN5_msotest2</property-value> - </related-to-property> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>24a4b507-853a-4a38-99aa-05fcc54be24d</relationship-value> - </relationship-data> - <related-to-property> - <property-key>vpn-binding.vpn-name</property-key> - <property-value>oam_protected_net_6_MTN5_msotest1</property-value> - </related-to-property> - </relationship> - </relationship-list> - </ctag-assignment> - </ctag-assignments> - <relationship-list> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>85f015d0-2e32-4c30-96d2-87a1a27f8017</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>c980a6ef-3b88-49f0-9751-dbad8608d0a6</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>tenant</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/</related-link> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>7dd5365547234ee8937416c65507d266</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>network-policy</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg</related-link> - <relationship-data> - <relationship-key>network-policy.network-policy-id</relationship-key> - <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0cg</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>route-table-reference</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1</related-link> - <relationship-data> - <relationship-key>route-table-reference.route-table-reference-id</relationship-key> - <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0hi</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>route-table-reference</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2</related-link> - <relationship-data> - <relationship-key>route-table-reference.route-table-reference-id</relationship-key> - <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0hi</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </l3-network> - </rest:payload> -</rest:RESTResponse>""" - - String queryIdAIIResponseTestScenario01 = - """<?xml version="1.0" encoding="UTF-8"?> -<l3-network xmlns="http://org.openecomp.aai.inventory/v7"> - <network-id>4da55fe4-7a9e-478c-a434-8a98d62265ab</network-id> - <network-name>GN_EVPN_direct_net_0_ST1</network-name> - <network-type>CONTRAIL30_BASIC</network-type> - <network-role>GN_EVPN_direct</network-role> - <network-technology>contrail</network-technology> - <is-bound-to-vpn>false</is-bound-to-vpn> - <service-id>9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <network-role-instance>0</network-role-instance> - <resource-version>1465398611</resource-version> - <orchestration-status>pending-delete</orchestration-status> - <physical-network-name>networkName</physical-network-name> - <is-provider-network>false</is-provider-network> - <is-shared-network>true</is-shared-network> - <is-external-network>false</is-external-network> - <subnets> - <subnet> - <subnet-id>cb1a7b47-5428-44c9-89c2-8b17541c3228</subnet-id> - <gateway-address>108.239.40.1</gateway-address> - <network-start-address>108.239.40.0</network-start-address> - <cidr-mask>28</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>pending-delete</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <dhcp-start>108.239.40.0</dhcp-start> - <dhcp-end>108.239.40.0</dhcp-end> - <resource-version>1465398611</resource-version> - <subnet-name>subnetName</subnet-name> - <relationship-list /> - </subnet> - <subnet> - <subnet-id>e2cc7c14-90f0-4205-840d-b4e07f04e621</subnet-id> - <gateway-address>2606:ae00:2e01:604::1</gateway-address> - <network-start-address>2606:ae00:2e01:604::</network-start-address> - <cidr-mask>64</cidr-mask> - <ip-version>6</ip-version> - <orchestration-status>pending-delete</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <dhcp-start>2606:ae00:2e01:604::</dhcp-start> - <dhcp-end>2606:ae00:2e01:604::</dhcp-end> - <resource-version>1465398611</resource-version> - <subnet-name>subnetName</subnet-name> - <relationship-list /> - </subnet> - </subnets> - <ctag-assignments /> - <segmentation-assignments> - <segmentation-id>416</segmentation-id> - <resource-version>4132176</resource-version> - </segmentation-assignments> - <relationship-list> - <relationship> - <related-to>cloud-region</related-to> - <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/ - </related-link> - <relationship-data> - <relationship-key>cloud-region.cloud-region-id</relationship-key> - <relationship-value>AAIAIC25</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>CloudOwner</relationship-value> - </relationship-data> - <related-to-property> - <property-key>cloud-region.owner-defined-type</property-key> - <property-value></property-value> - </related-to-property> - </relationship> - <relationship> - <related-to>tenant</related-to> - <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/tenants/tenant/4ae1d3446a4c48b2bec44b6cfba06d68/</related-link> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>4ae1d3446a4c48b2bec44b6cfba06d68 - </relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>CloudOwner</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>cloud-region.cloud-region-id</relationship-key> - <relationship-value>AAIAIC25</relationship-value> - </relationship-data> - <related-to-property> - <property-key>tenant.tenant-name</property-key> - <property-value>Ruchira Contrail 3.0 test</property-value> - </related-to-property> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://localhost:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>9a7b327d9-287aa00-82c4b0-100001</relationship-value> - </relationship-data> - <related-to-property> - <property-key>vpn-binding.vpn-name</property-key> - <property-value>GN_EVPN_direct_net_0_ST1</property-value> - </related-to-property> - </relationship> - <relationship> - <related-to>route-table-reference</related-to> - <relationship-data> - <relationship-key>route-table-reference.route-table-reference-id</relationship-key> - <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0hi</relationship-value> - </relationship-data> - </relationship> - </relationship-list> -</l3-network>""" - - String queryIdAIIResponseVpnNotPresent = - """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - statusCode="200"> - <rest:headers> - <rest:header name="Transfer-Encoding" value="chunked"/> - <rest:header name="Date" value="Thu,10 Mar 2016 00:01:18 GMT"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:502-132671"/> - <rest:header name="Content-Type" value="application/xml"/> - <rest:header name="Server" value="Apache-Coyote/1.1"/> - <rest:header name="Cache-Control" value="private"/> - </rest:headers> - <rest:payload contentType="text/xml"> - <l3-network xmlns="http://org.openecomp.aai.inventory/v6"> - <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <network-role>dmz_direct</network-role> - <network-technology>contrail</network-technology> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <network-role-instance>0</network-role-instance> - <orchestration-status>pending-delete</orchestration-status> - <physical-network-name>networkName</physical-network-name> - <is-provider-network>false</is-provider-network> - <is-shared-network>true</is-shared-network> - <is-external-network>false</is-external-network> - <subnets> - <subnet> - <subnet-id>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</subnet-id> - <gateway-address>107.239.52.1</gateway-address> - <network-start-address>107.239.52.0</network-start-address> - <cidr-mask>24</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>pending-delete</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <subnet-name>subnetName</subnet-name> - <relationship-list/> - </subnet> - </subnets> - <relationship-list/> - </l3-network> - </rest:payload> -</rest:RESTResponse>""" - - String queryNameAIIResponse = - """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - statusCode="200"> - <rest:headers> - <rest:header name="Transfer-Encoding" value="chunked"/> - <rest:header name="Date" value="Thu,10 Mar 2016 00:01:18 GMT"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:502-132671"/> - <rest:header name="Content-Type" value="application/xml"/> - <rest:header name="Server" value="Apache-Coyote/1.1"/> - <rest:header name="Cache-Control" value="private"/> - </rest:headers> - <rest:payload contentType="text/xml"> - <l3-network xmlns="http://org.openecomp.aai.inventory/v6"> - <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <network-role>dmz_direct</network-role> - <network-technology>contrail</network-technology> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <network-role-instance>0</network-role-instance> - <orchestration-status>pending-delete</orchestration-status> - <subnets> - <subnet> - <subnet-id>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</subnet-id> - <gateway-address>107.239.52.1</gateway-address> - <network-start-address>107.239.52.0</network-start-address> - <cidr-mask>24</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>pending-delete</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <relationship-list/> - </subnet> - </subnets> - <relationship-list> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>85f015d0-2e32-4c30-96d2-87a1a27f8017</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>c980a6ef-3b88-49f0-9751-dbad8608d0a6</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>tenant</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/</related-link> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>7dd5365547234ee8937416c65507d266</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </l3-network> - </rest:payload> - </rest:RESTResponse>""" - - String queryNameAIIResponseVpnNotPresent = - """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - statusCode="200"> - <rest:headers> - <rest:header name="Transfer-Encoding" value="chunked"/> - <rest:header name="Date" value="Thu,10 Mar 2016 00:01:18 GMT"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:502-132671"/> - <rest:header name="Content-Type" value="application/xml"/> - <rest:header name="Server" value="Apache-Coyote/1.1"/> - <rest:header name="Cache-Control" value="private"/> - </rest:headers> - <rest:payload contentType="text/xml"> - <l3-network xmlns="http://org.openecomp.aai.inventory/v6> - <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <network-role>dmz_direct</network-role> - <network-technology>contrail</network-technology> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <network-role-instance>0</network-role-instance> - <orchestration-status>pending-delete</orchestration-status> - <subnets> - <subnet> - <subnet-id>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</subnet-id> - <gateway-address>107.239.52.1</gateway-address> - <network-start-address>107.239.52.0</network-start-address> - <cidr-mask>24</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>pending-delete</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <relationship-list/> - </subnet> - </subnets> - </l3-network> - </rest:payload> - </rest:RESTResponse>""" - - String aaiVpnResponseStub = - """<rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - xmlns="http://org.openecomp.aai.inventory/v8" - contentType="text/xml"> - <vpn-binding> - <global-route-target/> - </vpn-binding> -</rest:payload>""" - - String queryVpnBindingAAIResponse = - """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - statusCode="200"> - <rest:headers> - <rest:header name="Transfer-Encoding" value="chunked"/> - <rest:header name="Date" value="Mon,14 Mar 2016 20:53:33 GMT"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" - value="localhost-20160314-20:53:33:487-134392"/> - <rest:header name="Content-Type" value="application/xml"/> - <rest:header name="Server" value="Apache-Coyote/1.1"/> - <rest:header name="Cache-Control" value="private"/> - </rest:headers> - <rest:payload contentType="text/xml"> - <vpn-binding xmlns="http://org.openecomp.aai.inventory/v6"> - <vpn-id>9a7b327d9-287aa00-82c4b0-105757</vpn-id> - <vpn-name>GN_EVPN_Test</vpn-name> - <global-route-target>13979:105757</global-route-target> - <relationship-list> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>689ec39e-c5fc-4462-8db2-4f760763ad28</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>1a49396b-19b3-40a4-8792-aa2fbd0f0704</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>774f3329-3c83-4771-86c7-9e6207cd50fd</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </vpn-binding> - </rest:payload> -</rest:RESTResponse>""" - String updateNetworkRequest = """<updateNetworkRequest> @@ -1172,271 +544,10 @@ String updateNetworkRequest_noPhysicalName = </networkRollback> </rollbackNetworkRequest>""" - String updateNetworkResponse = - """<ns2:updateNetworkContrailResponse xmlns:ns2="http://org.onap.so/network" - xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> - <networkId>MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641</networkId> - <neutronNetworkId>c4f4e878-cde0-4b15-ae9a-bda857759cea</neutronNetworkId> - <networkStackId>MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641</networkStackId> - <networkFqdn>default-domain:MSOTest:GN_EVPN_direct_net_0_ST1</networkFqdn> - <subnetIdMap> - <entry> - <key>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</key> - <value>bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73</value> - </entry> - </subnetIdMap> - <rollback> - <cloudId>RDM2WAGPLCP</cloudId> - <msoRequest> - <requestId>1ef47428-cade-45bd-a103-0751e8b2deb0</requestId> - <serviceInstanceId/> - </msoRequest> - <networkUpdated>true</networkUpdated> - <networkId>MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641</networkId> - <networkType>CONTRAIL_EXTERNAL</networkType> - <networkUpdated>false</networkUpdated> - <neutronNetworkId>c4f4e878-cde0-4b15-ae9a-bda857759cea</neutronNetworkId> - <tenantId>7dd5365547234ee8937416c65507d266</tenantId> - </rollback> -</ns2:updateNetworkContrailResponse>""" - - String updateContrailAAIPayloadRequest = - """<l3-network xmlns="http://org.openecomp.aai.inventory/v9"> - <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <network-role>dmz_direct</network-role> - <network-technology>contrail</network-technology> - <neutron-network-id>c4f4e878-cde0-4b15-ae9a-bda857759cea</neutron-network-id> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <network-role-instance>0</network-role-instance> - <resource-version>l3-version</resource-version> - <orchestration-status>Active</orchestration-status> - <heat-stack-id>ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326</heat-stack-id> - <contrail-network-fqdn>default-domain:MSOTest:GN_EVPN_direct_net_0_ST1</contrail-network-fqdn> - <physical-network-name>networkName</physical-network-name> - <is-provider-network>false</is-provider-network> - <is-shared-network>true</is-shared-network> - <is-external-network>false</is-external-network> - <subnets> - <subnet> - <subnet-id>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</subnet-id> - <neutron-subnet-id>bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73</neutron-subnet-id> - <gateway-address>107.239.52.1</gateway-address> - <network-start-address>107.239.52.0</network-start-address> - <cidr-mask>24</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>Active</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <subnet-role>ECOMP</subnet-role> - <resource-version>1505857300987</resource-version> - <subnet-name>subnetName</subnet-name> - <ip-assignment-direction>true</ip-assignment-direction> - <host-routes> - <host-route> - <host-route-id>400d286b-7e44-4514-b9b3-f70f7360ff32</host-route-id> - <route-prefix>172.20.1.0/24</route-prefix> - <next-hop>10.102.200.1</next-hop> - <next-hop-type>ip-address</next-hop-type> - <resource-version>1505857300987</resource-version> - </host-route> - <host-route> - <host-route-id>6f038013-8b15-4eb8-914b-507489fbc8ee</host-route-id> - <route-prefix>10.102.0.0/16</route-prefix> - <next-hop>10.102.200.1</next-hop> - <next-hop-type>ip-address</next-hop-type> - <resource-version>1505857301151</resource-version> - </host-route> - <host-route> - <host-route-id>8811c5f8-f1ed-4fa0-a505-e1be60396e28</host-route-id> - <route-prefix>192.168.2.0/25</route-prefix> - <next-hop>10.102.200.1</next-hop> - <next-hop-type/> - <resource-version>1505857301954</resource-version> - </host-route> - </host-routes> - </subnet> - </subnets> - <segmentation-assignments> - <segmentation-id>414</segmentation-id> - <resource-version>4132176</resource-version> - </segmentation-assignments> - <segmentation-assignments> - <segmentation-id>415</segmentation-id> - <resource-version>4132176</resource-version> - </segmentation-assignments> - <ctag-assignments> - <ctag-assignment> - <vlan-id-inner>inner</vlan-id-inner> - <resource-version>ctag-version</resource-version> - <relationship-list> - <relationship> - <related-to>tenant</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/</related-link> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>897deadc2b954a6bac6d3c197fb3525e</relationship-value> - </relationship-data> - <related-to-property> - <property-key>tenant.tenant-name</property-key> - <property-value>MSOTest1</property-value> - </related-to-property> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>a290b841-f672-44dd-b9cd-6f8c20d7d8c8</relationship-value> - </relationship-data> - <related-to-property> - <property-key>vpn-binding.vpn-name</property-key> - <property-value>oam_protected_net_6_MTN5_msotest2</property-value> - </related-to-property> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>24a4b507-853a-4a38-99aa-05fcc54be24d</relationship-value> - </relationship-data> - <related-to-property> - <property-key>vpn-binding.vpn-name</property-key> - <property-value>oam_protected_net_6_MTN5_msotest1</property-value> - </related-to-property> - </relationship> - </relationship-list> - </ctag-assignment> - </ctag-assignments> - <relationship-list> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>85f015d0-2e32-4c30-96d2-87a1a27f8017</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>c980a6ef-3b88-49f0-9751-dbad8608d0a6</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>tenant</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/</related-link> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>7dd5365547234ee8937416c65507d266</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>network-policy</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg</related-link> - <relationship-data> - <relationship-key>network-policy.network-policy-id</relationship-key> - <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0cg</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>route-table-reference</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1</related-link> - <relationship-data> - <relationship-key>route-table-reference.route-table-reference-id</relationship-key> - <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0hi</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>route-table-reference</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2</related-link> - <relationship-data> - <relationship-key>route-table-reference.route-table-reference-id</relationship-key> - <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0hi</relationship-value> - </relationship-data> - </relationship> - </relationship-list> -</l3-network>""" - - - String updateContrailAAIResponse = - """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - statusCode="200"> - <rest:headers> - <rest:header name="Date" value="Thu,10 Mar 2016 00:01:18 GMT"/> - <rest:header name="Content-Length" value="0"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:551-132672"/> - <rest:header name="Server" value="Apache-Coyote/1.1"/> - <rest:header name="Cache-Control" value="private"/> - </rest:headers> -</rest:RESTResponse>""" - - String updateNetworkErrorResponse = - """<updateNetworkError> - <messageId>680bd458-5ec1-4a16-b77c-509022e53450</messageId><category>INTERNAL</category> - <message>400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data</message> - <rolledBack>true</rolledBack> - </updateNetworkError>""" - String networkException500 = """<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:VersionMismatch</faultcode><faultstring>"http://org.onap.so/network", the namespace on the "updateNetworkContrail" element, is not a valid SOAP version.</faultstring></soap:Fault></soap:Body></soap:Envelope>""" - String aaiResponse = - """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - statusCode="200"> - <rest:headers> - <rest:header name="Transfer-Encoding" value="chunked"/> - <rest:header name="Date" value="Sat,30 Jan 2016 20:09:24 GMT"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" - value="localhost-20160130-20:09:24:814-165843"/> - <rest:header name="Content-Type" value="application/xml"/> - <rest:header name="Server" value="Apache-Coyote/1.1"/> - <rest:header name="Cache-Control" value="private"/> - </rest:headers> - <rest:payload contentType="text/xml"> - <l3-network xmlns="http://org.openecomp.aai.inventory/v3"> - <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <network-role>HSL_direct</network-role> - <network-technology>contrail</network-technology> - <neutron-network-id>8bbd3edf-b835-4610-96a2-a5cafa029042</neutron-network-id> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <orchestration-status>active</orchestration-status> - <heat-stack-id>MNS-25180-L-01-dmz_direct_net_1/57594a56-1c92-4a38-9caa-641c1fa3d4b6</heat-stack-id> - <subnets> - <subnet> - <subnet-id>ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a</subnet-id> - <neutron-subnet-id>5a77fdc2-7789-4649-a1b9-6eaf1db1813a</neutron-subnet-id> - <gateway-address>172.16.34.1</gateway-address> - <network-start-address>172.16.34.0</network-start-address> - <cidr-mask>28</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>active</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <relationship-list/> - </subnet> - </subnets> - <relationship-list> - <relationship> - <related-to>tenant</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/</related-link> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>e81d842d3e8b45c5a59f57cd76af3aaf</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </l3-network> - </rest:payload> - </rest:RESTResponse>""" - String changeAssignSDNCRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:ns5="http://org.onap/so/request/types/v1" @@ -1465,8 +576,8 @@ String updateNetworkRequest_noPhysicalName = </service-information> <network-request-information> <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> - <network-type>CONTRAIL_EXTERNAL</network-type> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> + <network-type>CONTRAIL30_BASIC</network-type> + <network-name>vprobes_pktinternal_net_4_1806</network-name> <tenant>7dd5365547234ee8937416c65507d266</tenant> <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region> </network-request-information> @@ -1545,42 +656,6 @@ String assignResponse = </sdncadapterworkflow:response-data> </sdncadapterworkflow:SDNCAdapterWorkflowResponse>""" - String expected_sdncAdapterWorkflowResponse_Error = - """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns="com:att:sdnctl:vnf" - xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" - xmlns:tag0="http://org.onap.so/workflow/sdnc/adapter/schema/v1" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <sdncadapterworkflow:response-data> - <tag0:RequestData xsi:type="xs:string"> - <output> - <response-code>400</response-code> - <response-message>Error writing to l3-netework</response-message> - <ack-final-indicator>Y</ack-final-indicator> - <svc-request-id>c79240d8-34b5-4853-af69-2021928dba00</svc-request-id> - </output> - </tag0:RequestData> - </sdncadapterworkflow:response-data> -</sdncadapterworkflow:SDNCAdapterWorkflowResponse>""" - - String sdncAdapterWorkflowFormattedResponse = - """<aetgt:SDNCAdapterWorkflowResponse xmlns:aetgt="http://org.onap/so/workflow/schema/v1" - xmlns="com:att:sdnctl:vnf"> - <aetgt:response-data> - <output> - <svc-request-id>00703dc8-71ff-442d-a4a8-3adc5beef6a9</svc-request-id> - <response-code>200</response-code> - <ack-final-indicator>Y</ack-final-indicator> - <network-information> - <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> - </network-information> - <service-information> - <service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type> - <service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id> - <subscriber-name>notsurewecare</subscriber-name> - </service-information> - </output> - </aetgt:response-data> -</aetgt:SDNCAdapterWorkflowResponse>""" String rollbackSDNCRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" @@ -1649,6 +724,22 @@ String rollbackNetworkRequest = // - - - - - - - - + @BeforeClass + static void initEnv() { + MockEnvironment mockEnvironment = mock(MockEnvironment.class) + when(mockEnvironment.getProperty("mso.workflow.global.default.aai.version")).thenReturn("14") + when(mockEnvironment.getProperty("mso.workflow.global.default.aai.namespace")).thenReturn("defaultTestNamespace") + when(mockEnvironment.getProperty("aai.endpoint")).thenReturn("http://localhost:8090") + UrnPropertiesReader urnPropertiesReader = new UrnPropertiesReader() + urnPropertiesReader.setEnvironment(mockEnvironment) + } + + @AfterClass + static void cleanupEnv() { + UrnPropertiesReader urnPropertiesReader = new UrnPropertiesReader() + urnPropertiesReader.setEnvironment(null) + } + @Before public void init() { @@ -1743,117 +834,126 @@ String rollbackNetworkRequest = } - @Test - //@Ignore - public void preProcessRequest_NetworkRequest() { - - println "************ preProcessRequest_Payload ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true) - when(mockExecution.getVariable("recipeTimeout")).thenReturn(0) - when(mockExecution.getVariable("requestAction")).thenReturn("UPDATE") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("vnfId")).thenReturn("") - when(mockExecution.getVariable("volumeGroupId")).thenReturn("") - when(mockExecution.getVariable("networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") - when(mockExecution.getVariable("serviceType")).thenReturn("MOG") - when(mockExecution.getVariable("networkType")).thenReturn("modelName") - when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) - when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.rollback")).thenReturn("true") - when(mockExecution.getVariable("disableRollback")).thenReturn("true") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.preProcessRequest(mockExecution) - -// verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix + "") - - //verify variable initialization - initializeVariables(mockExecution) - - // Authentications - verify(mockExecution).setVariable("action", "UPDATE") - verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequest) - verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) - verify(mockExecution).setVariable(Prefix + "networkInputs", expectedNetworkInputs) - verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable(Prefix + "networkOutputs", "") - - } - - @Test - //@Ignore - public void preProcessRequest_vPERNetworkRequest() { - - String networkModelInfo = """{"modelUuid": "sn5256d1-5a33-55df-13ab-12abad84e111", + @Test + public void preProcessRequest_NetworkRequest() { + + println "************ preProcessRequest_Payload ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("requestAction")).thenReturn("UPDATE") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) + when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso.adapters.po.auth")). + thenReturn("5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.preProcessRequest(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + + //verify variable initialization + initializeVariables(mockExecution) + + // Authentications + verify(mockExecution).setVariable("action", "UPDATE") + verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequest) + verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) + verify(mockExecution).setVariable(Prefix + "networkInputs", expectedNetworkInputs) + verify(mockExecution).setVariable(Prefix + "messageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + verify(mockExecution).setVariable(Prefix + "source", "VID") + verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic dGVzdDp0ZXN0") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic dGVzdDp0ZXN0") + verify(mockExecution).setVariable(Prefix + "serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4") + verify(mockExecution).setVariable(Prefix + "networkOutputs", """<network-outputs> +\t <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> +\t <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> +\t </network-outputs>""") + verify(mockExecution).setVariable(Prefix + "networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4") + verify(mockExecution).setVariable(Prefix + "networkName", "MNS-25180-L-01-dmz_direct_net_1") + } + + @Test + public void preProcessRequest_vPERNetworkRequest() { + + String networkModelInfo = """{"modelUuid": "sn5256d1-5a33-55df-13ab-12abad84e111", "modelName": "CONTRAIL_EXTERNAL", - "modelType": "CONTRAIL_EXTERNAL", - "modelVersion": "1", - "modelCustomizationUuid": "sn5256d1-5a33-55df-13ab-12abad84e222", - "modelInvariantUuid": "sn5256d1-5a33-55df-13ab-12abad84e764" - }""".trim() - - println "************ preProcessRequest_Payload ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("disableRollback")).thenReturn("true") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") // optional - when(mockExecution.getVariable("networkName")).thenReturn("MNS-25180-L-01-dmz_direct_net_1") // optional - when(mockExecution.getVariable("productFamilyId")).thenReturn("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") - when(mockExecution.getVariable("networkModelInfo")).thenReturn("CONTRAIL_EXTERNAL") - when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable("tenantId")).thenReturn("7dd5365547234ee8937416c65507d266") - when(mockExecution.getVariable("failIfExists")).thenReturn("false") - when(mockExecution.getVariable("networkModelInfo")).thenReturn(networkModelInfo) - when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") - when(mockExecution.getVariable("action")).thenReturn("UPDATE") - when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("MSO-dev-service-type") - when(mockExecution.getVariable("globalSubscriberId")).thenReturn("globalId_45678905678") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - - when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - - when(mockExecution.getVariable("mso.rollback")).thenReturn("true") - when(mockExecution.getVariable("mso.adapters.sdnc.endpoint")).thenReturn("http://localhost:8090/SDNCAdapter") - when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter") - when(mockExecution.getVariable("mso.adapters.sdnc.resource.endpoint")).thenReturn("http://localhost:8090/SDNCAdapterRpc") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.preProcessRequest(mockExecution) - -// verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix + "") - - //verify variable initialization - initializeVariables(mockExecution) - - // Authentications - verify(mockExecution).setVariable("action", "UPDATE") - verify(mockExecution).setVariable(Prefix + "networkRequest", expectedVperNetworkRequest) - verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) - verify(mockExecution).setVariable(Prefix + "networkInputs", expectedVperNetworkInputs) - verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable(Prefix + "networkOutputs", "") - - } - - @Test + "modelType": "CONTRAIL_EXTERNAL", + "modelVersion": "1", + "modelCustomizationUuid": "sn5256d1-5a33-55df-13ab-12abad84e222", + "modelInvariantUuid": "sn5256d1-5a33-55df-13ab-12abad84e764" + }""".trim() + + println "************ preProcessRequest_Payload ************* " + + ExecutionEntity mockExecution = setupMock() + + // Initialize prerequisite variables + when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("action")).thenReturn("UPDATE") + + when(mockExecution.getVariable("disableRollback")).thenReturn("true") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") // optional + when(mockExecution.getVariable("networkName")).thenReturn("MNS-25180-L-01-dmz_direct_net_1") // optional + when(mockExecution.getVariable("productFamilyId")).thenReturn("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + when(mockExecution.getVariable("networkModelInfo")).thenReturn("CONTRAIL_EXTERNAL") + when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable("tenantId")).thenReturn("7dd5365547234ee8937416c65507d266") + when(mockExecution.getVariable("failIfExists")).thenReturn("false") + when(mockExecution.getVariable("networkModelInfo")).thenReturn(networkModelInfo) + when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") + + when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("MSO-dev-service-type") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("globalId_45678905678") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + + when(mockExecution.getVariable("mso.adapters.po.auth")). + thenReturn("5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + when(mockExecution.getVariable("mso.adapters.sdnc.endpoint")). + thenReturn("http://localhost:8090/SDNCAdapter") + when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")). + thenReturn("http://localhost:8090/networks/NetworkAdapter") + when(mockExecution.getVariable("mso.adapters.sdnc.resource.endpoint")). + thenReturn("http://localhost:8090/SDNCAdapterRpc") + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.preProcessRequest(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + + //verify variable initialization + initializeVariables(mockExecution) + + // Authentications + verify(mockExecution).setVariable("action", "UPDATE") + verify(mockExecution).setVariable(Prefix + "networkRequest", expectedVperNetworkRequest) + verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) + verify(mockExecution).setVariable(Prefix + "networkInputs", expectedVperNetworkInputs) + verify(mockExecution).setVariable(Prefix + "messageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + verify(mockExecution).setVariable(Prefix + "source", "VID") + verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic dGVzdDp0ZXN0") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic dGVzdDp0ZXN0") + verify(mockExecution).setVariable(Prefix + "serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4") + verify(mockExecution).setVariable(eq(Prefix + "networkOutputs"), eq("""<network-outputs> +\t <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> +\t <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> +\t </network-outputs>""")) + + verify(mockExecution).setVariable(Prefix + "networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4") + verify(mockExecution).setVariable(Prefix + "networkName", "MNS-25180-L-01-dmz_direct_net_1") + } + + @Test //@Ignore public void preProcessRequest_MissingNetworkId() { @@ -1968,107 +1068,88 @@ String rollbackNetworkRequest = } - @Test - //@Ignore - public void prepareUpdateNetworkRequest() { - - println "************ prepareNetworkRequest ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedVperNetworkRequest) - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") - when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") - //when(mockExecution.getVariable(Prefix + "queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) - when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("<routeTargets>13979:105757</routeTargets><routeTargets>13979:105757</routeTargets>") - when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("<policyFqdns>GN_EVPN_Test</policyFqdns>") - when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("<routeTableFqdns>refFQDN1</routeTableFqdns><routeTableFqdns>refFQDN2</routeTableFqdns>") - when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.prepareUpdateNetworkRequest(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix + "") - - verify(mockExecution).setVariable(Prefix + "updateNetworkRequest", updateNetworkRequest) - - } - - - @Test - //@Ignore - public void prepareUpdateNetworkRequest_NoPhysicalname() { - - println "************ prepareNetworkRequest ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(NetworkRequest_noPhysicalName) - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") - when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") - //when(mockExecution.getVariable(Prefix + "queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) - when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("<routeTargets>13979:105757</routeTargets><routeTargets>13979:105757</routeTargets>") - when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("<policyFqdns>GN_EVPN_Test</policyFqdns>") - when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("") - when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.prepareUpdateNetworkRequest(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix + "") - - verify(mockExecution).setVariable(Prefix + "updateNetworkRequest", updateNetworkRequest_noPhysicalName) - - } - - @Test - //@Ignore - public void prepareSDNCRequest() { - - println "************ prepareSDNCRequest ************* " - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(aaiResponse) - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") - - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.prepareSDNCRequest(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "changeAssignSDNCRequest", changeAssignSDNCRequest) - - } + @Test + public void prepareUpdateNetworkRequest() { + + println "************ prepareNetworkRequest ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedVperNetworkRequest) + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(getContrailL3Network()) + when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") + when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") + when(mockExecution.getVariable(Prefix + "routeCollection")). + thenReturn("<routeTargets>13979:105757</routeTargets><routeTargets>13979:105757</routeTargets>") + when(mockExecution.getVariable(Prefix + "networkCollection")). + thenReturn("<policyFqdns>GN_EVPN_Test</policyFqdns>") + when(mockExecution.getVariable(Prefix + "tableRefCollection")). + thenReturn("<routeTableFqdns>refFQDN1</routeTableFqdns><routeTableFqdns>refFQDN2</routeTableFqdns>") + when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.prepareUpdateNetworkRequest(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "updateNetworkRequest", updateNetworkRequest) + } + + + @Test + public void prepareUpdateNetworkRequest_NoPhysicalname() { + + println "************ prepareNetworkRequest ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") + when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") + + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(NetworkRequest_noPhysicalName) + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")). + thenReturn(getContrailL3Network()) + when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") + + when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("<routeTargets>13979:105757</routeTargets><routeTargets>13979:105757</routeTargets>") + when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("<policyFqdns>GN_EVPN_Test</policyFqdns>") + when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("") + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.prepareUpdateNetworkRequest(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "updateNetworkRequest", updateNetworkRequest_noPhysicalName) + } + + @Test + public void prepareSDNCRequest() { + + println "************ prepareSDNCRequest ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json"))) + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn( + "https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.prepareSDNCRequest(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "changeAssignSDNCRequest", changeAssignSDNCRequest) + } @Test //@Ignore @@ -2101,614 +1182,412 @@ String rollbackNetworkRequest = } - @Test - //@Ignore - public void callRESTQueryAAINetworkId_200() { + @Test + public void callRESTQueryAAINetworkId_200() { + + println "************ callRESTQueryAAINetworkId ************* " + + WireMock.reset(); + MockGetNetworkByIdWithDepth(wireMockRule, "49c86598-f766-46f8-84f8-8d1c1b10f9b4", + "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkId(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "aaiIdReturnCode", "200") + verify(mockExecution).setVariable(eq(Prefix + "queryIdAAIResponse"), isA(AAIResultWrapper.class)) + } + + @Test + public void callRESTQueryAAICloudRegion30_200() { + + println "************ callRESTQueryAAICloudRegion30_200 ************* " + + WireMock.reset(); + MockGetNetworkCloudRegion(wireMockRule, "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml", "RDM2WAGPLCP"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")). + thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") + verify(mockExecution, atLeast(2)).setVariable(Prefix + "queryCloudRegionReturnCode", "200") + verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) + } + + @Test + public void callRESTQueryAAICloudRegion25_200() { - println "************ callRESTQueryAAINetworkId ************* " + println "************ callRESTQueryAAICloudRegion25_200 ************* " - WireMock.reset(); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "all"); + WireMock.reset(); + MockGetNetworkCloudRegion(wireMockRule, "CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.DoUpdateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkId(mockExecution) + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")). + thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "queryIdAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") - verify(mockExecution).setVariable(Prefix + "aaiIdReturnCode", "200") + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) + } - } + @Test + public void callRESTQueryAAICloudRegion_NotFound() { - @Test - //@Ignore - public void callRESTQueryAAICloudRegion30_200() { + println "************ callRESTQueryAAICloudRegionFake ************* " - println "************ callRESTQueryAAICloudRegion30_200 ************* " + WireMock.reset(); + MockGetNetworkCloudRegion_404(wireMockRule, "MDTWNJ21"); - WireMock.reset(); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml", "RDM2WAGPLCP"); + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(vnfRequestFakeRegion) + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")). + thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") + verify(mockExecution, atLeast(1)).setVariable(Prefix + "queryCloudRegionReturnCode", "404") + verify(mockExecution).setVariable(Prefix + "cloudRegionPo", "MDTWNJ21") + verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc", "AAIAIC25") + verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) + } - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "queryCloudRegionReturnCode", "200") - verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) + @Test + public void callRESTQueryAAINetworkVpnBinding_200() { - } + println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " - @Test - public void callRESTQueryAAICloudRegion25_200() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json"))) - println "************ callRESTQueryAAICloudRegion25_200 ************* " + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIResponse", + """<rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" + xmlns="defaultTestNamespacev14"\n contentType="text/xml">\n <vpn-binding> + <global-route-target/>\n </vpn-binding>\n</rest:payload>""") + verify(mockExecution).setVariable(Prefix + "routeCollection", "<routeTargets/>") + } + + @Test + public void callRESTQueryAAINetworkVpnBindingList_200() { + + println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " - WireMock.reset(); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); + WireMock.reset(); - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) - - } - - @Test - //@Ignore - public void callRESTQueryAAICloudRegion_NotFound() { - - println "************ callRESTQueryAAICloudRegionFake ************* " - - WireMock.reset(); - MockGetNetworkCloudRegion_404("MDTWNJ21"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(vnfRequestFakeRegion) - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") - verify(mockExecution, atLeast(1)).setVariable(Prefix + "queryCloudRegionReturnCode", "404") - verify(mockExecution).setVariable(Prefix + "cloudRegionPo", "MDTWNJ21") - verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc", "AAIAIC25") - verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) - - } + MockGetNetworkVpnBindingWithDepth(wireMockRule, + "BuildingBlocks/Network/queryAAIVpnBindingTestResponseWithRoutes.json", + "13e94b71-3ce1-4988-ab0e-61208fc91f1c", "2") - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBinding_200() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json"))) - println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) - WireMock.reset(); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "routeCollection", """<routeTargets> + <routeTarget>2001:051111</routeTarget>\n <routeTargetRole>EXPORT</routeTargetRole>\n</routeTargets> +<routeTargets>\n <routeTarget>1000:051113</routeTarget>\n <routeTargetRole>IMPORT</routeTargetRole>\n</routeTargets>\n""") + } - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) // v6 - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + @Test + public void callRESTQueryAAINetworkVpnBinding_200_URN_Uri() { - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) + println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "vpnCount", 2) - verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + WireMock.reset(); + MockGetNetworkVpnBindingWithDepth(wireMockRule, + "BuildingBlocks/Network/queryAAIVpnBindingTestResponseWithRoutes.json", + "13e94b71-3ce1-4988-ab0e-61208fc91f1c", "2"); - } + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json"))) - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBindingList_200() { + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) - println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "routeCollection", + """<routeTargets>\n <routeTarget>2001:051111</routeTarget>\n <routeTargetRole>EXPORT</routeTargetRole> +</routeTargets>\n<routeTargets>\n <routeTarget>1000:051113</routeTarget>\n <routeTargetRole>IMPORT</routeTargetRole> +</routeTargets>\n""") + } - WireMock.reset(); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + @Test + public void callRESTQueryAAINetworkVpnBinding_NotPresent() { - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) // v6 - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + println "************ callRESTQueryAAINetworkVpnBinding_NotPresent ************* " - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + WireMock.reset(); - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "vpnCount", 2) - verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + MockGetNetworkVpnBindingWithDepth(wireMockRule, + "BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json", + "13e94b71-3ce1-4988-ab0e-61208fc91f1c", "2") - } + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json"))) - - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBinding_TestScenario01_200() { + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) - println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "routeCollection", "") + } - WireMock.reset(); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponseTestScenario01) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + @Test + public void callRESTQueryAAINetworkTableRef_200() { - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) + println "************ callRESTQueryAAINetworkTableRef_200 ************* " + WireMock.reset(); - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "vpnCount", 1) - verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") - verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json"))) - } + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkTableRef(mockExecution) - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBinding_200_URN_Uri() { + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "networkTableRefCount", 0) + verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "200") + verify(mockExecution).setVariable(Prefix + "queryNetworkTableRefAAIResponse", + """<rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" + xmlns="defaultTestNamespacev14"\n contentType="text/xml">\n <route-table-references> + <route-table-reference-fqdn/>\n </route-table-references>\n</rest:payload>""") + verify(mockExecution).setVariable(Prefix + "tableRefCollection", "<routeTableFqdns/>") + } - println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + @Test + public void callRESTQueryAAINetworkPolicy_200() { - WireMock.reset(); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + println "************ callRESTQueryAAINetworkPolicy_200 ************* " - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + WireMock.reset(); - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json"))) - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkPolicy(mockExecution) - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "vpnCount", 2) - verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "networkPolicyCount", 0) + verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "200") + verify(mockExecution).setVariable(Prefix + "queryNetworkPolicyAAIResponse", + """<rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" + xmlns="defaultTestNamespacev14"\n contentType="text/xml">\n <network-policy> + <network-policy-fqdn/>\n </network-policy>\n</rest:payload>""") + verify(mockExecution).setVariable(Prefix + "networkCollection", "<policyFqdns/>") + } - } - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBinding_NotPresent() { + @Test + public void callRESTReQueryAAINetworkId_200() { - println "************ callRESTQueryAAINetworkVpnBinding_NotPresent ************* " + println "************ callRESTReQueryAAINetworkId ************* " - WireMock.reset(); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + WireMock.reset(); + MockGetNetworkByIdWithDepth(wireMockRule, "49c86598-f766-46f8-84f8-8d1c1b10f9b4", + "BuildingBlocks/Network/queryAAINetworkTestResponse.json", "1"); - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponseVpnNotPresent) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTReQueryAAINetworkId(mockExecution) - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "aaiRequeryIdReturnCode", "200") + verify(mockExecution).setVariable(eq(Prefix + "requeryIdAAIResponse"), isA(AAIResultWrapper.class)) + verify(mockExecution).setVariable(Prefix + "networkOutputs", """<network-outputs> + <network-id>467e3349-bec1-4922-bcb1-d0bb041bce30</network-id> + <network-name>vprobes_pktinternal_net_4_1806</network-name> + </network-outputs>""") + } - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") - verify(mockExecution).setVariable(Prefix + "vpnCount", 0) - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIResponse", aaiVpnResponseStub) + @Test + public void callRESTUpdateContrailAAINetworkREST_200() { - } + println "************ callRESTUpdateContrailAAINetwork ************* " - @Test - //@Ignore - public void callRESTQueryAAINetworkTableRef_200() { + WireMock.reset(); + MockPostNetwork(wireMockRule, "49c86598-f766-46f8-84f8-8d1c1b10f9b4") + MockPostNetworkSubnet(wireMockRule, "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "209f62cf-cf0c-42f8-b13c-f038b92ef108") + MockPostNetworkSubnet(wireMockRule, "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "971bc608-1aff-47c0-923d-92e43b699f01") - println "************ callRESTQueryAAINetworkTableRef_200 ************* " + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json"))) + when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(updateNetworkResponseREST) + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTUpdateContrailAAINetwork(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "isPONR", true) + } - WireMock.reset(); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.default.aai.network-table-reference.uri")).thenReturn("") - when(mockExecution.getVariable("mso.workflow.DoUpdateNetworkInstance.aai.route-table-reference.uri")).thenReturn("/aai/v8/network/route-table-references/route-table-reference") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + @Test + public void validateUpdateNetworkResponseREST() { - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkTableRef(mockExecution) + println "************ validateNetworkResponse ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(updateNetworkResponseREST) + when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('200') + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.validateUpdateNetworkResponse(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "updateNetworkResponse", updateNetworkResponseREST) + verify(mockExecution).setVariable(Prefix + "isNetworkRollbackNeeded", true) + verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", updateRollbackNetworkRequest) + } - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) + @Test + public void validateUpdateNetworkResponseREST_Error() { - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "networkTableRefCount", 2) - verify(mockExecution).setVariable(Prefix + "networkTableRefUriList", ['/aai/v8/network/route-table-references/route-table-reference/refFQDN1','/aai/v8/network/route-table-references/route-table-reference/refFQDN2']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryNetworkTableRefAAIRequest", "http://localhost:8090/aai/v8/network/route-table-references/route-table-reference/refFQDN1?depth=all") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "200") + println "************ validateNetworkResponse ************* " - } + WorkflowException workflowException = new WorkflowException("DoUpdateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") - @Test - //@Ignore - public void callRESTQueryAAINetworkPolicy_200() { + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(networkException500) + when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('500') - println "************ callRESTQueryAAINetworkPolicy_200 ************* " + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + try { + DoUpdateNetworkInstance.validateUpdateNetworkResponse(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } - WireMock.reset(); - MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution, atLeast(1)).setVariable(eq("WorkflowException"), refEq(workflowException)) - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.network-policy.uri")).thenReturn("/aai/v8/network/network-policies/network-policy") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + } - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkPolicy(mockExecution) + @Test + public void validateSDNCResponse() { - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) + println "************ validateSDNCResponse ************* " - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "networkPolicyCount", 1) - verify(mockExecution).setVariable(Prefix + "networkPolicyUriList", ['/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryNetworkPolicyAAIRequest", "http://localhost:8090/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg?depth=all") - verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "200") + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse) + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) + when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(true) - } + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.validateSDNCResponse(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", false) + verify(mockExecution).setVariable(Prefix + "sdncRequestDataResponseCode", "200") + verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", true) + verify(mockExecution).setVariable(Prefix + "changeAssignSDNCResponse", sdncAdapterWorkflowResponse) + verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) + } + + @Test(expected = BpmnError.class) + public void validateSDNCResponse_Error() { - - @Test - //@Ignore - public void callRESTReQueryAAINetworkId_200() { - - println "************ callRESTReQueryAAINetworkId ************* " - - WireMock.reset(); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "all"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowFormattedResponse) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.DoUpdateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTReQueryAAINetworkId(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "requeryIdAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") - verify(mockExecution).setVariable(Prefix + "aaiRequeryIdReturnCode", "200") - - } - - - @Test - //@Ignore - public void callRESTUpdateContrailAAINetworkREST_200() { - - println "************ callRESTUpdateContrailAAINetwork ************* " - - WireMock.reset(); - MockPutNetworkIdWithDepth("UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowFormattedResponse) - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(updateNetworkResponseREST) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.DoUpdateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTUpdateContrailAAINetwork(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "updateContrailAAIUrlRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") - verify(mockExecution).setVariable(Prefix + "updateContrailAAIPayloadRequest", updateContrailAAIPayloadRequest) - verify(mockExecution).setVariable(Prefix + "aaiUpdateContrailReturnCode", "200") - //verify(mockExecution).setVariable(Prefix + "updateContrailAAIResponse", updateContrailAAIResponse) - verify(mockExecution).setVariable(Prefix + "isPONR", true) - - } - - - - @Test - //@Ignore - public void validateUpdateNetworkResponseREST() { - - println "************ validateNetworkResponse ************* " - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(updateNetworkResponseREST) - when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('200') - - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.validateUpdateNetworkResponse(mockExecution) - - //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - //debugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "updateNetworkResponse", updateNetworkResponseREST) - verify(mockExecution).setVariable(Prefix + "isNetworkRollbackNeeded", true) - verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", updateRollbackNetworkRequest) - - } - - @Test - //@Ignore - public void validateUpdateNetworkResponseREST_Error() { - - println "************ validateNetworkResponse ************* " - - WorkflowException workflowException = new WorkflowException("DoUpdateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(networkException500) - when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('500') - - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - try { - DoUpdateNetworkInstance.validateUpdateNetworkResponse(mockExecution) - } catch (Exception ex) { - println " Test End - Handle catch-throw BpmnError()! " - } - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution, atLeast(1)).setVariable("WorkflowException", refEq(workflowException, any(WorkflowException.class))) - - } - - @Test - //@Ignore - public void validateSDNCResponse() { - - println "************ validateSDNCResponse ************* " - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse) - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) - when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "isResponseGood")).thenReturn(true) - - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - try { - DoUpdateNetworkInstance.validateSDNCResponse(mockExecution) - verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) - verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", "") - - } catch (Exception ex) { - println " Graceful Exit - " + ex.getMessage() - } - //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - //debugger.printInvocations(mockExecution) - - //verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) - - } - - @Test - //@Ignore - public void validateSDNCResponse_Error() { - - println "************ validateSDNCResponse ************* " - //ExecutionEntity mockExecution = mock(ExecutionEntity.class) - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse_Error) - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(false) - when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "isResponseGood")).thenReturn(true) - - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - try { - DoUpdateNetworkInstance.validateSDNCResponse(mockExecution) - } catch (Exception ex) { - println " Graceful Exit! - " + ex.getMessage() - } - //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - //debugger.printInvocations(mockExecution) - - // verify set prefix = Prefix + "" - //verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", false) - - } - - @Test - //@Ignore - public void prepareRollbackData() { - - println "************ prepareRollbackData() ************* " - - - - WorkflowException workflowException = new WorkflowException("DoUpdateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn(rollbackSDNCRequest) - when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(rollbackNetworkRequest) - when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.prepareRollbackData(mockExecution) - -// verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - } + println "************ validateSDNCResponse ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse_Error) + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(false) + when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "isResponseGood")).thenReturn(true) + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + try { + DoUpdateNetworkInstance.validateSDNCResponse(mockExecution) + } catch (BpmnError ex) { + verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", false) + println " Graceful Exit! - " + ex.getMessage() + throw ex + } + } + + @Test + public void prepareRollbackData() { + + println "************ prepareRollbackData() ************* " + + WorkflowException workflowException = new WorkflowException("DoUpdateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn(rollbackSDNCRequest) + when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(rollbackNetworkRequest) + when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.prepareRollbackData(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + } @Test //@Ignore @@ -2735,6 +1614,37 @@ String rollbackNetworkRequest = } + private static L3Network getContrailL3Network() { + + HostRoutes routes1 = new HostRoutes() + routes1.getHostRoute().add(new HostRoute(routePrefix: "172.20.1.0/24", nextHop: "10.102.200.1")) + routes1.getHostRoute().add(new HostRoute(routePrefix: "10.102.0.0/16", nextHop: "10.102.200.1")) + routes1.getHostRoute().add(new HostRoute(routePrefix: "192.168.2.0/25", nextHop: "10.102.200.1")) + + Subnet subnet1 = new Subnet(networkStartAddress: "107.239.52.0", cidrMask: "24", dhcpEnabled: true, + gatewayAddress: "107.239.52.1", ipVersion: "4", subnetId: "57e9a1ff-d14f-4071-a828-b19ae98eb2fc", + subnetName: "subnetName", ipAssignmentDirection: "true", hostRoutes: routes1) + Subnets subnets = new Subnets() + subnets.getSubnet().add(subnet1) + + SegmentationAssignments segments = new SegmentationAssignments() + segments.getSegmentationAssignment().add(new SegmentationAssignment(segmentationId: "414")) + segments.getSegmentationAssignment().add(new SegmentationAssignment(segmentationId: "415")) + + return new L3Network( + networkName: "MNS-25180-L-01-dmz_direct_net_1", + networkType: "CONTRAIL_EXTERNAL", + networkTechnology: "Contrail", + networkId: "49c86598-f766-46f8-84f8-8d1c1b10f9b4", + orchestrationStatus: "pending-create", + physicalNetworkName: "networkName", + heatStackId: "ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326", + isSharedNetwork: true, + subnets: subnets, + segmentationAssignments: segments + ) + } + private ExecutionEntity setupMock() { ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) @@ -2742,16 +1652,13 @@ String rollbackNetworkRequest = RepositoryService mockRepositoryService = mock(RepositoryService.class) when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoUpdateNetworkInstance") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) ExecutionEntity mockExecution = mock(ExecutionEntity.class) // Initialize prerequisite variables - when(mockExecution.getId()).thenReturn("100") when(mockExecution.getProcessDefinitionId()).thenReturn("DoUpdateNetworkInstance") - when(mockExecution.getProcessInstanceId()).thenReturn("DoUpdateNetworkInstance") when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy index 8af15de75b..80e2c863e8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy @@ -4,7 +4,9 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * 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 * @@ -32,7 +34,7 @@ import org.junit.runner.RunWith import org.mockito.ArgumentCaptor import org.mockito.Captor import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner +import org.mockito.junit.MockitoJUnitRunner import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.VfModule import org.onap.aai.domain.yang.VolumeGroup @@ -48,23 +50,23 @@ import javax.ws.rs.core.UriBuilder import static org.mockito.Mockito.* -@RunWith(MockitoJUnitRunner.class) +@RunWith(MockitoJUnitRunner.Silent.class) class UpdateVfModuleVolumeInfraV1Test extends MsoGroovyTest{ - + def prefix = "UPDVfModVol_" @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) @Rule public ExpectedException thrown = ExpectedException.none() - - @Before - public void init(){ + + @Before + public void init() { super.init("UpdateVfModuleVolumeInfraV1") - MockitoAnnotations.initMocks(this) + MockitoAnnotations.initMocks(this) } - + @Test void testQueryAAIForVfModule() { ExecutionEntity mockExecution = setupMock() diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java index 01f37ad655..ddcc6fe875 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java @@ -30,7 +30,11 @@ import com.googlecode.junittoolbox.WildcardPatternSuite; @RunWith(WildcardPatternSuite.class) @SuiteClasses({"!**/service/*Test.class", "!**/subprocess/*Test.class", "!**/process/*Test.class", "!**/tasks/*Test.class", "!**/infrastructure/aai/*Test.class", - "!**/infrastructure/scripts/*Test.class", "**/*Test.class"}) + "!**/infrastructure/scripts/*Test.class", + "**/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.class", + "**/infrastructure/scripts/DoUpdateNetworkInstanceTest.class", + "**/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.class", + "**/*Test.class"}) public class AllTestsTestSuite { // the class remains empty, // used only as a holder for the above annotations diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponseWithRoutes.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponseWithRoutes.json new file mode 100644 index 0000000000..4a30d4bcec --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponseWithRoutes.json @@ -0,0 +1,903 @@ +{ + "vpn-id": "13e94b71-3ce1-4988-ab0e-61208fc91f1c", + "vpn-name": "vMDNS", + "resource-version": "1510956324462", + "route-targets": {"route-target": [ + { + "global-route-target": "2001:051111", + "route-target-role": "EXPORT", + "resource-version": "1515683690360" + }, + { + "global-route-target": "1000:051113", + "route-target-role": "IMPORT", + "resource-version": "1515683690372" + } + ]}, + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/b3376949-5487-4a74-9029-332c07720c07", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b3376949-5487-4a74-9029-332c07720c07" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_hsl_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/d0b8ecd3-aee4-48ba-8bc5-222d3fb08162", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d0b8ecd3-aee4-48ba-8bc5-222d3fb08162" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/34305bd0-ad54-4349-8567-6f65ea09e750", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "34305bd0-ad54-4349-8567-6f65ea09e750" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vEPDG-FN_swu_direct_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/dfa4972a-ed82-43cd-98be-ed73bb3406a9", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "dfa4972a-ed82-43cd-98be-ed73bb3406a9" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_EXN_INTERNET_NET_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/93556256-aa23-449d-a2fd-3a9c034f232a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "93556256-aa23-449d-a2fd-3a9c034f232a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_CORE-NSD-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/7ce01c3a-5998-4908-85f6-ab29bc507a92", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7ce01c3a-5998-4908-85f6-ab29bc507a92" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKEN_CORE-NSD-TOAM0_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/016d3722-999b-4133-b4e6-8a1088bab664", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "016d3722-999b-4133-b4e6-8a1088bab664" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND-vepdg-FN-Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/80038196-9eae-452c-ad06-1f3fef1bef9f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "80038196-9eae-452c-ad06-1f3fef1bef9f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VPMS-FN-26071-T-BE-01_cdr_direct_net420" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f5f38447-dc62-4969-90a3-c60474f9c0ac", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f5f38447-dc62-4969-90a3-c60474f9c0ac" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_3" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/58b374aa-01ca-4a39-99b9-889c2f7ae908", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "58b374aa-01ca-4a39-99b9-889c2f7ae908" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_OAM_MGMT_NET_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/efe0dfca-18e7-4992-a63a-041b9f8271e0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "efe0dfca-18e7-4992-a63a-041b9f8271e0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_APN-dns_int_apn_dns_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/dab7e704-6a6e-4c53-9a80-fb5857a43b6f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "dab7e704-6a6e-4c53-9a80-fb5857a43b6f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKEN_CORE-NSD-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/634653b3-9084-41d9-ad6a-40863a3d666f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "634653b3-9084-41d9-ad6a-40863a3d666f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-01A_int_fw_dns_trusted_net_5" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6117b35e-c029-4308-85e6-007c24014484", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6117b35e-c029-4308-85e6-007c24014484" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-D-T001_vprobes_int_mgmt_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/eb1ce51b-d10f-4b08-9166-345335b9f73b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "eb1ce51b-d10f-4b08-9166-345335b9f73b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_OAMP_NSD_ISBC0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/468f83be-4abb-4901-950b-e399b77a09a0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "468f83be-4abb-4901-950b-e399b77a09a0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_IRPR-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/103d17dc-6575-427c-a2c1-301493e08ec0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "103d17dc-6575-427c-a2c1-301493e08ec0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_segw_hsl_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/305214f8-64be-4209-8a0d-10b6dfb77dd1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "305214f8-64be-4209-8a0d-10b6dfb77dd1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vMDS_FN_int_fw_dns_trusted_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/7989a6d2-ba10-4a5d-8f15-4520bc833090", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7989a6d2-ba10-4a5d-8f15-4520bc833090" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02AShared_cor_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f040ebf4-76ad-4b05-a766-1deec26549ae", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f040ebf4-76ad-4b05-a766-1deec26549ae" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_gn_untrusted_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/26d6038b-4b9e-4fe5-bcff-9af7586651cc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "26d6038b-4b9e-4fe5-bcff-9af7586651cc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-D-T001_vprobes_pktinternal_net_10" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/9e78d3f4-85b5-40b8-803e-c3a0ab6d6165", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9e78d3f4-85b5-40b8-803e-c3a0ab6d6165" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_MNS_Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/a2de22f9-eb91-452e-aff5-e81a1a679ef6", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "a2de22f9-eb91-452e-aff5-e81a1a679ef6" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_GN_DIRECT_NET_01" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6d6b7254-72d2-4731-80d6-8e8375d959e9", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6d6b7254-72d2-4731-80d6-8e8375d959e9" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_VDBE-PED-DMZ0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/21819ac4-95c4-490f-ba7c-0ad92920f805", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "21819ac4-95c4-490f-ba7c-0ad92920f805" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_FN_int_pktinternal_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/98ff6827-320a-4b71-bd2b-df2bd20b6855", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "98ff6827-320a-4b71-bd2b-df2bd20b6855" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_oam_protected_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/e229ab86-279c-4505-a08a-91e373293e20", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e229ab86-279c-4505-a08a-91e373293e20" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_OAM_DIRECT_NET_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/bb722f93-2d1a-42a5-bd11-57ad30ff1085", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "bb722f93-2d1a-42a5-bd11-57ad30ff1085" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_segw_hsl_direct_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0399443d-1fc6-42a6-934c-77030d751916", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0399443d-1fc6-42a6-934c-77030d751916" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VDBE-PED-DMZ0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/d259ec74-304d-4bd2-bbd6-93c201acba42", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d259ec74-304d-4bd2-bbd6-93c201acba42" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A__vprobes_int_mgmt_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f69fb458-e2bd-4d0f-9a47-430d18cbebfd", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f69fb458-e2bd-4d0f-9a47-430d18cbebfd" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VPMS-FN-26071-T-BE-01_cdr_direct_net4" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0f18b91f-ee79-403b-a081-8c0a89650641", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0f18b91f-ee79-403b-a081-8c0a89650641" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VPMS-FN_int_pktinternal_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/90fdbbbb-42bb-41ff-9356-db245466a4fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "90fdbbbb-42bb-41ff-9356-db245466a4fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_oam_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0e66adce-d5dd-4968-bcb2-83f0281424db", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0e66adce-d5dd-4968-bcb2-83f0281424db" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKEN_VDBF-MIS-UDAT0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/db572383-dbd7-4d5e-93cb-8c7c1d209a90", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "db572383-dbd7-4d5e-93cb-8c7c1d209a90" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_TRST_VIF_ISBC0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/478b7f86-8544-48e5-95f1-568dfd18730d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "478b7f86-8544-48e5-95f1-568dfd18730d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_GN_DIRECT_NET_01" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0f725895-5224-4016-b49a-d9d016eaafff", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0f725895-5224-4016-b49a-d9d016eaafff" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/9cd47b0c-ee58-46f0-9ec5-b4db504dd59b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9cd47b0c-ee58-46f0-9ec5-b4db504dd59b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-FN-25180-T-01Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f95259c9-f5c6-4861-a9f4-b6eec199b33f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f95259c9-f5c6-4861-a9f4-b6eec199b33f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/caf98ee4-2496-4c92-a41c-b6a50efcc29f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "caf98ee4-2496-4c92-a41c-b6a50efcc29f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_MGM-CORE-NSD-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/754739cb-5371-4d5b-a02a-489587d17443", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "754739cb-5371-4d5b-a02a-489587d17443" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_4" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8cd7add8-0cfc-4f65-bbf8-d0f25a0dbc70", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8cd7add8-0cfc-4f65-bbf8-d0f25a0dbc70" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VDBE-MIS-UDAT0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/7093921f-bed8-4866-bb3c-a2b8c376ca69", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7093921f-bed8-4866-bb3c-a2b8c376ca69" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_VIRPR-TDAT0_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/691da8b2-805e-4dd1-aaf5-b0e37414c662", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "691da8b2-805e-4dd1-aaf5-b0e37414c662" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_int_pktmirror_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/00eaa0b3-90df-4b43-a850-9d30abb7fded", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "00eaa0b3-90df-4b43-a850-9d30abb7fded" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-01AShared_oam_protected_net_5" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6ba57200-c61a-46be-821b-88b3fa169b66", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ba57200-c61a-46be-821b-88b3fa169b66" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_3" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8e32ec2c-47a1-4514-b21a-2806e23f0437", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8e32ec2c-47a1-4514-b21a-2806e23f0437" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKENb_VDBF-PSD-DMZ0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/a755ddd0-512a-444d-9f38-97b3eff70f85", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "a755ddd0-512a-444d-9f38-97b3eff70f85" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_UNTR_VSE_ISBC0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c7bde85d-1c12-467c-ae6f-57bdf5c1d380", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7bde85d-1c12-467c-ae6f-57bdf5c1d380" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKENb_VDBF-PSD-DMZ0_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0933fcec-9e78-4045-a21a-8258e18cb78e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0933fcec-9e78-4045-a21a-8258e18cb78e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vdbe_oam_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6a26a729-d9ce-4619-a20e-38597205ba7d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6a26a729-d9ce-4619-a20e-38597205ba7d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_swu_direct_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c1a06665-518b-408b-bfe0-8f393204baf6", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1a06665-518b-408b-bfe0-8f393204baf6" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/fb51398b-7622-4570-9bd6-e29c82621d44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb51398b-7622-4570-9bd6-e29c82621d44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_4" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/92072731-1c40-45c2-a218-5e75b713b312", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92072731-1c40-45c2-a218-5e75b713b312" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_TRST_VIF_ISBC0_net_0001" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c6d94632-fd6b-4bfe-993e-377b0368476b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c6d94632-fd6b-4bfe-993e-377b0368476b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-01AShared_int_ha_net_5" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/84516ef3-e371-4039-908e-83cd2b55a4a1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "84516ef3-e371-4039-908e-83cd2b55a4a1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "VPMS-FN-26071-T-BE-01_vprobes_int_mgmt_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/2c4f3adc-1a45-4484-8fb6-9eeac99eb922", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "2c4f3adc-1a45-4484-8fb6-9eeac99eb922" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_VDBE-MIS-UDAT0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/1fea0624-dac2-4997-904d-34ca1bc12fa9", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1fea0624-dac2-4997-904d-34ca1bc12fa9" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02AShared_cps_internal_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8ab98982-05b7-45b2-828d-648da3d6cc0f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8ab98982-05b7-45b2-828d-648da3d6cc0f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_swu_direct_fn_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c8934d59-24a8-41cc-af9d-2026ef261843", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c8934d59-24a8-41cc-af9d-2026ef261843" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_oam_protected_net_vrar_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c741fe5b-bf27-4ad9-b30d-20518e115495", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c741fe5b-bf27-4ad9-b30d-20518e115495" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_int_apn_dns_fn_net_PB_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8285fbae-ec25-44f7-ac52-89a968d45a2b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8285fbae-ec25-44f7-ac52-89a968d45a2b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-T2B_vEPDG-FN_swu_direct_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/65e6d4b0-0c96-4bfa-bdd6-2baa16df322a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65e6d4b0-0c96-4bfa-bdd6-2baa16df322a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vEPDG-FN_gn_untrusted_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/38e51c7b-adc2-491a-a036-3189645b007c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "38e51c7b-adc2-491a-a036-3189645b007c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vprobes_pktinternal_net_2_1806" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/4d210b09-b6ce-41b3-95a6-5e4dffea9ca2", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4d210b09-b6ce-41b3-95a6-5e4dffea9ca2" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vprobes_pktinternal_net_3_1806" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c5df1c57-3c85-4abc-973f-a1ffb13e391a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c5df1c57-3c85-4abc-973f-a1ffb13e391a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/467e3349-bec1-4922-bcb1-d0bb041bce30", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "467e3349-bec1-4922-bcb1-d0bb041bce30" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vprobes_pktinternal_net_4_1806" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/1596f4d2-66b5-4627-96f2-c26794154530", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1596f4d2-66b5-4627-96f2-c26794154530" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_2" + }] + } + ]} +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/vnfAdapterDeleteRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/vnfAdapterDeleteRequest.xml index fd6c228cba..f7d44c030b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/vnfAdapterDeleteRequest.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/vnfAdapterDeleteRequest.xml @@ -1,5 +1,6 @@ <deleteVolumeGroupRequest> <cloudSiteId>null</cloudSiteId> + <cloudOwner>null</cloudOwner> <tenantId>12345</tenantId> <volumeGroupId>12345</volumeGroupId> <volumeGroupStackId>null</volumeGroupStackId> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index dad84e53a9..279957ca1e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -28,6 +28,7 @@ import java.util.Optional; import java.util.TreeSet; import java.util.UUID; import java.util.stream.Collectors; +import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.BpmnError; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -204,7 +205,8 @@ public class AAICreateTasks { if (platform.getPlatformName() == null || "".equals(platform.getPlatformName())) { logger.debug("PlatformName is null in input. Skipping create platform..."); } else { - aaiVnfResources.createPlatformandConnectVnf(platform,vnf); + List<String> platforms = splitCDL(platform.getPlatformName()); + platforms.stream().forEach(platformName -> aaiVnfResources.createPlatformandConnectVnf(new Platform(platformName),vnf)); } } } catch (Exception ex) { @@ -213,6 +215,13 @@ public class AAICreateTasks { } + public List<String> splitCDL(String str){ + return Stream.of(str.split(",")) + .map(String::trim) + .map (elem -> new String(elem)) + .collect(Collectors.toList()); + } + public void createLineOfBusiness(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); @@ -221,7 +230,8 @@ public class AAICreateTasks { if (lineOfBusiness.getLineOfBusinessName() == null || "".equals(lineOfBusiness.getLineOfBusinessName())) { logger.info("lineOfBusiness is null in input. Skipping create lineOfBusiness..."); } else { - aaiVnfResources.createLineOfBusinessandConnectVnf(lineOfBusiness,vnf); + List<String> lineOfBussinesses = splitCDL(lineOfBusiness.getLineOfBusinessName()); + lineOfBussinesses.stream().forEach(lobName -> aaiVnfResources.createLineOfBusinessandConnectVnf(new LineOfBusiness(lobName),vnf)); } } } catch (Exception ex) { diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java index d0901eb689..8bbb6c7f46 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java @@ -267,7 +267,7 @@ public class TestDataSetup{ projectCounter++; Project project = new Project(); - project.setProjectName("testProjectName" + projectCounter); + project.setProjectName("testProjectName1 , testProjectName2 , testProjectName3" + projectCounter); return project; } @@ -485,11 +485,11 @@ public class TestDataSetup{ genericVnf.setIpv4OamAddress("10.222.22.2"); Platform platform = new Platform(); - platform.setPlatformName("testPlatformName"); + platform.setPlatformName(" testPlatformName, testPlatformName2 , testPlatformName3 , testPlatformName4"); genericVnf.setPlatform(platform); LineOfBusiness lob = new LineOfBusiness(); - lob.setLineOfBusinessName("testLineOfBusinessName"); + lob.setLineOfBusinessName(" testLineOfBusinessName , testLineOfBusinessName2, testLineOfBusinessName3, testLineOfBusinessName4"); genericVnf.setLineOfBusiness(lob); ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java index fcb95ca07e..5c1caccc2d 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java @@ -20,6 +20,7 @@ package org.onap.so.bpmn.infrastructure.aai.tasks; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doNothing; @@ -31,6 +32,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.Arrays; +import java.util.List; import java.util.Optional; import java.util.TreeSet; @@ -43,6 +45,7 @@ import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatchers; import org.mockito.Captor; import org.mockito.InjectMocks; +import org.mockito.Mockito; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -51,6 +54,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; @@ -61,6 +65,7 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; public class AAICreateTasksTest extends BaseTaskTest{ @@ -162,14 +167,41 @@ public class AAICreateTasksTest extends BaseTaskTest{ public void createPlatformTest() throws Exception { doNothing().when(aaiVnfResources).createPlatformandConnectVnf(genericVnf.getPlatform(), genericVnf); aaiCreateTasks.createPlatform(execution); - verify(aaiVnfResources, times(1)).createPlatformandConnectVnf(genericVnf.getPlatform(), genericVnf); + ArgumentCaptor<Platform> platformCaptor = ArgumentCaptor.forClass(Platform.class); + ArgumentCaptor<GenericVnf> genericVnf = ArgumentCaptor.forClass(GenericVnf.class); + Mockito.verify(aaiVnfResources,times(4)).createPlatformandConnectVnf(platformCaptor.capture(),genericVnf.capture()); + + List<Platform> capturedPlatforms = platformCaptor.getAllValues(); + assertTrue(capturedPlatforms.stream().anyMatch(item -> "testPlatformName".equals(item.getPlatformName()))); + assertTrue(capturedPlatforms.stream().anyMatch(item -> "testPlatformName2".equals(item.getPlatformName()))); + assertTrue(capturedPlatforms.stream().anyMatch(item -> "testPlatformName3".equals(item.getPlatformName()))); + assertTrue(capturedPlatforms.stream().anyMatch(item -> "testPlatformName4".equals(item.getPlatformName()))); } @Test public void createLineOfBusinessTest() throws Exception { doNothing().when(aaiVnfResources).createLineOfBusinessandConnectVnf(genericVnf.getLineOfBusiness(), genericVnf); aaiCreateTasks.createLineOfBusiness(execution); - verify(aaiVnfResources, times(1)).createLineOfBusinessandConnectVnf(genericVnf.getLineOfBusiness(), genericVnf); + + ArgumentCaptor<LineOfBusiness> lobCaptor = ArgumentCaptor.forClass(LineOfBusiness.class); + ArgumentCaptor<GenericVnf> genericVnf = ArgumentCaptor.forClass(GenericVnf.class); + Mockito.verify(aaiVnfResources,times(4)).createLineOfBusinessandConnectVnf(lobCaptor.capture(),genericVnf.capture()); + + List<LineOfBusiness> capturedLOB = lobCaptor.getAllValues(); + assertTrue(capturedLOB.stream().anyMatch(item -> "testLineOfBusinessName".equals(item.getLineOfBusinessName()))); + assertTrue(capturedLOB.stream().anyMatch(item -> "testLineOfBusinessName2".equals(item.getLineOfBusinessName()))); + assertTrue(capturedLOB.stream().anyMatch(item -> "testLineOfBusinessName3".equals(item.getLineOfBusinessName()))); + assertTrue(capturedLOB.stream().anyMatch(item -> "testLineOfBusinessName4".equals(item.getLineOfBusinessName()))); + + } + + @Test + public void splitCDL_Test() throws Exception { + List<String> strings = aaiCreateTasks.splitCDL("Test"); + assertEquals(strings.get(0),"Test"); + + List<String> strings2 = aaiCreateTasks.splitCDL(""); + assertEquals(strings2.get(0),""); } @Test |