From d62f39bb2ee31d0e5c9fd0f26934223d9c2a6539 Mon Sep 17 00:00:00 2001 From: lizi Date: Wed, 11 Oct 2017 18:34:42 +0800 Subject: [PATCH] Add swagger.json to main/resources. Change-Id: Idbe8b45d713017a0dd487037e504238f7a58efcc Issue-ID: AAI-430 Signed-off-by: lizi --- esr-mgr/pom.xml | 67 ++ .../src/main/java/org/onap/aai/esr/ExtsysApp.java | 1 + .../java/org/onap/aai/esr/resource/EmsManager.java | 2 + .../aai/esr/resource/ThirdpatySdncManager.java | 2 + .../java/org/onap/aai/esr/resource/VimManager.java | 3 + .../org/onap/aai/esr/resource/VnfmManager.java | 3 + esr-mgr/src/main/resources/swagger.json | 723 +++++++++++++++++++++ 7 files changed, 801 insertions(+) create mode 100644 esr-mgr/src/main/resources/swagger.json diff --git a/esr-mgr/pom.xml b/esr-mgr/pom.xml index 7f9057d..cfc1714 100644 --- a/esr-mgr/pom.xml +++ b/esr-mgr/pom.xml @@ -200,4 +200,71 @@ 1.0.0 + + + + swagger + + + io.swagger + swagger-jersey2-jaxrs + 1.5.0 + + + + + + com.github.kongchen + swagger-maven-plugin + 3.1.1 + + + + false + org.onap.aai.esr.resource + /api/aai-esr-server/v1/ + + API Descriptions for External System Management + v1 + + This page shows all the APIs available in the ESR server module. + + + http://www.github.com/kongchen/swagger-maven-plugin + + + li.zi30@zte.com.cn + Zi Li + + + http://www.apache.org/licenses/LICENSE-2.0.html + Apache 2.0 + + + + + ${basedir}/src/main/resources + + + + + + compile + + generate + + + + + + io.swagger + swagger-hibernate-validations + 1.5.6 + + + + + + + diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysApp.java b/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysApp.java index adcaa08..2e1ae6f 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysApp.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysApp.java @@ -61,6 +61,7 @@ public class ExtsysApp extends Application { MsbHelper helper = new MsbHelper(msbClient); try { helper.registerMsb(); + LOGGER.info("Register esr-server to msb by java-sdk finished"); } catch (Exception e) { LOGGER.error("Register esr-server to msb by java-sdk failed", e); } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/EmsManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/EmsManager.java index 861cd5a..11fba23 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/resource/EmsManager.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/EmsManager.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.SwaggerDefinition; import org.eclipse.jetty.http.HttpStatus; import org.onap.aai.esr.entity.rest.EmsRegisterInfo; @@ -40,6 +41,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +@SwaggerDefinition @Path("/emses") @Api(tags = {" ems Management "}) public class EmsManager { diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpatySdncManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpatySdncManager.java index 0d0f935..8660ade 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpatySdncManager.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpatySdncManager.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.SwaggerDefinition; import org.eclipse.jetty.http.HttpStatus; import org.onap.aai.esr.entity.rest.ThirdpartySdncRegisterInfo; @@ -40,6 +41,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +@SwaggerDefinition @Path("/sdncontrollers") @Api(tags = {"ThirdParty sdnc Management "}) public class ThirdpatySdncManager { diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/VimManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/VimManager.java index 75fc10b..aa7d34d 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/resource/VimManager.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/VimManager.java @@ -20,6 +20,8 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.SwaggerDefinition; + import org.eclipse.jetty.http.HttpStatus; import org.onap.aai.esr.entity.rest.VimRegisterInfo; import org.onap.aai.esr.util.ExtsysUtil; @@ -38,6 +40,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +@SwaggerDefinition @Path("/vims") @Api(tags = {" vim Management "}) public class VimManager { diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/VnfmManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/VnfmManager.java index 4a76a90..893b5b5 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/resource/VnfmManager.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/VnfmManager.java @@ -21,6 +21,8 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.SwaggerDefinition; + import org.eclipse.jetty.http.HttpStatus; import org.onap.aai.esr.entity.rest.VnfmRegisterInfo; import org.onap.aai.esr.util.ExtsysUtil; @@ -39,6 +41,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +@SwaggerDefinition @Path("/vnfms") @Api(tags = {" vnfm Management "}) public class VnfmManager { diff --git a/esr-mgr/src/main/resources/swagger.json b/esr-mgr/src/main/resources/swagger.json new file mode 100644 index 0000000..155b4cb --- /dev/null +++ b/esr-mgr/src/main/resources/swagger.json @@ -0,0 +1,723 @@ +{ + "swagger" : "2.0", + "info" : { + "description" : "This page shows all the APIs available in the ESR server module.", + "version" : "v1", + "title" : "API Descriptions for External System Management", + "termsOfService" : "http://www.github.com/kongchen/swagger-maven-plugin", + "contact" : { + "name" : "Zi Li", + "email" : "li.zi30@zte.com.cn" + }, + "license" : { + "name" : "Apache 2.0", + "url" : "http://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "basePath" : "/api/aai-esr-server/v1/", + "tags" : [ { + "name" : " ems Management " + }, { + "name" : " service test " + }, { + "name" : " vim Management " + }, { + "name" : " vnfm Management " + }, { + "name" : "ThirdParty sdnc Management " + } ], + "paths" : { + "/emses" : { + "get" : { + "tags" : [ " ems Management " ], + "summary" : "get all ems ", + "description" : "", + "operationId" : "queryEmsList", + "produces" : [ "application/json" ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + }, + "post" : { + "tags" : [ " ems Management " ], + "summary" : "create a ems", + "description" : "", + "operationId" : "registerEms", + "consumes" : [ "application/json" ], + "produces" : [ "text/plain", "application/json" ], + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "ems", + "required" : true, + "schema" : { + "$ref" : "#/definitions/EmsRegisterInfo" + } + } ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + } + }, + "/emses/{emsId}" : { + "get" : { + "tags" : [ " ems Management " ], + "summary" : "get ems by id", + "description" : "", + "operationId" : "queryemsById", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "emsId", + "in" : "path", + "description" : "ems id", + "required" : true, + "type" : "string" + } ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + }, + "put" : { + "tags" : [ " ems Management " ], + "summary" : "update a ems", + "description" : "", + "operationId" : "updateEms", + "consumes" : [ "application/json" ], + "produces" : [ "text/plain", "application/json" ], + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "ems", + "required" : true, + "schema" : { + "$ref" : "#/definitions/EmsRegisterInfo" + } + }, { + "name" : "emsId", + "in" : "path", + "description" : "ems id", + "required" : true, + "type" : "string" + } ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + }, + "delete" : { + "tags" : [ " ems Management " ], + "summary" : "delete a ems", + "description" : "", + "operationId" : "delems", + "parameters" : [ { + "name" : "emsId", + "in" : "path", + "description" : "ems id", + "required" : true, + "type" : "string" + } ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + } + }, + "/sdncontrollers" : { + "get" : { + "tags" : [ "ThirdParty sdnc Management " ], + "summary" : "get all thirdParty sdnc ", + "description" : "", + "operationId" : "queryThirdpartySdncList", + "produces" : [ "application/json" ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + }, + "post" : { + "tags" : [ "ThirdParty sdnc Management " ], + "summary" : "register a thirdparty sdnc", + "description" : "", + "operationId" : "registerThirdpatySdnc", + "consumes" : [ "application/json" ], + "produces" : [ "text/plain", "application/json" ], + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "thirdPartySdnc", + "required" : true, + "schema" : { + "$ref" : "#/definitions/ThirdpartySdncRegisterInfo" + } + } ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + } + }, + "/sdncontrollers/{thirdPartySdncId}" : { + "get" : { + "tags" : [ "ThirdParty sdnc Management " ], + "summary" : "get thirdParty sdnc by id", + "description" : "", + "operationId" : "queryThirdpartySdncById", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "thirdPartySdncId", + "in" : "path", + "description" : "thirdparty sdnc id", + "required" : true, + "type" : "string" + } ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + }, + "put" : { + "tags" : [ "ThirdParty sdnc Management " ], + "summary" : "update a thirdParty Sdnc", + "description" : "", + "operationId" : "updateThirdpartySdnc", + "consumes" : [ "application/json" ], + "produces" : [ "text/plain", "application/json" ], + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "thirdpartySdnc", + "required" : true, + "schema" : { + "$ref" : "#/definitions/ThirdpartySdncRegisterInfo" + } + }, { + "name" : "thirdPartySdncId", + "in" : "path", + "description" : "sdnc id", + "required" : true, + "type" : "string" + } ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + }, + "delete" : { + "tags" : [ "ThirdParty sdnc Management " ], + "summary" : "delete a thirdparty sdnc", + "description" : "", + "operationId" : "delThirdpartySdnc", + "parameters" : [ { + "name" : "thirdPartySdncId", + "in" : "path", + "description" : "thirdparty sdnc id", + "required" : true, + "type" : "string" + } ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + } + }, + "/test" : { + "get" : { + "tags" : [ " service test " ], + "summary" : " service test ", + "description" : "", + "operationId" : "queryEmsList", + "produces" : [ "application/json" ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + } + }, + "/vims" : { + "get" : { + "tags" : [ " vim Management " ], + "summary" : "get all vim ", + "description" : "", + "operationId" : "queryVimList", + "produces" : [ "application/json" ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + }, + "post" : { + "tags" : [ " vim Management " ], + "summary" : "create a vim", + "description" : "", + "operationId" : "registerVims", + "consumes" : [ "application/json" ], + "produces" : [ "text/plain", "application/json" ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + } + }, + "/vims/{cloudOwner}/{cloudRegionId}" : { + "get" : { + "tags" : [ " vim Management " ], + "summary" : "get vim by id", + "description" : "", + "operationId" : "queryVimById", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "cloudOwner", + "in" : "path", + "required" : true, + "type" : "string" + }, { + "name" : "cloudRegionId", + "in" : "path", + "required" : true, + "type" : "string" + } ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + }, + "put" : { + "tags" : [ " vim Management " ], + "summary" : "update a vim", + "description" : "", + "operationId" : "updatevims", + "consumes" : [ "application/json" ], + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "cloudOwner", + "in" : "path", + "required" : true, + "type" : "string" + }, { + "name" : "cloudRegionId", + "in" : "path", + "required" : true, + "type" : "string" + } ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + }, + "delete" : { + "tags" : [ " vim Management " ], + "summary" : "delete a vim", + "description" : "", + "operationId" : "delvim", + "parameters" : [ { + "name" : "cloudOwner", + "in" : "path", + "required" : true, + "type" : "string" + }, { + "name" : "cloudRegionId", + "in" : "path", + "required" : true, + "type" : "string" + } ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + } + }, + "/vnfms" : { + "get" : { + "tags" : [ " vnfm Management " ], + "summary" : "get all vnfm ", + "description" : "", + "operationId" : "queryVnfmList", + "produces" : [ "application/json" ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + }, + "post" : { + "tags" : [ " vnfm Management " ], + "summary" : "create a vnfm", + "description" : "", + "operationId" : "registerVnfm", + "consumes" : [ "application/json" ], + "produces" : [ "text/plain", "application/json" ], + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "vnfm", + "required" : true, + "schema" : { + "$ref" : "#/definitions/VnfmRegisterInfo" + } + } ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + } + }, + "/vnfms/{vnfmId}" : { + "get" : { + "tags" : [ " vnfm Management " ], + "summary" : "get vnfm by id", + "description" : "", + "operationId" : "queryVnfmById", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "vnfmId", + "in" : "path", + "description" : "vnfm id", + "required" : true, + "type" : "string" + } ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + }, + "put" : { + "tags" : [ " vnfm Management " ], + "summary" : "update a vnfm", + "description" : "", + "operationId" : "updateVnfm", + "consumes" : [ "application/json" ], + "produces" : [ "text/plain", "application/json" ], + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "vnfm", + "required" : true, + "schema" : { + "$ref" : "#/definitions/VnfmRegisterInfo" + } + }, { + "name" : "vnfmId", + "in" : "path", + "description" : "vnfm id", + "required" : true, + "type" : "string" + } ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + }, + "delete" : { + "tags" : [ " vnfm Management " ], + "summary" : "delete a vnfm", + "description" : "", + "operationId" : "delVnfm", + "parameters" : [ { + "name" : "vnfmId", + "in" : "path", + "description" : "vnfm id", + "required" : true, + "type" : "string" + } ], + "responses" : { + "404" : { + "description" : "microservice not found" + }, + "415" : { + "description" : "Unprocessable MicroServiceInfo Entity " + }, + "500" : { + "description" : "internal server error" + } + } + } + } + }, + "definitions" : { + "AlarmAddr" : { + "type" : "object", + "properties" : { + "ip" : { + "type" : "string" + }, + "port" : { + "type" : "string" + }, + "user" : { + "type" : "string" + }, + "password" : { + "type" : "string" + } + } + }, + "EmsRegisterInfo" : { + "type" : "object", + "properties" : { + "emsId" : { + "type" : "string" + }, + "name" : { + "type" : "string" + }, + "vendor" : { + "type" : "string" + }, + "version" : { + "type" : "string" + }, + "resourceAddr" : { + "$ref" : "#/definitions/FtpAddr" + }, + "performanceAddr" : { + "$ref" : "#/definitions/FtpAddr" + }, + "alarmAddr" : { + "$ref" : "#/definitions/AlarmAddr" + } + } + }, + "FtpAddr" : { + "type" : "object", + "properties" : { + "ftptype" : { + "type" : "string" + }, + "ip" : { + "type" : "string" + }, + "port" : { + "type" : "string" + }, + "user" : { + "type" : "string" + }, + "password" : { + "type" : "string" + }, + "remotepath" : { + "type" : "string" + }, + "passive" : { + "type" : "boolean", + "default" : false + } + } + }, + "ThirdpartySdncRegisterInfo" : { + "type" : "object", + "properties" : { + "thirdpartySdncId" : { + "type" : "string" + }, + "name" : { + "type" : "string" + }, + "vendor" : { + "type" : "string" + }, + "version" : { + "type" : "string" + }, + "type" : { + "type" : "string" + }, + "location" : { + "type" : "string" + }, + "url" : { + "type" : "string" + }, + "userName" : { + "type" : "string" + }, + "password" : { + "type" : "string" + }, + "productName" : { + "type" : "string" + }, + "protocol" : { + "type" : "string" + } + } + }, + "VnfmRegisterInfo" : { + "type" : "object", + "properties" : { + "vnfmId" : { + "type" : "string" + }, + "name" : { + "type" : "string" + }, + "type" : { + "type" : "string" + }, + "vimId" : { + "type" : "string" + }, + "vendor" : { + "type" : "string" + }, + "version" : { + "type" : "string" + }, + "certificateUrl" : { + "type" : "string" + }, + "url" : { + "type" : "string" + }, + "userName" : { + "type" : "string" + }, + "password" : { + "type" : "string" + } + } + } + } +} \ No newline at end of file -- 2.16.6