summaryrefslogtreecommitdiffstats
path: root/controlloop/common/simulators
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2018-08-27 15:32:14 -0400
committerJim Hahn <jrh3@att.com>2018-08-28 10:56:27 -0400
commitf43b3e32fdf4cdb3361c584491730af18ef46baf (patch)
treed3e6434d66c3e5e8d6371581d64039b79c6ad584 /controlloop/common/simulators
parent57ac9eac8ac0f8236ddb52e5226f475368d4de33 (diff)
use new SO API for scale-out
Updated licenses and serialization IDs. Moved hashCode() and equals() methods to be in same location as in the original code so it can be more easily compared. Changed vDNS yaml timeout and retry to 1200 and 0, respectively, to match the original values. Removed extra newline from yaml, to match original yaml. Reformatted source to wrap lines at 120 characters and removing trailing white space. Change-Id: I3f5e59a1f44750347de49164f587d4ffefdee8b4 Issue-ID: POLICY-962 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/simulators')
-rw-r--r--controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java27
-rw-r--r--controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java20
2 files changed, 21 insertions, 26 deletions
diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java
index 0d08aa216..35abf55b0 100644
--- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java
+++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,50 +21,47 @@
package org.onap.policy.simulators;
import java.util.UUID;
-
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-
import org.onap.policy.so.SORequest;
import org.onap.policy.so.SORequestReferences;
import org.onap.policy.so.SORequestStatus;
import org.onap.policy.so.SOResponse;
-
import com.att.aft.dme2.internal.gson.Gson;
-@Path("/serviceInstances")
+@Path("/serviceInstantiation")
public class SoSimulatorJaxRs {
-
- /**
+
+ /**
* SO post query.
- *
+ *
* @param serviceInstanceId the service instance Id
* @param vnfInstanceId the VNF Id
* @return the response
*/
@POST
- @Path("/v5/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules")
+ @Path("/v7/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/scaleOut")
@Consumes(MediaType.APPLICATION_JSON)
@Produces("application/json")
- public String soPostQuery(@PathParam("serviceInstanceId") final String serviceInstanceId, @PathParam("vnfInstanceId") final String vnfInstanceId)
- {
+ public String soPostQuery(@PathParam("serviceInstanceId") final String serviceInstanceId,
+ @PathParam("vnfInstanceId") final String vnfInstanceId) {
final SORequest request = new SORequest();
final SORequestStatus requestStatus = new SORequestStatus();
requestStatus.setRequestState("COMPLETE");
request.setRequestStatus(requestStatus);
request.setRequestId(UUID.randomUUID());
-
+
final SOResponse response = new SOResponse();
-
+
final SORequestReferences requestReferences = new SORequestReferences();
final String requestId = UUID.randomUUID().toString();
requestReferences.setRequestId(requestId);
response.setRequestReferences(requestReferences);
-
+
response.setRequest(request);
return new Gson().toJson(response);
diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java
index 837c52cd6..4e0654df1 100644
--- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java
+++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java
@@ -22,10 +22,8 @@ package org.onap.policy.simulators;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
-
import java.util.HashMap;
import java.util.UUID;
-
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -96,7 +94,7 @@ public class SoSimulatorTest {
// requestInfo
//
request.getRequestDetails().getRequestInfo()
- .setInstanceName("vDNS_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8");
+ .setInstanceName("vDNS_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8");
request.getRequestDetails().getRequestInfo().setSource("POLICY");
request.getRequestDetails().getRequestInfo().setSuppressRollback(false);
request.getRequestDetails().getRequestInfo().setRequestorId("policy");
@@ -112,9 +110,9 @@ public class SoSimulatorTest {
relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SOModelInfo());
relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("service");
relatedInstanceListElement1.getRelatedInstance().getModelInfo()
- .setModelInvariantId("4fcbc1c0-7793-46d8-8aa1-fa1c2ed9ec7b");
+ .setModelInvariantId("4fcbc1c0-7793-46d8-8aa1-fa1c2ed9ec7b");
relatedInstanceListElement1.getRelatedInstance().getModelInfo()
- .setModelVersionId("5c996219-b2e2-4c76-9b43-7e8672a33c1d");
+ .setModelVersionId("5c996219-b2e2-4c76-9b43-7e8672a33c1d");
relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelName("8330e932-2a23-4943-8606");
relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelVersion("1.0");
//
@@ -122,13 +120,13 @@ public class SoSimulatorTest {
relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SOModelInfo());
relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("vnf");
relatedInstanceListElement2.getRelatedInstance().getModelInfo()
- .setModelInvariantId("033a32ed-aa65-4764-a736-36f2942f1aa0");
+ .setModelInvariantId("033a32ed-aa65-4764-a736-36f2942f1aa0");
relatedInstanceListElement2.getRelatedInstance().getModelInfo()
- .setModelVersionId("d4d072dc-4e21-4a03-9524-628985819a8e");
+ .setModelVersionId("d4d072dc-4e21-4a03-9524-628985819a8e");
relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelName("c15ce9e1-e914-4c8f-b8bb");
relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelVersion("1");
relatedInstanceListElement2.getRelatedInstance().getModelInfo()
- .setModelCustomizationName("c15ce9e1-e914-4c8f-b8bb 1");
+ .setModelCustomizationName("c15ce9e1-e914-4c8f-b8bb 1");
//
request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement1);
request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement2);
@@ -139,9 +137,9 @@ public class SoSimulatorTest {
@Test
public void testResponse() {
final String request = Serialization.gsonPretty.toJson(this.createTestRequest());
- final Pair<Integer, String> httpDetails =
- new RESTManager().post("http://localhost:6667/serviceInstances/v5/12345/vnfs/12345/vfModules",
- "username", "password", new HashMap<>(), "application/json", request);
+ final Pair<Integer, String> httpDetails = new RESTManager().post(
+ "http://localhost:6667/serviceInstantiation/v7/12345/vnfs/12345/vfModules/scaleOut", "username",
+ "password", new HashMap<>(), "application/json", request);
assertNotNull(httpDetails);
final SOResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, SOResponse.class);
assertNotNull(response);