summaryrefslogtreecommitdiff
path: root/kpov_judge
diff options
context:
space:
mode:
Diffstat (limited to 'kpov_judge')
-rw-r--r--kpov_judge/tasks/dhcp_dns_predefined_ip/task.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/kpov_judge/tasks/dhcp_dns_predefined_ip/task.py b/kpov_judge/tasks/dhcp_dns_predefined_ip/task.py
index 0a5b853..525e5bb 100644
--- a/kpov_judge/tasks/dhcp_dns_predefined_ip/task.py
+++ b/kpov_judge/tasks/dhcp_dns_predefined_ip/task.py
@@ -63,7 +63,7 @@ params_meta = {
'DNS_NM': {'descriptions': {'si': 'DNS za maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True},
'IP_static': {'descriptions': {'si': 'Naslov maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True},
'DNS_static': {'descriptions': {'si': 'DNS za maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True},
- 'HOSTNAME_X_IP': {'descriptions': {'si': 'Naslov HOSTNAME_X'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'HOSTNAME_X_IP': {'descriptions': {'si': 'Naslov HOSTNAME_X'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True},
}
def task(IP_NM, DNS_NM, IP_static, DNS_static):
@@ -78,11 +78,17 @@ def task(IP_NM, DNS_NM, IP_static, DNS_static):
sB.login(IP_static, peer_user, peer_passwd)
# sA
# make sure NM is not handling eth0
- results['NM_nmcli'] = sA.run('nmcli d')
+ sA.sendline('nmcli -c no d')
+ sA.prompt()
+ results['NM_nmcli'] = sA.before
+
results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
# sB
# check whether NM is handling eth0
- results['static_nmcli'] = sB.run('nmcli d')
+ sA.sendline('nmcli -c no d')
+ sA.prompt()
+ results['static_nmcli'] = sA.before
+
results['static_nslookup'] = sB.run('nslookup www.arnes.si')
sA.logout()
sB.logout()
@@ -95,7 +101,7 @@ def gen_params(user_id, params_meta):
dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
net = kpov_random_helpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
params['DNS_NM'] = r.choice(dns_servers)
- params['IP_NM'], params['IP_static'] = kpov_random_helpers.IPv4_addr_gen(r, net, 2)
+ params['IP_NM'], params['IP_static'], params['HOSTNAME_X_IP'] = kpov_random_helpers.IPv4_addr_gen(r, net, 3)
params['DNS_static'] = r.choice(dns_servers)
return params
@@ -111,14 +117,16 @@ def task_check(results, params):
score += 3
else:
hint += ["Static DNS wrong"]
- if re.search(r'eth0 +802-.*connected', results['NM_nmcli']):
+ if re.search(r'e(th0|np0s3|ns3) +ethernet +connected', results['NM_nmcli']):
+ # print "NM_nmcli OK"
score += 2
else:
- hint += ["NM wrong"]
- if not re.search(r'eth0 +802-.*connected', results['static_nmcli']):
+ hints += ['nmcli incorrect']
+ if not re.search(r'e(th0|np0s3|ns3) +ethernet +connected', results['static_nmcli']):
+ # print "NM_nmcli OK"
score += 2
else:
- hint += ["static wrong"]
+ hints += ['static nmcli incorrect']
return score, hints
def prepare_disks(templates, task_params, global_params):