summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kpov_judge/tasks/nat_vlc/task.py38
1 files changed, 21 insertions, 17 deletions
diff --git a/kpov_judge/tasks/nat_vlc/task.py b/kpov_judge/tasks/nat_vlc/task.py
index b595961..b0e9342 100644
--- a/kpov_judge/tasks/nat_vlc/task.py
+++ b/kpov_judge/tasks/nat_vlc/task.py
@@ -76,29 +76,33 @@ params_meta = {
# 'DNS_NM': {'descriptions': {'si': 'DNS za maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True},
'IP_simple': {'descriptions': {'si': 'Naslov SimpleArbiter'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True},
'IP_NAT': {'descriptions': {'si': 'Naslov NAT'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True },
+ 'IP_NAT_user': {'descriptions': {'si': 'Username NAT virtualke'}, 'w': False, 'public' : True, 'type' : 'username', 'generated' : True},
+ 'IP_NAT_passwd': {'descriptions': {'si': 'Password NAT virtualke'}, 'w': True,'public' : True, 'type' : 'passwd', 'generated' : False},
# 'DNS_static': {'descriptions': {'si': 'DNS za maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True},
}
-def task(IP_NM, DNS_NM, IP_static, DNS_static):
+def task(IP_simple, IP_NAT, IP_NAT_user, IP_NAT_passwd):
import pxssh
import pexpect
results = dict()
- peer_user = 'student'
- peer_passwd = 'vaje'
- sA = pxssh.pxssh()
- sB = pxssh.pxssh()
- sA.login(IP_NM, peer_user, peer_passwd)
- sB.login(IP_static, peer_user, peer_passwd)
- # sA
- # make sure NM is not handling eth0
- results['NM_nmcli'] = sA.run('nmcli d')
- results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
- # sB
- # check whether NM is handling eth0
- results['static_nmcli'] = sB.run('nmcli d')
- results['static_nslookup'] = sB.run('nslookup www.arnes.si')
- sA.logout()
- sB.logout()
+ # Connect to NAT
+ povezava = pxssh.pxssh()
+ povezava.login(IP_NAT,IP_NAT_user,IP_NAT_passwd)
+
+ # Check if If IP_simple is connected to NAT
+ results['IP_simple ping to NAT'] = run('ping -c 5 IP_NAT')
+ # Check routing table on IP_simple
+ results['IP_simple routing table'] = run('route -n')
+ # Tracert Check if IP_simple is connected to internet
+ results['IP_simple to internet'] = run('traceroute 8.8.8.8')
+ # Check DNS
+ results['IP_simple dns'] = run('nslookup www.google.com')
+ # Check if IP_NAT ip forward is not 0
+ povezava.prompt()
+ povezava.sendline('cat /proc/sys/net/ipv4/ip_forward')
+ povezava.prompt()
+ results['IP_NAT ip forward'] = povezava.before
+ povezava.logout();
return results
def gen_params(user_id, params_meta):