Libraries for Managing Embedded devices

Hello,
Any pointers towards the libraries which can manage and configure the embedded devices like routers and network equipment’s using CLI , SNMP and Netconf?

Hii Sibi,

As for SNMP and Netconf, I have not seen anything but if there are python libraries you could create your own keyword libraries for those actions.

As for CLI, I would suggest you look into the TelnetLibrary and the sshLibrary

Dave.

Hello Dave,
Thanks for your suggestion!!!

We already use nccleint for our netconf automation. I find a robot library for it robotframework-ncclient · PyPI
Also I see SNMP Library robotframework-snmplibrary · PyPI
But I am yet to figure out if these can be used or build on top of it for our automation migration .

Hii Sibi,

Great you found those libraries!

What are you looking to achieve with your automation migration? If I know what you are trying to achieve I might be able to make some suggestions.

Dave.

Hello Dave,

We already have automated tests with scripts and libraries written in TCL/Expect. We plan to migrate this. I am looking for an approach where we can use these already written TCL Scripts/libraries with out completely re writing to Rboto/Python.
May be a middle ground where we benefit from the features of the robot framework and still utilise our TCL libraries for our already written automated cases.

Regards,
Sibi Alex Jacob.

Hi Sibi,

I obviously don’t know what exactly you are using your expect scripts for, so let me give a generic example where you could potentially reuse your expect scripts and get some good value from RF.

For my example we have an imaginary router, currently it’s configuration is via a serial cable and your company has made an updated firmware for this router that now has a web page frontend for configuring the router (I know this imaginary use case is probably 10-15 years old)

Your existing test scripts uses expect to log in to the router using minicom or screen and then perform a variety of configuration tasks and view the config screens to validate those configuration tasks.

we’ll start with a simple expect script that test adding and removing static routes

your test script for this imaginary router does the following:

  • connect to the router via serial port /dev/tty.usbserial0
  • expect login prompt
  • send user name
  • expect password prompt
  • send password
  • expect console prompt
  • execute command to add static route
  • execute command to display static routes
  • expect route added to be in list
  • execute command to remove static route
  • execute command to display static routes
  • expect route added to not be in list
  • disconnect from router

So lets break this up into keywords:
keyword: Connect To Router
takes arguments of serial port, username, password and executes:

  • connect to the router via serial port /dev/tty.usbserial0
  • expect login prompt
  • send user name
  • expect password prompt
  • send password
  • expect console prompt

keyword: Add Route
takes argument of route data and executes:

  • execute command to add static route

keyword: Add Route
takes argument of route data and executes:

  • execute command to remove static route

keyword: Display Routes
executes and returns route list:

  • execute command to display static routes

keyword: Disconnect router
executes:

  • disconnect from router

These steps can easily be replaced with builtin RF keywords of should contain and should not contain:

  • expect route added to be in list
  • expect route added to not be in list

So I did a little research and there doesn’t appear to be any support for interactive shells in RF except for telnet or ssh, so for these expect scripts, we would need to break the original script into small scripts that do these simple steps and then call them using Run Process from the processlibrary

But longer term you would probably want to convert these keywords to python keywords using the pyserial or pexpect-serial python modules for better reliability and cross platform support.

So this might seem like a lot of work just for a nicer report, but here’s where it becomes really useful, using seleniumlibrary we create a series of keywords to login to the web ui, navigate to the static routes page, check for a route, add a route, and remove a route.

Now with our collection of seleniumlibrary keywords we can create test cases that log in via the web ui, and create a route, then login to the serial console and verify the route, then we can also do the reverse, and create a route on the serial console and verify it in the web ui.

Sorry if this was a bit long winded but hopefully it’ll give you some ideas.

Dave.