summaryrefslogtreecommitdiffstats
path: root/examples/examples-onap-vcpe/src/test
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-10-08 13:36:31 +0100
committerliamfallon <liam.fallon@est.tech>2019-03-27 22:35:12 +0000
commitf996ef829249c304550becb0cb57db3efd3baf6a (patch)
treeef2657cd8d44f80b02cfee8db0908a8f9ca7dbf1 /examples/examples-onap-vcpe/src/test
parentcfcffbce70ddc3083e337f18377c0847f7233caa (diff)
Change vCPE example to use POJOs
This review uses POJOs rather than Avro schema to unmarshal and marshal events from and to DMaaP. The POJO classes for interacting with DMaaP have been moved into a common policy module. This review is now ready for full review (finally!). Issue-ID: POLICY-954 Change-Id: Ibb89d8af5b9006821e6a0a756e16bbe3815af15a Signed-off-by: liamfallon <liam.fallon@ericsson.com> Signed-off-by: liamfallon <liam.fallon@est.tech> Signed-off-by: Liam Fallon <liam.fallon@est.tech> Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'examples/examples-onap-vcpe/src/test')
-rw-r--r--examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AaiAndGuardSimEndpointTest.java183
-rw-r--r--examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AppcResponseCreator.java94
-rw-r--r--examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/OnapVCpeSim.java (renamed from examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AaiAndGuardSim.java)13
-rw-r--r--examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/OnapVCpeSimEndpoint.java343
-rw-r--r--examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/OnapVcpeRunner.java68
-rw-r--r--examples/examples-onap-vcpe/src/test/resources/config/ApexConfigFileOnly.json88
-rw-r--r--examples/examples-onap-vcpe/src/test/resources/config/appc.lcm.success.json22
-rw-r--r--examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.abatement.json16
-rw-r--r--examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.onset.json15
-rw-r--r--examples/examples-onap-vcpe/src/test/resources/etc/Notes.txt31
-rw-r--r--examples/examples-onap-vcpe/src/test/resources/events/AAIQuery.json16
-rw-r--r--examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4Policy.json76
-rw-r--r--examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4VNF.json287
-rw-r--r--examples/examples-onap-vcpe/src/test/resources/events/AAIResponseExample.json206
-rw-r--r--examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartRequestEvent.json22
-rw-r--r--examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseNOKEvent.json22
-rw-r--r--examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKEvent.json22
-rw-r--r--examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKInitialEvent.json22
-rw-r--r--examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedAAIInfoEvent.json23
-rw-r--r--examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedNoAAIInfoEvent.json15
-rw-r--r--examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetAAIInfoEvent.json22
-rw-r--r--examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetNoAAIInfoEvent.json15
22 files changed, 543 insertions, 1078 deletions
diff --git a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AaiAndGuardSimEndpointTest.java b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AaiAndGuardSimEndpointTest.java
deleted file mode 100644
index 5b9040f95..000000000
--- a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AaiAndGuardSimEndpointTest.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.domains.onap.vcpe;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import com.google.gson.Gson;
-
-import java.util.Map;
-import java.util.Random;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Response;
-
-/**
- * The Class AaiAndGuardSimEndpoint.
- */
-@Path("/sim")
-public class AaiAndGuardSimEndpointTest {
-
- private static int postMessagesReceived = 0;
- private static int putMessagesReceived = 0;
- private static int statMessagesReceived = 0;
- private static int getMessagesReceived = 0;
-
- /**
- * Service get stats.
- *
- * @return the response
- */
- @Path("/pdp/api/Stats")
- @GET
- public Response serviceGetStats() {
- statMessagesReceived++;
- return Response.status(200).entity("{\"GET\": " + getMessagesReceived + ",\"STAT\": " + statMessagesReceived
- + ",\"POST\": " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build();
- }
-
- /**
- * Service guard post request.
- *
- * @param jsonString the json string
- * @return the response
- */
- @Path("/pdp/api/getDecision")
- @POST
- public Response serviceGuardPostRequest(final String jsonString) {
- postMessagesReceived++;
-
- if (postMessagesReceived % 2 == 0) {
- return Response.status(200).entity("{\"decision\": \"PERMIT\", \"details\": \"Decision Permit. OK!\"}")
- .build();
- } else {
- return Response.status(200).entity("{\"decision\": \"DENY\", \"details\": \"Decision Denied. NOK :-(\"}")
- .build();
- }
- }
-
- /**
- * Service get event.
- *
- * @return the response
- */
- @Path("/event/GetEvent")
- @GET
- public Response serviceGetEvent() {
- final Random rand = new Random();
- final int nextMatchCase = rand.nextInt(4);
- final String nextEventName = "Event0" + rand.nextInt(2) + "00";
-
- final String eventString = "{\n" + "\"nameSpace\": \"org.onap.policy.apex.sample.events\",\n" + "\"name\": \""
- + nextEventName + "\",\n" + "\"version\": \"0.0.1\",\n" + "\"source\": \"REST_" + getMessagesReceived
- + "\",\n" + "\"target\": \"apex\",\n" + "\"TestSlogan\": \"Test slogan for External Event0\",\n"
- + "\"TestMatchCase\": " + nextMatchCase + ",\n" + "\"TestTimestamp\": " + System.currentTimeMillis()
- + ",\n" + "\"TestTemperature\": 9080.866\n" + "}";
-
- getMessagesReceived++;
-
- return Response.status(200).entity(eventString).build();
- }
-
- /**
- * Service get empty event.
- *
- * @return the response
- */
- @Path("/event/GetEmptyEvent")
- @GET
- public Response serviceGetEmptyEvent() {
- return Response.status(200).build();
- }
-
- /**
- * Service get event bad response.
- *
- * @return the response
- */
- @Path("/event/GetEventBadResponse")
- @GET
- public Response serviceGetEventBadResponse() {
- return Response.status(400).build();
- }
-
- /**
- * Service post request.
- *
- * @param jsonString the json string
- * @return the response
- */
- @Path("/event/PostEvent")
- @POST
- public Response servicePostRequest(final String jsonString) {
- postMessagesReceived++;
-
- @SuppressWarnings("unchecked")
- final Map<String, Object> jsonMap = new Gson().fromJson(jsonString, Map.class);
- assertTrue(jsonMap.containsKey("name"));
- assertEquals("0.0.1", jsonMap.get("version"));
- assertEquals("org.onap.policy.apex.sample.events", jsonMap.get("nameSpace"));
- assertEquals("Act", jsonMap.get("source"));
- assertEquals("Outside", jsonMap.get("target"));
-
- return Response.status(200).entity("{\"GET\": , " + getMessagesReceived + ",\"STAT\": " + statMessagesReceived
- + ",\"POST\": , " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build();
- }
-
- /**
- * Service post request bad response.
- *
- * @param jsonString the json string
- * @return the response
- */
- @Path("/event/PostEventBadResponse")
- @POST
- public Response servicePostRequestBadResponse(final String jsonString) {
- return Response.status(400).build();
- }
-
- /**
- * Service put request.
- *
- * @param jsonString the json string
- * @return the response
- */
- @Path("/event/PutEvent")
- @PUT
- public Response servicePutRequest(final String jsonString) {
- putMessagesReceived++;
-
- @SuppressWarnings("unchecked")
- final Map<String, Object> jsonMap = new Gson().fromJson(jsonString, Map.class);
- assertTrue(jsonMap.containsKey("name"));
- assertEquals("0.0.1", jsonMap.get("version"));
- assertEquals("org.onap.policy.apex.sample.events", jsonMap.get("nameSpace"));
- assertEquals("Act", jsonMap.get("source"));
- assertEquals("Outside", jsonMap.get("target"));
-
- return Response.status(200).entity("{\"GET\": , " + getMessagesReceived + ",\"STAT\": " + statMessagesReceived
- + ",\"POST\": , " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build();
- }
-}
diff --git a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AppcResponseCreator.java b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AppcResponseCreator.java
new file mode 100644
index 000000000..f5f2b2792
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AppcResponseCreator.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.domains.onap.vcpe;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.BlockingQueue;
+
+import org.onap.policy.appclcm.LcmRequest;
+import org.onap.policy.appclcm.LcmRequestWrapper;
+import org.onap.policy.appclcm.LcmResponse;
+import org.onap.policy.appclcm.LcmResponseWrapper;
+import org.onap.policy.appclcm.util.Serialization;
+
+/**
+ * Respond to an APPC request with a given delay.
+ */
+public class AppcResponseCreator {
+ // The request from APPC
+ private final String jsonRequestString;
+
+ // The queue for APPC responses
+ private final BlockingQueue<String> appcResponseQueue;
+
+ // The timer task for response generation
+ private final Timer appcTimer;
+
+ /**
+ * Respond to the given APPC request after the given amount of milliseconds.
+ *
+ * @param appcResponseQueue the queue into which to put the APPC response
+ * @param jsonRequestString the request JSON string
+ * @param milliSecondsToWait the number of milliseconds to wait
+ */
+ public AppcResponseCreator(BlockingQueue<String> appcResponseQueue, String jsonRequestString,
+ long milliSecondsToWait) {
+ this.jsonRequestString = jsonRequestString;
+ this.appcResponseQueue = appcResponseQueue;
+
+ appcTimer = new Timer();
+ appcTimer.schedule(new AppcTimerTask(), milliSecondsToWait);
+ }
+
+ private class AppcTimerTask extends TimerTask {
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.util.TimerTask#run()
+ */
+ @Override
+ public void run() {
+ Gson gson = new GsonBuilder().registerTypeAdapter(LcmRequest.class, new Serialization.RequestAdapter())
+ .registerTypeAdapter(LcmResponse.class, new Serialization.ResponseAdapter())
+ .setPrettyPrinting().create();
+
+ LcmRequestWrapper requestWrapper = gson.fromJson(jsonRequestString, LcmRequestWrapper.class);
+
+ LcmResponse response = new LcmResponse(requestWrapper.getBody());
+ response.getStatus().setCode(400);
+ response.getStatus().setMessage("Restart Successful");
+
+ LcmResponseWrapper responseWrapper = new LcmResponseWrapper();
+ responseWrapper.setBody(response);
+
+ responseWrapper.setVersion(requestWrapper.getVersion());
+ responseWrapper.setRpcName(requestWrapper.getRpcName());
+ responseWrapper.setCorrelationId(requestWrapper.getCorrelationId());
+ responseWrapper.setType(requestWrapper.getType());
+
+ appcResponseQueue.add(gson.toJson(responseWrapper, LcmResponseWrapper.class));
+ }
+ }
+}
diff --git a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AaiAndGuardSim.java b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/OnapVCpeSim.java
index 93b587a41..671f333d9 100644
--- a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AaiAndGuardSim.java
+++ b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/OnapVCpeSim.java
@@ -30,17 +30,18 @@ import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
/**
* The Class AaiAndGuardSim.
*/
-public class AaiAndGuardSim {
- private static final String BASE_URI = "http://localhost:54321/AAIAndGuardSim";
+public class OnapVCpeSim {
private static final int MAX_LOOPS = 100000;
private HttpServer server;
/**
* Instantiates a new aai and guard sim.
*/
- public AaiAndGuardSim() {
- final ResourceConfig rc = new ResourceConfig(AaiAndGuardSimEndpointTest.class);
- server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc);
+ public OnapVCpeSim(final String[] args) {
+ final String baseUri = "http://" + args[0] + ':' + args[1] + "/OnapVCpeSim";
+
+ final ResourceConfig rc = new ResourceConfig(OnapVCpeSimEndpoint.class);
+ server = GrizzlyHttpServerFactory.createHttpServer(URI.create(baseUri), rc);
while (!server.isStarted()) {
ThreadUtilities.sleep(50);
@@ -63,7 +64,7 @@ public class AaiAndGuardSim {
* @throws Exception the exception
*/
public static void main(final String[] args) throws Exception {
- final AaiAndGuardSim sim = new AaiAndGuardSim();
+ final OnapVCpeSim sim = new OnapVCpeSim(args);
for (int index = 0; index < MAX_LOOPS; index++) {
ThreadUtilities.sleep(100);
diff --git a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/OnapVCpeSimEndpoint.java b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/OnapVCpeSimEndpoint.java
new file mode 100644
index 000000000..936c319a9
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/OnapVCpeSimEndpoint.java
@@ -0,0 +1,343 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.domains.onap.vcpe;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Response;
+
+import org.onap.policy.aai.AaiNqGenericVnf;
+import org.onap.policy.aai.AaiNqInventoryResponseItem;
+import org.onap.policy.aai.AaiNqRequest;
+import org.onap.policy.aai.AaiNqResponse;
+import org.onap.policy.aai.AaiNqVfModule;
+import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class AaiAndGuardSimEndpoint.
+ */
+@Path("/sim")
+public class OnapVCpeSimEndpoint {
+ private static final XLogger LOGGER = XLoggerFactory.getXLogger(OnapVCpeSimEndpoint.class);
+
+ private static BlockingQueue<String> appcResponseQueue = new LinkedBlockingQueue<>();
+
+ private static AtomicInteger guardMessagesReceived = new AtomicInteger();
+ private static AtomicInteger postMessagesReceived = new AtomicInteger();
+ private static AtomicInteger putMessagesReceived = new AtomicInteger();
+ private static AtomicInteger statMessagesReceived = new AtomicInteger();
+ private static AtomicInteger getMessagesReceived = new AtomicInteger();
+
+ /**
+ * Service get stats.
+ *
+ * @return the response
+ */
+ @Path("/pdp/api/Stats")
+ @GET
+ public Response serviceGetStats() {
+ statMessagesReceived.incrementAndGet();
+
+ return Response.status(200).entity("{\"GET\": " + getMessagesReceived + ",\"STAT\": " + statMessagesReceived
+ + ",\"POST\": " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build();
+ }
+
+ /**
+ * Service guard post request.
+ *
+ * @param jsonString the json string
+ * @return the response
+ */
+ @Path("/pdp/api/getDecision")
+ @POST
+ public Response serviceGuardPostRequest(final String jsonString) {
+ LOGGER.info("\n*** GUARD REQUEST START ***\n" + jsonString + "\n *** GUARD REQUEST END ***");
+
+ String target = jsonString.substring(jsonString.indexOf("b4fe00ac"));
+ target = target.substring(0, target.indexOf('"'));
+
+ int thisGuardMessageNumber = guardMessagesReceived.incrementAndGet();
+ postMessagesReceived.incrementAndGet();
+
+ String responseJsonString = null;
+ if (thisGuardMessageNumber % 2 == 0) {
+ responseJsonString = "{\"decision\": \"PERMIT\", \"details\": \"Decision Permit. OK!\"}";
+ } else {
+ responseJsonString = "{\"decision\": \"DENY\", \"details\": \"Decision Denied. NOK :-(\"}";
+ }
+
+ LOGGER.info("\n*** GUARD RESPONSE START ***\n" + target + "\n" + responseJsonString
+ + "\n*** GUARD RESPONSE END ***");
+
+ return Response.status(200).entity(responseJsonString).build();
+ }
+
+ /**
+ * AAI named query request.
+ *
+ * @param jsonString the json string
+ * @return the response
+ */
+ @Path("aai/search/named-query")
+ @POST
+ public Response aaiNamedQueryRequest(final String jsonString) {
+ postMessagesReceived.incrementAndGet();
+
+ LOGGER.info("\n*** AAI REQUEST START ***\n" + jsonString + "\n *** AAI REQUEST END ***");
+
+ AaiNqRequest request = new Gson().fromJson(jsonString, AaiNqRequest.class);
+ String vnfId = request.getInstanceFilters().getInstanceFilter().iterator().next().get("generic-vnf")
+ .get("vnf-id");
+ String vnfSuffix = vnfId.substring(vnfId.length() - 4);
+
+ AaiNqInventoryResponseItem responseItem = new AaiNqInventoryResponseItem();
+ responseItem.setModelName("vCPE");
+
+ AaiNqGenericVnf genericVnf = new AaiNqGenericVnf();
+ genericVnf.setResourceVersion("1");
+ genericVnf.setVnfName("vCPEInfraVNF" + vnfSuffix);
+ genericVnf.setProvStatus("PREPROV");
+ genericVnf.setIsClosedLoopDisabled(false);
+ genericVnf.setVnfType("vCPEInfraService10/vCPEInfraService10 0");
+ genericVnf.setInMaint(false);
+ genericVnf.setServiceId("5585fd2c-ad0d-4050-b0cf-dfe4a03bd01f");
+ genericVnf.setVnfId(vnfId);
+
+ responseItem.setGenericVnf(genericVnf);
+
+ AaiNqVfModule vfModule = new AaiNqVfModule();
+ vfModule.setOrchestrationStatus("Created");
+
+ responseItem.setVfModule(vfModule);
+
+ AaiNqResponse response = new AaiNqResponse();
+ response.getInventoryResponseItems().add(responseItem);
+
+ String responseJsonString = new GsonBuilder().setPrettyPrinting().create().toJson(response);
+
+ LOGGER.info("\n*** AAI RESPONSE START ***\n" + responseJsonString + "\n *** AAI RESPONSE END ***");
+
+ return Response.status(200).entity(responseJsonString).build();
+ }
+
+ /**
+ * DCAE input of events (simulation of DMaaP).
+ *
+ * @param timeout the timeout to wait for
+ * @return the response
+ */
+ @Path("events/unauthenticated.DCAE_CL_OUTPUT/APEX/1")
+ @GET
+ public Response dcaeClOutput(@QueryParam("timeout") final int timeout) {
+ getMessagesReceived.incrementAndGet();
+
+ ThreadUtilities.sleep(timeout - 500);
+
+ return Response.status(200).build();
+ }
+
+ /**
+ * APPC response events (simulation of DMaaP).
+ *
+ * @param timeout the timeout to wait for
+ * @return the response
+ * @throws InterruptedException on queue interrupts
+ */
+ @Path("events/APPC_LCM_WRITE/APEX/1")
+ @GET
+ public Response appcResponseOutput(@QueryParam("timeout") final int timeout) throws InterruptedException {
+ getMessagesReceived.incrementAndGet();
+
+ int timeLeft = timeout - 500;
+
+ do {
+ String appcResponse = appcResponseQueue.poll(100, TimeUnit.MILLISECONDS);
+
+ if (appcResponse != null) {
+ LOGGER.info("\n*** APPC RESPONSE START ***");
+ System.err.println(appcResponse);
+ LOGGER.info("\n*** APPC RESPONSE END ***");
+
+ return Response.status(200).entity(appcResponse).build();
+ }
+ timeLeft -= 100;
+ }
+ while (timeLeft > 0);
+
+ return Response.status(200).build();
+ }
+
+ /**
+ * Post to Policy management log (Simulation of DMaaP).
+ *
+ * @param jsonString the json string
+ * @return the response
+ */
+ @Path("/events/POLICY_CL_MGT")
+ @POST
+ public Response policyLogRequest(final String jsonString) {
+ postMessagesReceived.incrementAndGet();
+
+ LOGGER.info("\n*** POLICY LOG ENTRY START ***\n" + jsonString + "\n *** POLICY LOG ENTRY END ***");
+
+ return Response.status(200).build();
+ }
+
+ /**
+ * Post to APPC LCM (Simulation of DMaaP).
+ *
+ * @param jsonString the json string
+ * @return the response
+ */
+ @Path("/events/APPC-LCM-READ")
+ @POST
+ public Response appcRequest(final String jsonString) {
+ postMessagesReceived.incrementAndGet();
+
+ LOGGER.info("\n*** APPC REQUEST START ***\n" + jsonString + "\n *** APPC REQUEST END ***");
+
+ new AppcResponseCreator(appcResponseQueue, jsonString, 10000);
+
+ return Response.status(200).build();
+ }
+
+ /**
+ * Service get event.
+ *
+ * @return the response
+ */
+ @Path("/event/GetEvent")
+ @GET
+ public Response serviceGetEvent() {
+ final Random rand = new Random();
+ final int nextMatchCase = rand.nextInt(4);
+ final String nextEventName = "Event0" + rand.nextInt(2) + "00";
+
+ final String eventString = "{\n" + "\"nameSpace\": \"org.onap.policy.apex.sample.events\",\n" + "\"name\": \""
+ + nextEventName + "\",\n" + "\"version\": \"0.0.1\",\n" + "\"source\": \"REST_"
+ + getMessagesReceived + "\",\n" + "\"target\": \"apex\",\n"
+ + "\"TestSlogan\": \"Test slogan for External Event0\",\n" + "\"TestMatchCase\": "
+ + nextMatchCase + ",\n" + "\"TestTimestamp\": " + System.currentTimeMillis() + ",\n"
+ + "\"TestTemperature\": 9080.866\n" + "}";
+
+ getMessagesReceived.incrementAndGet();
+
+ return Response.status(200).entity(eventString).build();
+ }
+
+ /**
+ * Service get empty event.
+ *
+ * @return the response
+ */
+ @Path("/event/GetEmptyEvent")
+ @GET
+ public Response serviceGetEmptyEvent() {
+ return Response.status(200).build();
+ }
+
+ /**
+ * Service get event bad response.
+ *
+ * @return the response
+ */
+ @Path("/event/GetEventBadResponse")
+ @GET
+ public Response serviceGetEventBadResponse() {
+ return Response.status(400).build();
+ }
+
+ /**
+ * Service post request.
+ *
+ * @param jsonString the json string
+ * @return the response
+ */
+ @Path("/event/PostEvent")
+ @POST
+ public Response servicePostRequest(final String jsonString) {
+ postMessagesReceived.incrementAndGet();
+
+ @SuppressWarnings("unchecked")
+ final Map<String, Object> jsonMap = new Gson().fromJson(jsonString, Map.class);
+ assertTrue(jsonMap.containsKey("name"));
+ assertEquals("0.0.1", jsonMap.get("version"));
+ assertEquals("org.onap.policy.apex.sample.events", jsonMap.get("nameSpace"));
+ assertEquals("Act", jsonMap.get("source"));
+ assertEquals("Outside", jsonMap.get("target"));
+
+ return Response.status(200).entity("{\"GET\": , " + getMessagesReceived + ",\"STAT\": " + statMessagesReceived
+ + ",\"POST\": , " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build();
+ }
+
+ /**
+ * Service post request bad response.
+ *
+ * @param jsonString the json string
+ * @return the response
+ */
+ @Path("/event/PostEventBadResponse")
+ @POST
+ public Response servicePostRequestBadResponse(final String jsonString) {
+ return Response.status(400).build();
+ }
+
+ /**
+ * Service put request.
+ *
+ * @param jsonString the json string
+ * @return the response
+ */
+ @Path("/event/PutEvent")
+ @PUT
+ public Response servicePutRequest(final String jsonString) {
+ putMessagesReceived.incrementAndGet();
+
+ @SuppressWarnings("unchecked")
+ final Map<String, Object> jsonMap = new Gson().fromJson(jsonString, Map.class);
+ assertTrue(jsonMap.containsKey("name"));
+ assertEquals("0.0.1", jsonMap.get("version"));
+ assertEquals("org.onap.policy.apex.sample.events", jsonMap.get("nameSpace"));
+ assertEquals("Act", jsonMap.get("source"));
+ assertEquals("Outside", jsonMap.get("target"));
+
+ return Response.status(200).entity("{\"GET\": , " + getMessagesReceived + ",\"STAT\": " + statMessagesReceived
+ + ",\"POST\": , " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build();
+ }
+}
diff --git a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/OnapVcpeRunner.java b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/OnapVcpeRunner.java
new file mode 100644
index 000000000..4f6b6101c
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/OnapVcpeRunner.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.domains.onap.vcpe;
+
+import org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain;
+import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.service.engine.main.ApexMain;
+
+/**
+ * Test the ONAP vCPE use case.
+ */
+public class OnapVcpeRunner {
+
+ private OnapVcpeRunner() throws ApexException {
+
+ // @formatter:off
+ final String[] cliArgs = new String[] {
+ "-c",
+ "src/main/resources/policy/ONAPvCPEPolicyModel.apex",
+ "-l",
+ "target/ONAPvCPEPolicyModel.log",
+ "-o",
+ "target/classes/ONAPvCPEPolicyModel.json"
+ };
+ // @formatter:on
+
+ new ApexCommandLineEditorMain(cliArgs);
+
+ // @formatter:off
+ final String[] apexArgs = {
+ "-rfr",
+ "target/classes",
+ "-c",
+ "src/main/resources/examples/config/ONAPvCPE/ApexConfig_Sim.json",
+ "-m",
+ "target/classes/ONAPvCPEPolicyModel.json"
+ };
+ // @formatter:on
+
+ final ApexMain apexMain = new ApexMain(apexArgs);
+
+ ThreadUtilities.sleep(1000000);
+ apexMain.shutdown();
+ }
+
+ public static void main(String[] args) throws ApexException {
+ new OnapVcpeRunner();
+ }
+}
diff --git a/examples/examples-onap-vcpe/src/test/resources/config/ApexConfigFileOnly.json b/examples/examples-onap-vcpe/src/test/resources/config/ApexConfigFileOnly.json
deleted file mode 100644
index ae365c39b..000000000
--- a/examples/examples-onap-vcpe/src/test/resources/config/ApexConfigFileOnly.json
+++ /dev/null
@@ -1,88 +0,0 @@
-{
- "engineServiceParameters": {
- "name": "MyApexEngine",
- "version": "0.0.1",
- "id": 45,
- "instanceCount": 4,
- "deploymentPort": 12561,
- "policyModelFileName": "policy/ONAPvCPEPolicyModel.json",
- "engineParameters": {
- "executorParameters": {
- "JAVASCRIPT": {
- "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
- }
- },
- "contextParameters": {
- "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters",
- "schemaParameters": {
- "Avro": {
- "parameterClassName": "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters"
- }
- }
- }
- }
- },
- "eventInputParameters": {
- "VCPEInitConsumer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "FILE",
- "parameters": {
- "fileName": "src/main/resources/config/VCPEInitiationEvents.txt"
- }
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON",
- "parameters": {
- "nameAlias": "closedLoopControlName",
- "versionAlias": "version",
- "sourceAlias": "from"
- }
- }
- },
- "GuardRequestorConsumer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "RESTREQUESTOR",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters",
- "parameters": {
- "url": "http://localhost:54321/AAIAndGuardSim/sim/pdp/api/getDecision",
- "httpMethod": "POST",
- "restRequestTimeout": 2000
- }
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventName": "GuardResponseEvent",
- "eventNameFilter": "GuardResponseEvent",
- "requestorMode": true,
- "requestorPeer": "GuardRequestorProducer",
- "requestorTimeout": 500
- }
- },
- "eventOutputParameters": {
- "GuardRequestorProducer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "RESTREQUESTOR",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters"
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventNameFilter": "GuardRequestEvent",
- "requestorMode": true,
- "requestorPeer": "GuardRequestorConsumer",
- "requestorTimeout": 500
- },
- "logProducer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "FILE",
- "parameters": {
- "fileName": "/tmp/VCPEEventsOut.json"
- }
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- }
- }
- }
-}
diff --git a/examples/examples-onap-vcpe/src/test/resources/config/appc.lcm.success.json b/examples/examples-onap-vcpe/src/test/resources/config/appc.lcm.success.json
deleted file mode 100644
index 2d2005d98..000000000
--- a/examples/examples-onap-vcpe/src/test/resources/config/appc.lcm.success.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "body": {
- "output": {
- "common-header": {
- "timestamp": "2017-08-25T21:06:23.037Z",
- "api-ver": "5.00",
- "originator-id": "664be3d2-6c12-4f4b-a3e7-c349acced200",
- "request-id": "664be3d2-6c12-4f4b-a3e7-c349acced200",
- "sub-request-id": "1",
- "flags": {}
- },
- "status": {
- "code": 400,
- "message": "Restart Successful"
- }
- }
- },
- "version": "2.0",
- "rpc-name": "restart",
- "correlation-id": "664be3d2-6c12-4f4b-a3e7-c349acced200-1",
- "type": "response"
-} \ No newline at end of file
diff --git a/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.abatement.json b/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.abatement.json
deleted file mode 100644
index 729451191..000000000
--- a/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.abatement.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "closedLoopControlName": "${closedLoopControlName}",
- "closedLoopAlarmStart": 1463679805324,
- "closedLoopAlarmEnd": 1463699805324,
- "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca",
- "closedLoopEventStatus": "ABATED",
- "requestID": "664be3d2-6c12-4f4b-a3e7-c349acced200",
- "target_type": "VNF",
- "target": "generic-vnf.vnf-id",
- "AAI": {
- "vserver.is-closed-loop-disabled": "false",
- "generic-vnf.vnf-id": "vCPE_Infrastructure_vGMUX_demo_app"
- },
- "from": "DCAE",
- "version": "1.0.2"
-}
diff --git a/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.onset.json b/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.onset.json
deleted file mode 100644
index feb15c153..000000000
--- a/examples/examples-onap-vcpe/src/test/resources/config/dcae.vcpe.onset.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "closedLoopControlName": "${closedLoopControlName}",
- "closedLoopAlarmStart": 1463679805324,
- "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca",
- "closedLoopEventStatus": "ONSET",
- "requestID": "664be3d2-6c12-4f4b-a3e7-c349acced200",
- "target_type": "VNF",
- "target": "generic-vnf.vnf-id",
- "AAI": {
- "vserver.is-closed-loop-disabled": "false",
- "generic-vnf.vnf-id": "vCPE_Infrastructure_vGMUX_demo_app"
- },
- "from": "DCAE",
- "version": "1.0.2"
-}
diff --git a/examples/examples-onap-vcpe/src/test/resources/etc/Notes.txt b/examples/examples-onap-vcpe/src/test/resources/etc/Notes.txt
new file mode 100644
index 000000000..5db41a2a0
--- /dev/null
+++ b/examples/examples-onap-vcpe/src/test/resources/etc/Notes.txt
@@ -0,0 +1,31 @@
+Check out Draft Review
+
+Build the source
+mvn clean install
+
+Build the docker image for the demo
+cd packages/apex-pdp-docker/src/main/
+cp ../../../apex-pdp-package-full/target/apex-pdp-package-full-2.0.0-SNAPSHOT-tarball.tar.gz docker/apex-pdp-package-full.tar.gz
+docker build -t apex-onap-vcpe docker
+
+Run the Docker container
+docker run -it --rm -p 12561:12561 apex-onap-vcpe
+
+Find the address of the host containter
+ip route list
+
+Update the configuration file REST URLs with the IP address of the source container
+vi examples/config/ONAPvCPE/ApexConfig.json
+examples/config/ONAPvCPE/ApexConfigStdin.json
+
+Run simulator from command line on host machine using Maven, replacing xxx.xxx.xxx.xxx with the IP address of the local host
+mvn exec:java -Dexec.classpathScope="test" -Dexec.mainClass=org.onap.policy.apex.domains.onap.vcpe.OnapVCpeSim -Dexec.args="xxx.xxx.xxx.xxx 54321"
+
+Run the engine in Docker, running the full example
+/opt/app/policy/apex-pdp/bin/apexApps.sh engine -c examples/config/ONAPvCPE/ApexConfig.json
+
+Run the engine in Docker, running with pasting into console using standard input
+/opt/app/policy/apex-pdp/bin/apexApps.sh engine -c examples/config/ONAPvCPE/ApexConfigStdin.json
+
+On an extraction of the Apex tarball, run the Apex client
+bin/apexApps.sh full-client
diff --git a/examples/examples-onap-vcpe/src/test/resources/events/AAIQuery.json b/examples/examples-onap-vcpe/src/test/resources/events/AAIQuery.json
deleted file mode 100644
index 46b5dbe73..000000000
--- a/examples/examples-onap-vcpe/src/test/resources/events/AAIQuery.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "query-parameters": {
- "named-query": {
- "named-query-uuid": "a93ac487-409c-4e8c-9e5f-334ae8f99087"
- }
- },
- "instance-filters": {
- "instance-filter": [
- {
- "generic-vnf": {
- "vnf-id": "de7cc3ab-0212-47df-9e64-da1c79234deb"
- }
- }
- ]
- }
-} \ No newline at end of file
diff --git a/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4Policy.json b/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4Policy.json
deleted file mode 100644
index 5bcff1b4b..000000000
--- a/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4Policy.json
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "inventory-response-item": [
- {
- "model-name": "service-instance",
- "generic-vnf": {
- "vnf-id": "de7cc3ab-0212-47df-9e64-da1c79234deb",
- "vnf-name": "ZRDM2MMEX39",
- "vnf-type": "vMME Svc Jul 14/vMME VF Jul 14 1",
- "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
- "orchestration-status": "active",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1503082370097",
- "model-invariant-id": "82194af1-3c2c-485a-8f44-420e22a9eaa4",
- "model-version-id": "46b92144-923a-4d20-b85a-3cbd847668a9"
- },
- "extra-properties": {
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "model-name": "service-instance",
- "service-instance": {
- "service-instance-id": "37b8cdb7-94eb-468f-a0c2-4e3c3546578e",
- "service-instance-name": "Changed Service Instance NAME",
- "model-invariant-id": "82194af1-3c2c-485a-8f44-420e22a9eaa4",
- "model-version-id": "46b92144-923a-4d20-b85a-3cbd847668a9",
- "resource-version": "1503082993532",
- "orchestration-status": "Active"
- },
- "extra-properties": {
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "model-name": "pnf",
- "generic-vnf": {
- "vnf-id": "jimmy-test",
- "vnf-name": "jimmy-test-vnf",
- "vnf-type": "vMME Svc Jul 14/vMME VF Jul 14 1",
- "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
- "orchestration-status": "active",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1504013830207",
- "model-invariant-id": "862b25a1-262a-4961-bdaa-cdc55d69785a",
- "model-version-id": "e9f1fa7d-c839-418a-9601-03dc0d2ad687"
- },
- "extra-properties": {
- }
- },
- {
- "model-name": "service-instance",
- "generic-vnf": {
- "vnf-id": "jimmy-test-vnf2",
- "vnf-name": "jimmy-test-vnf2-named",
- "vnf-type": "vMME Svc Jul 14/vMME VF Jul 14 1",
- "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
- "orchestration-status": "active",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1504014833841",
- "model-invariant-id": "82194af1-3c2c-485a-8f44-420e22a9eaa4",
- "model-version-id": "46b92144-923a-4d20-b85a-3cbd847668a9"
- },
- "extra-properties": {
- }
- }
- ]
- }
- }
- ]
- }
- }
- ]
-} \ No newline at end of file
diff --git a/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4VNF.json b/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4VNF.json
deleted file mode 100644
index 3e8391eaa..000000000
--- a/examples/examples-onap-vcpe/src/test/resources/events/AAIResponse4VNF.json
+++ /dev/null
@@ -1,287 +0,0 @@
-{
- "inventory-response-item": [
- {
- "model-name": "vFW",
- "generic-vnf": {
- "vnf-id": "vFirewall_demo_app",
- "vnf-name": "vFirewall_demo_app",
- "vnf-type": "vFW",
- "service-id": "vFirewall_demo_app",
- "orchestration-status": "running",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1509456799110",
- "model-invariant-id": "vFirewall",
- "model-version-id": "vFW"
- },
- "extra-properties": {
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "vserver": {
- "vserver-id": "5b06cf36-40a0-4bcb-bde9-849aa4702d67",
- "vserver-name": "vFW",
- "vserver-name2": "vFW",
- "prov-status": "Running",
- "vserver-selflink": "http://10.12.25.2:8774/v2.1/466979b815b5415ba14ada713e6e1846/servers/5b06cf36-40a0-4bcb-bde9-849aa4702d67",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1509047869791"
- },
- "extra-properties": {
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "vnfc": {
- "vnfc-name": "VNFC_vGMUX_demo_app2",
- "nfc-naming-code": "vGMUXCODE2",
- "nfc-function": "vGMUX",
- "prov-status": "Running",
- "orchestration-status": "Error",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1509407048855"
- },
- "extra-properties": {
- }
- },
- {
- "tenant": {
- "tenant-id": "466979b815b5415ba14ada713e6e1846",
- "tenant-name": "Integration",
- "resource-version": "1508920100541"
- },
- "extra-properties": {
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "cloud-region": {
- "cloud-owner": "pod25",
- "cloud-region-id": "RegionOne",
- "identity-url": "http://10.12.25.2:5000/v3",
- "sriov-automation": false,
- "resource-version": "1509048416263"
- },
- "extra-properties": {
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "esr-system-info": {
- "esr-system-info-id": "432ac032-e996-41f2-84ed-9c7a1766eb29",
- "system-name": "example-system-name-val-29070",
- "type": "example-type-val-85254",
- "vendor": "example-vendor-val-94515",
- "version": "example-version-val-71880",
- "service-url": "http://10.12.25.2:5000/v3",
- "user-name": "demo",
- "password": "onapdemo",
- "system-type": "VIM",
- "ssl-cacert": "example-ssl-cacert-val-75021",
- "ssl-insecure": true,
- "ip-address": "example-ip-address-val-44431",
- "port": "example-port-val-93234",
- "cloud-domain": "Default",
- "default-tenant": "Integration",
- "resource-version": "1508920101033"
- },
- "extra-properties": {
- }
- }
- ]
- }
- }
- ]
- }
- }
- ]
- }
- },
- {
- "vserver": {
- "vserver-id": "0c52905c-f682-42cf-bd52-e7f8953e80e3",
- "vserver-name": "vFW",
- "vserver-name2": "vFW",
- "prov-status": "Running",
- "vserver-selflink": "http://10.12.25.2:8774/v2.1/466979b815b5415ba14ada713e6e1846/servers/0c52905c-f682-42cf-bd52-e7f8953e80e3",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1509047548567"
- },
- "extra-properties": {
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "vnfc": {
- "vnfc-name": "VNFC_vGMUX_demo_app3",
- "nfc-naming-code": "vGMUXCODE3",
- "nfc-function": "vGMUX",
- "prov-status": "Running",
- "orchestration-status": "Running",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1509041912808"
- },
- "extra-properties": {
- }
- },
- {
- "tenant": {
- "tenant-id": "466979b815b5415ba14ada713e6e1846",
- "tenant-name": "Integration",
- "resource-version": "1508920100541"
- },
- "extra-properties": {
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "cloud-region": {
- "cloud-owner": "pod25",
- "cloud-region-id": "RegionOne",
- "identity-url": "http://10.12.25.2:5000/v3",
- "sriov-automation": false,
- "resource-version": "1509048416263"
- },
- "extra-properties": {
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "esr-system-info": {
- "esr-system-info-id": "432ac032-e996-41f2-84ed-9c7a1766eb29",
- "system-name": "example-system-name-val-29070",
- "type": "example-type-val-85254",
- "vendor": "example-vendor-val-94515",
- "version": "example-version-val-71880",
- "service-url": "http://10.12.25.2:5000/v3",
- "user-name": "demo",
- "password": "onapdemo",
- "system-type": "VIM",
- "ssl-cacert": "example-ssl-cacert-val-75021",
- "ssl-insecure": true,
- "ip-address": "example-ip-address-val-44431",
- "port": "example-port-val-93234",
- "cloud-domain": "Default",
- "default-tenant": "Integration",
- "resource-version": "1508920101033"
- },
- "extra-properties": {
- }
- }
- ]
- }
- }
- ]
- }
- }
- ]
- }
- },
- {
- "vserver": {
- "vserver-id": "33e16e02-098a-4f4e-a37f-b4e0307596c0",
- "vserver-name": "vFW",
- "vserver-name2": "vFW",
- "prov-status": "Running",
- "vserver-selflink": "http://10.12.25.2:8774/v2.1/466979b815b5415ba14ada713e6e1846/servers/33e16e02-098a-4f4e-a37f-b4e0307596c0",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1509047285114"
- },
- "extra-properties": {
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "vnfc": {
- "vnfc-name": "vnfc-related-to-vserver-example",
- "nfc-naming-code": "example-nfc-naming-code-val-78172",
- "nfc-function": "example-nfc-function-val-56352",
- "prov-status": "example-prov-status-val-10699",
- "orchestration-status": "example-orchestration-status-val-68896",
- "ipaddress-v4-oam-vip": "example-ipaddress-v4-oam-vip-val-71483",
- "in-maint": true,
- "is-closed-loop-disabled": true,
- "group-notation": "example-group-notation-val-31912",
- "resource-version": "1508800709772"
- },
- "extra-properties": {
- }
- },
- {
- "vnfc": {
- "vnfc-name": "VNFC_vGMUX_demo_app",
- "nfc-naming-code": "vGMUXCODE",
- "nfc-function": "vGMUX",
- "prov-status": "Running",
- "orchestration-status": "Running",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1509041573965"
- },
- "extra-properties": {
- }
- },
- {
- "tenant": {
- "tenant-id": "466979b815b5415ba14ada713e6e1846",
- "tenant-name": "Integration",
- "resource-version": "1508920100541"
- },
- "extra-properties": {
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "cloud-region": {
- "cloud-owner": "pod25",
- "cloud-region-id": "RegionOne",
- "identity-url": "http://10.12.25.2:5000/v3",
- "sriov-automation": false,
- "resource-version": "1509048416263"
- },
- "extra-properties": {
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "esr-system-info": {
- "esr-system-info-id": "432ac032-e996-41f2-84ed-9c7a1766eb29",
- "system-name": "example-system-name-val-29070",
- "type": "example-type-val-85254",
- "vendor": "example-vendor-val-94515",
- "version": "example-version-val-71880",
- "service-url": "http://10.12.25.2:5000/v3",
- "user-name": "demo",
- "password": "onapdemo",
- "system-type": "VIM",
- "ssl-cacert": "example-ssl-cacert-val-75021",
- "ssl-insecure": true,
- "ip-address": "example-ip-address-val-44431",
- "port": "example-port-val-93234",
- "cloud-domain": "Default",
- "default-tenant": "Integration",
- "resource-version": "1508920101033"
- },
- "extra-properties": {
- }
- }
- ]
- }
- }
- ]
- }
- }
- ]
- }
- }
- ]
- }
- }
- ]
-} \ No newline at end of file
diff --git a/examples/examples-onap-vcpe/src/test/resources/events/AAIResponseExample.json b/examples/examples-onap-vcpe/src/test/resources/events/AAIResponseExample.json
deleted file mode 100644
index 1d3f64c78..000000000
--- a/examples/examples-onap-vcpe/src/test/resources/events/AAIResponseExample.json
+++ /dev/null
@@ -1,206 +0,0 @@
-{
- "inventory-response-item": [
- {
- "vserver": {
- "vserver-id": "6ed3642c-f7a1-4a7c-9290-3d51fe1531eb",
- "vserver-name": "zdfw1lb01lb02",
- "vserver-name2": "zdfw1lb01lb02",
- "prov-status": "ACTIVE",
- "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/6ed3642c-f7a1-4a7c-9290-3d51fe1531eb",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1510606403522"
- },
- "extra-properties": {
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "model-name": "vLoadBalancer",
- "generic-vnf": {
- "vnf-id": "db373a8d-f7be-4d02-8ac8-6ca4c305d144",
- "vnf-name": "Vfmodule_vLB1113",
- "vnf-type": "vLoadBalancer-1106/vLoadBalancer 0",
- "service-id": "66f157fc-4148-4880-95f5-e120677e98d1",
- "prov-status": "PREPROV",
- "orchestration-status": "Created",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1510604011851",
- "model-invariant-id": "cee050ed-92a5-494f-ab04-234307a846dc",
- "model-version-id": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2",
- "model-customization-id": "1983c783-444f-4e79-af3a-85e5d49628f3",
- "nf-type": "",
- "nf-function": "",
- "nf-role": "",
- "nf-naming-code": ""
- },
- "extra-properties": {
- "extra-property": [
- {
- "property-name": "model-ver.model-version-id",
- "property-value": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2"
- },
- {
- "property-name": "model-ver.model-name",
- "property-value": "vLoadBalancer"
- },
- {
- "property-name": "model.model-type",
- "property-value": "resource"
- },
- {
- "property-name": "model.model-invariant-id",
- "property-value": "cee050ed-92a5-494f-ab04-234307a846dc"
- },
- {
- "property-name": "model-ver.model-version",
- "property-value": "1.0"
- }
- ]
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "model-name": "vLoadBalancer-1106",
- "service-instance": {
- "service-instance-id": "3b12f31f-8f2d-4f5c-b875-61ff1194b941",
- "service-instance-name": "vLoadBalancer-1113",
- "model-invariant-id": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a",
- "model-version-id": "732d4692-4b97-46f9-a996-0b3339e88c50",
- "resource-version": "1510603936425"
- },
- "extra-properties": {
- "extra-property": [
- {
- "property-name": "model-ver.model-version-id",
- "property-value": "732d4692-4b97-46f9-a996-0b3339e88c50"
- },
- {
- "property-name": "model-ver.model-name",
- "property-value": "vLoadBalancer-1106"
- },
- {
- "property-name": "model.model-type",
- "property-value": "service"
- },
- {
- "property-name": "model.model-invariant-id",
- "property-value": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a"
- },
- {
- "property-name": "model-ver.model-version",
- "property-value": "1.0"
- }
- ]
- }
- },
- {
- "model-name": "Vloadbalancer..base_vlb..module-0",
- "vf-module": {
- "vf-module-id": "e6b3e3eb-34e1-4c00-b8c1-2a4fbe479b12",
- "vf-module-name": "Vfmodule_vLB1113-1",
- "heat-stack-id": "Vfmodule_vLB1113-1/3dd6d900-772f-4fcc-a0cb-e250ab2bb4db",
- "orchestration-status": "active",
- "is-base-vf-module": true,
- "resource-version": "1510604612557",
- "model-invariant-id": "6d760188-9a24-451a-b05b-e08b86cb94f2",
- "model-version-id": "93facad9-55f2-4fe0-9574-814c2bc2d071",
- "model-customization-id": "93fd5bd4-8051-4074-8530-c0c504604df5",
- "module-index": 0
- },
- "extra-properties": {
- "extra-property": [
- {
- "property-name": "model-ver.model-version-id",
- "property-value": "93facad9-55f2-4fe0-9574-814c2bc2d071"
- },
- {
- "property-name": "model-ver.model-name",
- "property-value": "Vloadbalancer..base_vlb..module-0"
- },
- {
- "property-name": "model.model-type",
- "property-value": "resource"
- },
- {
- "property-name": "model.model-invariant-id",
- "property-value": "6d760188-9a24-451a-b05b-e08b86cb94f2"
- },
- {
- "property-name": "model-ver.model-version",
- "property-value": "1"
- }
- ]
- }
- },
- {
- "model-name": "Vloadbalancer..dnsscaling..module-1",
- "vf-module": {
- "vf-module-id": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144",
- "vf-module-name": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144",
- "is-base-vf-module": false,
- "resource-version": "1510610079687",
- "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c",
- "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a"
- },
- "extra-properties": {
- "extra-property": [
- {
- "property-name": "model-ver.model-version-id",
- "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a"
- },
- {
- "property-name": "model-ver.model-name",
- "property-value": "Vloadbalancer..dnsscaling..module-1"
- },
- {
- "property-name": "model.model-type",
- "property-value": "resource"
- },
- {
- "property-name": "model.model-invariant-id",
- "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c"
- },
- {
- "property-name": "model-ver.model-version",
- "property-value": "1"
- }
- ]
- }
- }
- ]
- }
- },
- {
- "tenant": {
- "tenant-id": "41d6d38489bd40b09ea8a6b6b852dcbd",
- "tenant-name": "Integration-SB-00",
- "resource-version": "1509587770200"
- },
- "extra-properties": {
- },
- "inventory-response-items": {
- "inventory-response-item": [
- {
- "cloud-region": {
- "cloud-owner": "CloudOwner",
- "cloud-region-id": "RegionOne",
- "cloud-type": "SharedNode",
- "owner-defined-type": "OwnerType",
- "cloud-region-version": "v1",
- "cloud-zone": "CloudZone",
- "sriov-automation": false,
- "resource-version": "1509587770092"
- },
- "extra-properties": {
- }
- }
- ]
- }
- }
- ]
- }
- }
- ]
-}
diff --git a/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartRequestEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartRequestEvent.json
deleted file mode 100644
index 6e18a91b0..000000000
--- a/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartRequestEvent.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "rpc-name": "restart",
- "version": "2.0",
- "correlation-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c",
- "type": "request",
- "body": {
- "input": {
- "common-header": {
- "timestamp": "2018-02-26T10:23:41.97Z",
- "api-ver": "2.15",
- "originator-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c",
- "request-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c",
- "sub-request-id": "1",
- "flags": {}
- },
- "action": "Restart",
- "action-identifiers": {
- "vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db39e1"
- }
- }
- }
-} \ No newline at end of file
diff --git a/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseNOKEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseNOKEvent.json
deleted file mode 100644
index 9a0ff9af1..000000000
--- a/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseNOKEvent.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "rpc-name": "restart",
- "version": "0.0.1",
- "correlation-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c",
- "type": "response",
- "body": {
- "output": {
- "common-header": {
- "timestamp": "2018-02-26T10:23:42.97Z",
- "api-ver": "5.00",
- "originator-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c",
- "request-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c",
- "sub-request-id": "1",
- "flags": {}
- },
- "status": {
- "code": 400,
- "message": "Restart Failed"
- }
- }
- }
-} \ No newline at end of file
diff --git a/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKEvent.json
deleted file mode 100644
index 4afc51d85..000000000
--- a/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKEvent.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "rpc-name": "restart",
- "version": "0.0.1",
- "correlation-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c",
- "type": "response",
- "body": {
- "output": {
- "common-header": {
- "timestamp": "2018-02-26T10:23:42.97Z",
- "api-ver": "5.00",
- "originator-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c",
- "request-id": "4a68f8a5-0db9-4070-a132-adede51e3d5c",
- "sub-request-id": "1",
- "flags": {}
- },
- "status": {
- "code": 200,
- "message": "Restart Successful"
- }
- }
- }
-} \ No newline at end of file
diff --git a/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKInitialEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKInitialEvent.json
deleted file mode 100644
index 2f53a83bc..000000000
--- a/examples/examples-onap-vcpe/src/test/resources/events/APPCvCPERestartResponseOKInitialEvent.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "rpc-name": "restart",
- "version": "0.0.1",
- "correlation-id": "4a68f8a5-0db9-4070-a132-adede51ebeef",
- "type": "response",
- "body": {
- "output": {
- "common-header": {
- "timestamp": "2018-02-26T10:23:42.97Z",
- "api-ver": "5.00",
- "originator-id": "4a68f8a5-0db9-4070-a132-adede51ebeef",
- "request-id": "4a68f8a5-0db9-4070-a132-adede51ebeef",
- "sub-request-id": "1",
- "flags": {}
- },
- "status": {
- "code": 200,
- "message": "Restart Successful"
- }
- }
- }
-} \ No newline at end of file
diff --git a/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedAAIInfoEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedAAIInfoEvent.json
deleted file mode 100644
index 5efbfef69..000000000
--- a/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedAAIInfoEvent.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "closedLoopControlName": "ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1",
- "closedLoopAlarmStart": 1519638001326,
- "closedLoopAlarmEnd": 1519638197324,
- "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca",
- "closedLoopEventStatus": "ABATED",
- "requestID": "4a68f8a5-0db9-4070-a132-adede51e3d5c",
- "target_type": "VNF",
- "target": "generic-vnf.vnf-id",
- "version": "1.0.2",
- "from": "DCAE",
- "AAI": {
- "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db39e1",
- "generic-vnf.resource-version": "1",
- "generic-vnf.vnf-name": "vCPEInfraVNF13",
- "generic-vnf.prov-status": "PREPROV",
- "generic-vnf.is-closed-loop-disabled": "false",
- "generic-vnf.orchestration-status": "Created",
- "generic-vnf.vnf-type": "cCPEInfraService10/vCPEInfraService10 0",
- "generic-vnf.in-maint": "false",
- "generic-vnf.service-id": "5585fd2c-ad0d-4050-b0cf-dfe4a03bd01f"
- }
-} \ No newline at end of file
diff --git a/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedNoAAIInfoEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedNoAAIInfoEvent.json
deleted file mode 100644
index 7cc910e96..000000000
--- a/examples/examples-onap-vcpe/src/test/resources/events/VCPEAbatedNoAAIInfoEvent.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "closedLoopControlName": "ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1",
- "closedLoopAlarmStart": 1519638001326,
- "closedLoopAlarmEnd": 1519638197324,
- "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca",
- "closedLoopEventStatus": "ABATED",
- "requestID": "4a68f8a5-0db9-4070-a132-adede51e3d5c",
- "target_type": "VNF",
- "target": "generic-vnf.vnf-id",
- "version": "1.0.2",
- "from": "DCAE",
- "AAI": {
- "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db39e1"
- }
-} \ No newline at end of file
diff --git a/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetAAIInfoEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetAAIInfoEvent.json
deleted file mode 100644
index 405cc0b2b..000000000
--- a/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetAAIInfoEvent.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "closedLoopControlName": "ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1",
- "closedLoopAlarmStart": 1519638197324,
- "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca",
- "closedLoopEventStatus": "ONSET",
- "requestID": "4a68f8a5-0db9-4070-a132-adede51e3d5c",
- "target_type": "VNF",
- "target": "generic-vnf.vnf-id",
- "AAI": {
- "generic-vnf.resource-version": "1",
- "generic-vnf.vnf-name": "vCPEInfraVNF13",
- "generic-vnf.prov-status": "PREPROV",
- "generic-vnf.is-closed-loop-disabled": "false",
- "generic-vnf.orchestration-status": "Created",
- "generic-vnf.vnf-type": "cCPEInfraService10/vCPEInfraService10 0",
- "generic-vnf.in-maint": "false",
- "generic-vnf.service-id": "5585fd2c-ad0d-4050-b0cf-dfe4a03bd01f",
- "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db39e1"
- },
- "from": "DCAE",
- "version": "1.0.2"
-}
diff --git a/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetNoAAIInfoEvent.json b/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetNoAAIInfoEvent.json
deleted file mode 100644
index 342451a0c..000000000
--- a/examples/examples-onap-vcpe/src/test/resources/events/VCPEOnsetNoAAIInfoEvent.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "closedLoopControlName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e",
- "closedLoopAlarmStart": 1519638197324,
- "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca",
- "closedLoopEventStatus": "ONSET",
- "requestID": "664be3d2-6c12-4f4b-a3e7-c349acced200",
- "target_type": "VNF",
- "target": "generic-vnf.vnf-id",
- "AAI": {
- "vserver.is-closed-loop-disabled": "false",
- "generic-vnf.vnf-id": "b4fe00ac-1da6-4b00-ac0d-8e8300db39e1"
- },
- "from": "DCAE",
- "version": "1.0.2"
-}