AT&T 1712 and 1802 release code
[so.git] / mso-api-handlers / mso-api-handler-infra / src / test / java / org / openecomp / mso / apihandlerinfra / MsoRequestTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 package org.openecomp.mso.apihandlerinfra;
21
22 import static org.junit.Assert.assertEquals;
23 import static org.junit.Assert.assertFalse;
24 import static org.junit.Assert.assertNotNull;
25 import static org.junit.Assert.assertTrue;
26
27 import java.io.IOException;
28 import java.util.Arrays;
29 import java.util.Collection;
30 import java.util.HashMap;
31
32 import org.apache.commons.io.IOUtils;
33 import org.apache.commons.lang.CharEncoding;
34 import org.junit.Before;
35 import org.junit.Rule;
36 import org.junit.Test;
37 import org.junit.rules.ExpectedException;
38 import org.junit.runner.RunWith;
39 import org.openecomp.mso.apihandler.common.ValidationException;
40 import org.openecomp.mso.serviceinstancebeans.ServiceInstancesRequest;
41
42 import com.fasterxml.jackson.core.JsonParseException;
43 import com.fasterxml.jackson.databind.JsonMappingException;
44 import com.fasterxml.jackson.databind.ObjectMapper;
45
46 import junitparams.JUnitParamsRunner;
47 import junitparams.Parameters;
48
49 @RunWith(JUnitParamsRunner.class)
50 public class MsoRequestTest {
51         private ObjectMapper mapper = new ObjectMapper();
52         private HashMap<String, String> instanceIdMapTest = new HashMap<>();
53         private ServiceInstancesRequest sir;
54         private MsoRequest msoRequest;
55         private Action action;
56         private String version;
57         private String originalRequestJSON;
58         private String requestJSON;
59         private boolean expected;
60         private String expectedException;
61         
62         @Rule
63         public ExpectedException thrown = ExpectedException.none();
64         
65         
66         @Before
67         public void validate(){
68                 msoRequest = new MsoRequest();
69         }
70         public String inputStream(String JsonInput)throws IOException{
71                 String input = IOUtils.toString(ClassLoader.class.getResourceAsStream (JsonInput), CharEncoding.UTF_8);
72                 return input;
73         }
74         @Test
75         public void nullInstanceIdMapTest() throws JsonParseException, JsonMappingException, IOException, ValidationException{
76                 this.sir = mapper.readValue(inputStream("/RequestParametersNull.json"), ServiceInstancesRequest.class);
77                 this.instanceIdMapTest = null;
78                 thrown.expect(NullPointerException.class);
79                 this.msoRequest = new MsoRequest("nullINstanceIdMap");
80                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
81         }
82         @Test
83         @Parameters(method = "successParameters")
84         public void successTest(ServiceInstancesRequest sir, HashMap<String, String> instanceIdMapTest, Action action, String version) throws ValidationException{
85                 this.sir = sir;
86                 this.instanceIdMapTest = instanceIdMapTest;
87                 this.action = action;
88                 this.version = version;
89                 this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
90                 this.instanceIdMapTest.put("vnfInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
91                 this.msoRequest = new MsoRequest("successTest");
92                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
93         }
94         @Parameters
95         private Collection<Object[]> successParameters() throws JsonParseException, JsonMappingException, IOException{
96                 return Arrays.asList(new Object[][]{
97                         {mapper.readValue(inputStream("/EmptyRequestorId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v3"},
98                         {mapper.readValue(inputStream("/ValidModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v4"},
99                         {mapper.readValue(inputStream("/EmptyCloudConfiguration.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, "v3"},
100                         {mapper.readValue(inputStream("/RelatedInstancesModelInvariantId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deleteInstance, "v5"},
101                         {mapper.readValue(inputStream("/PlatformTest.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, "v5"},
102                         {mapper.readValue(inputStream("/v5EnablePortMirrorService.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.enablePort, "v5"},
103                         {mapper.readValue(inputStream("/ValidModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.replaceInstance, "v5"},
104                         {mapper.readValue(inputStream("/ValidModelCustomizationIdService.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.replaceInstance, "v5"},
105                         {mapper.readValue(inputStream("/ServiceProductFamilyIdUpdate.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, "v5"},
106                         {mapper.readValue(inputStream("/ServiceProductFamilyIdFlag.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, "v5"},             
107                         {mapper.readValue(inputStream("/VnfModelCustomizationIdEmpty.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deleteInstance, "v5"},
108                         {mapper.readValue(inputStream("/RelatedInstancesVfModule.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, "v5"},
109                         {mapper.readValue(inputStream("/RelatedInstances.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, "v5"},
110                         {mapper.readValue(inputStream("/VnfModelCustomizationNameNull.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.replaceInstance, "v5"},
111                         {mapper.readValue(inputStream("/VnfModelCustomizationTest.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.replaceInstance, "v5"},
112                         {mapper.readValue(inputStream("/ServiceModelNameEmptyOnDelete.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deleteInstance, "v2"},
113                         {mapper.readValue(inputStream("/ServiceModelNameEmptyOnActivate.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, "v2"},
114                         {mapper.readValue(inputStream("/ModelVersionNetwork.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deleteInstance, "v3"},
115                         {mapper.readValue(inputStream("/ModelInvariantIdService.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deactivateInstance, "v4"},
116                         {mapper.readValue(inputStream("/ModelInvariantIdConfigurationDelete.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deleteInstance, "v3"},
117                         {mapper.readValue(inputStream("/ModelCustomizationIdUsingPreload.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.replaceInstance, "v5"},
118                         {mapper.readValue(inputStream("/ServiceInPlaceSoftwareUpdate.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.inPlaceSoftwareUpdate, "v6"},
119                         {mapper.readValue(inputStream("/EmptyOwningEntityName.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
120                         {mapper.readValue(inputStream("/VnfRequestParameters.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deleteInstance, "v6"},
121                         {mapper.readValue(inputStream("/VnfActivate.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, "v6"},
122                         {mapper.readValue(inputStream("/ServiceInPlaceSoftwareUpdate.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.applyUpdatedConfig, "v6"},
123                         {mapper.readValue(inputStream("/ProjectAndOwningEntity2.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v6"},
124                         {mapper.readValue(inputStream("/PlatformAndLineOfBusiness2.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v6"},
125                         {mapper.readValue(inputStream("/UserParams.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"}
126                 });
127         }
128         @Test
129         @Parameters(method = "aLaCarteParameters")
130         public void aLaCarteFlagTest(boolean expected, ServiceInstancesRequest sir, HashMap<String, String> instanceIdMapTest, Action action, String version) throws JsonParseException, IOException, ValidationException{
131                 this.expected = expected;
132                 this.sir = sir;
133                 this.instanceIdMapTest = instanceIdMapTest;
134                 this.action = action;
135                 this.version = version;
136                 this.msoRequest = new MsoRequest("aLaCarteCheck");
137                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
138                 assertEquals(expected, msoRequest.getALaCarteFlag());
139         }
140         @Parameters
141         private Collection<Object[]> aLaCarteParameters() throws IOException{
142                 return Arrays.asList(new Object[][] {
143                         {false, mapper.readValue(inputStream("/RequestParametersNull.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deleteInstance, "v3"},
144                         {true, mapper.readValue(inputStream("/RequestParametersALaCarteTrue.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v3"},
145                         {true, mapper.readValue(inputStream("/v2requestParametersALaCarteFalse.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v2"},
146                 });
147         }
148         @Test
149         @Parameters(method = "validationParameters")
150         public void validationFailureTest(String expectedException, ServiceInstancesRequest sir, HashMap<String, String> instanceIdMapTest, Action action, String version) throws JsonParseException, JsonMappingException, IOException, ValidationException{
151                 this.expectedException = expectedException;
152                 this.sir = sir;
153                 this.instanceIdMapTest = instanceIdMapTest;
154                 this.action = action;
155                 this.version = version;
156                 this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
157                 this.instanceIdMapTest.put("vnfInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
158                 thrown.expect(ValidationException.class);
159                 thrown.expectMessage(expectedException);
160                 this.msoRequest = new MsoRequest("validationFailure");
161                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
162         }
163         @Parameters
164         private Collection<Object[]> validationParameters() throws IOException{
165                 return Arrays.asList(new Object[][] {
166                         {"No valid aLaCarte in requestParameters", mapper.readValue(inputStream("/RequestParametersNull.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.addRelationships, "v4"},
167                         {"No valid model-info is specified", mapper.readValue(inputStream("/ModelInfoNull.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
168                         {"No valid requestInfo is specified", mapper.readValue(inputStream("/RequestInfoNull.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
169                         {"No valid modelType is specified", mapper.readValue(inputStream("/ModelTypeNull.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
170                         {"No valid lcpCloudRegionId is specified", mapper.readValue(inputStream("/EmptyLcpCloudConfiguration.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
171                         {"No valid tenantId is specified", mapper.readValue(inputStream("/EmptyTenantId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
172                         {"No valid requestParameters is specified", mapper.readValue(inputStream("/RequestParametersNull.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
173                         {"No valid subscriptionServiceType is specified", mapper.readValue(inputStream("/EmptySubscriptionServiceType.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
174                         {"No valid instanceName format is specified", mapper.readValue(inputStream("/InvalidInstanceName.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v2"},
175                         {"No valid requestorId is specified", mapper.readValue(inputStream("/EmptyRequestorId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
176                         {"No valid modelInvariantId format is specified", mapper.readValue(inputStream("/InvalidModelInvariantId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v2"},
177                         {"No valid subscriberInfo is specified", mapper.readValue(inputStream("/EmptySubscriberInfo.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
178                         {"No valid globalSubscriberId is specified", mapper.readValue(inputStream("/EmptyGlobalSubscriberId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
179                         {"No valid platformName is specified", mapper.readValue(inputStream("/EmptyPlatform.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
180                         {"No valid platform is specified", mapper.readValue(inputStream("/Platform.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v6"},
181                         {"No valid lineOfBusinessName is specified", mapper.readValue(inputStream("/EmptyLineOfBusiness.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
182                         {"No valid projectName is specified", mapper.readValue(inputStream("/EmptyProject.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
183                         {"No valid owningEntity is specified", mapper.readValue(inputStream("/OwningEntity.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v6"},
184                         {"No valid owningEntityId is specified", mapper.readValue(inputStream("/EmptyOwningEntityId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
185                         {"No valid modelCustomizationId is specified", mapper.readValue(inputStream("/ModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.replaceInstance, "v5"},
186                         {"No valid modelCustomizationId or modelCustomizationName is specified", mapper.readValue(inputStream("/VnfModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.replaceInstance, "v5"},
187                         {"No valid modelName is specified", mapper.readValue(inputStream("/VfModuleModelName.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deleteInstance, "v4"},
188                         {"No valid modelCustomizationId or modelCustomizationName is specified", mapper.readValue(inputStream("/VnfModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
189                         {"No valid cloudConfiguration is specified", mapper.readValue(inputStream("/CloudConfiguration.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v4"},
190                         {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
191                         {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ConfigurationModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, "v5"},
192                         {"No valid productFamilyId is specified", mapper.readValue(inputStream("/VnfProductFamilyId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v3"},
193                         {"No valid productFamilyId is specified", mapper.readValue(inputStream("/NetworkProductFamilyId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v3"},
194                         {"No valid productFamilyId is specified", mapper.readValue(inputStream("/NetworkProductFamilyId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, "v3"},
195                         {"No valid productFamilyId is specified", mapper.readValue(inputStream("/ServiceProductFamilyId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
196                         {"No valid modelVersionId in relatedInstance is specified", mapper.readValue(inputStream("/RelatedInstancesModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
197                         {"No valid modelType in relatedInstance is specified", mapper.readValue(inputStream("/RelatedInstancesModelType.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
198                         {"No valid modelInfo in relatedInstance is specified", mapper.readValue(inputStream("/RelatedInstancesModelInfo.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
199                         {"No valid instanceName format in relatedInstance is specified", mapper.readValue(inputStream("/RelatedInstancesNameFormat.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
200                         {"No valid instanceId in relatedInstance is specified", mapper.readValue(inputStream("/RelatedInstancesId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
201                         {"No valid instanceId format in relatedInstance is specified", mapper.readValue(inputStream("/RelatedInstancesIdFormat.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
202                         {"No valid modelInvariantId in relatedInstance is specified", mapper.readValue(inputStream("/RelatedInstancesModelInvariantId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
203                         {"No valid modelName in relatedInstance is specified", mapper.readValue(inputStream("/RelatedInstancesModelName.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
204                         {"No valid modelVersion in relatedInstance is specified", mapper.readValue(inputStream("/RelatedInstancesModelVersion.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
205                         {"No valid modelInvariantId format in relatedInstance is specified", mapper.readValue(inputStream("/RelatedInstancesModelInvariantIdFormat.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
206                         {"No valid modelCustomizationName or modelCustomizationId in relatedInstance of vnf is specified", mapper.readValue(inputStream("/RelatedInstancesModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, "v5"},
207                         {"No valid serviceInstanceId matching the serviceInstanceId in request URI is specified", mapper.readValue(inputStream("/RelatedInstancesInstanceId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, "v5"},
208                         {"No valid vnfInstanceId matching the vnfInstanceId in request URI is specified", mapper.readValue(inputStream("/RelatedInstancesVnfInstanceId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, "v5"},
209                         {"No valid related vnf instance for volumeGroup request is specified", mapper.readValue(inputStream("/RelatedInstancesVnfInstance.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, "v5"},
210                         {"No valid related service instance for volumeGroup request is specified", mapper.readValue(inputStream("/RelatedInstancesServiceInstance.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, "v5"},
211                         {"No valid related vnf instance for vfModule request is specified", mapper.readValue(inputStream("/VfModuleRelatedInstancesVnf.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, "v5"},
212                         {"No valid related service instance for vfModule request is specified", mapper.readValue(inputStream("/VfModuleRelatedInstancesService.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, "v5"},
213                         {"No valid related service instance for vnf request is specified", mapper.readValue(inputStream("/VnfRelatedInstancesService.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, "v5"},
214                         {"No valid modelCustomizationId or modelCustomizationName is specified", mapper.readValue(inputStream("/VnfModelCustomizationIdPreload.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.replaceInstance, "v5"},
215                         {"No valid modelVersion is specified", mapper.readValue(inputStream("/ModelVersionService.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, "v3"},
216                         {"No valid modelVersion is specified", mapper.readValue(inputStream("/ModelVersionVfModule.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v3"},
217                         {"No valid modelInvariantId is specified", mapper.readValue(inputStream("/ModelInvariantId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deactivateInstance, "v4"},
218                         {"No valid modelInvariantId is specified", mapper.readValue(inputStream("/v5ModelInvariantIdNetwork.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.enablePort, "v5"},
219                         {"No valid modelInvariantId is specified", mapper.readValue(inputStream("/v5ModelInvariantIdDisablePort.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.disablePort, "v5"},
220                         {"No valid modelInvariantId is specified", mapper.readValue(inputStream("/ModelInvariantIdVnf.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, "v3"},
221                         {"No valid modelInvariantId is specified", mapper.readValue(inputStream("/ModelInvariantIdConfiguration.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, "v3"},
222                         {"No valid modelVersion is specified", mapper.readValue(inputStream("/ModelInvariantIdServiceCreate.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v3"},
223                         {"No valid modelVersionId is specified", mapper.readValue(inputStream("/v2ModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, "v4"},
224                         {"No valid modelVersionId is specified", mapper.readValue(inputStream("/v2ModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deactivateInstance, "v4"},
225                         {"No valid modelVersionId is specified", mapper.readValue(inputStream("/v2ModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, "v5"},
226                         {"No valid modelVersionId is specified", mapper.readValue(inputStream("/v2ModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.enablePort, "v5"},
227                         {"No valid modelVersionId is specified", mapper.readValue(inputStream("/v2ModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.disablePort, "v5"},
228                         {"No valid modelCustomizationId or modelCustomizationName is specified", mapper.readValue(inputStream("/ModelVersionIdTest.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, "v5"},
229                         {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelVersionIdCreate.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
230                         {"No valid requestParameters is specified", mapper.readValue(inputStream("/RequestParameters.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.applyUpdatedConfig, "v6"},
231                         {"No valid requestInfo is specified", mapper.readValue(inputStream("/RequestInfo.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.applyUpdatedConfig, "v6"},
232                         {"No valid requestorId is specified", mapper.readValue(inputStream("/RequestorId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.applyUpdatedConfig, "v6"},
233                         {"No valid requestParameters is specified", mapper.readValue(inputStream("/RequestParameters.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.inPlaceSoftwareUpdate, "v6"},
234                         {"No valid requestInfo is specified", mapper.readValue(inputStream("/RequestInfo.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.inPlaceSoftwareUpdate, "v6"},
235                         {"No valid requestorId is specified", mapper.readValue(inputStream("/RequestorId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.inPlaceSoftwareUpdate, "v6"},
236                         {"No valid cloudConfiguration is specified", mapper.readValue(inputStream("/InPlaceSoftwareUpdateCloudConfiguration.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.inPlaceSoftwareUpdate, "v6"},
237                         {"No valid lcpCloudRegionId is specified", mapper.readValue(inputStream("/InPlaceSoftwareUpdateCloudRegionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.inPlaceSoftwareUpdate, "v6"},
238                         {"No valid tenantId is specified", mapper.readValue(inputStream("/InPlaceSoftwareUpdateTenantId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.inPlaceSoftwareUpdate, "v6"},
239                         {"No valid serviceInstanceId matching the serviceInstanceId in request URI is specified", mapper.readValue(inputStream("/v6VnfDeleteInstance.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deleteInstance, "v6"},
240                         {"No valid related instances is specified", mapper.readValue(inputStream("/ServiceNoRelatedInstance.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.addRelationships, "v2"},
241                         {"No valid related instances is specified", mapper.readValue(inputStream("/ServiceNoRelatedInstance.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.removeRelationships, "v2"},
242                         {"No valid modelCustomizationId or modelCustomizationName is specified", mapper.readValue(inputStream("/VnfRequestParameters.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.replaceInstance, "v6"},
243                         {"No valid modelCustomizationId or modelCustomizationName is specified", mapper.readValue(inputStream("/VnfRequestParameters.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, "v6"},
244                         {"No valid instanceName in relatedInstance for pnf modelType is specified", mapper.readValue(inputStream("/v6AddRelationshipsBadData.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.removeRelationships, "v6"},
245                         {"No valid instanceName in relatedInstance for pnf modelType is specified", mapper.readValue(inputStream("/v6AddRelationshipsBadData.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.addRelationships, "v6"},
246                         {"No valid modelInvariantId is specified", mapper.readValue(inputStream("/v5DeactivatePortMirrorBadData.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deactivateInstance, "v5"},
247                         {"No valid modelVersionId is specified", mapper.readValue(inputStream("/v5ActivatePortMirrorBadData.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, "v5"},
248                         {"No valid related instances is specified", mapper.readValue(inputStream("/v5EnablePortMirrorNoRelatedInstance.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.disablePort, "v2"},
249                         {"No valid connectionPoint relatedInstance for Port Configuration is specified", mapper.readValue(inputStream("/v5EnablePortMirrorNoConnectionPoint.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.disablePort, "v5"},
250                         {"No valid connectionPoint relatedInstance for Port Configuration is specified", mapper.readValue(inputStream("/v5EnablePortMirrorNoConnectionPoint.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.enablePort, "v5"},
251                         {"No valid related instances is specified", mapper.readValue(inputStream("/v5EnablePortMirrorNoRelatedInstance.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.enablePort, "v5"},
252                         {"No valid modelCustomizationId is specified", mapper.readValue(inputStream("/v5PortMirrorCreateConfigurationBad.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
253                         {"No valid source vnf relatedInstance for Port Configuration is specified", mapper.readValue(inputStream("/v5PortMirrorCreateNoSourceRelatedInstance.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
254                         {"No valid destination vnf relatedInstance for Port Configuration is specified", mapper.readValue(inputStream("/v5PortMirrorCreateNoDestinationRelatedInstance.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
255                         {"No valid related instances is specified", mapper.readValue(inputStream("/v5PortMirrorCreateNoRelatedInstances.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
256                         {"No valid modelCustomizationId is specified", mapper.readValue(inputStream("/v4CreateVfModuleMissingModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v4"},
257                         {"No valid modelInvariantId is specified", mapper.readValue(inputStream("/v3DeleteServiceInstanceALaCarte.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v3"},
258                         {"No valid modelInvariantId is specified", mapper.readValue(inputStream("/v3UpdateNetworkBad.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, "v4"},
259                         {"No valid related instances is specified", mapper.readValue(inputStream("/v3VolumeGroupBad.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, "v4"}
260                 });
261         }
262         @Test
263         public void setInstancedIdHashMapTest() throws JsonParseException, JsonMappingException, IOException, ValidationException{
264                 this.sir = mapper.readValue(inputStream("/v2AutoBuildVfModulesTrue.json"), ServiceInstancesRequest.class);
265                 this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
266                 this.instanceIdMapTest.put("vnfInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff001");
267                 this.instanceIdMapTest.put("vfModuleInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff002");
268                 this.instanceIdMapTest.put("volumeGroupInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff003");
269                 this.instanceIdMapTest.put("networkInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff004");
270                 this.instanceIdMapTest.put("configurationInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff005");
271                 this.action = Action.createInstance;
272                 this.version = "v5";
273                 this.msoRequest = new MsoRequest("setInstanceIdHashMap");
274                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
275                 assertEquals("ff305d54-75b4-431b-adb2-eb6b9e5ff000", msoRequest.getServiceInstancesRequest().getServiceInstanceId());
276                 assertEquals("ff305d54-75b4-431b-adb2-eb6b9e5ff001", msoRequest.getServiceInstancesRequest().getVnfInstanceId());
277                 assertEquals("ff305d54-75b4-431b-adb2-eb6b9e5ff002", msoRequest.getServiceInstancesRequest().getVfModuleInstanceId());
278                 assertEquals("ff305d54-75b4-431b-adb2-eb6b9e5ff003", msoRequest.getServiceInstancesRequest().getVolumeGroupInstanceId());
279                 assertEquals("ff305d54-75b4-431b-adb2-eb6b9e5ff004", msoRequest.getServiceInstancesRequest().getNetworkInstanceId());
280                 assertEquals("ff305d54-75b4-431b-adb2-eb6b9e5ff005", msoRequest.getServiceInstancesRequest().getConfigurationId());
281         }
282         @Test
283         public void serviceInstanceIdHashMapFailureTest() throws JsonParseException, JsonMappingException, IOException, ValidationException{
284                 this.sir = mapper.readValue(inputStream("/v2AutoBuildVfModulesTrue.json"), ServiceInstancesRequest.class);
285                 this.instanceIdMapTest.put("serviceInstanceId", "test");
286                 this.action = Action.createInstance;
287                 this.version = "v5";
288                 thrown.expect(ValidationException.class);
289                 thrown.expectMessage("No valid serviceInstanceId is specified");
290                 this.msoRequest = new MsoRequest("serviceInstanceIdFailure");
291                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
292         }
293         @Test
294         public void vnfInstanceIdHashMapFailureTest() throws JsonParseException, JsonMappingException, IOException, ValidationException{
295                 this.sir = mapper.readValue(inputStream("/v2AutoBuildVfModulesTrue.json"), ServiceInstancesRequest.class);
296                 this.instanceIdMapTest.put("vnfInstanceId", "test");
297                 this.action = Action.createInstance;
298                 this.version = "v5";
299                 thrown.expect(ValidationException.class);
300                 thrown.expectMessage("No valid vnfInstanceId is specified");
301                 this.msoRequest = new MsoRequest("vnfInstanceIdFailure");
302                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
303         }
304         @Test
305         public void vfModuleInstanceIdHashMapFailureTest() throws JsonParseException, JsonMappingException, IOException, ValidationException{
306                 this.sir = mapper.readValue(inputStream("/v2AutoBuildVfModulesTrue.json"), ServiceInstancesRequest.class);
307                 this.instanceIdMapTest.put("vfModuleInstanceId", "test");
308                 this.action = Action.createInstance;
309                 this.version = "v5";
310                 thrown.expect(ValidationException.class);
311                 thrown.expectMessage("No valid vfModuleInstanceId is specified");
312                 this.msoRequest = new MsoRequest("vfModuleInstanceIdFailure");
313                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
314         }
315         @Test
316         public void volumeGroupInstanceIdHashMapFailureTest() throws JsonParseException, JsonMappingException, IOException, ValidationException{
317                 this.sir = mapper.readValue(inputStream("/v2AutoBuildVfModulesTrue.json"), ServiceInstancesRequest.class);
318                 this.instanceIdMapTest.put("volumeGroupInstanceId", "test");
319                 this.action = Action.createInstance;
320                 this.version = "v5";
321                 thrown.expect(ValidationException.class);
322                 thrown.expectMessage("No valid volumeGroupInstanceId is specified");
323                 this.msoRequest = new MsoRequest("volumeGroupInstanceIdFailure");
324                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
325         }
326         @Test
327         public void networkInstanceIdHashMapFailureTest() throws JsonParseException, JsonMappingException, IOException, ValidationException{
328                 this.sir = mapper.readValue(inputStream("/v2AutoBuildVfModulesTrue.json"), ServiceInstancesRequest.class);
329                 this.instanceIdMapTest.put("networkInstanceId", "test");
330                 this.action = Action.createInstance;
331                 this.version = "v5";
332                 thrown.expect(ValidationException.class);
333                 thrown.expectMessage("No valid networkInstanceId is specified");
334                 this.msoRequest = new MsoRequest("networkInstanceIdFailure");
335                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
336         }
337         @Test
338         public void configurationInstanceIdHashMapFailureTest() throws JsonParseException, JsonMappingException, IOException, ValidationException{
339                 this.sir = mapper.readValue(inputStream("/v2AutoBuildVfModulesTrue.json"), ServiceInstancesRequest.class);
340                 this.instanceIdMapTest.put("configurationInstanceId", "test");
341                 this.action = Action.createInstance;
342                 this.version = "v5";
343                 thrown.expect(ValidationException.class);
344                 thrown.expectMessage("No valid configurationInstanceId is specified");
345                 this.msoRequest = new MsoRequest("configurationInstanceIdFailure");
346                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
347         }
348         @Test
349         public void setVolumeGroupRelatedInstancesTest() throws JsonParseException, JsonMappingException, IOException, ValidationException{
350                 this.sir = mapper.readValue(inputStream("/VolumeGroupRelatedInstances.json"), ServiceInstancesRequest.class);
351                 this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
352                 this.instanceIdMapTest.put("vnfInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff001");
353                 this.action = Action.createInstance;
354                 this.version = "v5";
355                 this.msoRequest = new MsoRequest("setVolumeGroupRelatedInstances");
356                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
357                 assertEquals("vSAMP12", msoRequest.getServiceInstanceType());
358                 assertEquals("vSAMP12" + "/" + "test", msoRequest.getVnfType());
359                 assertEquals("1.0", msoRequest.getAsdcServiceModelVersion());
360         }
361         @Test
362         @Parameters(method = "projectParameters")
363         public void setProjectAndOwningEntityTest(ServiceInstancesRequest sir, HashMap<String, String> instanceIdMapTest, Action action, String version) throws ValidationException, JsonParseException, JsonMappingException, IOException{
364                 this.sir = sir;
365                 this.action = action;
366                 this.version = version;
367                 this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
368                 this.msoRequest = new MsoRequest("setProjectAndOwningEntity");
369                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
370                 assertEquals("projectName", msoRequest.getProject().getProjectName());
371                 assertEquals("oeId", msoRequest.getOwningEntity().getOwningEntityId());
372                 assertEquals("oeName", msoRequest.getOwningEntity().getOwningEntityName());
373         }
374         @Parameters
375         private Collection<Object[]> projectParameters() throws IOException{
376                 return Arrays.asList(new Object[][] {
377                         {mapper.readValue(inputStream("/ProjectAndOwningEntity.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
378                         {mapper.readValue(inputStream("/ProjectAndOwningEntity.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v6"},
379                 });
380         }
381         
382         @Test
383         public void setModelInfoTest() throws ValidationException, JsonParseException, JsonMappingException, IOException{
384                 this.sir = mapper.readValue(inputStream("/RequestParametersALaCarteTrue.json"), ServiceInstancesRequest.class);
385                 this.action = Action.createInstance;
386                 this.version = "v5";
387                 this.msoRequest = new MsoRequest("setModelInfo");
388                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
389                 assertEquals("test", msoRequest.getServiceInstancesRequest().getRequestDetails().getModelInfo().getModelVersionId());
390         }
391         @Test
392         public void setServiceInstanceTypeTest() throws ValidationException, JsonParseException, JsonMappingException, IOException{
393                 this.sir = mapper.readValue(inputStream("/RequestParametersALaCarteTrue.json"), ServiceInstancesRequest.class);
394                 this.action = Action.createInstance;
395                 this.version = "v5";
396                 this.msoRequest = new MsoRequest("setServiceInstanceType");
397                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
398                 assertEquals("SDNW Service 1710", msoRequest.getServiceInstanceType());
399         }
400         @Test
401         @Parameters(method = "platformParameters")
402         public void setPlatformAndLineOfBusinessTest(ServiceInstancesRequest sir, HashMap<String, String> instanceIdMapTest, Action action, String version) throws ValidationException, JsonParseException, JsonMappingException, IOException{
403                 this.sir = sir;
404                 this.action = action;
405                 this.instanceIdMapTest = instanceIdMapTest;
406                 this.version = version;
407                 this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
408                 this.msoRequest = new MsoRequest("setPlatformAndLineOfBusiness");
409                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
410                 assertEquals("platformName", msoRequest.getPlatform().getPlatformName());
411                 assertEquals("lobName", msoRequest.getLineOfBusiness().getLineOfBusinessName());
412         }
413         @Parameters
414         private Collection<Object[]> platformParameters() throws IOException{
415                 return Arrays.asList(new Object[][] {
416                         {mapper.readValue(inputStream("/PlatformAndLineOfBusiness.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v5"},
417                         {mapper.readValue(inputStream("/PlatformAndLineOfBusiness.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "v6"},
418                 });
419         }
420         
421         @Test
422         public void setNetworkTypeTest() throws ValidationException, JsonParseException, JsonMappingException, IOException{
423                 this.sir = mapper.readValue(inputStream("/NetworkType.json"), ServiceInstancesRequest.class);
424                 this.action = Action.createInstance;
425                 this.version = "v2";
426                 this.msoRequest = new MsoRequest("setNetworkType");
427                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
428                 assertEquals("TestNetworkType", msoRequest.getNetworkType());
429         }
430         @Test
431         public void setModelNameVersionIdTest() throws ValidationException, JsonParseException, JsonMappingException, IOException{
432                 this.sir = mapper.readValue(inputStream("/ModelNameVersionId.json"), ServiceInstancesRequest.class);
433                 this.action = Action.createInstance;
434                 this.version = "v5";
435                 this.msoRequest = new MsoRequest("setModelNameVersionId");
436                 this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON);
437                 assertEquals("test", msoRequest.getModelInfo().getModelNameVersionId());
438         }
439         @Test
440         public void testParseOrchestration() throws JsonParseException, JsonMappingException, IOException, ValidationException{
441                 this.requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"}}}";
442                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
443                 this.msoRequest = new MsoRequest ("ParseOrchestration");
444                 msoRequest.parseOrchestration(sir);
445                 assertEquals(msoRequest.getRequestInfo().getSource(),"VID");
446                 assertEquals(msoRequest.getRequestInfo().getRequestorId(),"zz9999");
447
448         }
449         @Test
450         public void testParseOrchestrationFailure() throws JsonParseException, JsonMappingException, IOException, ValidationException{
451                 this.requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\"}}}";
452                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
453                 thrown.expect(ValidationException.class);
454                 thrown.expectMessage("No valid requestorId is specified");
455                 this. msoRequest = new MsoRequest ("ParseOrchestration");
456                 msoRequest.parseOrchestration(sir);
457         }
458         @Test
459         public void testParseV3VnfCreate() throws JsonParseException, JsonMappingException, IOException, ValidationException{
460                 this.requestJSON = inputStream("/v3VnfCreate.json");
461                 this.instanceIdMapTest.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
462                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
463                 this.msoRequest = new MsoRequest ("1234");
464                 msoRequest.parse(sir, instanceIdMapTest, Action.createInstance, "v3", originalRequestJSON);
465                 assertEquals(msoRequest.getRequestInfo().getSource(),"VID");
466                 assertEquals(msoRequest.getReqVersion(),3);
467         }
468         @Test
469         public void testParseV3UpdateNetwork() throws JsonParseException, JsonMappingException, IOException, ValidationException{
470                 this.requestJSON = inputStream("/v3UpdateNetwork.json");
471                 this.instanceIdMapTest.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
472                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
473                 this.msoRequest = new MsoRequest ("1234");
474                 msoRequest.parse(sir, instanceIdMapTest, Action.updateInstance, "v3", originalRequestJSON);
475         }
476         @Test
477         public void testParseV3DeleteNetwork() throws JsonParseException, JsonMappingException, IOException, ValidationException{
478                 this.requestJSON = inputStream("/v3DeleteNetwork.json");
479                 this.instanceIdMapTest.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
480                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
481                 this.msoRequest = new MsoRequest ("1234");
482                 msoRequest.parse(sir, instanceIdMapTest, Action.deleteInstance, "v3", originalRequestJSON);
483         }
484         @Test
485         public void testParseV3ServiceInstanceDelete() throws JsonParseException, JsonMappingException, IOException, ValidationException{
486                 String requestJSON2;
487                 this.requestJSON = inputStream("/v3DeleteServiceInstance.json");
488                 requestJSON2 = inputStream("/v3DeleteServiceInstanceALaCarte.json");
489                 this.instanceIdMapTest.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
490                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
491                 this.msoRequest = new MsoRequest ("1234");
492                 msoRequest.parse(sir, instanceIdMapTest, Action.deleteInstance, "v3", originalRequestJSON);
493                 boolean testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarte();
494                 assertFalse(testIsALaCarteSet);
495                 this.sir  = mapper.readValue(requestJSON2, ServiceInstancesRequest.class);
496                 this.msoRequest = new MsoRequest ("12345");
497                 msoRequest.parse(sir, instanceIdMapTest, Action.deleteInstance, "v3", originalRequestJSON);
498                 testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarte();
499                 assertTrue(testIsALaCarteSet);
500                 assertTrue(msoRequest.getALaCarteFlag());
501         }
502         @Test
503         public void testVfModuleV4UsePreLoad() throws JsonParseException, JsonMappingException, IOException, ValidationException {
504                 this.requestJSON = inputStream("/v4CreateVfModule.json");
505                 this.instanceIdMapTest.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
506                 this.instanceIdMapTest.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
507                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
508                 this.msoRequest = new MsoRequest ("1234");
509                 msoRequest.parse(sir, instanceIdMapTest, Action.createInstance, "v4", originalRequestJSON);
510                 
511                 this.requestJSON = inputStream("/v4CreateVfModuleNoCustomizationId.json");
512                 this.instanceIdMapTest.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
513                 this.instanceIdMapTest.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
514                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
515                 msoRequest = new MsoRequest ("1234");
516                 msoRequest.parse(sir, instanceIdMapTest, Action.createInstance, "v4", originalRequestJSON);
517         }
518         @Test
519         public void testV5PortMirrorCreateConfiguration() throws JsonParseException, JsonMappingException, IOException, ValidationException{
520                 this.requestJSON = inputStream("/v5PortMirrorCreateConfiguration.json");
521                 this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
522                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
523                 this.msoRequest = new MsoRequest ("1234");
524                 msoRequest.parse(sir, instanceIdMapTest, Action.createInstance, "v5", originalRequestJSON);
525         }
526         @Test
527         public void testV6PortMirrorCreateConfiguration() throws JsonParseException, JsonMappingException, IOException, ValidationException{
528                 this.requestJSON = inputStream("/v6PortMirrorCreateConfiguration.json");
529                 this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
530                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
531                 this.msoRequest = new MsoRequest ("1234");
532                 msoRequest.parse(sir, instanceIdMapTest, Action.createInstance, "v6", originalRequestJSON);
533         }
534         @Test
535         public void testV5EnablePortMirrorConfiguration() throws JsonParseException, JsonMappingException, IOException, ValidationException{
536                 this.requestJSON = inputStream("/v5EnablePortMirrorConfiguration.json");
537                 this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
538                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
539                 this.msoRequest = new MsoRequest ("1234");
540                 msoRequest.parse(sir, instanceIdMapTest, Action.enablePort, "v5", originalRequestJSON);
541         }
542         @Test
543         public void testV5DisablePortMirrorConfiguration() throws JsonParseException, JsonMappingException, IOException, ValidationException{
544                 this.requestJSON = inputStream("/v5EnablePortMirrorConfiguration.json");
545                 this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
546                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
547                 this.msoRequest = new MsoRequest ("1234");
548                 msoRequest.parse(sir, instanceIdMapTest, Action.disablePort, "v5", originalRequestJSON);
549         }
550         @Test
551         public void testV5ActivatePortMirrorConfiguration() throws JsonParseException, JsonMappingException, IOException, ValidationException{
552                 this.requestJSON = inputStream("/v5ActivatePortMirrorConfiguration.json");
553                 this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
554                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
555                 this.msoRequest = new MsoRequest ("1234");
556                 msoRequest.parse(sir, instanceIdMapTest, Action.activateInstance, "v5", originalRequestJSON);
557         }
558         @Test
559         public void testV5ActivatePortMirrorNoRelatedInstance() throws JsonParseException, JsonMappingException, IOException, ValidationException{
560                 this.requestJSON = inputStream("/v5ActivatePortMirrorNoRelatedInstance.json");
561                 this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
562                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
563                 this.msoRequest = new MsoRequest ("1234");
564                 msoRequest.parse(sir, instanceIdMapTest, Action.activateInstance, "v5", originalRequestJSON);
565         }
566         @Test
567         public void testV5DeactivatePortMirrorConfiguration() throws JsonParseException, JsonMappingException, IOException, ValidationException{
568                 this.requestJSON = inputStream("/v5DeactivatePortMirrorConfiguration.json");
569                 this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
570                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
571                 this.msoRequest = new MsoRequest ("1234");
572                 msoRequest.parse(sir, instanceIdMapTest, Action.deactivateInstance, "v5", originalRequestJSON);
573         }
574         @Test
575         public void testV5DeactivatePortMirrorNoRelatedInstance() throws JsonParseException, JsonMappingException, IOException, ValidationException{
576                 this.requestJSON = inputStream("/v5DeactivatePortMirrorNoRelatedInstance.json");
577                 this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
578                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
579                 this.msoRequest = new MsoRequest ("1234");
580                 msoRequest.parse(sir, instanceIdMapTest, Action.deactivateInstance, "v5", originalRequestJSON);
581         }
582         @Test
583         public void testV6AddRelationships() throws JsonParseException, JsonMappingException, IOException, ValidationException{
584                 this.requestJSON = inputStream("/v6AddRelationships.json");
585                 this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
586                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
587                 this.msoRequest = new MsoRequest ("V6AddRelationships");
588                 msoRequest.parse(sir, instanceIdMapTest, Action.addRelationships, "v6", originalRequestJSON);
589         }
590         @Test
591         public void testV6RemoveRelationships() throws JsonParseException, JsonMappingException, IOException, ValidationException{
592                 this.requestJSON = inputStream("/v6AddRelationships.json");
593                 this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
594                 this.sir  = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
595                 this.msoRequest = new MsoRequest ("V6RemoveRelationships");
596                 msoRequest.parse(sir, instanceIdMapTest, Action.removeRelationships, "v6", originalRequestJSON);
597                 assertNotNull(msoRequest.getRequestId());
598                 assertEquals(msoRequest.getReqVersion(), 6);
599         }
600 }