This document is a tutorial for using VM Build Container (VMBC) to build virtual machine (VM) images for Rhino applications. In addition to the VM creation steps, this document covers the steps of deploying the VM images with the Rhino VM automation solution. It intends to help you learn to use VMBC and get familiar with the VM automation solution.

This document assumes that you have basic knowledge about the following products:

  • Rhino Telecom Application Server

  • ServiceIQ Management Platform (SIMPL)

  • Apache Cassandra

Based on your needs, you also need to be familiar with a VM hosting platform, such as OpenStack or VMware vSphere.

Getting started

Before starting the tutorial steps, read through the Introduction section to learn about VMBC and the tutorial, and then set up your development environment as per the Prerequisites and preparation section.

Once you are ready, start the tutorial with the Building the VM step.

Notices

Copyright © 2022 Microsoft. All rights reserved

This manual is issued on a controlled basis to a specific person on the understanding that no part of the Metaswitch Networks product code or documentation (including this manual) will be copied or distributed without prior agreement in writing from Metaswitch Networks.

Metaswitch Networks reserves the right to, without notice, modify or revise all or part of this document and/or change product features or specifications and shall not be responsible for any loss, cost, or damage, including consequential damage, caused by reliance on these materials.

Metaswitch and the Metaswitch logo are trademarks of Metaswitch Networks. Other brands and products referenced herein are the trademarks or registered trademarks of their respective holders.

Introduction

This tutorial will walk you through using VMBC and the Metaswitch Rhino VM automation solution to create, deploy, and test a simple VM.

It uses an example to guide you through developing your own VMs with Rhino TAS and VMBC and deploying/managing the VMs in a production environment with automation tools.

Overview of the tutorial

VMBC is a tool in the Rhino VM automation solution for producing automated VMs that run your Rhino application.

Before starting to use the tool, learn about how the solution works at a high level by reading through the Rhino VM Automation solution documentation.

What is covered

This tutorial takes you through:

  • Compiling a very simple Rhino service.

  • Using VMBC to build a virtual appliance image that contains a Rhino application based on this service.

  • Deploying a SIMPL VM.

  • Using the SIMPL VM to deploy three VMs from the image.

  • Configuring and testing the VMs.

