« www.tkk.fi

Suomeksi | På svenska | In English | GER | CAT | SPA | EPO | IT | Old

Siirry sivun sisällön alkuun





VSIB to UDP/IP multicast utilities

(C) 06/2009 Jan Wagner

Introduction

The tools allow the data from a single VSIB card to be multicasted locally and onto the network as a multicast UDP/IP packet stream. The packets contain time stamps that have been derived from a NTP/maser and the station 1PPS, and not extracted from the data itself. Local and remote computers can join the multicast group and receive a copy of the stream. This stream copy can then be written to a local disk.

It is also possible to have one computer re-cast the multicast stream as normal unicast UDP/IP. While this is not so good for the network (it tends to clog up), it is nevertheless useful for those situations where multicast has been disabled somewhere on the route towards one or more of the receiving clients. With re-casting they can resort back to normal unicast UDP.

Note that although there are Reliable Multicast implementations, the current set of tools do not make use of them. The main reasons are that reliable multicast methods require additional stream setup and are rarely supported on the public networks.

Source code

The source code is under ./multicast/ and can also be downloaded as a package vsib2multicast_1.00.tar.gz.

How to use the tools

The starting time arguments are always Unix seconds. As an example, you can check the current second on a terminal using /bin/date +%s. Some of the tools may be run as root via sudo - the programs will then stick to a single CPU core, boost their priority to real-time and will prevent memory swapping. In practice at the usual sub-1024 Mbit/s data rates runnig as root does not show much performance boost except on quite old computers.

vsib2multicast: sends data as multicast UDP packets. You can choose any free multicast group destination IP. The data contains 1250 bytes of payload. Sixty-four (64) UDP packets build one full 80.000-byte VLBA frame. The UDP data is prepended by two 32-bit unsigned integers. The first is a Unix time stamp derived from station 1PPS and the auto-detected VSIB data rate (128, 256, 512 Mbit/s). The second is a 32-bit freely running packet sequence number that has no relation to the Unix time stamp. Control-C or SIGINT will terminate the server cleanly.

VSIB data streaming tool 'vsib2multicast' v1.00
(C) 2009 Jan Wagner, Metsahovi Radio Observatory
Usage: ./vsib2multicast <target_ip> <target_port> [scanlistfile]
  target_ip   : some multicast group target ip from 224.0.0.0-239.255.255.255
  target_port : the port number
  listfile    : file with list of times to record into current directory
You can choose a free IP from http://www.iana.org/assignments/multicast-addresses/

vsib2multicast_client: joins a multicast group to receive a copy of the stream. The stream is monitored until the timestamps in the stream reach the specified starting second. After this, payload data is written into the output file for a specified duration of data timestamp seconds. The written data does not contain the timestamp nor the packet sequence number, it is plain VSIB data. The packet sequence numbers are used to position the payload data at the correct location inside the file.

Usage: ./vsib2multicast_client <group_ip> <group_port> <start_second> <duration_secs> <outputfile>
  group_ip   : the multicast group IP between 224.0.0.0-239.255.255.255
  group_port : the multicast input port number
  start_second  : start to record from which data second
  duration_secs : how many data seconds to record
  outputfile    : name and path of the output file
Joins the specified multicast group, outputs data on stdout.

vsib2multicast_recast: joins a multicast group to receive a copy of the stream. The received packets are forwarded as unicast UDP to a single specified destination. This can be used to stream to remote hosts where multicast support is not available on some parts along the network path.

Usage: ./vsib2multicast_recast <group_ip> <group_port> <destination_ip> <destination_port>
  group_ip   : the multicast group IP between 224.0.0.0-239.255.255.255
  group_port : the multicast input port number
  dest_ip    : the unicast host destination IP
  dest_port  : the unicast host destination port
Joins the specified multicast group, forwards to unicast IP.

vsib2udp_client: same as vsib2multicast_client except that it listens on a local UDP port instead of joining a multicast group.

Usage: ./vsib2multicast_client <source_port> <start_second> <duration_secs> <outputfile>
  source_port   : the port on which to receive data
  start_second  : start to record from which data second
  duration_secs : how many data seconds to record
  outputfile    : name and path of the output file

So much about that. Now some real-life demos.

Examples

Below the vsib2multicast server is started either with full or per-scanlist copy of sent data or is started as a plain multicast sender without a local file copy:

oper@tetricus:/usr/src/vsib$ ### sudo ./vsib2multicast 232.43.211.235 46321 ~/euro99mh.scanlist
oper@tetricus:/usr/src/vsib$ sudo ./vsib2multicast 232.43.211.235 46321 

VSIB data streaming tool 'vsib2multicast' v1.00
(C) 2009 Jan Wagner, Metsahovi Radio Observatory

Configured multicast: TTL=64, loopback=allowed
Program tied to CPU#0
Changed to SCHED_RR with priority 50
Locked future allocs with mlockall()
VSIB opened with vsib mode 0x02, embed=false, giga=false, skip=none
First packet sent at second 1245166290.008638
Rate change detected: 128 Mbps => 256.23/256 Mbps, dT=0.4996 sec
waiting for VSIB DMA DONE...
VSIB opened with vsib mode 0x02, embed=false, giga=false, skip=none
First packet sent at second 1245166292.008636
Second 1245166293, one-sec average rate 256.22
Second 1245166294, one-sec average rate 256.21
Second 1245166295, one-sec average rate 256.23
Second 1245166296, one-sec average rate 256.22
Second 1245166297, one-sec average rate 255.23
Second 1245166298, one-sec average rate 256.21
Second 1245166299, one-sec average rate 256.22
...

