summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-simulators
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-04-17 15:09:21 -0400
committerJim Hahn <jrh3@att.com>2020-04-17 19:31:23 -0400
commite887a0c6c415a00888e17d1bbfe4acf548a2cfa5 (patch)
tree1cccd49d453eb1cf94b0f8f7fd7d14eae02404d9 /models-interactions/model-simulators
parentbed21af59885a954e3facf7226c4678f4b69b153 (diff)
Add PNF support to new CDS actor
Made the following updates: - added new A&AI get-PNF Operation by refactoring AaiGetOperation, separating out Tenant and PNF operations - added PNF support to the CDS actor - added logging to the CDS Handler - added get-pnf to the A&AI simulator Issue-ID: POLICY-2505 Change-Id: Iff140e7c864f762790d8e2ecaba62c161c859e6e Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-simulators')
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java23
-rw-r--r--models-interactions/model-simulators/src/main/resources/org/onap/policy/simulators/aai/AaiGetPnfResponse.json12
2 files changed, 33 insertions, 2 deletions
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java
index 8c96ee533..8a3d6a803 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -51,7 +51,7 @@ public class AaiSimulatorJaxRs {
@Path("/v8/network/generic-vnfs/generic-vnf/{vnfId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces("application/json")
- public String aaiGetQuery(@PathParam("vnfID") final String vnfId) {
+ public String aaiGetQuery(@PathParam("vnfId") final String vnfId) {
return "{\"relationship-list\": {\"relationship\":[{\"related-to-property\": [{\"property-key\": "
+ "\"service-instance.service-instance-name\"}]},{\"related-to-property\": [ {\"property-key\": "
+ "\"vserver.vserver-name\",\"property-value\": \"USUCP0PCOIL0110UJZZ01-vsrx\" }]} ]}}";
@@ -96,6 +96,25 @@ public class AaiSimulatorJaxRs {
}
/**
+ * A&AI get PNF query.
+ *
+ * @return the result
+ * @throws IOException if a response file cannot be read
+ */
+ @GET
+ @Path("/v16/network/pnfs/pnf/{pnfName}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces("application/json")
+ public String aaiGetPnfQuery(@PathParam("pnfName") final String pnfName) throws IOException {
+ if (GETFAIL.equals(pnfName)) {
+ throw new IllegalArgumentException("query failed, as requested");
+ }
+
+ return IOUtils.toString(getClass().getResource("aai/AaiGetPnfResponse.json"),
+ StandardCharsets.UTF_8);
+ }
+
+ /**
* Get by VNF name.
*
* @param vnfName the VNF name
diff --git a/models-interactions/model-simulators/src/main/resources/org/onap/policy/simulators/aai/AaiGetPnfResponse.json b/models-interactions/model-simulators/src/main/resources/org/onap/policy/simulators/aai/AaiGetPnfResponse.json
new file mode 100644
index 000000000..ce8eb75a7
--- /dev/null
+++ b/models-interactions/model-simulators/src/main/resources/org/onap/policy/simulators/aai/AaiGetPnfResponse.json
@@ -0,0 +1,12 @@
+{
+ "equip-vendor":"Vendor-A",
+ "ipaddress-v4-oam":"10.10.10.10",
+ "in-maint":false,
+ "pnf-ipv4-address":"3.3.3.3",
+ "resource-version":"1570746989505",
+ "nf-role":"ToR DC101",
+ "equip-type":"Router",
+ "equip-model":"model-123456",
+ "frame-id":"3",
+ "pnf-name":"demo-pnf"
+}