diff options
author | mp7462@student.uni-lj.si <mp7462@student.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414> | 2014-12-12 22:55:29 +0000 |
---|---|---|
committer | mp7462@student.uni-lj.si <mp7462@student.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414> | 2014-12-12 22:55:29 +0000 |
commit | 7f22e40080631b1fc7967a76fadff13d4ec3d8d5 (patch) | |
tree | 34caa09527c041d523d728739bb945e5b19f0a08 /kpov_judge/tasks | |
parent | 6d0020f4e5bdbbf1d3c3096f397706e749a9cf79 (diff) |
Added some checks
git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@68 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414
Diffstat (limited to 'kpov_judge/tasks')
-rw-r--r-- | kpov_judge/tasks/openvpn_simple_smb/task.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/kpov_judge/tasks/openvpn_simple_smb/task.py b/kpov_judge/tasks/openvpn_simple_smb/task.py index 4783486..ef7d48a 100644 --- a/kpov_judge/tasks/openvpn_simple_smb/task.py +++ b/kpov_judge/tasks/openvpn_simple_smb/task.py @@ -111,18 +111,22 @@ params_meta = { def task(IP_NM, DNS_NM, IP_static, DNS_static): - import pxssh - import pexpect + import pxssh # Used to set up an SSH connection to a remote machine + import pexpect # Allows the script to spawn a child application and control it as if a human were typing commands + # the necessary things we need to check if the task was performed correctly results = dict() + # The login params (these must be used on the machines!) peer_user = 'student' peer_passwd = 'vaje' + # Sets up the SSH connections to the machines sA = pxssh.pxssh() sB = pxssh.pxssh() + # Logs in to the machines with the default login params sA.login(IP_NM, peer_user, peer_passwd) sB.login(IP_static, peer_user, peer_passwd) @@ -136,9 +140,22 @@ def task(IP_NM, DNS_NM, IP_static, DNS_static): results['static_nmcli'] = sB.run('nmcli d') results['static_nslookup'] = sB.run('nslookup www.arnes.si') + # Check if the tap exists + # Must return a non-empty string + results['is_tap_exists'] = sA.run('ls /sys/class/net | grep "tap0"'); + # Check if the VPN server is running + # Must return a non-empty string + results['is_VPN_running'] = sA.run('ls /sys/class/net | grep "tun0"'); + + # Check if both clients are connected + # + # + + sA.logout() sB.logout() + return results |