would like to run scan in a Subscriber Unit (SU)
to determine the signal strengths of the various Access Point (AP) seen by the SU
using:
“routeros_api.class.php”
Probably because when the SU scans for occupancy of the spectrum it disconnects from your server and therefore as you no longer have communication with the SU, it returns no data ?
Yes, Telnet WILL work, but try connecting to the SU with winbox or SSH while it’s scanning. I am sure it will disconnect you. I find Telnet is insecure, but very good for making a remote scan. All other and more secure connections always drop before the scan is complete I find.
you are correct that the SU must use the radio on other channels for the scan and thus is off line during the scan of all channels
not trying to be argumentative but complete
the telnet/IP session does not drop (timeout) during the scan even though the SU is off line = incommunicado
proof:
1.
ping during scan:
64 bytes from 10.106.41.46: icmp_seq=10 ttl=58 time=14.9 ms
64 bytes from 10.106.41.46: icmp_seq=11 ttl=58 time=16.2 ms
64 bytes from 10.106.41.46: icmp_seq=25 ttl=58 time=33.1 ms
64 bytes from 10.106.41.46: icmp_seq=26 ttl=58 time=16.4 ms
64 bytes from 10.106.41.46: icmp_seq=27 ttl=58 time=16.8 ms
here SU was off line for 25 - 11 = 14 seconds but IP session did not drop
the scan results were returned in telnet session with
no second log in required
3.
exactly same behavior with ssh
shame you are not using telnet then! Like I said, I do not believe the api command will ever complete as the scan will break the api connection. Which I believe is the reason why you cannot make it work with api.
You see the problem is I am lazy and I have been using telnet and ssh for automation of device management but I am tired or parsing the replies and some replies are truncated apparently because of the line length control of telnet. In particular the scan results via the perl telnet module are truncated.
I would like to use API because when it does work, the parsing is done for you!
A hymn to Saraswati, the Goddess of Knowledge:
Wonderful is your gift of knowledge
the more we share, the more it grows
the more we hoard it, the more it diminishes
if you have to do once - fr initial setup, you could attempt to create custom OpenWRT image and run API tool connecting to router from within the router and do scan, and get all the data, then connect to best AP and upload data to server. If you have several routers behind wireless link, you could run it on one router with most resources and thus - manage the wireless clients.
project is to manage thousands of SUs
in a dense network where each SU may see several APs
some see as many as eight APs!
idea is to slowly scan network make sure best AP is selected
things in the Fresnel zone move, trees grow etc.
If API won’t work, then maybe use telnet - would have to write once a parser as solve problem of truncation of replies - see example below.
Of maybe a script resident in the SU that could be queried by NOS?
Or maybe SU on its own selects best AP (somewhat complicated by SUs that have static public IPs)
Example of telnet truncation:
partial reply to $command = “/interface wireless scan 0 duration=6”;
debug output - telnet returned line quoted with <>
96: line < ADDRESS SSID BAND CHA.. FREQ SIG NF SNR RADIO-NAME >
96: line <A R B D4:CA:6D:11:5A:C9 Broadban... 5ghz-n 20mhz 5180 -79 -120 41 >
98: line <A R B D4:CA:6D:11:5A:C9 Broadban... 5ghz-n 20mhz 5180 -79 -120 41 >
96: line <A R B D4:CA:6D:11:5A:C6 Broadban... 5ghz-n 20mhz 5200 -73 -120 47 AP Crwn_E2 >
98: line <A R B D4:CA:6D:11:5A:C6 Broadban... 5ghz-n 20mhz 5200 -73 -120 47 AP Crwn_E2 >
96: line <A R B D4:CA:6D:11:5A:D2 Broadban... 5ghz-n 20mhz 5240 -68 -120 52 AP Crown...>
I mean… if the API connection was being terminated after the scan command was issued, shouldn’t this cause an error message/exception/something on PHP’s end? A “!fatal” response at least?
you will receive !fatal if connection is running and there is router fault and connection cannot be held open. If connection is lost, then API reacts to that and closes it. As i wrote before, you can have something like metarouter running your custom code that would be able to connect from within the rotuer, issue scan or whatever operations that will cause router to go offline, gather results and then resume. Gathered data will reside on MetaROUTER guest, or you can automatically cause guest to adjust settings on router and set up wireless connect-list as required.
And you will need OpenWRT or similar to run custom code on it. Just note the requirements for cross-compilation so that your code actually runs on inside it.
But that’s just it - an empty result list means RouterOS closed the connection for some reason, without giving any kind of response (being !fatal, or !trap) to explain why. If the connection cannot be held opened due to a design requirement, I’d expect a !fatal or !trap with a message telling me something like “Connection is terminated in order for the command to finish”.