From 7f22e40080631b1fc7967a76fadff13d4ec3d8d5 Mon Sep 17 00:00:00 2001 From: "mp7462@student.uni-lj.si" Date: Fri, 12 Dec 2014 22:55:29 +0000 Subject: Added some checks git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@68 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414 --- kpov_judge/tasks/openvpn_simple_smb/task.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'kpov_judge/tasks/openvpn_simple_smb') 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 -- cgit v1.2.1