summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToine Siebelink <toine.siebelink@est.tech>2021-07-15 07:40:15 +0000
committerGerrit Code Review <gerrit@onap.org>2021-07-15 07:40:15 +0000
commitb0c2031e8d546336685c84cfccef8d515144dfc6 (patch)
treef17c7fc5e9c35c554c879c2343a29b038ef95061
parentd9fe3582c963209a2841b2ec2ca0e5cfe17ea887 (diff)
parentb46d137c04a78f62d097f680e016558b815bd915 (diff)
Merge "Expose Prometheus metrics for monitoring"
-rwxr-xr-xcps-application/pom.xml4
-rw-r--r--cps-application/src/main/resources/application.yml10
-rwxr-xr-xcsit/plans/default/setup.sh8
-rw-r--r--csit/tests/actuator/actuator.robot8
-rw-r--r--csit/tests/cps-admin/cps-admin.robot14
-rw-r--r--csit/tests/cps-data/cps-data.robot6
-rwxr-xr-xdocker-compose/docker-compose.yml3
7 files changed, 33 insertions, 20 deletions
diff --git a/cps-application/pom.xml b/cps-application/pom.xml
index 1ea5d330d0..9ce0006ce1 100755
--- a/cps-application/pom.xml
+++ b/cps-application/pom.xml
@@ -66,6 +66,10 @@
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
+ <groupId>io.micrometer</groupId>
+ <artifactId>micrometer-registry-prometheus</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
diff --git a/cps-application/src/main/resources/application.yml b/cps-application/src/main/resources/application.yml
index 5ae6786ef1..1b62b02df5 100644
--- a/cps-application/src/main/resources/application.yml
+++ b/cps-application/src/main/resources/application.yml
@@ -75,26 +75,26 @@ notification:
security:
# comma-separated uri patterns which do not require authorization
- permit-uri: /manage/health/**,/manage/info,/swagger-ui/**,/swagger-resources/**,/v3/api-docs
+ permit-uri: /manage/**,/swagger-ui/**,/swagger-resources/**,/v3/api-docs
auth:
username: ${CPS_USERNAME}
password: ${CPS_PASSWORD}
# Actuator
management:
+ server:
+ port: 8081
endpoints:
web:
base-path: /manage
- exposure:
- include: info,health,loggers
+ exposure:
+ include: info,health,loggers,prometheus
endpoint:
health:
show-details: always
# kubernetes probes: liveness and readiness
probes:
enabled: true
- loggers:
- enabled: true
logging:
level:
diff --git a/csit/plans/default/setup.sh b/csit/plans/default/setup.sh
index 4d5d1c85c4..cf29b53ac5 100755
--- a/csit/plans/default/setup.sh
+++ b/csit/plans/default/setup.sh
@@ -17,6 +17,7 @@
# Modifications copyright (c) 2017 AT&T Intellectual Property
# Modifications copyright (c) 2020-2021 Samsung Electronics Co., Ltd.
# Modifications Copyright (C) 2021 Pantheon.tech
+# Modifications Copyright (C) 2021 Bell Canada.
#
# Branched from ccsdk/distribution to this repository Feb 23, 2021
#
@@ -66,8 +67,11 @@ if [ "$TIME" -gt "$TIME_OUT" ]; then
fi
# The CPS host according to docker-compose.yml
-CPS_HOST="http://localhost:8883"
+CPS_HOST="localhost"
+CPS_PORT="8883"
+
+MANAGEMENT_PORT="8887"
# Pass variables required for Robot test suites in ROBOT_VARIABLES
-ROBOT_VARIABLES="-v CPS_HOST:$CPS_HOST -v DATADIR:$WORKSPACE/data"
+ROBOT_VARIABLES="-v CPS_HOST:$CPS_HOST -v CPS_PORT:$CPS_PORT -v MANAGEMENT_PORT:$MANAGEMENT_PORT -v DATADIR:$WORKSPACE/data"
diff --git a/csit/tests/actuator/actuator.robot b/csit/tests/actuator/actuator.robot
index 3a0493d686..55ff40e076 100644
--- a/csit/tests/actuator/actuator.robot
+++ b/csit/tests/actuator/actuator.robot
@@ -1,5 +1,6 @@
# ============LICENSE_START=======================================================
# Copyright (c) 2021 Pantheon.tech.
+# Modifications Copyright (c) 2021 Bell Canada.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,16 +23,17 @@ Documentation CPS - Actuator endpoints
Library Collections
Library RequestsLibrary
-Suite Setup Create Session CPS_HOST ${CPS_HOST}
+Suite Setup Create Session MANAGEMENT_URL http://${CPS_HOST}:${MANAGEMENT_PORT}/manage
*** Variables ***
*** Test Cases ***
Test Liveness Probe Endpoint
- ${response}= GET On Session CPS_HOST /manage/health/liveness expected_status=200
+ ${response}= GET On Session MANAGEMENT_URL health/liveness expected_status=200
Should Be Equal As Strings ${response.json()['status']} UP
Test Readiness Probe Endpoint
- ${response}= GET On Session CPS_HOST /manage/health/readiness expected_status=200
+ ${response}= GET On Session MANAGEMENT_URL health/readiness expected_status=200
Should Be Equal As Strings ${response.json()['status']} UP
+
diff --git a/csit/tests/cps-admin/cps-admin.robot b/csit/tests/cps-admin/cps-admin.robot
index 7e944ec6f7..43a46d3274 100644
--- a/csit/tests/cps-admin/cps-admin.robot
+++ b/csit/tests/cps-admin/cps-admin.robot
@@ -23,7 +23,7 @@ Library Collections
Library OperatingSystem
Library RequestsLibrary
-Suite Setup Create Session CPS_HOST ${CPS_HOST}
+Suite Setup Create Session CPS_URL http://${CPS_HOST}:${CPS_PORT}
*** Variables ***
@@ -40,7 +40,7 @@ Create Dataspace
${uri}= Set Variable ${basePath}/v1/dataspaces
${params}= Create Dictionary dataspace-name=${dataspaceName}
${headers}= Create Dictionary Authorization=${auth}
- ${response}= POST On Session CPS_HOST ${uri} params=${params} headers=${headers}
+ ${response}= POST On Session CPS_URL ${uri} params=${params} headers=${headers}
Should Be Equal As Strings ${response.status_code} 201
Create Schema Set from YANG file
@@ -50,7 +50,7 @@ Create Schema Set from YANG file
${fileTuple}= Create List test.yang ${fileData} application/zip
&{files}= Create Dictionary file=${fileTuple}
${headers}= Create Dictionary Authorization=${auth}
- ${response}= POST On Session CPS_HOST ${uri} files=${files} params=${params} headers=${headers}
+ ${response}= POST On Session CPS_URL ${uri} files=${files} params=${params} headers=${headers}
Should Be Equal As Strings ${response.status_code} 201
Create Schema Set from ZIP file
@@ -60,13 +60,13 @@ Create Schema Set from ZIP file
${fileTuple}= Create List test.zip ${fileData} application/zip
&{files}= Create Dictionary file=${fileTuple}
${headers}= Create Dictionary Authorization=${auth}
- ${response}= POST On Session CPS_HOST ${uri} files=${files} params=${params} headers=${headers}
+ ${response}= POST On Session CPS_URL ${uri} files=${files} params=${params} headers=${headers}
Should Be Equal As Strings ${response.status_code} 201
Get Schema Set info
${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/schema-sets/${schemaSetName}
${headers}= Create Dictionary Authorization=${auth}
- ${response}= Get On Session CPS_HOST ${uri} headers=${headers} expected_status=200
+ ${response}= Get On Session CPS_URL ${uri} headers=${headers} expected_status=200
${responseJson}= Set Variable ${response.json()}
Should Be Equal As Strings ${responseJson['name']} ${schemaSetName}
Should Be Equal As Strings ${responseJson['dataspaceName']} ${dataspaceName}
@@ -75,13 +75,13 @@ Create Anchor
${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/anchors
${params}= Create Dictionary schema-set-name=${schemaSetName} anchor-name=${anchorName}
${headers}= Create Dictionary Authorization=${auth}
- ${response}= POST On Session CPS_HOST ${uri} params=${params} headers=${headers}
+ ${response}= POST On Session CPS_URL ${uri} params=${params} headers=${headers}
Should Be Equal As Strings ${response.status_code} 201
Get CPS RAN Schema Set info
${uri}= Set Variable ${basePath}/v1/dataspaces/${ranDataspaceName}/schema-sets/${ranSchemaSetName}
${headers}= Create Dictionary Authorization=${auth}
- ${response}= Get On Session CPS_HOST ${uri} headers=${headers} expected_status=200
+ ${response}= Get On Session CPS_URL ${uri} headers=${headers} expected_status=200
${responseJson}= Set Variable ${response.json()}
Should Be Equal As Strings ${responseJson['name']} ${ranSchemaSetName}
Should Be Equal As Strings ${responseJson['dataspaceName']} ${ranDataspaceName}
diff --git a/csit/tests/cps-data/cps-data.robot b/csit/tests/cps-data/cps-data.robot
index 9fd8451d28..e7334ae11e 100644
--- a/csit/tests/cps-data/cps-data.robot
+++ b/csit/tests/cps-data/cps-data.robot
@@ -23,7 +23,7 @@ Library Collections
Library OperatingSystem
Library RequestsLibrary
-Suite Setup Create Session CPS_HOST ${CPS_HOST}
+Suite Setup Create Session CPS_URL http://${CPS_HOST}:${CPS_PORT}
*** Variables ***
@@ -37,14 +37,14 @@ Create Data Node
${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/anchors/${anchorName}/nodes
${headers} Create Dictionary Content-Type=application/json Authorization=${auth}
${jsonData}= Get Binary File ${DATADIR}${/}test-tree.json
- ${response}= POST On Session CPS_HOST ${uri} headers=${headers} data=${jsonData}
+ ${response}= POST On Session CPS_URL ${uri} headers=${headers} data=${jsonData}
Should Be Equal As Strings ${response.status_code} 201
Get Data Node by XPath
${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/anchors/${anchorName}/node
${params}= Create Dictionary xpath=/test-tree/branch[@name='Left']/nest
${headers}= Create Dictionary Authorization=${auth}
- ${response}= Get On Session CPS_HOST ${uri} params=${params} headers=${headers} expected_status=200
+ ${response}= Get On Session CPS_URL ${uri} params=${params} headers=${headers} expected_status=200
${responseJson}= Set Variable ${response.json()}
Should Be Equal As Strings ${responseJson['name']} Small
diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml
index e7e7450969..e2185f6de4 100755
--- a/docker-compose/docker-compose.yml
+++ b/docker-compose/docker-compose.yml
@@ -24,6 +24,7 @@ services:
# image: ${DOCKER_REPO:-nexus3.onap.org:10003}/onap/cps-service:${VERSION:-latest}
# ports:
# - "8881:8080"
+ # - "8887:8081"
# environment:
# CPS_USERNAME: ${CPS_USERNAME:-cpsuser}
# CPS_PASSWORD: ${CPS_PASSWORD:-cpsr0cks!}
@@ -41,6 +42,7 @@ services:
# image: ${DOCKER_REPO:-nexus3.onap.org:10003}/onap/cps-ncmp:${VERSION:-latest}
# ports:
# - "8882:8080"
+ # - "8887:8081"
# environment:
# CPS_USERNAME: ${CPS_USERNAME:-cpsuser}
# CPS_PASSWORD: ${CPS_PASSWORD:-cpsr0cks!}
@@ -58,6 +60,7 @@ services:
image: ${DOCKER_REPO:-nexus3.onap.org:10003}/onap/cps-and-ncmp:${VERSION:-latest}
ports:
- "8883:8080"
+ - "8887:8081"
environment:
CPS_USERNAME: ${CPS_USERNAME:-cpsuser}
CPS_PASSWORD: ${CPS_PASSWORD:-cpsr0cks!}