| 1 | == Multi-Genenrator with real-time data logging == |
| 2 | |
| 3 | Multi-Generator (mgen) is an open source network utility capable of performing performance tests and measurements by generating and receiving UDP/TCP packets. This tool is already well documented under the [https://en.wikipedia.org/wiki/Wikipedia:Tutorial/Wikipedia_links Networks and Communication Systems Branch at US Navy Research]. |
| 4 | |
| 5 | An integrated version of mgen (version 5.02c) and Orbit Measurement Framework & Library (OML) has been built and tested in the Orbit environment. The following steps describe how to build and run this version of mgen. |
| 6 | |
| 7 | |
| 8 | === Set up === |
| 9 | |
| 10 | 1) Install the OML library and develpoment files. |
| 11 | {{{ |
| 12 | apt-get update |
| 13 | apt-get install liboml2 |
| 14 | }}} |
| 15 | |
| 16 | While building mgen other dependencies may be required to complete the compilation. Simply search and install the missing libraries and continue compiling. |
| 17 | |
| 18 | |
| 19 | 2) Download the source file for mgen, navigate to 'makefiles' directory and build. |
| 20 | {{{ |
| 21 | wget https://downloads.pf.itd.nrl.navy.mil/mgen/src-mgen-5.02c.tgz |
| 22 | tar -zxvf src-mgen-5.02c.tgz |
| 23 | mv src-mgen-5.02c.tgz mgen |
| 24 | cd mgen/makefile |
| 25 | make -f Makefile.linux mgen |
| 26 | }}} |
| 27 | |
| 28 | 3) use help for a listing of options |
| 29 | {{{ |
| 30 | ./mgen help |
| 31 | GPSSubscribe(): fopen() error: No such file or directory |
| 32 | GPSSubscribe(): fopen() error: No such file or directory |
| 33 | mgen: version 5.02c |
| 34 | mgen [ipv4][ipv6][input <scriptFile>][save <saveFile>] |
| 35 | [output <logFile>][log <logFile>][hostAddr {on|off} |
| 36 | [logData {on|off}][logGpsData {on|off}] |
| 37 | [binary][txlog][nolog][flush] |
| 38 | [event "<mgen event>"][port <recvPortList>] |
| 39 | [instance <name>][command <cmdInput>] |
| 40 | [sink <sinkFile>][block][source <sourceFile>] |
| 41 | [interface <interfaceName>][ttl <multicastTimeToLive>] |
| 42 | [unicast_ttl <unicastTimeToLive>] |
| 43 | [df <on|off>] |
| 44 | [tos <typeOfService>][label <value>] |
| 45 | [txbuffer <txSocketBufferSize>][rxbuffer <rxSocketBufferSize>] |
| 46 | [start <hr:min:sec>[GMT]][offset <sec>] |
| 47 | [precise {on|off}][ifinfo <ifName>] |
| 48 | [txcheck][rxcheck][check] |
| 49 | [queue <queueSize>][broadcast {on|off}] |
| 50 | [convert <binaryLog>][debug <debugLevel>] |
| 51 | [gpskey <gpsSharedMemoryLocation>] |
| 52 | [boost] [reuse {on|off}] |
| 53 | [oml <server:port[,omlFile]>] |
| 54 | MgenApp::ProcessCommands() OnCommand(help) error |
| 55 | mgen: error while processing startup commands |
| 56 | }}} |
| 57 | |
| 58 | The errors shown above are just informatory and can be ignored. |
| 59 | |
| 60 | All the options above (with the exception of 'oml') are explained in details in the [https://downloads.pf.itd.nrl.navy.mil/docs/mgen/mgen.html reference guide]. |
| 61 | |
| 62 | The 'oml' option specifies the oml server and port number to send and record events into an sql file. A specific filename can be given as well otherwise if the field is left blank the filename will default to 'oml_mgen_test.sq3'. Example |
| 63 | {{{ |
| 64 | ./mgen event "listen udp 5124" oml oml:3003,test_file |
| 65 | }}} |
| 66 | |
| 67 | The table below describes the parameters that are recorded |
| 68 | |
| 69 | || '''Parameter''' || '''Type''' || '''Description''' || |
| 70 | || oml_sender_id || INTEGER || identify which node the recorded data came from || |
| 71 | || oml_seq || INTEGER || oml sequence number || |
| 72 | || oml_ts_client || REAL || oml client time stamp || |
| 73 | || oml_ts_server || REAL || oml server time stamp || |
| 74 | || "proto" || TEXT || type of traffic -> UDP, TCP || |
| 75 | || "direction" || TEXT || direction of traffic -> sender, receiver || |
| 76 | || "flowid" || INTEGER || mgen flow id || |
| 77 | || "seq_num" || INTEGER || sequence number for each flow id || |
| 78 | || "src_addr" || TEXT || source IP address || |
| 79 | || "src_port" || INTEGER || source port || |
| 80 | || "dst_addr" || TEXT || destination IP || |
| 81 | || "dst_port" || INTEGER || destination port || |
| 82 | || "data_len" || INTEGER || length of data || |
| 83 | |
| 84 | === Simple OML recording with 1 sender and 1 receiver === |
| 85 | 1) Refer to the reference guide for complete details on using formatted scripts and options to run mgen. In this section we'll only describe |
| 86 | |
| 87 | 2) To demonstrate the OML recording feature, setup mgen on two nodes and run a script with the input option. For this example node6-6 and node15-6 on the grid were used and the corresponding script is showing the table. |
| 88 | || '''Node Id''' || '''Traffic Direction''' || '''Script contents''' || |
| 89 | || node6-6 || sender || 0.0 ON 0 UDP SRC 5000 DST 10.10.15.6/5000 POISSON [10 1024:1200] \\ 2.0 ON 1 UDP SRC 5001 DST 10.10.15.6/5001 POISSON [8 1024:1200] \\ 4.0 ON 2 UDP SRC 5002 DST 10.10.15.6/5002 POISSON [6 1024:1200] \\ 6.0 ON 3 UDP SRC 5003 DST 10.10.15.6/5003 POISSON [4 1024:1200] \\ 8.0 ON 4 UDP SRC 5004 DST 10.10.15.6/5004 PERIODIC [1 256] || |
| 90 | || node15-6 || receiver || 0.0 LISTEN UDP 5000-5004 || |
| 91 | |
| 92 | |
| 93 | The sender script file (udp_sender_script.mgn) configures the node to transmit UDP traffic to the receiver node which is configured to listen for UDP packet on port ranging from 5000 to 5004. |
| 94 | |
| 95 | The format of the sender script is briefly described below. |
| 96 | || Event time || Event || Flow id || Protocol || Source port || Destination IP and port || Traffic pattern || |
| 97 | || 0.0 || ON || 0 || UDP || SRC 5000 || DST 10.10.15.6/5000 || POISSON [10 1024:1200]|| |
| 98 | |
| 99 | Likewise the receiver script (udp_recv_script.mgn) is condensed into a single liner |
| 100 | || Event time || Event || Protocol || Port list || |
| 101 | || 0.0 || LISTEN || UDP || 5000-5004 || |
| 102 | |
| 103 | 3) Run each script using the 'input' option of mgen and specify the oml options for recording. |
| 104 | {{{ |
| 105 | node6-6> ./mgen input udp_send_script.mgn oml oml:3003,udp_send_mgen |
| 106 | |
| 107 | node15-6> ./mgen input udp_recv_script.mgn oml oml:3003,udp_recv_mgen |
| 108 | }}} |
| 109 | |
| 110 | Each instance of mgen will start producing the text output. In the background it will also send packet infomation to the specified oml server and database. To quickly view the contents of the data files, run the following command from the console: |
| 111 | {{{ |
| 112 | console> sqlite3 /var/lib/oml2/udp_recv_mgen.sq3 .dump |
| 113 | PRAGMA foreign_keys=OFF; |
| 114 | BEGIN TRANSACTION; |
| 115 | CREATE TABLE _senders (name TEXT PRIMARY KEY, id INTEGER UNIQUE); |
| 116 | INSERT INTO "_senders" VALUES('et',1); |
| 117 | CREATE TABLE "_experiment_metadata" (oml_tuple_id INTEGER PRIMARY KEY, oml_sender_id INTEGER, oml_seq INTEGER, oml_ts_client REAL, oml_ts_server REAL, "subject" TEXT, "key" TEXT, "value" TEXT); |
| 118 | INSERT INTO "_experiment_metadata" VALUES(1,NULL,NULL,NULL,NULL,NULL,'table__experiment_metadata','0 _experiment_metadata subject:string key:string value:string'); |
| 119 | INSERT INTO "_experiment_metadata" VALUES(2,NULL,NULL,NULL,NULL,NULL,'start_time','1528726472'); |
| 120 | INSERT INTO "_experiment_metadata" VALUES(3,NULL,NULL,NULL,NULL,NULL,'table__mp__udp_recv_mgen','1 _mp__udp_recv_mgen proto:string flowid:int32 seq_num:int32 src_addr:string src_port:int32 dst_addr:string dst_port:int32 data_len:int32'); |
| 121 | CREATE TABLE "_mp__udp_recv_mgen" (oml_tuple_id INTEGER PRIMARY KEY, oml_sender_id INTEGER, oml_seq INTEGER, oml_ts_client REAL, oml_ts_server REAL, "proto" TEXT, "flowid" INTEGER, "seq_num" INTEGER, "src_addr" TEXT, "src_port" INTEGER, "dst_addr" TEXT, "dst_port" INTEGER, "data_len" INTEGER); |
| 122 | INSERT INTO "_mp__udp_recv_mgen" VALUES(1,1,1,3.50581999868154525756e-01,2.95809999999999961861e-01,'UDP',0,4,'10.10.6.6',5000,'10.10.15.6',5000,1044); |
| 123 | INSERT INTO "_mp__udp_recv_mgen" VALUES(2,1,2,4.55220999661833047866e-01,0.3979,'UDP',0,5,'10.10.6.6',5000,'10.10.15.6',5000,1172); |
| 124 | INSERT INTO "_mp__udp_recv_mgen" VALUES(3,1,3,0.585224999114871,5.2790399999999992886e-01,'UDP',0,6,'10.10.6.6',5000,'10.10.15.6',5000,1192); |
| 125 | INSERT INTO "_mp__udp_recv_mgen" VALUES(4,1,4,1.40533899888396263122e+00,1.489031,'UDP',0,7,'10.10.6.6',5000,'10.10.15.6',5000,1041); |
| 126 | INSERT INTO "_mp__udp_recv_mgen" VALUES(5,1,5,1.59353199973702430725e+00,1.614587,'UDP',0,8,'10.10.6.6',5000,'10.10.15.6',5000,1110); |
| 127 | INSERT INTO "_mp__udp_recv_mgen" VALUES(6,1,6,1.68116699904203414916e+00,1.62387099999999984234e+00,'UDP',0,9,'10.10.6.6',5000,'10.10.15.6',5000,1198); |
| 128 | INSERT INTO "_mp__udp_recv_mgen" VALUES(7,1,7,1.72220599837601184844e+00,1.66488099999999983324e+00,'UDP',0,10,'10.10.6.6',5000,'10.10.15.6',5000,1176); |
| 129 | INSERT INTO "_mp__udp_recv_mgen" VALUES(8,1,8,1.89545799978077411651e+00,1.838213,'UDP',1,0,'10.10.6.6',5001,'10.10.15.6',5001,1049); |
| 130 | INSERT INTO "_mp__udp_recv_mgen" VALUES(9,1,9,1.91608599945902824401e+00,1.858813,'UDP',1,1,'10.10.6.6',5001,'10.10.15.6',5001,1127); |
| 131 | INSERT INTO "_mp__udp_recv_mgen" VALUES(10,1,10,2.05955099686980247497e+00,2.144107,'UDP',1,2,'10.10.6.6',5001,'10.10.15.6',5001,1169); |
| 132 | INSERT INTO "_mp__udp_recv_mgen" VALUES(11,1,11,2.0766779966652393341e+00,2.269656,'UDP',1,3,'10.10.6.6',5001,'10.10.15.6',5001,1080); |
| 133 | INSERT INTO "_mp__udp_recv_mgen" VALUES(12,1,12,2.10336599871516227722e+00,2.269673,'UDP',1,4,'10.10.6.6',5001,'10.10.15.6',5001,1064); |
| 134 | INSERT INTO "_mp__udp_recv_mgen" VALUES(13,1,13,2.15250899642705917358e+00,2.269681,'UDP',1,5,'10.10.6.6',5001,'10.10.15.6',5001,1075); |
| 135 | INSERT INTO "_mp__udp_recv_mgen" VALUES(14,1,14,2.19350999966263771057e+00,2.269688,'UDP',0,11,'10.10.6.6',5000,'10.10.15.6',5000,1180); |
| 136 | INSERT INTO "_mp__udp_recv_mgen" VALUES(15,1,15,2.24396899715065956115e+00,2.269796,'UDP',1,6,'10.10.6.6',5001,'10.10.15.6',5001,1073); |
| 137 | INSERT INTO "_mp__udp_recv_mgen" VALUES(16,1,16,2.24748399853706359863e+00,2.269805,'UDP',0,12,'10.10.6.6',5000,'10.10.15.6',5000,1161); |
| 138 | INSERT INTO "_mp__udp_recv_mgen" VALUES(17,1,17,2.26098299771547317504e+00,2.269826,'UDP',1,7,'10.10.6.6',5001,'10.10.15.6',5001,1148); |
| 139 | INSERT INTO "_mp__udp_recv_mgen" VALUES(18,1,18,2.2951769977808,2.269834,'UDP',0,13,'10.10.6.6',5000,'10.10.15.6',5000,1164); |
| 140 | INSERT INTO "_mp__udp_recv_mgen" VALUES(19,1,19,2.30865999683737754821e+00,2.26984,'UDP',1,8,'10.10.6.6',5001,'10.10.15.6',5001,1128); |
| 141 | INSERT INTO "_mp__udp_recv_mgen" VALUES(20,1,20,2.32708599790930747985e+00,2.269847,'UDP',1,9,'10.10.6.6',5001,'10.10.15.6',5001,1171); |
| 142 | INSERT INTO "_mp__udp_recv_mgen" VALUES(21,1,21,2.35045599937438964843e+00,2.293127,'UDP',0,14,'10.10.6.6',5000,'10.10.15.6',5000,1153); |
| 143 | INSERT INTO "_mp__udp_recv_mgen" VALUES(22,1,22,2.44623499736189842224e+00,2.388898,'UDP',0,15,'10.10.6.6',5000,'10.10.15.6',5000,1166); |
| 144 | INSERT INTO "_mp__udp_recv_mgen" VALUES(23,1,23,2.58714799955487251281e+00,2.52982499999999976836e+00,'UDP',1,10,'10.10.6.6',5001,'10.10.15.6',5001,1173); |
| 145 | |
| 146 | }}} |
| 147 | |