| 1 | '''[wiki:GEC16Agenda/WiMAX-Tutorial/Video/03 Previous]''' |
| 2 | |
| 3 | == Writing the Experiment Script == |
| 4 | |
| 5 | Once all of the OMF application wrappers are installed on the OMF EC console, we can prepare the experiment script: |
| 6 | |
| 7 | {{{ |
| 8 | #!ruby |
| 9 | |
| 10 | defProperty('res', 2, "First node") |
| 11 | defProperty('prefix', "omf.necwimax.node", "Prefix for node names") |
| 12 | |
| 13 | # Video properties |
| 14 | defProperty('vlcport', 9001, "Port on node to send video stream to") |
| 15 | defProperty('duration', 30, "Length of time to save video for") |
| 16 | defProperty('bitrate', 100, "Bitrate of transcoded video") |
| 17 | defProperty('scale', 0.5, "Scale of transcoded video") |
| 18 | defProperty('vlcsenderbin', "/home/wimax/vlc-2.0.5/vlc", "Full path to VLC binary to run on sender") |
| 19 | defProperty('vlcsendargs', " -I dummy -V dummy --quiet --play-and-exit --run-time #{property.duration}", |
| 20 | "Arguments to pass to VLC sender") |
| 21 | defProperty('vlcsend', |
| 22 | ":sout=\'#transcode{vcodec=h264,vb=#{property.bitrate},scale=#{property.scale},acodec=none}:std{access=udp{ttl=1},mux=ts,dst=10.43.255.255:#{property.vlcport}}\'", |
| 23 | "Text of VLC sout stanza for sender") |
| 24 | defProperty('vlcomlargs', "--extraintf omlstats --oml-exp-id #{Experiment.ID} --oml-server tcp:128.238.66.220:3008 --oml-id video-source", |
| 25 | "OML arguments for VLC sender") |
| 26 | |
| 27 | defGroup('receiver', "#{property.prefix}#{property.res}") do |node| |
| 28 | node.net.t0.channel = "2590000,10" |
| 29 | node.net.t0.mtu=1470 |
| 30 | node.net.t0.netmask = "255.255.0.0" |
| 31 | node.net.t0.ip = "10.43.9.202" |
| 32 | node.addApplication("wmxstat_universal") do |app| |
| 33 | app.measure('status') |
| 34 | end |
| 35 | node.addApplication("vlc") do |app| |
| 36 | app.setProperty('quiet', true) |
| 37 | app.setProperty('play-and-exit', true) |
| 38 | app.setProperty('intf', 'dummy') |
| 39 | app.setProperty('extraintf', 'omlstats') |
| 40 | app.setProperty('input', "udp://@:#{property.vlcport}") |
| 41 | app.setProperty('sout', "''#standard{access=file,mux=ts,dst=/root/#{Experiment.ID}.mp4}''") |
| 42 | app.measure('audio', :samples =>1) |
| 43 | app.measure('video', :samples =>1) |
| 44 | app.measure('input', :samples =>1) |
| 45 | app.measure('output', :samples =>1) |
| 46 | end |
| 47 | |
| 48 | end |
| 49 | |
| 50 | onEvent(:ALL_UP_AND_INSTALLED) do |event| |
| 51 | system("/home/#{ENV['USER']}/getbsconf -i wimaxrf --oml-server tcp:localhost:3003 --oml-id console --oml-exp-id #{Experiment.ID}") |
| 52 | wait 10 |
| 53 | allGroups.startApplications |
| 54 | system("ssh wimax@128.238.38.83 \"#{property.vlcsenderbin} #{property.vlcsendargs} udp://@:9000 #{property.vlcsend} #{property.vlcomlargs}\"") |
| 55 | wait property.duration |
| 56 | allGroups.stopApplications |
| 57 | wait 2 |
| 58 | allGroups.exec("/usr/local/bin/iput -f /root/#{Experiment.ID}.mp4 video") |
| 59 | wait 5 |
| 60 | Experiment.done |
| 61 | end |
| 62 | |
| 63 | |
| 64 | }}} |
| 65 | |
| 66 | [[br]] |
| 67 | > '''Deconstructing the experiment script''': [[br]] |
| 68 | > Every OMF-enabled node in the experiment (purple node) is represented by a "defGroup" stanza. [[br]] |
| 69 | > Every OML-enabled application that runs on an OMF node is represented by an "addApplication" stanza within the "defGroup" |
| 70 | |
| 71 | [[br]] |
| 72 | |
| 73 | '''[wiki:GEC16Agenda/WiMAX-Tutorial/Video/05 Next]''' |