Using python script with opentap plugin

I created a opentap plugin for sending a command and reading the expected value . Iam trying to connect to my virtual machine (which is running on ubuntu) using ssh and then send command to the machine. so I am able to send some commands like “ifconfig” , “cat log.txt”, “touch log.txt” and getting the expected result .
But I am not able to change directory to where my python scripts are. so cd /…/./…/ is not working. It will send the command but not change the directory.
Is there any way to run python scripts as is in opentap code? why my command to change directory is not working, any idea Anyone??

1 Like


If I understand your correctly, you are sending the cd command using SSH?
If that is the case, your working directory is only changed in that single SSH call, and it will be reset in the next call. You would need to do something like ssh user@server "bash -c 'cd /…/./…/ ; python ./'" to set the working directory for that SSH call.

I wouldn’t really recommend using SSH if you just need to communicate with your ubuntu VM. It would probably be easier to just run the test plan on your VM instead.

If you want to integrate your plugin with Python, I suggest taking a look at the Python plugin:

Here is the source code: OpenTAP / Plugins / python · GitLab
And here is the documentation: OpenTAP Python Integration

It supports writing test steps and many other OpenTAP abstractions directly in Python

Hope this helps!

1 Like

Hi @alexander.larsen ,
Thanks for your reply. I understood the issue now. will try with python plugin.