Extend probe mechanism
[vid.git] / vid-app-common / src / main / java / org / onap / vid / controller / ProbeController.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.vid.controller;
22
23 import org.onap.portalsdk.core.controller.RestrictedBaseController;
24 import org.onap.vid.aai.AaiClient;
25 import org.onap.vid.aai.AaiOverTLSClientInterface;
26 import org.onap.vid.model.probes.ExternalComponentStatus;
27 import org.onap.vid.mso.MsoBusinessLogic;
28 import org.onap.vid.scheduler.SchedulerService;
29 import org.onap.vid.services.VidService;
30 import org.springframework.beans.factory.annotation.Autowired;
31 import org.springframework.web.bind.annotation.GetMapping;
32 import org.springframework.web.bind.annotation.RequestMapping;
33 import org.springframework.web.bind.annotation.RestController;
34
35 import java.util.ArrayList;
36 import java.util.List;
37
38 @RestController
39 @RequestMapping("probe")
40 public class ProbeController extends RestrictedBaseController {
41
42     private final AaiClient aaiClient;
43     private final AaiOverTLSClientInterface newAaiClient;
44     private final VidService vidService;
45     private final MsoBusinessLogic msoBusinessLogic;
46     private final SchedulerService schedulerService;
47
48
49     @Autowired
50     public ProbeController(AaiClient aaiClient, VidService vidService, MsoBusinessLogic msoBusinessLogic, SchedulerService schedulerService, AaiOverTLSClientInterface newAaiClient) {
51         this.aaiClient = aaiClient;
52         this.vidService = vidService;
53         this.msoBusinessLogic = msoBusinessLogic;
54         this.schedulerService = schedulerService;
55         this.newAaiClient = newAaiClient;
56     }
57
58     @GetMapping
59     public List<ExternalComponentStatus> getProbe() {
60         List<ExternalComponentStatus> componentStatuses = new ArrayList<>();
61         componentStatuses.add(aaiClient.probeAaiGetAllSubscribers());
62         componentStatuses.add(newAaiClient.probeGetAllSubscribers());
63         componentStatuses.add(schedulerService.probeGetSchedulerChangeManagements());
64         componentStatuses.add(msoBusinessLogic.probeGetOrchestrationRequests());
65         componentStatuses.add(vidService.probeSDCConnection());
66         return componentStatuses;
67     }
68
69 }