Expose Prometheus metrics for monitoring
[cps.git] / csit / tests / cps-admin / cps-admin.robot
index 446a59b..43a46d3 100644 (file)
@@ -1,3 +1,21 @@
+# ============LICENSE_START=======================================================
+# Copyright (c) 2021 Pantheon.tech.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
 *** Settings ***
 Documentation         CPS Core - Admin REST API
 
@@ -5,20 +23,24 @@ 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 ***
 
+${auth}                 Basic Y3BzdXNlcjpjcHNyMGNrcyE=
 ${basePath}             /cps/api
 ${dataspaceName}        CSIT-Dataspace
 ${schemaSetName}        CSIT-SchemaSet
 ${anchorName}           CSIT-Anchor
+${ranDataspaceName}     NFP-Operational
+${ranSchemaSetName}     cps-ran-schema-model
 
 *** Test Cases ***
 Create Dataspace
     ${uri}=             Set Variable        ${basePath}/v1/dataspaces
     ${params}=          Create Dictionary   dataspace-name=${dataspaceName}
-    ${response}=        POST On Session     CPS_HOST   ${uri}   params=${params}
+    ${headers}=         Create Dictionary   Authorization=${auth}
+    ${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
@@ -27,7 +49,8 @@ Create Schema Set from YANG file
     ${fileData}=        Get Binary File     ${DATADIR}${/}test-tree.yang
     ${fileTuple}=       Create List         test.yang   ${fileData}   application/zip
     &{files}=           Create Dictionary   file=${fileTuple}
-    ${response}=        POST On Session     CPS_HOST   ${uri}   files=${files}   params=${params}
+    ${headers}=         Create Dictionary   Authorization=${auth}
+    ${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
@@ -36,12 +59,14 @@ Create Schema Set from ZIP file
     ${fileData}=        Get Binary File     ${DATADIR}${/}yang-resources.zip
     ${fileTuple}=       Create List         test.zip   ${fileData}   application/zip
     &{files}=           Create Dictionary   file=${fileTuple}
-    ${response}=        POST On Session     CPS_HOST   ${uri}   files=${files}   params=${params}
+    ${headers}=         Create Dictionary   Authorization=${auth}
+    ${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}
-    ${response}=        Get On Session      CPS_HOST   ${uri}   expected_status=200
+    ${headers}=         Create Dictionary   Authorization=${auth}
+    ${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}
@@ -49,5 +74,14 @@ Get Schema Set info
 Create Anchor
     ${uri}=             Set Variable        ${basePath}/v1/dataspaces/${dataspaceName}/anchors
     ${params}=          Create Dictionary   schema-set-name=${schemaSetName}   anchor-name=${anchorName}
-    ${response}=        POST On Session     CPS_HOST   ${uri}   params=${params}
-    Should Be Equal As Strings              ${response.status_code}   201
\ No newline at end of file
+    ${headers}=         Create Dictionary   Authorization=${auth}
+    ${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_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}