summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/set_ip_static_dhcp
diff options
context:
space:
mode:
Diffstat (limited to 'kpov_judge/tasks/set_ip_static_dhcp')
-rw-r--r--kpov_judge/tasks/set_ip_static_dhcp/task.py37
1 files changed, 25 insertions, 12 deletions
diff --git a/kpov_judge/tasks/set_ip_static_dhcp/task.py b/kpov_judge/tasks/set_ip_static_dhcp/task.py
index 14869f0..8c33a90 100644
--- a/kpov_judge/tasks/set_ip_static_dhcp/task.py
+++ b/kpov_judge/tasks/set_ip_static_dhcp/task.py
@@ -6,12 +6,12 @@
instructions = {
'si':u"""
Ustvari tri navidezne racunalnike. Za prvega
-uporabi sliko diska simpleArbiterGW, za drugega sliko diska
+uporabi sliko diska simpleArbiterDhcpGW, za drugega sliko diska
maliNetworkManager, za tretjega sliko diska maliBrezNetworkManager.
Racunalnike imenujmo enako kot slike diska.
Na maliBrezNetworkManager izklopi networkmanager in uporabljaj konzolo.
Na obeh rocno nastavi IP naslova ter naslova
-DNS strežnikov. Naslove dobiš na simpleArbiterGW.
+DNS strežnikov. Naslove dobiš na simpleArbiterDhcpGW.
"""
}
@@ -46,7 +46,7 @@ computers = {
},
'SimpleArbiter': {
'disks': [
- { 'name': 'simpleArbiterDhcp',
+ { 'name': 'simpleArbiterDhcpGW',
# attempt automount
},
#{ 'name': 'CDROM',
@@ -75,17 +75,25 @@ def task(IP_NM, DNS_NM, IP_static, DNS_static):
results = dict()
peer_user = 'student'
peer_passwd = 'vaje'
+ # sA - network manager
sA = pxssh.pxssh()
- sB = pxssh.pxssh()
sA.login(IP_NM, peer_user, peer_passwd)
- sB.login(IP_static, peer_user, peer_passwd)
- # sA - network manager
- results['NM_nmcli'] = sA.run('nmcli d')
- results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
- # sB - brez network manager
- results['static_nmcli'] = sB.run('nmcli d')
- results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.sendline('nmcli d')
+ sA.prompt()
+ results['NM_nmcli'] = sA.before
+ sA.sendline('nslookup www.arnes.si')
+ sA.prompt()
+ results['NM_nslookup'] = sA.before
sA.logout()
+ # sB - brez network manager
+ sB = pxssh.pxssh()
+ sB.login(IP_static, peer_user, peer_passwd)
+ sB.sendline('nmcli d')
+ sB.prompt()
+ results['static_nmcli'] = sB.before
+ sB.sendline('nslookup www.arnes.si')
+ sB.prompt()
+ results['static_nslookup'] = sB.before
sB.logout()
return results
@@ -103,13 +111,18 @@ def gen_params(user_id, params_meta):
def task_check(results, params):
import re
score = 0
+ #print results, params
if results['NM_nslookup'].find(params['DNS_NM']) > -1:
+ # print "NM_nslookup OK"
score += 3
if results['static_nslookup'].find(params['DNS_static']) > -1:
+ # print "static_nslookup OK"
score += 3
if re.search(r'eth0 +802-.*connected', results['NM_nmcli']):
+ # print "NM_nmcli OK"
score += 2
- if not re.search(r'eth0 +802-.*unmanaged', results['static_nmcli']):
+ if re.search(r'eth0 +802-.*unmanaged', results['static_nmcli']):
+ # print "static_nmcli OK"
score += 2
return score