Adding Spirent Virtual Test Center traffic generator to Unetlab

featured

Having a traffic generator in a lab is a huge advantage, hands down. As to this moment Unified Networking Lab supports software-based traffic generator called Ostinato. But I had an opportunity to use another traffic generator – Spirent Test Center, virtual edition.

Spirent’s images are not officially integrated/supported by UNL, so you will see how to add something that is not supported yet by Unetlab.

Spirent (virtual Test Center) vTC can be installed under ESXi, on a bare metal server or added as a virtal appliance running under qemu hypervisor. In my case I needed to add Spirent vTC to the Unetlab, so I sticked to the *.qcow2 image of the virtul Test Center.

Since Unetlab lacked support of Spirent products I had to manually configure Unetlab to be able to run it.

Adding custom templates to Unetlab

In order to add some unsupported image I had to get my hands dirty with Unetlab file structure. Let me save you some time and break the process of adding new software by steps:

1. Creating a new template

Go to  /opt/unetlab/html/templates/ and see the contents. Yep, these are the templates Unetlab uses to get a knowledge about

  • how to start an image?
  • what are default hardware options should be set?
  • how to connect to a running image?
  • what hypervisor options to use?
  • what icon should this instance use?
  • and so on

See the contents of a timos.php  which is used for Alcatel-Lucent 7750 SR virtual routers:

Though a router is not close to the type of the Spirent’s Test Center. I knew that Spirent vTC is a linux machine, so it would be wiser to took into linux.php :

Okay, I modified it a bit and created a file called svtc.php (Spirent Virtual Test Center == svtc):

2. Adding newly created template to a global list of equipment

Next step is to force Unetlab to actually “see” your custom template. To do so follow this steps:

  • go to  /opt/unetlab/html/includes/ and create a file  config.php
  • add this code to its contents:
    Add array values for your customized template (see string  'svtc' => 'Spirent Test Center', that I have added). Key value must have the same name, as previously created template (svtc.php)
  • original contents of this array can be found at  init.php file from the same directory.

3. Placing an image to the right place

Closing step is an image deployment. Qemu images should be stored in the  /opt/unetlab/addons/qemu/ in a subdirectory. It is mandatory to properly name this subdirectory – name it according to this template

And a name of your image must be  hda.qcow2.

Now you can reload web page with UNL, navigate to “Add new node” menu as you would normally and see your customized entry:

At this point you can use your custom software by poiting your vnc to the nodes address.

Polish your new node link naming

Take a look at my Spirent vTC the moment after I added it:

Look at  this beautiful interface labels for ALU router, somehow unetlab knows how to properly label ALU interfaces – 1/1/2 . With Spirent vTC it uses just defult naming e0, e1 . But Spirent has its own labeling system: management port should be admin0  and data ports shoud be port 1/x . Can we fix this? Surely.

  1. Open file  /opt/unetlab/html/includes/__node.php
  2. Find a piece of code responsible for interface labels generation (in this example I use timos code block):
  3. Copy this block with a case selector equal to you created template and fix interface naming:
    Save the changes and behold the difference:

    And this is pretty much all you need to get a pice of virtual appliance of your choice to Unetlab. Happy labbing!

BEWARE

Save all of your templates and changes to   /opt/unetlab/html/includes/__node.php because they could not survive unetlab update. Config.php  file should survive update, but after update copy the array from new init.php to config.php, since new nodes could be added to it.

Roman Dodin

Network engineer at Nokia
Eagerness to learn multiplied by passion to share.
You can reach me at LinkedIn

You Might Also Like

  • Archx 91

    What an amazing article dude!

    Thank you for this piece of information.