Greetings,
I think I’ve discovered a bug with using bandwidth-test through API. When the test completes, it continues sending traffic to the destination until the API session is ended. It also sends the “done testing” as a !re until you close the API session as well. There is no “!done” returned when the test completes.
For example, the command I’m sending (shown here in API syntax):
/tool bandwidth-test
=address=10.0.0.2
=duration=2s
=user=admin
=password=passw0rd
.tag=cmd1
My debug output is:
Response from cmd1 (!re)
array(9) {
[“status”]=>
string(10) “connecting”
[“duration”]=>
string(8) “00:00:00”
[“rx-current”]=>
string(1) “0”
[“rx-10-second-average”]=>
string(1) “0”
[“rx-total-average”]=>
string(1) “0”
[“lost-packets”]=>
string(1) “0”
[“random-data”]=>
string(5) “false”
[“direction”]=>
string(7) “receive”
[“rx-size”]=>
string(4) “1500”
}
Response from cmd1 (!re)
array(9) {
[“status”]=>
string(7) “running”
[“duration”]=>
string(8) “00:00:01”
[“rx-current”]=>
string(1) “0”
[“rx-10-second-average”]=>
string(1) “0”
[“rx-total-average”]=>
string(1) “0”
[“lost-packets”]=>
string(1) “0”
[“random-data”]=>
string(5) “false”
[“direction”]=>
string(7) “receive”
[“rx-size”]=>
string(4) “1500”
}
Response from cmd1 (!re)
array(9) {
[“status”]=>
string(7) “running”
[“duration”]=>
string(8) “00:00:02”
[“rx-current”]=>
string(7) “8387024”
[“rx-10-second-average”]=>
string(7) “8387024”
[“rx-total-average”]=>
string(7) “8387024”
[“lost-packets”]=>
string(1) “0”
[“random-data”]=>
string(5) “false”
[“direction”]=>
string(7) “receive”
[“rx-size”]=>
string(4) “1500”
}
Response from cmd1 (!re)
array(9) {
[“status”]=>
string(12) “done testing”
[“duration”]=>
string(8) “00:00:03”
[“rx-current”]=>
string(8) “12540032”
[“rx-10-second-average”]=>
string(8) “10463528”
[“rx-total-average”]=>
string(8) “10463528”
[“lost-packets”]=>
string(1) “0”
[“random-data”]=>
string(5) “false”
[“direction”]=>
string(7) “receive”
[“rx-size”]=>
string(4) “1500”
}
Response from cmd1 (!re)
array(9) {
[“status”]=>
string(12) “done testing”
[“duration”]=>
string(8) “00:00:04”
[“rx-current”]=>
string(8) “18659888”
[“rx-10-second-average”]=>
string(8) “13195648”
[“rx-total-average”]=>
string(8) “13195648”
[“lost-packets”]=>
string(1) “0”
[“random-data”]=>
string(5) “false”
[“direction”]=>
string(7) “receive”
[“rx-size”]=>
string(4) “1500”
}
Response from cmd1 (!re)
array(9) {
[“status”]=>
string(12) “done testing”
[“duration”]=>
string(8) “00:00:05”
[“rx-current”]=>
string(8) “27888048”
[“rx-10-second-average”]=>
string(8) “16868744”
[“rx-total-average”]=>
string(8) “16868744”
[“lost-packets”]=>
string(1) “0”
[“random-data”]=>
string(5) “false”
[“direction”]=>
string(7) “receive”
[“rx-size”]=>
string(4) “1500”
}
I’m using the PHP PEAR2_Net_RouterOS package to send the commands. Ping results seem to come back fine when I run ping through API:
/ping
=count=2
=address=10.0.0.2
.tag=cmd1
Response from cmd1 (!re)
array(10) {
[“host”]=>
string(12) “10.0.0.2”
[“size”]=>
string(2) “56”
[“ttl”]=>
string(2) “64”
[“time”]=>
string(12) “00:00:00.001”
[“sent”]=>
string(1) “1”
[“received”]=>
string(1) “1”
[“packet-loss”]=>
string(1) “0”
[“min-rtt”]=>
string(12) “00:00:00.001”
[“avg-rtt”]=>
string(12) “00:00:00.001”
[“max-rtt”]=>
string(12) “00:00:00.001”
}
Response from cmd1 (!re)
array(10) {
[“host”]=>
string(12) “10.0.0.2”
[“size”]=>
string(2) “56”
[“ttl”]=>
string(2) “64”
[“time”]=>
string(12) “00:00:00.005”
[“sent”]=>
string(1) “2”
[“received”]=>
string(1) “2”
[“packet-loss”]=>
string(1) “0”
[“min-rtt”]=>
string(12) “00:00:00.001”
[“avg-rtt”]=>
string(12) “00:00:00.003”
[“max-rtt”]=>
string(12) “00:00:00.005”
}
Response from cmd1 (!done)
array(0) {
}
You can see the ping has !done but the bandwidth-test does not. I would imagine that when the bandwidth-test completes, it should stop it’s own traffic and issue !done to the API connection.