diff options
author | sr5154@student.uni-lj.si <sr5154@student.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414> | 2017-03-31 16:24:11 +0000 |
---|---|---|
committer | sr5154@student.uni-lj.si <sr5154@student.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414> | 2017-03-31 16:24:11 +0000 |
commit | c71ceb41abbd4521ee5646ea1c17f04552bcaa95 (patch) | |
tree | 28407edbd80b961d48cde1cc851d6b73d8b8cf94 /kpov_judge | |
parent | a3cf12f9af771e9b6ba6dad9b4d20ecbc1d6e126 (diff) |
Preveri DNS poizvedbo
git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@413 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414
Diffstat (limited to 'kpov_judge')
-rw-r--r-- | kpov_judge/tasks/dhcp_dns_predefined_ip/task.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/kpov_judge/tasks/dhcp_dns_predefined_ip/task.py b/kpov_judge/tasks/dhcp_dns_predefined_ip/task.py index 14ade9e..a7d6949 100644 --- a/kpov_judge/tasks/dhcp_dns_predefined_ip/task.py +++ b/kpov_judge/tasks/dhcp_dns_predefined_ip/task.py @@ -7,7 +7,7 @@ instructions = { 'si':u""" Ustvari tri navidezne računalnike. Za enega (SimpleArbiter) uporabi sliko diska simpleArbiterGW. Na drugega (DHCP_server) postavi strežnika DHCP in DNS. Poskrbi, da bo preostali računalnik (DHCP_client) dobil naslov, ki ga prebereš na SimpleArbiterju. -Poskrbi, da bo DNS strežnik za HOSTNAME_X vrnil naslov {HOSTNAME_X_IP}. +Poskrbi, da bo DNS strežnik za domeno test.net vrnil naslov {HOSTNAME_X_IP}. DHCP_server naj za DNS strežnik uporabi {DNS_NM}. DHCP_client naj za DNS strežnik uporabi {DNS_static}. """ @@ -68,7 +68,7 @@ params_meta = { '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): +def task(IP_NM, DNS_NM, IP_static, DNS_static, HOSTNAME_X_IP): from pexpect import pxssh import pexpect results = dict() @@ -90,6 +90,8 @@ def task(IP_NM, DNS_NM, IP_static, DNS_static): sB.prompt() results['static_nmcli'] = sB.before results['static_nslookup'] = sB.run('nslookup www.arnes.si') + # test the DNS server + results['NM_dns_test'] = sA.run('nslookup test 127.0.0.1') sA.logout() sB.logout() return results @@ -110,11 +112,11 @@ def task_check(results, params): score = 0 hints = [] if results['NM_nslookup'].find('Server:\t\t{0}\r'.format(params['DNS_NM'])) > -1: - score += 3 + score += 2 else: hint += ["NM DNS wrong"] if results['static_nslookup'].find('Server:\t\t{0}\r'.format(params['DNS_static'])) > -1: - score += 3 + score += 2 else: hint += ["Static DNS wrong"] if re.search(r'e(th0|np0s3|ns3) +ethernet +connected', results['NM_nmcli']): @@ -125,6 +127,10 @@ def task_check(results, params): score += 2 else: hints += ['nmcli on malibrez incorrect'] + if results['NM_dns_test'].find('Address: {0}'.format(params['HOSTNAME_X_IP'])) > -1: + score += 2 + else: + hints += ['DNS query wrong'] return score, hints def prepare_disks(templates, task_params, global_params): |