1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# kpov_random_helpers should be imported by add_assignment.py
# Postavi nek film na Internet tako, da ga bodo lahko ostali videli.
# TODO: finish this
instructions = {
'si':u"""
Postavi navidezni računalnik SimpleArbiter z diska simpleArbiter. Posodobi datoteko /etc/apt/sources.list
preveri za posodobitve in naloži VLC.
Posnemi ali kako drugače ustvari film ter poskrbi, da bo film dostopen na lokalnem omrežju prek RTP z imenom toka TOK na naslovu NASLOV. Računaj, da bodo film lahko videli tvoji sošolci. Kršenje avtorskih pravic je pri reševanju te naloge
strogo prepovedano.
"""
'en':u"""
Set up a virtual computer SimpleArbiter from the simpleArbiter disk.
Read a movie title and stream name for stream TOK onto simpleArbiter. Film or
otherwise create a movie and make sure the movie is avaliable on your local network
via RTP with the name of the stream TOK on the address NASLOV.
Take into account that the movie may be seen by your classmates. Copyright infrigement while solving this task is
prohibited.
"""
}
computers = {
'SimpleArbiter': {
'disks': [
{ 'name': 'simpleArbiter',
# attempt automount
},
#{ 'name': 'CDROM',
# 'options': {'readonly': True},
# 'parts': [{'dev': 'b1', 'path': '/cdrom'}],
#},
],
'network_interfaces': [{'network': 'net1'}, {'network': 'test-net'}],
'flavor': 'm1.tiny',
'config_drive': False
}
}
networks = { 'test-net': {'public': True} }
params_meta = {
'NASLOV': {'descriptions': {'si': 'RTP multicast IP naslov'}, 'w': False, 'public':True, 'type': 'stream_name', 'generated': True},
'TOK': {'descriptions': {'si': 'Naslov toka'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True},
}
def task(NASLOV, TOK):
import pexpect
# sA
# make sure NM is not handling eth0
# sB
# check whether NM is handling eth0
results['ps'] = pexpect.run('ps xa')
results['tcpdump'] = pexpect.run('tcpdump')
return results
def gen_params(user_id, params_meta):
params = dict()
r = random.Random(user_id)
net = kpov_random_helpers.IPv4_net_gen(r, min_hosts = 16,
public=True, multicast=True)
params['NASLOV'] = kpov_random_helpers.IPv4_addr_gen(r, net, 1)[0]
params['TOK'] = kpov_random_helpers.hostname_gen(r)
return params
def task_check(results, params):
import re
print results
return score
def prepare_disks(templates, params):
# d = templates['simpleArbiterDhcp']
pass
|