• Alexander

Cisco Modeling Lab 2 - breakout UI

I have been waiting for CML 2 to be released and the team has done a great job to simplify the UI and how we can build labs quite easily. If you ever worked with VIRL and VMMaestro you know what I am talking about.




The HTML 5 UI provides a way to connect to the console of the devices that are part of your lab but if you are like me it is nice to use your preferred terminal emulator to connect to these devices.


My preferred terminal emulator is iTerm2 (as I am using macOS), I like the different configuration options, profiles, window layouts and much more. (download it at https://iterm2.com)



The team responsible for creating CML 2 made sure that you can still use your favourite emulator to connect to your lab devices. The tool they provided us to achieve this is called Breakout Tool.


The tool can be downloaded from the Lab Manager landing page > Tools > Breakout Tool.

This will open up a new page with the documentation about the tool such as configuration files, executable options and the link to download the executable for your favourite OS (i.e Linux, macOS and Windows).


Now it isn't my goal to explain how to install this tool and the initial configuration, the Cisco team did a great job just that on the documentation link, however here is my config.yaml file.



If you are a bit like me and do not want to manually start the breakout tool every time you log out, reboot etc., if you are using a Mac, you can use the Automator app to create a bash script which you can add to your login items every time you logon.


Open the Automater app and choose New Document and as type create an Application.

Once that is select Run Shell Script and drag it to the right canvas which will look like the following screenshot :


You can choose your preferred scripting language such as Bash, Perl, Python etc... Although I like python a lot, I used bash to accomplish this task. (if I have more free time I will add the python version).


The bash script is pretty straightforward it will check if the breakout tool is running if it is running it will log the message "CML Breakout UI Already Running" to a file I have created under /var/log/breakout else the script will launch the breakout UI.


#Start Breakout UI Server only if it is not running


if["$(ps -ef | grep -v grep | grep "breakout -noverify ui" | wc -l)" -le 0 ]

then

# Note starting breakout ui not as a sudoer

/Users/adeca/breakout -noverify init >> /var/log/breakout/cml.log 2>&1 &

/Users/adeca/breakout -noverify ui >> /var/log/breakout/cml.log 2>&1 &

echo"CML Breakout UI Server Started" >> /var/log/breakout/cml.log 2>&1 &

else

echo"CML Breakout UI Already Running" >> /var/log/breakout/cml.log 2>&1 &

fi

Note: if you are not familiar with Linux I just want to highlight that we are redirecting output, called STDOUT (identified with >>) to the log file cml.log and we are redirecting STDERR (identified with 2>&1) to STDOUT.

Save the file ex. cml_breakout.app and add this app to your login items under System Preferences > Users & Groups and you are done, the breakout UI will be launched automatically when you log in.






90 views

© 2018 by Deca Consulting.