summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidationTest.java18
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/RelatedInstanceInstanceId.json138
2 files changed, 156 insertions, 0 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidationTest.java
index 93a19a9531..ef160e9c4c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidationTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidationTest.java
@@ -31,6 +31,7 @@ import org.junit.rules.ExpectedException;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.BaseTest;
import org.onap.so.exceptions.ValidationException;
+import org.onap.so.serviceinstancebeans.InstanceDirection;
import org.onap.so.serviceinstancebeans.RelatedInstanceList;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -133,4 +134,21 @@ public class RelatedInstancesValidationTest extends BaseTest {
validation.validate(setupValidationInformation(
"src/test/resources/Validation/VpnBondingValidation/NoModelInvariantId.json"));
}
+
+ @Test
+ public void validateRelatedInstanceInstanceIdTest() throws IOException, ValidationException {
+ validation.validate(setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/RelatedInstanceInstanceId.json"));
+ }
+
+ @Test
+ public void validateRelatedInstanceInstanceIdExceptionTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage("serviceInstanceId matching the serviceInstanceId in request URI");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/RelatedInstanceInstanceId.json");
+ RelatedInstanceList[] instanceList = info.sir.getRequestDetails().getRelatedInstanceList();
+ instanceList[0].getRelatedInstance().setInstanceDirection(InstanceDirection.fromValue("destination"));
+ validation.validate(info);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/RelatedInstanceInstanceId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/RelatedInstanceInstanceId.json
new file mode 100644
index 0000000000..156eedf2b4
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/RelatedInstanceInstanceId.json
@@ -0,0 +1,138 @@
+{
+ "requestDetails": {
+ "subscriberInfo": {
+ "globalSubscriberId": "ubuntu-customer"
+ },
+ "requestInfo": {
+ "suppressRollback": false,
+ "instanceName": "Onap-Unit-Test",
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "requestorId": "portal",
+ "source": "postman"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "Onap215",
+ "tenantId": "e2710e84063b421fab08189818761d55",
+ "cloudOwner": "Onap"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "ubuntu",
+ "userParams": [
+ {
+ "Homing_Solution": "none"
+ },
+ {
+ "service": {
+ "instanceParams": [],
+ "resources": {
+ "vnfs": [
+ {
+ "modelInfo": {
+ "modelName": "UbuntuVF",
+ "modelVersionId": "3b6cb925-b583-4c5d-8200-62212258dd03",
+ "modelInvariantUuid": "dcbd2b4f-86a9-48f2-9149-9fbd506cb0f5",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "1aa2ae52-f3c8-4c52-91eb-54a23104cff8",
+ "modelInstanceName": "UbuntuVF 0"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "lcp",
+ "tenantId": "e2710e84063b421fab08189818761d55",
+ "cloudOwner": "Onap"
+ },
+ "platform": {
+ "platformName": "openstack"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "wireless"
+ },
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "instanceName": "vnf-instanceName",
+ "instanceParams": [
+ {
+ "vnf-name": "vnf-vnf-name",
+ "vnf_name": "UbuntuVNFName"
+ }
+ ],
+ "vfModules": [
+ {
+ "modelInfo": {
+ "modelName": "UbuntuVF..base..module-0",
+ "modelVersionId": "2bb60c6b-2bfb-4162-b95b-74d81916aa25",
+ "modelInvariantUuid": "fb8af74c-83a6-4c27-b2db-b414bf70062a",
+ "modelVersion": "1",
+ "modelCustomizationId": "cd530d5b-b24b-4d2c-9987-5179075c9381"
+ },
+ "instanceName": "Openstack-fail-network-1",
+ "instanceParams": [
+ {
+ "name": "Openstack-fail-network-1",
+ "cidr": "10.10.10.0/24"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "UbuntuVF..ubuntu-vf-module..module-1",
+ "modelVersionId": "73fb74e8-f7cc-4927-9cc2-bb5c7b36c109",
+ "modelInvariantUuid": "51d1c820-7578-4c5d-8fc7-fcf975800059",
+ "modelVersion": "1",
+ "modelCustomizationId": "67b4547c-b059-4a45-8b0b-12ce6bb3cf2f"
+ },
+ "instanceName": "Openstack-fail-ubuntu-1",
+ "instanceParams": [
+ {
+ "name": "Openstack-fail-ubuntu-1",
+ "network_mgmt": "vlan666_net",
+ "key_name": "mykey",
+ "network_name": "Openstack-fail-network-1"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "modelInfo": {
+ "modelVersion": "1.0",
+ "modelVersionId": "b0dce97c-e320-4dea-bd4a-7e398b4f5199",
+ "modelInvariantId": "577d7107-53ab-4f3d-a5a4-f4e9295312d8",
+ "modelName": "UbuntuSVC",
+ "modelType": "service"
+ }
+ }
+ }
+ ],
+ "aLaCarte": false
+ },
+ "project": {
+ "projectName": "Project-UbuntuDemo"
+ },
+ "owningEntity": {
+ "owningEntityId": "33a8b609-1cfe-4d19-8dc2-5b95b921de1e",
+ "owningEntityName": "owner"
+ },
+ "modelInfo": {
+ "modelVersion": "1.0",
+ "modelVersionId": "b0dce97c-e320-4dea-bd4a-7e398b4f5199",
+ "modelInvariantId": "577d7107-53ab-4f3d-a5a4-f4e9295312d8",
+ "modelName": "UbuntuSVC",
+ "modelType": "service"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "351262fb-4a32-4c43-b600-c6514f6ff808",
+ "modelInfo": {
+ "modelVersion": "1.0",
+ "modelVersionId": "b0dce97c-e320-4dea-bd4a-7e398b4f5199",
+ "modelInvariantId": "577d7107-53ab-4f3d-a5a4-f4e9295312d8",
+ "modelName": "UbuntuSVC",
+ "modelType": "service"
+ },
+ "instanceDirection": "source"
+ }
+ }
+ ]
+ }
+} \ No newline at end of file