* Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.\r
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.\r
* Modifications Copyright (C) 2020 Nordix Foundation.\r
+ * Modifications Copyright (C) 2020 Bell Canada.\r
* ================================================================================\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
import io.swagger.annotations.ResponseHeader;\r
import io.swagger.annotations.SecurityDefinition;\r
import io.swagger.annotations.SwaggerDefinition;\r
+import java.net.HttpURLConnection;\r
+import java.util.List;\r
import java.util.UUID;\r
import javax.ws.rs.Consumes;\r
import javax.ws.rs.DELETE;\r
import javax.ws.rs.Produces;\r
import javax.ws.rs.QueryParam;\r
import javax.ws.rs.core.Response;\r
+import javax.ws.rs.core.Response.Status;\r
import org.onap.policy.api.main.rest.provider.HealthCheckProvider;\r
import org.onap.policy.api.main.rest.provider.PolicyProvider;\r
import org.onap.policy.api.main.rest.provider.PolicyTypeProvider;\r
\r
private static final Logger LOGGER = LoggerFactory.getLogger(ApiRestController.class);\r
\r
+ private static final String ERROR_MESSAGE_NO_POLICIES_FOUND = "No policies found";\r
+\r
+ private static final String EXTENSION_NAME = "interface info";\r
+\r
+ private static final String API_VERSION_NAME = "api-version";\r
+ private static final String API_VERSION = "1.0.0";\r
+\r
+ private static final String LAST_MOD_NAME = "last-mod-release";\r
+\r
+ private static final String AUTHORIZATION_TYPE = "basicAuth";\r
+\r
+ private static final String VERSION_MINOR_NAME = "X-MinorVersion";\r
+ private static final String VERSION_MINOR_DESCRIPTION =\r
+ "Used to request or communicate a MINOR version back from the client"\r
+ + " to the server, and from the server back to the client";\r
+\r
+ private static final String VERSION_PATCH_NAME = "X-PatchVersion";\r
+ private static final String VERSION_PATCH_DESCRIPTION = "Used only to communicate a PATCH version in a response for"\r
+ + " troubleshooting purposes only, and will not be provided by" + " the client on request";\r
+\r
+ private static final String VERSION_LATEST_NAME = "X-LatestVersion";\r
+ private static final String VERSION_LATEST_DESCRIPTION = "Used only to communicate an API's latest version";\r
+\r
+ private static final String REQUEST_ID_NAME = "X-ONAP-RequestID";\r
+ private static final String REQUEST_ID_HDR_DESCRIPTION = "Used to track REST transactions for logging purpose";\r
+ private static final String REQUEST_ID_PARAM_DESCRIPTION = "RequestID for http transaction";\r
+\r
+ private static final String AUTHENTICATION_ERROR_MESSAGE = "Authentication Error";\r
+ private static final String AUTHORIZATION_ERROR_MESSAGE = "Authorization Error";\r
+ private static final String SERVER_ERROR_MESSAGE = "Internal Server Error";\r
+ private static final String NOT_FOUND_MESSAGE = "Resource Not Found";\r
+ private static final String INVALID_BODY_MESSAGE = "Invalid Body";\r
+ private static final String INVALID_PAYLOAD_MESSAGE = "Not Acceptable Payload";\r
+ private static final String HTTP_CONFLICT_MESSAGE = "Delete Conflict, Rule Violation";\r
+\r
+\r
/**\r
* Retrieves the healthcheck status of the API component.\r
*\r
@ApiOperation(value = "Perform a system healthcheck", notes = "Returns healthy status of the Policy API component",\r
response = HealthCheckReport.class,\r
responseHeaders = {\r
- @ResponseHeader(name = "X-MinorVersion",\r
- description = "Used to request or communicate a MINOR version back from the client"\r
- + " to the server, and from the server back to the client",\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-PatchVersion",\r
- description = "Used only to communicate a PATCH version in a response for"\r
- + " troubleshooting purposes only, and will not be provided by" + " the client on request",\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-LatestVersion", description = "Used only to communicate an API's latest version",\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-ONAP-RequestID",\r
- description = "Used to track REST transactions for logging purpose", response = UUID.class)},\r
- authorizations = @Authorization(value = "basicAuth"), tags = {"HealthCheck", },\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"HealthCheck", },\r
extensions = {\r
- @Extension(name = "interface info", properties = {@ExtensionProperty(name = "api-version", value = "1.0.0"),\r
- @ExtensionProperty(name = "last-mod-release", value = "Dublin")})})\r
- @ApiResponses(value = {@ApiResponse(code = 401, message = "Authentication Error"),\r
- @ApiResponse(code = 403, message = "Authorization Error"),\r
- @ApiResponse(code = 500, message = "Internal Server Error")})\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "Dublin")})})\r
+ @ApiResponses(value = {\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)})\r
public Response\r
- getHealthCheck(@HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+ getHealthCheck(@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId) {\r
\r
updateApiStatisticsCounter(Target.OTHER, Result.SUCCESS, HttpMethod.GET);\r
return makeOkResponse(requestId, new HealthCheckProvider().performHealthCheck());\r
notes = "Returns current statistics including the counters of API invocation",\r
response = StatisticsReport.class,\r
responseHeaders = {\r
- @ResponseHeader(name = "X-MinorVersion",\r
- description = "Used to request or communicate a MINOR version back from the client"\r
- + " to the server, and from the server back to the client",\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-PatchVersion",\r
- description = "Used only to communicate a PATCH version in a response for"\r
- + " troubleshooting purposes only, and will not be provided by" + " the client on request",\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-LatestVersion", description = "Used only to communicate an API's latest version",\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-ONAP-RequestID",\r
- description = "Used to track REST transactions for logging purpose", response = UUID.class)},\r
- authorizations = @Authorization(value = "basicAuth"), tags = {"Statistics", },\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"Statistics", },\r
extensions = {\r
- @Extension(name = "interface info", properties = {@ExtensionProperty(name = "api-version", value = "1.0.0"),\r
- @ExtensionProperty(name = "last-mod-release", value = "Dublin")})})\r
- @ApiResponses(value = {@ApiResponse(code = 401, message = "Authentication Error"),\r
- @ApiResponse(code = 403, message = "Authorization Error"),\r
- @ApiResponse(code = 500, message = "Internal Server Error")})\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "Dublin")})})\r
+ @ApiResponses(value = {\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)})\r
public Response\r
- getStatistics(@HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+ getStatistics(@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId) {\r
\r
updateApiStatisticsCounter(Target.OTHER, Result.SUCCESS, HttpMethod.GET);\r
\r
notes = "Returns a list of existing policy types stored in Policy Framework",\r
response = ToscaServiceTemplate.class,\r
responseHeaders = {\r
- @ResponseHeader(name = "X-MinorVersion",\r
- description = "Used to request or communicate a MINOR version back from the client"\r
- + " to the server, and from the server back to the client",\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-PatchVersion",\r
- description = "Used only to communicate a PATCH version in a response for"\r
- + " troubleshooting purposes only, and will not be provided by" + " the client on request",\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-LatestVersion", description = "Used only to communicate an API's latest version",\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-ONAP-RequestID",\r
- description = "Used to track REST transactions for logging purpose", response = UUID.class)},\r
- authorizations = @Authorization(value = "basicAuth"), tags = {"PolicyType", },\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"PolicyType", },\r
extensions = {\r
- @Extension(name = "interface info", properties = {@ExtensionProperty(name = "api-version", value = "1.0.0"),\r
- @ExtensionProperty(name = "last-mod-release", value = "Dublin")})})\r
- @ApiResponses(value = {@ApiResponse(code = 401, message = "Authentication Error"),\r
- @ApiResponse(code = 403, message = "Authorization Error"),\r
- @ApiResponse(code = 500, message = "Internal Server Error")})\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "Dublin")})})\r
+ @ApiResponses(value = {\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)})\r
public Response\r
- getAllPolicyTypes(@HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+ getAllPolicyTypes(@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId) {\r
\r
try (PolicyTypeProvider policyTypeProvider = new PolicyTypeProvider()) {\r
ToscaServiceTemplate serviceTemplate = policyTypeProvider.fetchPolicyTypes(null, null);\r
updateApiStatisticsCounter(Target.POLICY_TYPE, Result.SUCCESS, HttpMethod.GET);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelException | PfModelRuntimeException pfme) {\r
- LOGGER.debug("GET /policytypes", pfme);\r
+ LOGGER.warn("GET /policytypes", pfme);\r
updateApiStatisticsCounter(Target.POLICY_TYPE, Result.FAILURE, HttpMethod.GET);\r
return makeErrorResponse(requestId, pfme);\r
}\r
notes = "Returns a list of all available versions for the specified policy type",\r
response = ToscaServiceTemplate.class,\r
responseHeaders = {\r
- @ResponseHeader(name = "X-MinorVersion",\r
- description = "Used to request or communicate a MINOR version back from the client"\r
- + " to the server, and from the server back to the client",\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-PatchVersion",\r
- description = "Used only to communicate a PATCH version in a response for"\r
- + " troubleshooting purposes only, and will not be provided by" + " the client on request",\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-LatestVersion", description = "Used only to communicate an API's latest version",\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-ONAP-RequestID",\r
- description = "Used to track REST transactions for logging purpose", response = UUID.class)},\r
- authorizations = @Authorization(value = "basicAuth"), tags = {"PolicyType", },\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"PolicyType", },\r
extensions = {\r
- @Extension(name = "interface info", properties = {@ExtensionProperty(name = "api-version", value = "1.0.0"),\r
- @ExtensionProperty(name = "last-mod-release", value = "Dublin")})})\r
- @ApiResponses(value = {@ApiResponse(code = 401, message = "Authentication Error"),\r
- @ApiResponse(code = 403, message = "Authorization Error"),\r
- @ApiResponse(code = 404, message = "Resource Not Found"),\r
- @ApiResponse(code = 500, message = "Internal Server Error")})\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "Dublin")})})\r
+ @ApiResponses(value = {\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = NOT_FOUND_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)})\r
public Response getAllVersionsOfPolicyType(\r
@PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
- @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+ @HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId) {\r
\r
try (PolicyTypeProvider policyTypeProvider = new PolicyTypeProvider()) {\r
ToscaServiceTemplate serviceTemplate = policyTypeProvider.fetchPolicyTypes(policyTypeId, null);\r
updateApiStatisticsCounter(Target.POLICY_TYPE, Result.SUCCESS, HttpMethod.GET);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelException | PfModelRuntimeException pfme) {\r
- LOGGER.debug("GET /policytypes/{}", policyTypeId, pfme);\r
+ LOGGER.warn("GET /policytypes/{}", policyTypeId, pfme);\r
updateApiStatisticsCounter(Target.POLICY_TYPE, Result.FAILURE, HttpMethod.GET);\r
return makeErrorResponse(requestId, pfme);\r
}\r
@ApiOperation(value = "Retrieve one particular version of a policy type",\r
notes = "Returns a particular version for the specified policy type", response = ToscaServiceTemplate.class,\r
responseHeaders = {\r
- @ResponseHeader(name = "X-MinorVersion",\r
- description = "Used to request or communicate a MINOR version back from the client"\r
- + " to the server, and from the server back to the client",\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-PatchVersion",\r
- description = "Used only to communicate a PATCH version in a response for"\r
- + " troubleshooting purposes only, and will not be provided by" + " the client on request",\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-LatestVersion", description = "Used only to communicate an API's latest version",\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-ONAP-RequestID",\r
- description = "Used to track REST transactions for logging purpose", response = UUID.class)},\r
- authorizations = @Authorization(value = "basicAuth"), tags = {"PolicyType", },\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"PolicyType", },\r
extensions = {\r
- @Extension(name = "interface info", properties = {@ExtensionProperty(name = "api-version", value = "1.0.0"),\r
- @ExtensionProperty(name = "last-mod-release", value = "Dublin")})})\r
- @ApiResponses(value = {@ApiResponse(code = 401, message = "Authentication Error"),\r
- @ApiResponse(code = 403, message = "Authorization Error"),\r
- @ApiResponse(code = 404, message = "Resource Not Found"),\r
- @ApiResponse(code = 500, message = "Internal Server Error")})\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "Dublin")})})\r
+ @ApiResponses(value = {\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = NOT_FOUND_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)})\r
public Response getSpecificVersionOfPolicyType(\r
@PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
@PathParam("versionId") @ApiParam(value = "Version of policy type", required = true) String versionId,\r
- @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+ @HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId) {\r
\r
try (PolicyTypeProvider policyTypeProvider = new PolicyTypeProvider()) {\r
ToscaServiceTemplate serviceTemplate = policyTypeProvider.fetchPolicyTypes(policyTypeId, versionId);\r
updateApiStatisticsCounter(Target.POLICY_TYPE, Result.SUCCESS, HttpMethod.GET);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelException | PfModelRuntimeException pfme) {\r
- LOGGER.debug("GET /policytypes/{}/versions/{}", policyTypeId, versionId, pfme);\r
+ LOGGER.warn("GET /policytypes/{}/versions/{}", policyTypeId, versionId, pfme);\r
updateApiStatisticsCounter(Target.POLICY_TYPE, Result.FAILURE, HttpMethod.GET);\r
return makeErrorResponse(requestId, pfme);\r
}\r
@ApiOperation(value = "Retrieve latest version of a policy type",\r
notes = "Returns latest version for the specified policy type", response = ToscaServiceTemplate.class,\r
responseHeaders = {\r
- @ResponseHeader(name = "X-MinorVersion",\r
- description = "Used to request or communicate a MINOR version back from the client"\r
- + " to the server, and from the server back to the client",\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-PatchVersion",\r
- description = "Used only to communicate a PATCH version in a response for"\r
- + " troubleshooting purposes only, and will not be provided by" + " the client on request",\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-LatestVersion", description = "Used only to communicate an API's latest version",\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-ONAP-RequestID",\r
- description = "Used to track REST transactions for logging purpose", response = UUID.class)},\r
- authorizations = @Authorization(value = "basicAuth"), tags = {"PolicyType", },\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"PolicyType", },\r
extensions = {\r
- @Extension(name = "interface info", properties = {@ExtensionProperty(name = "api-version", value = "1.0.0"),\r
- @ExtensionProperty(name = "last-mod-release", value = "Dublin")})})\r
- @ApiResponses(value = {@ApiResponse(code = 401, message = "Authentication Error"),\r
- @ApiResponse(code = 403, message = "Authorization Error"),\r
- @ApiResponse(code = 404, message = "Resource Not Found"),\r
- @ApiResponse(code = 500, message = "Internal Server Error")})\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "Dublin")})})\r
+ @ApiResponses(value = {\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = NOT_FOUND_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)})\r
public Response getLatestVersionOfPolicyType(\r
@PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
- @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+ @HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId) {\r
\r
try (PolicyTypeProvider policyTypeProvider = new PolicyTypeProvider()) {\r
ToscaServiceTemplate serviceTemplate = policyTypeProvider.fetchLatestPolicyTypes(policyTypeId);\r
updateApiStatisticsCounter(Target.POLICY_TYPE, Result.SUCCESS, HttpMethod.GET);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelException | PfModelRuntimeException pfme) {\r
- LOGGER.debug("GET /policytypes/{}/versions/latest", policyTypeId, pfme);\r
+ LOGGER.warn("GET /policytypes/{}/versions/latest", policyTypeId, pfme);\r
updateApiStatisticsCounter(Target.POLICY_TYPE, Result.FAILURE, HttpMethod.GET);\r
return makeErrorResponse(requestId, pfme);\r
}\r
@POST\r
@Path("/policytypes")\r
@ApiOperation(value = "Create a new policy type", notes = "Client should provide TOSCA body of the new policy type",\r
- authorizations = @Authorization(value = "basicAuth"), tags = {"PolicyType", },\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"PolicyType", },\r
response = ToscaServiceTemplate.class,\r
responseHeaders = {\r
- @ResponseHeader(name = "X-MinorVersion",\r
- description = "Used to request or communicate a MINOR version back from the client"\r
- + " to the server, and from the server back to the client",\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-PatchVersion",\r
- description = "Used only to communicate a PATCH version in a response for"\r
- + " troubleshooting purposes only, and will not be provided by" + " the client on request",\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-LatestVersion", description = "Used only to communicate an API's latest version",\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-ONAP-RequestID",\r
- description = "Used to track REST transactions for logging purpose", response = UUID.class)},\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
extensions = {\r
- @Extension(name = "interface info", properties = {@ExtensionProperty(name = "api-version", value = "1.0.0"),\r
- @ExtensionProperty(name = "last-mod-release", value = "Dublin")})})\r
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid Body"),\r
- @ApiResponse(code = 401, message = "Authentication Error"),\r
- @ApiResponse(code = 403, message = "Authorization Error"),\r
- @ApiResponse(code = 406, message = "Not Acceptable Payload"),\r
- @ApiResponse(code = 500, message = "Internal Server Error")})\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "Dublin")})})\r
+ @ApiResponses(value = {\r
+ @ApiResponse(code = HttpURLConnection.HTTP_BAD_REQUEST, message = INVALID_BODY_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_NOT_ACCEPTABLE, message = INVALID_PAYLOAD_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)})\r
public Response createPolicyType(\r
@ApiParam(value = "Entity body of policy type", required = true) ToscaServiceTemplate body,\r
- @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+ @HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId) {\r
\r
if (NetLoggerUtil.getNetworkLogger().isInfoEnabled()) {\r
NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, "/policytypes", toJson(body));\r
updateApiStatisticsCounter(Target.POLICY_TYPE, Result.SUCCESS, HttpMethod.POST);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelException | PfModelRuntimeException pfme) {\r
- LOGGER.debug("POST /policytypes", pfme);\r
+ LOGGER.warn("POST /policytypes", pfme);\r
updateApiStatisticsCounter(Target.POLICY_TYPE, Result.FAILURE, HttpMethod.POST);\r
return makeErrorResponse(requestId, pfme);\r
}\r
notes = "Rule 1: pre-defined policy types cannot be deleted;"\r
+ "Rule 2: policy types that are in use (parameterized by a TOSCA policy) cannot be deleted."\r
+ "The parameterizing TOSCA policies must be deleted first;",\r
- authorizations = @Authorization(value = "basicAuth"), tags = {"PolicyType", },\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"PolicyType", },\r
response = ToscaServiceTemplate.class,\r
responseHeaders = {\r
- @ResponseHeader(name = "X-MinorVersion",\r
- description = "Used to request or communicate a MINOR version back from the client"\r
- + " to the server, and from the server back to the client",\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-PatchVersion",\r
- description = "Used only to communicate a PATCH version in a response for"\r
- + " troubleshooting purposes only, and will not be provided by" + " the client on request",\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-LatestVersion", description = "Used only to communicate an API's latest version",\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-ONAP-RequestID",\r
- description = "Used to track REST transactions for logging purpose", response = UUID.class)},\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
extensions = {\r
- @Extension(name = "interface info", properties = {@ExtensionProperty(name = "api-version", value = "1.0.0"),\r
- @ExtensionProperty(name = "last-mod-release", value = "Dublin")})})\r
- @ApiResponses(value = {@ApiResponse(code = 401, message = "Authentication Error"),\r
- @ApiResponse(code = 403, message = "Authorization Error"),\r
- @ApiResponse(code = 404, message = "Resource Not Found"),\r
- @ApiResponse(code = 409, message = "Delete Conflict, Rule Violation"),\r
- @ApiResponse(code = 500, message = "Internal Server Error")})\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "Dublin")})})\r
+ @ApiResponses(value = {\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = NOT_FOUND_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_CONFLICT, message = HTTP_CONFLICT_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)})\r
public Response deleteSpecificVersionOfPolicyType(\r
@PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
@PathParam("versionId") @ApiParam(value = "Version of policy type", required = true) String versionId,\r
- @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+ @HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId) {\r
\r
try (PolicyTypeProvider policyTypeProvider = new PolicyTypeProvider()) {\r
ToscaServiceTemplate serviceTemplate = policyTypeProvider.deletePolicyType(policyTypeId, versionId);\r
+ updateApiStatisticsCounter(Target.POLICY_TYPE, Result.SUCCESS, HttpMethod.DELETE);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelException | PfModelRuntimeException pfme) {\r
- LOGGER.debug("DELETE /policytypes/{}/versions/{}", policyTypeId, versionId, pfme);\r
+ LOGGER.warn("DELETE /policytypes/{}/versions/{}", policyTypeId, versionId, pfme);\r
+ updateApiStatisticsCounter(Target.POLICY_TYPE, Result.FAILURE, HttpMethod.DELETE);\r
return makeErrorResponse(requestId, pfme);\r
}\r
}\r
*\r
* @return the Response object containing the results of the API operation\r
*/\r
- // @formatter:off\r
@GET\r
@Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies")\r
@ApiOperation(\r
notes = "Returns a list of all versions of specified policy created for the specified policy type version",\r
response = ToscaServiceTemplate.class,\r
responseHeaders = {\r
- @ResponseHeader(name = "X-MinorVersion",\r
- description = "Used to request or communicate a MINOR version back from the client"\r
- + " to the server, and from the server back to the client",\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-PatchVersion",\r
- description = "Used only to communicate a PATCH version in a response for"\r
- + " troubleshooting purposes only, and will not be provided by" + " the client on request",\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-LatestVersion", description = "Used only to communicate an API's latest version",\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-ONAP-RequestID",\r
- description = "Used to track REST transactions for logging purpose", response = UUID.class)},\r
- authorizations = @Authorization(value = "basicAuth"), tags = {"Policy,"},\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"Policy,"},\r
extensions = {\r
- @Extension(name = "interface info", properties = {\r
- @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
- @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "Dublin")\r
})\r
}\r
)\r
@ApiResponses(value = {\r
- @ApiResponse(code = 401, message = "Authentication Error"),\r
- @ApiResponse(code = 403, message = "Authorization Error"),\r
- @ApiResponse(code = 404, message = "Resource Not Found"),\r
- @ApiResponse(code = 500, message = "Internal Server Error")\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = NOT_FOUND_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)\r
})\r
public Response getAllPolicies(\r
@PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
@PathParam("policyTypeVersion") @ApiParam(value = "Version of policy type",\r
required = true) String policyTypeVersion,\r
- @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId,\r
+ @HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,\r
@QueryParam("mode") @DefaultValue("bare") @ApiParam("Fetch mode for policies, BARE for bare policies (default),"\r
+ " REFERENCED for fully referenced policies") PolicyFetchMode mode\r
) {\r
updateApiStatisticsCounter(Target.POLICY, Result.SUCCESS, HttpMethod.GET);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelException | PfModelRuntimeException pfme) {\r
- LOGGER.debug("GET /policytypes/{}/versions/{}/policies", policyTypeId, policyTypeVersion, pfme);\r
+ LOGGER.warn("GET /policytypes/{}/versions/{}/policies", policyTypeId, policyTypeVersion, pfme);\r
updateApiStatisticsCounter(Target.POLICY, Result.FAILURE, HttpMethod.GET);\r
return makeErrorResponse(requestId, pfme);\r
}\r
}\r
- // @formatter:on\r
\r
/**\r
* Retrieves all versions of a particular policy.\r
*\r
* @return the Response object containing the results of the API operation\r
*/\r
- // @formatter:off\r
@GET\r
@Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}")\r
@ApiOperation(value = "Retrieve all version details of a policy created for a particular policy type version",\r
notes = "Returns a list of all version details of the specified policy", response = ToscaServiceTemplate.class,\r
responseHeaders = {\r
- @ResponseHeader(name = "X-MinorVersion",\r
- description = "Used to request or communicate a MINOR version back from the client"\r
- + " to the server, and from the server back to the client",\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-PatchVersion",\r
- description = "Used only to communicate a PATCH version in a response for"\r
- + " troubleshooting purposes only, and will not be provided by" + " the client on request",\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-LatestVersion", description = "Used only to communicate an API's latest version",\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-ONAP-RequestID",\r
- description = "Used to track REST transactions for logging purpose", response = UUID.class)},\r
- authorizations = @Authorization(value = "basicAuth"), tags = {"Policy", },\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"Policy", },\r
extensions = {\r
- @Extension(name = "interface info", properties = {\r
- @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
- @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "Dublin")\r
})\r
}\r
)\r
@ApiResponses(value = {\r
- @ApiResponse(code = 401, message = "Authentication Error"),\r
- @ApiResponse(code = 403, message = "Authorization Error"),\r
- @ApiResponse(code = 404, message = "Resource Not Found"),\r
- @ApiResponse(code = 500, message = "Internal Server Error")\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = NOT_FOUND_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)\r
})\r
public Response getAllVersionsOfPolicy(\r
@PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
@PathParam("policyTypeVersion") @ApiParam(value = "Version of policy type",\r
required = true) String policyTypeVersion,\r
@PathParam("policyId") @ApiParam(value = "ID of policy", required = true) String policyId,\r
- @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId,\r
+ @HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,\r
@QueryParam("mode") @DefaultValue("bare") @ApiParam("Fetch mode for policies, BARE for bare policies (default),"\r
+ " REFERENCED for fully referenced policies") PolicyFetchMode mode\r
) {\r
updateApiStatisticsCounter(Target.POLICY, Result.SUCCESS, HttpMethod.GET);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelException | PfModelRuntimeException pfme) {\r
- LOGGER.debug("/policytypes/{}/versions/{}/policies/{}", policyTypeId, policyTypeVersion, policyId, pfme);\r
+ LOGGER.warn("/policytypes/{}/versions/{}/policies/{}", policyTypeId, policyTypeVersion, policyId, pfme);\r
updateApiStatisticsCounter(Target.POLICY, Result.FAILURE, HttpMethod.GET);\r
return makeErrorResponse(requestId, pfme);\r
}\r
}\r
- // @formatter:on\r
\r
/**\r
* Retrieves the specified version of a particular policy.\r
*\r
* @return the Response object containing the results of the API operation\r
*/\r
- // @formatter:off\r
@GET\r
@Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}/versions/{policyVersion}")\r
@ApiOperation(value = "Retrieve one version of a policy created for a particular policy type version",\r
notes = "Returns a particular version of specified policy created for the specified policy type version",\r
response = ToscaServiceTemplate.class,\r
responseHeaders = {\r
- @ResponseHeader(name = "X-MinorVersion",\r
- description = "Used to request or communicate a MINOR version back from the client"\r
- + " to the server, and from the server back to the client",\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-PatchVersion",\r
- description = "Used only to communicate a PATCH version in a response for"\r
- + " troubleshooting purposes only, and will not be provided by" + " the client on request",\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-LatestVersion", description = "Used only to communicate an API's latest version",\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-ONAP-RequestID",\r
- description = "Used to track REST transactions for logging purpose", response = UUID.class)},\r
- authorizations = @Authorization(value = "basicAuth"), tags = {"Policy", },\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"Policy", },\r
extensions = {\r
- @Extension(name = "interface info", properties = {\r
- @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
- @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "Dublin")\r
})\r
}\r
)\r
@ApiResponses(value = {\r
- @ApiResponse(code = 401, message = "Authentication Error"),\r
- @ApiResponse(code = 403, message = "Authorization Error"),\r
- @ApiResponse(code = 404, message = "Resource Not Found"),\r
- @ApiResponse(code = 500, message = "Internal Server Error")\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = NOT_FOUND_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)\r
})\r
public Response getSpecificVersionOfPolicy(\r
@PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
required = true) String policyTypeVersion,\r
@PathParam("policyId") @ApiParam(value = "ID of policy", required = true) String policyId,\r
@PathParam("policyVersion") @ApiParam(value = "Version of policy", required = true) String policyVersion,\r
- @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId,\r
+ @HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,\r
@QueryParam("mode") @DefaultValue("bare") @ApiParam("Fetch mode for policies, BARE for bare policies (default),"\r
+ " REFERENCED for fully referenced policies") PolicyFetchMode mode\r
) {\r
updateApiStatisticsCounter(Target.POLICY, Result.SUCCESS, HttpMethod.GET);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelException | PfModelRuntimeException pfme) {\r
- LOGGER.debug("GET /policytypes/{}/versions/{}/policies/{}/versions/{}", policyTypeId, policyTypeVersion,\r
+ LOGGER.warn("GET /policytypes/{}/versions/{}/policies/{}/versions/{}", policyTypeId, policyTypeVersion,\r
policyId, policyVersion, pfme);\r
updateApiStatisticsCounter(Target.POLICY, Result.FAILURE, HttpMethod.GET);\r
return makeErrorResponse(requestId, pfme);\r
}\r
}\r
- // @formatter:on\r
\r
/**\r
* Retrieves the latest version of a particular policy.\r
@ApiOperation(value = "Retrieve the latest version of a particular policy",\r
notes = "Returns the latest version of specified policy", response = ToscaServiceTemplate.class,\r
responseHeaders = {\r
- @ResponseHeader(name = "X-MinorVersion",\r
- description = "Used to request or communicate a MINOR version back from the client"\r
- + " to the server, and from the server back to the client",\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-PatchVersion",\r
- description = "Used only to communicate a PATCH version in a response for"\r
- + " troubleshooting purposes only, and will not be provided by" + " the client on request",\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-LatestVersion", description = "Used only to communicate an API's latest version",\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-ONAP-RequestID",\r
- description = "Used to track REST transactions for logging purpose", response = UUID.class)},\r
- authorizations = @Authorization(value = "basicAuth"), tags = {"Policy", },\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"Policy", },\r
extensions = {\r
- @Extension(name = "interface info", properties = {@ExtensionProperty(name = "api-version", value = "1.0.0"),\r
- @ExtensionProperty(name = "last-mod-release", value = "Dublin")})})\r
- @ApiResponses(value = {@ApiResponse(code = 401, message = "Authentication Error"),\r
- @ApiResponse(code = 403, message = "Authorization Error"),\r
- @ApiResponse(code = 404, message = "Resource Not Found"),\r
- @ApiResponse(code = 500, message = "Internal Server Error")})\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "Dublin")})})\r
+ @ApiResponses(value = {\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = NOT_FOUND_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)})\r
public Response getLatestVersionOfPolicy(\r
@PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
@PathParam("policyTypeVersion") @ApiParam(value = "Version of policy type",\r
required = true) String policyTypeVersion,\r
@PathParam("policyId") @ApiParam(value = "ID of policy", required = true) String policyId,\r
- @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId,\r
+ @HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,\r
@QueryParam("mode") @ApiParam("Fetch mode for policies, TERSE for bare policies (default), "\r
+ "REFERENCED for fully referenced policies") PolicyFetchMode mode) {\r
\r
updateApiStatisticsCounter(Target.POLICY, Result.SUCCESS, HttpMethod.GET);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelException | PfModelRuntimeException pfme) {\r
- LOGGER.debug("GET /policytypes/{}/versions/{}/policies/{}/versions/latest", policyTypeId, policyTypeVersion,\r
+ LOGGER.warn("GET /policytypes/{}/versions/{}/policies/{}/versions/latest", policyTypeId, policyTypeVersion,\r
policyId, pfme);\r
updateApiStatisticsCounter(Target.POLICY, Result.FAILURE, HttpMethod.GET);\r
return makeErrorResponse(requestId, pfme);\r
@Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies")\r
@ApiOperation(value = "Create a new policy for a policy type version",\r
notes = "Client should provide TOSCA body of the new policy",\r
- authorizations = @Authorization(value = "basicAuth"), tags = {"Policy", },\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"Policy", },\r
response = ToscaServiceTemplate.class,\r
responseHeaders = {\r
- @ResponseHeader(name = "X-MinorVersion",\r
- description = "Used to request or communicate a MINOR version back from the client"\r
- + " to the server, and from the server back to the client",\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-PatchVersion",\r
- description = "Used only to communicate a PATCH version in a response for"\r
- + " troubleshooting purposes only, and will not be provided by" + " the client on request",\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-LatestVersion", description = "Used only to communicate an API's latest version",\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-ONAP-RequestID",\r
- description = "Used to track REST transactions for logging purpose", response = UUID.class)},\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
extensions = {\r
- @Extension(name = "interface info", properties = {@ExtensionProperty(name = "api-version", value = "1.0.0"),\r
- @ExtensionProperty(name = "last-mod-release", value = "Dublin")})})\r
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid Body"),\r
- @ApiResponse(code = 401, message = "Authentication Error"),\r
- @ApiResponse(code = 403, message = "Authorization Error"),\r
- @ApiResponse(code = 404, message = "Resource Not Found"),\r
- @ApiResponse(code = 406, message = "Not Acceptable Payload"),\r
- @ApiResponse(code = 500, message = "Internal Server Error")})\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "Dublin")})})\r
+ @ApiResponses(value = {\r
+ @ApiResponse(code = HttpURLConnection.HTTP_BAD_REQUEST, message = INVALID_BODY_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = NOT_FOUND_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_NOT_ACCEPTABLE, message = INVALID_PAYLOAD_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)})\r
public Response createPolicy(\r
@PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
@PathParam("policyTypeVersion") @ApiParam(value = "Version of policy type",\r
required = true) String policyTypeVersion,\r
- @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId,\r
+ @HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,\r
@ApiParam(value = "Entity body of policy", required = true) ToscaServiceTemplate body) {\r
\r
if (NetLoggerUtil.getNetworkLogger().isInfoEnabled()) {\r
updateApiStatisticsCounter(Target.POLICY, Result.SUCCESS, HttpMethod.POST);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelException | PfModelRuntimeException pfme) {\r
- LOGGER.debug("POST /policytypes/{}/versions/{}/policies", policyTypeId, policyTypeVersion, pfme);\r
+ LOGGER.warn("POST /policytypes/{}/versions/{}/policies", policyTypeId, policyTypeVersion, pfme);\r
updateApiStatisticsCounter(Target.POLICY, Result.FAILURE, HttpMethod.POST);\r
return makeErrorResponse(requestId, pfme);\r
}\r
}\r
\r
+ /**\r
+ * Deletes the specified version of a particular policy.\r
+ *\r
+ * @param policyTypeId the ID of specified policy type\r
+ * @param policyTypeVersion the version of specified policy type\r
+ * @param policyId the ID of specified policy\r
+ * @param policyVersion the version of specified policy\r
+ *\r
+ * @return the Response object containing the results of the API operation\r
+ */\r
+ @DELETE\r
+ @Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}/versions/{policyVersion}")\r
+ @ApiOperation(value = "Delete a particular version of a policy",\r
+ notes = "Rule: the version that has been deployed in PDP group(s) cannot be deleted",\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"Policy", },\r
+ response = ToscaServiceTemplate.class,\r
+ responseHeaders = {\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
+ response = String.class),\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
+ response = String.class),\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
+ response = String.class),\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
+ extensions = {\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "Dublin")})})\r
+ @ApiResponses(value = {\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = NOT_FOUND_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_CONFLICT, message = HTTP_CONFLICT_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)})\r
+ public Response deleteSpecificVersionOfPolicy(\r
+ @PathParam("policyTypeId") @ApiParam(value = "PolicyType ID", required = true) String policyTypeId,\r
+ @PathParam("policyTypeVersion") @ApiParam(value = "Version of policy type",\r
+ required = true) String policyTypeVersion,\r
+ @PathParam("policyId") @ApiParam(value = "ID of policy", required = true) String policyId,\r
+ @PathParam("policyVersion") @ApiParam(value = "Version of policy", required = true) String policyVersion,\r
+ @HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId) {\r
+\r
+ try (PolicyProvider policyProvider = new PolicyProvider()) {\r
+ ToscaServiceTemplate serviceTemplate =\r
+ policyProvider.deletePolicy(policyTypeId, policyTypeVersion, policyId, policyVersion);\r
+ updateApiStatisticsCounter(Target.POLICY, Result.SUCCESS, HttpMethod.DELETE);\r
+ return makeOkResponse(requestId, serviceTemplate);\r
+ } catch (PfModelException | PfModelRuntimeException pfme) {\r
+ LOGGER.warn("DELETE /policytypes/{}/versions/{}/policies/{}/versions/{}", policyTypeId, policyTypeVersion,\r
+ policyId, policyVersion, pfme);\r
+ updateApiStatisticsCounter(Target.POLICY, Result.FAILURE, HttpMethod.DELETE);\r
+ return makeErrorResponse(requestId, pfme);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Retrieves all the available policies.\r
+ *\r
+ * @return the Response object containing the results of the API operation\r
+ */\r
+ @GET\r
+ @Path("/policies")\r
+ @ApiOperation(value = "Retrieve all versions of available policies",\r
+ notes = "Returns all version of available policies",\r
+ response = ToscaServiceTemplate.class,\r
+ responseHeaders = {\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
+ response = String.class),\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
+ response = String.class),\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
+ response = String.class),\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"Policy", },\r
+ extensions = {\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "Guilin")\r
+ })\r
+ }\r
+ )\r
+ @ApiResponses(value = {\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = NOT_FOUND_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)\r
+ })\r
+ public Response getPolicies(\r
+ @HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,\r
+ @QueryParam("mode") @DefaultValue("bare") @ApiParam("Fetch mode for policies, BARE for bare policies (default),"\r
+ + " REFERENCED for fully referenced policies") PolicyFetchMode mode\r
+ ) {\r
+ try (PolicyProvider policyProvider = new PolicyProvider()) {\r
+ ToscaServiceTemplate serviceTemplate =\r
+ policyProvider.fetchPolicies(null, null, null, null, mode);\r
+ updateApiStatisticsCounter(Target.POLICY, Result.SUCCESS, HttpMethod.GET);\r
+ return makeOkResponse(requestId, serviceTemplate);\r
+ } catch (PfModelException | PfModelRuntimeException pfme) {\r
+ LOGGER.warn("GET /policies/ --", pfme);\r
+ updateApiStatisticsCounter(Target.POLICY, Result.FAILURE, HttpMethod.GET);\r
+ if (pfme.getErrorResponse().getResponseCode().equals(Status.NOT_FOUND)) {\r
+ pfme.getErrorResponse().setErrorMessage(ERROR_MESSAGE_NO_POLICIES_FOUND);\r
+ pfme.getErrorResponse().setErrorDetails(List.of(ERROR_MESSAGE_NO_POLICIES_FOUND));\r
+ }\r
+ return makeErrorResponse(requestId, pfme);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Retrieves the specified version of a particular policy.\r
+ *\r
+ * @param policyId the Name of specified policy\r
+ * @param policyVersion the version of specified policy\r
+ *\r
+ * @return the Response object containing the results of the API operation\r
+ */\r
+ @GET\r
+ @Path("/policies/{policyId}/versions/{policyVersion}")\r
+ @ApiOperation(value = "Retrieve specific version of a specified policy",\r
+ notes = "Returns a particular version of specified policy",\r
+ response = ToscaServiceTemplate.class,\r
+ responseHeaders = {\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
+ response = String.class),\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
+ response = String.class),\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
+ response = String.class),\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"Policy", },\r
+ extensions = {\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "Guilin")\r
+ })\r
+ }\r
+ )\r
+ @ApiResponses(value = {\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = NOT_FOUND_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)\r
+ })\r
+ public Response getSpecificPolicy(\r
+ @PathParam("policyId") @ApiParam(value = "Name of policy", required = true) String policyId,\r
+ @PathParam("policyVersion") @ApiParam(value = "Version of policy", required = true) String policyVersion,\r
+ @HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,\r
+ @QueryParam("mode") @DefaultValue("bare") @ApiParam("Fetch mode for policies, BARE for bare policies (default),"\r
+ + " REFERENCED for fully referenced policies") PolicyFetchMode mode\r
+ ) {\r
+ try (PolicyProvider policyProvider = new PolicyProvider()) {\r
+ ToscaServiceTemplate serviceTemplate =\r
+ policyProvider.fetchPolicies(null, null, policyId, policyVersion, mode);\r
+ updateApiStatisticsCounter(Target.POLICY, Result.SUCCESS, HttpMethod.GET);\r
+ return makeOkResponse(requestId, serviceTemplate);\r
+ } catch (PfModelException | PfModelRuntimeException pfme) {\r
+ LOGGER.warn("GET /policies/{}/versions/{}", policyId, policyVersion, pfme);\r
+ updateApiStatisticsCounter(Target.POLICY, Result.FAILURE, HttpMethod.GET);\r
+ return makeErrorResponse(requestId, pfme);\r
+ }\r
+ }\r
+\r
/**\r
* Creates one or more new policies in one call.\r
*\r
@Path("/policies")\r
@ApiOperation(value = "Create one or more new policies",\r
notes = "Client should provide TOSCA body of the new polic(ies)",\r
- authorizations = @Authorization(value = "basicAuth"), tags = {"Policy", },\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"Policy", },\r
response = ToscaServiceTemplate.class,\r
responseHeaders = {\r
- @ResponseHeader(name = "X-MinorVersion",\r
- description = "Used to request or communicate a MINOR version back from the client"\r
- + " to the server, and from the server back to the client",\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-PatchVersion",\r
- description = "Used only to communicate a PATCH version in a response for"\r
- + " troubleshooting purposes only, and will not be provided by" + " the client on request",\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-LatestVersion", description = "Used only to communicate an API's latest version",\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-ONAP-RequestID",\r
- description = "Used to track REST transactions for logging purpose", response = UUID.class)},\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
extensions = {\r
- @Extension(name = "interface info", properties = {@ExtensionProperty(name = "api-version", value = "1.0.0"),\r
- @ExtensionProperty(name = "last-mod-release", value = "El Alto")})})\r
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid Body"),\r
- @ApiResponse(code = 401, message = "Authentication Error"),\r
- @ApiResponse(code = 403, message = "Authorization Error"),\r
- @ApiResponse(code = 404, message = "Resource Not Found"),\r
- @ApiResponse(code = 406, message = "Not Acceptable Payload"),\r
- @ApiResponse(code = 500, message = "Internal Server Error")})\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "El Alto")})})\r
+ @ApiResponses(value = {\r
+ @ApiResponse(code = HttpURLConnection.HTTP_BAD_REQUEST, message = INVALID_BODY_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = NOT_FOUND_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_NOT_ACCEPTABLE, message = INVALID_PAYLOAD_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)})\r
public Response createPolicies(\r
- @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId,\r
+ @HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,\r
@ApiParam(value = "Entity body of policy", required = true) ToscaServiceTemplate body) {\r
\r
if (NetLoggerUtil.getNetworkLogger().isInfoEnabled()) {\r
updateApiStatisticsCounter(Target.POLICY, Result.SUCCESS, HttpMethod.POST);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelException | PfModelRuntimeException pfme) {\r
- LOGGER.debug("POST /policies", pfme);\r
+ LOGGER.warn("POST /policies", pfme);\r
updateApiStatisticsCounter(Target.POLICY, Result.FAILURE, HttpMethod.POST);\r
return makeErrorResponse(requestId, pfme);\r
}\r
/**\r
* Deletes the specified version of a particular policy.\r
*\r
- * @param policyTypeId the ID of specified policy type\r
- * @param policyTypeVersion the version of specified policy type\r
* @param policyId the ID of specified policy\r
* @param policyVersion the version of specified policy\r
*\r
* @return the Response object containing the results of the API operation\r
*/\r
@DELETE\r
- @Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}/versions/{policyVersion}")\r
+ @Path("/policies/{policyId}/versions/{policyVersion}")\r
@ApiOperation(value = "Delete a particular version of a policy",\r
notes = "Rule: the version that has been deployed in PDP group(s) cannot be deleted",\r
- authorizations = @Authorization(value = "basicAuth"), tags = {"Policy", },\r
- response = ToscaServiceTemplate.class,\r
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE), tags = {"Policy", },\r
+ response = ToscaServiceTemplate.class,\r
responseHeaders = {\r
- @ResponseHeader(name = "X-MinorVersion",\r
- description = "Used to request or communicate a MINOR version back from the client"\r
- + " to the server, and from the server back to the client",\r
+ @ResponseHeader(name = VERSION_MINOR_NAME,\r
+ description = VERSION_MINOR_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-PatchVersion",\r
- description = "Used only to communicate a PATCH version in a response for"\r
- + " troubleshooting purposes only, and will not be provided by" + " the client on request",\r
+ @ResponseHeader(name = VERSION_PATCH_NAME,\r
+ description = VERSION_PATCH_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-LatestVersion", description = "Used only to communicate an API's latest version",\r
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,\r
response = String.class),\r
- @ResponseHeader(name = "X-ONAP-RequestID",\r
- description = "Used to track REST transactions for logging purpose", response = UUID.class)},\r
+ @ResponseHeader(name = REQUEST_ID_NAME,\r
+ description = REQUEST_ID_HDR_DESCRIPTION, response = UUID.class)},\r
extensions = {\r
- @Extension(name = "interface info", properties = {@ExtensionProperty(name = "api-version", value = "1.0.0"),\r
- @ExtensionProperty(name = "last-mod-release", value = "Dublin")})})\r
- @ApiResponses(value = {@ApiResponse(code = 401, message = "Authentication Error"),\r
- @ApiResponse(code = 403, message = "Authorization Error"),\r
- @ApiResponse(code = 404, message = "Resource Not Found"),\r
- @ApiResponse(code = 409, message = "Delete Conflict, Rule Violation"),\r
- @ApiResponse(code = 500, message = "Internal Server Error")})\r
- public Response deleteSpecificVersionOfPolicy(\r
- @PathParam("policyTypeId") @ApiParam(value = "PolicyType ID", required = true) String policyTypeId,\r
- @PathParam("policyTypeVersion") @ApiParam(value = "Version of policy type",\r
- required = true) String policyTypeVersion,\r
+ @Extension(name = EXTENSION_NAME, properties = {\r
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),\r
+ @ExtensionProperty(name = LAST_MOD_NAME, value = "Guilin")})})\r
+ @ApiResponses(value = {\r
+ @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = AUTHENTICATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = AUTHORIZATION_ERROR_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = NOT_FOUND_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_CONFLICT, message = HTTP_CONFLICT_MESSAGE),\r
+ @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = SERVER_ERROR_MESSAGE)})\r
+ public Response deleteSpecificPolicy(\r
@PathParam("policyId") @ApiParam(value = "ID of policy", required = true) String policyId,\r
@PathParam("policyVersion") @ApiParam(value = "Version of policy", required = true) String policyVersion,\r
- @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+ @HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId) {\r
\r
try (PolicyProvider policyProvider = new PolicyProvider()) {\r
ToscaServiceTemplate serviceTemplate =\r
- policyProvider.deletePolicy(policyTypeId, policyTypeVersion, policyId, policyVersion);\r
+ policyProvider.deletePolicy(null, null, policyId, policyVersion);\r
+ updateApiStatisticsCounter(Target.POLICY, Result.SUCCESS, HttpMethod.DELETE);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelException | PfModelRuntimeException pfme) {\r
- LOGGER.debug("DELETE /policytypes/{}/versions/{}/policies/{}/versions/{}", policyTypeId, policyTypeVersion,\r
- policyId, policyVersion, pfme);\r
+ LOGGER.warn("DELETE /policies/{}/versions/{}", policyId, policyVersion, pfme);\r
+ updateApiStatisticsCounter(Target.POLICY, Result.FAILURE, HttpMethod.DELETE);\r
return makeErrorResponse(requestId, pfme);\r
}\r
}\r
\r
+\r
+\r
private enum Target {\r
POLICY,\r
POLICY_TYPE,\r
\r
private enum HttpMethod {\r
POST,\r
- GET\r
+ GET,\r
+ DELETE\r
}\r
\r
private void updateApiStatisticsCounter(Target target, Result result, HttpMethod http) {\r
\r
private void updatePolicyStats(Result result, HttpMethod http) {\r
if (result == Result.SUCCESS) {\r
- if (http == HttpMethod.GET) {\r
- ApiStatisticsManager.updateApiCallSuccessCount();\r
- ApiStatisticsManager.updateTotalPolicyGetCount();\r
- ApiStatisticsManager.updatePolicyGetSuccessCount();\r
- } else if (http == HttpMethod.POST) {\r
- ApiStatisticsManager.updateApiCallSuccessCount();\r
- ApiStatisticsManager.updateTotalPolicyPostCount();\r
- ApiStatisticsManager.updatePolicyPostSuccessCount();\r
+ switch (http) {\r
+ case GET:\r
+ ApiStatisticsManager.updateApiCallSuccessCount();\r
+ ApiStatisticsManager.updateTotalPolicyGetCount();\r
+ ApiStatisticsManager.updatePolicyGetSuccessCount();\r
+ break;\r
+ case POST:\r
+ ApiStatisticsManager.updateApiCallSuccessCount();\r
+ ApiStatisticsManager.updateTotalPolicyPostCount();\r
+ ApiStatisticsManager.updatePolicyPostSuccessCount();\r
+ break;\r
+ case DELETE:\r
+ ApiStatisticsManager.updateApiCallSuccessCount();\r
+ ApiStatisticsManager.updateTotalPolicyDeleteCount();\r
+ ApiStatisticsManager.updatePolicyDeleteSuccessCount();\r
+ break;\r
+ default:\r
+ ApiStatisticsManager.updateApiCallSuccessCount();\r
+ break;\r
}\r
} else {\r
- if (http == HttpMethod.GET) {\r
- ApiStatisticsManager.updateApiCallFailureCount();\r
- ApiStatisticsManager.updateTotalPolicyGetCount();\r
- ApiStatisticsManager.updatePolicyGetFailureCount();\r
- } else {\r
- ApiStatisticsManager.updateApiCallFailureCount();\r
- ApiStatisticsManager.updateTotalPolicyPostCount();\r
- ApiStatisticsManager.updatePolicyPostFailureCount();\r
+ switch (http) {\r
+ case GET:\r
+ ApiStatisticsManager.updateApiCallFailureCount();\r
+ ApiStatisticsManager.updateTotalPolicyGetCount();\r
+ ApiStatisticsManager.updatePolicyGetFailureCount();\r
+ break;\r
+ case POST:\r
+ ApiStatisticsManager.updateApiCallFailureCount();\r
+ ApiStatisticsManager.updateTotalPolicyPostCount();\r
+ ApiStatisticsManager.updatePolicyPostFailureCount();\r
+ break;\r
+ case DELETE:\r
+ ApiStatisticsManager.updateApiCallFailureCount();\r
+ ApiStatisticsManager.updateTotalPolicyDeleteCount();\r
+ ApiStatisticsManager.updatePolicyDeleteFailureCount();\r
+ break;\r
+ default:\r
+ ApiStatisticsManager.updateApiCallFailureCount();\r
+ break;\r
}\r
}\r
}\r
\r
private void updatePolicyTypeStats(Result result, HttpMethod http) {\r
if (result == Result.SUCCESS) {\r
- if (http == HttpMethod.GET) {\r
- ApiStatisticsManager.updateApiCallSuccessCount();\r
- ApiStatisticsManager.updateTotalPolicyTypeGetCount();\r
- ApiStatisticsManager.updatePolicyTypeGetSuccessCount();\r
- } else if (http == HttpMethod.POST) {\r
- ApiStatisticsManager.updateApiCallSuccessCount();\r
- ApiStatisticsManager.updatePolicyTypePostSuccessCount();\r
- ApiStatisticsManager.updatePolicyTypePostSuccessCount();\r
+ switch (http) {\r
+ case GET:\r
+ ApiStatisticsManager.updateApiCallSuccessCount();\r
+ ApiStatisticsManager.updateTotalPolicyTypeGetCount();\r
+ ApiStatisticsManager.updatePolicyTypeGetSuccessCount();\r
+ break;\r
+ case POST:\r
+ ApiStatisticsManager.updateApiCallSuccessCount();\r
+ ApiStatisticsManager.updateTotalPolicyTypePostCount();\r
+ ApiStatisticsManager.updatePolicyTypePostSuccessCount();\r
+ break;\r
+ case DELETE:\r
+ ApiStatisticsManager.updateApiCallSuccessCount();\r
+ ApiStatisticsManager.updateTotalPolicyTypeDeleteCount();\r
+ ApiStatisticsManager.updatePolicyTypeDeleteSuccessCount();\r
+ break;\r
+ default:\r
+ ApiStatisticsManager.updateApiCallSuccessCount();\r
+ break;\r
}\r
} else {\r
- if (http == HttpMethod.GET) {\r
- ApiStatisticsManager.updateApiCallFailureCount();\r
- ApiStatisticsManager.updateTotalPolicyTypeGetCount();\r
- ApiStatisticsManager.updatePolicyTypeGetFailureCount();\r
- } else {\r
- ApiStatisticsManager.updateApiCallFailureCount();\r
- ApiStatisticsManager.updateTotalPolicyTypePostCount();\r
- ApiStatisticsManager.updatePolicyTypePostFailureCount();\r
+ switch (http) {\r
+ case GET:\r
+ ApiStatisticsManager.updateApiCallFailureCount();\r
+ ApiStatisticsManager.updateTotalPolicyTypeGetCount();\r
+ ApiStatisticsManager.updatePolicyTypeGetFailureCount();\r
+ break;\r
+ case POST:\r
+ ApiStatisticsManager.updateApiCallFailureCount();\r
+ ApiStatisticsManager.updateTotalPolicyTypePostCount();\r
+ ApiStatisticsManager.updatePolicyTypePostFailureCount();\r
+ break;\r
+ case DELETE:\r
+ ApiStatisticsManager.updateApiCallFailureCount();\r
+ ApiStatisticsManager.updateTotalPolicyTypeDeleteCount();\r
+ ApiStatisticsManager.updatePolicyTypeDeleteFailureCount();\r
+ break;\r
+ default:\r
+ ApiStatisticsManager.updateApiCallFailureCount();\r
+ break;\r
}\r
}\r
}\r
{
- "info": {
- "_postman_id": "1592e803-60f3-4f7e-a1e1-4ad01c72d960",
- "name": "Policy Framework Lifecycle API",
- "description": "This collection lists all the Lifecycle API's supported by ONAP Policy Framework. These API's are used to perform CRUD operations for Policy, Policy Type & Data Type for all supported PDP engines.",
- "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
+ "info": {
+ "_postman_id": "50c9900b-7fbc-42f6-8d84-f3761824b96b",
+ "name": "Policy Framework Lifecycle API",
+ "description": "This collection lists all the Lifecycle API's supported by ONAP Policy Framework. These API's are used to perform CRUD operations for Policy, Policy Type & Data Type for all supported PDP engines.",
+ "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
+ },
+ "item": [
+ {
+ "name": "Lifecycle Api Healthcheck",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/healthcheck",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "healthcheck"
+ ]
+ },
+ "description": "This is an API to fetch current healthcheck information for the policy-api component."
+ },
+ "response": []
},
- "item": [
- {
- "name": "Lifecycle Api Healthcheck",
- "request": {
- "method": "GET",
- "header": [
- {
- "key": "Content-Type",
- "type": "text",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "type": "text",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/healthcheck",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "healthcheck"
- ]
- },
- "description": "This is an API to fetch current healthcheck information for the policy-api component."
- },
- "response": []
+ {
+ "name": "Lifecycle Api Statistics",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/statistics",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "statistics"
+ ]
},
- {
- "name": "Lifecycle Api Statistics",
- "request": {
- "method": "GET",
- "header": [
- {
- "key": "Content-Type",
- "type": "text",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "type": "text",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/statistics",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "statistics"
- ]
- },
- "description": "This is an API to fetch current statistics information for the policy-api component."
- },
- "response": []
+ "description": "This is an API to fetch current statistics information for the policy-api component."
+ },
+ "response": []
+ },
+ {
+ "name": "Create Policy Type",
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/yaml"
+ },
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/yaml"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.operational.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: |\n Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant\n Policy Types. This does NOT support the legacy Policy YAML policy type.\n properties:\n id:\n type: string\n description: The unique control loop id.\n required: true\n timeout:\n type: integer\n description: |\n Overall timeout for executing all the operations. This timeout should equal or exceed the total\n timeout for each operation listed.\n required: true\n abatement:\n type: boolean\n description: Whether an abatement event message will be expected for the control loop from DCAE.\n required: true\n default: false\n trigger:\n type: string\n description: Initial operation to execute upon receiving an Onset event message for the Control Loop.\n required: true\n operations:\n type: list\n description: List of operations to be performed when Control Loop is triggered.\n required: true\n entry_schema:\n type: onap.datatype.controlloop.Operation\n\n onap.policies.controlloop.operational.common.Drools:\n derived_from: onap.policies.controlloop.operational.Common\n type_version: 1.0.0\n version: 1.0.0\n description: Operational policies for Drools PDP\n properties:\n controllerName:\n type: string\n description: Drools controller properties\n required: false\n\ndata_types:\n onap.datatype.controlloop.Target:\n derived_from: tosca.datatypes.Root\n description: Definition for a entity in A&AI to perform a control loop operation on\n properties:\n targetType:\n type: string\n description: Category for the target type\n required: true\n constraints:\n - valid_values: [VNF, VM, VFMODULE, PNF]\n entityIds:\n type: map\n description: |\n Map of values that identify the resource. If none are provided, it is assumed that the\n entity that generated the ONSET event will be the target.\n required: false\n metadata:\n clamp_possible_values: ClampExecution:CSAR_RESOURCES\n entry_schema:\n type: string\n\n onap.datatype.controlloop.Actor:\n derived_from: tosca.datatypes.Root\n description: An actor/operation/target definition\n properties:\n actor:\n type: string\n description: The actor performing the operation.\n required: true\n metadata:\n clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor\n operation:\n type: string\n description: The operation the actor is performing.\n metadata:\n clamp_possible_values: Dictionary:DefaultOperations,ClampExecution:CDS/operation\n required: true\n target:\n type: onap.datatype.controlloop.Target\n description: The resource the operation should be performed on.\n required: true\n payload:\n type: map\n description: Name/value pairs of payload information passed by Policy to the actor\n required: false\n metadata:\n clamp_possible_values: ClampExecution:CDS/payload\n entry_schema:\n type: string\n\n onap.datatype.controlloop.Operation:\n derived_from: tosca.datatypes.Root\n description: An operation supported by an actor\n properties:\n id:\n type: string\n description: Unique identifier for the operation\n required: true\n description:\n type: string\n description: A user-friendly description of the intent for the operation\n required: false\n operation:\n type: onap.datatype.controlloop.Actor\n description: The definition of the operation to be performed.\n required: true\n timeout:\n type: integer\n description: The amount of time for the actor to perform the operation.\n required: true\n retries:\n type: integer\n description: The number of retries the actor should attempt to perform the operation.\n required: true\n default: 0\n success:\n type: string\n description: Points to the operation to invoke on success. A value of \"final_success\" indicates and end to the operation.\n required: false\n default: final_success\n failure:\n type: string\n description: Points to the operation to invoke on Actor operation failure.\n required: false\n default: final_failure\n failure_timeout:\n type: string\n description: Points to the operation to invoke when the time out for the operation occurs.\n required: false\n default: final_failure_timeout\n failure_retries:\n type: string\n description: Points to the operation to invoke when the current operation has exceeded its max retries.\n required: false\n default: final_failure_retries\n failure_exception:\n type: string\n description: Points to the operation to invoke when the current operation causes an exception.\n required: false\n default: final_failure_exception\n failure_guard:\n type: string\n description: Points to the operation to invoke when the current operation is blocked due to guard policy enforcement.\n required: false\n default: final_failure_guard"
},
- {
- "name": "Create Policy Type",
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Accept",
- "type": "text",
- "value": "application/yaml"
- },
- {
- "key": "Content-Type",
- "type": "text",
- "value": "application/yaml"
- }
- ],
- "body": {
- "mode": "raw",
- "raw": "tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.operational.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: |\n Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant\n Policy Types. This does NOT support the legacy Policy YAML policy type.\n properties:\n id:\n type: string\n description: The unique control loop id.\n required: true\n timeout:\n type: integer\n description: |\n Overall timeout for executing all the operations. This timeout should equal or exceed the total\n timeout for each operation listed.\n required: true\n abatement:\n type: boolean\n description: Whether an abatement event message will be expected for the control loop from DCAE.\n required: true\n default: false\n trigger:\n type: string\n description: Initial operation to execute upon receiving an Onset event message for the Control Loop.\n required: true\n operations:\n type: list\n description: List of operations to be performed when Control Loop is triggered.\n required: true\n entry_schema:\n type: onap.datatype.controlloop.Operation\n\n onap.policies.controlloop.operational.common.Drools:\n derived_from: onap.policies.controlloop.operational.Common\n type_version: 1.0.0\n version: 1.0.0\n description: Operational policies for Drools PDP\n properties:\n controllerName:\n type: string\n description: Drools controller properties\n required: false\n\ndata_types:\n onap.datatype.controlloop.Target:\n derived_from: tosca.datatypes.Root\n description: Definition for a entity in A&AI to perform a control loop operation on\n properties:\n targetType:\n type: string\n description: Category for the target type\n required: true\n constraints:\n - valid_values: [VNF, VM, VFMODULE, PNF]\n entityIds:\n type: map\n description: |\n Map of values that identify the resource. If none are provided, it is assumed that the\n entity that generated the ONSET event will be the target.\n required: false\n metadata:\n clamp_possible_values: ClampExecution:CSAR_RESOURCES\n entry_schema:\n type: string\n\n onap.datatype.controlloop.Actor:\n derived_from: tosca.datatypes.Root\n description: An actor/operation/target definition\n properties:\n actor:\n type: string\n description: The actor performing the operation.\n required: true\n metadata:\n clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor\n operation:\n type: string\n description: The operation the actor is performing.\n metadata:\n clamp_possible_values: Dictionary:DefaultOperations,ClampExecution:CDS/operation\n required: true\n target:\n type: onap.datatype.controlloop.Target\n description: The resource the operation should be performed on.\n required: true\n payload:\n type: map\n description: Name/value pairs of payload information passed by Policy to the actor\n required: false\n metadata:\n clamp_possible_values: ClampExecution:CDS/payload\n entry_schema:\n type: string\n\n onap.datatype.controlloop.Operation:\n derived_from: tosca.datatypes.Root\n description: An operation supported by an actor\n properties:\n id:\n type: string\n description: Unique identifier for the operation\n required: true\n description:\n type: string\n description: A user-friendly description of the intent for the operation\n required: false\n operation:\n type: onap.datatype.controlloop.Actor\n description: The definition of the operation to be performed.\n required: true\n timeout:\n type: integer\n description: The amount of time for the actor to perform the operation.\n required: true\n retries:\n type: integer\n description: The number of retries the actor should attempt to perform the operation.\n required: true\n default: 0\n success:\n type: string\n description: Points to the operation to invoke on success. A value of \"final_success\" indicates and end to the operation.\n required: false\n default: final_success\n failure:\n type: string\n description: Points to the operation to invoke on Actor operation failure.\n required: false\n default: final_failure\n failure_timeout:\n type: string\n description: Points to the operation to invoke when the time out for the operation occurs.\n required: false\n default: final_failure_timeout\n failure_retries:\n type: string\n description: Points to the operation to invoke when the current operation has exceeded its max retries.\n required: false\n default: final_failure_retries\n failure_exception:\n type: string\n description: Points to the operation to invoke when the current operation causes an exception.\n required: false\n default: final_failure_exception\n failure_guard:\n type: string\n description: Points to the operation to invoke when the current operation is blocked due to guard policy enforcement.\n required: false\n default: final_failure_guard"
- },
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "policytypes"
- ]
- },
- "description": "This is a generic API to create one or more policy types together in a single API call."
- },
- "response": []
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policytypes"
+ ]
},
- {
- "name": "Fetch Policy Type",
- "request": {
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "type": "text",
- "value": "application/json"
- },
- {
- "key": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "policytypes",
- "onap.policies.controlloop.operational.common.Drools",
- "versions",
- "1.0.0"
- ]
- },
- "description": "This is an API to fetch a specific policy type (example - \"onap.policies.controlloop.operational.common.Drools\") currently available in Policy DB."
- },
- "response": []
+ "description": "This is a generic API to create one or more policy types together in a single API call."
+ },
+ "response": []
+ },
+ {
+ "name": "Fetch Policy Type",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/json"
+ },
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policytypes",
+ "onap.policies.controlloop.operational.common.Drools",
+ "versions",
+ "1.0.0"
+ ]
},
- {
- "name": "Fetch All Policy Types",
- "request": {
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "type": "text",
- "value": "application/json"
- },
- {
- "key": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "policytypes"
- ]
- },
- "description": "This is a generic API to fetch all policy types currently available in Policy DB."
- },
- "response": []
+ "description": "This is an API to fetch a specific policy type (example - \"onap.policies.controlloop.operational.common.Drools\") currently available in Policy DB."
+ },
+ "response": []
+ },
+ {
+ "name": "Fetch All Policy Types",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/json"
+ },
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policytypes"
+ ]
},
- {
- "name": "Fetch All Versions of Policy Type",
- "request": {
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "type": "text",
- "value": "application/json"
- },
- {
- "key": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "policytypes",
- "onap.policies.controlloop.operational.common.Drools"
- ]
- },
- "description": "This is an API to fetch all versions of a specific policy type (example - \"onap.policies.controlloop.operational.common.Drools\") currently available in Policy DB."
- },
- "response": []
+ "description": "This is a generic API to fetch all policy types currently available in Policy DB."
+ },
+ "response": []
+ },
+ {
+ "name": "Fetch All Versions of Policy Type",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/json"
+ },
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policytypes",
+ "onap.policies.controlloop.operational.common.Drools"
+ ]
},
- {
- "name": "Fetch Latest Version of Policy Type",
- "request": {
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "type": "text",
- "value": "application/json"
- },
- {
- "key": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/latest",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "policytypes",
- "onap.policies.controlloop.operational.common.Drools",
- "versions",
- "latest"
- ]
- },
- "description": "This is an API to fetch latest versions of a specific policy type (example - \"onap.policies.controlloop.operational.common.Drools\") currently available in Policy DB."
- },
- "response": []
+ "description": "This is an API to fetch all versions of a specific policy type (example - \"onap.policies.controlloop.operational.common.Drools\") currently available in Policy DB."
+ },
+ "response": []
+ },
+ {
+ "name": "Fetch Latest Version of Policy Type",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/json"
+ },
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/latest",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policytypes",
+ "onap.policies.controlloop.operational.common.Drools",
+ "versions",
+ "latest"
+ ]
},
- {
- "name": "Delete Policy Type",
- "request": {
- "method": "DELETE",
- "header": [
- {
- "key": "Accept",
- "type": "text",
- "value": "application/json"
- },
- {
- "key": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "policytypes",
- "onap.policies.controlloop.operational.common.Drools",
- "versions",
- "1.0.0"
- ]
- },
- "description": "This is an API to delete a specific policy type (example - \"onap.policies.controlloop.operational.common.Drools\") currently available in Policy DB."
- },
- "response": []
+ "description": "This is an API to fetch latest versions of a specific policy type (example - \"onap.policies.controlloop.operational.common.Drools\") currently available in Policy DB."
+ },
+ "response": []
+ },
+ {
+ "name": "Delete Policy Type",
+ "request": {
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/json"
+ },
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policytypes",
+ "onap.policies.controlloop.operational.common.Drools",
+ "versions",
+ "1.0.0"
+ ]
},
- {
- "name": "Create Policy (Generic)",
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Accept",
- "type": "text",
- "value": "application/json"
- },
- {
- "key": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "raw": "{\n \"tosca_definitions_version\": \"tosca_simple_yaml_1_1_0\",\n \"topology_template\": {\n \"policies\": [\n {\n \"operational.modifyconfig\": {\n \"type\": \"onap.policies.controlloop.operational.common.Drools\",\n \"type_version\": \"1.0.0\",\n \"version\": \"1.0.0\",\n \"metadata\": {\n \"policy-id\": \"operational.modifyconfig\"\n },\n \"properties\": {\n \"id\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\n \"timeout\": 1200,\n \"abatement\": false,\n \"trigger\": \"unique-policy-id-1-modifyConfig\",\n \"operations\": [\n {\n \"id\": \"unique-policy-id-1-modifyConfig\",\n \"description\": \"Modify the packet generator\",\n \"operation\": {\n \"actor\": \"CDS\",\n \"operation\": \"modify-config\",\n \"target\": {\n \"targetType\": \"VNF\",\n \"entityIds\": {\n \"resourceID\": \"37b008b9-b367-4359-93fd-74d3ce0ee1a0\"\n }\n },\n \"payload\":{\n \"artifact_name\": \"vFW-CDS\",\n \"artifact_version\": \"1.0.0\",\n \"data\": \"{\\\"active-streams\\\": \\\"7\\\"}\"\n }\n },\n \"timeout\": 300,\n \"retries\": 0,\n \"success\": \"final_success\",\n \"failure\": \"final_failure\",\n \"failure_timeout\": \"final_failure_timeout\",\n \"failure_retries\": \"final_failure_retries\",\n \"failure_exception\": \"final_failure_exception\",\n \"failure_guard\": \"final_failure_guard\"\n }\n ],\n \"controllerName\": \"frankfurt\"\n }\n }\n }\n ]\n }\n}"
- },
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/policies",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "policies"
- ]
- },
- "description": "This is a generic API to create multiple policies together in a single API call. The individual policies can refer to same policy type or different policy types."
- },
- "response": []
+ "description": "This is an API to delete a specific policy type (example - \"onap.policies.controlloop.operational.common.Drools\") currently available in Policy DB."
+ },
+ "response": []
+ },
+ {
+ "name": "Create Policy (Generic)",
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/json"
+ },
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"tosca_definitions_version\": \"tosca_simple_yaml_1_1_0\",\n \"topology_template\": {\n \"policies\": [\n {\n \"operational.modifyconfig\": {\n \"type\": \"onap.policies.controlloop.operational.common.Drools\",\n \"type_version\": \"1.0.0\",\n \"version\": \"1.0.0\",\n \"metadata\": {\n \"policy-id\": \"operational.modifyconfig\"\n },\n \"properties\": {\n \"id\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\n \"timeout\": 1200,\n \"abatement\": false,\n \"trigger\": \"unique-policy-id-1-modifyConfig\",\n \"operations\": [\n {\n \"id\": \"unique-policy-id-1-modifyConfig\",\n \"description\": \"Modify the packet generator\",\n \"operation\": {\n \"actor\": \"CDS\",\n \"operation\": \"modify-config\",\n \"target\": {\n \"targetType\": \"VNF\",\n \"entityIds\": {\n \"resourceID\": \"37b008b9-b367-4359-93fd-74d3ce0ee1a0\"\n }\n },\n \"payload\":{\n \"artifact_name\": \"vFW-CDS\",\n \"artifact_version\": \"1.0.0\",\n \"data\": \"{\\\"active-streams\\\": \\\"7\\\"}\"\n }\n },\n \"timeout\": 300,\n \"retries\": 0,\n \"success\": \"final_success\",\n \"failure\": \"final_failure\",\n \"failure_timeout\": \"final_failure_timeout\",\n \"failure_retries\": \"final_failure_retries\",\n \"failure_exception\": \"final_failure_exception\",\n \"failure_guard\": \"final_failure_guard\"\n }\n ],\n \"controllerName\": \"frankfurt\"\n }\n }\n }\n ]\n }\n}"
},
- {
- "name": "Create Policy (Specific)",
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Accept",
- "type": "text",
- "value": "application/json"
- },
- {
- "key": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "raw": "{\n \"tosca_definitions_version\": \"tosca_simple_yaml_1_1_0\",\n \"topology_template\": {\n \"policies\": [\n {\n \"operational.modifyconfig\": {\n \"type\": \"onap.policies.controlloop.operational.common.Drools\",\n \"type_version\": \"1.0.0\",\n \"version\": \"1.0.0\",\n \"metadata\": {\n \"policy-id\": \"operational.modifyconfig\"\n },\n \"properties\": {\n \"id\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\n \"timeout\": 1200,\n \"abatement\": false,\n \"trigger\": \"unique-policy-id-1-modifyConfig\",\n \"operations\": [\n {\n \"id\": \"unique-policy-id-1-modifyConfig\",\n \"description\": \"Modify the packet generator\",\n \"operation\": {\n \"actor\": \"CDS\",\n \"operation\": \"modify-config\",\n \"target\": {\n \"targetType\": \"VNF\",\n \"entityIds\": {\n \"resourceID\": \"37b008b9-b367-4359-93fd-74d3ce0ee1a0\"\n }\n },\n \"payload\":{\n \"artifact_name\": \"vFW-CDS\",\n \"artifact_version\": \"1.0.0\",\n \"data\": \"{\\\"active-streams\\\": \\\"7\\\"}\"\n }\n },\n \"timeout\": 300,\n \"retries\": 0,\n \"success\": \"final_success\",\n \"failure\": \"final_failure\",\n \"failure_timeout\": \"final_failure_timeout\",\n \"failure_retries\": \"final_failure_retries\",\n \"failure_exception\": \"final_failure_exception\",\n \"failure_guard\": \"final_failure_guard\"\n }\n ],\n \"controllerName\": \"frankfurt\"\n }\n }\n }\n ]\n }\n}"
- },
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "policytypes",
- "onap.policies.controlloop.operational.common.Drools",
- "versions",
- "1.0.0",
- "policies"
- ]
- },
- "description": "This is a specific API to create a policy referring to the given policy type (example - \"onap.policies.controlloop.operational.common.Drools\"). The same API can be used to create policy for any policy type to be deployed in any supported PDP engine."
- },
- "response": []
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policies",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policies"
+ ]
},
- {
- "name": "Create Policy (Legacy)",
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Accept",
- "type": "text",
- "value": "application/yaml"
- },
- {
- "key": "Content-Type",
- "type": "text",
- "value": "application/yaml"
- }
- ],
- "body": {
- "mode": "raw",
- "raw": "{\n \"policy-id\" : \"operational.modifyconfiglegacy\",\n \"content\" : \"controlLoop%3A%0A%20%20version%3A%202.0.0%0A%20%20controlLoopName%3A%20ControlLoop-vFirewall-7e4fbe9c-d612-4ec5-bbf8-605aeabdb677%0A%20%20trigger_policy%3A%20unique-policy-id-1-modifyConfig%0A%20%20timeout%3A%2060%0A%20%20abatement%3A%20false%0Apolicies%3A%0A%20%20-%20id%3A%20unique-policy-id-1-modifyConfig%0A%20%20%20%20name%3A%20modifyconfig-cds-actor%0A%20%20%20%20description%3A%0A%20%20%20%20actor%3A%20CDS%0A%20%20%20%20recipe%3A%20modify-config%0A%20%20%20%20target%3A%0A%20%20%20%20%20%20resourceID%3A%2037b008b9-b367-4359-93fd-74d3ce0ee1a0%0A%20%20%20%20%20%20type%3A%20VNF%0A%20%20%20%20payload%3A%0A%20%20%20%20%20%20artifact_name%3A%20vFW-CDS%0A%20%20%20%20%20%20artifact_version%3A%201.0.0%0A%20%20%20%20%20%20data%3A%20%27%7B%22active-streams%22%3A%227%22%7D%27%0A%20%20%20%20retry%3A%200%0A%20%20%20%20timeout%3A%2030%0A%20%20%20%20success%3A%20final_success%0A%20%20%20%20failure%3A%20final_failure%0A%20%20%20%20failure_timeout%3A%20final_failure_timeout%0A%20%20%20%20failure_retries%3A%20final_failure_retries%0A%20%20%20%20failure_exception%3A%20final_failure_exception%0A%20%20%20%20failure_guard%3A%20final_failure_guard\"\n}"
- },
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "policytypes",
- "onap.policies.controlloop.Operational",
- "versions",
- "1.0.0",
- "policies"
- ]
- },
- "description": "This is a specific API to create a policy of type \"onap.policies.controlloop.Operational\", used to create legacy control loop operational policy aimed to be deployed in drools-pdp engine."
- },
- "response": []
+ "description": "This is a generic API to create multiple policies together in a single API call. The individual policies can refer to same policy type or different policy types."
+ },
+ "response": []
+ },
+ {
+ "name": "Create Policy (Specific)",
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/json"
+ },
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"tosca_definitions_version\": \"tosca_simple_yaml_1_1_0\",\n \"topology_template\": {\n \"policies\": [\n {\n \"operational.modifyconfig\": {\n \"type\": \"onap.policies.controlloop.operational.common.Drools\",\n \"type_version\": \"1.0.0\",\n \"version\": \"1.0.0\",\n \"metadata\": {\n \"policy-id\": \"operational.modifyconfig\"\n },\n \"properties\": {\n \"id\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\n \"timeout\": 1200,\n \"abatement\": false,\n \"trigger\": \"unique-policy-id-1-modifyConfig\",\n \"operations\": [\n {\n \"id\": \"unique-policy-id-1-modifyConfig\",\n \"description\": \"Modify the packet generator\",\n \"operation\": {\n \"actor\": \"CDS\",\n \"operation\": \"modify-config\",\n \"target\": {\n \"targetType\": \"VNF\",\n \"entityIds\": {\n \"resourceID\": \"37b008b9-b367-4359-93fd-74d3ce0ee1a0\"\n }\n },\n \"payload\":{\n \"artifact_name\": \"vFW-CDS\",\n \"artifact_version\": \"1.0.0\",\n \"data\": \"{\\\"active-streams\\\": \\\"7\\\"}\"\n }\n },\n \"timeout\": 300,\n \"retries\": 0,\n \"success\": \"final_success\",\n \"failure\": \"final_failure\",\n \"failure_timeout\": \"final_failure_timeout\",\n \"failure_retries\": \"final_failure_retries\",\n \"failure_exception\": \"final_failure_exception\",\n \"failure_guard\": \"final_failure_guard\"\n }\n ],\n \"controllerName\": \"frankfurt\"\n }\n }\n }\n ]\n }\n}"
},
- {
- "name": "Fetch Policy (Specific)",
- "request": {
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "type": "text",
- "value": "application/json"
- },
- {
- "key": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies/operational.modifyconfig/versions/1.0.0",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "policytypes",
- "onap.policies.controlloop.operational.common.Drools",
- "versions",
- "1.0.0",
- "policies",
- "operational.modifyconfig",
- "versions",
- "1.0.0"
- ]
- },
- "description": "This is a specific API to fetch a policy (example - operational.modifyconfig) referring to the given policy type (example - \"onap.policies.controlloop.operational.common.Drools\"). The same API can be used to fetch a policy referring to any policy type currently available in Policy DB."
- },
- "response": []
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policytypes",
+ "onap.policies.controlloop.operational.common.Drools",
+ "versions",
+ "1.0.0",
+ "policies"
+ ]
},
- {
- "name": "Fetch Policy (Legacy)",
- "request": {
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "type": "text",
- "value": "application/json"
- },
- {
- "key": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/operational.modifyconfiglegacy/versions/1",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "policytypes",
- "onap.policies.controlloop.Operational",
- "versions",
- "1.0.0",
- "policies",
- "operational.modifyconfiglegacy",
- "versions",
- "1"
- ]
- },
- "description": "This is a specific API to fetch a policy (example - operational.modifyconfig) referring to the specific policy type \"onap.policies.controlloop.Operational\" currently available in Policy DB."
- },
- "response": []
+ "description": "This is a specific API to create a policy referring to the given policy type (example - \"onap.policies.controlloop.operational.common.Drools\"). The same API can be used to create policy for any policy type to be deployed in any supported PDP engine."
+ },
+ "response": []
+ },
+ {
+ "name": "Create Policy (Legacy)",
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/yaml"
+ },
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/yaml"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"policy-id\" : \"operational.modifyconfiglegacy\",\n \"content\" : \"controlLoop%3A%0A%20%20version%3A%202.0.0%0A%20%20controlLoopName%3A%20ControlLoop-vFirewall-7e4fbe9c-d612-4ec5-bbf8-605aeabdb677%0A%20%20trigger_policy%3A%20unique-policy-id-1-modifyConfig%0A%20%20timeout%3A%2060%0A%20%20abatement%3A%20false%0Apolicies%3A%0A%20%20-%20id%3A%20unique-policy-id-1-modifyConfig%0A%20%20%20%20name%3A%20modifyconfig-cds-actor%0A%20%20%20%20description%3A%0A%20%20%20%20actor%3A%20CDS%0A%20%20%20%20recipe%3A%20modify-config%0A%20%20%20%20target%3A%0A%20%20%20%20%20%20resourceID%3A%2037b008b9-b367-4359-93fd-74d3ce0ee1a0%0A%20%20%20%20%20%20type%3A%20VNF%0A%20%20%20%20payload%3A%0A%20%20%20%20%20%20artifact_name%3A%20vFW-CDS%0A%20%20%20%20%20%20artifact_version%3A%201.0.0%0A%20%20%20%20%20%20data%3A%20%27%7B%22active-streams%22%3A%227%22%7D%27%0A%20%20%20%20retry%3A%200%0A%20%20%20%20timeout%3A%2030%0A%20%20%20%20success%3A%20final_success%0A%20%20%20%20failure%3A%20final_failure%0A%20%20%20%20failure_timeout%3A%20final_failure_timeout%0A%20%20%20%20failure_retries%3A%20final_failure_retries%0A%20%20%20%20failure_exception%3A%20final_failure_exception%0A%20%20%20%20failure_guard%3A%20final_failure_guard\"\n}"
},
- {
- "name": "Fetch All Policies (Specific)",
- "request": {
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "type": "text",
- "value": "application/json"
- },
- {
- "key": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "policytypes",
- "onap.policies.controlloop.operational.common.Drools",
- "versions",
- "1.0.0",
- "policies"
- ]
- },
- "description": "This is a specific API to fetch all policies referring to the given policy type (example - \"onap.policies.controlloop.operational.common.Drools\"). The same API can be used to fetch policies for any policy type currently available in Policy DB."
- },
- "response": []
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policytypes",
+ "onap.policies.controlloop.Operational",
+ "versions",
+ "1.0.0",
+ "policies"
+ ]
},
- {
- "name": "Fetch All Version of a Policy (Specific)",
- "request": {
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "type": "text",
- "value": "application/json"
- },
- {
- "key": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies/operational.modifyconfig",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "policytypes",
- "onap.policies.controlloop.operational.common.Drools",
- "versions",
- "1.0.0",
- "policies",
- "operational.modifyconfig"
- ]
- },
- "description": "This is a specific API to fetch all versions of a policy (example - operational.modifyconfig) referring to the given policy type (example - \"onap.policies.controlloop.operational.common.Drools\"). The same API can be used to fetch all versions of a policy referring to any policy type currently available in Policy DB."
- },
- "response": []
+ "description": "This is a specific API to create a policy of type \"onap.policies.controlloop.Operational\", used to create legacy control loop operational policy aimed to be deployed in drools-pdp engine."
+ },
+ "response": []
+ },
+ {
+ "name": "Fetch Policy (Specific)",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/json"
+ },
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies/operational.modifyconfig/versions/1.0.0",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policytypes",
+ "onap.policies.controlloop.operational.common.Drools",
+ "versions",
+ "1.0.0",
+ "policies",
+ "operational.modifyconfig",
+ "versions",
+ "1.0.0"
+ ]
},
- {
- "name": "Fetch Latest Version of a Policy (Specific)",
- "request": {
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "type": "text",
- "value": "application/json"
- },
- {
- "key": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies/operational.modifyconfig/versions/latest",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "policytypes",
- "onap.policies.controlloop.operational.common.Drools",
- "versions",
- "1.0.0",
- "policies",
- "operational.modifyconfig",
- "versions",
- "latest"
- ]
- },
- "description": "This is a specific API to fetch latest version of a policy (example - operational.modifyconfig) referring to the given policy type (example - \"onap.policies.controlloop.operational.common.Drools\"). The same API can be used to fetch latest version of a policy referring to any policy type currently available in Policy DB."
- },
- "response": []
+ "description": "This is a specific API to fetch a policy (example - operational.modifyconfig) referring to the given policy type (example - \"onap.policies.controlloop.operational.common.Drools\"). The same API can be used to fetch a policy referring to any policy type currently available in Policy DB."
+ },
+ "response": []
+ },
+ {
+ "name": "Fetch All Policies without specifying policyType",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/json"
+ },
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policies",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policies"
+ ]
},
- {
- "name": "Delete Policy (Specific)",
- "request": {
- "method": "DELETE",
- "header": [
- {
- "key": "Accept",
- "value": "application/json",
- "type": "text"
- },
- {
- "key": "Content-Type",
- "value": "application/json",
- "type": "text"
- }
- ],
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies/operational.modifyconfig/versions/1.0.0",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "policytypes",
- "onap.policies.controlloop.operational.common.Drools",
- "versions",
- "1.0.0",
- "policies",
- "operational.modifyconfig",
- "versions",
- "1.0.0"
- ]
- },
- "description": "This is a specific API to delete a policy (example - operational.modifyconfig) referring to the given policy type (example - \"onap.policies.controlloop.operational.common.Drools\"). The same API can be used to delete a policy referring to any policy type currently available in Policy DB."
- },
- "response": []
+ "description": "This is a specific API to fetch all policies currently available in Policy DB."
+ },
+ "response": []
+ },
+ {
+ "name": "Fetch Policy without specifying policyType (Specific)",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/json"
+ },
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policies/operational.modifyconfig/versions/1.0.0",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policies",
+ "operational.modifyconfig",
+ "versions",
+ "1.0.0"
+ ]
},
- {
- "name": "Delete Policy (Legacy)",
- "request": {
- "method": "DELETE",
- "header": [
- {
- "key": "Accept",
- "value": "application/json",
- "type": "text"
- },
- {
- "key": "Content-Type",
- "value": "application/json",
- "type": "text"
- }
- ],
- "url": {
- "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/operational.modifyconfiglegacy/versions/1",
- "host": [
- "{{POLICY-API-URL}}"
- ],
- "path": [
- "policy",
- "api",
- "v1",
- "policytypes",
- "onap.policies.controlloop.Operational",
- "versions",
- "1.0.0",
- "policies",
- "operational.modifyconfiglegacy",
- "versions",
- "1"
- ]
- },
- "description": "This is a specific API to delete a policy (example - operational.modifyconfiglegacy) referring to the specific policy type \"onap.policies.controlloop.Operational\" currently available in Policy DB."
- },
- "response": []
- }
- ],
- "auth": {
- "type": "basic",
- "basic": [
- {
- "key": "password",
- "value": "{{PASSWORD}}",
- "type": "string"
- },
- {
- "key": "username",
- "value": "{{USER}}",
- "type": "string"
- }
- ]
+ "description": "This is a specific API to fetch a policy (example - operational.modifyconfig). The same API can be used to fetch a policy without referring to any policy type currently available in Policy DB."
+ },
+ "response": []
},
- "event": [
- {
- "listen": "prerequest",
- "script": {
- "id": "c9224b64-293c-4a9c-bd05-ca4b1e1a9dba",
- "type": "text/javascript",
- "exec": [
- ""
- ]
- }
+ {
+ "name": "Fetch Policy (Legacy)",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/json"
+ },
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/operational.modifyconfiglegacy/versions/1",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policytypes",
+ "onap.policies.controlloop.Operational",
+ "versions",
+ "1.0.0",
+ "policies",
+ "operational.modifyconfiglegacy",
+ "versions",
+ "1"
+ ]
},
- {
- "listen": "test",
- "script": {
- "id": "efd8a8fe-3e04-4989-9f1c-8874190c49e4",
- "type": "text/javascript",
- "exec": [
- ""
- ]
- }
- }
- ],
- "variable": [
- {
- "id": "99d48afc-d62d-48be-9f89-d7db5acf48dd",
- "key": "USER",
- "value": "healthcheck",
- "type": "string"
+ "description": "This is a specific API to fetch a policy (example - operational.modifyconfig) referring to the specific policy type \"onap.policies.controlloop.Operational\" currently available in Policy DB."
+ },
+ "response": []
+ },
+ {
+ "name": "Fetch All Policies (Specific)",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/json"
+ },
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policytypes",
+ "onap.policies.controlloop.operational.common.Drools",
+ "versions",
+ "1.0.0",
+ "policies"
+ ]
},
- {
- "id": "a9c660a8-2bd1-4e87-aacd-aa6ff2104a60",
- "key": "PASSWORD",
- "value": "zb!XztG34",
- "type": "string"
- }
- ],
- "protocolProfileBehavior": {}
+ "description": "This is a specific API to fetch all policies referring to the given policy type (example - \"onap.policies.controlloop.operational.common.Drools\"). The same API can be used to fetch policies for any policy type currently available in Policy DB."
+ },
+ "response": []
+ },
+ {
+ "name": "Fetch All Version of a Policy (Specific)",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/json"
+ },
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies/operational.modifyconfig",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policytypes",
+ "onap.policies.controlloop.operational.common.Drools",
+ "versions",
+ "1.0.0",
+ "policies",
+ "operational.modifyconfig"
+ ]
+ },
+ "description": "This is a specific API to fetch all versions of a policy (example - operational.modifyconfig) referring to the given policy type (example - \"onap.policies.controlloop.operational.common.Drools\"). The same API can be used to fetch all versions of a policy referring to any policy type currently available in Policy DB."
+ },
+ "response": []
+ },
+ {
+ "name": "Fetch Latest Version of a Policy (Specific)",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/json"
+ },
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies/operational.modifyconfig/versions/latest",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policytypes",
+ "onap.policies.controlloop.operational.common.Drools",
+ "versions",
+ "1.0.0",
+ "policies",
+ "operational.modifyconfig",
+ "versions",
+ "latest"
+ ]
+ },
+ "description": "This is a specific API to fetch latest version of a policy (example - operational.modifyconfig) referring to the given policy type (example - \"onap.policies.controlloop.operational.common.Drools\"). The same API can be used to fetch latest version of a policy referring to any policy type currently available in Policy DB."
+ },
+ "response": []
+ },
+ {
+ "name": "Delete Policy (Specific)",
+ "request": {
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json",
+ "type": "text"
+ },
+ {
+ "key": "Content-Type",
+ "value": "application/json",
+ "type": "text"
+ }
+ ],
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies/operational.modifyconfig/versions/1.0.0",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policytypes",
+ "onap.policies.controlloop.operational.common.Drools",
+ "versions",
+ "1.0.0",
+ "policies",
+ "operational.modifyconfig",
+ "versions",
+ "1.0.0"
+ ]
+ },
+ "description": "This is a specific API to delete a policy (example - operational.modifyconfig) referring to the given policy type (example - \"onap.policies.controlloop.operational.common.Drools\"). The same API can be used to delete a policy referring to any policy type currently available in Policy DB."
+ },
+ "response": []
+ },
+ {
+ "name": "Delete Policy without specifying policyType (Specific)",
+ "request": {
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Accept",
+ "type": "text",
+ "value": "application/json"
+ },
+ {
+ "key": "Content-Type",
+ "type": "text",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policies/operational.modifyconfig/versions/1.0.0",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policies",
+ "operational.modifyconfig",
+ "versions",
+ "1.0.0"
+ ]
+ },
+ "description": "This is a specific API to delete a policy (example - operational.modifyconfig). The same API can be used to delete a policy without referring to any policy type currently available in Policy DB."
+ },
+ "response": []
+ },
+ {
+ "name": "Delete Policy (Legacy)",
+ "request": {
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json",
+ "type": "text"
+ },
+ {
+ "key": "Content-Type",
+ "value": "application/json",
+ "type": "text"
+ }
+ ],
+ "url": {
+ "raw": "{{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/operational.modifyconfiglegacy/versions/1",
+ "host": [
+ "{{POLICY-API-URL}}"
+ ],
+ "path": [
+ "policy",
+ "api",
+ "v1",
+ "policytypes",
+ "onap.policies.controlloop.Operational",
+ "versions",
+ "1.0.0",
+ "policies",
+ "operational.modifyconfiglegacy",
+ "versions",
+ "1"
+ ]
+ },
+ "description": "This is a specific API to delete a policy (example - operational.modifyconfiglegacy) referring to the specific policy type \"onap.policies.controlloop.Operational\" currently available in Policy DB."
+ },
+ "response": []
+ }
+ ],
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "{{PASSWORD}}",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "{{USER}}",
+ "type": "string"
+ }
+ ]
+ },
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "id": "baf39e37-fd26-4171-82eb-f05352acc45e",
+ "type": "text/javascript",
+ "exec": [
+ ""
+ ]
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "id": "5ba39dc8-fe5c-48fb-a157-c7bb26641a75",
+ "type": "text/javascript",
+ "exec": [
+ ""
+ ]
+ }
+ }
+ ],
+ "variable": [
+ {
+ "id": "99d48afc-d62d-48be-9f89-d7db5acf48dd",
+ "key": "USER",
+ "value": "healthcheck",
+ "type": "string"
+ },
+ {
+ "id": "a9c660a8-2bd1-4e87-aacd-aa6ff2104a60",
+ "key": "PASSWORD",
+ "value": "zb!XztG34",
+ "type": "string"
+ }
+ ],
+ "protocolProfileBehavior": {}
}
\ No newline at end of file