Feature 11065: Ubuntu24 as base image for OSM installation

Change-Id: Ib55cbb7f14f66d6c72f96cecc88c17426cce494a
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/installers/10-install-client-tools.sh b/installers/10-install-client-tools.sh
index 51153d1..c32bfb0 100755
--- a/installers/10-install-client-tools.sh
+++ b/installers/10-install-client-tools.sh
@@ -132,21 +132,27 @@
 # OSM client
 OSM_CLIENT_VERSION=${OSM_CLIENT_VERSION:-"master"}
 OSM_IM_VERSION=${OSM_IM_VERSION:-"master"}
-sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-setuptools python3-dev python3-pip
-sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libmagic1
+sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-setuptools python3-dev python3-pip python3-venv
+sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libmagic1t64
 sudo DEBIAN_FRONTEND=noninteractive apt-get install -y make
-python3 -m pip install --user -U pip
+
+python3 -m venv venv
+source venv/bin/activate
+python -m pip install -U pip
+
 # Install OSM IM and its dependencies via pip
-python3 -m pip install --user -r "https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=${OSM_IM_VERSION}"
+pip install -r "https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=${OSM_IM_VERSION}"
 # Path needs to include $HOME/.local/bin in order to use pyang
 [ "$(which pyang)" = "$HOME/.local/bin/pyang" ] || export PATH=$HOME/.local/bin:${PATH}
-#python3 -m pip install --user "git+https://osm.etsi.org/gerrit/osm/IM.git@${OSM_IM_VERSION}#egg=osm-im" --upgrade
+#pip install "git+https://osm.etsi.org/gerrit/osm/IM.git@${OSM_IM_VERSION}#egg=osm-im" --upgrade
 TMP_DIR=$(mktemp -d)
 git clone https://osm.etsi.org/gerrit/osm/IM.git "$TMP_DIR/IM"
 git -C "$TMP_DIR/IM" fetch "https://osm.etsi.org/gerrit/osm/IM" refs/changes/15/15515/1 && git -C "$TMP_DIR/IM" checkout FETCH_HEAD
-python3 -m pip install --user "$TMP_DIR/IM"
-python3 -m pip install --user -r "https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=${OSM_CLIENT_VERSION}"
-python3 -m pip install --user git+https://osm.etsi.org/gerrit/osm/osmclient.git@${OSM_CLIENT_VERSION}#egg=osmclient
+pip install "$TMP_DIR/IM"
+pip install -r "https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=${OSM_CLIENT_VERSION}"
+pip install git+https://osm.etsi.org/gerrit/osm/osmclient.git@${OSM_CLIENT_VERSION}#egg=osmclient
+mkdir -p $HOME/.local/bin
+ln -s $HOME/venv/bin/osm $HOME/.local/bin/osm
 echo "OSM client installed"
 
 popd
diff --git a/jenkins/ci-pipelines/ci_stage_2.groovy b/jenkins/ci-pipelines/ci_stage_2.groovy
index a5eba64..a588cf0 100644
--- a/jenkins/ci-pipelines/ci_stage_2.groovy
+++ b/jenkins/ci-pipelines/ci_stage_2.groovy
@@ -105,7 +105,7 @@
             def downstream_params_stage_3 = [
                 string(name: 'GERRIT_BRANCH', value: "${branch}"),
                 string(name: 'INSTALLER', value: "Default" ),
-                string(name: 'OPENSTACK_BASE_IMAGE', value: "ubuntu22.04" ),
+                string(name: 'OPENSTACK_BASE_IMAGE', value: "ubuntu24.04" ),
                 string(name: 'OPENSTACK_OSM_FLAVOR', value: "osm.sanity" ),
                 string(name: 'UPSTREAM_JOB_NAME', value: "${JOB_NAME}" ),
                 string(name: 'UPSTREAM_JOB_NUMBER', value: "${BUILD_NUMBER}" ),
diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy
index f03dbe2..8ce0379 100644
--- a/jenkins/ci-pipelines/ci_stage_3.groovy
+++ b/jenkins/ci-pipelines/ci_stage_3.groovy
@@ -31,7 +31,7 @@
         string(defaultValue: 'artifactory-osm', description: '', name: 'ARTIFACTORY_SERVER'),
         string(defaultValue: 'osm-stage_4', description: '', name: 'DOWNSTREAM_STAGE_NAME'),
         string(defaultValue: 'testing-daily', description: '', name: 'DOCKER_TAG'),
-        string(defaultValue: 'ubuntu22.04', description: '', name: 'OPENSTACK_BASE_IMAGE'),
+        string(defaultValue: 'ubuntu24.04', description: '', name: 'OPENSTACK_BASE_IMAGE'),
         string(defaultValue: 'osm.sanity', description: '', name: 'OPENSTACK_OSM_FLAVOR'),
         booleanParam(defaultValue: false, description: '', name: 'TRY_OLD_SERVICE_ASSURANCE'),
         booleanParam(defaultValue: true, description: '', name: 'TRY_JUJU_INSTALLATION'),
@@ -889,7 +889,7 @@
                             "-o StrictHostKeyChecking=no " +
                             "-o UserKnownHostsFile=/dev/null " +
                             "ubuntu@${IP_ADDRESS} " +
-                            "'sudo systemctl restart sshd'")
+                            "'sudo systemctl restart ssh.service'")
                     //////////////////////////////////////////////////////////////////////////////////////////////
 
                 } // stage("Spawn Remote VM")
diff --git a/jenkins/public-clouds-tests/Jenkinsfile b/jenkins/public-clouds-tests/Jenkinsfile
index caea6df..aabe795 100644
--- a/jenkins/public-clouds-tests/Jenkinsfile
+++ b/jenkins/public-clouds-tests/Jenkinsfile
@@ -61,7 +61,7 @@
     environment {
         // Azure environment
         CLOUD_TYPE                 = 'azure'
-        SOURCE_IMAGE_NAME          = 'Canonical:0001-com-ubuntu-server-jammy:22_04-lts:latest'
+        SOURCE_IMAGE_NAME          = 'Canonical:ubuntu-24_04-lts:server:latest'
         FLAVOR_NAME                = 'Standard_D4as_v4'
         K8S_FLAVOR_NAME            = 'Standard_A2_v2'
         USE_PAAS_K8S               = 'FALSE'
@@ -84,7 +84,7 @@
         VIM_EXT_NET                = 'osm-ext'
         OVERRIDES                  = '--override-epa'
         FLAVOR_NAME                = 'osm.sanity'
-        SOURCE_IMAGE_NAME          = 'ubuntu22.04'
+        SOURCE_IMAGE_NAME          = 'ubuntu24.04'
         SSH_KEY_NAME               = 'niv2020'
         SDNC_USER                  = 'karaf'
         SDNC_PASSWORD              = 'karaf'