While the multicast server is feeding the multicast group, you can let the same or other computers on the network join the multicast to get a traffic-efficient copy of the data -- at the cost of loosing Tsunami-like lost packet retransmission capability.

Below we record five seconds of data from the multicast stream.

oper@tetricus:/usr/src/vsib$ ./vsib2multicast_client 232.43.211.235 46321 1245167935 5 /raid/multicast/clitest.bin
VSIB multicast client tool 'vsib2multicast_client' v1.00
(C) 2009 Jan Wagner, Metsahovi Radio Observatory

Program tied to CPU#0
Warning: could not change to Round-Robin scheduler
sched_setscheduler: Operation not permitted
Locked future allocs with mlockall()
Second 1245167929; packets-per-sec 0, frames-per-sec 0.000000, rate  0.00 Mbps : record='n'
Second 1245167930; packets-per-sec 4928, frames-per-sec 77.000000, rate 49.28 Mbps : record='n'
Second 1245167931; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='n'
Second 1245167932; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='n'
Second 1245167933; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='n'
Second 1245167934; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='n'
Second 1245167935; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='y'
Second 1245167936; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='y'
Second 1245167937; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='y'
Second 1245167938; packets-per-sec 25429, frames-per-sec 397.328125, rate 254.29 Mbps : record='y'
Second 1245167939; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='y'
The last second has been recorded.
KTHX!

The recording can be scripted. The start times and scan durations in a FieldSystem schedule file can be transformed into a recording script that calls the ./vsib2multicast_client once for every scan.

Sometimes it is not possible to have multicast functionality available through the entire network up to the final client computer. In this case we can set up any number of multicast-to-unicast forwarding computers. Below we forward the UDP to the host 193.166.42.24 and port 46225:

oper@tetricus:/usr/src/vsib$ sudo ./vsib2multicast_recast 232.43.211.235 46321 193.166.42.24 46225
VSIB multicast recasting tool 'vsib2multicast_recast' v1.00
(C) 2009 Jan Wagner, Metsahovi Radio Observatory

Program tied to CPU#1
Changed to SCHED_RR with priority 50
Locked future allocs with mlockall()
Forwarding multicast UDP to: 193.166.42.24 port 46225, buffer size 16777216 bytes
Seconds changed to 1245168150; packets-per-sec 0, frames-per-sec 0.000000, rate  0.00 Mbps
Seconds changed to 1245168151; packets-per-sec 18488, frames-per-sec 288.875000, rate 184.88 Mbps
Seconds changed to 1245168152; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps
Seconds changed to 1245168153; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps
Seconds changed to 1245168154; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps
Seconds changed to 1245168155; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps
...

This unicast UDP packet stream can then be captured on the remote computer using the vsib2udp_client utility. It is otherwise identical to the vsib2multicast_client except it listens on a local port only. A five-second data capture example:

user@lionel:/usr/src/vsib$ sudo ./vsib2udp_client 46225 1245168380 5 /dev/null
VSIB UDP client tool 'vsib2udp_client' v1.00
(C) 2009 Jan Wagner, Metsahovi Radio Observatory

Program tied to CPU#0
Changed to SCHED_RR with priority 50
Locked future allocs with mlockall()
Receiving data on UDP port 46225
Second 1245168373; packets-per-sec 0, frames-per-sec 0.000000, rate  0.00 Mbps : record='n'
Second 1245168374; packets-per-sec 9001, frames-per-sec 140.640625, rate 90.01 Mbps : record='n'
Second 1245168375; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='n'
Second 1245168376; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='n'
Second 1245168377; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='n'
Second 1245168378; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='n'
Second 1245168379; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='n'
Second 1245168380; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='y'
Second 1245168381; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='y'
Second 1245168382; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='y'
Second 1245168383; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='y'
Second 1245168384; packets-per-sec 25600, frames-per-sec 400.000000, rate 256.00 Mbps : record='y'
The last second has been recorded.
KTHX!

Examples with scan lists and scripting

Scan lists can be used with every one of the tools. First we let FieldSystem drudg the schedule file and copy the generated .snp file to our own directory. Then the generate_scanlist.sh script can be used to extract the scan name, unix starting time and the scan duration:

oper@tetricus:/usr/src/vsib/$ cd fstools; scp oper@fs1:euro99mh.snp .

oper@tetricus:/usr/src/vsib/fstools$ ./generate_scanlist.sh euro99mh.snp
A list of the scans has been written to euro99mh.scanlist:
dummy_Mh_today_2009-06-18T14:19:10.evn 1245334750 30
euro99_Mh_145-1200_2009-05-25T12:00:00.evn 1243252800 30
euro99_Mh_145-1204_2009-05-25T12:04:09.evn 1243253049 40
euro99_Mh_145-1208_2009-05-25T12:08:46.evn 1243253326 39
...

To use the scanlist to let the server create a local copy:

oper@tetricus:/usr/src/vsib/fstools$ vsib2multicast 226.221.221.38 46220 euro99mh.scanlist

Or use the scanlist in the client(s):

oper@tetricus:/usr/src/vsib/fstools$ pico scanrecorder_multicast.sh  # edit RAID_PATH etc
oper@tetricus:/usr/src/vsib/fstools$ ./scanrecorder_multicast.sh euro99mh.scanlist
or unicast
oper@tetricus:/usr/src/vsib/fstools$ pico scanrecorder_unicast.sh  # edit RAID_PATH etc
oper@tetricus:/usr/src/vsib/fstools$ ./scanrecorder_uniicast.sh euro99mh.scanlist


EXPReS Logo EXPReS Logo This work has received financial support under the EU FP6 Integrated Infrastructure Initiative contract number #026642, EXPReS.