Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.

Create your own Solenoid LXC tarball

Lisa Roach edited this page Sep 29, 2016 · 6 revisions

Introduction

Creating the Solenoid tarball is based on documentation found in the XR Toolbox Series. If you haven’t checked out the XR toolbox Series, then you can do so here:

XR Toolbox Series

Follow the steps below to create your Solenoid LXC tarball. This would be useful to do if you want to test out the newest code in-between Solenoid official releases.

Clone the git repo

The entire environment can be replicated on any environment running vagrant, provided there is at least 4.5GB of space available. The topology includes on IOS-XRv router (3.5G RAM) and an Ubuntu instance (501MB RAM).

Clone the Solenoid code from here: https://github.com/ios-xr/Solenoid.git

Spin up the Ubuntu devbox:

Move into the vagrant directory and launch only the devbox node:

cd Solenoid/vagrant
vagrant up devbox

Create Solenoid LXC tar ball

Enter the devbox:

vagrant ssh devbox

Install LXC:

sudo apt-get update
sudo apt -y install lxc

Create the Solenoid LXC template:

sudo lxc-create -t ubuntu --name solenoid

Start the container. You will be dropped into the console once boot is complete.

sudo lxc-start --name solenoid

Username: ubuntu

Password: ubuntu

Install Application dependencies inside LXC

Install Solenoid, exaBGP and all of their dependencies inside the container. We’ll also install git, screen, curl, and pip to fetch the repositories and install the requirements. Initiate the following commands:

sudo apt-get -y install git curl screen python-dev python-setuptools
sudo easy_install pip
sudo pip install virtualenv exabgp

Fetch the Application code from github

Now, download Solenoid from github. Using the Solenoid directory, we can install the remaining dependencies with the setup.py installation script.

git clone https://github.com/ios-xr/Solenoid.git
cd Solenoid
virtualenv venv
source venv/bin/activate
pip install grpcio
python setup.py install 

Perfect! Now all of our dependencies have been installed.

Configure Solenoid and exaBGP

Create a solenoid.config file with the following data (in the Solenoid/ top-level directory):

[default]
transport: gRPC
ip: 11.1.1.10
port: 57777
username: vagrant
password: vagrant

That is all we need to configure Solenoid to work for your system. Now we need to add a configuration file for exaBGP. Navigate to your home directory, and add a file named router.ini:

group demo {
        router-id 11.1.1.10;

        process monitor-neighbors {
            encoder json;
            receive {
                parsed;
                updates;
                neighbor-changes;
            }
            run /usr/bin/env python /home/ubuntu/Solenoid/solenoid/edit_rib.py -f '/home/ubuntu/Solenoid/filter.txt';
        }

        neighbor 11.1.1.20 {
                local-address 11.1.1.10;
                local-as 65000;
                peer-as 65000;
        }
}

Change the SSH port inside the container

When we deploy the container to IOS-XR, we will share XR’s network namespace. Since IOS-XR already uses up port 22 and port 57722 for its own purposes, we need to pick some other port for our container.

P.S. If you check the Vagrantfile, we intend to expose port 58822 to the user’s laptop directly, on xrv.

Let’s change the SSH port to 58822:

sudo sed -i s/Port\ 22/Port\ 58822/ /etc/ssh/sshd_config

Check that your port was updated successfully:

~$ cat /etc/ssh/sshd_config | grep Port
Port 58822

We’re good!

Package up the LXC

Shutdown the container: sudo shutdown -h now

You’re back on the devbox.

Become root and package up your tar ball:

sudo -s

cd /var/lib/lxc/solenoid/rootfs/

tar -czvf /vagrant/solenoid.tgz *

See what we did there? We packaged up the container tar ball as pathchecker_rootfs.tar.gz under /vagrant directory. Why is this important?

Well, Vagrant also automatically shares a certain directory with your laptop (for most types of guest operating systems). So the /vagrant is automatically mapped to the directory in which you launched your vagrant instance. To check this, let’s get out of our vagrant instance and issue an ls in your launch directory:

~$ exit
~$ exit
> pwd
~/Workspace/Solenoid/vagrant
>ls -la solenoid.tgz
-rw-r--r--  1 lisroach  staff  252417007 Aug 2 11:27 solenoid.tgz
>

Now you have your solenoid tar ball!

For information about launching and using your LXC, please refer to IOS-XR toolbox.

Once it is up and running on the IOS-XR, you can access your container with:

ssh -p 58822 ubuntu@localhost

Password: ubuntu