diff options
Diffstat (limited to 'vid-app-common/src/main/java/org/openecomp/vid/services')
8 files changed, 0 insertions, 401 deletions
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/services/AaiService.java b/vid-app-common/src/main/java/org/openecomp/vid/services/AaiService.java deleted file mode 100644 index d3bacadec..000000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/services/AaiService.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.openecomp.vid.services; - -import org.openecomp.vid.aai.AaiResponse; -import org.openecomp.vid.aai.SubscriberFilteredResults; -import org.openecomp.vid.aai.model.AaiGetTenatns.GetTenantsResponse; -import org.openecomp.vid.roles.RoleValidator; - -import javax.ws.rs.core.Response; -import java.util.List; - -/** - * Created by Oren on 7/4/17. - */ -public interface AaiService { - - - SubscriberFilteredResults getFullSubscriberList(RoleValidator roleValidator); - - AaiResponse getSubscriberData(String subscriberId, RoleValidator roleValidator); - - AaiResponse getServices(RoleValidator roleValidator); - - AaiResponse getAaiZones(); - - AaiResponse getAicZoneForPnf(String globalCustomerId , String serviceType , String serviceId); - - Response getVNFData(String globalSubscriberId, String serviceType); - - AaiResponse<GetTenantsResponse[]> getTenants(String globalCustomerId, String serviceType, RoleValidator roleValidator); - - AaiResponse getVNFData(String globalSubscriberId, String serviceType, String serviceInstanceId); - - Response getVersionByInvariantId(List<String> modelInvariantId); -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/services/AaiServiceImpl.java b/vid-app-common/src/main/java/org/openecomp/vid/services/AaiServiceImpl.java deleted file mode 100644 index cb0962869..000000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/services/AaiServiceImpl.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.openecomp.vid.services; - -import org.ecomp.aai.model.AaiAICZones.AicZones; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.vid.aai.*; -import org.openecomp.vid.aai.model.AaiGetServicesRequestModel.*; -import org.openecomp.vid.aai.model.AaiGetTenatns.GetTenantsResponse; -import org.openecomp.vid.model.*; -import org.openecomp.vid.roles.RoleValidator; -import org.openecomp.vid.scheduler.SchedulerProperties; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.ResponseEntity; - -import javax.ws.rs.core.Response; - -import java.util.List; - -/** - * Created by Oren on 7/4/17. - */ -public class AaiServiceImpl implements AaiService { - - - @Autowired - private AaiClientInterface aaiClient; - - - @Override - public SubscriberFilteredResults getFullSubscriberList(RoleValidator roleValidator) { - AaiResponse<SubscriberList> subscriberResponse = aaiClient.getAllSubscribers(); - SubscriberFilteredResults subscriberFilteredResults = - new SubscriberFilteredResults(roleValidator,subscriberResponse.getT(), - subscriberResponse.getErrorMessage(), - subscriberResponse.getHttpCode()); - - return subscriberFilteredResults; - } - - @Override - public AaiResponse getSubscriberData(String subscriberId, RoleValidator roleProvider) { - AaiResponse<Services> subscriberResponse = aaiClient.getSubscriberData(subscriberId); - String subscriberGlobalId = subscriberResponse.getT().globalCustomerId; - for (ServiceSubscription serviceSubscription : subscriberResponse.getT().serviceSubscriptions.serviceSubscription) { - String serviceType = serviceSubscription.serviceType; - serviceSubscription.isPermitted = roleProvider.isServicePermitted(subscriberGlobalId,serviceType); - } - return subscriberResponse; - - } - - @Override - public Response getVersionByInvariantId(List<String> modelInvariantId) { - try { - return aaiClient.getVersionByInvariantId(modelInvariantId); - }catch (Exception e){ - e.printStackTrace(); - } - return null; - } - - @Override - public AaiResponse getServices(RoleValidator roleValidator) { - AaiResponse<GetServicesAAIRespone> subscriberResponse = aaiClient.getServices(); - for (org.openecomp.vid.aai.model.AaiGetServicesRequestModel.Service service :subscriberResponse.getT().service){ - service.isPermitted = true; - } - return subscriberResponse; - } - - @Override - public AaiResponse<GetTenantsResponse[]> getTenants(String globalCustomerId, String serviceType, RoleValidator roleValidator) { - AaiResponse<GetTenantsResponse[]> aaiGetTenantsResponse = aaiClient.getTenants(globalCustomerId,serviceType); - GetTenantsResponse[] tenants = aaiGetTenantsResponse.getT(); - for (int i=0;i<tenants.length;i++){ - tenants[i].isPermitted = roleValidator.isTenantPermitted(globalCustomerId,serviceType, tenants[i].tenantID); - } - return aaiGetTenantsResponse; - } - - @Override - public AaiResponse getVNFData(String globalSubscriberId, String serviceType, String serviceInstanceId) { - return aaiClient.getVNFData(globalSubscriberId,serviceType,serviceInstanceId); - } - - @Override - public Response getVNFData(String globalSubscriberId, String serviceType) { - return aaiClient.getVNFData(globalSubscriberId,serviceType); - } - - @Override - public AaiResponse getAaiZones() { - AaiResponse<AicZones> response = aaiClient.getAllAicZones(); - return response; - } - - @Override - public AaiResponse getAicZoneForPnf(String globalCustomerId , String serviceType , String serviceId) { - AaiResponse<AicZones> response = aaiClient.getAicZoneForPnf(globalCustomerId , serviceType , serviceId); - return response; - } -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/services/ChangeManagementService.java b/vid-app-common/src/main/java/org/openecomp/vid/services/ChangeManagementService.java deleted file mode 100644 index 3ac528282..000000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/services/ChangeManagementService.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.openecomp.vid.services; - -import org.openecomp.vid.changeManagement.ChangeManagementRequest; -import org.json.simple.JSONArray; -import org.openecomp.vid.mso.rest.Request; -import org.springframework.http.ResponseEntity; - -import java.util.Collection; - -public interface ChangeManagementService { - Collection<Request> getMSOChangeManagements(); - ResponseEntity<String> doChangeManagement(ChangeManagementRequest request, String vnfName); - JSONArray getSchedulerChangeManagements(); -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/services/ChangeManagementServiceImpl.java b/vid-app-common/src/main/java/org/openecomp/vid/services/ChangeManagementServiceImpl.java deleted file mode 100644 index 7e69d8fec..000000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/services/ChangeManagementServiceImpl.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.openecomp.vid.services; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.vid.changeManagement.ChangeManagementRequest; -import org.openecomp.vid.changeManagement.RequestDetails; -import org.openecomp.vid.mso.MsoBusinessLogic; -import org.openecomp.vid.mso.MsoResponseWrapper; -import org.openecomp.vid.controller.MsoController; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.vid.scheduler.*; - -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.openecomp.vid.mso.rest.Request; -import org.springframework.stereotype.Service; -import org.json.simple.JSONArray; -import org.json.simple.parser.JSONParser; - -import java.util.Date; -import java.util.List; -import java.util.Collection; - - -@Service -public class ChangeManagementServiceImpl implements ChangeManagementService { - @Override - public Collection<Request> getMSOChangeManagements() { - Collection<Request> result = null; - MsoBusinessLogic msoBusinessLogic = new MsoBusinessLogic(); - try { - result = msoBusinessLogic.getOrchestrationRequestsForDashboard(); - } catch (Exception e) { - e.printStackTrace(); - } - - return result; - } - - private RequestDetails findRequestByVnfName(List<RequestDetails> requests, String vnfName){ - - if (requests == null) - return null; - - for(RequestDetails requestDetails: requests){ - if(requestDetails.getVnfName().equals(vnfName)){ - return requestDetails; - } - } - - return null; - } - - @Override - public ResponseEntity<String> doChangeManagement(ChangeManagementRequest request, String vnfName) { - if (request == null) - return null; - ResponseEntity<String> response = null; - RequestDetails currentRequestDetails = findRequestByVnfName(request.getRequestDetails(), vnfName); - MsoResponseWrapper msoResponseWrapperObject = null; - if(currentRequestDetails != null){ - MsoBusinessLogic msoBusinessLogicObject = new MsoBusinessLogic(); - String serviceInstanceId = currentRequestDetails.getRelatedInstList().get(0).getRelatedInstance().getInstanceId(); - String vnfInstanceId = currentRequestDetails.getVnfInstanceId(); - try { - if (request.getRequestType().equalsIgnoreCase("update")) { - - msoResponseWrapperObject = msoBusinessLogicObject.updateVnf(currentRequestDetails, serviceInstanceId, vnfInstanceId); - } - else if (request.getRequestType().equalsIgnoreCase("replace")) - { - msoResponseWrapperObject = msoBusinessLogicObject.replaceVnf(currentRequestDetails, serviceInstanceId, vnfInstanceId); -// throw new NotImplementedException(); - } - response = new ResponseEntity<String>(msoResponseWrapperObject.getResponse(), HttpStatus.OK); - return response; - } catch (Exception e) { - e.printStackTrace(); - } - - } - - // AH:TODO: return ChangeManagementResponse - return null; - } - - @Override - public JSONArray getSchedulerChangeManagements() { - JSONArray result = null; - try { - String path = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_GET_SCHEDULES); - org.openecomp.vid.scheduler.RestObject<String> restObject = new org.openecomp.vid.scheduler.RestObject<>(); - SchedulerRestInterfaceIfc restClient = SchedulerRestInterfaceFactory.getInstance(); - - String str = new String(); - restObject.set(str); - restClient.Get(str, "", path, restObject); - String restCallResult = restObject.get(); - JSONParser parser = new JSONParser(); - Object parserResult = parser.parse(restCallResult); - result = (JSONArray) parserResult; - } catch (Exception e) { - e.printStackTrace(); - } - - return result; - } - - -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/services/VidService.java b/vid-app-common/src/main/java/org/openecomp/vid/services/VidService.java deleted file mode 100644 index 4fb0ff160..000000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/services/VidService.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.openecomp.vid.services; - -import org.openecomp.vid.asdc.AsdcCatalogException; -import org.openecomp.vid.asdc.beans.Service; -import org.openecomp.vid.model.ServiceModel; - -import java.util.Collection; -import java.util.Map; - -public interface VidService { - - Collection<Service> getServices(Map<String, String[]> requestParams) - throws AsdcCatalogException; - - ServiceModel getService(String uuid) throws AsdcCatalogException; - -}
\ No newline at end of file diff --git a/vid-app-common/src/main/java/org/openecomp/vid/services/VidServiceImpl.java b/vid-app-common/src/main/java/org/openecomp/vid/services/VidServiceImpl.java deleted file mode 100644 index f647af456..000000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/services/VidServiceImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.openecomp.vid.services; - -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.AsdcClient; -import org.openecomp.vid.asdc.beans.Service; -import org.openecomp.vid.asdc.parser.ToscaParser; -import org.openecomp.vid.asdc.parser.ToscaParserImpl; -import org.openecomp.vid.asdc.parser.ToscaParserImpl2; -import org.openecomp.vid.model.ServiceModel; -import org.springframework.beans.factory.annotation.Autowired; - -import java.nio.file.Path; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.*; - -/** - * The Class VidController. - */ - -public class VidServiceImpl implements VidService { - /** - * The Constant LOG. - */ - private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(VidServiceImpl.class); - /** - * The Constant dateFormat. - */ - private final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); - protected final AsdcClient asdcClient; - @Autowired - private ToscaParserImpl2 toscaParser; - - public VidServiceImpl(AsdcClient asdcClient) { - this.asdcClient = asdcClient; - } - - /* - * (non-Javadoc) - * - * @see org.openecomp.vid.controller.VidService#getServices(java.util.Map) - */ - @Override - public Collection<Service> getServices(Map<String, String[]> requestParams) - throws AsdcCatalogException { - return asdcClient.getServices(requestParams); - } - - /* - * (non-Javadoc) - * - * @see org.openecomp.vid.controller.VidService#getService(java.lang.String) - */ - @Override - public ServiceModel getService(String uuid) throws AsdcCatalogException { - final Path serviceCsar = asdcClient.getServiceToscaModel(UUID.fromString(uuid)); - ToscaParser tosca = new ToscaParserImpl(); - serviceCsar.toFile().getAbsolutePath(); - ServiceModel serviceModel = null; - try { - final Service asdcServiceMetadata = asdcClient.getService(UUID.fromString(uuid)); - try { - serviceModel = toscaParser.makeServiceModel(serviceCsar, asdcServiceMetadata); - } - catch (SdcToscaParserException e){ - serviceModel = tosca.makeServiceModel(uuid, serviceCsar, asdcServiceMetadata); - } - } catch (Exception e) { - e.printStackTrace(); - } - return serviceModel; - } - - -}
\ No newline at end of file diff --git a/vid-app-common/src/main/java/org/openecomp/vid/services/WorkflowService.java b/vid-app-common/src/main/java/org/openecomp/vid/services/WorkflowService.java deleted file mode 100644 index 7f43433de..000000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/services/WorkflowService.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.openecomp.vid.services; - -import org.openecomp.vid.model.Workflow; -import java.util.Collection; - -public interface WorkflowService { - Collection<String> getWorkflowsForVNFs(Collection<String> vnfNames); - Collection<String> getAllWorkflows(); -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/services/WorkflowServiceImpl.java b/vid-app-common/src/main/java/org/openecomp/vid/services/WorkflowServiceImpl.java deleted file mode 100644 index deb506069..000000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/services/WorkflowServiceImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.openecomp.vid.services; - -import org.openecomp.vid.model.Workflow; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.stream.Collectors; - -@Service -public class WorkflowServiceImpl implements WorkflowService { - //TODO: Add the list of workflows hard coded or from DB. - private ArrayList<Workflow> workflows = new ArrayList<>(Arrays.asList( - new Workflow(0, "Upgrade", new ArrayList<>(Arrays.asList("VNF1", "VNF2", "VNF3", "VNF4"))), - new Workflow(1, "Clean", new ArrayList<>(Arrays.asList("VNF1", "VNF2", "VNF3"))), - new Workflow(2, "Reinstall", new ArrayList<>(Arrays.asList("VNF1", "VNF2", "VNF4"))), - new Workflow(3, "Dump", new ArrayList<>(Arrays.asList("VNF1", "VNF3", "VNF4"))), - new Workflow(4, "Flush", new ArrayList<>(Arrays.asList("VNF2", "VNF3", "VNF4"))) - )); - - @Override - public Collection<String> getWorkflowsForVNFs(Collection<String> vnfNames) { - Collection<String> result = workflows.stream() - .filter(workflow -> workflow.getVnfNames().containsAll(vnfNames)) - .map(workflow -> workflow.getWorkflowName()) - .distinct() - .collect(Collectors.toList()); - - return result; - } - - @Override - public Collection<String> getAllWorkflows() { - return workflows.stream() - .map(workflow -> workflow.getWorkflowName()) - .distinct() - .collect(Collectors.toList()); - } -} |