public MFTestResults NetworkInterfaceTest3_DynamicIP_DynamicDNS() { MFTestResults testResult = MFTestResults.Fail; //don't run these tests on the emulator. The emulator is SKU # 3 if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3) { return(MFTestResults.Skip); } for (int i = 0; i < NetworkInterface.GetAllNetworkInterfaces().Length; ++i) { NetworkInterface testNI = NetworkInterface.GetAllNetworkInterfaces()[i]; IPSettings ipSettings = new IPSettings(testNI); try { Log.Comment("EnableDhcp"); testNI.EnableDhcp(); if (!testNI.IsDhcpEnabled) { throw new Exception("IsDhcpEnabled data incorrect after EnableDhcp"); } try { Log.Comment("EnableDynamicDns"); testNI.EnableDynamicDns(); } catch { Log.Comment("correctly throws an exception for EnableDynamicDNS which isn't supported"); testResult = MFTestResults.Pass; } Log.Comment("should not be set since it is not supported."); if (testNI.IsDynamicDnsEnabled) { throw new Exception("IsDynamicDnsEnabled data incorrect after EnableDhcp"); } testResult = MFTestResults.Pass; } catch (Exception e) { Log.Comment("Exception: " + e.ToString()); testResult = MFTestResults.Fail; break; } finally { ipSettings.Restore(testNI); } } Log.Comment("Fixed Bug number: 20533 IsDynamicDnsEnabled incorrectly returns true after call to EnableDynamicDns()."); return(testResult); }
public MFTestResults NetworkInterfaceTest6_StaticIP_DynamicDNS() { MFTestResults testResult = MFTestResults.Fail; //don't run these tests on the emulator. The emulator is SKU # 3 if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3) { return(MFTestResults.Skip); } for (int i = 0; i < NetworkInterface.GetAllNetworkInterfaces().Length; ++i) { NetworkInterface testNI = NetworkInterface.GetAllNetworkInterfaces()[i]; IPSettings ipSettings = new IPSettings(testNI); try { Log.Comment("EnableStaticIP"); testNI.EnableStaticIP("157.54.14.192", testNI.SubnetMask, testNI.GatewayAddress); if (testNI.IsDhcpEnabled) { throw new Exception("IsDhcpEnabled data incorrect after EnableStaticIP"); } try { Log.Comment("EnableDynamicDns should fail"); testNI.EnableDynamicDns(); testResult = MFTestResults.Fail; } catch (Exception e) { Log.Comment("Expected Exception: " + e.ToString()); Log.Comment("Trying to enable Dynamic DNS with a Static IP address correctly fails"); testResult = MFTestResults.Pass; } if (testNI.IsDynamicDnsEnabled) { throw new Exception("IsDynamicDnsEnabled data incorrect"); } } catch (Exception e) { Log.Comment("Exception: " + e.ToString()); testResult = MFTestResults.Fail; } finally { ipSettings.Restore(testNI); } } return(testResult); }
public MFTestResults NetworkInterfaceTest7_DhcpRenewRelease() { /// <summary> /// 1. Save network configuration /// 2. Enable Dhcp (if not enabled) /// 3. Test Dhcp Release/Renew /// 4. Restore network configuration /// </summary> /// MFTestResults testResult = MFTestResults.Pass; //don't run these tests on the emulator. The emulator is SKU # 3 if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3) { return(MFTestResults.Skip); } try { for (int i = 0; i < NetworkInterface.GetAllNetworkInterfaces().Length; ++i) { NetworkInterface testNI = NetworkInterface.GetAllNetworkInterfaces()[i]; IPSettings ipConfig = new IPSettings(testNI); try { Log.Comment("EnableDhcp"); testNI.EnableDhcp(); Log.Comment(" make sure we can release"); testNI.ReleaseDhcpLease(); Log.Comment(" make sure we can renew"); testNI.RenewDhcpLease(); } catch (Exception e) { Log.Comment("Caught exception: " + e.Message); testResult = MFTestResults.Fail; } finally { ipConfig.Restore(testNI); } } } catch (Exception e) { Log.Comment("Caught exception: " + e.Message); testResult = MFTestResults.Fail; } return(testResult); }
public MFTestResults NetworkInterfaceTest0_EnableStaticDnsTwice() { //don't run these tests on the emulator. The emulator is SKU # 3 if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3) { return(MFTestResults.Skip); } MFTestResults testResult = MFTestResults.Pass; try { NetworkInterface[] nis = NetworkInterface.GetAllNetworkInterfaces(); for (int i = 0; i < nis.Length; i++) { NetworkInterface testNI = nis[i]; IPSettings ipSettings = new IPSettings(testNI); try { String [] dnsAddresses = new string[] { "0.0.0.0", "0.0.0.0" }; for (int j = 0; j < testNI.DnsAddresses.Length; ++j) { dnsAddresses[j] = testNI.DnsAddresses[j]; } //This double call to EnableStaticDns() is for the following bug that was fixed. //Do not remove. //19756 EBS: Call EnableStaticDns() twice then set the staticDnsAddresses and the device will throw an Abort Data. Log.Comment("EnableStaticDns"); testNI.EnableStaticDns(dnsAddresses); Log.Comment("EnableStaticDns"); testNI.EnableStaticDns(dnsAddresses); } finally { ipSettings.Restore(testNI); //grab the newly restored settings and display the information for debugging. ipSettings = new IPSettings(testNI); } } } catch (Exception e) { Log.Comment("Exception: " + e.ToString()); testResult = MFTestResults.Fail; } return(testResult); }
public MFTestResults NetworkInterfaceTest4_DynamicIP_StaticDNS() { MFTestResults testResult = MFTestResults.Fail; //don't run these tests on the emulator. The emulator is SKU # 3 if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3) { return(MFTestResults.Skip); } for (int i = 0; i < NetworkInterface.GetAllNetworkInterfaces().Length; ++i) { NetworkInterface testNI = NetworkInterface.GetAllNetworkInterfaces()[i]; IPSettings ipSettings = new IPSettings(testNI); try { Log.Comment("EnableDhcp"); testNI.EnableDhcp(); if (!testNI.IsDhcpEnabled) { throw new Exception("IsDhcpEnabled data incorrect after EnableDhcp"); } Log.Comment("EnableStaticDns"); testNI.EnableStaticDns(new string[] { "157.54.14.146" }); if (testNI.IsDynamicDnsEnabled) { throw new Exception("IsDynamicDnsEnabled data incorrect after EnableStaticDns"); } testResult = MFTestResults.Pass; } catch (Exception e) { Log.Comment("Exception: " + e.ToString()); testResult = MFTestResults.Fail; break; } finally { ipSettings.Restore(testNI); } } return(testResult); }
public MFTestResults NetworkInterfaceTest0_EnableStaticDnsTwice() { //don't run these tests on the emulator. The emulator is SKU # 3 if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3) return MFTestResults.Skip; MFTestResults testResult = MFTestResults.Pass; try { NetworkInterface[] nis = NetworkInterface.GetAllNetworkInterfaces(); for (int i = 0; i < nis.Length; i++) { NetworkInterface testNI = nis[i]; IPSettings ipSettings = new IPSettings(testNI); try { String [] dnsAddresses = new string[] { "0.0.0.0", "0.0.0.0" }; for (int j = 0; j < testNI.DnsAddresses.Length; ++j) { dnsAddresses[j] = testNI.DnsAddresses[j]; } //This double call to EnableStaticDns() is for the following bug that was fixed. //Do not remove. //19756 EBS: Call EnableStaticDns() twice then set the staticDnsAddresses and the device will throw an Abort Data. Log.Comment("EnableStaticDns"); testNI.EnableStaticDns(dnsAddresses); Log.Comment("EnableStaticDns"); testNI.EnableStaticDns(dnsAddresses); } finally { ipSettings.Restore(testNI); //grab the newly restored settings and display the information for debugging. ipSettings = new IPSettings(testNI); } } } catch (Exception e) { Log.Comment("Exception: " + e.ToString()); testResult = MFTestResults.Fail; } return testResult; }
public MFTestResults NetworkInterfaceTest8_GetHostEntry() { /// <summary> /// 1. Save network configuration /// 2. Enable Static IP (bad address) /// 3. Enable Static DNS /// 4. Test GetHostEntry /// 5. Restore network configuration /// </summary> /// MFTestResults testResult = MFTestResults.Pass; //don't run these tests on the emulator. The emulator is SKU # 3 if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3) return MFTestResults.Skip; try { for (int i = 0; i < NetworkInterface.GetAllNetworkInterfaces().Length; ++i) { NetworkInterface testNI = NetworkInterface.GetAllNetworkInterfaces()[i]; IPSettings ipConfig = new IPSettings(testNI); try { Log.Comment("EnableDhcp"); testNI.EnableDhcp(); // leave the addresses alone, they are supposed to be somewhat bogus Log.Comment("misconfigure the static IP configuration"); testNI.EnableStaticIP(testNI.IPAddress, testNI.SubnetMask, testNI.GatewayAddress); testNI.EnableStaticDns(new string[] { "157.54.14.146", "157.54.14.178" }); Log.Comment("get a DNS server host entry"); IPHostEntry entry = Dns.GetHostEntry("msw.dns.microsoft.com"); } catch (SocketException e) { Log.Comment("SocketException error code: " + e.ErrorCode); Log.Comment(e.Message); testResult = MFTestResults.Fail; } catch (Exception e) { Log.Comment("Caught exception: " + e.Message); testResult = MFTestResults.Fail; } finally { ipConfig.Restore(testNI); } } } catch (Exception e) { Log.Comment("Caught exception: " + e.Message); testResult = MFTestResults.Fail; } Log.Comment("Bug number: 20845 GetHostEntry(\"msw.dns.microsoft.com\") fails with socket error code -1 on imxs_net platform"); return testResult; }
public MFTestResults NetworkInterfaceTest7_DhcpRenewRelease() { /// <summary> /// 1. Save network configuration /// 2. Enable Dhcp (if not enabled) /// 3. Test Dhcp Release/Renew /// 4. Restore network configuration /// </summary> /// MFTestResults testResult = MFTestResults.Pass; //don't run these tests on the emulator. The emulator is SKU # 3 if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3) return MFTestResults.Skip; try { for (int i = 0; i < NetworkInterface.GetAllNetworkInterfaces().Length; ++i) { NetworkInterface testNI = NetworkInterface.GetAllNetworkInterfaces()[i]; IPSettings ipConfig = new IPSettings(testNI); try { Log.Comment("EnableDhcp"); testNI.EnableDhcp(); Log.Comment(" make sure we can release"); testNI.ReleaseDhcpLease(); Log.Comment(" make sure we can renew"); testNI.RenewDhcpLease(); } catch (Exception e) { Log.Comment("Caught exception: " + e.Message); testResult = MFTestResults.Fail; } finally { ipConfig.Restore(testNI); } } } catch (Exception e) { Log.Comment("Caught exception: " + e.Message); testResult = MFTestResults.Fail; } return testResult; }
public MFTestResults NetworkInterfaceTest6_StaticIP_DynamicDNS() { MFTestResults testResult = MFTestResults.Fail; //don't run these tests on the emulator. The emulator is SKU # 3 if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3) return MFTestResults.Skip; for (int i = 0; i < NetworkInterface.GetAllNetworkInterfaces().Length; ++i) { NetworkInterface testNI = NetworkInterface.GetAllNetworkInterfaces()[i]; IPSettings ipSettings = new IPSettings(testNI); try { Log.Comment("EnableStaticIP"); testNI.EnableStaticIP("157.54.14.192", testNI.SubnetMask, testNI.GatewayAddress); if (testNI.IsDhcpEnabled) throw new Exception("IsDhcpEnabled data incorrect after EnableStaticIP"); try { Log.Comment("EnableDynamicDns should fail"); testNI.EnableDynamicDns(); } catch (Exception e) { Log.Comment("Exception: " + e.ToString()); Log.Comment("Trying to enable Dynamic DNS with a Static IP address correctly fails"); testResult = MFTestResults.Pass; } if (testNI.IsDynamicDnsEnabled) testResult = MFTestResults.Fail; } catch (Exception e) { Log.Comment("Exception: " + e.ToString()); testResult = MFTestResults.Fail; } finally { ipSettings.Restore(testNI); } } Log.Comment("Fixed Bug number: 20533 IsDynamicDnsEnabled incorrectly returns true after call to EnableDynamicDns()."); return testResult; }
public MFTestResults NetworkInterfaceTest5_StaticIP_StaticDNS() { MFTestResults testResult = MFTestResults.Fail; //don't run these tests on the emulator. The emulator is SKU # 3 if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3) return MFTestResults.Skip; for (int i = 0; i < NetworkInterface.GetAllNetworkInterfaces().Length; ++i) { NetworkInterface testNI = NetworkInterface.GetAllNetworkInterfaces()[i]; IPSettings ipSettings = new IPSettings(testNI); try { Log.Comment("EnableStaticIP"); testNI.EnableStaticIP("157.54.14.192", testNI.SubnetMask, testNI.GatewayAddress); if (testNI.IsDhcpEnabled) throw new Exception("IsDhcpEnabled data incorrect after EnableStaticIP"); Log.Comment("EnableStaticDns"); testNI.EnableStaticDns(new string[] { "157.54.14.146" }); if (testNI.IsDynamicDnsEnabled) throw new Exception("IsDynamicDnsEnabled data incorrect after EnableStaticDns"); testResult = MFTestResults.Pass; } catch (Exception e) { Log.Comment("Exception: " + e.ToString()); testResult = MFTestResults.Fail; break; } finally { ipSettings.Restore(testNI); } } return testResult; }
public MFTestResults NetworkInterfaceTest3_DynamicIP_DynamicDNS() { MFTestResults testResult = MFTestResults.Fail; //don't run these tests on the emulator. The emulator is SKU # 3 if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3) return MFTestResults.Skip; for (int i = 0; i < NetworkInterface.GetAllNetworkInterfaces().Length; ++i) { NetworkInterface testNI = NetworkInterface.GetAllNetworkInterfaces()[i]; IPSettings ipSettings = new IPSettings(testNI); try { Log.Comment("EnableDhcp"); testNI.EnableDhcp(); if (!testNI.IsDhcpEnabled) throw new Exception("IsDhcpEnabled data incorrect after EnableDhcp"); try { Log.Comment("EnableDynamicDns"); testNI.EnableDynamicDns(); } catch { Log.Comment("correctly throws an exception for EnableDynamicDNS which isn't supported"); testResult = MFTestResults.Pass; } Log.Comment("should not be set since it is not supported."); if (testNI.IsDynamicDnsEnabled) throw new Exception("IsDynamicDnsEnabled data incorrect after EnableDhcp"); testResult = MFTestResults.Pass; } catch (Exception e) { Log.Comment("Exception: " + e.ToString()); testResult = MFTestResults.Fail; break; } finally { ipSettings.Restore(testNI); } } Log.Comment("Fixed Bug number: 20533 IsDynamicDnsEnabled incorrectly returns true after call to EnableDynamicDns()."); return testResult; }
public MFTestResults NetworkInterfaceTest8_GetHostEntry() { /// <summary> /// 1. Save network configuration /// 2. Enable Static IP (bad address) /// 3. Enable Static DNS /// 4. Test GetHostEntry /// 5. Restore network configuration /// </summary> /// MFTestResults testResult = MFTestResults.Pass; //don't run these tests on the emulator. The emulator is SKU # 3 if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3) { return(MFTestResults.Skip); } try { for (int i = 0; i < NetworkInterface.GetAllNetworkInterfaces().Length; ++i) { NetworkInterface testNI = NetworkInterface.GetAllNetworkInterfaces()[i]; IPSettings ipConfig = new IPSettings(testNI); try { Log.Comment("EnableDhcp"); testNI.EnableDhcp(); // leave the addresses alone, they are supposed to be somewhat bogus Log.Comment("misconfigure the static IP configuration"); testNI.EnableStaticIP(testNI.IPAddress, testNI.SubnetMask, testNI.GatewayAddress); testNI.EnableStaticDns(new string[] { "157.54.14.146", "157.54.14.178" }); Log.Comment("get a DNS server host entry"); IPHostEntry entry = Dns.GetHostEntry("msw.dns.microsoft.com"); } catch (SocketException e) { Log.Comment("SocketException error code: " + e.ErrorCode); Log.Comment(e.Message); testResult = MFTestResults.Fail; } catch (Exception e) { Log.Comment("Caught exception: " + e.Message); testResult = MFTestResults.Fail; } finally { ipConfig.Restore(testNI); } } } catch (Exception e) { Log.Comment("Caught exception: " + e.Message); testResult = MFTestResults.Fail; } Log.Comment("Bug number: 20845 GetHostEntry(\"msw.dns.microsoft.com\") fails with socket error code -1 on imxs_net platform"); return(testResult); }
public MFTestResults NetworkInterfaceTest4_DynamicIP_StaticDNS() { MFTestResults testResult = MFTestResults.Fail; //don't run these tests on the emulator. The emulator is SKU # 3 if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU == 3) return MFTestResults.Skip; for (int i = 0; i < NetworkInterface.GetAllNetworkInterfaces().Length; ++i) { NetworkInterface testNI = NetworkInterface.GetAllNetworkInterfaces()[i]; IPSettings ipSettings = new IPSettings(testNI); try { Log.Comment("EnableDhcp"); testNI.EnableDhcp(); if (!testNI.IsDhcpEnabled) throw new Exception("IsDhcpEnabled data incorrect after EnableDhcp"); try { // The combination of DHCP and StaticDNS is not supported at the moment Log.Comment("EnableStaticDns should fail"); testNI.EnableStaticDns(new string[] { "157.54.14.146" }); testResult = MFTestResults.Fail; } catch (Exception e) { Log.Comment("Expected Exception: " + e.ToString()); Log.Comment("Trying to enable Dynamic DNS with a Static IP address correctly fails"); testResult = MFTestResults.Pass; } if (!testNI.IsDynamicDnsEnabled) throw new Exception("IsDynamicDnsEnabled data incorrect"); testResult = MFTestResults.Pass; } catch (Exception e) { Log.Comment("Exception: " + e.ToString()); testResult = MFTestResults.Fail; break; } finally { ipSettings.Restore(testNI); } } return testResult; }