X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=models-interactions%2Fmodel-simulators%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fsimulators%2FAaiSimulatorJaxRs.java;h=27afb7b73c78e8d544265890e637ff54ae9f3ad8;hb=222018349b49d229fc95a3939f4eaad3a3b663a8;hp=3b17723426abf989d26e9024ba4c59ec2e7ff0a9;hpb=6de5a0c9e2acf3a799f53c9fedf8a40861b6ddbe;p=policy%2Fmodels.git 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 3b1772342..27afb7b73 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\" }]} ]}}"; @@ -68,12 +68,13 @@ public class AaiSimulatorJaxRs { @Produces("application/json") public String aaiGetVserverQuery(@QueryParam("filter") final String filter) { if (filter.equals("vserver-name:EQUALS:f953c499-4b1e-426b-8c6d-e9e9f1fc730f") + || filter.equals("vserver-name:EQUALS:Ete_vFWCLvFWSNK_7ba1fbde_0") || filter.equals("vserver-name:EQUALS:OzVServer") || filter.equals("vserver-name:EQUALS:testVserverName")) { return "{\"result-data\":[{\"resource-type\": \"vserver\",\"resource-link\":\"/aai/v15/" + "cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants" + "/tenant/3f2aaef74ecb4b19b35e26d0849fe9a2/vservers/vserver/" - + "6c3b3714-e36c-45af-9f16-7d3a73d99497\"}]}}"; + + "6c3b3714-e36c-45af-9f16-7d3a73d99497\"}]}"; } else { return null; } @@ -95,6 +96,25 @@ public class AaiSimulatorJaxRs { StandardCharsets.UTF_8); } + /** + * 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. *