From 47b65efd69c5158d958261846803d2e15adfb448 Mon Sep 17 00:00:00 2001 From: "Kotagiri, Ramprasad (rp5662)" Date: Fri, 21 Aug 2020 08:40:37 -0400 Subject: java 11 upgrade and sonar scan fixes Recompile java source code using jdk11 Run in ojdk11 JRE tomcat container upgrade alpine base image Issue-ID: DCAEGEN2-2298 Change-Id: Ic4bf2626e5805508589cafe52b7c4e91d7ae3580 Signed-off-by: Kotagiri, Ramprasad (rp5662) --- .../org/onap/portalapp/conf/ExternalAppConfig.java | 20 +- .../portalapp/conf/ExternalAppInitializer.java | 24 +- .../interceptor/AuthenticationInterceptor.java | 117 +- .../interceptor/AuthorizationInterceptor.java | 42 +- .../onap/portalapp/login/LoginStrategyImpl.java | 67 +- .../onap/portalapp/service/AdminAuthExtension.java | 4 +- ccsdk-app-os/src/main/resources/swagger.json | 240 +-- .../webapp/WEB-INF/conf/system.properties.template | 2 +- ccsdk-app-os/src/main/webapp/api-specs.html | 1625 +++++++------------- .../app/ccsdk/home/executions-view-controller.js | 1 + .../webapp/app/ccsdk/home/executions_view.html | 14 +- .../src/main/webapp/app/ccsdk/home/oom-style.css | 635 ++++---- 12 files changed, 1209 insertions(+), 1582 deletions(-) (limited to 'ccsdk-app-os/src') diff --git a/ccsdk-app-os/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java b/ccsdk-app-os/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java index 665e0da..c59d5d9 100644 --- a/ccsdk-app-os/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java +++ b/ccsdk-app-os/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java @@ -1,8 +1,8 @@ /*- * ================================================================================ - * ECOMP Portal SDK + * DCAE Dashboard * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property + * Copyright (C) 2020 AT&T Intellectual Property * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ * limitations under the License. * ================================================================================ */ + package org.onap.portalapp.conf; import java.util.ArrayList; @@ -52,7 +53,6 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; - /** * ECOMP Portal SDK sample application. ECOMP Portal SDK core AppConfig class to * reuse interceptors, view resolvers and other features defined there. @@ -75,7 +75,7 @@ public class ExternalAppConfig extends AppConfig implements Configurable { private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ExternalAppConfig.class); private static final String HEALTH = "/health*"; - + @Configuration @Import(SystemProperties.class) static class InnerConfiguration { @@ -136,14 +136,14 @@ public class ExternalAppConfig extends AppConfig implements Configurable { @Bean public AuthenticationInterceptor authenticationInterceptor() { - return new AuthenticationInterceptor(); - } - + return new AuthenticationInterceptor(); + } + @Bean public AuthorizationInterceptor authorizationInterceptor() { - return new AuthorizationInterceptor(); - } - + return new AuthorizationInterceptor(); + } + /** * Adds request interceptors to the specified registry by calling * {@link AppConfig#addInterceptors(InterceptorRegistry)}, but excludes diff --git a/ccsdk-app-os/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java b/ccsdk-app-os/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java index 2624e2f..d966c3a 100644 --- a/ccsdk-app-os/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java +++ b/ccsdk-app-os/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java @@ -1,8 +1,8 @@ /*- * ================================================================================ - * ECOMP Portal SDK + * DCAE Dashboard * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property + * Copyright (C) 2020 AT&T Intellectual Property * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,31 +19,11 @@ */ package org.onap.portalapp.conf; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; - import org.onap.ccsdk.dashboard.util.DashboardProperties; import org.onap.portalsdk.core.conf.AppInitializer; -import org.onap.portalsdk.core.logging.format.AlarmSeverityEnum; -import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.web.context.WebApplicationContext; public class ExternalAppInitializer extends AppInitializer { - /* - @Override - protected WebApplicationContext createServletApplicationContext() { - WebApplicationContext context = super.createServletApplicationContext(); - try { - ((ConfigurableEnvironment) context.getEnvironment()).setActiveProfiles("onap"); - } catch (Exception e) { - System.out.println("Unable to set the active profile" + e.getMessage()); - //throw e; - } - return context; - } -*/ @Override protected Class[] getRootConfigClasses() { return super.getRootConfigClasses(); diff --git a/ccsdk-app-os/src/main/java/org/onap/portalapp/interceptor/AuthenticationInterceptor.java b/ccsdk-app-os/src/main/java/org/onap/portalapp/interceptor/AuthenticationInterceptor.java index 206f364..e8a64b3 100644 --- a/ccsdk-app-os/src/main/java/org/onap/portalapp/interceptor/AuthenticationInterceptor.java +++ b/ccsdk-app-os/src/main/java/org/onap/portalapp/interceptor/AuthenticationInterceptor.java @@ -18,6 +18,7 @@ * ============LICENSE_END========================================================= * *******************************************************************************/ + package org.onap.portalapp.interceptor; import java.io.IOException; @@ -25,7 +26,6 @@ import java.nio.charset.StandardCharsets; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -//import javax.xml.bind.DatatypeConverter; import java.util.Base64; import org.apache.http.HttpStatus; @@ -33,70 +33,65 @@ import org.onap.portalsdk.core.domain.User; import org.onap.portalsdk.core.service.UserProfileService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.ResponseEntity; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; public class AuthenticationInterceptor implements HandlerInterceptor { - @Autowired - private UserProfileService userSvc; - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { - String authString = request.getHeader("Authorization"); - try { - if(authString == null || authString.isEmpty()) - { - response.setStatus(HttpStatus.SC_UNAUTHORIZED); - response.sendError(HttpStatus.SC_UNAUTHORIZED, "Authentication information is missing"); - return false; //Do not continue with request - } else { - String decodedAuth = ""; - String[] authParts = authString.split("\\s+"); - String authInfo = authParts[1]; - byte[] bytes = null; - bytes = Base64.getDecoder().decode(authInfo); - //DatatypeConverter.parseBase64Binary(authInfo); - decodedAuth = new String(bytes,StandardCharsets.UTF_8); - String[] authen = decodedAuth.split(":"); + @Autowired + private UserProfileService userSvc; + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, + Object handler) { + String authString = request.getHeader("Authorization"); + try { + if (authString == null || authString.isEmpty()) { + response.setStatus(HttpStatus.SC_UNAUTHORIZED); + response.sendError(HttpStatus.SC_UNAUTHORIZED, + "Authentication information is missing"); + return false; // Do not continue with request + } else { + String decodedAuth = ""; + String[] authParts = authString.split("\\s+"); + String authInfo = authParts[1]; + byte[] bytes = null; + bytes = Base64.getDecoder().decode(authInfo); + // DatatypeConverter.parseBase64Binary(authInfo); + decodedAuth = new String(bytes, StandardCharsets.UTF_8); + String[] authen = decodedAuth.split(":"); + + if (authen.length > 1) { + User user = userSvc.getUserByLoginId(authen[0]); + if (user == null) { + response.sendError(HttpStatus.SC_UNAUTHORIZED, + "Un-authorized to perform this operation"); + return false; + } + } else { + return false; + } + } + } catch (Exception e) { + try { + response.sendError(HttpStatus.SC_UNAUTHORIZED, e.getMessage()); + } catch (IOException e1) { + return false; + } + return false; + } + return true; // Continue with request + } + + @Override + public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, + ModelAndView modelAndView) throws Exception { + // Ignore + } - if (authen.length > 1) { - User user = userSvc.getUserByLoginId(authen[0]); - if (user == null) { - response.sendError(HttpStatus.SC_UNAUTHORIZED, "Un-authorized to perform this operation"); - return false; - } -/* ResponseEntity getResponse = - userSrvc.checkUserExists(authen[0], authen[1]); - if (getResponse.getStatusCode().value() != 200) { - response.sendError(HttpStatus.SC_UNAUTHORIZED, "Un-authorized to perform this operation"); - return false; - }*/ - } else { - return false; - } - } - } catch (Exception e) { - try { - response.sendError(HttpStatus.SC_UNAUTHORIZED, e.getMessage()); - } catch (IOException e1) { - return false; - } - return false; - } - return true; //Continue with request - } - - @Override - public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, - ModelAndView modelAndView) throws Exception { - //Ignore - } - - @Override - public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) - throws Exception { - //Ignore - } + @Override + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, + Object handler, Exception ex) throws Exception { + // Ignore + } } diff --git a/ccsdk-app-os/src/main/java/org/onap/portalapp/interceptor/AuthorizationInterceptor.java b/ccsdk-app-os/src/main/java/org/onap/portalapp/interceptor/AuthorizationInterceptor.java index 2f3362b..df230d2 100644 --- a/ccsdk-app-os/src/main/java/org/onap/portalapp/interceptor/AuthorizationInterceptor.java +++ b/ccsdk-app-os/src/main/java/org/onap/portalapp/interceptor/AuthorizationInterceptor.java @@ -18,6 +18,7 @@ * ============LICENSE_END========================================================= * *******************************************************************************/ + package org.onap.portalapp.interceptor; import java.util.HashSet; @@ -33,30 +34,31 @@ import org.springframework.web.servlet.ModelAndView; import com.fasterxml.jackson.databind.ObjectMapper; public class AuthorizationInterceptor implements HandlerInterceptor { - + protected final ObjectMapper objectMapper = new ObjectMapper(); - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, + Object handler) throws Exception { Set userRoleSet = new HashSet(); Set userApps = new TreeSet<>(); userRoleSet.add("Standard User"); - userRoleSet.add("ECOMPC_DCAE_WRITE"); + userRoleSet.add("DCAE_WRITE"); userApps.add("dcae"); request.setAttribute("userRoles", userRoleSet); - request.setAttribute("userApps", userApps); - return true; //Continue with request - } - - @Override - public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, - ModelAndView modelAndView) throws Exception { - //Ignore - } - - @Override - public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) - throws Exception { - //Ignore - } + request.setAttribute("userApps", userApps); + return true; // Continue with request + } + + @Override + public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, + ModelAndView modelAndView) throws Exception { + // Ignore + } + + @Override + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, + Object handler, Exception ex) throws Exception { + // Ignore + } } diff --git a/ccsdk-app-os/src/main/java/org/onap/portalapp/login/LoginStrategyImpl.java b/ccsdk-app-os/src/main/java/org/onap/portalapp/login/LoginStrategyImpl.java index d7c9ab7..8e80e79 100644 --- a/ccsdk-app-os/src/main/java/org/onap/portalapp/login/LoginStrategyImpl.java +++ b/ccsdk-app-os/src/main/java/org/onap/portalapp/login/LoginStrategyImpl.java @@ -1,6 +1,6 @@ /*- * ================================================================================ - * ECOMP Portal SDK + * DCAE Dashboard * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property * ================================================================================ @@ -35,15 +35,9 @@ import org.onap.portalsdk.core.auth.LoginStrategy; import org.onap.portalsdk.core.command.LoginBean; import org.onap.portalsdk.core.domain.Role; import org.onap.portalsdk.core.domain.RoleFunction; -import org.onap.portalsdk.core.domain.User; -import org.onap.portalsdk.core.domain.FusionObject.Parameters; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.menu.MenuProperties; import org.onap.portalsdk.core.onboarding.exception.PortalAPIException; -import org.onap.portalsdk.core.onboarding.util.CipherUtil; -import org.onap.portalsdk.core.onboarding.util.PortalApiConstants; -import org.onap.portalsdk.core.onboarding.util.PortalApiProperties; -import org.onap.portalsdk.core.service.DataAccessService; import org.onap.portalsdk.core.service.LoginService; import org.onap.portalsdk.core.service.RoleService; import org.onap.portalsdk.core.util.SystemProperties; @@ -61,9 +55,10 @@ public class LoginStrategyImpl extends LoginStrategy { @Autowired private RoleService roleService; - + @Override - public ModelAndView doExternalLogin(HttpServletRequest request, HttpServletResponse response) throws IOException { + public ModelAndView doExternalLogin(HttpServletRequest request, HttpServletResponse response) + throws IOException { invalidateExistingSession(request); @@ -72,13 +67,15 @@ public class LoginStrategyImpl extends LoginStrategy { String password = request.getParameter("password"); commandBean.setLoginId(loginId); commandBean.setLoginPwd(password); - //commandBean.setUserid(loginId); + // commandBean.setUserid(loginId); commandBean = loginService.findUser(commandBean, - (String) request.getAttribute(MenuProperties.MENU_PROPERTIES_FILENAME_KEY), new HashMap()); + (String) request.getAttribute(MenuProperties.MENU_PROPERTIES_FILENAME_KEY), + new HashMap()); List roleFunctionList = roleService.getRoleFunctions(loginId); if (commandBean.getUser() == null) { - String loginErrorMessage = (commandBean.getLoginErrorMessage() != null) ? commandBean.getLoginErrorMessage() + String loginErrorMessage = + (commandBean.getLoginErrorMessage() != null) ? commandBean.getLoginErrorMessage() : "login.error.external.invalid - User name and/or password incorrect"; Map model = new HashMap<>(); model.put("error", loginErrorMessage); @@ -86,53 +83,55 @@ public class LoginStrategyImpl extends LoginStrategy { } else { // store the currently logged in user's information in the session UserUtils.setUserSession(request, commandBean.getUser(), commandBean.getMenu(), - commandBean.getBusinessDirectMenu(), - SystemProperties.getProperty(SystemProperties.LOGIN_METHOD_BACKDOOR), roleFunctionList); + commandBean.getBusinessDirectMenu(), + SystemProperties.getProperty(SystemProperties.LOGIN_METHOD_BACKDOOR), + roleFunctionList); // set the user's max role level in session final String adminRole = "System Administrator"; final String standardRole = "Standard User"; final String readRole = "Read Access"; final String writeRole = "Write Access"; - + String maxRole = ""; String authType = "READ"; String accessLevel = "app"; - - Predicate adminRoleFilter = + + Predicate adminRoleFilter = p -> p.getName() != null && p.getName().equalsIgnoreCase(adminRole); - - Predicate writeRoleFilter = - p -> p.getName() != null && (p.getName().equalsIgnoreCase(writeRole) || p.getName().equalsIgnoreCase(standardRole)); - - Predicate readRoleFilter = - p -> p.getName() != null && (p.getName().equalsIgnoreCase(readRole) ); + + Predicate writeRoleFilter = + p -> p.getName() != null && (p.getName().equalsIgnoreCase(writeRole) + || p.getName().equalsIgnoreCase(standardRole)); + + Predicate readRoleFilter = + p -> p.getName() != null && (p.getName().equalsIgnoreCase(readRole)); if (UserUtils.getUserSession(request) != null) { @SuppressWarnings("unchecked") - Collection userRoles = + Collection userRoles = UserUtils.getRoles(request).values(); - if (userRoles.stream().anyMatch(adminRoleFilter) ) { + if (userRoles.stream().anyMatch(adminRoleFilter)) { maxRole = "admin"; - } else if (userRoles.stream().anyMatch(writeRoleFilter) ) { + } else if (userRoles.stream().anyMatch(writeRoleFilter)) { maxRole = "write"; - } else if (userRoles.stream().anyMatch(readRoleFilter) ) { + } else if (userRoles.stream().anyMatch(readRoleFilter)) { maxRole = "read"; } - switch(maxRole) { + switch (maxRole) { case "admin": authType = "ADMIN"; accessLevel = "ops"; break; case "write": authType = "WRITE"; - accessLevel = "dev"; + accessLevel = "dev"; break; case "read": authType = "READ"; - accessLevel = "dev"; - break; + accessLevel = "dev"; + break; default: - accessLevel = "app"; + accessLevel = "app"; } } AppUtils.getSession(request).setAttribute("role_level", accessLevel); @@ -142,7 +141,7 @@ public class LoginStrategyImpl extends LoginStrategy { return new ModelAndView("redirect:welcome"); } } - + @Override public ModelAndView doLogin(HttpServletRequest request, HttpServletResponse response) throws Exception { @@ -165,7 +164,7 @@ public class LoginStrategyImpl extends LoginStrategy { return userid; } - private static String getUserIdFromCookie(HttpServletRequest request){ + private static String getUserIdFromCookie(HttpServletRequest request) { String userId = ""; Cookie[] cookies = request.getCookies(); Cookie userIdcookie = null; diff --git a/ccsdk-app-os/src/main/java/org/onap/portalapp/service/AdminAuthExtension.java b/ccsdk-app-os/src/main/java/org/onap/portalapp/service/AdminAuthExtension.java index da306f6..65e8541 100644 --- a/ccsdk-app-os/src/main/java/org/onap/portalapp/service/AdminAuthExtension.java +++ b/ccsdk-app-os/src/main/java/org/onap/portalapp/service/AdminAuthExtension.java @@ -1,6 +1,6 @@ /*- * ================================================================================ - * ECOMP Portal SDK + * DCAE Dashboard * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property * ================================================================================ @@ -17,11 +17,11 @@ * limitations under the License. * ================================================================================ */ + package org.onap.portalapp.service; import java.util.Set; -import org.onap.portalapp.service.IAdminAuthExtension; import org.onap.portalsdk.core.domain.Role; import org.onap.portalsdk.core.domain.User; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; diff --git a/ccsdk-app-os/src/main/resources/swagger.json b/ccsdk-app-os/src/main/resources/swagger.json index 7a02e5a..8d4f463 100644 --- a/ccsdk-app-os/src/main/resources/swagger.json +++ b/ccsdk-app-os/src/main/resources/swagger.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "description": "API to manage deployment of microservices using blueprints.", + "description": "API to manage deployment of microservices using blueprints. HTTP Basic authorization schema is required to authenticate users for all the resource endpoints. The client sends HTTP requests with an Authorization header containing base64-encoded username:password string.", "version": "1.4.0", "title": "DCAE Dashboard API", "contact": { @@ -53,6 +53,9 @@ }, "400": { "description": "Invalid status value" + }, + "401": { + "$ref": "#/responses/UnauthorizedError" } } } @@ -70,17 +73,24 @@ ], "parameters": [ { - "name": "pageNum", + "name": "page", "in": "query", "description": "pagination control - page number", "required": true, - "type": "string" + "type": "integer" }, { - "name": "viewPerPage", + "name": "size", "in": "query", "description": "pagination control - page size", "required": true, + "type": "integer" + }, + { + "name": "filters", + "in": "query", + "description": "search filters, {\"_include\":\"id\", \"tenant\":\"onap-tenant-1\",\"serviceId\":\"dcae\"}", + "required": false, "type": "string" } ], @@ -90,12 +100,21 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/DCAEService" + "$ref": "#/definitions/Deployment" + } + }, + "headers": { + "Link": { + "type": "string", + "description": "pagination header" } } }, "400": { "description": "Invalid status value" + }, + "401": { + "$ref": "#/responses/UnauthorizedError" } } }, @@ -124,12 +143,15 @@ } ], "responses": { - "200": { + "201": { "description": "successful operation", "schema": { "$ref": "#/definitions/DeploymentResource" } }, + "401": { + "$ref": "#/responses/UnauthorizedError" + }, "405": { "description": "Invalid input" } @@ -164,7 +186,7 @@ } ], "responses": { - "200": { + "204": { "description": "successful operation", "schema": { "type": "string" @@ -172,6 +194,9 @@ }, "400": { "description": "Invalid status value" + }, + "401": { + "$ref": "#/responses/UnauthorizedError" } } }, @@ -210,6 +235,9 @@ "400": { "description": "Invalid ID supplied" }, + "401": { + "$ref": "#/responses/UnauthorizedError" + }, "404": { "description": "Deployment not found" }, @@ -243,12 +271,15 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/DCAEService" + "$ref": "#/definitions/Deployment" } } }, "400": { "description": "Invalid status value" + }, + "401": { + "$ref": "#/responses/UnauthorizedError" } } } @@ -292,6 +323,9 @@ }, "400": { "description": "Invalid status value" + }, + "401": { + "$ref": "#/responses/UnauthorizedError" } } } @@ -322,6 +356,9 @@ "schema": { "$ref": "#/definitions/serviceHealth" } + }, + "401": { + "$ref": "#/responses/UnauthorizedError" } } } @@ -365,6 +402,9 @@ }, "400": { "description": "Invalid status value" + }, + "401": { + "$ref": "#/responses/UnauthorizedError" } } } @@ -382,35 +422,25 @@ ], "parameters": [ { - "name": "pageNum", + "name": "page", "in": "query", - "description": "pagination control - page number", - "required": true, + "description": "page number", + "required": false, "type": "string" }, { - "name": "viewPerPage", + "name": "size", "in": "query", - "description": "pagination control - page size", - "required": true, + "description": "page size", + "required": false, "type": "string" }, { - "name": "_include", + "name": "filters", "in": "query", - "description": "blueprint object properties need to be considered for filter", + "description": "search filters, {\"owner\":\"user1\", \"name\":\"user1-bp1\",\"id\":\"2334-343\"}", "required": false, - "type": "array", - "items": { - "type": "string", - "enum": [ - "typeName", - "typeId", - "typeVersion" - ], - "default": "typeName" - }, - "collectionFormat": "multi" + "type": "string" } ], "responses": { @@ -418,10 +448,19 @@ "description": "List of `DCAEServiceType` objects", "schema": { "$ref": "#/definitions/InlineResponse200" + }, + "headers": { + "Link": { + "type": "string", + "description": "pagination header" + } } }, "400": { "description": "Invalid tag value" + }, + "401": { + "$ref": "#/responses/UnauthorizedError" } } }, @@ -447,7 +486,7 @@ } ], "responses": { - "200": { + "201": { "description": "A `DCAEServiceType` object", "schema": { "$ref": "#/definitions/InlineResponse200" @@ -455,6 +494,9 @@ }, "400": { "description": "Invalid tag value" + }, + "401": { + "$ref": "#/responses/UnauthorizedError" } } } @@ -480,8 +522,11 @@ } ], "responses": { - "200": { + "204": { "description": "successful operation" + }, + "401": { + "$ref": "#/responses/UnauthorizedError" } } } @@ -509,11 +554,24 @@ "responses": { "200": { "description": "successful operation" + }, + "401": { + "$ref": "#/responses/UnauthorizedError" } } } } }, + "securityDefinitions": { + "basicAuth": { + "type": "basic" + } + }, + "security": [ + { + "basicAuth": [] + } + ], "responses": { "UnauthorizedError": { "description": "Authentication information is missing or invalid", @@ -534,33 +592,21 @@ } } }, - "ComponentInput": { - "type": "object", - "properties": { - "cname": { - "type": "string", - "description": "component namespace name" - }, - "dname": { - "type": "string", - "description": "component display name" - } - } - }, "InlineResponse200": { "type": "object", "properties": { - "links": { - "$ref": "#/definitions/InlineResponse200Links" + "totalItems": { + "type": "integer", + "format": "int32" }, - "totalCount": { + "totalPages": { "type": "integer", "format": "int32" }, "items": { "type": "array", "items": { - "$ref": "#/definitions/DCAEServiceType" + "$ref": "#/definitions/DCAEServiceTypeSummary" } } } @@ -592,53 +638,26 @@ } } }, - "DCAEService": { + "Deployment": { "type": "object", "properties": { - "serviceId": { + "id": { + "description": "cloudify deployment name", "type": "string" }, - "selfLink": { - "description": "Link.title is serviceId", - "$ref": "#/definitions/Link" + "blueprint_id": { + "description": "cloudify blueprint name", + "type": "string" }, - "created": { + "created_at": { "type": "string", "format": "date-time" }, - "modified": { + "updated_at": { "type": "string", "format": "date-time" }, - "typeLink": { - "description": "Link.title is typeId", - "$ref": "#/definitions/Link" - }, - "vnfId": { - "type": "string" - }, - "vnfLink": { - "description": "Link.title is vnfId", - "$ref": "#/definitions/Link" - }, - "vnfType": { - "type": "string" - }, - "vnfLocation": { - "type": "string", - "description": "Location information of the associated VNF" - }, - "deploymentRef": { - "type": "string", - "description": "Reference to a Cloudify deployment" - }, - "components": { - "type": "array", - "items": { - "$ref": "#/definitions/DCAEServiceComponent" - } - }, - "tenant": { + "tenant_name": { "type": "string", "description": "cloudify tenant name" } @@ -657,7 +676,7 @@ "items": { "type": "array", "items": { - "$ref": "#/definitions/DCAEService" + "$ref": "#/definitions/Deployment" } } } @@ -758,7 +777,6 @@ "owner", "typeName", "typeVersion", - "application", "component" ], "properties": { @@ -784,7 +802,7 @@ }, "component": { "type": "string", - "description": "onboarding component name" + "description": "onboarding component name e.g. dcae" } } }, @@ -868,6 +886,50 @@ } } }, + "DCAEServiceTypeSummary": { + "type": "object", + "required": [ + "created", + "owner", + "selfLink", + "typeId", + "typeName", + "typeVersion", + "application", + "component" + ], + "properties": { + "owner": { + "type": "string" + }, + "typeName": { + "type": "string", + "description": "Descriptive name for this DCAE service type" + }, + "application": { + "type": "string", + "description": "application name" + }, + "component": { + "type": "string", + "description": "component name" + }, + "typeVersion": { + "type": "integer", + "format": "int32", + "description": "Version number for this DCAE service type" + }, + "typeId": { + "type": "string", + "description": "Unique identifier for this DCAE service type" + }, + "created": { + "type": "string", + "format": "date-time", + "description": "Created timestamp for this DCAE service type in epoch time" + } + } + }, "CloudifyDeploymentUpgradeRequest": { "type": "object", "required": [ @@ -910,7 +972,7 @@ "required": [ "component", "tag", - "blueprintName", + "blueprintId", "tenant", "inputs" ], @@ -921,11 +983,11 @@ }, "tag": { "type": "string", - "description": "tag to identify the deployment" + "description": "unique tag to identify the deployment. A non-unique value results in name conflict error" }, "blueprintId": { "type": "string", - "description": "typeId from inventory, a unique Id for the blueprint" + "description": "typeId from inventory, a unique Id for the blueprint, this can be replaced with blueprintName and blueprintVersion" }, "blueprintName": { "type": "string", @@ -934,7 +996,7 @@ "blueprintVersion": { "type": "integer", "format": "int32", - "description": "Version number for this DCAE service type, optional. Defaults to latest version." + "description": "Version number for this DCAE service type, optional. Defaults to 1." }, "tenant": { "type": "string", diff --git a/ccsdk-app-os/src/main/webapp/WEB-INF/conf/system.properties.template b/ccsdk-app-os/src/main/webapp/WEB-INF/conf/system.properties.template index 940bcf1..2ca6f1b 100644 --- a/ccsdk-app-os/src/main/webapp/WEB-INF/conf/system.properties.template +++ b/ccsdk-app-os/src/main/webapp/WEB-INF/conf/system.properties.template @@ -51,7 +51,7 @@ mobile_enable = false # Cache config file is needed on the classpath cache_config_file_path = /WEB-INF/classes/cache.ccf -cache_switch = 199 +cache_switch = 1 cache_load_on_startup = false user_name = fullName diff --git a/ccsdk-app-os/src/main/webapp/api-specs.html b/ccsdk-app-os/src/main/webapp/api-specs.html index 9a7d498..6dadc64 100644 --- a/ccsdk-app-os/src/main/webapp/api-specs.html +++ b/ccsdk-app-os/src/main/webapp/api-specs.html @@ -1504,6 +1504,11 @@ var n=this.pipeline.run(e.tokenizer(t)),r=new e.Vector,i=[],o=this._fields.reduc +
  • + Authentication + +
  • +
  • Blueprints @@ -1606,11 +1611,6 @@ var n=this.pipeline.run(e.tokenizer(t)),r=new e.Vector,i=[],o=this._fields.reduc
  • -
  • - ComponentInput - -
  • -
  • InlineResponse200 @@ -1627,7 +1627,7 @@ var n=this.pipeline.run(e.tokenizer(t)),r=new e.Vector,i=[],o=this._fields.reduc
  • - DCAEService + Deployment
  • @@ -1661,6 +1661,11 @@ var n=this.pipeline.run(e.tokenizer(t)),r=new e.Vector,i=[],o=this._fields.reduc +
  • + DCAEServiceTypeSummary + +
  • +
  • CloudifyDeploymentUpgradeRequest @@ -1717,7 +1722,7 @@ var n=this.pipeline.run(e.tokenizer(t)),r=new e.Vector,i=[],o=this._fields.reduc

    Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

    -

    API to manage deployment of microservices using blueprints.

    +

    API to manage deployment of microservices using blueprints. HTTP Basic authorization schema is required to authenticate users for all the resource endpoints. The client sends HTTP requests with an Authorization header containing base64-encoded username:password string.

    Base URLs:

    • @@ -1728,6 +1733,10 @@ var n=this.pipeline.run(e.tokenizer(t)),r=new e.Vector,i=[],o=this._fields.reduc

    Email: Support

    +

    Authentication

    +
      +
    • HTTP Authentication, scheme: basic
    • +

    Blueprints

    Query blueprint information

    List Blueprints

    @@ -1741,14 +1750,14 @@ headers = { } r = requests.get('https://dcae-dashboard:8080/ccsdk-app/nb-api/v2/blueprints', params={ - 'pageNum': 'string', 'viewPerPage': 'string' + }, headers = headers) print r.json()
    # You can also use wget
    -curl -X GET https://dcae-dashboard:8080/ccsdk-app/nb-api/v2/blueprints?pageNum=string&viewPerPage=string \
    +curl -X GET https://dcae-dashboard:8080/ccsdk-app/nb-api/v2/blueprints \
       -H 'Accept: application/json'
     
     
    @@ -1768,48 +1777,25 @@ curl -X GET https://dcae-dashboard:8080/ccsdk-app/nb-api/v2/blueprints?pageNum=s -pageNum +page query string -true -pagination control - page number +false +page number -viewPerPage +size query string -true -pagination control - page size +false +page size -_include +filters query -array[string] +string false -blueprint object properties need to be considered for filter - - - -

    Enumerated Values

    - - - - - - - - - - - - - - - - - - - +
    ParameterValue
    _includetypeName
    _includetypeId
    _includetypeVersionsearch filters, {"owner":"user1", "name":"user1-bp1","id":"2334-343"}
    @@ -1820,72 +1806,17 @@ curl -X GET https://dcae-dashboard:8080/ccsdk-app/nb-api/v2/blueprints?pageNum=s

    200 Response

    {
    -  "links": {
    -    "previousLink": {
    -      "title": "string",
    -      "rel": "string",
    -      "uri": "http://example.com",
    -      "uriBuilder": {},
    -      "rels": [
    -        "string"
    -      ],
    -      "params": {
    -        "property1": "string",
    -        "property2": "string"
    -      },
    -      "type": "string"
    -    },
    -    "nextLink": {
    -      "title": "string",
    -      "rel": "string",
    -      "uri": "http://example.com",
    -      "uriBuilder": {},
    -      "rels": [
    -        "string"
    -      ],
    -      "params": {
    -        "property1": "string",
    -        "property2": "string"
    -      },
    -      "type": "string"
    -    }
    -  },
    -  "totalCount": 0,
    +  "totalItems": 0,
    +  "totalPages": 0,
       "items": [
         {
           "owner": "string",
           "typeName": "string",
    +      "application": "string",
    +      "component": "string",
           "typeVersion": 0,
    -      "blueprintTemplate": "string",
    -      "serviceIds": [
    -        "string"
    -      ],
    -      "vnfTypes": [
    -        "string"
    -      ],
    -      "serviceLocations": [
    -        "string"
    -      ],
    -      "asdcServiceId": "string",
    -      "asdcResourceId": "string",
    -      "asdcServiceURL": "string",
           "typeId": "string",
    -      "selfLink": {
    -        "title": "string",
    -        "rel": "string",
    -        "uri": "http://example.com",
    -        "uriBuilder": {},
    -        "rels": [
    -          "string"
    -        ],
    -        "params": {
    -          "property1": "string",
    -          "property2": "string"
    -        },
    -        "type": "string"
    -      },
    -      "created": "2020-08-12T15:08:29Z",
    -      "deactivated": "2020-08-12T15:08:29Z"
    +      "created": "2020-08-20T00:20:10Z"
         }
       ]
     }
    @@ -1913,10 +1844,45 @@ curl -X GET https://dcae-dashboard:8080/ccsdk-app/nb-api/v2/blueprints?pageNum=s
     Invalid tag value
     None
     
    +
    +401
    +Unauthorized
    +Authentication information is missing or invalid
    +None
    +
    +
    +
    +

    Response Headers

    + + + + + + + + + + + + + + + + + + + + + + + + +
    StatusHeaderTypeFormatDescription
    200Linkstringpagination header
    401WWW_Authenticatestringnone
    -