aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/simulators/src
diff options
context:
space:
mode:
authormmis <michael.morris@ericsson.com>2018-03-22 14:20:46 +0000
committermmis <michael.morris@ericsson.com>2018-03-22 15:36:03 +0000
commit5c4675e5f6f7fe9b8d9e87976ac5f603ff61c268 (patch)
tree6bcecde682b32cc55405a0131725ec7eb84a58c8 /controlloop/common/simulators/src
parent51619118d5148d10e9232d44b507a503c5b777e5 (diff)
Removed checkstyle warnings
Removed checkstyle warnings in: policy/controlloop/common/guard policy/controlloop/common/msb policy/controlloop/simulators including renaming of the following classes: MSBServiceFactory -> MsbServiceFactory MSBServiceManager -> MsbServiceManager MSBServiceException -> MsbServiceException Issue-ID: POLICY-705 Change-Id: I11d62a74fcb77e764121df119cb0bd9b844b485b Signed-off-by: mmis <michael.morris@ericsson.com>
Diffstat (limited to 'controlloop/common/simulators/src')
-rw-r--r--controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java376
-rw-r--r--controlloop/common/simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java35
-rw-r--r--controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java34
-rw-r--r--controlloop/common/simulators/src/main/java/org/onap/policy/simulators/Util.java127
-rw-r--r--controlloop/common/simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java70
-rw-r--r--controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java123
-rw-r--r--controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java82
-rw-r--r--controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java189
-rw-r--r--controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java70
9 files changed, 692 insertions, 414 deletions
diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java
index c6b22cf70..627e9311e 100644
--- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java
+++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -34,88 +34,294 @@ import org.onap.policy.aai.util.Serialization;
@Path("/aai")
public class AaiSimulatorJaxRs {
-
- @GET
- @Path("/v8/network/generic-vnfs/generic-vnf/{vnfId}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces("application/json")
- public String aaiGetQuery (@PathParam("vnfID") 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\" }]} ]}}";
- }
-
- @POST
- @Path("/search/named-query")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces("application/json")
- public String aaiPostQuery(String req)
- {
- AAINQRequest request = Serialization.gsonPretty.fromJson(req, AAINQRequest.class);
-
- if (request.getInstanceFilters().getInstanceFilter().get(0).containsKey("vserver"))
- {
- String vserverName = request.getInstanceFilters().getInstanceFilter().get(0).get("vserver").get("vserver-name");
- if ("error".equals(vserverName)) {
- return "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3001\",\"text\":\"Resource not found for %1 using id %2 (msg=%3) (ec=%4)\",\"variables\":[\"POST Search\",\"getNamedQueryResponse\",\"Node Not Found:No Node of type vserver found for properties\",\"ERR.5.4.6114\"]}}}";
- }
- else {
- // vll format - new
- // new aai response from Brian 11/13/2017
- return "{\"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\":{}}]}}]}}]}";
- }
- }
- else
- {
- String vnfID = request.getInstanceFilters().getInstanceFilter().get(0).get("generic-vnf").get("vnf-id");
- if ("error".equals(vnfID)) {
- return "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3001\",\"text\":\"Resource not found for %1 using id %2 (msg=%3) (ec=%4)\",\"variables\":[\"POST Search\",\"getNamedQueryResponse\",\"Node Not Found:No Node of type generic-vnf found for properties\",\"ERR.5.4.6114\"]}}}";
- }
- else {
- return "{\"inventory-response-item\": [{\"model-name\": \"service-instance\",\"generic-vnf\": {\"vnf-id\": \""+ vnfID + "\",\"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\": \"Eace933104d443b496b8.nodes.heat.vpg\",\"model-version-id\": \"46b92144-923a-4d20-b85a-3cbd847668a9\"},\"extra-properties\": {}}]}}]}}]}";
- }
- }
- }
-
- @GET
- @Path("/v11/network/generic-vnfs/generic-vnf")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces("application/json")
- public String getByVnfName (@QueryParam("vnf-name") String vnfName)
- {
- if ("getFail".equals(vnfName)) {
- return "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3001\",\"text\":\"Resource not found for %1 using id %2 (msg=%3) (ec=%4)\",\"variables\":[\"GET\",\"network/generic-vnfs/generic-vnf\",\"Node Not Found:No Node of type generic-vnf found at network/generic-vnfs/generic-vnf\",\"ERR.5.4.6114\"]}}}";
- }
- boolean isDisabled = "disableClosedLoop".equals(vnfName);
- if ("error".equals(vnfName)) {
- return "{ \"vnf-id\": \"error\", \"vnf-name\": \"" + vnfName + "\", \"vnf-type\": \"RT\", \"service-id\": \"d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4\", \"equipment-role\": \"UCPE\", \"orchestration-status\": \"created\", \"management-option\": \"ATT\", \"ipv4-oam-address\": \"32.40.68.35\", \"ipv4-loopback0-address\": \"32.40.64.57\", \"nm-lan-v6-address\": \"2001:1890:e00e:fffe::1345\", \"management-v6-address\": \"2001:1890:e00e:fffd::36\", \"in-maint\": false, \"is-closed-loop-disabled\": " + isDisabled + ", \"resource-version\": \"1493389458092\", \"relationship-list\": {\"relationship\":[{ \"related-to\": \"service-instance\", \"related-link\": \"/aai/v11/business/customers/customer/1610_Func_Global_20160817084727/service-subscriptions/service-subscription/uCPE-VMS/service-instances/service-instance/USUCP0PCOIL0110UJZZ01\", \"relationship-data\":[{ \"relationship-key\": \"customer.global-customer-id\", \"relationship-value\": \"1610_Func_Global_20160817084727\"},{ \"relationship-key\": \"service-subscription.service-type\", \"relationship-value\": \"uCPE-VMS\"},{ \"relationship-key\": \"service-instance.service-instance-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01\"} ], \"related-to-property\": [{\"property-key\": \"service-instance.service-instance-name\"}]},{ \"related-to\": \"vserver\", \"related-link\": \"/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/USUCP0PCOIL0110UJZZ01%3A%3AuCPE-VMS/vservers/vserver/3b2558f4-39d8-40e7-bfc7-30660fb52c45\", \"relationship-data\":[{ \"relationship-key\": \"cloud-region.cloud-owner\", \"relationship-value\": \"att-aic\"},{ \"relationship-key\": \"cloud-region.cloud-region-id\", \"relationship-value\": \"AAIAIC25\"},{ \"relationship-key\": \"tenant.tenant-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01::uCPE-VMS\"},{ \"relationship-key\": \"vserver.vserver-id\", \"relationship-value\": \"3b2558f4-39d8-40e7-bfc7-30660fb52c45\"} ], \"related-to-property\": [ {\"property-key\": \"vserver.vserver-name\",\"property-value\": \"USUCP0PCOIL0110UJZZ01-vsrx\" }]} ]}}";
-
- }
- return "{ \"vnf-id\": \"5e49ca06-2972-4532-9ed4-6d071588d792\", \"vnf-name\": \"" + vnfName + "\", \"vnf-type\": \"RT\", \"service-id\": \"d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4\", \"equipment-role\": \"UCPE\", \"orchestration-status\": \"created\", \"management-option\": \"ATT\", \"ipv4-oam-address\": \"32.40.68.35\", \"ipv4-loopback0-address\": \"32.40.64.57\", \"nm-lan-v6-address\": \"2001:1890:e00e:fffe::1345\", \"management-v6-address\": \"2001:1890:e00e:fffd::36\", \"in-maint\": false, \"is-closed-loop-disabled\": " + isDisabled + ", \"resource-version\": \"1493389458092\", \"relationship-list\": {\"relationship\":[{ \"related-to\": \"service-instance\", \"related-link\": \"/aai/v11/business/customers/customer/1610_Func_Global_20160817084727/service-subscriptions/service-subscription/uCPE-VMS/service-instances/service-instance/USUCP0PCOIL0110UJZZ01\", \"relationship-data\":[{ \"relationship-key\": \"customer.global-customer-id\", \"relationship-value\": \"1610_Func_Global_20160817084727\"},{ \"relationship-key\": \"service-subscription.service-type\", \"relationship-value\": \"uCPE-VMS\"},{ \"relationship-key\": \"service-instance.service-instance-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01\"} ], \"related-to-property\": [{\"property-key\": \"service-instance.service-instance-name\"}]},{ \"related-to\": \"vserver\", \"related-link\": \"/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/USUCP0PCOIL0110UJZZ01%3A%3AuCPE-VMS/vservers/vserver/3b2558f4-39d8-40e7-bfc7-30660fb52c45\", \"relationship-data\":[{ \"relationship-key\": \"cloud-region.cloud-owner\", \"relationship-value\": \"att-aic\"},{ \"relationship-key\": \"cloud-region.cloud-region-id\", \"relationship-value\": \"AAIAIC25\"},{ \"relationship-key\": \"tenant.tenant-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01::uCPE-VMS\"},{ \"relationship-key\": \"vserver.vserver-id\", \"relationship-value\": \"3b2558f4-39d8-40e7-bfc7-30660fb52c45\"} ], \"related-to-property\": [ {\"property-key\": \"vserver.vserver-name\",\"property-value\": \"USUCP0PCOIL0110UJZZ01-vsrx\" }]} ]}}";
- }
-
- @GET
- @Path("/v11/network/generic-vnfs/generic-vnf/{vnfId}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces("application/json")
- public String getByVnfId (@PathParam("vnfId") String vnfId)
- {
- if ("getFail".equals(vnfId)) {
- return "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3001\",\"text\":\"Resource not found for %1 using id %2 (msg=%3) (ec=%4)\",\"variables\":[\"GET\",\"network/generic-vnfs/generic-vnf/getFail\",\"Node Not Found:No Node of type generic-vnf found at network/generic-vnfs/generic-vnf/getFail\",\"ERR.5.4.6114\"]}}}";
- }
- boolean isDisabled = "disableClosedLoop".equals(vnfId);
- return "{ \"vnf-id\": \"" + vnfId + "\", \"vnf-name\": \"USUCP0PCOIL0110UJRT01\", \"vnf-type\": \"RT\", \"service-id\": \"d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4\", \"equipment-role\": \"UCPE\", \"orchestration-status\": \"created\", \"management-option\": \"ATT\", \"ipv4-oam-address\": \"32.40.68.35\", \"ipv4-loopback0-address\": \"32.40.64.57\", \"nm-lan-v6-address\": \"2001:1890:e00e:fffe::1345\", \"management-v6-address\": \"2001:1890:e00e:fffd::36\", \"in-maint\": false, \"is-closed-loop-disabled\": " + isDisabled + ", \"resource-version\": \"1493389458092\", \"relationship-list\": {\"relationship\":[{ \"related-to\": \"service-instance\", \"related-link\": \"/aai/v11/business/customers/customer/1610_Func_Global_20160817084727/service-subscriptions/service-subscription/uCPE-VMS/service-instances/service-instance/USUCP0PCOIL0110UJZZ01\", \"relationship-data\":[{ \"relationship-key\": \"customer.global-customer-id\", \"relationship-value\": \"1610_Func_Global_20160817084727\"},{ \"relationship-key\": \"service-subscription.service-type\", \"relationship-value\": \"uCPE-VMS\"},{ \"relationship-key\": \"service-instance.service-instance-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01\"} ], \"related-to-property\": [{\"property-key\": \"service-instance.service-instance-name\"}]},{ \"related-to\": \"vserver\", \"related-link\": \"/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/USUCP0PCOIL0110UJZZ01%3A%3AuCPE-VMS/vservers/vserver/3b2558f4-39d8-40e7-bfc7-30660fb52c45\", \"relationship-data\":[{ \"relationship-key\": \"cloud-region.cloud-owner\", \"relationship-value\": \"att-aic\"},{ \"relationship-key\": \"cloud-region.cloud-region-id\", \"relationship-value\": \"AAIAIC25\"},{ \"relationship-key\": \"tenant.tenant-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01::uCPE-VMS\"},{ \"relationship-key\": \"vserver.vserver-id\", \"relationship-value\": \"3b2558f4-39d8-40e7-bfc7-30660fb52c45\"} ], \"related-to-property\": [ {\"property-key\": \"vserver.vserver-name\",\"property-value\": \"USUCP0PCOIL0110UJZZ01-vsrx\" }]} ]}}";
- }
-
- @GET
- @Path("/v11/nodes/vservers")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces("application/json")
- public String getByVserverName (@QueryParam("vserver-name") String vserverName)
- {
- if ("getFail".equals(vserverName)) {
- return "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3001\",\"text\":\"Resource not found for %1 using id %2 (msg=%3) (ec=%4)\",\"variables\":[\"GET\",\"nodes/vservers\",\"Node Not Found:No Node of type generic-vnf found at nodes/vservers\",\"ERR.5.4.6114\"]}}}";
- }
- boolean isDisabled = "disableClosedLoop".equals(vserverName);
- return "{\"vserver\": [{ \"vserver-id\": \"d0668d4f-c25e-4a1b-87c4-83845c01efd8\", \"vserver-name\": \"" + vserverName + "\", \"vserver-name2\": \"vjunos0\", \"vserver-selflink\": \"https://aai-ext1.test.att.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8\", \"in-maint\": false, \"is-closed-loop-disabled\": " + isDisabled + ", \"resource-version\": \"1494001931513\", \"relationship-list\": {\"relationship\":[{ \"related-to\": \"generic-vnf\", \"related-link\": \"/aai/v11/network/generic-vnfs/generic-vnf/e1a41e99-4ede-409a-8f9d-b5e12984203a\", \"relationship-data\": [ {\"relationship-key\": \"generic-vnf.vnf-id\",\"relationship-value\": \"e1a41e99-4ede-409a-8f9d-b5e12984203a\" }], \"related-to-property\": [ {\"property-key\": \"generic-vnf.vnf-name\",\"property-value\": \"USMSO1SX7NJ0103UJSW01\" }]},{ \"related-to\": \"pserver\", \"related-link\": \"/aai/v11/cloud-infrastructure/pservers/pserver/USMSO1SX7NJ0103UJZZ01\", \"relationship-data\": [ {\"relationship-key\": \"pserver.hostname\",\"relationship-value\": \"USMSO1SX7NJ0103UJZZ01\" }], \"related-to-property\": [{\"property-key\": \"pserver.pserver-name2\"}]} ]}}]}";
- }
+
+ /**
+ * A&AI get query.
+ *
+ * @param vnfId the VNF Id
+ * @return the result
+ */
+ @GET
+ @Path("/v8/network/generic-vnfs/generic-vnf/{vnfId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces("application/json")
+ public String aaiGetQuery(@PathParam("vnfID") 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\" }]} ]}}";
+ }
+
+ /**
+ * A&AI post query.
+ *
+ * @param req the request
+ * @return the response
+ */
+ @POST
+ @Path("/search/named-query")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces("application/json")
+ public String aaiPostQuery(String req) {
+ AAINQRequest request = Serialization.gsonPretty.fromJson(req, AAINQRequest.class);
+
+ if (request.getInstanceFilters().getInstanceFilter().get(0).containsKey("vserver")) {
+ String vserverName =
+ request.getInstanceFilters().getInstanceFilter().get(0).get("vserver").get("vserver-name");
+ if ("error".equals(vserverName)) {
+ return "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3001\",\"text\":\"Resource not "
+ + "found for %1 using id %2 (msg=%3) (ec=%4)\",\"variables\":[\"POST Search\",\""
+ + "getNamedQueryResponse\",\"Node Not Found:No Node of type vserver found for properties\""
+ + ",\"ERR.5.4.6114\"]}}}";
+ } else {
+ // vll format - new
+ // new aai response from Brian 11/13/2017
+ return "{\"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\":{}}]}}]}}]}";
+ }
+ } else {
+ String vnfId = request.getInstanceFilters().getInstanceFilter().get(0).get("generic-vnf").get("vnf-id");
+ if ("error".equals(vnfId)) {
+ return "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3001\",\"text\":\"Resource not "
+ + "found for %1 using id %2 (msg=%3) (ec=%4)\",\"variables\":[\"POST Search\",\""
+ + "getNamedQueryResponse\",\"Node Not Found:No Node of type generic-vnf found for properties"
+ + "\",\"ERR.5.4.6114\"]}}}";
+ } else {
+ return "{\"inventory-response-item\": [{\"model-name\": \"service-instance\",\"generic-vnf\": {\""
+ + "vnf-id\": \"" + vnfId + "\",\"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\": \"Eace933104d443b496b8.nodes.heat.vpg\",\""
+ + "model-version-id\": \"46b92144-923a-4d20-b85a-3cbd847668a9\"},\"extra-properties\": "
+ + "{}}]}}]}}]}";
+ }
+ }
+ }
+
+ /**
+ * Get by VNF name.
+ *
+ * @param vnfName the VNF name
+ * @return the response
+ */
+ @GET
+ @Path("/v11/network/generic-vnfs/generic-vnf")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces("application/json")
+ public String getByVnfName(@QueryParam("vnf-name") String vnfName) {
+ if ("getFail".equals(vnfName)) {
+ return "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3001\",\"text\":\"Resource not found"
+ + " for %1 using id %2 (msg=%3) (ec=%4)\",\"variables\":[\"GET\",\"network/generic-vnfs/"
+ + "generic-vnf\",\"Node Not Found:No Node of type generic-vnf found at network/generic-vnfs"
+ + "/generic-vnf\",\"ERR.5.4.6114\"]}}}";
+ }
+ boolean isDisabled = "disableClosedLoop".equals(vnfName);
+ if ("error".equals(vnfName)) {
+ return "{ \"vnf-id\": \"error\", \"vnf-name\": \"" + vnfName
+ + "\", \"vnf-type\": \"RT\", \"service-id\": \"d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4\", \""
+ + "equipment-role\": \"UCPE\", \"orchestration-status\": \"created\", \"management-option\": \""
+ + "ATT\", \"ipv4-oam-address\": \"32.40.68.35\", \"ipv4-loopback0-address\": \"32.40.64.57\", \""
+ + "nm-lan-v6-address\": \"2001:1890:e00e:fffe::1345\", \"management-v6-address\": \""
+ + "2001:1890:e00e:fffd::36\", \"in-maint\": false, \"is-closed-loop-disabled\": " + isDisabled
+ + ", \"resource-version\": \"1493389458092\", \"relationship-list\": {\"relationship\":[{ \""
+ + "related-to\": \"service-instance\", \"related-link\": \"/aai/v11/business/customers/customer/"
+ + "1610_Func_Global_20160817084727/service-subscriptions/service-subscription/uCPE-VMS/"
+ + "service-instances/service-instance/USUCP0PCOIL0110UJZZ01\", \"relationship-data\":[{ \""
+ + "relationship-key\": \"customer.global-customer-id\", \"relationship-value\": \""
+ + "1610_Func_Global_20160817084727\"},{ \"relationship-key\": \"service-subscription.service-type"
+ + "\", \"relationship-value\": \"uCPE-VMS\"},{ \"relationship-key\": \""
+ + "service-instance.service-instance-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01"
+ + "\"} ], \"related-to-property\": [{\"property-key\": \"service-instance.service-instance-name"
+ + "\"}]},{ \"related-to\": \"vserver\", \"related-link\": \"/aai/v11/cloud-infrastructure/"
+ + "cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/"
+ + "USUCP0PCOIL0110UJZZ01%3A%3AuCPE-VMS/vservers/vserver/3b2558f4-39d8-40e7-bfc7-30660fb52c45"
+ + "\", \"relationship-data\":[{ \"relationship-key\": \"cloud-region.cloud-owner\", \""
+ + "relationship-value\": \"att-aic\"},{ \"relationship-key\": \"cloud-region.cloud-region-id"
+ + "\", \"relationship-value\": \"AAIAIC25\"},{ \"relationship-key\": \"tenant.tenant-id"
+ + "\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01::uCPE-VMS\"},{ \"relationship-key\": \""
+ + "vserver.vserver-id\", \"relationship-value\": \"3b2558f4-39d8-40e7-bfc7-30660fb52c45\"} ], \""
+ + "related-to-property\": [ {\"property-key\": \"vserver.vserver-name\",\"property-value\": \""
+ + "USUCP0PCOIL0110UJZZ01-vsrx\" }]} ]}}";
+
+ }
+ return "{ \"vnf-id\": \"5e49ca06-2972-4532-9ed4-6d071588d792\", \"vnf-name\": \"" + vnfName
+ + "\", \"vnf-type\": \"RT\", \"service-id\": \"d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4\", \""
+ + "equipment-role\": \"UCPE\", \"orchestration-status\": \"created\", \"management-option\": \"ATT"
+ + "\", \"ipv4-oam-address\": \"32.40.68.35\", \"ipv4-loopback0-address\": \"32.40.64.57\", \""
+ + "nm-lan-v6-address\": \"2001:1890:e00e:fffe::1345\", \"management-v6-address\": \""
+ + "2001:1890:e00e:fffd::36\", \"in-maint\": false, \"is-closed-loop-disabled\": " + isDisabled
+ + ", \"resource-version\": \"1493389458092\", \"relationship-list\": {\"relationship\":[{ \""
+ + "related-to\": \"service-instance\", \"related-link\": \"/aai/v11/business/customers/customer"
+ + "/1610_Func_Global_20160817084727/service-subscriptions/service-subscription/uCPE-VMS/"
+ + "service-instances/service-instance/USUCP0PCOIL0110UJZZ01\", \"relationship-data\":[{ \""
+ + "relationship-key\": \"customer.global-customer-id\", \"relationship-value\": \""
+ + "1610_Func_Global_20160817084727\"},{ \"relationship-key\": \"service-subscription.service-type"
+ + "\", \"relationship-value\": \"uCPE-VMS\"},{ \"relationship-key\": \""
+ + "service-instance.service-instance-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01\"} ], \""
+ + "related-to-property\": [{\"property-key\": \"service-instance.service-instance-name\"}]},{ \""
+ + "related-to\": \"vserver\", \"related-link\": \"/aai/v11/cloud-infrastructure/cloud-regions/"
+ + "cloud-region/att-aic/AAIAIC25/tenants/tenant/USUCP0PCOIL0110UJZZ01%3A%3AuCPE-VMS/vservers/vserver"
+ + "/3b2558f4-39d8-40e7-bfc7-30660fb52c45\", \"relationship-data\":[{ \"relationship-key\": \""
+ + "cloud-region.cloud-owner\", \"relationship-value\": \"att-aic\"},{ \"relationship-key\": \""
+ + "cloud-region.cloud-region-id\", \"relationship-value\": \"AAIAIC25\"},{ \"relationship-key\": \""
+ + "tenant.tenant-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01::uCPE-VMS\"},{ \""
+ + "relationship-key\": \"vserver.vserver-id\", \"relationship-value\": \""
+ + "3b2558f4-39d8-40e7-bfc7-30660fb52c45\"} ], \"related-to-property\": [ {\"property-key\": \""
+ + "vserver.vserver-name\",\"property-value\": \"USUCP0PCOIL0110UJZZ01-vsrx\" }]} ]}}";
+ }
+
+ /**
+ * Get by VNF Id.
+ *
+ * @param vnfId the VNF Id
+ * @return the response
+ */
+ @GET
+ @Path("/v11/network/generic-vnfs/generic-vnf/{vnfId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces("application/json")
+ public String getByVnfId(@PathParam("vnfId") String vnfId) {
+ if ("getFail".equals(vnfId)) {
+ return "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3001\",\"text\":\"Resource not found"
+ + " for %1 using id %2 (msg=%3) (ec=%4)\",\"variables\":[\"GET\",\"network/generic-vnfs/"
+ + "generic-vnf/getFail\",\"Node Not Found:No Node of type generic-vnf found at network/"
+ + "generic-vnfs/generic-vnf/getFail\",\"ERR.5.4.6114\"]}}}";
+ }
+ boolean isDisabled = "disableClosedLoop".equals(vnfId);
+ return "{ \"vnf-id\": \"" + vnfId
+ + "\", \"vnf-name\": \"USUCP0PCOIL0110UJRT01\", \"vnf-type\": \"RT\", \"service-id\": \""
+ + "d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4\", \"equipment-role\": \"UCPE\", \"orchestration-status"
+ + "\": \"created\", \"management-option\": \"ATT\", \"ipv4-oam-address\": \"32.40.68.35\", \""
+ + "ipv4-loopback0-address\": \"32.40.64.57\", \"nm-lan-v6-address\": \"2001:1890:e00e:fffe::1345"
+ + "\", \"management-v6-address\": \"2001:1890:e00e:fffd::36\", \"in-maint\": false, \"" + ""
+ + "is-closed-loop-disabled\": " + isDisabled + ", \"resource-version\": \"1493389458092\", \""
+ + "relationship-list\": {\"relationship\":[{ \"related-to\": \"service-instance\", \"related-link"
+ + "\": \"/aai/v11/business/customers/customer/1610_Func_Global_20160817084727/service-subscriptions"
+ + "/service-subscription/uCPE-VMS/service-instances/service-instance/USUCP0PCOIL0110UJZZ01\", \""
+ + "relationship-data\":[{ \"relationship-key\": \"customer.global-customer-id\", \""
+ + "relationship-value\": \"1610_Func_Global_20160817084727\"},{ \"relationship-key\": \""
+ + "service-subscription.service-type\", \"relationship-value\": \"uCPE-VMS\"},{ \"relationship-key"
+ + "\": \"service-instance.service-instance-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01\"} "
+ + "], \"related-to-property\": [{\"property-key\": \"service-instance.service-instance-name\"}]},"
+ + "{ \"related-to\": \"vserver\", \"related-link\": \"/aai/v11/cloud-infrastructure/cloud-regions/"
+ + "cloud-region/att-aic/AAIAIC25/tenants/tenant/USUCP0PCOIL0110UJZZ01%3A%3AuCPE-VMS/vservers/vserver"
+ + "/3b2558f4-39d8-40e7-bfc7-30660fb52c45\", \"relationship-data\":[{ \"relationship-key\": \""
+ + "cloud-region.cloud-owner\", \"relationship-value\": \"att-aic\"},{ \"relationship-key\": \""
+ + "cloud-region.cloud-region-id\", \"relationship-value\": \"AAIAIC25\"},{ \"relationship-key\": \""
+ + "tenant.tenant-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01::uCPE-VMS\"},{ \""
+ + "relationship-key\": \"vserver.vserver-id\", \"relationship-value\": \""
+ + "3b2558f4-39d8-40e7-bfc7-30660fb52c45\"} ], \"related-to-property\": [ {\"property-key\": \""
+ + "vserver.vserver-name\",\"property-value\": \"USUCP0PCOIL0110UJZZ01-vsrx\" }]} ]}}";
+ }
+
+ /**
+ * Get by VServer name.
+ *
+ * @param vserverName the VServer name
+ * @return the response
+ */
+ @GET
+ @Path("/v11/nodes/vservers")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces("application/json")
+ public String getByVserverName(@QueryParam("vserver-name") String vserverName) {
+ if ("getFail".equals(vserverName)) {
+ return "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3001\",\"text\":\"Resource not found"
+ + " for %1 using id %2 (msg=%3) (ec=%4)\",\"variables\":[\"GET\",\"nodes/vservers\",\"Node Not"
+ + " Found:No Node of type generic-vnf found at nodes/vservers\",\"ERR.5.4.6114\"]}}}";
+ }
+ boolean isDisabled = "disableClosedLoop".equals(vserverName);
+ return "{\"vserver\": [{ \"vserver-id\": \"d0668d4f-c25e-4a1b-87c4-83845c01efd8\", \"vserver-name\": \""
+ + vserverName
+ + "\", \"vserver-name2\": \"vjunos0\", \"vserver-selflink\": \"https://aai-ext1.test.att.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8\", \"in-maint\": false, \"is-closed-loop-disabled\": "
+ + isDisabled
+ + ", \"resource-version\": \"1494001931513\", \"relationship-list\": {\"relationship\":[{ \"related-to"
+ + "\": \"generic-vnf\", \"related-link\": \"/aai/v11/network/generic-vnfs/generic-vnf/"
+ + "e1a41e99-4ede-409a-8f9d-b5e12984203a\", \"relationship-data\": [ {\"relationship-key\": \""
+ + "generic-vnf.vnf-id\",\"relationship-value\": \"e1a41e99-4ede-409a-8f9d-b5e12984203a\" }], \""
+ + "related-to-property\": [ {\"property-key\": \"generic-vnf.vnf-name\",\"property-value\": \""
+ + "USMSO1SX7NJ0103UJSW01\" }]},{ \"related-to\": \"pserver\", \"related-link\": \"/aai/v11/"
+ + "cloud-infrastructure/pservers/pserver/USMSO1SX7NJ0103UJZZ01\", \"relationship-data\": [ {\""
+ + "relationship-key\": \"pserver.hostname\",\"relationship-value\": \"USMSO1SX7NJ0103UJZZ01\" }], \""
+ + "related-to-property\": [{\"property-key\": \"pserver.pserver-name2\"}]} ]}}]}";
+ }
}
diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java
index 4551cf246..90bec372b 100644
--- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java
+++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -30,19 +30,24 @@ import org.json.JSONObject;
@Path("/pdp/api")
public class GuardSimulatorJaxRs {
- public static final String DENY_CLNAME = "denyGuard";
+ public static final String DENY_CLNAME = "denyGuard";
- @POST
- @Path("/getDecision")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces("application/json")
- public String getGuardDecision(String req){
- String clName = new JSONObject(req).getJSONObject("decisionAttributes").getString("clname");
- if (DENY_CLNAME.equals(clName))
- {
- return "{\"decision\": \"DENY\", \"details\": \"Decision Deny. You asked for it\"}";
- }
- else
- return "{\"decision\": \"PERMIT\", \"details\": \"Decision Permit. OK!\"}";
- }
+ /**
+ * Get a guard decision.
+ *
+ * @param req the request
+ * @return the response
+ */
+ @POST
+ @Path("/getDecision")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces("application/json")
+ public String getGuardDecision(String req) {
+ String clName = new JSONObject(req).getJSONObject("decisionAttributes").getString("clname");
+ if (DENY_CLNAME.equals(clName)) {
+ return "{\"decision\": \"DENY\", \"details\": \"Decision Deny. You asked for it\"}";
+ } else {
+ return "{\"decision\": \"PERMIT\", \"details\": \"Decision Permit. OK!\"}";
+ }
+ }
}
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 eb12362ee..1547fd41f 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
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -29,18 +29,26 @@ import javax.ws.rs.core.MediaType;
@Path("/serviceInstances")
public class SoSimulatorJaxRs {
-
- @POST
- @Path("/v5/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces("application/json")
- public String soPostQuery(@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId)
- {
- // the requestID contained in the SO Response is a newly generated requestID
- // with no relation to the requestID in Policy controlLoopEvent
- return "{\"requestReferences\": {\"instanceId\": \"ff305d54-75b4-ff1b-bdb2-eb6b9e5460ff\", \"requestId\": \"rq1234d1-5a33-ffdf-23ab-12abad84e331\" }}";
+ /**
+ * SO post query.
+ *
+ * @param serviceInstanceId the service instance Id
+ * @param vnfInstanceId the VNF Id
+ * @return the response
+ */
+ @POST
+ @Path("/v5/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces("application/json")
+ public String soPostQuery(@PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId) {
+
+ // the requestID contained in the SO Response is a newly generated requestID
+ // with no relation to the requestID in Policy controlLoopEvent
+ return "{\"requestReferences\": {\"instanceId\": \"ff305d54-75b4-ff1b-bdb2-eb6b9e5460ff\", \"requestId\": \""
+ + "rq1234d1-5a33-ffdf-23ab-12abad84e331\" }}";
+
+ }
- }
-
}
diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/Util.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/Util.java
index 05afd1179..fc9a9320e 100644
--- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/Util.java
+++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/Util.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -26,56 +26,89 @@ import org.onap.policy.drools.http.server.HttpServletServer;
import org.onap.policy.drools.utils.NetworkUtil;
public class Util {
- private Util() {
- // Prevent instantiation of thic class
- }
+ private Util() {
+ // Prevent instantiation of thic class
+ }
- public static final String AAISIM_SERVER_NAME = "aaiSim";
- public static final String SOSIM_SERVER_NAME = "soSim";
- public static final String VFCSIM_SERVER_NAME = "vfcSim";
- public static final String GUARDSIM_SERVER_NAME = "guardSim";
+ public static final String AAISIM_SERVER_NAME = "aaiSim";
+ public static final String SOSIM_SERVER_NAME = "soSim";
+ public static final String VFCSIM_SERVER_NAME = "vfcSim";
+ public static final String GUARDSIM_SERVER_NAME = "guardSim";
- public static final int AAISIM_SERVER_PORT = 6666;
- public static final int SOSIM_SERVER_PORT = 6667;
- public static final int VFCSIM_SERVER_PORT = 6668;
- public static final int GUARDSIM_SERVER_PORT = 6669;
+ public static final int AAISIM_SERVER_PORT = 6666;
+ public static final int SOSIM_SERVER_PORT = 6667;
+ public static final int VFCSIM_SERVER_PORT = 6668;
+ public static final int GUARDSIM_SERVER_PORT = 6669;
- public static HttpServletServer buildAaiSim() throws InterruptedException, IOException {
- final HttpServletServer testServer = HttpServletServer.factory.build(AAISIM_SERVER_NAME,
- "localhost", AAISIM_SERVER_PORT, "/", false, true);
- testServer.addServletClass("/*", AaiSimulatorJaxRs.class.getName());
- testServer.waitedStart(5000);
- if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L))
- throw new IllegalStateException("cannot connect to port " + testServer.getPort());
- return testServer;
- }
+ /**
+ * Build an A&AI simulator.
+ *
+ * @return the simulator
+ * @throws InterruptedException if a thread is interrupted
+ * @throws IOException if an IO errror occurs
+ */
+ public static HttpServletServer buildAaiSim() throws InterruptedException, IOException {
+ final HttpServletServer testServer =
+ HttpServletServer.factory.build(AAISIM_SERVER_NAME, "localhost", AAISIM_SERVER_PORT, "/", false, true);
+ testServer.addServletClass("/*", AaiSimulatorJaxRs.class.getName());
+ testServer.waitedStart(5000);
+ if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L)) {
+ throw new IllegalStateException("cannot connect to port " + testServer.getPort());
+ }
+ return testServer;
+ }
- public static HttpServletServer buildSoSim() throws InterruptedException, IOException {
- final HttpServletServer testServer = HttpServletServer.factory.build(SOSIM_SERVER_NAME,
- "localhost", SOSIM_SERVER_PORT, "/", false, true);
- testServer.addServletClass("/*", SoSimulatorJaxRs.class.getName());
- testServer.waitedStart(5000);
- if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L))
- throw new IllegalStateException("cannot connect to port " + testServer.getPort());
- return testServer;
- }
+ /**
+ * Build an SO simulator.
+ *
+ * @return the simulator
+ * @throws InterruptedException if a thread is interrupted
+ * @throws IOException if an IO errror occurs
+ */
+ public static HttpServletServer buildSoSim() throws InterruptedException, IOException {
+ final HttpServletServer testServer =
+ HttpServletServer.factory.build(SOSIM_SERVER_NAME, "localhost", SOSIM_SERVER_PORT, "/", false, true);
+ testServer.addServletClass("/*", SoSimulatorJaxRs.class.getName());
+ testServer.waitedStart(5000);
+ if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L)) {
+ throw new IllegalStateException("cannot connect to port " + testServer.getPort());
+ }
+ return testServer;
+ }
- public static HttpServletServer buildVfcSim() throws InterruptedException, IOException {
- final HttpServletServer testServer = HttpServletServer.factory.build(VFCSIM_SERVER_NAME,
- "localhost", VFCSIM_SERVER_PORT, "/", false, true);
- testServer.addServletClass("/*", VfcSimulatorJaxRs.class.getName());
- testServer.waitedStart(5000);
- if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L))
- throw new IllegalStateException("cannot connect to port " + testServer.getPort());
- return testServer;
- }
+ /**
+ * Build a VFC simulator.
+ *
+ * @return the simulator
+ * @throws InterruptedException if a thread is interrupted
+ * @throws IOException if an IO errror occurs
+ */
+ public static HttpServletServer buildVfcSim() throws InterruptedException, IOException {
+ final HttpServletServer testServer =
+ HttpServletServer.factory.build(VFCSIM_SERVER_NAME, "localhost", VFCSIM_SERVER_PORT, "/", false, true);
+ testServer.addServletClass("/*", VfcSimulatorJaxRs.class.getName());
+ testServer.waitedStart(5000);
+ if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L)) {
+ throw new IllegalStateException("cannot connect to port " + testServer.getPort());
+ }
+ return testServer;
+ }
- public static HttpServletServer buildGuardSim() throws InterruptedException, IOException {
- HttpServletServer testServer = HttpServletServer.factory.build(GUARDSIM_SERVER_NAME, "localhost", GUARDSIM_SERVER_PORT, "/", false, true);
- testServer.addServletClass("/*", GuardSimulatorJaxRs.class.getName());
- testServer.waitedStart(5000);
- if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L))
- throw new IllegalStateException("cannot connect to port " + testServer.getPort());
- return testServer;
- }
+ /**
+ * Build a guard simulator.
+ *
+ * @return the simulator
+ * @throws InterruptedException if a thread is interrupted
+ * @throws IOException if an IO errror occurs
+ */
+ public static HttpServletServer buildGuardSim() throws InterruptedException, IOException {
+ HttpServletServer testServer = HttpServletServer.factory.build(GUARDSIM_SERVER_NAME, "localhost",
+ GUARDSIM_SERVER_PORT, "/", false, true);
+ testServer.addServletClass("/*", GuardSimulatorJaxRs.class.getName());
+ testServer.waitedStart(5000);
+ if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L)) {
+ throw new IllegalStateException("cannot connect to port " + testServer.getPort());
+ }
+ return testServer;
+ }
}
diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java
index b8c0683d5..101184d69 100644
--- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java
+++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -20,13 +20,13 @@
package org.onap.policy.simulators;
+import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
-import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
@@ -36,32 +36,50 @@ import org.slf4j.LoggerFactory;
@Path("/api/nslcm/v1")
public class VfcSimulatorJaxRs {
- @POST
- @Path("/ns/{nsInstanceId}/heal")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces("application/json")
- public String vfcPostQuery(@PathParam("nsInstanceId") String nsInstanceId,
- @Context final HttpServletResponse response)
- {
- response.setStatus(HttpServletResponse.SC_ACCEPTED);
- try {
- response.flushBuffer();
- } catch(Exception e){
- final Logger logger = LoggerFactory.getLogger(VfcSimulatorJaxRs.class);
- logger.error("flushBuffer threw: ", e);
- return "";
- }
+ /**
+ * VFC post query.
+ *
+ * @param nsInstanceId the NS instance
+ * @param response the response
+ * @return the response
+ */
+ @POST
+ @Path("/ns/{nsInstanceId}/heal")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces("application/json")
+ public String vfcPostQuery(@PathParam("nsInstanceId") String nsInstanceId,
+ @Context final HttpServletResponse response) {
+ response.setStatus(HttpServletResponse.SC_ACCEPTED);
+ try {
+ response.flushBuffer();
+ } catch (Exception e) {
+ final Logger logger = LoggerFactory.getLogger(VfcSimulatorJaxRs.class);
+ logger.error("flushBuffer threw: ", e);
+ return "";
+ }
- return "{\"jobId\":\"1\"}";
- }
+ return "{\"jobId\":\"1\"}";
+ }
- @GET
- @Path("/jobs/{jobId}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces("application/json")
- public String vfcGetQuery(@PathParam("jobId") String jobId) {
- return "{\"jobId\" : "+jobId+",\"responseDescriptor\" : {\"progress\" : \"40\",\"status\" : \"finished\",\"statusDescription\" : \"OMC VMs are decommissioned in VIM\",\"errorCode\" : null,\"responseId\": 101 ,\"responseHistoryList\": [{\"progress\" : \"40\",\"status\" : \"proccessing\",\"statusDescription\" : \"OMC VMs are decommissioned in VIM\",\"errorCode\" : null,\"responseId\" : \"1\"}, {\"progress\" : \"41\",\"status\" : \"proccessing\",\"statusDescription\" : \"OMC VMs are decommissioned in VIM\",\"errorCode\" : null,\"responseId\" : \"2\"}]}}";
- }
+ /**
+ * VFC get query.
+ *
+ * @param jobId tthe job id
+ * @return the response
+ */
+ @GET
+ @Path("/jobs/{jobId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces("application/json")
+ public String vfcGetQuery(@PathParam("jobId") String jobId) {
+ return "{\"jobId\" : " + jobId
+ + ",\"responseDescriptor\" : {\"progress\" : \"40\",\"status\" : \"finished\",\"statusDescription"
+ + "\" : \"OMC VMs are decommissioned in VIM\",\"errorCode\" : null,\"responseId\": 101 ,\""
+ + "responseHistoryList\": [{\"progress\" : \"40\",\"status\" : \"proccessing\",\"statusDescription"
+ + "\" : \"OMC VMs are decommissioned in VIM\",\"errorCode\" : null,\"responseId\" : \"1\"}, {\""
+ + "progress\" : \"41\",\"status\" : \"proccessing\",\"statusDescription\" : \"OMC VMs are "
+ + "decommissioned in VIM\",\"errorCode\" : null,\"responseId\" : \"2\"}]}}";
+ }
}
diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java
index 86168e899..89208d2c6 100644
--- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java
+++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -45,70 +45,73 @@ import org.onap.policy.rest.RESTManager;
public class AaiSimulatorTest {
- @BeforeClass
- public static void setUpSimulator() {
- LoggerUtil.setLevel("ROOT", "INFO");
- LoggerUtil.setLevel("org.eclipse.jetty", "WARN");
- try {
- Util.buildAaiSim();
- } catch (final Exception e) {
- fail(e.getMessage());
+ /**
+ * Set up test class.
+ */
+ @BeforeClass
+ public static void setUpSimulator() {
+ LoggerUtil.setLevel("ROOT", "INFO");
+ LoggerUtil.setLevel("org.eclipse.jetty", "WARN");
+ try {
+ Util.buildAaiSim();
+ } catch (final Exception e) {
+ fail(e.getMessage());
+ }
}
- }
- @AfterClass
- public static void tearDownSimulator() {
- HttpServletServer.factory.destroy();
- }
+ @AfterClass
+ public static void tearDownSimulator() {
+ HttpServletServer.factory.destroy();
+ }
- @Test
- public void testGet() {
- final AAIGETVnfResponse response = new AAIManager(new RESTManager()).getQueryByVnfID(
- "http://localhost:6666/aai/v11/network/generic-vnfs/generic-vnf/", "testUser", "testPass",
- UUID.randomUUID(), "5e49ca06-2972-4532-9ed4-6d071588d792");
- assertNotNull(response);
- assertNotNull(response.getRelationshipList());
- }
+ @Test
+ public void testGet() {
+ final AAIGETVnfResponse response = new AAIManager(new RESTManager()).getQueryByVnfID(
+ "http://localhost:6666/aai/v11/network/generic-vnfs/generic-vnf/", "testUser", "testPass",
+ UUID.randomUUID(), "5e49ca06-2972-4532-9ed4-6d071588d792");
+ assertNotNull(response);
+ assertNotNull(response.getRelationshipList());
+ }
- @Test
- public void testPost() {
- final AAINQRequest request = new AAINQRequest();
- final AAINQQueryParameters tempQueryParameters = new AAINQQueryParameters();
- final AAINQNamedQuery tempNamedQuery = new AAINQNamedQuery();
- tempNamedQuery.setNamedQueryUUID(UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469"));
- tempQueryParameters.setNamedQuery(tempNamedQuery);
- request.setQueryParameters(tempQueryParameters);
- Map<String, String> tempInnerMap = new HashMap<>();
- tempInnerMap.put("vserver-name", "vserver-name-16102016-aai3255-data-11-1");
- Map<String, Map<String, String>> tempOuterMap = new HashMap<>();
- tempOuterMap.put("vserver", tempInnerMap);
- List<Map<String, Map<String, String>>> tempInstanceFilter = new LinkedList<>();
- tempInstanceFilter.add(tempOuterMap);
- AAINQInstanceFilters tempInstanceFilters = new AAINQInstanceFilters();
- tempInstanceFilters.setInstanceFilter(tempInstanceFilter);
- request.setInstanceFilters(tempInstanceFilters);
+ @Test
+ public void testPost() {
+ final AAINQRequest request = new AAINQRequest();
+ final AAINQQueryParameters tempQueryParameters = new AAINQQueryParameters();
+ final AAINQNamedQuery tempNamedQuery = new AAINQNamedQuery();
+ tempNamedQuery.setNamedQueryUUID(UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469"));
+ tempQueryParameters.setNamedQuery(tempNamedQuery);
+ request.setQueryParameters(tempQueryParameters);
+ Map<String, String> tempInnerMap = new HashMap<>();
+ tempInnerMap.put("vserver-name", "vserver-name-16102016-aai3255-data-11-1");
+ Map<String, Map<String, String>> tempOuterMap = new HashMap<>();
+ tempOuterMap.put("vserver", tempInnerMap);
+ List<Map<String, Map<String, String>>> tempInstanceFilter = new LinkedList<>();
+ tempInstanceFilter.add(tempOuterMap);
+ AAINQInstanceFilters tempInstanceFilters = new AAINQInstanceFilters();
+ tempInstanceFilters.setInstanceFilter(tempInstanceFilter);
+ request.setInstanceFilters(tempInstanceFilters);
- AAINQResponse response = new AAIManager(new RESTManager()).postQuery("http://localhost:6666", "testUser", "testPass",
- request, UUID.randomUUID());
- assertNotNull(response);
- assertNotNull(response.getInventoryResponseItems());
+ AAINQResponse response = new AAIManager(new RESTManager()).postQuery("http://localhost:6666", "testUser",
+ "testPass", request, UUID.randomUUID());
+ assertNotNull(response);
+ assertNotNull(response.getInventoryResponseItems());
- tempNamedQuery.setNamedQueryUUID(UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087"));
- tempQueryParameters.setNamedQuery(tempNamedQuery);
- request.setQueryParameters(tempQueryParameters);
- tempInnerMap = new HashMap<>();
- tempInnerMap.put("vnf-id", "de7cc3ab-0212-47df-9e64-da1c79234deb");
- tempOuterMap = new HashMap<>();
- tempOuterMap.put("generic-vnf", tempInnerMap);
- tempInstanceFilter = new LinkedList<>();
- tempInstanceFilter.add(tempOuterMap);
- tempInstanceFilters = new AAINQInstanceFilters();
- tempInstanceFilters.setInstanceFilter(tempInstanceFilter);
- request.setInstanceFilters(tempInstanceFilters);
+ tempNamedQuery.setNamedQueryUUID(UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087"));
+ tempQueryParameters.setNamedQuery(tempNamedQuery);
+ request.setQueryParameters(tempQueryParameters);
+ tempInnerMap = new HashMap<>();
+ tempInnerMap.put("vnf-id", "de7cc3ab-0212-47df-9e64-da1c79234deb");
+ tempOuterMap = new HashMap<>();
+ tempOuterMap.put("generic-vnf", tempInnerMap);
+ tempInstanceFilter = new LinkedList<>();
+ tempInstanceFilter.add(tempOuterMap);
+ tempInstanceFilters = new AAINQInstanceFilters();
+ tempInstanceFilters.setInstanceFilter(tempInstanceFilter);
+ request.setInstanceFilters(tempInstanceFilters);
- response = new AAIManager(new RESTManager()).postQuery("http://localhost:6666", "testUser", "testPass", request,
- UUID.randomUUID());
- assertNotNull(response);
- assertNotNull(response.getInventoryResponseItems());
- }
+ response = new AAIManager(new RESTManager()).postQuery("http://localhost:6666", "testUser", "testPass", request,
+ UUID.randomUUID());
+ assertNotNull(response);
+ assertNotNull(response.getInventoryResponseItems());
+ }
}
diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java
index ea13ec445..9522e55da 100644
--- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java
+++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -20,6 +20,10 @@
package org.onap.policy.simulators;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -28,48 +32,48 @@ import org.onap.policy.drools.utils.LoggerUtil;
import org.onap.policy.rest.RESTManager;
import org.onap.policy.rest.RESTManager.Pair;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
public class GuardSimulatorTest {
- @BeforeClass
- public static void setupSimulator() {
- LoggerUtil.setLevel("ROOT", "INFO");
- LoggerUtil.setLevel("org.eclipse.jetty", "WARN");
- try {
- org.onap.policy.simulators.Util.buildGuardSim();
- } catch (Exception e) {
- fail(e.getMessage());
- }
- }
-
- @AfterClass
- public static void tearDownSimulator() {
- HttpServletServer.factory.destroy();
- }
-
- @Test
- public void testGuard() {
- String request = makeRequest("test_actor_id", "test_op_id", "test_target", "test_clName");
- String url = "http://localhost:" + Util.GUARDSIM_SERVER_PORT + "/pdp/api/getDecision";
- Pair<Integer, String> response = new RESTManager().post(url, "testUname", "testPass", null, "application/json", request);
- assertNotNull(response);
- assertNotNull(response.a);
- assertNotNull(response.b);
- assertEquals("{\"decision\": \"PERMIT\", \"details\": \"Decision Permit. OK!\"}", response.b);
-
- request = makeRequest("test_actor_id", "test_op_id", "test_target", "denyGuard");
- response = new RESTManager().post(url, "testUname", "testPass", null, "application/json", request);
- assertNotNull(response);
+ /**
+ * Set up test class.
+ */
+ @BeforeClass
+ public static void setupSimulator() {
+ LoggerUtil.setLevel("ROOT", "INFO");
+ LoggerUtil.setLevel("org.eclipse.jetty", "WARN");
+ try {
+ org.onap.policy.simulators.Util.buildGuardSim();
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @AfterClass
+ public static void tearDownSimulator() {
+ HttpServletServer.factory.destroy();
+ }
+
+ @Test
+ public void testGuard() {
+ String request = makeRequest("test_actor_id", "test_op_id", "test_target", "test_clName");
+ String url = "http://localhost:" + Util.GUARDSIM_SERVER_PORT + "/pdp/api/getDecision";
+ Pair<Integer, String> response =
+ new RESTManager().post(url, "testUname", "testPass", null, "application/json", request);
+ assertNotNull(response);
+ assertNotNull(response.a);
+ assertNotNull(response.b);
+ assertEquals("{\"decision\": \"PERMIT\", \"details\": \"Decision Permit. OK!\"}", response.b);
+
+ request = makeRequest("test_actor_id", "test_op_id", "test_target", "denyGuard");
+ response = new RESTManager().post(url, "testUname", "testPass", null, "application/json", request);
+ assertNotNull(response);
assertNotNull(response.a);
assertNotNull(response.b);
assertEquals("{\"decision\": \"DENY\", \"details\": \"Decision Deny. You asked for it\"}", response.b);
- }
-
- private static String makeRequest (String actor, String recipe, String target, String clName) {
- return "{\"decisionAttributes\": {\"actor\": \"" + actor + "\", \"recipe\": \"" + recipe + "\""
+ }
+
+ private static String makeRequest(String actor, String recipe, String target, String clName) {
+ return "{\"decisionAttributes\": {\"actor\": \"" + actor + "\", \"recipe\": \"" + recipe + "\""
+ ", \"target\": \"" + target + "\", \"clname\": \"" + clName + "\"}, \"onapName\": \"PDPD\"}";
- }
+ }
}
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 8ea0062cc..edc942bbe 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
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -46,103 +46,104 @@ import org.onap.policy.so.util.Serialization;
public class SoSimulatorTest {
- @BeforeClass
- public static void setUpSimulator() {
- LoggerUtil.setLevel("ROOT", "INFO");
- LoggerUtil.setLevel("org.eclipse.jetty", "WARN");
- try {
- Util.buildSoSim();
- } catch (final Exception e) {
- fail(e.getMessage());
+ /**
+ * Set up test class.
+ */
+ @BeforeClass
+ public static void setUpSimulator() {
+ LoggerUtil.setLevel("ROOT", "INFO");
+ LoggerUtil.setLevel("org.eclipse.jetty", "WARN");
+ try {
+ Util.buildSoSim();
+ } catch (final Exception e) {
+ fail(e.getMessage());
+ }
}
- }
- @AfterClass
- public static void tearDownSimulator() {
- HttpServletServer.factory.destroy();
- }
+ @AfterClass
+ public static void tearDownSimulator() {
+ HttpServletServer.factory.destroy();
+ }
- /**
- * Create dummy SO request for TestResponse() junit
- */
- private SORequest createTestRequest() {
+ /**
+ * Create dummy SO request for TestResponse() junit.
+ */
+ private SORequest createTestRequest() {
- // Construct SO Request
- final SORequest request = new SORequest();
- request.setRequestId(UUID.randomUUID());
- request.setRequestDetails(new SORequestDetails());
- request.getRequestDetails().setModelInfo(new SOModelInfo());
- request.getRequestDetails().setCloudConfiguration(new SOCloudConfiguration());
- request.getRequestDetails().setRequestInfo(new SORequestInfo());
- request.getRequestDetails().setRequestParameters(new SORequestParameters());
- request.getRequestDetails().getRequestParameters().setUserParams(null);
- //
- // cloudConfiguration
- //
- request.getRequestDetails().getCloudConfiguration().setLcpCloudRegionId("DFW");
- request.getRequestDetails().getCloudConfiguration().setTenantId("1015548");
- //
- // modelInfo
- //
- request.getRequestDetails().getModelInfo().setModelType("vfModule");
- request.getRequestDetails().getModelInfo().setModelInvariantId("f32568ec-2f1c-458a-864b-0593d53d141a");
- request.getRequestDetails().getModelInfo().setModelVersionId("69615025-879d-4f0d-afe3-b7d1a7eeed1f");
- request.getRequestDetails().getModelInfo().setModelName("C15ce9e1E9144c8fB8bb..dnsscaling..module-1");
- request.getRequestDetails().getModelInfo().setModelVersion("1.0");
- //
- // requestInfo
- //
- request.getRequestDetails().getRequestInfo().setInstanceName(
- "vDNS_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8");
- request.getRequestDetails().getRequestInfo().setSource("POLICY");
- request.getRequestDetails().getRequestInfo().setSuppressRollback(false);
- request.getRequestDetails().getRequestInfo().setRequestorId("policy");
- //
- // relatedInstanceList
- //
- final SORelatedInstanceListElement relatedInstanceListElement1 =
- new SORelatedInstanceListElement();
- final SORelatedInstanceListElement relatedInstanceListElement2 =
- new SORelatedInstanceListElement();
- relatedInstanceListElement1.setRelatedInstance(new SORelatedInstance());
- relatedInstanceListElement2.setRelatedInstance(new SORelatedInstance());
- //
- relatedInstanceListElement1.getRelatedInstance().setInstanceId("cf8426a6-0b53-4e3d-bfa6-4b2f4d5913a5");
- relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SOModelInfo());
- relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("service");
- relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelInvariantId(
- "4fcbc1c0-7793-46d8-8aa1-fa1c2ed9ec7b");
- relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelVersionId(
- "5c996219-b2e2-4c76-9b43-7e8672a33c1d");
- relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelName("8330e932-2a23-4943-8606");
- relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelVersion("1.0");
- //
- relatedInstanceListElement2.getRelatedInstance().setInstanceId("594e2fe0-48b8-41ff-82e2-3d4bab69b192");
- relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SOModelInfo());
- relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("vnf");
- relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelInvariantId(
- "033a32ed-aa65-4764-a736-36f2942f1aa0");
- relatedInstanceListElement2.getRelatedInstance().getModelInfo().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");
- //
- request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement1);
- request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement2);
+ // Construct SO Request
+ final SORequest request = new SORequest();
+ request.setRequestId(UUID.randomUUID());
+ request.setRequestDetails(new SORequestDetails());
+ request.getRequestDetails().setModelInfo(new SOModelInfo());
+ request.getRequestDetails().setCloudConfiguration(new SOCloudConfiguration());
+ request.getRequestDetails().setRequestInfo(new SORequestInfo());
+ request.getRequestDetails().setRequestParameters(new SORequestParameters());
+ request.getRequestDetails().getRequestParameters().setUserParams(null);
+ //
+ // cloudConfiguration
+ //
+ request.getRequestDetails().getCloudConfiguration().setLcpCloudRegionId("DFW");
+ request.getRequestDetails().getCloudConfiguration().setTenantId("1015548");
+ //
+ // modelInfo
+ //
+ request.getRequestDetails().getModelInfo().setModelType("vfModule");
+ request.getRequestDetails().getModelInfo().setModelInvariantId("f32568ec-2f1c-458a-864b-0593d53d141a");
+ request.getRequestDetails().getModelInfo().setModelVersionId("69615025-879d-4f0d-afe3-b7d1a7eeed1f");
+ request.getRequestDetails().getModelInfo().setModelName("C15ce9e1E9144c8fB8bb..dnsscaling..module-1");
+ request.getRequestDetails().getModelInfo().setModelVersion("1.0");
+ //
+ // requestInfo
+ //
+ request.getRequestDetails().getRequestInfo()
+ .setInstanceName("vDNS_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8");
+ request.getRequestDetails().getRequestInfo().setSource("POLICY");
+ request.getRequestDetails().getRequestInfo().setSuppressRollback(false);
+ request.getRequestDetails().getRequestInfo().setRequestorId("policy");
+ //
+ // relatedInstanceList
+ //
+ final SORelatedInstanceListElement relatedInstanceListElement1 = new SORelatedInstanceListElement();
+ final SORelatedInstanceListElement relatedInstanceListElement2 = new SORelatedInstanceListElement();
+ relatedInstanceListElement1.setRelatedInstance(new SORelatedInstance());
+ relatedInstanceListElement2.setRelatedInstance(new SORelatedInstance());
+ //
+ relatedInstanceListElement1.getRelatedInstance().setInstanceId("cf8426a6-0b53-4e3d-bfa6-4b2f4d5913a5");
+ relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SOModelInfo());
+ relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("service");
+ relatedInstanceListElement1.getRelatedInstance().getModelInfo()
+ .setModelInvariantId("4fcbc1c0-7793-46d8-8aa1-fa1c2ed9ec7b");
+ relatedInstanceListElement1.getRelatedInstance().getModelInfo()
+ .setModelVersionId("5c996219-b2e2-4c76-9b43-7e8672a33c1d");
+ relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelName("8330e932-2a23-4943-8606");
+ relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelVersion("1.0");
+ //
+ relatedInstanceListElement2.getRelatedInstance().setInstanceId("594e2fe0-48b8-41ff-82e2-3d4bab69b192");
+ relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SOModelInfo());
+ relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("vnf");
+ relatedInstanceListElement2.getRelatedInstance().getModelInfo()
+ .setModelInvariantId("033a32ed-aa65-4764-a736-36f2942f1aa0");
+ relatedInstanceListElement2.getRelatedInstance().getModelInfo()
+ .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");
+ //
+ request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement1);
+ request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement2);
- return request;
- }
+ return request;
+ }
- @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);
- assertNotNull(httpDetails);
- final SOResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, SOResponse.class);
- assertNotNull(response);
- }
+ @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);
+ assertNotNull(httpDetails);
+ final SOResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, SOResponse.class);
+ assertNotNull(response);
+ }
}
diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java
index 4c29331bf..d26cee321 100644
--- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java
+++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -38,42 +38,42 @@ import org.onap.policy.vfc.util.Serialization;
public class VfcSimulatorTest {
- @BeforeClass
- public static void setUpSimulator() {
- LoggerUtil.setLevel("ROOT", "INFO");
- LoggerUtil.setLevel("org.eclipse.jetty", "WARN");
- try {
- Util.buildVfcSim();
- } catch (final Exception e) {
- fail(e.getMessage());
+ /**
+ * Set up test class.
+ */
+ @BeforeClass
+ public static void setUpSimulator() {
+ LoggerUtil.setLevel("ROOT", "INFO");
+ LoggerUtil.setLevel("org.eclipse.jetty", "WARN");
+ try {
+ Util.buildVfcSim();
+ } catch (final Exception e) {
+ fail(e.getMessage());
+ }
}
- }
- @AfterClass
- public static void tearDownSimulator() {
- HttpServletServer.factory.destroy();
- }
+ @AfterClass
+ public static void tearDownSimulator() {
+ HttpServletServer.factory.destroy();
+ }
- @Test
- public void testPost() {
- final Pair<Integer, String> httpDetails =
- new RESTManager().post("http://localhost:6668/api/nslcm/v1/ns/1234567890/heal", "username",
- "password", new HashMap<String, String>(), "application/json", "Some Request Here");
- assertNotNull(httpDetails);
- assertTrue(httpDetails.a == 202);
- final VFCResponse response =
- Serialization.gsonPretty.fromJson(httpDetails.b, VFCResponse.class);
- assertNotNull(response);
- }
+ @Test
+ public void testPost() {
+ final Pair<Integer, String> httpDetails =
+ new RESTManager().post("http://localhost:6668/api/nslcm/v1/ns/1234567890/heal", "username", "password",
+ new HashMap<String, String>(), "application/json", "Some Request Here");
+ assertNotNull(httpDetails);
+ assertTrue(httpDetails.a == 202);
+ final VFCResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, VFCResponse.class);
+ assertNotNull(response);
+ }
- @Test
- public void testGet() {
- final Pair<Integer, String> httpDetails =
- new RESTManager().get("http://localhost:6668/api/nslcm/v1/jobs/1234", "username", "password",
- new HashMap<String, String>());
- assertNotNull(httpDetails);
- final VFCResponse response =
- Serialization.gsonPretty.fromJson(httpDetails.b, VFCResponse.class);
- assertNotNull(response);
- }
+ @Test
+ public void testGet() {
+ final Pair<Integer, String> httpDetails = new RESTManager().get("http://localhost:6668/api/nslcm/v1/jobs/1234",
+ "username", "password", new HashMap<String, String>());
+ assertNotNull(httpDetails);
+ final VFCResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, VFCResponse.class);
+ assertNotNull(response);
+ }
}