summaryrefslogtreecommitdiffstats
path: root/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi
diff options
context:
space:
mode:
Diffstat (limited to 'nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi')
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/SoApi.java174
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/SoV2Api.java194
2 files changed, 194 insertions, 174 deletions
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/SoApi.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/SoApi.java
deleted file mode 100644
index eb6c289f..00000000
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/SoApi.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright 2016-2017, Nokia Corporation
- *
- * 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.
- */
-package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.restapi;
-
-import javax.servlet.http.HttpServletResponse;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.so.SoLifecycleManager;
-import org.onap.vnfmadapter.so.model.*;
-import org.slf4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-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.ResponseBody;
-
-import static javax.servlet.http.HttpServletResponse.SC_CREATED;
-
-import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.Constants.BASE_URL;
-import static org.slf4j.LoggerFactory.getLogger;
-import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
-import static org.springframework.web.bind.annotation.RequestMethod.*;
-
-/**
- * Responsible for providing the Nokia sVNFM REST APIs
- */
-@Controller
-@RequestMapping(value = BASE_URL + "/so")
-public class SoApi {
- private static Logger logger = getLogger(SoApi.class);
-
- private final SoLifecycleManager soLifecycleManager;
-
- @Autowired
- SoApi(SoLifecycleManager lifecycleManager) {
- this.soLifecycleManager = lifecycleManager;
- }
-
- /**
- * Create the VNF
- *
- * @param request the creation request
- * @param vnfmId the identifier of the VNFM
- * @param httpResponse the HTTP response
- * @return the descriptor of the created VNF
- */
- @RequestMapping(value = "/{vnfmId}/vnfs", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
- @ResponseBody
- public SoVnfCreationResponse createVnf(@RequestBody SoVnfCreationRequest request, @PathVariable("vnfmId") String vnfmId, HttpServletResponse httpResponse) {
- logger.info("REST: Create the VNF");
- SoVnfCreationResponse response = soLifecycleManager.create(vnfmId, request);
- httpResponse.setStatus(SC_CREATED);
- return response;
- }
-
- /**
- * Activate the VNF
- *
- * @param request the activation request
- * @param vnfmId the identifier of the VNFM
- * @param httpResponse the HTTP response
- * @return the descriptor of the created VNF
- */
- @RequestMapping(value = "/{vnfmId}/vnfs/{vnfId}", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
- @ResponseBody
- public SoJobHandler activateVnf(@RequestBody SoVnfActivationRequest request, @PathVariable("vnfmId") String vnfmId, @PathVariable("vnfId") String vnfId, HttpServletResponse httpResponse) {
- logger.info("REST: Activate the VNF");
- return soLifecycleManager.activate(vnfmId, vnfId, request, httpResponse);
- }
-
- /**
- * Execute custom operation on the VNF
- *
- * @param request the custom operation request
- * @param vnfmId the identifier of the VNFM
- * @param httpResponse the HTTP response
- * @return the descriptor of the created VNF
- */
- @RequestMapping(value = "/{vnfmId}/vnfs/{vnfId}/customOperation", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
- @ResponseBody
- public SoJobHandler executeCustomOperation(@RequestBody SoVnfCustomOperation request, @PathVariable("vnfmId") String vnfmId, @PathVariable("vnfId") String vnfId, HttpServletResponse httpResponse) {
- logger.info("REST: Execute custom operation on the VNF");
- return soLifecycleManager.customOperation(vnfmId, vnfId, request, httpResponse);
- }
-
- /**
- * Terminate the VNF
- *
- * @param request the termination request
- * @param vnfmId the identifier of the VNFM
- * @param vnfId the identifier of the VNF
- * @param httpResponse the HTTP response
- * @return the job representing the VNF termination operation
- */
- @RequestMapping(value = "/{vnfmId}/vnfs/{vnfId}/terminate", method = POST, produces = APPLICATION_JSON_VALUE)
- @ResponseBody
- public SoJobHandler deactivateVnf(@RequestBody SoVnfTerminationRequest request, @PathVariable("vnfmId") String vnfmId, @PathVariable("vnfId") String vnfId, HttpServletResponse httpResponse) {
- logger.info("REST: Deactivate the VNF");
- return soLifecycleManager.deactivate(vnfmId, vnfId, request, httpResponse);
- }
-
- /**
- * Delete the VNF
- *
- * @param vnfmId the identifier of the VNFM
- * @param vnfId the identifier of the VNF
- * @param httpResponse the HTTP response
- */
- @RequestMapping(value = "/{vnfmId}/vnfs/{vnfId}", method = DELETE)
- public void deleteVnf(@PathVariable("vnfmId") String vnfmId, @PathVariable("vnfId") String vnfId, HttpServletResponse httpResponse) {
- logger.info("REST: Delete the VNF");
- soLifecycleManager.delete(vnfmId, vnfId);
- httpResponse.setStatus(HttpServletResponse.SC_NO_CONTENT);
- }
-
- /**
- * Query the job
- *
- * @param jobId the identifier of the job
- * @param vnfmId the identifier of the VNFM
- * @param httpResponse the HTTP response
- * @return the instantiated VNF info
- */
- @RequestMapping(value = "/{vnfmId}/jobs/{jobId}", method = GET, produces = APPLICATION_JSON_VALUE)
- @ResponseBody
- public SoJobDetail getJob(@PathVariable("vnfmId") String vnfmId, @PathVariable("jobId") String jobId, HttpServletResponse httpResponse) {
- logger.trace("REST: Query the job");
- return soLifecycleManager.getJobDetails(vnfmId, jobId);
- }
-
- /**
- * Scale the VNF (defined further in the VF-C driver integration documentation)
- *
- * @param request the scaling request
- * @param vnfmId the identifier of the VNFM
- * @param vnfId the identifier of the VNF
- * @param httpResponse the HTTP response
- * @return the job representing the scaling operation
- */
- @RequestMapping(value = "/{vnfmId}/vnfs/{vnfId}/scale", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
- @ResponseBody
- public SoJobHandler scaleVnf(@RequestBody SoVnfScaleRequest request, @PathVariable("vnfmId") String vnfmId, @PathVariable("vnfId") String vnfId, HttpServletResponse httpResponse) {
- logger.info("REST: Scale the VNF");
- return soLifecycleManager.scale(vnfmId, vnfId, request, httpResponse);
- }
-
- /**
- * Heal the VNF (defined further in the VF-C driver integration documentation)
- *
- * @param request the healing request
- * @param vnfmId the identifier of the VNFM
- * @param vnfInstanceId the identifier of the VNF
- * @param httpResponse the HTTP response
- * @return the job representing the healing operation
- */
- @RequestMapping(value = "/{vnfmId}/vnfs/{vnfId}/heal", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
- @ResponseBody
- public SoJobHandler healVnf(@RequestBody SoVnfHealRequest request, @PathVariable("vnfmId") String vnfmId, @PathVariable("vnfId") String vnfInstanceId, HttpServletResponse httpResponse) {
- logger.info("REST: Heal the VNF");
- return soLifecycleManager.heal(vnfmId, vnfInstanceId, request, httpResponse);
- }
-}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/SoV2Api.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/SoV2Api.java
new file mode 100644
index 00000000..13d4ef8e
--- /dev/null
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/SoV2Api.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2016-2017, Nokia Corporation
+ *
+ * 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.
+ */
+package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.restapi;
+
+import javax.servlet.http.HttpServletResponse;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.so.SoV2LifecycleManager;
+import org.onap.vnfmadapter.so.v2.model.*;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+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.ResponseBody;
+
+import static javax.servlet.http.HttpServletResponse.SC_CREATED;
+import static javax.servlet.http.HttpServletResponse.SC_NO_CONTENT;
+
+import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.Constants.BASE_URL;
+import static org.slf4j.LoggerFactory.getLogger;
+import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
+import static org.springframework.web.bind.annotation.RequestMethod.*;
+
+/**
+ * Responsible for providing the Nokia sVNFM REST APIs
+ */
+@Controller
+@RequestMapping(value = BASE_URL + "/so/v2")
+public class SoV2Api {
+ private static Logger logger = getLogger(SoV2Api.class);
+
+ private final SoV2LifecycleManager soLifecycleManager;
+
+ @Autowired
+ SoV2Api(SoV2LifecycleManager lifecycleManager) {
+ this.soLifecycleManager = lifecycleManager;
+ }
+
+ /**
+ * Create the VNF
+ *
+ * @param request the creation request
+ * @param vnfIdInAai the identifier of the VNF in A&AI
+ * @param httpResponse the HTTP response
+ * @return the descriptor of the created VNF
+ */
+ @RequestMapping(value = "/vnfs/{vnfIdInAai}", method = POST, consumes = APPLICATION_JSON_VALUE)
+ @ResponseBody
+ public void createVnf(@RequestBody SoV2VnfCreateRequest request, @PathVariable("vnfIdInAai") String vnfIdInAai, HttpServletResponse httpResponse) {
+ logger.info("REST: Create the VNF");
+ soLifecycleManager.createVnf(vnfIdInAai, request, httpResponse);
+ httpResponse.setStatus(SC_NO_CONTENT);
+ }
+
+ /**
+ * Query the VNF
+ *
+ * @param request the creation request
+ * @param vnfIdInAai the identifier of the VNF in A&AI
+ * @param httpResponse the HTTP response
+ * @return the descriptor of the created VNF
+ */
+ @RequestMapping(value = "/vnfs/{vnfIdInAai}", method = POST, consumes = APPLICATION_JSON_VALUE)
+ @ResponseBody
+ public SoV2VnfQueryResponse queryVnf(@RequestBody SoV2VnfQueryRequest request, @PathVariable("vnfIdInAai") String vnfIdInAai, HttpServletResponse httpResponse) {
+ logger.info("REST: Create the VNF");
+ return soLifecycleManager.queryVnf(vnfIdInAai, request, httpResponse);
+ }
+
+ /**
+ * Terminate the VNF
+ *
+ * @param request the termination request
+ * @param vnfIdInAai the identifier of the VNF in A&AI
+ * @param httpResponse the HTTP response
+ * @return the job representing the VNF termination operation
+ */
+ @RequestMapping(value = "/vnfs/{vnfIdInAai}", method = DELETE, consumes = APPLICATION_JSON_VALUE)
+ @ResponseBody
+ public void delete(@RequestBody SoV2VnfDeleteRequest request, @PathVariable("vnfIdInAai") String vnfIdInAai, HttpServletResponse httpResponse) {
+ logger.info("REST: Deactivate the VNF");
+ soLifecycleManager.delete(vnfIdInAai, request, httpResponse);
+ httpResponse.setStatus(SC_NO_CONTENT);
+ }
+
+ /**
+ * Update the VNF
+ *
+ * @param request the creation request
+ * @param vnfIdInAai the identifier of the VNF in A&AI
+ * @param httpResponse the HTTP response
+ * @return the descriptor of the created VNF
+ */
+ @RequestMapping(value = "/vnfs/{vnfIdInAai}", method = PUT, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
+ @ResponseBody
+ public SoV2VnfUpdateResponse updateVnf(@RequestBody SoV2VnfUpdateRequest request, @PathVariable("vnfIdInAai") String vnfIdInAai, HttpServletResponse httpResponse) {
+ logger.info("REST: Update the VNF");
+ return soLifecycleManager.updateVnf(vnfIdInAai, request, httpResponse);
+ }
+
+ /**
+ * Rollback update VNF
+ *
+ * @param request the rollback request
+ * @param httpResponse the HTTP response
+ */
+ @RequestMapping(value = "/vnfs/{vnfIdInAai}/rollback", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
+ @ResponseBody
+ public void rollback(@RequestBody SoV2RollbackVnfUpdate request, @PathVariable("vnfIdInAai") String vnfIdInAai, HttpServletResponse httpResponse) {
+ logger.info("REST: Create the VF");
+ soLifecycleManager.rollback(vnfIdInAai, request, httpResponse);
+ }
+
+ /**
+ * Create the VF module
+ *
+ * @param request the creation request
+ * @param vnfIdInAai the identifier of the VNF in A&AI
+ * @param httpResponse the HTTP response
+ */
+ @RequestMapping(value = "/vfmodule/{vnfIdInAai}/{vfModuleId}", method = POST, consumes = APPLICATION_JSON_VALUE)
+ @ResponseBody
+ public void createVfModule(@RequestBody SoV2VfModuleCreateRequest request, @PathVariable("vnfIdInAai") String vnfIdInAai, @PathVariable("vfModuleId") String vfModuleId, HttpServletResponse httpResponse) {
+ logger.info("REST: Create the VF");
+ soLifecycleManager.createVfModule(vnfIdInAai, vfModuleId, request, httpResponse);
+ httpResponse.setStatus(SC_CREATED);
+ }
+
+ /**
+ * Terminate the VF module
+ *
+ * @param request the termination request
+ * @param vnfIdInAai the identifier of the VNF in A&AI
+ * @param httpResponse the HTTP response
+ */
+ @RequestMapping(value = "/vfmodule/{vnfIdInAai}/{vfModuleId}", method = DELETE, consumes = APPLICATION_JSON_VALUE)
+ @ResponseBody
+ public void deleteVfModule(@RequestBody SoV2VnfDeleteRequest request, @PathVariable("vnfIdInAai") String vnfIdInAai, @PathVariable("vfModuleId") String vfModuleId, HttpServletResponse httpResponse) {
+ logger.info("REST: Deactivate the VNF");
+ soLifecycleManager.deleteVfModule(vnfIdInAai, vfModuleId, request, httpResponse);
+ httpResponse.setStatus(SC_NO_CONTENT);
+ }
+
+ /**
+ * Update the VF module
+ *
+ * @param request the creation request
+ * @param vnfIdInAai the identifier of the VNF in A&AI
+ * @param httpResponse the HTTP response
+ * @return the descriptor of the created VNF
+ */
+ @RequestMapping(value = "/vfmodule/{vnfIdInAai}/{vfModuleId}", method = PUT, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
+ @ResponseBody
+ public SoV2VnfUpdateResponse updateVfModule(@RequestBody SoV2VnfUpdateRequest request, @PathVariable("vnfIdInAai") String vnfIdInAai, @PathVariable("vfModuleId") String vfModuleId, HttpServletResponse httpResponse) {
+ logger.info("REST: Update the VNF");
+ return soLifecycleManager.updateVfModule(vnfIdInAai, vfModuleId, request, httpResponse);
+ }
+
+ /**
+ * Rollback update VNF
+ *
+ * @param request the rollback request
+ * @param httpResponse the HTTP response
+ */
+ @RequestMapping(value = "/vfmodule/{vnfIdInAai}/{vfModuleId}/rollback", method = PUT, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
+ @ResponseBody
+ public void rollbackVfModuleUpdate(@RequestBody SoV2RollbackVnfUpdate request, @PathVariable("vnfIdInAai") String vnfIdInAai, HttpServletResponse httpResponse) {
+ logger.info("REST: Roll back VF module update");
+ soLifecycleManager.rollback(vnfIdInAai, request, httpResponse);
+ }
+
+ /**
+ * Provides a probe for SO to test health of VNFM adapter
+ *
+ * @param httpResponse the HTTP response
+ */
+ @RequestMapping(value = "/ping", method = GET)
+ public void testLcnConnectivity(HttpServletResponse httpResponse) {
+ httpResponse.setStatus(HttpServletResponse.SC_OK);
+ }
+}