Add ETSI VIM prometheus config file to VIM registration in stage3 to fix SA tests 61/15261/5
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 26 Jun 2025 15:45:46 +0000 (17:45 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 27 Jun 2025 07:23:42 +0000 (09:23 +0200)
Change-Id: I2f12b59acb87cb9e5b5eaab752b820a3e219f352
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
jenkins/ci-pipelines/ci_stage_3.groovy

index 10b8e8f..070eaaa 100644 (file)
@@ -50,6 +50,9 @@ properties([
         string(defaultValue: '/home/jenkins/hive/port-mapping-etsi-vim.yaml',
                description: 'Port mapping file for SDN assist in ETSI VIM',
                name: 'ROBOT_PORT_MAPPING_VIM'),
+        string(defaultValue: '/home/jenkins/hive/etsi-vim-prometheus.json',
+               description: 'Prometheus configuration file in ETSI VIM',
+               name: 'PROMETHEUS_CONFIG_VIM'),
         string(defaultValue: '/home/jenkins/hive/kubeconfig.yaml', description: '', name: 'KUBECONFIG'),
         string(defaultValue: '/home/jenkins/hive/clouds.yaml', description: '', name: 'CLOUDS'),
         string(defaultValue: 'Default', description: '', name: 'INSTALLER'),
@@ -64,7 +67,8 @@ properties([
 // Helper Functions
 ////////////////////////////////////////////////////////////////////////////////////////
 String execute_docker_run(String tagName, String osmHostname, String environmentFile,
-                        String portmappingfile, String kubeconfig, String clouds,
+                        String portmappingfile, String prometheusconfigfile,
+                        String kubeconfig, String clouds,
                         String entrypoint=null, String entrypointArgs="") {
     try {
         String entrypointCmd = entrypoint ? "--entrypoint ${entrypoint}" : ""
@@ -74,6 +78,7 @@ String execute_docker_run(String tagName, String osmHostname, String environment
             -v ${clouds}:/etc/openstack/clouds.yaml \
             -v ${kubeconfig}:/root/.kube/config \
             -v ${portmappingfile}:/root/port-mapping.yaml \
+            -v ${prometheusconfigfile}:/root/etsi-vim-prometheus.json \
             opensourcemano/tests:${tagName} ${entrypointArgs}""")
         return output
     } catch (Exception e) {
@@ -88,7 +93,8 @@ void register_etsi_vim_account(
     String envfile=null,
     String portmappingfile=null,
     String kubeconfig=null,
-    String clouds=null
+    String clouds=null,
+    String prometheusconfigfile=null
 ) {
     String VIM_TARGET = "osm"
     String VIM_MGMT_NET = "osm-ext"
@@ -112,8 +118,9 @@ void register_etsi_vim_account(
                 String entrypointArgs = """vim-create --name ${VIM_TARGET} --user ${OS_USERNAME} \
                         --password ${OS_PASSWORD} --tenant ${OS_PROJECT_NAME} \
                         --auth_url ${OS_AUTH_URL} --account_type openstack --description vim \
+                        --prometheus_config_file /root/etsi-vim-prometheus.json \
                         --config '{management_network_name: ${VIM_MGMT_NET}, dataplane_physical_net: physnet2}' || true"""
-                String createOutput = execute_docker_run(tagName, osmHostname, environmentFile, portmappingfile, kubeconfig, clouds, entrypointCmd, entrypointArgs)
+                String createOutput = execute_docker_run(tagName, osmHostname, environmentFile, portmappingfile, prometheusconfigfile, kubeconfig, clouds, entrypointCmd, entrypointArgs)
                 println("VIM Creation Output: ${createOutput}")
             }
 
@@ -122,7 +129,7 @@ void register_etsi_vim_account(
             while (statusChecks > 0) {
                 sleep(10)  // Wait for 10 seconds before checking status
                 entrypointArgs = """vim-list --long | grep ${VIM_TARGET}"""
-                String vimList = execute_docker_run(tagName, osmHostname, environmentFile, portmappingfile, kubeconfig, clouds, entrypointCmd, entrypointArgs)
+                String vimList = execute_docker_run(tagName, osmHostname, environmentFile, portmappingfile, prometheusconfigfile, kubeconfig, clouds, entrypointCmd, entrypointArgs)
                 println("VIM List output: ${vimList}")
                 if (vimList.contains("ENABLED")) {
                     println("VIM successfully registered and is ENABLED.")
@@ -134,7 +141,7 @@ void register_etsi_vim_account(
             // If stuck, delete and retry
             println("VIM stuck for more than 50 seconds, deleting and retrying...")
             entrypointArgs = """vim-delete --force ${VIM_TARGET}"""
-            String deleteOutput = execute_docker_run(tagName, osmHostname, environmentFile, portmappingfile, kubeconfig, clouds, entrypointCmd, entrypointArgs)
+            String deleteOutput = execute_docker_run(tagName, osmHostname, environmentFile, portmappingfile, prometheusconfigfile, kubeconfig, clouds, entrypointCmd, entrypointArgs)
             println("VIM Deletion Output: ${deleteOutput}")
             sleep(5)
         } catch (Exception e) {
@@ -153,7 +160,8 @@ void register_etsi_k8s_cluster(
     String envfile=null,
     String portmappingfile=null,
     String kubeconfig=null,
-    String clouds=null
+    String clouds=null,
+    String prometheusconfigfile=null
 ) {
     String K8S_CLUSTER_TARGET = "osm"
     String VIM_TARGET = "osm"
@@ -175,7 +183,7 @@ void register_etsi_k8s_cluster(
             String entrypointArgs = """k8scluster-add ${K8S_CLUSTER_TARGET} --creds ${K8S_CREDENTIALS} --version "v1" \
                         --description "Robot-cluster" --skip-jujubundle --vim ${VIM_TARGET} \
                         --k8s-nets '{net1: ${VIM_MGMT_NET}}'"""
-            String createOutput = execute_docker_run(tagName, osmHostname, environmentFile, portmappingfile, kubeconfig, clouds, entrypointCmd, entrypointArgs)
+            String createOutput = execute_docker_run(tagName, osmHostname, environmentFile, portmappingfile, prometheusconfigfile, kubeconfig, clouds, entrypointCmd, entrypointArgs)
             println("K8s Cluster Addition Output: ${createOutput}")
 
             // Check if the K8s cluster is ENABLED
@@ -183,7 +191,7 @@ void register_etsi_k8s_cluster(
             while (statusChecks > 0) {
                 sleep(10)  // Wait for 10 seconds before checking status
                 entrypointArgs = """k8scluster-list | grep ${K8S_CLUSTER_TARGET}"""
-                String clusterList = execute_docker_run(tagName, osmHostname, environmentFile, portmappingfile, kubeconfig, clouds, entrypointCmd, entrypointArgs)
+                String clusterList = execute_docker_run(tagName, osmHostname, environmentFile, portmappingfile, prometheusconfigfile, kubeconfig, clouds, entrypointCmd, entrypointArgs)
                 println("K8s Cluster List Output: ${clusterList}")
                 if (clusterList.contains("ENABLED")) {
                     println("K8s cluster successfully registered and is ENABLED.")
@@ -195,10 +203,10 @@ void register_etsi_k8s_cluster(
             // If stuck, delete and retry
             println("K8s cluster stuck for more than 50 seconds, deleting and retrying...")
             entrypointArgs = """k8scluster-show ${K8S_CLUSTER_TARGET}"""
-            String showOutput = execute_docker_run(tagName, osmHostname, environmentFile, portmappingfile, kubeconfig, clouds, entrypointCmd, entrypointArgs)
+            String showOutput = execute_docker_run(tagName, osmHostname, environmentFile, portmappingfile, prometheusconfigfile, kubeconfig, clouds, entrypointCmd, entrypointArgs)
             println("K8s Cluster Show Output: ${showOutput}")
             entrypointArgs = """k8scluster-delete ${K8S_CLUSTER_TARGET}"""
-            String deleteOutput = execute_docker_run(tagName, osmHostname, environmentFile, portmappingfile, kubeconfig, clouds, entrypointCmd, entrypointArgs)
+            String deleteOutput = execute_docker_run(tagName, osmHostname, environmentFile, portmappingfile, prometheusconfigfile, kubeconfig, clouds, entrypointCmd, entrypointArgs)
             println("K8s Cluster Deletion Output: ${deleteOutput}")
             sleep(5)
         } catch (Exception e) {
@@ -798,7 +806,8 @@ EOF"""
                             params.ROBOT_VIM,
                             params.ROBOT_PORT_MAPPING_VIM,
                             params.KUBECONFIG,
-                            params.CLOUDS
+                            params.CLOUDS,
+                            params.PROMETHEUS_CONFIG_VIM
                         )
                         register_etsi_k8s_cluster(
                             containerName,
@@ -806,7 +815,8 @@ EOF"""
                             params.ROBOT_VIM,
                             params.ROBOT_PORT_MAPPING_VIM,
                             params.KUBECONFIG,
-                            params.CLOUDS
+                            params.CLOUDS,
+                            params.PROMETHEUS_CONFIG_VIM
                         )
                         run_robot_systest(
                             containerName,