Reputation: 847
I am trying to write a framework which has capability to entaract with multiple linux machines.
For example my test case which is going to use that framework can be able to start a server in a linux machine, start a client in another linux machine and then should be able to make some configuration changes in a different linux machine without waiting for any command to complete.
I have tried using pexpect
to do my job but didn't find it more useful.
Can anyone suggest me any Python module which i can use to do my task ?
My Testcase steps are like:
1. Login to SIP Server -> su -> start SIP server
2. Login to Voice Server -> su -> make some configuration changes
3. Login to SIP client -> su -> start SIP client
4. Collect logs and perform validations
In my environment I can't login into my machines directly as su.
Upvotes: 0
Views: 60
Reputation: 17506
You should look into using something like python-fabric It allows you to use higher level language constructs such as context managers and makes the shell more usable with python in general.
Example usage:
fabfile.py
from fabric.api import run
def host_type():
run('uname -s')
Then you can use host_type
from the commandline in the directory of fabfile.py
:
$ fab -H localhost,linuxbox host_type
[localhost] run: uname -s
[localhost] out: Darwin
[linuxbox] run: uname -s
[linuxbox] out: Linux
Upvotes: 2