Skip to content
Snippets Groups Projects
Commit 91da27e9 authored by aticig's avatar aticig
Browse files

Changing scripts to use hackfest15main project for OSM instances installation


Signed-off-by: aticig's avatarGulsum Atici <gulsum.atici@canonical.com>
parent a4e47e53
No related branches found
No related tags found
1 merge request!223Setup scripts for Charmed OSM Hackfest 15
Pipeline #11088 failed with stage
in 1 minute and 24 seconds
Showing
with 2010 additions and 106 deletions
...@@ -16,7 +16,7 @@ if [ ! -z ${DEBUG} ]; then ...@@ -16,7 +16,7 @@ if [ ! -z ${DEBUG} ]; then
fi fi
START=5 START=5
MAX=10 MAX=5
if [ ! -z $2 ] ; then if [ ! -z $2 ] ; then
START=$1 START=$1
......
...@@ -3,23 +3,14 @@ echo $0 started at $(date) ...@@ -3,23 +3,14 @@ echo $0 started at $(date)
PARTICIPANT=${1} PARTICIPANT=${1}
. ./common-vars . ./common-vars
. ./openstack_credentials.rc $PARTICIPANT . ./main_credentials.rc
VM_NAME=`expr charmedosm-${PARTICIPANT}` VM_NAME=`expr charmedosm-${PARTICIPANT}`
echo "Creating public port" echo "Creating public port"
# This port gets created as the admin # This port gets created as the admin
openstack port create --security-group default --network $NETWORK $VM_NAME openstack port create --disable-port-security --enable --network $NETWORK $VM_NAME
wait wait
NOT_READY=1
while [ $NOT_READY -eq 1 ] ; do
openstack server list
NOT_READY=$?
done
echo "Creating Keypair" echo "Creating Keypair"
openstack keypair create --public-key ./hackfest_rsa.pub ${KEY_NAME} & openstack keypair create --public-key ./hackfest_rsa.pub ${KEY_NAME} &
wait wait
......
#!/bin/bash #!/bin/bash
echo $0 started at $(date) echo $0 started at $(date)
PARTICIPANT=${1}
. ./common-vars . ./common-vars
. ./openstack_credentials.rc PARTICIPANT . ./main_credentials.rc
OPENSTACK_USER=hackfest15group${PARTICIPANT}
PROJECT=hackfest15group${PARTICIPANT}
PASSWORD=hackfest15group-${PARTICIPANT}!
echo Cleaning up ${OPENSTACK_USER}
PROJECT_ID=`openstack project list | grep "${PROJECT} " | awk '{print $2}'` PROJECT_ID=`openstack project list | grep "${PROJECT} " | awk '{print $2}'`
if [ "${PROJECT_ID}" != "" ]; then if [ "${PROJECT_ID}" != "" ]; then
unset OS_PROJECT_NAME
echo "Removing Router Ports" echo "Removing Router Ports"
for ROUTER in $(openstack --os-username=$OPENSTACK_USER --os-password=$PASSWORD --os-project-id=$PROJECT_ID router list -f value -c ID); do for ROUTER in $(openstack router list -f value -c ID); do
openstack --os-username=$OPENSTACK_USER --os-password=$PASSWORD --os-project-id=$PROJECT_ID router unset --external-gateway ${ROUTER} openstack router unset --external-gateway ${ROUTER}
PORT=$(openstack --os-username=$OPENSTACK_USER --os-password=$PASSWORD --os-project-id=$PROJECT_ID router show ${ROUTER} -f json -c interfaces_info | jq .interfaces_info[0].port_id -r) PORT=$(openstack router show ${ROUTER} -f json -c interfaces_info | jq .interfaces_info[0].port_id -r)
while [ "${PORT}" != "null" -a "${PORT}" != "" ] ; do while [ "${PORT}" != "null" -a "${PORT}" != "" ] ; do
openstack --os-username=$OPENSTACK_USER --os-password=$PASSWORD --os-project-id=$PROJECT_ID router remove port ${ROUTER} ${PORT} openstack router remove port ${ROUTER} ${PORT}
PORT=$(openstack --os-username=$OPENSTACK_USER --os-password=$PASSWORD --os-project-id=$PROJECT_ID router show ${ROUTER} -f json -c interfaces_info | jq .interfaces_info[0].port_id -r) PORT=$(openstack router show ${ROUTER} -f json -c interfaces_info | jq .interfaces_info[0].port_id -r)
done done
done done
echo "Removing VMs" echo "Removing VMs"
openstack --os-username=$OPENSTACK_USER --os-password=$PASSWORD --os-project-id=$PROJECT_ID server list -f value -c ID | xargs openstack --os-username=$OPENSTACK_USER --os-password=$PASSWORD --os-project-id=$PROJECT_ID server delete openstack server list -f value -c ID | xargs openstack server delete
echo "Removing Routers" echo "Removing Routers"
openstack --os-username=$OPENSTACK_USER --os-password=$PASSWORD --os-project-id=$PROJECT_ID router list -f value -c ID | xargs openstack --os-username=$OPENSTACK_USER --os-password=$PASSWORD --os-project-id=$PROJECT_ID router delete openstack router list -f value -c ID | xargs openstack router delete
echo "Removing Ports" echo "Removing Ports"
openstack --os-username=$OPENSTACK_USER --os-password=$PASSWORD --os-project-id=$PROJECT_ID port list -f value -c ID | xargs openstack --os-username=$OPENSTACK_USER --os-password=$PASSWORD --os-project-id=$PROJECT_ID port delete openstack port list -f value -c ID | xargs openstack port delete
fi fi
......
./create-openstack-vm.sh started at Çrş 07 Haz 2023 11:35:59 +03
Creating public port
The option [tenant_id] has been deprecated. Please avoid using it.
+-------------------------+------------------------------------------------------------------------------+
| Field | Value |
+-------------------------+------------------------------------------------------------------------------+
| admin_state_up | UP |
| allowed_address_pairs | |
| binding_host_id | |
| binding_profile | |
| binding_vif_details | |
| binding_vif_type | unbound |
| binding_vnic_type | normal |
| created_at | 2023-06-07T08:36:02Z |
| data_plane_status | None |
| description | |
| device_id | |
| device_owner | |
| device_profile | None |
| dns_assignment | None |
| dns_domain | None |
| dns_name | None |
| extra_dhcp_opts | |
| fixed_ips | ip_address='172.21.248.95', subnet_id='d14f68b7-8287-41fe-b533-dafb2240680a' |
| id | 3015e793-2ec3-4427-b070-07a3d52d7196 |
| ip_allocation | None |
| mac_address | fa:16:3e:ea:1e:8e |
| name | charmedosm-5 |
| network_id | 21ea5d92-24f1-40ab-8d28-83230e277a49 |
| numa_affinity_policy | None |
| port_security_enabled | False |
| project_id | f3ba6235ec7b4e9fbe6002992d60a207 |
| propagate_uplink_status | None |
| qos_network_policy_id | None |
| qos_policy_id | None |
| resource_request | None |
| revision_number | 1 |
| security_group_ids | |
| status | DOWN |
| tags | |
| tenant_id | f3ba6235ec7b4e9fbe6002992d60a207 |
| trunk_details | None |
| updated_at | 2023-06-07T08:36:02Z |
+-------------------------+------------------------------------------------------------------------------+
Creating Keypair
+-------------+-------------------------------------------------+
| Field | Value |
+-------------+-------------------------------------------------+
| created_at | None |
| fingerprint | fe:af:ae:27:b9:9d:73:6e:a2:00:c8:10:03:21:89:fe |
| id | hackfest |
| is_deleted | None |
| name | hackfest |
| type | ssh |
| user_id | 5fcfab909583499e8af7ed632709dc2e |
+-------------+-------------------------------------------------+
Launching OSM VM
The option [tenant_id] has been deprecated. Please avoid using it.
More than one Port exists with the name 'charmedosm-5'.
Waiting for OSM VM to be ready
./create-openstack-vm.sh started at Çrş 07 Haz 2023 11:40:01 +03
Creating public port
The option [tenant_id] has been deprecated. Please avoid using it.
+-------------------------+-------------------------------------------------------------------------------+
| Field | Value |
+-------------------------+-------------------------------------------------------------------------------+
| admin_state_up | UP |
| allowed_address_pairs | |
| binding_host_id | |
| binding_profile | |
| binding_vif_details | |
| binding_vif_type | unbound |
| binding_vnic_type | normal |
| created_at | 2023-06-07T08:40:04Z |
| data_plane_status | None |
| description | |
| device_id | |
| device_owner | |
| device_profile | None |
| dns_assignment | None |
| dns_domain | None |
| dns_name | None |
| extra_dhcp_opts | |
| fixed_ips | ip_address='172.21.249.248', subnet_id='d14f68b7-8287-41fe-b533-dafb2240680a' |
| id | dea3d03e-5876-43b3-b27c-340d05706508 |
| ip_allocation | None |
| mac_address | fa:16:3e:ef:31:40 |
| name | charmedosm-5 |
| network_id | 21ea5d92-24f1-40ab-8d28-83230e277a49 |
| numa_affinity_policy | None |
| port_security_enabled | False |
| project_id | f3ba6235ec7b4e9fbe6002992d60a207 |
| propagate_uplink_status | None |
| qos_network_policy_id | None |
| qos_policy_id | None |
| resource_request | None |
| revision_number | 1 |
| security_group_ids | |
| status | DOWN |
| tags | |
| tenant_id | f3ba6235ec7b4e9fbe6002992d60a207 |
| trunk_details | None |
| updated_at | 2023-06-07T08:40:04Z |
+-------------------------+-------------------------------------------------------------------------------+
Creating Keypair
ConflictException: 409: Client Error for url: http://172.21.247.1:8774/v2.1/os-keypairs, Key pair 'hackfest' already exists.
Launching OSM VM
The option [tenant_id] has been deprecated. Please avoid using it.
+-------------------------------------+----------------------------------------------------+
| Field | Value |
+-------------------------------------+----------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | |
| OS-EXT-SRV-ATTR:host | None |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None |
| OS-EXT-SRV-ATTR:instance_name | |
| OS-EXT-STS:power_state | NOSTATE |
| OS-EXT-STS:task_state | scheduling |
| OS-EXT-STS:vm_state | building |
| OS-SRV-USG:launched_at | None |
| OS-SRV-USG:terminated_at | None |
| accessIPv4 | |
| accessIPv6 | |
| addresses | |
| adminPass | 955KMZsruLpb |
| config_drive | |
| created | 2023-06-07T08:40:12Z |
| flavor | osm.sanity (7d3c99d5-b597-4228-88e0-f67a81be6a64) |
| hostId | |
| id | 0992ad21-03e7-4401-b19d-25932d81e4a4 |
| image | ubuntu20.04 (d3cd2290-5813-4f77-90f8-7a1e8c21d9c6) |
| key_name | hackfest |
| name | charmedosm-5 |
| progress | 0 |
| project_id | f3ba6235ec7b4e9fbe6002992d60a207 |
| properties | |
| security_groups | name='default' |
| status | BUILD |
| updated | 2023-06-07T08:40:12Z |
| user_id | 5fcfab909583499e8af7ed632709dc2e |
| volumes_attached | |
+-------------------------------------+----------------------------------------------------+
Waiting for OSM VM to be ready
This diff is collapsed.
This diff is collapsed.
#OpenStack Credentials #OpenStack Credentials for OSM instances
PARTICIPANT=`expr $1`
export OS_AUTH_URL=http://172.21.247.1:5000/v3 export OS_AUTH_URL=http://172.21.247.1:5000/v3
export OS_PROJECT_NAME=hackfest15group${PARTICIPANT} export OS_PROJECT_NAME=hackfest15main
export OS_USER_DOMAIN_NAME='Default' export OS_USER_DOMAIN_NAME='Default'
export OS_PROJECT_DOMAIN_ID='default' export OS_PROJECT_DOMAIN_ID='default'
export OS_USERNAME=hackfest15group${PARTICIPANT} export OS_USERNAME=hackfest_admin
export OS_PASSWORD=hackfest15group-${PARTICIPANT}! export OS_PASSWORD=h@ckf3st
export OS_REGION_NAME='RegionOne' export OS_REGION_NAME='RegionOne'
export OS_INTERFACE=public export OS_INTERFACE=public
export OS_IDENTITY_API_VERSION=3 export OS_IDENTITY_API_VERSION=3
...@@ -5,9 +5,8 @@ echo $0 started at $(date) ...@@ -5,9 +5,8 @@ echo $0 started at $(date)
mkdir -p logs/ mkdir -p logs/
for PARTICIPANT in `seq ${START} ${MAX}` ; do ./delete-openstack-vm.sh 2>&1 | tee -a logs/delete-openstack-osm-vms.log &
./delete-openstack-vm.sh ${PARTICIPANT} 2>&1 | tee -a logs/delete-openstack-user-and-project-${PARTICIPANT}.log &
done
wait wait
echo $0 $@ complete at $(date) echo $0 $@ complete at $(date)
\ No newline at end of file
...@@ -3,10 +3,10 @@ echo $0 started at $(date) ...@@ -3,10 +3,10 @@ echo $0 started at $(date)
. ./common-vars . ./common-vars
./run-create-openstack-vm.sh $@ #./run-create-openstack-vm.sh $@
./run-vm-initial-setup.sh $@ #./run-vm-initial-setup.sh $@
./run-install-osm.sh $@ ./run-install-osm.sh $@
wait wait
./run-osm-vim-k8scluster-add.sh $@ #./run-osm-vim-k8scluster-add.sh $@
echo $0 $@ complete at $(date) echo $0 $@ complete at $(date)
\ No newline at end of file
#!/bin/bash #!/bin/bash
echo $0 started at $(date) echo $0 started at $(date)
. ./common-vars $@ . ./common-vars
. ./main_credentials.rc
for PARTICIPANT in `seq ${START} ${MAX}` ; do for PARTICIPANT in `seq ${START} ${MAX}` ; do
. ./openstack_credentials.rc PARTICIPANT
VM_NAME=`expr charmedosm-${PARTICIPANT}` VM_NAME=`expr charmedosm-${PARTICIPANT}`
IP=`openstack server list --name $VM_NAME --column Networks -f yaml | head -3 | tail -1 | grep -o '[0-9]\+[.][0-9]\+[.][0-9]\+[.][0-9]\+'` IP=`openstack server list --name $VM_NAME --column Networks -f yaml | head -3 | tail -1 | grep -o '[0-9]\+[.][0-9]\+[.][0-9]\+[.][0-9]\+'`
echo $IP echo $IP
......
#!/bin/bash #!/bin/bash
echo $0 started at $(date) echo $0 started at $(date)
. ./common-vars $@ . ./common-vars
. ./main_credentials.rc
for PARTICIPANT in `seq ${START} ${MAX}` ; do for PARTICIPANT in `seq ${START} ${MAX}` ; do
. ./openstack_credentials.rc PARTICIPANT VM_NAME=`expr hackfest-k8scluster` # There is only one VM which is created by Mark in admin project
VM_NAME=`expr charmedosm-${PARTICIPANT}`
IP=`expr openstack server list --name $VM_NAME --column Networks -f yaml | head -3 | tail -1 | grep -o '[0-9]\+[.][0-9]\+[.][0-9]\+[.][0-9]\+'` IP=`expr openstack server list --name $VM_NAME --column Networks -f yaml | head -3 | tail -1 | grep -o '[0-9]\+[.][0-9]\+[.][0-9]\+[.][0-9]\+'`
scp -o StrictHostKeyChecking=no -i hackfest_rsa ./hackfest_rsa ./hackfest_rsa.pub ubuntu@${IP}:.ssh/ & scp -o StrictHostKeyChecking=no -i hackfest_rsa ./hackfest_rsa ./hackfest_rsa.pub ubuntu@${IP}:.ssh/ &
scp -o StrictHostKeyChecking=no -i hackfest_rsa vm-microk8s-setup.sh ubuntu@${IP}: & scp -o StrictHostKeyChecking=no -i hackfest_rsa vm-microk8s-setup.sh ubuntu@${IP}: &
......
#!/bin/bash #!/bin/bash
echo $0 started at $(date) echo $0 started at $(date)
. ./common-vars $@ . ./common-vars
. ./main_credentials.rc
for PARTICIPANT in `seq ${START} ${MAX}` ; do for PARTICIPANT in `seq ${START} ${MAX}` ; do
. ./openstack_credentials.rc PARTICIPANT
VM_NAME=`expr charmedosm-${PARTICIPANT}` VM_NAME=`expr charmedosm-${PARTICIPANT}`
IP=`openstack server list --name $VM_NAME --column Networks -f yaml | head -3 | tail -1 | grep -o '[0-9]\+[.][0-9]\+[.][0-9]\+[.][0-9]\+'` IP=`openstack server list --name $VM_NAME --column Networks -f yaml | head -3 | tail -1 | grep -o '[0-9]\+[.][0-9]\+[.][0-9]\+[.][0-9]\+'`
OS_USERNAME=hackfest15group${PARTICIPANT} OS_USERNAME=hackfest15group${PARTICIPANT}
...@@ -30,7 +30,7 @@ EOF ...@@ -30,7 +30,7 @@ EOF
while [ $? -ne -0 ] ; do while [ $? -ne -0 ] ; do
ssh -o StrictHostKeyChecking=no -i hackfest_rsa ubuntu@${IP} ". .profile;osm version" ssh -o StrictHostKeyChecking=no -i hackfest_rsa ubuntu@${IP} ". .profile;osm version"
done done
scp -o StrictHostKeyChecking=no -i hackfest_rsa ${OS_USERNAME}.rc ubuntu@${IP}: &
ssh -o StrictHostKeyChecking=no -i hackfest_rsa ubuntu@${IP} ". .profile;osm vim-create --name openstack --user ${OS_USERNAME} --password ${OS_PASSWORD} --auth_url ${OS_AUTH_URL} --tenant ${OS_PROJECT_NAME} --account_type openstack --config=\"{ management_network_name: osm-ext, security_groups: default, insecure: true, project_domain_name: ${OS_PROJECT_DOMAIN_NAME}, user_domain_name: ${OS_USER_DOMAIN_NAME} }\"" 2>&1 | tee -a logs/osm-vim-k8scluster-add-${PARTICIPANT}.log ssh -o StrictHostKeyChecking=no -i hackfest_rsa ubuntu@${IP} ". .profile;osm vim-create --name openstack --user ${OS_USERNAME} --password ${OS_PASSWORD} --auth_url ${OS_AUTH_URL} --tenant ${OS_PROJECT_NAME} --account_type openstack --config=\"{ management_network_name: osm-ext, security_groups: default, insecure: true, project_domain_name: ${OS_PROJECT_DOMAIN_NAME}, user_domain_name: ${OS_USER_DOMAIN_NAME} }\"" 2>&1 | tee -a logs/osm-vim-k8scluster-add-${PARTICIPANT}.log
ssh -o StrictHostKeyChecking=no -i hackfest_rsa ubuntu@${IP} '. .profile;osm k8scluster-add --creds hackfest-k8s.yaml --vim openstack --k8s-nets "{"net1": "osm-ext"}" --version 1.26 --namespace hackfest --description "Microk8s cluster" hackfest' 2>&1 | tee -a logs/osm-vim-k8scluster-add-${PARTICIPANT}.log ssh -o StrictHostKeyChecking=no -i hackfest_rsa ubuntu@${IP} '. .profile;osm k8scluster-add --creds hackfest-k8s.yaml --vim openstack --k8s-nets "{"net1": "osm-ext"}" --version 1.26 --namespace hackfest --description "Microk8s cluster" hackfest' 2>&1 | tee -a logs/osm-vim-k8scluster-add-${PARTICIPANT}.log
ssh -o StrictHostKeyChecking=no -i hackfest_rsa ubuntu@${IP} "echo . ~/${OS_USERNAME}.rc >> .bashrc" ssh -o StrictHostKeyChecking=no -i hackfest_rsa ubuntu@${IP} "echo . ~/${OS_USERNAME}.rc >> .bashrc"
......
...@@ -2,17 +2,14 @@ ...@@ -2,17 +2,14 @@
echo $0 started at $(date) echo $0 started at $(date)
. ./common-vars $@ . ./common-vars $@
. ./main_credentials.rc
for PARTICIPANT in `seq ${START} ${MAX}` ; do for PARTICIPANT in `seq ${START} ${MAX}` ; do
. ./openstack_credentials.rc $PARTICIPANT
VM_NAME=`expr charmedosm-${PARTICIPANT}` VM_NAME=`expr charmedosm-${PARTICIPANT}`
IP=`openstack server list --name $VM_NAME --column Networks -f yaml | head -3 | tail -1 | grep -o '[0-9]\+[.][0-9]\+[.][0-9]\+[.][0-9]\+'` IP=`openstack server list --name $VM_NAME --column Networks -f yaml | head -3 | tail -1 | grep -o '[0-9]\+[.][0-9]\+[.][0-9]\+[.][0-9]\+'`
echo $IP echo $IP
scp -o StrictHostKeyChecking=no -i hackfest_rsa vm-initial-setup.sh ubuntu@${IP}: & scp -o StrictHostKeyChecking=no -i hackfest_rsa ./vm-initial-setup.sh ubuntu@${IP}: &
scp -o StrictHostKeyChecking=no -i hackfest_rsa ./hackfest_rsa ubuntu@${IP}:.ssh/id_rsa & ssh -o StrictHostKeyChecking=no -i hackfest_rsa ubuntu@${IP} ./vm-initial-setup.sh 2>&1 | tee -a logs/vm-initial-setup-${PARTICIPANT}.log &
scp -o StrictHostKeyChecking=no -i hackfest_rsa ./hackfest_rsa.pub ubuntu@${IP}:.ssh/id_rsa.pub &
scp -o StrictHostKeyChecking=no -i hackfest_rsa ./hackfest_rsa ./hackfest_rsa.pub ubuntu@${IP}:.ssh/ &
ssh -o StrictHostKeyChecking=no -i hackfest_rsa ubuntu@${IP} "./vm-initial-setup.sh" 2>&1 | tee -a logs/vm-initial-setup-${PARTICIPANT}.log &
done done
wait wait
......
#!/bin/bash
echo $0 started at $(date)
sudo sed -i "s/127.0.0.1 /127.0.0.1 $HOSTNAME /" /etc/hosts
echo 'ubuntu:hackfest'| sudo chpasswd
sudo sed -i "s/^PasswordAuthentication.*/PasswordAuthentication yes/" /etc/ssh/sshd_config
sudo service ssh restart
echo "Acquire::http::Proxy \"http://172.21.1.1:3142\";" | sudo tee /etc/apt/apt.conf.d/proxy.conf
echo "Acquire::https::Proxy \"http://172.21.1.1:3142\";" | sudo tee -a /etc/apt/apt.conf.d/proxy.conf
sudo apt update
sudo apt full-upgrade -y
sudo snap install code --classic
sudo snap install openstackclients yq jq
echo net.ipv4.ip_forward=1 | sudo tee -a /etc/sysctl.conf
sudo sysctl net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
cat << EOF | sudo tee /etc/rc.local
#!/bin/sh -e
echo iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
EOF
sudo chmod +x /etc/rc.local
git clone --recurse-submodules -j8 https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git
# Clone OSM code
mkdir $HOME/OSM/
pushd $HOME/OSM
BRANCH=master
for MDG in common devops IM LCM MON N2VC NBI NG-SA NG-UI osmclient PLA POL RO tests; do
git clone https://osm.etsi.org/gerrit/osm/${MDG}
git -C ${MDG} checkout ${BRANCH}
done
popd
# Export Module paths
cat << 'EOF' > $HOME/osm-vars.sh
export GIT_PATH=$HOME/OSM
export COMMON_LOCAL_PATH="$GIT_PATH/common"
export LCM_LOCAL_PATH="$GIT_PATH/LCM"
export MON_LOCAL_PATH="$GIT_PATH/MON"
export N2VC_LOCAL_PATH="$GIT_PATH/N2VC"
export NBI_LOCAL_PATH="$GIT_PATH/NBI"
export POL_LOCAL_PATH="$GIT_PATH/POL"
export RO_LOCAL_PATH="$GIT_PATH/RO"
EOF
echo ". $HOME/osm-vars.sh" >> $HOME/.bashrc
. $HOME/osm-vars.sh
echo $0 $@ complete at $(date)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment