aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/openecomp/vid/controller
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main/java/org/openecomp/vid/controller')
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/controller/AaiController.java952
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/controller/BrowseServiceTypesController.java87
-rw-r--r--vid-app-common/src/main/java/org/openecomp/vid/controller/ChangeManagementController.java71
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/controller/HealthCheckController.java196
-rw-r--r--vid-app-common/src/main/java/org/openecomp/vid/controller/MsoConfig.java29
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/controller/MsoController.java770
-rw-r--r--vid-app-common/src/main/java/org/openecomp/vid/controller/PolicyController.java90
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/controller/PropertyController.java122
-rw-r--r--vid-app-common/src/main/java/org/openecomp/vid/controller/SchedulerController.java244
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java119
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/controller/ViewEditSubController.java107
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/controller/ViewLogController.java84
-rw-r--r--vid-app-common/src/main/java/org/openecomp/vid/controller/WebConfig.java122
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/controller/test/TestAaiController.java93
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/controller/test/TestAsdcController.java112
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/controller/test/TestMsoController.java729
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/controller/test/TestPageController.java57
17 files changed, 0 insertions, 3984 deletions
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/AaiController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/AaiController.java
deleted file mode 100755
index a8bdf39b..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/AaiController.java
+++ /dev/null
@@ -1,952 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.controller;
-
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-import org.json.simple.parser.JSONParser;
-import org.openecomp.aai.util.AAIRestInterface;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.domain.User;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.openecomp.vid.aai.AaiResponse;
-import org.openecomp.vid.aai.SubscriberData;
-import org.openecomp.vid.aai.SubscriberFilteredResults;
-import org.openecomp.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
-import org.openecomp.vid.model.VersionByInvariantIdsRequest;
-import org.openecomp.vid.roles.Role;
-import org.openecomp.vid.roles.RoleProvider;
-import org.openecomp.vid.roles.RoleValidator;
-import org.openecomp.vid.services.AaiService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.servlet.ModelAndView;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
-import java.io.File;
-import java.io.IOException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-/**
- * Controller to handle a&ai requests.
- */
-
-@RestController
-public class AaiController extends RestrictedBaseController {
-
- /**
- * The Constant dateFormat.
- */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
- /**
- * The from app id.
- */
- protected String fromAppId = "VidAaiController";
- /**
- * The view name.
- */
- String viewName;
- /**
- * The logger.
- */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AaiController.class);
- /**
- * The model.
- */
- private Map<String, Object> model = new HashMap<String, Object>();
- /**
- * The servlet context.
- */
- @Autowired
- private ServletContext servletContext;
- /**
- * aai service
- */
- @Autowired
- private AaiService aaiService;
- public AaiController() {
-
- }
-
- public AaiController(ServletContext servletContext) {
- this.servletContext = servletContext;
-
- }
-
- /**
- * Return tenant details.
- *
- * @param jsonObject the json object
- * @return String The parsing results
- */
- public static String parseCustomerObjectForTenants(JSONObject jsonObject) {
-
- JSONArray tenantArray = new JSONArray();
- boolean bconvert = false;
-
- try {
-
- JSONObject serviceSubsObj = (JSONObject) jsonObject.get("service-subscriptions");
-
- if (serviceSubsObj != null) {
- JSONArray srvcSubArray = (JSONArray) serviceSubsObj.get("service-subscription");
-
- if (srvcSubArray != null) {
- Iterator i = srvcSubArray.iterator();
-
- while (i.hasNext()) {
-
- JSONObject innerObj = (JSONObject) i.next();
-
- if (innerObj == null)
- continue;
-
- JSONObject relationShipListsObj = (JSONObject) innerObj.get("relationship-list");
- if (relationShipListsObj != null) {
- JSONArray rShipArray = (JSONArray) relationShipListsObj.get("relationship");
- if (rShipArray != null) {
- Iterator i1 = rShipArray.iterator();
-
- while (i1.hasNext()) {
-
- JSONObject inner1Obj = (JSONObject) i1.next();
-
- if (inner1Obj == null)
- continue;
-
- String relatedTo = checkForNull((String) inner1Obj.get("related-to"));
- if (relatedTo.equalsIgnoreCase("tenant")) {
- JSONObject tenantNewObj = new JSONObject();
-
- String relatedLink = checkForNull((String) inner1Obj.get("related-link"));
- tenantNewObj.put("link", relatedLink);
-
- JSONArray rDataArray = (JSONArray) inner1Obj.get("relationship-data");
- if (rDataArray != null) {
- Iterator i2 = rDataArray.iterator();
-
- while (i2.hasNext()) {
- JSONObject inner2Obj = (JSONObject) i2.next();
-
- if (inner2Obj == null)
- continue;
-
- String rShipKey = checkForNull((String) inner2Obj.get("relationship-key"));
- String rShipVal = checkForNull((String) inner2Obj.get("relationship-value"));
- if (rShipKey.equalsIgnoreCase("cloud-region.cloud-owner")) {
- tenantNewObj.put("cloudOwner", rShipVal);
- } else if (rShipKey.equalsIgnoreCase("cloud-region.cloud-region-id")) {
- tenantNewObj.put("cloudRegionID", rShipVal);
- }
-
- if (rShipKey.equalsIgnoreCase("tenant.tenant-id")) {
- tenantNewObj.put("tenantID", rShipVal);
- }
- }
- }
-
- JSONArray relatedTPropArray = (JSONArray) inner1Obj.get("related-to-property");
- if (relatedTPropArray != null) {
- Iterator i3 = relatedTPropArray.iterator();
-
- while (i3.hasNext()) {
- JSONObject inner3Obj = (JSONObject) i3.next();
-
- if (inner3Obj == null)
- continue;
-
- String propKey = checkForNull((String) inner3Obj.get("property-key"));
- String propVal = checkForNull((String) inner3Obj.get("property-value"));
- if (propKey.equalsIgnoreCase("tenant.tenant-name")) {
- tenantNewObj.put("tenantName", propVal);
- }
- }
- }
- bconvert = true;
- tenantArray.add(tenantNewObj);
- }
- }
- }
- }
- }
- }
- }
- } catch (NullPointerException ex) {
-
-
- }
-
- if (bconvert)
- return tenantArray.toJSONString();
- else
- return "";
-
- }
-
-
- /**
- * Retrieve the service subscription from the jsonObject.
- *
- * @param jsonObject the json object
- * @return String
- */
- public static String parseServiceSubscriptionObjectForTenants(JSONObject jsonObject) {
-
- JSONArray tenantArray = new JSONArray();
- boolean bconvert = false;
-
- try {
- JSONObject relationShipListsObj = (JSONObject) jsonObject.get("relationship-list");
- if (relationShipListsObj != null) {
- JSONArray rShipArray = (JSONArray) relationShipListsObj.get("relationship");
- if (rShipArray != null) {
- Iterator i1 = rShipArray.iterator();
-
- while (i1.hasNext()) {
-
- JSONObject inner1Obj = (JSONObject) i1.next();
-
- if (inner1Obj == null)
- continue;
-
- String relatedTo = checkForNull((String) inner1Obj.get("related-to"));
- if (relatedTo.equalsIgnoreCase("tenant")) {
- JSONObject tenantNewObj = new JSONObject();
-
- String relatedLink = checkForNull((String) inner1Obj.get("related-link"));
- tenantNewObj.put("link", relatedLink);
-
- JSONArray rDataArray = (JSONArray) inner1Obj.get("relationship-data");
- if (rDataArray != null) {
- Iterator i2 = rDataArray.iterator();
-
- while (i2.hasNext()) {
- JSONObject inner2Obj = (JSONObject) i2.next();
-
- if (inner2Obj == null)
- continue;
-
- String rShipKey = checkForNull((String) inner2Obj.get("relationship-key"));
- String rShipVal = checkForNull((String) inner2Obj.get("relationship-value"));
- if (rShipKey.equalsIgnoreCase("cloud-region.cloud-owner")) {
- tenantNewObj.put("cloudOwner", rShipVal);
- } else if (rShipKey.equalsIgnoreCase("cloud-region.cloud-region-id")) {
- tenantNewObj.put("cloudRegionID", rShipVal);
- }
-
- if (rShipKey.equalsIgnoreCase("tenant.tenant-id")) {
- tenantNewObj.put("tenantID", rShipVal);
- }
- }
- }
-
- JSONArray relatedTPropArray = (JSONArray) inner1Obj.get("related-to-property");
- if (relatedTPropArray != null) {
- Iterator i3 = relatedTPropArray.iterator();
-
- while (i3.hasNext()) {
- JSONObject inner3Obj = (JSONObject) i3.next();
-
- if (inner3Obj == null)
- continue;
-
- String propKey = checkForNull((String) inner3Obj.get("property-key"));
- String propVal = checkForNull((String) inner3Obj.get("property-value"));
- if (propKey.equalsIgnoreCase("tenant.tenant-name")) {
- tenantNewObj.put("tenantName", propVal);
- }
- }
- }
- bconvert = true;
- tenantArray.add(tenantNewObj);
- }
- }
-
- }
- }
- } catch (NullPointerException ex) {
-
-
- }
-
- if (bconvert)
- return tenantArray.toJSONString();
- else
- return "";
-
- }
-
- /**
- * Check for null.
- *
- * @param local the local
- * @return the string
- */
- private static String checkForNull(String local) {
- if (local != null)
- return local;
- else
- return "";
-
- }
-
- /**
- * Welcome method.
- *
- * @param request the request
- * @return ModelAndView The view
- */
- @RequestMapping(value = {"/subscriberSearch"}, method = RequestMethod.GET)
- public ModelAndView welcome(HttpServletRequest request) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== AaiController welcome start");
- return new ModelAndView(getViewName());
- }
-
- @RequestMapping(value = {"/aai_get_aic_zones"}, method = RequestMethod.GET)
- public ResponseEntity<String> getAicZones(HttpServletRequest request) throws JsonGenerationException, JsonMappingException, IOException {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== getAicZones controller start");
- AaiResponse response = aaiService.getAaiZones();
- return aaiResponseToResponseEntity(response);
- }
-
- @RequestMapping(value = {"/aai_get_aic_zone_for_pnf/{globalCustomerId}/{serviceType}/{serviceId}"}, method = RequestMethod.GET)
- public ResponseEntity<String> getAicZoneForPnf(@PathVariable("globalCustomerId") String globalCustomerId ,@PathVariable("serviceType") String serviceType , @PathVariable("serviceId") String serviceId ,HttpServletRequest request) throws JsonGenerationException, JsonMappingException, IOException {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== getAicZoneForPnf controller start");
- AaiResponse response = aaiService.getAicZoneForPnf(globalCustomerId , serviceType , serviceId);
- return aaiResponseToResponseEntity(response);
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#getViewName()
- */
- public String getViewName() {
- return viewName;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#setViewName(java.lang.String)
- */
- public void setViewName(String viewName) {
- this.viewName = viewName;
- }
-
- /**
- * Get services from a&ai.
- *
- * @return ResponseEntity<String> The response entity with the logged in user uuid.
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws InterruptedException the interrupted exception
- */
- @RequestMapping(value = {"/getuserID"}, method = RequestMethod.GET)
- public ResponseEntity<String> getUserID(HttpServletRequest request) throws IOException, InterruptedException {
-
- String userId = "";
- HttpSession session = request.getSession();
- if (session != null) {
- User user = (User) session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME));
- if (user != null) {
- //userId = user.getHrid();
- userId = user.getLoginId();
- if (userId == null)
- userId = user.getOrgUserId();
- }
- }
-
- return new ResponseEntity<String>(userId, HttpStatus.OK);
- }
-
- /**
- * Get services from a&ai.
- *
- * @return ResponseEntity<String> The response entity
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws InterruptedException the interrupted exception
- */
- @RequestMapping(value = "/aai_get_services", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<String> doGetServices(HttpServletRequest request) throws IOException, InterruptedException {
-
- RoleValidator roleValidator = new RoleValidator(new RoleProvider().getUserRoles(request));
-
- AaiResponse subscriberList = aaiService.getServices(roleValidator);
- ResponseEntity<String> responseEntity = aaiResponseToResponseEntity(subscriberList);
-
- return responseEntity;
- }
-
-
- @RequestMapping(value = {"/aai_get_version_by_invariant_id"}, method = RequestMethod.POST)
- public ResponseEntity<String> getVersionByInvariantId(HttpServletRequest request, @RequestBody VersionByInvariantIdsRequest versions) throws IOException {
- ResponseEntity<String> responseEntity;
- ObjectMapper objectMapper = new ObjectMapper();
-
- Response result = aaiService.getVersionByInvariantId(versions.versions);
-
- return new ResponseEntity<String>(result.readEntity(String.class), HttpStatus.OK);
- }
-
-
- private ResponseEntity<String> aaiResponseToResponseEntity(AaiResponse aaiResponseData)
- throws IOException, JsonGenerationException, JsonMappingException {
- ResponseEntity<String> responseEntity;
- ObjectMapper objectMapper = new ObjectMapper();
- if (aaiResponseData.getHttpCode() == 200) {
- responseEntity = new ResponseEntity<String>(objectMapper.writeValueAsString(aaiResponseData.getT()), HttpStatus.OK);
- } else {
- responseEntity = new ResponseEntity<String>(aaiResponseData.getErrorMessage(), HttpStatus.valueOf(aaiResponseData.getHttpCode()));
- }
- return responseEntity;
- }
-
- /**
- * Lookup single service instance in a&ai. Get the service-subscription and customer, too, i guess?
- *
- * @param serviceInstanceId the service instance Id
- * @return ResponseEntity The response entity
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws InterruptedException the interrupted exception
- */
- @RequestMapping(value = "/aai_get_service_instance/{service-instance-id}/{service-instance-type}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<String> doGetServiceInstance(@PathVariable("service-instance-id") String serviceInstanceId, @PathVariable("service-instance-type") String serviceInstanceType) throws IOException, InterruptedException {
- File certiPath = GetCertificatesPath();
- Response resp = null;
-
- if (serviceInstanceType.equalsIgnoreCase("Service Instance Id")) {
- resp = doAaiGet(certiPath.getAbsolutePath(),
- "search/nodes-query?search-node-type=service-instance&filter=service-instance-id:EQUALS:"
- + serviceInstanceId, false);
- } else {
- resp = doAaiGet(certiPath.getAbsolutePath(),
- "search/nodes-query?search-node-type=service-instance&filter=service-instance-name:EQUALS:"
- + serviceInstanceId, false);
- }
- return convertResponseToResponseEntity(resp);
- }
-
- /**
- * Get services from a&ai.
- *
- * @param globalCustomerId the global customer id
- * @param serviceSubscriptionId the service subscription id
- * @return ResponseEntity The response entity
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws InterruptedException the interrupted exception
- */
- @RequestMapping(value = "/aai_get_service_subscription/{global-customer-id}/{service-subscription-id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<String> doGetServices(@PathVariable("global-customer-id") String globalCustomerId,
- @PathVariable("service-subscription-id") String serviceSubscriptionId) throws IOException, InterruptedException {
- File certiPath = GetCertificatesPath();
- Response resp = doAaiGet(certiPath.getAbsolutePath(), "business/customers/customer/" + globalCustomerId
- + "/service-subscriptions/service-subscription/" + serviceSubscriptionId + "?depth=0", false);
- return convertResponseToResponseEntity(resp);
- }
-
- /**
- * Obtain the subscriber list from a&ai.
- *
- * @param fullSet the full set
- * @return ResponseEntity The response entity
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws InterruptedException the interrupted exception
- */
- @RequestMapping(value = "/aai_get_subscribers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<String> doGetSubscriberList(HttpServletRequest request, @DefaultValue("n") @QueryParam("fullSet") String fullSet) throws IOException, InterruptedException {
- return getFullSubscriberList(request);
- }
-
- /**
- * Obtain the Target Prov Status from the System.Properties file.
- *
- * @return ResponseEntity The response entity
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws InterruptedException the interrupted exception
- */
- @RequestMapping(value = "/get_system_prop_vnf_prov_status", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<String> getTargetProvStatus() throws IOException, InterruptedException {
- String p = SystemProperties.getProperty("aai.vnf.provstatus");
- return new ResponseEntity<String>(p, HttpStatus.OK);
- }
-
- /**
- * Obtain the full subscriber list from a&ai.
- * <p>
- * g @return ResponseEntity The response entity
- *
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws InterruptedException the interrupted exception
- */
- @RequestMapping(value = "/aai_get_full_subscribers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<String> getFullSubscriberList(HttpServletRequest request) throws IOException, InterruptedException {
- ObjectMapper objectMapper = new ObjectMapper();
- ResponseEntity<String> responseEntity;
- RoleValidator roleValidator = new RoleValidator(new RoleProvider().getUserRoles(request));
- SubscriberFilteredResults subscriberList = aaiService.getFullSubscriberList(roleValidator);
- if (subscriberList.getHttpCode() == 200) {
- responseEntity = new ResponseEntity<String>(objectMapper.writeValueAsString(subscriberList.getSubscriberList()), HttpStatus.OK);
- } else {
- responseEntity = new ResponseEntity<String>(subscriberList.getErrorMessage(), HttpStatus.valueOf(subscriberList.getHttpCode()));
- }
-
-
- return responseEntity;
- }
-
-
- @RequestMapping(value = "/get_vnf_data_by_globalid_and_service_type/{globalCustomerId}/{serviceType}",
- method = RequestMethod.GET,
- produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<String> getVnfDataByGlobalIdAndServiceType(HttpServletRequest request,
- @PathVariable("globalCustomerId") String globalCustomerId,
- @PathVariable("serviceType") String serviceType) throws IOException {
-
- Response resp = aaiService.getVNFData(globalCustomerId, serviceType);
- return convertResponseToResponseEntity(resp);
- }
-
-
- /**
- * Refresh the subscriber list from a&ai.
- *
- * @return ResponseEntity The response entity
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @RequestMapping(value = "/aai_refresh_subscribers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<String> doRefreshSubscriberList() throws IOException {
- Response resp = getSubscribers(false);
- return convertResponseToResponseEntity(resp);
- }
-
- /**
- * Refresh the full subscriber list from a&ai.
- *
- * @return ResponseEntity The response entity
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @RequestMapping(value = "/aai_refresh_full_subscribers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<String> doRefreshFullSubscriberList() throws IOException {
- Response resp = getSubscribers(false);
- return convertResponseToResponseEntity(resp);
- }
-
- /**
- * Get subscriber details from a&ai.
- *
- * @param subscriberId the subscriber id
- * @return ResponseEntity The response entity
- */
- @RequestMapping(value = "/aai_sub_details/{subscriberId}", method = RequestMethod.GET)
- public ResponseEntity<String> GetSubscriberDetails(HttpServletRequest request, @PathVariable("subscriberId") String subscriberId) throws IOException {
- ObjectMapper objectMapper = new ObjectMapper();
- ResponseEntity responseEntity;
- List<Role> roles = new RoleProvider().getUserRoles(request);
- RoleValidator roleValidator = new RoleValidator(roles);
- AaiResponse<SubscriberData> subscriberData = aaiService.getSubscriberData(subscriberId, roleValidator);
- String httpMessage = subscriberData.getT() != null ?
- objectMapper.writeValueAsString(subscriberData.getT()) :
- subscriberData.getErrorMessage();
-
- responseEntity = new ResponseEntity<String>(httpMessage, HttpStatus.valueOf(subscriberData.getHttpCode()));
- return responseEntity;
- }
-
- /**
- * Issue a named query to a&ai.
- *
- * @param namedQueryId the named query id
- * @param globalCustomerId the global customer id
- * @param serviceType the service type
- * @param serviceInstance the service instance
- * @return ResponseEntity The response entity
- */
- @RequestMapping(value = "/aai_sub_viewedit/{namedQueryId}/{globalCustomerId}/{serviceType}/{serviceInstance}", method = RequestMethod.GET)
- public ResponseEntity<String> viewEditGetComponentList(
- @PathVariable("namedQueryId") String namedQueryId,
- @PathVariable("globalCustomerId") String globalCustomerId,
- @PathVariable("serviceType") String serviceType,
- @PathVariable("serviceInstance") String serviceInstance) {
-
- String componentListPayload = getComponentListPutPayload(namedQueryId, globalCustomerId, serviceType, serviceInstance);
- File certiPath = GetCertificatesPath();
-
- Response resp = doAaiPost(certiPath.getAbsolutePath(), "search/named-query", componentListPayload, false);
- return convertResponseToResponseEntity(resp);
- }
-
-
- @RequestMapping(value = "/aai_get_vnf_data/{globalCustomerId}/{serviceType}/{serviceInstanceId}", method = RequestMethod.GET)
- public AaiResponse<String> getVnfData(
- @PathVariable("globalCustomerId") String globalCustomerId,
- @PathVariable("serviceType") String serviceType,
- @PathVariable("serviceInstanceId") String serviceInstanceId) {
-
- return aaiService.getVNFData(globalCustomerId, serviceType, serviceInstanceId);
-
- }
-
-
- // @RequestMapping(value="/aai_get_tenants/{global-customer-id}", method = RequestMethod.GET)
- // public ResponseEntity<String> viewEditGetComponentList(
- // @PathVariable("global-customer-id") String globalCustomerId) {
- // return new ResponseEntity<String>(getTenants(globalCustomerId), HttpStatus.OK);
- // }
-
- /**
- * Issue a named query to a&ai.
- *
- * @param namedQueryId the named query id
- * @param globalCustomerId the global customer id
- * @param serviceType the service type
- * @return ResponseEntity The response entity
- */
- @RequestMapping(value = "/aai_get_models_by_service_type/{namedQueryId}/{globalCustomerId}/{serviceType}", method = RequestMethod.GET)
- public ResponseEntity<String> viewEditGetComponentList(
- @PathVariable("namedQueryId") String namedQueryId,
- @PathVariable("globalCustomerId") String globalCustomerId,
- @PathVariable("serviceType") String serviceType) {
-
- String componentListPayload = getModelsByServiceTypePayload(namedQueryId, globalCustomerId, serviceType);
- File certiPath = GetCertificatesPath();
-
- Response resp = doAaiPost(certiPath.getAbsolutePath(), "search/named-query", componentListPayload, false);
- return convertResponseToResponseEntity(resp);
- }
-
- /**
- * Parses the for tenants.
- *
- * @param resp the resp
- * @return the string
- */
- private String parseForTenants(String resp) {
- String tenantList = "";
-
- try {
- JSONParser jsonParser = new JSONParser();
-
- JSONObject jsonObject = (JSONObject) jsonParser.parse(resp);
-
- return parseCustomerObjectForTenants(jsonObject);
- } catch (Exception ex) {
-
- }
-
- return tenantList;
- }
-
- /**
- * Parses the for tenants by service subscription.
- *
- * @param resp the resp
- * @return the string
- */
- private String parseForTenantsByServiceSubscription(String resp) {
- String tenantList = "";
-
- try {
- JSONParser jsonParser = new JSONParser();
-
- JSONObject jsonObject = (JSONObject) jsonParser.parse(resp);
-
- return parseServiceSubscriptionObjectForTenants(jsonObject);
- } catch (Exception ex) {
-
- }
-
- return tenantList;
- }
-
- /**
- * Obtain tenants for a given service type.
- *
- * @param globalCustomerId the global customer id
- * @param serviceType the service type
- * @return ResponseEntity The response entity
- */
- @RequestMapping(value = "/aai_get_tenants/{global-customer-id}/{service-type}", method = RequestMethod.GET)
- public ResponseEntity<String> viewEditGetTenantsFromServiceType(HttpServletRequest request,
- @PathVariable("global-customer-id") String globalCustomerId, @PathVariable("service-type") String serviceType) {
-
- ResponseEntity responseEntity;
- try {
- ObjectMapper objectMapper = new ObjectMapper();
- List<Role> roles = new RoleProvider().getUserRoles(request);
- RoleValidator roleValidator = new RoleValidator(roles);
- AaiResponse<GetTenantsResponse[]> response = aaiService.getTenants(globalCustomerId, serviceType, roleValidator);
- if (response.getHttpCode() == 200) {
- responseEntity = new ResponseEntity<String>(objectMapper.writeValueAsString(response.getT()), HttpStatus.OK);
- } else {
- responseEntity = new ResponseEntity<String>(response.getErrorMessage(), HttpStatus.valueOf(response.getHttpCode()));
- }
- } catch (Exception e) {
- responseEntity = new ResponseEntity<String>("Unable to proccess getTenants reponse", HttpStatus.INTERNAL_SERVER_ERROR);
- }
- return responseEntity;
- }
-
-
- private ResponseEntity<String> convertResponseToResponseEntity(Response resp) {
- ResponseEntity<String> respEnt;
- ObjectMapper objectMapper = new ObjectMapper();
- if (resp == null) {
- respEnt = new ResponseEntity<String>("Failed to fetch data from A&AI, check server logs for details.", HttpStatus.INTERNAL_SERVER_ERROR);
- } else {
- respEnt = new ResponseEntity<String>(resp.readEntity(String.class), HttpStatus.valueOf(resp.getStatus()));
- }
- return respEnt;
- }
-
- /**
- * Gets the tenants.
- *
- * @param globalCustomerId the global customer id
- * @return the tenants
- */
- private ResponseEntity<String> getTenants(String globalCustomerId) {
- File certiPath = GetCertificatesPath();
- Response resp = doAaiGet(certiPath.getAbsolutePath(), "business/customers/customer/" + globalCustomerId, false);
-
- ResponseEntity<String> respEnt;
- if (resp.getStatus() >= 200 && resp.getStatus() <= 299) {
- respEnt = new ResponseEntity<String>(parseForTenants((String) resp.readEntity(String.class)), HttpStatus.OK);
- } else {
- respEnt = new ResponseEntity<String>((String) resp.readEntity(String.class), HttpStatus.valueOf(resp.getStatus()));
- }
- return respEnt;
-
- }
-
- /**
- * Gets the tenants from service type.
- *
- * @param globalCustomerId the global customer id
- * @param serviceType the service type
- * @return the tenants from service type
- */
- private ResponseEntity<String> getTenantsFromServiceType(String globalCustomerId, String serviceType) {
-
-
- File certiPath = GetCertificatesPath();
- String url = "business/customers/customer/" + globalCustomerId + "/service-subscriptions/service-subscription/" + serviceType;
-
- Response resp = doAaiGet(certiPath.getAbsolutePath(), url, false);
-
- ResponseEntity<String> respEnt;
- if (resp.getStatus() >= 200 && resp.getStatus() <= 299) {
- respEnt = new ResponseEntity<String>(parseForTenantsByServiceSubscription((String) resp.readEntity(String.class)), HttpStatus.OK);
- } else {
- respEnt = new ResponseEntity<String>((String) resp.readEntity(String.class), HttpStatus.valueOf(resp.getStatus()));
- }
- return respEnt;
-
- }
-
- /**
- * Gets the services.
- *
- * @return the services
- */
- private Response getServices() {
- File certiPath = GetCertificatesPath();
- Response resp = doAaiGet(certiPath.getAbsolutePath(), "service-design-and-creation/services", false);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "getServices() resp=" + resp.getStatusInfo());
-
- //model.put("aai_get_services", resp);
- return resp;
- }
-
- /**
- * Gets the subscribers.
- *
- * @param isFullSet the is full set
- * @return the subscribers
- */
- private Response getSubscribers(boolean isFullSet) {
-
- File certiPath = GetCertificatesPath();
- String depth = "0";
-
- Response resp = doAaiGet(certiPath.getAbsolutePath(), "business/customers?subscriber-type=INFRA&depth=" + depth, false);
- if (resp != null) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "getSubscribers() resp=" + resp.getStatusInfo().toString());
- }
- return resp;
- }
-
- /**
- * Gets the subscriber details.
- *
- * @param subscriberId the subscriber id
- * @return the subscriber details
- */
- private Response getSubscriberDetails(String subscriberId) {
- File certiPath = GetCertificatesPath();
- Response resp = doAaiGet(certiPath.getAbsolutePath(), "business/customers/customer/" + subscriberId + "?depth=2", false);
- //String resp = doAaiGet(certiPath.getAbsolutePath(), "business/customers/customer/" + subscriberId, false);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "getSubscriberDetails() resp=" + resp.getStatusInfo().toString());
- return resp;
- }
-
- /**
- * Gets the certificates path.
- *
- * @return the file
- */
- private File GetCertificatesPath() {
- if (servletContext != null)
- return new File(servletContext.getRealPath("/WEB-INF/cert/"));
- return null;
- }
-
- /**
- * Send a GET request to a&ai.
- *
- * @param certiPath the certi path
- * @param uri the uri
- * @param xml the xml
- * @return String The response
- */
- protected Response doAaiGet(String certiPath, String uri, boolean xml) {
- String methodName = "getSubscriberList";
- String transId = UUID.randomUUID().toString();
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- Response resp = null;
- try {
-
- AAIRestInterface restContrller = new AAIRestInterface(certiPath);
- resp = restContrller.RestGet(fromAppId, transId, uri, xml);
-
- } catch (WebApplicationException e) {
- final String message = ((BadRequestException) e).getResponse().readEntity(String.class);
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + message);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + message);
- } catch (Exception e) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- }
-
- return resp;
- }
-
- /**
- * Send a POST request to a&ai.
- *
- * @param certiPath the certi path
- * @param uri the uri
- * @param payload the payload
- * @param xml the xml
- * @return String The response
- */
- protected Response doAaiPost(String certiPath, String uri, String payload, boolean xml) {
- String methodName = "getSubscriberList";
- String transId = UUID.randomUUID().toString();
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- Response resp = null;
- try {
-
- AAIRestInterface restContrller = new AAIRestInterface(certiPath);
- resp = restContrller.RestPost(fromAppId, transId, uri, payload, xml);
-
- } catch (Exception e) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- }
-
- return resp;
- }
-
- /**
- * Gets the component list put payload.
- *
- * @param namedQueryId the named query id
- * @param globalCustomerId the global customer id
- * @param serviceType the service type
- * @param serviceInstance the service instance
- * @return the component list put payload
- */
- private String getComponentListPutPayload(String namedQueryId, String globalCustomerId, String serviceType, String serviceInstance) {
- return
- " {" +
- " \"instance-filters\": {" +
- " \"instance-filter\": [" +
- " {" +
- " \"customer\": {" +
- " \"global-customer-id\": \"" + globalCustomerId + "\"" +
- " }," +
- " \"service-instance\": {" +
- " \"service-instance-id\": \"" + serviceInstance + "\"" +
- " }," +
- " \"service-subscription\": {" +
- " \"service-type\": \"" + serviceType + "\"" +
- " }" +
- " }" +
- " ]" +
- " }," +
- " \"query-parameters\": {" +
- " \"named-query\": {" +
- " \"named-query-uuid\": \"" + namedQueryId + "\"" +
- " }" +
- " }" +
- "}";
-
- }
-
- private String getModelsByServiceTypePayload(String namedQueryId, String globalCustomerId, String serviceType) {
- // TODO Auto-generated method stub
- return " {" +
- " \"instance-filters\": {" +
- " \"instance-filter\": [" +
- " {" +
- " \"customer\": {" +
- " \"global-customer-id\": \"" + globalCustomerId + "\"" +
- " }," +
- " \"service-subscription\": {" +
- " \"service-type\": \"" + serviceType + "\"" +
- " }" +
- " }" +
- " ]" +
- " }," +
- " \"query-parameters\": {" +
- " \"named-query\": {" +
- " \"named-query-uuid\": \"" + namedQueryId + "\"" +
- " }" +
- " }" +
- "}";
-
- }
-}
-
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/BrowseServiceTypesController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/BrowseServiceTypesController.java
deleted file mode 100755
index 0698cfd9..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/BrowseServiceTypesController.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.controller;
-
-
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.servlet.ModelAndView;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-
-
-/**
- * The Class BrowseServiceTypesController.
- */
-@RestController
-public class BrowseServiceTypesController extends RestrictedBaseController{
-
- /** The view name. */
- String viewName;
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(BrowseServiceTypesController.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /** The servlet context. */
- private @Autowired ServletContext servletContext;
-
- /**
- * Welcome.
- *
- * @param request the request
- * @return the model and view
- */
- @RequestMapping(value = {"/browseservicetypes" }, method = RequestMethod.GET)
- public ModelAndView welcome(HttpServletRequest request) {
-
- return new ModelAndView(getViewName());
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#getViewName()
- */
- public String getViewName() {
- return viewName;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#setViewName(java.lang.String)
- */
- public void setViewName(String viewName) {
- this.viewName = viewName;
- }
-
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/ChangeManagementController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/ChangeManagementController.java
deleted file mode 100644
index 1af71546..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/ChangeManagementController.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.openecomp.vid.controller;
-
-import org.json.simple.JSONArray;
-import org.openecomp.portalsdk.core.controller.UnRestrictedBaseController;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.vid.services.ChangeManagementService;
-import org.openecomp.vid.services.WorkflowService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import org.openecomp.vid.changeManagement.ChangeManagementRequest;
-import org.openecomp.vid.mso.rest.Request;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * Controller to handle ChangeManagement feature requests.
- */
-@RestController
-@RequestMapping("change-management")
-public class ChangeManagementController extends UnRestrictedBaseController {
- private EELFLoggerDelegate logger;
- private String fromAppId;
- private final WorkflowService workflowService;
- private final ChangeManagementService changeManagementService;
-
- @Autowired
- public ChangeManagementController(WorkflowService workflowService, ChangeManagementService changeManagementService) {
- this.logger = EELFLoggerDelegate.getLogger(ChangeManagementController.class);
- this.fromAppId = "VidChangeManagementController";
- this.workflowService = workflowService;
- this.changeManagementService = changeManagementService;
- }
-
- @RequestMapping(value = {"/workflow"}, method = RequestMethod.GET)
- public ResponseEntity<Collection<String>> getWorkflow(@RequestParam("vnfs") Collection<String> vnfs) throws IOException, InterruptedException {
- Collection<String> result = this.workflowService.getWorkflowsForVNFs(vnfs);
- return new ResponseEntity<>(result, HttpStatus.OK);
- }
-
- @RequestMapping(value = {"/mso"}, method = RequestMethod.GET)
- public ResponseEntity<Collection<Request>> getMSOChangeManagements() throws IOException, InterruptedException {
- Collection<Request> result = this.changeManagementService.getMSOChangeManagements();
- return new ResponseEntity<>(result, HttpStatus.OK);
- }
-
- @RequestMapping(value = "/workflow/{vnfName}", method = RequestMethod.POST)
- public ResponseEntity<String> changeManagement(@PathVariable("vnfName") String vnfName,
- HttpServletRequest request,
- @RequestBody ChangeManagementRequest changeManagmentRequest)
- throws Exception {
- return this.changeManagementService.doChangeManagement(changeManagmentRequest, vnfName);
- }
-
-
- @RequestMapping(value = {"/scheduler"}, method = RequestMethod.GET)
- public ResponseEntity<JSONArray> getSchedulerChangeManagements() throws IOException, InterruptedException {
- JSONArray result = this.changeManagementService.getSchedulerChangeManagements();
- return new ResponseEntity<>(result, HttpStatus.OK);
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/HealthCheckController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/HealthCheckController.java
deleted file mode 100755
index abef8d62..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/HealthCheckController.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.controller;
-
-import java.io.IOException;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import org.openecomp.portalsdk.core.controller.UnRestrictedBaseController;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.openecomp.vid.dao.FnAppDoaImpl;
-
-/**
- * Controller for user profile view. The view is restricted to authenticated
- * users. The view name resolves to page user_profile.jsp which uses Angular.
- */
-
-@RestController
-@RequestMapping("/")
-public class HealthCheckController extends UnRestrictedBaseController {
-
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HealthCheckController.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- private static final String HEALTH_CHECK_PATH = "/healthCheck";
-
- /**
- * Model for JSON response with health-check results.
- */
- public class HealthStatus {
- // Either 200 or 500
- public int statusCode;
-
- // Additional detail in case of error, empty in case of success.
- public String message;
-
- public String date;
-
- public HealthStatus(int code, String msg) {
- this.statusCode = code;
- this.message = msg;
- }
-
- public HealthStatus(int code,String date, String msg) {
- this.statusCode = code;
- this.message = msg;
- this.date=date;
- }
-
- public int getStatusCode() {
- return statusCode;
- }
-
- public void setStatusCode(int code) {
- this.statusCode = code;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String msg) {
- this.message = msg;
- }
-
- public String getDate() {
- return date;
- }
-
- public void setDate(String date) {
- this.date = date;
- }
-
- }
-
- @SuppressWarnings("unchecked")
- public int getProfileCount(String driver, String URL, String username, String password) {
- FnAppDoaImpl doa= new FnAppDoaImpl();
- int count= doa.getProfileCount(driver,URL,username,password);
- return count;
- }
-
-
-
- /**
- * Obtain the HealthCheck Status from the System.Properties file.
- * Used by IDNS for redundancy
- * @return ResponseEntity The response entity
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws InterruptedException the interrupted exception
- */
- @RequestMapping(value="/healthCheck",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public HealthStatus gethealthCheckStatusforIDNS() throws IOException, InterruptedException {
-
- String driver = SystemProperties.getProperty("db.driver");
- String URL = SystemProperties.getProperty("db.connectionURL");
- String username = SystemProperties.getProperty("db.userName");
- String password = SystemProperties.getProperty("db.password");
-
- logger.debug(EELFLoggerDelegate.debugLogger, "driver ::" + driver);
- logger.debug(EELFLoggerDelegate.debugLogger, "URL::" + URL);
- logger.debug(EELFLoggerDelegate.debugLogger, "username::" + username);
- logger.debug(EELFLoggerDelegate.debugLogger,"password::" + password);
-
-
- HealthStatus healthStatus = null;
- try {
- logger.debug(EELFLoggerDelegate.debugLogger, "Performing health check");
- int count=getProfileCount(driver,URL,username,password);
- logger.debug(EELFLoggerDelegate.debugLogger,"count:::"+count);
- healthStatus = new HealthStatus(200, "health check succeeded");
- } catch (Exception ex) {
-
- logger.error(EELFLoggerDelegate.errorLogger, "Failed to perform health check", ex);
- healthStatus = new HealthStatus(500, "health check failed: " + ex.toString());
- }
- return healthStatus;
- }
-
- /**
- * Obtain the HealthCheck Status from the System.Properties file.
- *
- * @return ResponseEntity The response entity
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws InterruptedException the interrupted exception
- * Project :
- */
- @RequestMapping(value="rest/healthCheck/{User-Agent}/{X-ECOMP-RequestID}",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public HealthStatus getHealthCheck(
- @PathVariable("User-Agent") String UserAgent,
- @PathVariable("X-ECOMP-RequestID") String ECOMPRequestID) throws IOException, InterruptedException {
-
- String driver = SystemProperties.getProperty("db.driver");
- String URL = SystemProperties.getProperty("db.connectionURL");
- String username = SystemProperties.getProperty("db.userName");
- String password = SystemProperties.getProperty("db.password");
-
- logger.debug(EELFLoggerDelegate.debugLogger, "driver ::" + driver);
- logger.debug(EELFLoggerDelegate.debugLogger, "URL::" + URL);
- logger.debug(EELFLoggerDelegate.debugLogger, "username::" + username);
- logger.debug(EELFLoggerDelegate.debugLogger,"password::" + password);
-
-
- HealthStatus healthStatus = null;
- try {
- logger.debug(EELFLoggerDelegate.debugLogger, "Performing health check");
- logger.debug(EELFLoggerDelegate.debugLogger, "User-Agent" + UserAgent);
- logger.debug(EELFLoggerDelegate.debugLogger, "X-ECOMP-RequestID" + ECOMPRequestID);
-
-
- int count=getProfileCount(driver,URL,username,password);
-
- logger.debug(EELFLoggerDelegate.debugLogger,"count:::"+count);
- healthStatus = new HealthStatus(200,dateFormat.format(new Date()) ,"health check succeeded");
- } catch (Exception ex) {
-
- logger.error(EELFLoggerDelegate.errorLogger, "Failed to perform health check", ex);
- healthStatus = new HealthStatus(500,dateFormat.format(new Date()),"health check failed: " + ex.toString());
- }
- return healthStatus;
- }
-}
-
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/MsoConfig.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/MsoConfig.java
deleted file mode 100644
index e0b59204..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/MsoConfig.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.openecomp.vid.controller;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.openecomp.vid.factories.MsoRequestFactory;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-
-@Configuration
-public class MsoConfig {
-
- /**
- * Gets the object mapper.
- *
- * @return the object mapper
- */
- @Bean
- public ObjectMapper getObjectMapper() {
- return new ObjectMapper();
- }
-
- @Bean
- public MsoRequestFactory createRequestDetailsFactory(){
- return new MsoRequestFactory();
- }
-
-
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/MsoController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/MsoController.java
deleted file mode 100755
index 451b19de..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/MsoController.java
+++ /dev/null
@@ -1,770 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.controller;
-
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-//import java.util.UUID;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Scanner;
-import java.util.stream.Collectors;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.codehaus.jackson.JsonEncoding;
-import org.codehaus.jackson.JsonFactory;
-import org.codehaus.jackson.JsonGenerator;
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
-import org.glassfish.jersey.client.ClientResponse;
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-import org.json.simple.parser.JSONParser;
-import org.openecomp.vid.model.ExceptionResponse;
-import org.openecomp.vid.mso.*;
-import org.openecomp.vid.mso.rest.*;
-import org.springframework.http.HttpStatus;
-//import org.springframework.http.ResponseEntity;
-//import org.springframework.http.RequestEntity;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.servlet.ModelAndView;
-
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.ObjectReader;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-
-/**
- * The Class MsoController.
- */
-@RestController
-@RequestMapping("mso")
-public class MsoController extends RestrictedBaseController {
-
- /**
- * The view name.
- */
- String viewName;
-
- /**
- * The logger.
- */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoController.class);
-
- /**
- * The Constant dateFormat.
- */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /**
- * The Constant SVC_INSTANCE_ID.
- */
- public final static String SVC_INSTANCE_ID = "<service_instance_id>";
- public final static String REQUEST_TYPE = "<request_type>";
-
- /**
- * The Constant VNF_INSTANCE_ID.
- */
- public final static String VNF_INSTANCE_ID = "<vnf_instance_id>";
-
- /**
- * Welcome.
- *
- * @param request the request
- * @return the model and view
-
- public ModelAndView welcome(HttpServletRequest request) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== MsoController welcome start");
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + " MSO_SERVER_URL=" +
- SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) );
- return new ModelAndView(getViewName());
- }
- */
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#getViewName()
-
- public String getViewName() {
- return viewName;
- }
- */
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#setViewName(java.lang.String)
-
- public void setViewName(String viewName) {
- this.viewName = viewName;
- }
- */
-
- /**
- * Creates the svc instance.
- *
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_create_svc_instance", method = RequestMethod.POST)
- public ResponseEntity<String> createSvcInstance(HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
- String methodName = "createSvcInstance";
-
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- MsoBusinessLogic mbl = new MsoBusinessLogic();
- // always return OK, the MSO status code is embedded in the body
-
- MsoResponseWrapper w = mbl.createSvcInstance(mso_request);
-
- return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
-
- }
-
-
- /**
- * Creates the svc instance.
- *
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
-
- public ResponseEntity<String> createSvcInstanceNewRest(HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
- String methodName = "createSvcInstance";
-
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- MsoBusinessLogicNew mbln = new MsoBusinessLogicNew();
-
- // always return OK, the MSO status code is embedded in the body
-
- MsoResponseWrapper w = mbln.createSvcInstanceRest(mso_request);
-
- if (w == null) {
- return null;
- }
- return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
-
- }
-
- /**
- * Creates the svc instance.
- *
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
-
- public ResponseEntity<String> createSvcInstanceNew(HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
- String methodName = "createSvcInstance";
-
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- MsoBusinessLogicNew mbln = new MsoBusinessLogicNew();
- // always return OK, the MSO status code is embedded in the body
-
- MsoResponseWrapper w = mbln.createSvcInstance(mso_request);
-
- if (w == null) {
- return null;
- }
-
- return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
-
- }
-
- /**
- * Creates the vnf.
- *
- * @param serviceInstanceId the service instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_create_vnf_instance/{serviceInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> createVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
-
- MsoBusinessLogic mbl = new MsoBusinessLogic();
-
- MsoResponseWrapper w = mbl.createVnf(mso_request, serviceInstanceId);
-
- // always return OK, the MSO status code is embedded in the body
-
- return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
-
- }
-
- /**
- * Creates the nw instance.
- *
- * @param serviceInstanceId the service instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_create_nw_instance/{serviceInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> createNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
- String methodName = "createNwInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start, serviceInstanceId = " + serviceInstanceId);
-
- MsoBusinessLogic mbl = new MsoBusinessLogic();
-
- MsoResponseWrapper w = mbl.createNwInstance(mso_request, serviceInstanceId);
-
- return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
-
- }
-
- /**
- * Creates the volume group instance.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_create_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> createVolumeGroupInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
- HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
- String methodName = "createVolumeGroupInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- MsoBusinessLogic mbl = new MsoBusinessLogic();
-
- MsoResponseWrapper w = mbl.createVolumeGroupInstance(mso_request, serviceInstanceId, vnfInstanceId);
-
- // always return OK, the MSO status code is embedded in the body
- return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
- }
-
- /**
- * Creates the vf module instance.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_create_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> createVfModuleInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
- String methodName = "createVfModuleInstance";
-
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- MsoBusinessLogic mbl = new MsoBusinessLogic();
-
- MsoResponseWrapper w = mbl.createVfModuleInstance(mso_request, serviceInstanceId, vnfInstanceId);
-
- // always return OK, the MSO status code is embedded in the body
-
- return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
- }
-
- /**
- * Creates the instance.
- *
- * @param request the request
- * @param path the path
- * @return the mso response wrapper
- * @throws ClientHandlerException the client handler exception
- * @throws Exception the exception
- */
- protected MsoResponseWrapper createInstance(RequestDetails request, String path) throws Exception {
- String methodName = "createInstance";
- logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- try {
- MsoRestInterfaceIfc restController = new MsoRestInterface();
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Post, request = (" + request + ")");
-
- RestObject<String> restObjStr = new RestObject<String>();
- String str = new String();
- restObjStr.set(str);
- restController.<String>Post(str, request, "", path, restObjStr);
- MsoResponseWrapper w = MsoUtil.wrapResponse(restObjStr);
-
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
- return w;
- } catch (Exception e) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- throw e;
- }
- }
-
- /**
- * Delete svc instance.
- *
- * @param serviceInstanceId the service instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_delete_svc_instance/{serviceInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteSvcInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
-
- String methodName = "deleteSvcInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- MsoBusinessLogic mbl = new MsoBusinessLogic();
-
- MsoResponseWrapper w = mbl.deleteSvcInstance(mso_request, serviceInstanceId);
-
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
- // always return OK, the MSO status code is embedded in the body
-
- return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
-
- }
-
- /**
- * Delete vnf.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_delete_vnf_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
-
- public ResponseEntity<String> deleteVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
- HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
- String methodName = "deleteVnf";
-
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- MsoBusinessLogic mlb = new MsoBusinessLogic();
-
- MsoResponseWrapper w = mlb.deleteVnf(mso_request, serviceInstanceId, vnfInstanceId);
-
- // always return OK, the MSO status code is embedded in the body
- return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
-
- }
-
- /**
- * Delete vf module.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param vfModuleId the vf module id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- //mso_delete_vf_module/bc305d54-75b4-431b-adb2-eb6b9e546014/vnfs/fe9000-0009-9999/vfmodules/abeeee-abeeee-abeeee
- @RequestMapping(value = "/mso_delete_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfModuleId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteVfModule(
- @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
- @PathVariable("vfModuleId") String vfModuleId, HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
-
- String methodName = "deleteVfModule";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- MsoBusinessLogic mbl = new MsoBusinessLogic();
-
- MsoResponseWrapper w = mbl.deleteVfModule(mso_request, serviceInstanceId, vnfInstanceId, vfModuleId);
-
- // always return OK, the MSO status code is embedded in the body
- return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
-
- }
-
- /**
- * Delete volume group instance.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param volumeGroupId the volume group id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_delete_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteVolumeGroupInstance(
- @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId, @PathVariable("volumeGroupId") String volumeGroupId,
- HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
- String methodName = "deleteVolumeGroupInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- MsoBusinessLogic mbl = new MsoBusinessLogic();
-
- MsoResponseWrapper w = mbl.deleteVolumeGroupInstance(mso_request, serviceInstanceId, vnfInstanceId, volumeGroupId);
-
- // always return OK, the MSO status code is embedded in the body
- return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
- }
-
- /**
- * Delete nw instance.
- *
- * @param serviceInstanceId the service instance id
- * @param networkInstanceId the network instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_delete_nw_instance/{serviceInstanceId}/networks/{networkInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- @PathVariable("networkInstanceId") String networkInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
- String methodName = "deleteNwInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- MsoBusinessLogic mbl = new MsoBusinessLogic();
-
- MsoResponseWrapper w = mbl.deleteNwInstance(mso_request, serviceInstanceId, networkInstanceId);
-
- // always return OK, the MSO status code is embedded in the body
- return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
-
- }
-
- /**
- * Gets the orchestration request.
- *
- * @param requestId the request id
- * @param request the request
- * @return the orchestration request
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_get_orch_req/{requestId}", method = RequestMethod.GET)
- public ResponseEntity<String> getOrchestrationRequest(@PathVariable("requestId") String requestId,
- HttpServletRequest request) throws Exception {
-
- String methodName = "getOrchestrationRequest";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
-
- MsoBusinessLogic mbl = new MsoBusinessLogic();
-
- MsoResponseWrapper w = mbl.getOrchestrationRequest(requestId);
-
- // always return OK, the MSO status code is embedded in the body
- return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
- }
-
-
- /**
- * Gets the orchestration requests.
- *
- * @param filterString the filter string
- * @param request the request
- * @return the orchestration requests
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_get_orch_reqs/{filterString}", method = RequestMethod.GET)
- public ResponseEntity<String> getOrchestrationRequests(@PathVariable("filterString") String filterString,
- HttpServletRequest request) throws Exception {
-
- String methodName = "getOrchestrationRequests";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
-
- MsoBusinessLogic mbl = new MsoBusinessLogic();
-
- MsoResponseWrapper w = mbl.getOrchestrationRequests(filterString);
-
- // always return OK, the MSO status code is embedded in the body
- return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
- }
-
-
- /**
- * activate to a pnf instance.
- *
- * @param serviceInstanceId the id of the service.
- * @param requestDetails the body of the request.
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_activate_service_instance/{serviceInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> activateServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @RequestBody RequestDetails requestDetails) throws Exception {
- String methodName = "activateServiceInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- MsoBusinessLogic mbl = new MsoBusinessLogic();
-
- MsoResponseWrapper w = mbl.activateServiceInstance(requestDetails, serviceInstanceId);
- return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
- }
-
-
- /**
- * Gets the orchestration requests for the dashboard.
- * currently its all the orchestration requests with RequestType updateInstance or replaceInstance.
- * @return the orchestration requests
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_get_orch_reqs/dashboard", method = RequestMethod.GET)
- public List<Request> getOrchestrationRequestsForDashboard() throws Exception {
-
- String methodName = "getOrchestrationRequestsForDashboard";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
-
- MsoBusinessLogic mbl = new MsoBusinessLogic();
-
- return mbl.getOrchestrationRequestsForDashboard();
- }
-
- /**
- * Gets the Manual Tasks for the given request id.
- *
- * @param originalRequestId the id of the original request.
- * @return the tasks
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_get_man_task/{originalRequestId}", method = RequestMethod.GET)
- public List<Task> getManualTasksByRequestId(@PathVariable("originalRequestId") String originalRequestId) throws Exception {
-
- String methodName = "getManualTasksByRequestId";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
-
- MsoBusinessLogic mbl = new MsoBusinessLogic();
-
- return mbl.getManualTasksByRequestId(originalRequestId);
- }
-
-
-
- /**
- * Complete the manual task.
- *
- * @param taskId the id of the task to complete.
- * @param requestDetails the body of the request.
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_post_man_task/{taskId}", method = RequestMethod.POST)
- public ResponseEntity<String> manualTaskComplete(@PathVariable("taskId") String taskId , @RequestBody RequestDetails requestDetails) throws Exception {
-
- String methodName = "manualTaskComplete";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- MsoBusinessLogic mbl = new MsoBusinessLogic();
-
- MsoResponseWrapper w = mbl.completeManualTask(requestDetails, taskId);
- return new ResponseEntity<String>(w.getResponse(), HttpStatus.OK);
- }
-
-
-
-
-
- /**
- * Gets the orchestration requests for svc instance.
- *
- * @param svc_instance_id the svc instance id
- * @return the orchestration requests for svc instance
- * @throws Exception the exception
- */
-// public MsoResponseWrapper getOrchestrationRequestsForSvcInstance(String svc_instance_id) throws Exception {
-
-// String methodName = "getOrchestrationRequestsForSvcInstance";
-// logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-// MsoResponseWrapper w = null;
-//
-// try {
-// MsoRestInterfaceIfc restController = MsoRestInterfaceFactory.getInstance();
-// String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQS);
-// String path = p + svc_instance_id;
-//
-// RestObject<String> restObjStr = new RestObject<String>();
-// String str = new String();
-// restObjStr.set(str);
-//
-// restController.<String>Get(str, "", path, restObjStr);
-// w = MsoUtil.wrapResponse(restObjStr);
-// logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
-//
-// } catch (Exception e) {
-// logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
-// logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
-// throw e;
-// }
-// return w;
-// }
-
- /**
- * Exception handler.
- *
- * @param e the e
- * @param response the response
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @ExceptionHandler(Exception.class)
- private void exceptionHandler(Exception e, HttpServletResponse response) throws IOException {
-
- /*
- * The following "logger.error" lines "should" be sufficient for logging the exception.
- * However, the console output in my Eclipse environment is NOT showing ANY of the
- * logger statements in this class. Thus the temporary "e.printStackTrace" statement
- * is also included.
- */
-
- String methodName = "exceptionHandler";
- logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- StringWriter sw = new StringWriter();
- e.printStackTrace(new PrintWriter(sw));
- logger.error(EELFLoggerDelegate.errorLogger, sw.toString());
-
- /*
- * Temporary - IF the above mentioned "logger.error" glitch is resolved ...
- * this statement could be removed since it would then likely result in duplicate
- * trace output.
- */
- e.printStackTrace(System.err);
-
- response.setContentType("application/json; charset=UTF-8");
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-
- ExceptionResponse exceptionResponse = new ExceptionResponse();
- exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", ""));
- exceptionResponse.setMessage(e.getMessage());
-
- response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));
-
- response.flushBuffer();
-
- }
-
- /**
- * Parses the orchestration requests for svc instance.
- *
- * @param resp the resp
- * @return the list
- * @throws ParseException the parse exception
- * @throws Exception the exception
- */
- @SuppressWarnings("unchecked")
- public List<JSONObject> parseOrchestrationRequestsForSvcInstance(ClientResponse resp) throws org.json.simple.parser.ParseException, Exception {
-
- String methodName = "parseOrchestrationRequestsForSvcInstance";
-
- ArrayList<JSONObject> json_list = new ArrayList<JSONObject>();
-
- String rlist_str = resp.readEntity(String.class);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + " Response string: " + rlist_str);
-
- JSONParser parser = new JSONParser();
- try {
- Object obj = parser.parse(rlist_str);
-
- JSONObject jsonObject = (JSONObject) obj;
-
- JSONArray requestList = (JSONArray) jsonObject.get("requestList");
-
- if (requestList != null && !(requestList.isEmpty()))
- for (Object container : requestList) {
-
- JSONObject containerJsonObj = (JSONObject) container;
- //logger.debug(dateFormat.format(new Date()) + "<== " + "." + methodName + " reqJsonObj: " + containerJsonObj.toJSONString());
- JSONObject reqJsonObj = (JSONObject) containerJsonObj.get("request");
-
- //logger.debug(dateFormat.format(new Date()) + "<== " + "." + methodName + " reqJsonObj.requestId: " +
- // reqJsonObj.get("requestId") );
- JSONObject result = new JSONObject();
-
- result.put("requestId", reqJsonObj.get("requestId"));
- if (reqJsonObj.get("requestType") != null) {
- result.put("requestType", (reqJsonObj.get("requestType").toString()));
- }
- JSONObject req_status = (JSONObject) reqJsonObj.get("requestStatus");
- if (req_status != null) {
- result.put("timestamp", (req_status.get("timestamp")));
- result.put("requestState", (req_status.get("requestState")));
- result.put("statusMessage", (req_status.get("statusMessage")));
- result.put("percentProgress", (req_status.get("percentProgress")));
- }
- json_list.add(result);
- }
- } catch (org.json.simple.parser.ParseException pe) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + " Parse exception: " + pe.toString());
- throw pe;
- } catch (Exception e) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + " Exception: " + e.toString());
- throw e;
- }
- return (json_list);
- }
-
- /**
- * Retrieve request object.
- *
- * @param request the request
- * @return the request details
- * @throws Exception the exception
- */
- public RequestDetails retrieveRequestObject(HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
-
- String methodName = "retrieveRequestObject";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- ObjectMapper mapper = new ObjectMapper();
- //JSON from String to Object
- //RequestDetails mso_request;
-
- try {
- //mso_request = new RequestDetails();
- //mso_request = mapper.readValue(request.getInputStream(), RequestDetails.class);
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " Unable to read json object RequestDetails e=" + e.getMessage());
- throw e;
- }
- if (mso_request == null) {
- logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " mso_request is null");
- throw new Exception("RequestDetails is missing");
- }
- try {
- String json_req = mapper.writeValueAsString(mso_request);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " request=[" + json_req + "]");
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " Unable to convert RequestDetails to json string e=" + e.getMessage());
- throw e;
- }
- return (mso_request);
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/PolicyController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/PolicyController.java
deleted file mode 100644
index 83e177a6..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/PolicyController.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.controller;
-
-import java.util.UUID;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.json.simple.JSONObject;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.vid.policy.PolicyProperties;
-import org.openecomp.vid.policy.PolicyResponseWrapper;
-import org.openecomp.vid.policy.PolicyRestInterfaceFactory;
-import org.openecomp.vid.policy.PolicyRestInterfaceIfc;
-import org.openecomp.vid.policy.PolicyUtil;
-import org.openecomp.vid.policy.RestObject;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * Controller to handle Policy requests.
- */
-
-@RestController
-public class PolicyController extends RestrictedBaseController{
-
- /** The logger. */
- static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PolicyController.class);
-
- @RequestMapping(value="/get_policy",method = RequestMethod.POST)
- public ResponseEntity<String> getPolicyInfo( HttpServletRequest request, @RequestBody JSONObject policy_request) throws Exception {
-
- logger.debug("#####################POLICY API CALL STARTED ###############"+ PolicyProperties.POLICY_GET_CONFIG_VAL);
- logger.debug("#####################Policy Request ###############"+policy_request.toString());
-
- String path = PolicyProperties.getProperty(PolicyProperties.POLICY_GET_CONFIG_VAL);
- PolicyResponseWrapper policyResWrapper = getPolicyConfig(policy_request,path);
-
- logger.debug("$$$$$$$$$$$$$$$$$$$$$$ " + new ResponseEntity<String>(policyResWrapper.getResponse(), HttpStatus.OK).toString());
-
- return ( new ResponseEntity<String>(policyResWrapper.getResponse(), HttpStatus.valueOf(policyResWrapper.getStatus())) );
- }
-
- protected static PolicyResponseWrapper getPolicyConfig(JSONObject request, String path) throws Exception {
- String methodName = "getPolicyConfig";
- String uuid = UUID.randomUUID().toString();
- logger.debug( "starting getPolicyConfig ");
-
- try {
- //STARTING REST API CALL AS AN FACTORY INSTACE
- PolicyRestInterfaceIfc restController = PolicyRestInterfaceFactory.getInstance();
-
- RestObject<String> restObjStr = new RestObject<String>();
- String str = new String();
- restObjStr.set(str);
- restController.<String>Post(str, request, uuid, path, restObjStr );
- PolicyResponseWrapper policyRespWrapper = PolicyUtil.wrapResponse (restObjStr);
-
- logger.debug( "<== " + methodName + " w=" + policyRespWrapper.getResponse());
- return policyRespWrapper;
- } catch (Exception e) {
- logger.debug( "EXCEPTION in getPolicyConfig <== " + "." + methodName + e.toString());
- throw e;
- }
- }
-}
-
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/PropertyController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/PropertyController.java
deleted file mode 100755
index 90080769..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/PropertyController.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.controller;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.servlet.ModelAndView;
-
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-
-/**
- * The Class PropertyController.
- */
-@RestController
-public class PropertyController extends RestrictedBaseController{
-
- /** The view name. */
- String viewName;
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PropertyController.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /**
- * Welcome.
- *
- * @param request the request
- * @return the model and view
- */
- @RequestMapping(value = {"/propertyhome" }, method = RequestMethod.GET)
- public ModelAndView welcome(HttpServletRequest request) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== PropertyController welcome start");
- return new ModelAndView(getViewName());
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#getViewName()
- */
- public String getViewName() {
- return viewName;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#setViewName(java.lang.String)
- */
- public void setViewName(String _viewName) {
- this.viewName = _viewName;
- }
-
- /**
- * Gets the property.
- *
- * @param name the name
- * @param defaultvalue the defaultvalue
- * @param request the request
- * @return the property
- * @throws Exception the exception
- */
- @RequestMapping(value = "/get_property/{name}/{defaultvalue}", method = RequestMethod.GET)
- public ResponseEntity<String> getProperty (@PathVariable("name") String name, @PathVariable("defaultvalue") String defaultvalue,
- HttpServletRequest request) throws Exception {
-
- String methodName = "getProperty";
- ResponseEntity<String> resp = null;
- String pvalue = null;
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- try {
- // convert "_" to "." in the property name
- if (name == null || name.length() == 0 ) {
- return ( new ResponseEntity<String> (defaultvalue, HttpStatus.OK));
- }
- // convert "_" to "." in the property name
- String propertyName = name.replace('_', '.');
- pvalue = SystemProperties.getProperty(propertyName);
- if ( ( pvalue == null ) || ( pvalue.length() == 0 ) ) {
- pvalue = defaultvalue;
- }
- resp = new ResponseEntity<String>(pvalue, HttpStatus.OK);
- }
- catch (Exception e) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- throw e;
- }
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " returning " + pvalue);
- return ( resp );
- }
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/SchedulerController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/SchedulerController.java
deleted file mode 100644
index 0fd2079e..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/SchedulerController.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.controller;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.UUID;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.json.simple.JSONObject;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.openecomp.vid.scheduler.RestObjects.GetTimeSlotsRestObject;
-import org.openecomp.vid.scheduler.RestObjects.PostCreateNewVnfRestObject;
-import org.openecomp.vid.scheduler.RestObjects.PostSubmitVnfChangeRestObject;
-import org.openecomp.vid.scheduler.SchedulerProperties;
-import org.openecomp.vid.scheduler.SchedulerRestInterface;
-import org.openecomp.vid.scheduler.SchedulerResponseWrappers.GetTimeSlotsWrapper;
-import org.openecomp.vid.scheduler.SchedulerResponseWrappers.PostCreateNewVnfWrapper;
-import org.openecomp.vid.scheduler.SchedulerResponseWrappers.PostSubmitVnfChangeTimeSlotsWrapper;
-import org.openecomp.vid.scheduler.SchedulerUtil;
-
-/**
- * Controller to handle Scheduler requests.
- */
-
-@RestController
-public class SchedulerController extends RestrictedBaseController {
-
- static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerController.class);
-
- /** The request date format. */
- public DateFormat requestDateFormat = new SimpleDateFormat("EEE, dd MMM YYYY HH:mm:ss z");
-
- @Autowired
- private SchedulerRestInterface restController;
-
- /*
- *
- * GET SCHEDULER CONTROLLERS
- *
- */
-
- @RequestMapping(value = "/get_time_slots/{scheduler_request}", method = RequestMethod.GET)
- public ResponseEntity<String> getTimeSlots(HttpServletRequest request, @PathVariable("scheduler_request") String scheduler_request) throws Exception {
-
- Date startingTime = new Date();
- String startTimeRequest = requestDateFormat.format(startingTime);
-
- System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- System.out.println(startTimeRequest + " | Controller Scheduler GET : /get_time_slots/{scheduler_request} \n");
- System.out.println("Original Request : \n " + scheduler_request + '\n');
-
- String path = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_GET_TIME_SLOTS) + scheduler_request;
-
- GetTimeSlotsWrapper schedulerResWrapper = getTimeSlots(scheduler_request, path, scheduler_request);
-
- Date endTime = new Date();
- String endTimeRequest = requestDateFormat.format(endTime);
- System.out.println(endTimeRequest + " | Controller Scheduler - GET\n");
-
- return (new ResponseEntity<String>(schedulerResWrapper.getResponse(), HttpStatus.OK));
-
- }
-
- protected GetTimeSlotsWrapper getTimeSlots(String request, String path, String uuid) throws Exception {
-
- try {
- //STARTING REST API CALL AS AN FACTORY INSTACE
- System.out.println("<== Get Time Slots Request START \n");
-
- GetTimeSlotsRestObject<String> restObjStr = new GetTimeSlotsRestObject<String>();
- String str = new String();
-
- restObjStr.set(str);
-
- restController.<String>Get(str, uuid, path, restObjStr);
- GetTimeSlotsWrapper schedulerRespWrapper = SchedulerUtil.getTimeSlotsWrapResponse(restObjStr);
-
- System.out.println("<== Get Time Slots Request END : Response = " + schedulerRespWrapper.getResponse() + '\n');
-
- return schedulerRespWrapper;
-
- } catch (Exception e) {
- System.out.println("<== Get Time Slots Request ERROR : " + e.toString() + '\n');
- throw e;
- }
- }
-
- /*
- *
- * POST SCHEDULER CONTROLLERS
- *
- */
-
- @SuppressWarnings("unchecked")
- @RequestMapping(value = "/post_create_new_vnf_change", method = RequestMethod.POST)
- public ResponseEntity<String> postCreateNewVNFChange(HttpServletRequest request, @RequestBody JSONObject scheduler_request) throws Exception {
-
- Date startingTime = new Date();
- String startTimeRequest = requestDateFormat.format(startingTime);
-
- System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- System.out.println(startTimeRequest + " | Controller Scheduler POST : post_create_new_vnf_change \n");
-
- //Generating uuid
- String uuid = UUID.randomUUID().toString();
-
- scheduler_request.put("scheduleId", uuid);
- System.out.println("<== UUID : " + uuid + '\n');
-
- //adding uuid to the request payload
- scheduler_request.put("scheduleId", uuid);
-
- System.out.println("<== UUID : " + uuid + '\n');
- System.out.println("Original Request : \n " + scheduler_request.toString() + '\n');
-
- String path = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_CREATE_NEW_VNF_CHANGE_INSTANCE_VAL) + uuid;
-
- PostCreateNewVnfWrapper responseWrapper = postSchedulingRequest(scheduler_request, path, uuid);
-
- Date endTime = new Date();
- String endTimeRequest = requestDateFormat.format(endTime);
- System.out.println(endTimeRequest + " | Controller Scheduler - POST\n");
-
- return (new ResponseEntity<String>(responseWrapper.getResponse(), HttpStatus.OK));
- }
-
- protected PostCreateNewVnfWrapper postSchedulingRequest(JSONObject request, String path, String uuid) throws Exception {
-
- try {
- //STARTING REST API CALL AS AN FACTORY INSTACE
- System.out.println("<== Post Create New Vnf Scheduling Request START \n");
-
- PostCreateNewVnfRestObject<String> restObjStr = new PostCreateNewVnfRestObject<String>();
- String str = new String();
-
- restObjStr.set(str);
- restController.<String>Post(str, request, path, restObjStr);
-
- int status = restObjStr.getStatusCode();
- if (status >= 200 && status <= 299) {
- restObjStr.setUUID(uuid);
- }
-
- PostCreateNewVnfWrapper responseWrapper = SchedulerUtil.postCreateNewVnfWrapResponse(restObjStr);
-
- System.out.println("<== Post Create New Vnf Scheduling Request END : Response = " + responseWrapper.getResponse() + '\n');
-
- return responseWrapper;
-
- } catch (Exception e) {
- System.out.println("<== Post Create New Vnf Scheduling Request ERROR : " + e.toString() + '\n');
- throw e;
- }
- }
-
- @RequestMapping(value = "/submit_vnf_change_timeslots", method = RequestMethod.POST)
- public ResponseEntity<String> postSubmitVnfChangeTimeslots(HttpServletRequest request, @RequestBody JSONObject scheduler_request) throws Exception {
-
- Date startingTime = new Date();
- String startTimeRequest = requestDateFormat.format(startingTime);
-
- System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- System.out.println(startTimeRequest + " | Controller Scheduler POST : submit_vnf_change_timeslots \n");
-
- //Generating uuid
- String uuid = (String) scheduler_request.get("scheduleId");
- scheduler_request.remove("scheduleId");
-
- System.out.println("<== UUID : " + uuid + '\n');
- System.out.println("Original Request : \n " + scheduler_request.toString() + '\n');
-
- String path = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_SUBMIT_NEW_VNF_CHANGE).replace("{scheduleId}", uuid);
-
- PostSubmitVnfChangeTimeSlotsWrapper responseWrapper = postSubmitSchedulingRequest(scheduler_request, path, uuid);
-
- Date endTime = new Date();
- String endTimeRequest = requestDateFormat.format(endTime);
- System.out.println(endTimeRequest + " | Controller Scheduler - POST Submit\n");
-
- return (new ResponseEntity<String>(responseWrapper.getResponse(), HttpStatus.OK));
- }
-
- protected PostSubmitVnfChangeTimeSlotsWrapper postSubmitSchedulingRequest(JSONObject request, String path, String uuid) throws Exception {
-
- try {
- //STARTING REST API CALL AS AN FACTORY INSTACE
- System.out.println("<== Post Submit Scheduling Request START \n");
-
- PostSubmitVnfChangeRestObject<String> restObjStr = new PostSubmitVnfChangeRestObject<String>();
- String str = new String();
-
- restObjStr.set(str);
- restController.<String>Post(str, request, path, restObjStr);
-
- int status = restObjStr.getStatusCode();
- if (status >= 200 && status <= 299) {
- restObjStr.setUUID(uuid);
- }
-
- PostSubmitVnfChangeTimeSlotsWrapper responseWrapper = SchedulerUtil.postSubmitNewVnfWrapResponse(restObjStr);
-
- System.out.println("<== Post Submit Scheduling Request END : Response = " + responseWrapper.getResponse() + '\n');
-
- return responseWrapper;
-
- } catch (Exception e) {
- System.out.println("<== Post Submit Scheduling Request ERROR : " + e.toString() + '\n');
- throw e;
- }
- }
-}
-
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java
deleted file mode 100755
index f21036eb..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.controller;
-
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
-import org.openecomp.vid.asdc.AsdcCatalogException;
-import org.openecomp.vid.asdc.beans.SecureServices;
-import org.openecomp.vid.exceptions.VidServiceUnavailableException;
-import org.openecomp.vid.model.ServiceModel;
-import org.openecomp.vid.roles.Role;
-import org.openecomp.vid.roles.RoleProvider;
-import org.openecomp.vid.roles.RoleValidator;
-import org.openecomp.vid.services.VidService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.servlet.ModelAndView;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-import java.util.Map;
-
-//import org.openecomp.vid.model.Service;
-
-@RestController
-public class VidController extends RestrictedBaseController {
-
- private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(VidController.class);
-
- private final VidService service;
-
- @Autowired
- public VidController(VidService vidService) throws SdcToscaParserException{
-
- service = vidService;
- }
-//
- /**
- * Gets the services.
- *
- * @param request the request
- * @return the services
- * @throws VidServiceUnavailableException the vid service unavailable exception
- */
- @RequestMapping(value={"/rest/models/services"}, method = RequestMethod.GET)
- public SecureServices getServices(HttpServletRequest request) throws VidServiceUnavailableException {
- try {
- LOG.info("Start API for browse ASDC was called");
- SecureServices secureServices = new SecureServices();
- RoleProvider roleProvider = new RoleProvider();
- Map<String, String[]> requestParams = request.getParameterMap();
- List<Role> roles = new RoleProvider().getUserRoles(request);
- secureServices.setServices(service.getServices(requestParams));
- //Disable roles until AAF integration finishes
- //secureServices.setReadOnly(roleProvider.userPermissionIsReadOnly(roles));
- return secureServices;
- } catch (AsdcCatalogException e) {
- LOG.error("Failed to retrieve service definitions from SDC", e);
- throw new VidServiceUnavailableException("Failed to retrieve service definitions from SDC", e);
- } catch (Throwable t) {
- LOG.debug("Unexpected error while retrieving service definitions from SDC: " + t.getMessage() + ":", t);
- t.printStackTrace();
- throw new VidServiceUnavailableException("Unexpected error while retrieving service definitions from SDC: " + t.getMessage(), t);
- }
- }
-
- /**
- * Gets the services.
- *
- * @param uuid the uuid
- * @return the services
- * @throws VidServiceUnavailableException the vid service unavailable exception
- */
- @RequestMapping(value={"/rest/models/services/{uuid}"}, method = RequestMethod.GET)
- public ServiceModel getServices(@PathVariable("uuid") String uuid, HttpServletRequest request) throws VidServiceUnavailableException {
- try {
-// RoleValidator roleValidator = new RoleValidator(new RoleProvider().getUserRoles(request));
- return service.getService(uuid);
- } catch (AsdcCatalogException e) {
- LOG.error("Failed to retrieve service definitions from SDC", e);
- throw new VidServiceUnavailableException("Failed to retrieve service definitions from SDC", e);
- }
- }
-
-
- /**
- * Gets the services view.
- *
- * @param request the request
- * @return the services view
- * @throws VidServiceUnavailableException the vid service unavailable exception
- */
- @RequestMapping(value={"/serviceModels"}, method=RequestMethod.GET)
- public ModelAndView getServicesView(HttpServletRequest request) throws VidServiceUnavailableException {
- return new ModelAndView("serviceModels");
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/ViewEditSubController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/ViewEditSubController.java
deleted file mode 100755
index e23b99ba..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/ViewEditSubController.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.controller;
-
-
-import java.io.File;
-import java.text.DateFormat;
-import java.util.HashMap;
-import java.util.Map;
-
-
-
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.servlet.ModelAndView;
-
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-
-
-/**
- * The Class ViewEditSubController.
- */
-@RestController
-public class ViewEditSubController extends RestrictedBaseController{
-
- /** The view name. */
- String viewName;
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ViewEditSubController.class);
-
- /** The model. */
- private Map<String, Object> model = new HashMap<String, Object>();
-
- /** The servlet context. */
- private @Autowired ServletContext servletContext;
-
- /**
- * Welcome.
- *
- * @param request the request
- * @return the model and view
- */
- @RequestMapping(value = {"/vieweditsub" }, method = RequestMethod.GET)
- public ModelAndView welcome(HttpServletRequest request) {
- return new ModelAndView("vieweditsub","model", model);
- // return new ModelAndView(getViewName());
- }
-
- /**
- * Post subscriber.
- *
- * @param request the request
- */
- @RequestMapping(value="/vieweditsub/subedit", method = RequestMethod.POST)
- public void PostSubscriber(HttpServletRequest request) {
-
- String subID = request.getParameter("subscriberID");
- model.put("subInfo", subID);
-
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#getViewName()
- */
- public String getViewName() {
- return viewName;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#setViewName(java.lang.String)
- */
- public void setViewName(String viewName) {
- this.viewName = viewName;
- }
-
-
-
-
-}
-
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/ViewLogController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/ViewLogController.java
deleted file mode 100755
index 31e64983..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/ViewLogController.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.controller;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.servlet.ModelAndView;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-
-
-/**
- * The Class ViewLogController.
- */
-@RestController
-public class ViewLogController extends RestrictedBaseController{
-
- /** The view name. */
- String viewName;
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ViewLogController.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /** The servlet context. */
- private @Autowired ServletContext servletContext;
-
- /**
- * Welcome.
- *
- * @param request the request
- * @return the model and view
- */
- @RequestMapping(value = {"/viewlog" }, method = RequestMethod.GET)
- public ModelAndView welcome(HttpServletRequest request) {
-
- return new ModelAndView(getViewName());
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#getViewName()
- */
- public String getViewName() {
- return viewName;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#setViewName(java.lang.String)
- */
- public void setViewName(String viewName) {
- this.viewName = viewName;
- }
-
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/WebConfig.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/WebConfig.java
deleted file mode 100644
index 1e13d0eb..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/WebConfig.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package org.openecomp.vid.controller;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.commons.io.IOUtils;
-import org.json.JSONObject;
-import org.json.JSONTokener;
-import org.openecomp.vid.aai.AaiClient;
-import org.openecomp.vid.aai.AaiClientInterface;
-import org.openecomp.vid.asdc.AsdcClient;
-import org.openecomp.vid.asdc.local.LocalAsdcClient;
-import org.openecomp.vid.asdc.memory.InMemoryAsdcClient;
-import org.openecomp.vid.asdc.parser.ToscaParserImpl2;
-import org.openecomp.vid.asdc.rest.RestfulAsdcClient;
-import org.openecomp.vid.properties.AsdcClientConfiguration;
-import org.openecomp.vid.properties.AsdcClientConfiguration.AsdcClientType;
-import org.openecomp.vid.services.AaiService;
-import org.openecomp.vid.services.AaiServiceImpl;
-import org.openecomp.vid.services.VidService;
-import org.openecomp.vid.services.VidServiceImpl;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import javax.net.ssl.SSLContext;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
-import java.util.Arrays;
-
-@Configuration
-public class WebConfig {
-
- /**
- * Gets the object mapper.
- *
- * @return the object mapper
- */
- @Bean
- public ObjectMapper getObjectMapper() {
- return new ObjectMapper();
- }
-
-
-
- @Bean
- public VidService vidService(AsdcClient asdcClient) {
- return new VidServiceImpl(asdcClient);
- }
-
- @Bean
- public AaiService getAaiService(){
- return new AaiServiceImpl();
- }
-
- @Bean
- public AaiClientInterface getAaiClientInterface(){
- return new AaiClient();
- }
-
- @Bean
- public AsdcClient asdcClient(AsdcClientConfiguration asdcClientConfig) throws IOException {
- switch (asdcClientConfig.getAsdcClientType()) {
- case IN_MEMORY:
- final InputStream asdcCatalogFile = VidController.class.getClassLoader().getResourceAsStream("catalog.json");
- final JSONTokener tokener = new JSONTokener(asdcCatalogFile);
- final JSONObject catalog = new JSONObject(tokener);
-
- return new InMemoryAsdcClient.Builder().catalog(catalog).build();
- case REST:
-
- final String protocol = asdcClientConfig.getAsdcClientProtocol();
- final String host = asdcClientConfig.getAsdcClientHost();
- final int port = asdcClientConfig.getAsdcClientPort();
- final String auth = asdcClientConfig.getAsdcClientAuth();
- Client cl = null;
- if (protocol.equalsIgnoreCase("https")) {
- try {
- SSLContext ctx = SSLContext.getInstance("TLSv1.2");
- ctx.init(null, null, null);
- cl = ClientBuilder.newBuilder().sslContext(ctx).build();
- } catch (NoSuchAlgorithmException n) {
- throw new RuntimeException("SDC Client could not be instantiated due to unsupported protocol TLSv1.2", n);
- } catch (KeyManagementException k) {
- throw new RuntimeException("SDC Client could not be instantiated due to a key management exception", k);
- }
- } else {
- cl = ClientBuilder.newBuilder().build();
- }
-
- try {
- final URI uri = new URI(protocol + "://" + host + ":" + port + "/");
- return new RestfulAsdcClient.Builder(cl, uri)
- .auth(auth)
- .build();
- } catch (URISyntaxException e) {
- throw new RuntimeException("SDC Client could not be instantiated due to a syntax error in the URI", e);
- }
-
- case LOCAL:
-
- final InputStream asdcServicesFile = VidController.class.getClassLoader().getResourceAsStream("sdcservices.json");
-
- final JSONTokener jsonTokener = new JSONTokener(IOUtils.toString(asdcServicesFile));
- final JSONObject sdcServicesCatalog = new JSONObject(jsonTokener);
-
- return new LocalAsdcClient.Builder().catalog(sdcServicesCatalog).build();
-
- default:
- throw new RuntimeException(asdcClientConfig.getAsdcClientType() + " is invalid; must be one of " + Arrays.toString(AsdcClientType.values()));
- }
- }
-
- @Bean
- public ToscaParserImpl2 getToscaParser() {
- return new ToscaParserImpl2();
- }
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestAaiController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestAaiController.java
deleted file mode 100755
index 79017410..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestAaiController.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.controller.test;
-
-import java.io.IOException;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.codehaus.jackson.map.ObjectMapper;
-import org.openecomp.vid.model.ExceptionResponse;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-
-/**
- * The Class TestAaiController.
- */
-@RestController
-@RequestMapping("testaai")
-public class TestAaiController extends RestrictedBaseController {
-
- /**
- * Gets the subscription service type list.
- *
- * @param globalCustomerId the global customer id
- * @param request the request
- * @return the subscription service type list
- * @throws Exception the exception
- */
- @RequestMapping(value = "/getSubscriptionServiceTypeList/{globalCustomerId}", method = RequestMethod.GET)
- public String getSubscriptionServiceTypeList(@PathVariable("globalCustomerId") String globalCustomerId, HttpServletRequest request)
- throws Exception {
-
- System.err.println("GET SUBSCRIPTION SERVICE TYPE LIST: globalCustomerId: " + globalCustomerId);
-
- return "[\"vMOG\", \"sevice type 2\", \"sevice type 3\", \"sevice type 4\"]";
- }
-
- /**
- * Exception.
- *
- * @param e the e
- * @param response the response
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @ExceptionHandler(Exception.class)
- private void exception(Exception e, HttpServletResponse response) throws IOException {
-
- /*
- * This logging step should preferably be replaced with an appropriate
- * logging method consistent whatever logging mechanism the rest of the
- * application code uses.
- */
-
- e.printStackTrace(System.err);
-
- response.setContentType("application/json; charset=UTF-8");
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-
- ExceptionResponse exceptionResponse = new ExceptionResponse();
- exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", ""));
- exceptionResponse.setMessage(e.getMessage());
-
- response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));
-
- response.flushBuffer();
-
- }
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestAsdcController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestAsdcController.java
deleted file mode 100755
index 84a56b3b..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestAsdcController.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.controller.test;
-
-import java.io.IOException;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.codehaus.jackson.map.ObjectMapper;
-import org.openecomp.vid.model.ExceptionResponse;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-
-/**
- * The Class TestAsdcController.
- */
-@RestController
-@RequestMapping("testasdc")
-public class TestAsdcController extends RestrictedBaseController {
-
- /**
- * Gets the model.
- *
- * @param modelId the model id
- * @param request the request
- * @return the model
- * @throws Exception the exception
- */
- @RequestMapping(value = "/getModel/{modelId}", method = RequestMethod.GET)
- public String getModel(@PathVariable("modelId") String modelId, HttpServletRequest request) throws Exception {
-
- System.err.println("SDC: GET MODEL: modelId: " + modelId);
-
- // @formatter:off
- return
- "{" +
- "\"uuid\": \"5be686dc-fdca-4d54-8548-5d0ed23e962b\"," +
- "\"invariantUUID\": \"e5962da9-fe4f-433a-bc99-b43e0d88a9a1\"," +
- "\"name\": \"DE220127\"," +
- "\"version\": \"0.1\"," +
- "\"inputs\": {" +
- "\"defaultGateway\": {" +
- "\"type\": \"String\"," +
- "\"default\": \"192.168.1.1\"," +
- "\"description\": \"Router default gateway - use any valid IPv4 address\"" +
- "}," +
- "\"subnetMask\": {" +
- "\"type\": \"String\"," +
- "\"default\": \"255.255.255.0\"," +
- "\"description\": \"Router subnet mask - example (255.255.255.0)\"" +
- "}" +
- "}" +
- "}";
- // @formatter:on
- }
-
- /**
- * Exception.
- *
- * @param e the e
- * @param response the response
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @ExceptionHandler(Exception.class)
- private void exception(Exception e, HttpServletResponse response) throws IOException {
-
- /*
- * This logging step should preferably be replaced with an appropriate
- * logging method consistent whatever logging mechanism the rest of the
- * application code uses.
- */
-
- e.printStackTrace(System.err);
-
- response.setContentType("application/json; charset=UTF-8");
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-
- ExceptionResponse exceptionResponse = new ExceptionResponse();
- exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", ""));
- exceptionResponse.setMessage(e.getMessage());
-
- response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));
-
- response.flushBuffer();
-
- }
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestMsoController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestMsoController.java
deleted file mode 100755
index 02c29f67..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestMsoController.java
+++ /dev/null
@@ -1,729 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.controller.test;
-
-import java.io.IOException;
-import java.util.stream.Collectors;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.codehaus.jackson.map.ObjectMapper;
-import org.openecomp.vid.model.ExceptionResponse;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-
-/*
- * The "TestMsoController" class is primarily designed to help test "msoCommitController.js"
- *
- * This class expects and receives JSON data in the same format as expected
- * in the "real" application version of this code. However, string versions of JSON are
- * maintained internally here instead of marshalled / unmarshalled JSON objects.
- * The primary reasons for this were to encapsulate all the test code in this single file and
- * minimize the time required to support initial test cases.
- *
- * The non-test equivalent of this controller could alternatively incorporate POJO objects
- * instead of strings. However, the same data format sent to / received from the browser
- * JavaScript code would still be expected.
- *
- * Two specific mechanisms used in this test class may be useful to the application version:
- *
- * 1) The use of "{variable}" elements in @RequestMappings along with the corresponding
- * @PathVariable declarations.
- *
- * 2) The use of @ExceptionHandler for general purpose exception handler.
- * (See @ExceptionHandler comments)
- *
- * This class is intended to be used in either:
- *
- * A) Eclipse environments
- * OR
- * B) Linux environments with ONLY a single user running tests.
- * The "quick and dirty" error simulation approach used here makes use of static states for some
- * scenarios. Thus multiple users simultaneously testing in Linux environments
- * may have contention issues.
- */
-
-/**
- * The Class TestMsoController.
- */
-@RestController
-@RequestMapping("testmso")
-public class TestMsoController extends RestrictedBaseController {
-
- /*
- * Artificial delay (in milliseconds) added before responding to create /
- * delete requests
- */
-
- /** The Constant TEST_DELAY_SHORT_MSEC. */
- private final static int TEST_DELAY_SHORT_MSEC = 1000;
-
- /*
- * Long delay to simulate non-responsive server test
- */
-
- /** The Constant TEST_DELAY_LONG_MSEC. */
- private final static int TEST_DELAY_LONG_MSEC = 15000;
-
- /*
- * Default number of polls expected before transaction complete.
- */
-
- /** The Constant MAXIMUM_POLLS_DEFAULT. */
- private final static int MAXIMUM_POLLS_DEFAULT = 4;
-
- /*
- * Number of polls to simulate "maximum polls exceeded" test.
- */
-
- /** The Constant MAXIMUM_POLLS_LARGE. */
- private final static int MAXIMUM_POLLS_LARGE = 10;
-
- /*
- * Simulated error types. The GUI front end is expected to set these values
- * in the "modelName" field of the "mso_create_svc_instance" request.
- */
-
- /** The Constant ERROR_POLICY_EXCEPTION. */
- private final static String ERROR_POLICY_EXCEPTION = "ERROR_POLICY_EXCEPTION";
-
- /** The Constant ERROR_SERVICE_EXCEPTION. */
- private final static String ERROR_SERVICE_EXCEPTION = "ERROR_SERVICE_EXCEPTION";
-
- /** The Constant ERROR_POLL_FAILURE. */
- private final static String ERROR_POLL_FAILURE = "ERROR_POLL_FAILURE";
-
- /** The Constant ERROR_INVALID_FIELD_INITIAL. */
- private final static String ERROR_INVALID_FIELD_INITIAL = "ERROR_INVALID_FIELD_INITIAL";
-
- /** The Constant ERROR_INVALID_FIELD_POLL. */
- private final static String ERROR_INVALID_FIELD_POLL = "ERROR_INVALID_FIELD_POLL";
-
- /** The Constant ERROR_GENERAL_SERVER_EXCEPTION. */
- private final static String ERROR_GENERAL_SERVER_EXCEPTION = "ERROR_GENERAL_SERVER_EXCEPTION";
-
- /** The Constant ERROR_MAX_POLLS. */
- private final static String ERROR_MAX_POLLS = "ERROR_MAX_POLLS";
-
- /** The Constant ERROR_SERVER_TIMEOUT_INITIAL. */
- private final static String ERROR_SERVER_TIMEOUT_INITIAL = "ERROR_SERVER_TIMEOUT_INITIAL";
-
- /** The Constant ERROR_SERVER_TIMEOUT_POLL. */
- private final static String ERROR_SERVER_TIMEOUT_POLL = "ERROR_SERVER_TIMEOUT_POLL";
-
- /** The simulated error. */
- private String simulatedError = "";
-
- /** The maximum polls. */
- private int maximumPolls = 0;
-
- /** The attempt count. */
- private int attemptCount = 0;
-
- /**
- * Creates the svc instance.
- *
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_create_svc_instance", method = RequestMethod.POST)
- public ResponseEntity<String> createSvcInstance(HttpServletRequest request) throws Exception {
- readAndLogRequest("CREATE SERVICE INSTANCE", request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
-
- /*
- * This block of code simulates various errors and would NOT be expected
- * in a non-test method
- */
- System.err.println("simulatedError: " + simulatedError);
-
- if (simulatedError.equals(ERROR_POLICY_EXCEPTION)) {
- return new ResponseEntity<String>(policyExceptionResponse, HttpStatus.OK);
- }
- if (simulatedError.equals(ERROR_SERVICE_EXCEPTION)) {
- return new ResponseEntity<String>(serviceExceptionResponse, HttpStatus.OK);
- }
- if (simulatedError.equals(ERROR_INVALID_FIELD_INITIAL)) {
- /*
- * Force invalid response field name. Return
- * "XXXXXrequestReferences" instead of "requestReferences"
- */
- return new ResponseEntity<String>(acceptResponse.replace("requestReferences", "XXXXXrequestReferences"),
- HttpStatus.OK);
- }
-
- if (simulatedError.equals(ERROR_GENERAL_SERVER_EXCEPTION)) {
- throw new IOException("an example of an IO exception");
- }
-
- if (simulatedError.equals(ERROR_SERVER_TIMEOUT_INITIAL)) {
- Thread.sleep(TEST_DELAY_LONG_MSEC);
- }
-
- if (simulatedError.equals(ERROR_MAX_POLLS)) {
- maximumPolls = MAXIMUM_POLLS_LARGE;
- }
-
- /*
- * End of block of simulated error code.
- */
-
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Delete svc instance.
- *
- * @param serviceInstanceId the service instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_delete_svc_instance/{serviceInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteSvcInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- HttpServletRequest request) throws Exception {
- readAndLogRequest("DELETE SERVICE INSTANCE: serviceInstanceId: " + serviceInstanceId, request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Creates the vnf instance.
- *
- * @param serviceInstanceId the service instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_create_vnf_instance/{serviceInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> createVnfInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- HttpServletRequest request) throws Exception {
- readAndLogRequest("CREATE VNF INSTANCE: serviceInstanceId: " + serviceInstanceId, request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Delete vnf instance.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_delete_vnf_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteVnfInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request) throws Exception {
- readAndLogRequest(
- "DELETE VNF INSTANCE: serviceInstanceId: " + serviceInstanceId + " vnfInstanceId: " + vnfInstanceId,
- request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Creates the vf module instance.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- // /serviceInstances/v2/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-ff1b-adb2-eb6b9e5460ff/vfModules
- @RequestMapping(value = "/mso_create_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> createVfModuleInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request) throws Exception {
- readAndLogRequest("CREATE VF MODULE INSTANCE: serviceInstanceId: " + serviceInstanceId + " vnfInstanceId: "
- + vnfInstanceId, request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Delete vf module instance.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param vfModuleInstanceId the vf module instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- // /serviceInstances/v2/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-ff1b-adb2-eb6b9e5460ff/vfModules/ff305d54-75b4-ff1b-bdb2-eb6b9e5460ff
- @RequestMapping(value = "/mso_delete_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfModuleInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteVfModuleInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- @PathVariable("vnfInstanceId") String vnfInstanceId,
- @PathVariable("vfModuleInstanceId") String vfModuleInstanceId, HttpServletRequest request)
- throws Exception {
- readAndLogRequest("DELETE VF MODULE INSTANCE: serviceInstanceId: " + serviceInstanceId + " vnfInstanceId: "
- + vnfInstanceId + " vfModuleInstanceId: " + vfModuleInstanceId, request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- // POST
- /**
- * Creates the volume group instance.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- // /serviceInstances/v2/ff305d54-75b4-431b-adb2-eb6b9e5ff000/volumeGroups
- @RequestMapping(value = "/mso_create_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> createVolumeGroupInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request) throws Exception {
- readAndLogRequest("CREATE VOLUME GROUP INSTANCE: seviceInstanceId: " + serviceInstanceId + " vnfInstanceId: "
- + vnfInstanceId, request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Delete volume group instance.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param volumeGroupInstanceId the volume group instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- // /serviceInstances/v2/ff305d54-75b4-431b-adb2-eb6b9e5ff000/volumeGroups/ff305d54-75b4-ff1b-cdb2-eb6b9e5460ff
- @RequestMapping(value = "/mso_delete_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteVolumeGroupInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- @PathVariable("vnfInstanceId") String vnfInstanceId,
- @PathVariable("volumeGroupInstanceId") String volumeGroupInstanceId, HttpServletRequest request)
- throws Exception {
- readAndLogRequest("DELETE NW INSTANCE: serviceInstanceId: " + serviceInstanceId + " vnfInstanceId: "
- + vnfInstanceId + " volumeGroupInstanceId: " + volumeGroupInstanceId, request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Creates the nw instance.
- *
- * @param serviceInstanceId the service instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_create_nw_instance/{serviceInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> createNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- HttpServletRequest request) throws Exception {
- readAndLogRequest("CREATE NW INSTANCE: serviceInstanceId: " + serviceInstanceId, request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Delete nw instance.
- *
- * @param serviceInstanceId the service instance id
- * @param networkInstanceId the network instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_delete_nw_instance/{serviceInstanceId}/networks/{networkInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- @PathVariable("networkInstanceId") String networkInstanceId, HttpServletRequest request) throws Exception {
- readAndLogRequest("DELETE NW INSTANCE: serviceInstanceId: " + serviceInstanceId + " networkInstanceId: "
- + networkInstanceId, request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Gets the orchestration request.
- *
- * @param requestId the request id
- * @param request the request
- * @return the orchestration request
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_get_orch_req/{requestId}", method = RequestMethod.GET)
- public ResponseEntity<String> getOrchestrationRequest(@PathVariable("requestId") String requestId,
- HttpServletRequest request) throws Exception {
-
- System.err.println("GET ORCHESTRATION REQUEST: requestId: " + requestId);
-
- /*
- * This block of code simulates various errors and would NOT be expected
- * in a non-test method
- */
-
- if (simulatedError.equals(ERROR_INVALID_FIELD_POLL)) {
- /*
- * Force invalid response field name. Return "XXXXXrequestStatus"
- * instead of "requestStatus"
- */
- return new ResponseEntity<String>(inProgressResponse.replace("requestStatus", "XXXXXrequestStatus"),
- HttpStatus.OK);
- }
-
- if (simulatedError.equals(ERROR_POLL_FAILURE)) {
- /*
- * Force status field with "Failure"
- */
- return new ResponseEntity<String>(inProgressResponse.replace("InProgress", "Failure"), HttpStatus.OK);
- }
-
- if (simulatedError.equals(ERROR_SERVER_TIMEOUT_POLL)) {
- Thread.sleep(TEST_DELAY_LONG_MSEC);
- }
-
- /*
- * End of block of simulated error code.
- */
-
- /*
- * This logic simulates how MSO might behave ... i.e. return different
- * results depending on the value of 'maximumPolls'.
- *
- */
- int percentProgress = (++attemptCount * 100) / maximumPolls;
-
- System.err.println("attempts: " + attemptCount + " max: " + maximumPolls + " percent: " + percentProgress);
-
- String response = inProgressResponse.replace("\"50\"", "\"" + Integer.toString(percentProgress) + "\"");
-
- if (attemptCount < maximumPolls) {
- if (attemptCount > 1) {
- response = response.replace("vLan setup", "setup step " + Integer.toString(attemptCount));
- }
- return new ResponseEntity<String>(response, HttpStatus.OK);
- } else {
- return new ResponseEntity<String>(
- response.replace("InProgress", "Complete").replace("vLan setup complete", ""), HttpStatus.OK);
- }
- }
-
- /**
- * Gets the orchestration requests.
- *
- * @param filterString the filter string
- * @param request the request
- * @return the orchestration requests
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_get_orch_reqs/{filterString}", method = RequestMethod.GET)
- public ResponseEntity<String> getOrchestrationRequests(@PathVariable("filterString") String filterString,
- HttpServletRequest request) throws Exception {
-
- System.err.println("GET ORCHESTRATION REQUESTS: filterString: " + filterString);
-
- return new ResponseEntity<String>(getOrchestrationRequestsResponse, HttpStatus.OK);
-
- }
-
- /*
- * General purpose exception handler that could be used in application code.
- *
- * The method returns exceptions as error code 500. Both the exception type
- * and message are written as a JSON object.
- *
- * See the following references:
- *
- * 1) The ExceptionResponse POJO.
- *
- * 2) The "getHttpErrorMessage" function in "utilityService.js" - an example
- * of how the browser JavaScript code can interpret this response.
- */
-
- /**
- * Exception.
- *
- * @param e the e
- * @param response the response
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @ExceptionHandler(Exception.class)
- private void exception(Exception e, HttpServletResponse response) throws IOException {
-
- /*
- * This logging step should preferably be replaced with an appropriate
- * logging method consistent whatever logging mechanism the rest of the
- * application code uses.
- */
-
- e.printStackTrace(System.err);
-
- response.setContentType("application/json; charset=UTF-8");
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-
- ExceptionResponse exceptionResponse = new ExceptionResponse();
- exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", ""));
- exceptionResponse.setMessage(e.getMessage());
-
- response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));
-
- response.flushBuffer();
-
- }
-
- /*
- * 'readAndLogRequest' only intended to be used for testing.
- *
- * The method reads JSON from the input stream and thus prevents other
- * mechanisms from reading the input.
- */
-
- /**
- * Read and log request.
- *
- * @param label the label
- * @param request the request
- * @throws Exception the exception
- */
- private void readAndLogRequest(String label, HttpServletRequest request) throws Exception {
- String input = request.getReader().lines().collect(Collectors.joining(System.lineSeparator()));
-
- ObjectMapper mapper = new ObjectMapper();
- Object json = mapper.readValue(input, Object.class);
-
- System.err.println(label + "\n" + mapper.writerWithDefaultPrettyPrinter().writeValueAsString(json));
-
- /*
- * Only needed for error simulation ...
- */
- if (input.matches("^.*modelName.*$")) {
- simulatedError = input.replaceAll("^.*\"modelName\":\"", "").replaceAll("\".*$", "");
- }
- }
-
- /*
- * Various test responses:
- */
-
- // @formatter:off
-
- /** The accept response. */
- /*
- * Sample responses to initial create / delete transaction
- */
- private String acceptResponse =
- "{" +
- " \"status\": 202," +
- " \"entity\": {" +
- " \"requestReferences\": {" +
- " \"instanceId\": \"bc305d54-75b4-431b-adb2-eb6b9e546014\"," +
- " \"requestId\": \"rq1234d1-5a33-55df-13ab-12abad84e331\"" +
- " }" +
- " }" +
- "}";
-
- /** The policy exception response. */
- private String policyExceptionResponse =
- "{" +
- " \"status\": 400," +
- " \"entity\": { " +
- " \"requestError\": {" +
- " \"policyException\": {" +
- " \"messageId\": \"POL9003\"," +
- " \"text\": \"Message content size exceeds the allowable limit\"" +
- " }" +
- " }" +
- " }" +
- "}";
-
- /** The service exception response. */
- private String serviceExceptionResponse =
- "{" +
- " \"status\": 400," +
- " \"entity\": { " +
- " \"requestError\": {" +
- " \"serviceException\": {" +
- " \"messageId\": \"SVC2000\"," +
- " \"text\": \"Missing Parameter: %1. Error code is %2\"," +
- " \"variables\": [" +
- " \"severity\"," +
- " \"400\"" +
- " ]" +
- " }" +
- " }" +
- " }" +
- "}" +
- "";
-
- /** The in progress response. */
- /*
- * Sample response to subsequent getOrchestrationRequest
- */
- private String inProgressResponse =
- "{" +
- " \"status\": 200," +
- " \"entity\": {" +
- " \"request\": {" +
- " \"requestId\": \"rq1234d1-5a33-55df-13ab-12abad84e333\"," +
- " \"startTime\": \"Thu, 04 Jun 2009 02:51:59 GMT\"," +
- " \"instanceIds\": {" +
- " \"serviceInstanceId\": \"bc305d54-75b4-431b-adb2-eb6b9e546014\"" +
- " }," +
- " \"requestScope\": \"service\"," +
- " \"requestType\": \"createInstance\"," +
- " \"requestDetails\": {" +
- " \"modelInfo\": {" +
- " \"modelType\": \"service\"," +
- " \"modelId\": \"sn5256d1-5a33-55df-13ab-12abad84e764\"," +
- " \"modelNameVersionId\": \"ab6478e4-ea33-3346-ac12-ab121484a333\"," +
- " \"modelName\": \"WanBonding\"," +
- " \"modelVersion\": \"1\"" +
- " }," +
- " \"subscriberInfo\": {" +
- " \"globalSubscriberId\": \"C12345\"," +
- " \"subscriberName\": \"General Electric Division 12\"" +
- " }," +
- " \"requestParameters\": {" +
- " \"vpnId\": \"1a2b3c4d5e6f\"," +
- " \"productName\": \"Trinity\"," +
- " \"customerId\": \"icore9883749\"" +
- " }" +
- " }," +
- " \"requestStatus\": {" +
- " \"timestamp\": \"Thu, 04 Jun 2009 02:53:39 GMT\"," +
- " \"requestState\": \"InProgress\"," +
- " \"statusMessage\": \"vLan setup complete\"," +
- " \"percentProgress\": \"50\"" +
- " }" +
- " }" +
- " }" +
- "}";
-
- /*
- * Sample response to subsequent getOrchestrationRequests
- */
-
- /** The get orchestration requests response. */
- private String getOrchestrationRequestsResponse =
- "{" +
- " \"status\": 200," +
- " \"entity\": {" +
- " \"requestList\": [" +
- " {" +
- " \"request\": {" +
- " \"requestId\": \"rq1234d1-5a33-55df-13ab-12abad84e333\"," +
- " \"startTime\": \"Thu, 04 Jun 2009 02:51:59 GMT\"," +
- " \"finishTime\": \"Thu, 04 Jun 2009 02:55:59 GMT\"," +
- " \"instanceReferences\": {" +
- " \"serviceInstanceId\": \"bc305d54-75b4-431b-adb2-eb6b9e546014\"" +
- " }," +
- " \"requestScope\": \"service\"," +
- " \"requestType\": \"createInstance\"," +
- " \"requestDetails\": {" +
- " \"modelInfo\": {" +
- " \"modelType\": \"service\"," +
- " \"modelId\": \"sn5256d1-5a33-55df-13ab-12abad84e764\"," +
- " \"modelNameVersionId\": \"ab6478e4-ea33-3346-ac12-ab121484a333\"," +
- " \"modelName\": \"WanBonding\"," +
- " \"modelVersion\": \"1\"" +
- " }," +
- " \"subscriberInfo\": {" +
- " \"globalSubscriberId\": \"C12345\"," +
- " \"subscriberName\": \"General Electric Division 12\"" +
- " }," +
- " \"requestParameters\": {" +
- " \"vpnId\": \"1a2b3c4d5e6f\"," +
- " \"productName\": \"Trinity\"," +
- " \"customerId\": \"icore9883749\"" +
- " }" +
- " }," +
- " \"requestStatus\": {" +
- " \"timestamp\": \"Thu, 04 Jun 2009 02:54:49 GMT\"," +
- " \"requestState\": \"complete\"," +
- " \"statusMessage\": \"Resource Created\"," +
- " \"percentProgress\": \"100\"" +
- " }" +
- " }" +
- " }," +
- " {" +
- " \"request\": {" +
- " \"requestId\": \"rq1234d1-5a33-55df-13ab-12abad84e334\"," +
- " \"startTime\": \"Thu, 04 Jun 2009 03:52:59 GMT\"," +
- " \"instanceReferences\": {" +
- " \"serviceInstanceId\": \"bc305d54-75b4-431b-adb2-eb6b9e546014\"" +
- " }," +
- " \"requestScope\": \"service\"," +
- " \"requestType\": \"updateInstance\"," +
- " \"requestDetails\": {" +
- " \"modelInfo\": {" +
- " \"modelType\": \"service\"," +
- " \"modelId\": \"sn5256d1-5a33-55df-13ab-12abad84e764\"," +
- " \"modelNameVersionId\": \"ab6478e4-ea33-3346-ac12-ab121484a333\"," +
- " \"modelName\": \"WanBonding\"," +
- " \"modelVersion\": \"1\"" +
- " }," +
- " \"subscriberInfo\": {" +
- " \"globalSubscriberId\": \"C12345\"," +
- " \"subscriberName\": \"General Electric Division 12\"" +
- " }," +
- " \"requestParameters\": {" +
- " \"vpnId\": \"1a2b3c4d5e70\"," +
- " \"productName\": \"Trinity\"," +
- " \"customerId\": \"icore9883749\"" +
- " }" +
- " }," +
- " \"requestStatus\": {" +
- " \"timestamp\": \"Thu, 04 Jun 2009 03:53:39 GMT\"," +
- " \"requestState\": \"InProgress\"," +
- " \"statusMessage\": \"vLan setup complete\"," +
- " \"percentProgress\": \"50\"" +
- " }" +
- " }" +
- " }" +
- " ]" +
- " }" +
- "}";
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestPageController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestPageController.java
deleted file mode 100755
index 92f86f0b..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestPageController.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.controller.test;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.servlet.ModelAndView;
-
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-
-/**
- * The Class TestPageController.
- */
-@Controller
-public class TestPageController extends RestrictedBaseController {
-
- /**
- * Test mso page.
- *
- * @return the model and view
- */
- @RequestMapping(value = { "testMso.htm" }, method = RequestMethod.GET)
- public ModelAndView testMsoPage() {
- return new ModelAndView(getViewName());
- }
-
- /**
- * Test view edit page.
- *
- * @return the model and view
- */
- @RequestMapping(value = { "testViewEdit" }, method = RequestMethod.GET)
- public ModelAndView testViewEditPage() {
- return new ModelAndView(getViewName());
- }
-
-}