thaliproject / Thali_CordovaPlugin

Thali p2p plugin
MIT License
226 stars 44 forks source link

Need to detect when an iOS device is on real wifi and when it is not for CI purposes #917

Open yaronyg opened 8 years ago

yaronyg commented 8 years ago

We are going to start rebuilding iOS in CI using the old code (which should build) but not using the native layer. Instead we are going to use our wifi based native mock. This will at least allow us to test the node layer on iOS devices until the native layer is back.

Once we have the native layer on iOS ready we are still going to have some iOS devices connected to the full CI network that allows local multicast (that way we can test WiFi on those iOS devices) and some devices on the CI guest network that doesn't allow local multicast (thus preventing local WiFi from working properly and forcing the devices to use local radios).

To make this all work we have to know for each iOS device if it is on the guest network or the open network. We also have to communicate to all the devices via the coordination server how many iOS devices are on guest vs open. The reason we have to communicate that number is that we have tests that expect to connect to all devices in the test but if we are in WiFi mode that won't work!

We also have to think about desktop testing. How are you going to test at your desks when you need to force the local radios to work in order to follow up on problems if you can't talk to your local coordination server which is on the same network? The way we solved this in CI is that the coordination server actually has a public internet address. So the phones can't reach each other with local addresses but they can use the public internet address of the coordination server to reach it. But that is going to be a pain for you guys to set up. And it brings up security issues. My suggestion is that you buy a router for your office that has a 'child mode'. The child mode lets the parents set up a filter in the router that only allows the devices connected with the identified MAC addresses to reach a white list of locations. Using that you could make it impossible for the devices to see each other on the WiFi access point but you can put your coordination servers (e.g. your macs) into the white list.

And, depending on how your office AP is set up, you may have to set up the special AP with two different networks (a guest and a public, that is commonly supported). The second network would allow the devices to see each other. That way you can run wifi tests.

But now imagine how you run these tests from your desktop? How do you tell the devices which network they are on so that the tests run properly?

I'd like you two to make a proposal for how you would like to resolve this issue.

How do we make sure that when we are running coordinated tests in CI that each phone knows how many of its peers are 'WiFi enabled' and how many are on the guest network?

When we are on a desktop how do we know if the devices are on a guest/child network vs on a network that supports local wifi communication?

dersim-davaod commented 8 years ago

We briefly discussed the issue with Ilya. We need some time to decide how we can resolve it.

yaronyg commented 8 years ago

Why not just check the SSID name?

yaronyg commented 8 years ago

Dersim needs to investigate if we can get the SSID without using a private framework. If we can then we need to enhance networkChanged to return SSID and if we cannot (e.g. we have to have a private framework) then we need a way to get the SSID when we are testing.

dersim-davaod commented 8 years ago

Yes, we can get SSID and BSSID on iOS using public API. New networkChanged function in iOS is already using this API to return BSSID. (See https://github.com/thaliproject/Thali_CordovaPlugin/pull/938)