--- /dev/null
+/*\r
+ * ============LICENSE_START========================================================================\r
+ * ONAP : tr-069-adapter\r
+ * =================================================================================================\r
+ * Copyright (C) 2020 CommScope Inc Intellectual Property.\r
+ * =================================================================================================\r
+ * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,\r
+ * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You\r
+ * may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\r
+ * either express or implied. See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ===============LICENSE_END=======================================================================\r
+ */\r
+\r
+package org.commscope.tr069adapter.netconf.restapi;\r
+\r
+import java.util.List;\r
+\r
+import org.commscope.tr069adapter.mapper.model.NetConfServerDetails;\r
+import org.commscope.tr069adapter.netconf.server.NetConfServerManagerImpl;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.springframework.beans.factory.annotation.Autowired;\r
+import org.springframework.web.bind.annotation.GetMapping;\r
+import org.springframework.web.bind.annotation.PostMapping;\r
+import org.springframework.web.bind.annotation.RequestMapping;\r
+import org.springframework.web.bind.annotation.RequestParam;\r
+import org.springframework.web.bind.annotation.RestController;\r
+\r
+@RestController\r
+@RequestMapping("/netConfServerManagerService")\r
+public class NetConfServerManagerRestApi {\r
+\r
+ private static final Logger LOG = LoggerFactory.getLogger(NetConfServerManagerRestApi.class);\r
+\r
+ @Autowired\r
+ NetConfServerManagerImpl manager;\r
+\r
+ @PostMapping("/createServer")\r
+ public NetConfServerDetails createNetConfServerInstance(@RequestParam String deviceId,\r
+ @RequestParam String enodeBName) {\r
+ LOG.info("Received Create NetConf Server request for deviceID: {}, enodeBName: {}", deviceId,\r
+ enodeBName);\r
+ NetConfServerDetails serverDetails = manager.createServer(deviceId, enodeBName);\r
+ LOG.info("Successfully processed NetConf Server wit server details : {}", serverDetails);\r
+ return serverDetails;\r
+ }\r
+\r
+ @GetMapping("/listServers")\r
+ public List<NetConfServerDetails> listNetConfServersInfo() {\r
+ LOG.info("Received request to list all NetConf Servers information");\r
+ List<NetConfServerDetails> serverDetails = manager.getServersInfo();\r
+ LOG.info("Successfully processed request to list all NetConf Servers information");\r
+ return serverDetails;\r
+ }\r
+\r
+ @PostMapping("/unregisterServer")\r
+ public boolean unregisterNetConfServerInstance(@RequestParam String deviceId,\r
+ @RequestParam String enodeBName) {\r
+ LOG.info("Received request for Unregister NetConf Server for deviceID: {}, enodeBName: {}",\r
+ deviceId, enodeBName);\r
+ boolean status = manager.unregister(deviceId, enodeBName);\r
+ LOG.info("Unregister request is processed. NetConf Server for deviceID: {} , unregistered= {}",\r
+ deviceId, status);\r
+ return status;\r
+ }\r
+\r
+}\r