Access to the SAVI using CLI


October 10, 2021

We assume that you already have credentials to get access to use SAVI testbed and the focus of this tutorial is to show how to create a virtual machine using the command-line interface (CLI). Previously, we talked about how to access the testbed using the Web Portal here.

Getting Started


Log in

Log in to the client1 machine using your credentials.

ssh <username>@client1.savitestbed.ca

Once you logged in you can change your password by using:

savi-change-pass

Selecting Region and Project

The first step to use the testbed is selecting a region and a project you have access to. Currently, the best region to use is CORE and CORE-2. Some regions may not be available temporarily. You are required to use the project name that you have access to. Try running the command below and provide your password when it is asked:

source savi <username> <project> <region>

Upon successful login, you will see a message showing the project and region are ready to be used.


Create a New Instance (VM)

Now that you have logged in, you are ready to create your first VM. Try running:

savi-run-server <flavor> <image> <key> <security group> <vm name>

In order to boot up a VM, you need to specify 5 parameters: <flavor>, <image>, <key>, <security group> and <vm name>. Below we will specify what these parameters are and how you can use them.


1. Flavor

Flavor defines the compute, memory, and storage capacity. To see the list of available flavors try running:

openstack flavor list
2. Image

Image is a single file that is used as the operating system for your VM. To see the list of available images try running:

openstack image list
3. Key

Key or Keypair is the public key of an OpenSSH key pair used to access the VM. You need to create your Keypair by providing your public key. You can upload either your existing key or create a new one. Below we are going to create a new private and public key and use it as the Keypair for testbed:

# Create a public and private key, press enter when you are prompted to all questions:
ssh-keygen 

You will find your private and public key in ~/.ssh/ folder. Now let’s use the public key and upload it to the openstack system:

openstack keypair create --public-key ~/.ssh/id_rsa.pub my-key

That’s it!

4. Security Group

Security groups are sets of IP filter rules that define networking access to the VM. There is a default security group you can use. To list of all available security group try:

openstack security group list

In case you need to open a port/protocol for your environment you can easily do that using:

openstack security group rule create \
  --remote-ip 0.0.0.0/0 --protocol tcp --dst-port 22 default

# You can also open a range of ports using similar command:
openstack security group rule create \
  --remote-ip 0.0.0.0/0 --protocol tcp --dst-port 8080:8090 default

To view your security group rules:

openstack security group rule list
5. VM Name

This is just an arbitrary name for your VM.


Now you should be able to create a VM by providing all five parameters. Let’s try:

savi-run-server m1.small Ubuntu-18-04.4 my-key default test-vm1

You can get the list of all existing VMs using:

openstack server list

Once your VM is booted, you can just log in to the VM using ssh:

ssh ubuntu@<ip-address>

Once your job is done and you are ready to delete a VM, try running:

openstack server delete <vm-name>

SAVI Linux OpenStack