Lab-24:Lab infrastructure automation using CloudShell

I recently worked in a lab infrastructure automation project. Goal was to automate fiber connections between network elements (NE) and traffic generators, so to quickly spinoff different customer topology.

These are some of the issues we try to resolve using lab infrastructure automation:

  1. Reduce network re-configuration time. Too much time spend on re-configuring network, fibering, de-fibering , debugging wrong connections etc.
  2. Maximizing HW utilization. Groups hoarding the HW, not sharing HW fearing they will never get it back or they need to tear down and start from scratch
  3. Equipment sharing. Not knowing whether HW is activity used or not, difficult to share
  4. Remote development and testing support.

Walk around the lab and you will find these notes to shoo away engineers. Sometimes these notes remain hanging on the equipment  well after project is over, no one knows whether equipment is being actively used or sitting ideal.

cloudshell-1cloudshell-2

Let’s see what is needed to automate lab infrastructure.

Optical switch

The purpose of optical switch is to provide L1 connectivity between network elements and traffic generators. In our case it’s  an all optical switch (not electrical-optical-electrical) which using mirrors  directs light from one port to another port based on topology configuration. Optical switch avoids static fiber connections between NE and traffic generators and gives flexibility to change connections on demand without touching fibers, this is really beneficial  feature for remote teams they no longer depends on onsite team for lab support

We connected network elements and traffic generators to optical switch. Not all ports from network elements needs to be connected to optical switch. You need to decide which ports participate in network re-configuration only those needs to be connected to optical switch. Remaining connections can be static / hard wired.

Our optical switch is a passive switch it can take any signal rate with minimum power loss. In our case signals ranges from 1 Gig ,10Gig, 100 Gig (DWDM)

We used Calient S-series all optical switch, check this link to learn more about the switch

CloudShell

CloudShell  provides by Qualisystems is a lab infrastructure automation platform. It manages optical switch for you, keeps track of your resources (NEs) and give a gui based tool to create network topology. Check out more on CloudShell here

We used CloudShell resource management and lab management functions. It has built-in drivers to manage different vendors optical switches, in our case Calient switch. Resource management provides database for managed resources. Lab management provides GUI tool to build network topology . CloudShell comes with Python based API. Using API you can automate to create topology, create/release reservation and push topology to optical switch on demand.

CloudShell is optional but in that case you need build your own infrastructure to program optical switch, manage resources etc.

Here are the steps to create CloudShell based automation. I won’t go into detail how resources are managed.

Step-1:

Add all your HW resources into CloudShell RM (Resource Management). If you have existing database ClouldShell can integrate it or you can use ClouldShell RM. . You need to provide physical characteristics of your HW resources, like number of ports, unique identifier etc, this info is needed when you create topology

Step-2:

Connect  network elements and traffic generators ports  to optical switch and create a mapping table in CloudShell RM between network element and optical switch. Basically telling CloudShell which network element port connected to which optical switch port. This info is needed to build topology

Step-3

In the CloudShell lab management build your topology. This is a drag and drop GUI based tool. You drag your network elements & traffic generators  from CloudShell RM to a blank canvas and create links between ports. After you are done save the topology. At this point you can either reserve and activate topology manually or use automation. CloudShell comes with Python API to assist in topology reservation & activation. During reservation you specify how long the topology needs to be active. When activated CloudShell push topology connections details into optical switch which in turns creates internal cross connection between ports. At the expiry of timer topology is released and all cross connections on optical switch are cleared.

.

cloudshell

This is the logical diagram of our setup.Here we are creating a linear topology of 4 network elements  with traffic generators connected to two NEs. If required we can free up two NEs without any fiber re-configuration.

We have created two routines using CloudShell Python API 1)reserve & activate the topology  2)release the topology. These routines are part of our setup & teardown function.

Below is a sample Python code showing how to reserve  topology, activate topology and release topology

import getopt
import sys
from qualipy.api.cloudshell_api import CloudShellAPISession
def usage():
        print "Usage:"
        print "-d: [domain]                                     Domain name"
        print "-h:                                              help"
        print "-t: <topology>                                   Reserve"
        print "-r: <topology>                                   Release"
        print "lbaas -t <topology> -d global To reserve topology"
        print "lbaas -r <topology> -d global To release topology"


def get_reservationId(responseObject,topology):

        for attr, value in responseObject.__dict__.iteritems():
                for val in value:
                        topo1 = val.Topologies[0]
                        topo2 = topo1.split("/",2)
                        topo = topo2[2]
                        if topo == topology:
                                return val.Id

def release_topo(myTS,topology,username):

        responseInfo=myTS.GetCurrentReservations(reservationOwner=username)
        reservation_id = get_reservationId(responseInfo,topology)
        #print reservation_id
        myTS.EndReservation(reservation_id , unmap=0 )

def main(argv):
        cs_server='xxx.yyy.132.78'
        username='admin'
        password='admin'
        domain='Global'
        topologyFullPath='Topologies/'
        try:
                opts,args = getopt.getopt(argv,"d:ht:r:",["help","domain=","topology=","release="])

        except getopt.GetoptError:
                usage()
                sys.exit(2)

        if not opts:
                usage()
                sys.exit()

        for opt, arg in opts:
                if opt in ("-h","--help"):
                        usage()
                        sys.exit()
                elif opt in ("-d","--domain"):
                        domain= arg
                elif opt in ("-t","--topology"):
                        topology= arg
                elif opt in ("-r","--release"):
                        topology= arg
                        myTS=CloudShellAPISession(cs_server,username,password,domain)
                        release_topo(myTS,arg,username)
                        sys.exit()

        topologyWithPath= topologyFullPath + topology
        print "Topology=%s" % topology
        myTS=CloudShellAPISession(cs_server,username,password,domain)

        responseInfo=myTS.CreateImmediateReservation(reservationName=topology , owner=username , durationInMinutes=60 , notifyOnStart = False, notifyOnEnd = False, notificationMinutesBeforeEnd = 0)
        reservationId=responseInfo.Reservation.Id

        myTS.AddTopologyToReservation(reservationId , topologyWithPath , globalInputs = [], requirementsInputs = [], additionalInfoInputs = [])
        myTS.ActivateTopology(reservationId , topologyWithPath )

if __name__=="__main__":
    main(sys.argv[1:])

sjakhwal@rtxl3rld05:~/cloudshell$
sjakhwal@rtxl3rld05:~/cloudshell$ ./lbaas.py
Usage:
-d: [domain]                                    Domain name
-h:                                             help
-t: <topology>                                  Reserve
-r: <topology>                                  Release
lbaas -t <topology> -d global        To reserve topology
lbaas -r <topology> -d global        To release topology
sjakhwal@rtxl3rld05:~/cloudshell$