What is not covered

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::introduction-includes.adoc[tags="title-not-included-simpl"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::introduction-includes.adoc[tags="content-not-included-simpl"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::introduction-includes.adoc[tags="title-not-included-mdm"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::introduction-includes.adoc[tags="content-not-included-mdm"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::introduction-includes.adoc[tags="title-not-included-clustered"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::introduction-includes.adoc[tags="content-not-included-clustered"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::introduction-includes.adoc[tags="title-not-included-packaging"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::introduction-includes.adoc[tags="content-not-included-packaging"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::introduction-includes.adoc[tags="title-not-included-monitoring"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::introduction-includes.adoc[tags="content-not-included-monitoring"]

Next steps

To begin the tutorial, ensure you have your development environment set up and all required files downloaded, as per the Prerequisites and preparation page. Then proceed to Building the VM.

Prerequisites and preparation

Creating virtual appliances with VMBC requires certain tools and files. In addition, compiling the HTTP example service used in this tutorial requires the Rhino SDK and Apache Ant to be installed.

Prerequisites

You will need a VM host (referred to as the VNFI) to host the VMs created in this tutorial. Supported VM host platforms are VMware vSphere version 6.5 or later, or OpenStack release Newton or later.

You will also need:

  • A UNIX development environment. We recommend a Ubuntu 20.04 installation.

    Note Native, virtual, and WSL2 environments are all supported.
  • At least 20GB of free disk space in the development environment.

  • At least version 20 of Docker installed and available in the PATH.

  • A Java Development Kit (JDK) of at least Java version 11. We recommend the Microsoft JDK.

    Note This JDK must be installed in the development environment and available in the PATH.
  • Apache Ant version 1.10.7 or later installed and available in the PATH.

  • Access to the Metaswitch Manuals site. Contact your Metaswitch Customer Care representative if you need access.

You will need the following, which can be obtained from your Metaswitch Customer Care representative:

  • The VMBC software package

  • A (development) Rhino license

  • A SIMPL VM image appropriate for your VNFI

Create a directory called resources to store these files.

Preparation

Set up the VNFI

Ensure you have an operational VNFI and networking set up as detailed above.

Configure a new or existing user on your VNFI to have sufficient permissions for SIMPL VM to create VMs. Refer to the SIMPL VM manual for more information:

Ensure there are two non-overlapping IPv4 subnets configured on your VNFI, one for management and one for signaling. Reserve an IPv4 address on the management subnet for the SIMPL VM, and three IPv4 addresses on both the management and signaling subnets for the VMs. These addresses must not already be in use.

Upload the SIMPL VM image to the VNFI.

Set up the development environment

Download and install Docker, the JDK, and Apache Ant as detailed above and ensure their executables (docker, java, javac and ant) are available in the PATH.

Create an empty directory named resources somewhere in your development environment. This will be your base directory for all tutorial files, and is referred to hereafter as the resources directory.

Download source files for the virtual appliance

Download the following and save them to the resources directory:

  • The Rhino SDK, version 3.2, from here.

    Caution Ensure you download the SDK, not a production Rhino package.
  • The HTTP RA version 3.0.0.3 and the example service files, which are all contained in a .zip file available here.

  • The example hook scripts and node-parameters.yaml, which are all contained in the vm-build-container-tutorial.zip file available here.

Building the VM

In this part of the tutorial, you will:

  • Create an input directory for VMBC.

  • Prepare the required input files.

  • Compile the HTTP example Rhino application.

  • Assemble a directory of Deployable Units (DUs).

  • Run VMBC to produce a VM CSAR.

Steps

Expand each section below to view the detailed steps.

Note Unless specified otherwise, run all commands from the resources directory.

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="title-build-step1"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="content-build-step1"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="title-build-step2"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="content-build-step2"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="title-build-step3"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="content-build-step3"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="title-build-step4"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="content-build-step4"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="title-build-step5"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="content-build-step5"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="title-build-step6"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="content-build-step6"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="title-build-step7"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="content-build-step7"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="title-build-step8"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="content-build-step8"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="title-build-step9"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::building-the-vm-steps.adoc[tags="content-build-step9"]

Result

You created a CSAR containing your VM image. It will be in the target/images directory:

ls target/images
http-example-0.1.0-vsphere-csar.zip

If you are using OpenStack, it will be named -openstack-csar.zip instead of -vsphere-csar.zip.

Next step

In the next step Setting up SIMPL VM and CDS, you will deploy the SIMPL VM and prepare for the deployment of the example VMs from the CSAR you created. Click here to progress to the next step.

Setting up SIMPL VM and CDS

In this part of the tutorial, you will:

  • Deploy the SIMPL VM.

  • Upload the CSAR to SIMPL VM and unpack it.

  • Create a Cassandra node to act as a Configuration Data Store (CDS).

Steps

Expand each section below to view the detailed steps.

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::set-up-cds-and-simpl-steps.adoc[tags="title-setup-step1"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::set-up-cds-and-simpl-steps.adoc[tags="content-setup-step1"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::set-up-cds-and-simpl-steps.adoc[tags="title-setup-step2"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::set-up-cds-and-simpl-steps.adoc[tags="content-setup-step2"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::set-up-cds-and-simpl-steps.adoc[tags="title-setup-step3"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::set-up-cds-and-simpl-steps.adoc[tags="content-setup-step3"]

Result

You created a CDS node and a SIMPL VM, and unpacked your CSAR on the SIMPL VM.

Next step

In the next step, you will prepare configuration files and upload them to the SIMPL VM and to the CDS. Click here to progress to the next step.

Deploying and testing the VM

In this part of the tutorial, you will:

  • Create the solution definition file (SDF), secrets file, and configuration files.

  • Upload the configuration files to CDS.

  • Use SIMPL VM to create your VMs.

  • Verify the created VMs are functional.

Steps

Before starting, open a separate terminal, and in that terminal start an SSH session to the SIMPL VM with the command ssh -o ServerAliveInterval=30 admin@<SIMPL VM IP address>. The ServerAliveInterval option keeps the connection alive; by default the SIMPL VM terminates idle connections after a few minutes.

Expand each section below to view the detailed steps.

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="title-deploy-step1"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="content-deploy-step1"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="title-deploy-step2"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="content-deploy-step2"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="title-deploy-step3"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="content-deploy-step3"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="title-deploy-step4"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="content-deploy-step4"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="title-deploy-step5"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="content-deploy-step5"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="title-deploy-step6"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="content-deploy-step6"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="title-deploy-step7"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="content-deploy-step7"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="title-deploy-step8"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="content-deploy-step8"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="title-deploy-step9"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="content-deploy-step9"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="title-deploy-step10"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="content-deploy-step10"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="title-deploy-step11"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::deploy-and-test-vm-steps.adoc[tags="content-deploy-step11"]

Result

You created and configured three VMs, and verified that they work correctly.

This concludes the tutorial.

Next step

As optional extra steps, you can learn about:

If you want to redeploy your VMs

If you want to try the tutorial again, for example with changes to the example application or configuration, be sure to first clean up the old VMs and CDS data by running the following commands:

  • Destroy the VMs with cd ~/yamls; csar delete --sdf sdf-rvt.yaml

  • Delete state from CDS with cdcsars; http-example/0.1.0/resources/rvtconfig delete-deployment -c <CDS address> -d <deployment ID>

  • Delete the CSAR with csar remove http-example/0.1.0 and rm /home/admin/<csar>.zip

Using Rhino declarative configuration to configure your application

Previously, you configured your VM through a combination of the custom-config-data.yaml file and a configuration hook that applied the configuration contained in this YAML file to Rhino. While this approach was user-friendly for the operator deploying the VM, it required development effort to design the configuration in the YAML file and implement the configuration hook for every configuration field. This section describes an alternative approach for configuring your VM using Rhino declarative configuration.

Prerequisites

This section assumes you are familiar with the basic concepts described in the Rhino documentation around Rhino declarative configuration. If you aren’t familiar with the concepts, read that documentation first.

Steps

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::rhino-declarative-config-steps.adoc[tags="title-declarative-step1"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::rhino-declarative-config-steps.adoc[tags="content-declarative-step1"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::rhino-declarative-config-steps.adoc[tags="title-declarative-step2"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::rhino-declarative-config-steps.adoc[tags="content-declarative-step2"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::rhino-declarative-config-steps.adoc[tags="title-declarative-step3"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::rhino-declarative-config-steps.adoc[tags="content-declarative-step3"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::rhino-declarative-config-steps.adoc[tags="title-declarative-step4"]

Unresolved directive in vm-build-container-tutorial/foldable-content-template.adoc - include::rhino-declarative-config-steps.adoc[tags="content-declarative-step4"]

Result

You updated your application to support compression using declarative configuration and verified that this worked correctly.

Upgrades and MDM

In this tutorial, you used the Metaswitch Rhino VM automation solution to create, deploy, and test a simple VM. As described in the Introduction section, upgrades and MDM are out of scope of this tutorial. This page only gives a high-level overview of how you deploy MDM, how you connect the VMs to MDM, and how you perform rolling upgrades.

Deploying and connecting to MDM

While VMs can optionally be deployed in a lab environment without the use of MDM, Metaswitch mandates the use of MDM in production environments. MDM is an essential component of the lifecycle management in the Metaswitch Rhino VM automation solution. VMs cannot be upgraded without MDM. For more details, see the Rhino VM Automation Overview.

Important

Once a VM is deployed, its MDM connection cannot be reconfigured. Therefore, it is essential that you deploy MDM prior to deploying your application into your production environment.

We recommend that you first familiarize yourself with the steps required to deploy MDM and configure your VMs to connect to MDM in your lab environment. Follow the instructions in the Install MDM section of the Custom VM Install Guide to install MDM and instructions in the MDM service group section of the guide to configure your VMs to connect to MDM.

Upgrading VMs

The Metaswitch Rhino VM automation solution supports upgrading VMs using rolling replacement. That is, one by one, a downlevel (that is to say old version VM) gets shut down, followed by an uplevel (that is to say new version VM) being deployed. The architecture is described in the VM life cycle management section of the Rhino VM Automation Overview document, while the process to do the upgrades is documented in the Custom VM Install Guide (Rolling upgrade of custom nodes).

If your application is stateful, this could cause in-progress calls or sessions to fail, as the node that was handling it could have been deleted. To minimise this risk, enable replication in the node-parameters.yaml file.

Note

If your VMs are clustered, during the upgrade, the downlevel and uplevel Rhino nodes will be split into separate clusters. This means that if your application architecture depends on all VMs being in a single Rhino cluster, upgrades will not be hitless.

Quiesce hooks

Before a downlevel VM is deleted, it goes through a quiesce process, which cleans up any state relating to a VM that would otherwise persist outside of said VM. For example, for a clustered VM, the quiesce process removes the VM from the Rhino cluster.

If your initconf hooks created any side effects that need to be cleaned up when said VM is deleted, outside of the VM it ran on, you must use Quiesce hooks to achieve this.

As an example, you could add an initconf hook that registers the VM with an external load balancer. That would need an accompanying quiesce hook that unregisters the VM from the load balancer.

Glossary

Term Definition

DU

Deployable Unit. A .jar file containing a Rhino component or some supporting code for another component.

JRE

Java Runtime Environment. The binaries required to run Java applications.

JDK

Java Development Kit. A development kit that contains the JRE, a Java compiler, and other tooling required to build Java applications.

MDM

Metaswitch Deployment Manager. A VM that provides support for upgrading other VMs.

QSG

Quicksilver Secrets Gateway. A component of SIMPL VM that securely stores secrets.

RA

Resource Adaptor. See About Resource Adaptor Entities in the Rhino documentation.

SDF

Solution Definition File. A file used by SIMPL VM. It describes the VMs to be deployed and their properties.

SIMPL VM

Service IQ Management Platform. A VM that manages the lifecycle of other VMs.

Virtual Appliance

A VM image, or set of images, and associated tooling, which together allow you to deploy a set of VMs that perform a particular function.

VMBC

VM Build Container.

VNFI

Virtual Network Function Infrastructure. The host platform that runs virtual machines.

VM

Virtual Machine.

WSL2

Windows Subsystem for Linux, version 2. A feature in Windows 10 and later that allows you to run a Linux operating system within Windows.