2 * ============LICENSE_START========================================================================
3 * ONAP : tr-069-adapter
4 * =================================================================================================
5 * Copyright (C) 2020 CommScope Inc Intellectual Property.
6 * =================================================================================================
7 * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,
8 * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You
9 * may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14 * either express or implied. See the License for the specific language governing permissions and
15 * limitations under the License.
16 * ===============LICENSE_END=======================================================================
19 package org.commscope.tr069adapter.mapper.netconf.controller;
21 import org.commscope.tr069adapter.mapper.model.NetConfRequest;
22 import org.commscope.tr069adapter.mapper.model.NetConfResponse;
23 import org.commscope.tr069adapter.mapper.model.NetConfServerDetails;
24 import org.commscope.tr069adapter.mapper.netconf.NetConfRequestHandler;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
27 import org.springframework.beans.factory.annotation.Autowired;
28 import org.springframework.web.bind.annotation.PostMapping;
29 import org.springframework.web.bind.annotation.RequestBody;
30 import org.springframework.web.bind.annotation.RequestMapping;
31 import org.springframework.web.bind.annotation.RestController;
34 @RequestMapping("/tr069MapperNBI")
35 public class NetConfRequestReceiver {
37 private static final Logger LOG = LoggerFactory.getLogger(NetConfRequestReceiver.class);
40 NetConfRequestHandler handler;
42 @PostMapping("/setConfig")
43 public NetConfResponse setConfigRequest(@RequestBody NetConfRequest request) {
44 LOG.info("Received request for SET-CONFIG. Request : {}", request);
45 NetConfResponse response = handler.handleSetConfigRequest(request);
46 LOG.info("Processed SET-CONFIG request. Response : {}", response);
51 public NetConfResponse getRequest(@RequestBody NetConfRequest request) {
52 LOG.info("Received request for GET. Request : {}", request);
53 NetConfResponse response = handler.handleGetRequest(request);
54 LOG.info("Processed GET request. Response : {}", response);
58 @PostMapping("/getConfig")
59 public NetConfResponse getConfigRequest(@RequestBody NetConfRequest request) {
60 LOG.info("Received request for GET-CONFIG. Request : {}", request);
61 NetConfResponse response = handler.handleGetConfigRequest(request);
62 LOG.info("Processed GET-CONFIG request. Response : {}", response);
66 @PostMapping("/delConfig")
67 public NetConfResponse delConfigRequest(@RequestBody NetConfRequest request) {
68 LOG.info("Received request for DEL-CONFIG. Request : {}", request);
69 NetConfResponse response = handler.handleDelConfigRequest(request);
70 LOG.info("Processed DEL-CONFIG request. Response : {}", response);
74 @PostMapping("/softwareDowload")
75 public NetConfResponse swDownloadRequest(@RequestBody NetConfRequest request) {
76 LOG.info("Received request for SW-DOWNLOAD. Request : {}", request);
77 NetConfResponse response = handler.handleSWDownloadRequest(request);
78 LOG.info("Processed SW-DOWNLOAD request. Response : ");
82 @PostMapping("/softwareActivate")
83 public NetConfResponse swActivateRequest(@RequestBody NetConfRequest request) {
84 LOG.info("Received request for SW-ACTIVATE. Request : {}", request);
85 LOG.info("Processed SW-ACTIVATE request. Response : ");
89 @PostMapping("/registerNetconfServer")
90 public boolean handelRegisterEvent(@RequestBody NetConfServerDetails request) {
91 LOG.info("Received request for register event. Request : {}", request);
92 boolean result = handler.handelRegisterEvent(request);
93 LOG.info("Processed register event request. Response : {}", request);
97 @PostMapping("/addobject")
98 public NetConfResponse addObjectRequest(@RequestBody NetConfRequest request) {
99 LOG.info("Received request for addObject. Request : {}", request);
100 NetConfResponse response = handler.handleAddObjectRequest(request);
101 LOG.info("Processed addObject request. Response : {}", response);
105 @PostMapping("/deleteobject")
106 public NetConfResponse deleteObjectRequest(@RequestBody NetConfRequest request) {
107 LOG.info("Received request for deleteObject. Request : {}", request);
108 NetConfResponse response = handler.handleDeleteObjectRequest(request);
109 LOG.info("Processed deleteObject request. Response : {}", response);
113 @PostMapping("/reboot")
114 public NetConfResponse rebootRequest(@RequestBody NetConfRequest request) {
115 LOG.info("Received request for Reboot. Request : {}", request);
116 NetConfResponse response = handler.handleRequestWithoutInputParams(request);
117 LOG.info("Processed Reboot request. Response : {}", response);
121 @PostMapping("/reset")
122 public NetConfResponse resetRequest(@RequestBody NetConfRequest request) {
123 LOG.info("Received request for Reset. Request : {}", request);
124 NetConfResponse response = handler.handleRequestWithoutInputParams(request);
125 LOG.info("Processed Reset request. Response : {}", response);
129 @PostMapping("/spaobject")
130 public NetConfResponse spaObjectRequest(@RequestBody NetConfRequest request) {
131 LOG.info("Received request for SPAObject. Request : {}", request);
132 NetConfResponse response = handler.handleSPAObjectRequest(request);
133 LOG.info("Processed SPAObject request. Response : {}", response);
137 @PostMapping("/gpaobject")
138 public NetConfResponse gpaObjectRequest(@RequestBody NetConfRequest request) {
139 LOG.info("Received request for GPAObject. Request : {}", request);
140 NetConfResponse response = handler.handleGPAObjectRequest(request);
141 LOG.info("Processed GPAObject request. Response : {}", response);
145 @PostMapping("/connectionstatus")
146 public NetConfResponse connectionStatusRequest(@RequestBody NetConfRequest request) {
147 LOG.info("Received request for Connection Status. Request : {}", request);
148 NetConfResponse response = handler.handleConnectionStatusRequest(request);
149 LOG.info("Processed Connection Status request. Response : {}", response);
153 @PostMapping("/download")
154 public NetConfResponse downloadRequest(@RequestBody NetConfRequest request) {
155 LOG.info("Received request for download. Request : {}", request);
156 NetConfResponse response = handler.handleDownloadRequest(request);
157 LOG.info("Processed download request. Response : {}", response);