public void Restore(NetworkInterface networkInterface)
            {
                Log.Comment("Return the IP settings to their original state before the test started");

                if (m_dhcp)
                {
                    Log.Comment("EnableDhcp");
                    networkInterface.EnableDhcp();
                }
                else
                {
                    Log.Comment("EnableStaticIP");
                    networkInterface.EnableStaticIP(m_ipAddress, m_subNetMask, m_gatewayAddress);
                }

                if (m_dynamicDns)
                {
                    Log.Comment("EnableDynamicDns");
                    networkInterface.EnableDynamicDns();
                }
                else
                {
                    Log.Comment("EnableStaticDns");
                    networkInterface.EnableStaticDns(m_staticDnsAddresses);
                }

            }
Example #2
0
 private void FixIPAddress(NetworkInterface ni)
 {
     if (ni.IsDhcpEnabled)
     {
         ni.RenewDhcpLease();
         Thread.Sleep(500);
         ipAddress = ni.IPAddress;
         if (ipAddress == "0.0.0.0")
         {
             ipAddress = ni.IPAddress;
         }
     }
     else
     {
         ni.EnableDhcp();
         Thread.Sleep(500);
         ipAddress = ni.IPAddress;
     }
 }