Ejemplo n.º 1
0
        public TestSuiteParameters GetTestSuiteParameters()
        {
            TestSuiteParameters parameters = new TestSuiteParameters();

            if (Device != null)
            {
                parameters.Address = Device.DeviceServiceAddress;

                //parameters.CameraUUID
            }

            if (string.IsNullOrEmpty(parameters.Address))
            {
                Console.WriteLine("Mandatory parameters (Device address) not defined!");
                return(null);
            }

            Timeouts     defTimeouts = new Timeouts();
            TestSettings defSettings = new TestSettings();

            if (TestParameters != null)
            {
                parameters.MessageTimeout = (0 != TestParameters.MessageTimeout)
                                                ? TestParameters.MessageTimeout
                                                : defTimeouts.Message;
                parameters.RebootTimeout = (0 != TestParameters.RebootTimeout)
                                               ? TestParameters.RebootTimeout
                                               : defTimeouts.Reboot;
                parameters.RecoveryDelay    = TestParameters.TimeBetweenRequests;
                parameters.TimeBetweenTests = TestParameters.TimeBetweenTests;
                parameters.OperationDelay   = (0 != TestParameters.OperationDelay)
                                                ? TestParameters.OperationDelay
                                                : defSettings.OperationDelay;

                parameters.UserName = TestParameters.UserName;
                parameters.Password = TestParameters.Password;

                parameters.EnvironmentSettings = new EnvironmentSettings();
                parameters.EnvironmentSettings.DefaultGateway     = TestParameters.DefaultGatewayIpv4;
                parameters.EnvironmentSettings.DefaultGatewayIpv6 = TestParameters.DefaultGatewayIpv6;
                parameters.EnvironmentSettings.DnsIpv4            = TestParameters.DnsIpv4;
                parameters.EnvironmentSettings.DnsIpv6            = TestParameters.DnsIpv6;
                parameters.EnvironmentSettings.NtpIpv4            = TestParameters.NtpIpv4;
                parameters.EnvironmentSettings.NtpIpv6            = TestParameters.NtpIpv6;

                if (!string.IsNullOrEmpty(TestParameters.Address))
                {
                    // get all "own" addresses;

                    List <NetworkInterfaceDescription> nics = DiscoveryHelper.GetNetworkInterfaces();

                    // select required address (compare strings)
                    foreach (NetworkInterfaceDescription nic in nics)
                    {
                        if (nic.IP.ToString() == TestParameters.Address)
                        {
                            parameters.NetworkInterfaceController = nic;
                            break;
                        }
                    }

                    if (parameters.NetworkInterfaceController != null)
                    {
                        // define device IP
                        bool ipv6 = (parameters.NetworkInterfaceController.IP != null) &&
                                    (parameters.NetworkInterfaceController.IP.AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6);
                        parameters.CameraIP = DiscoveryUtils.GetIP(Device.DeviceIP, ipv6);
                    }
                }

                parameters.UseEmbeddedPassword = TestParameters.UseEmbeddedPassword;
                parameters.Password1           = TestParameters.Password1;
                parameters.Password2           = TestParameters.Password2;
                parameters.SecureMethod        = !string.IsNullOrEmpty(TestParameters.SecureMethod)
                                              ? TestParameters.SecureMethod
                                              : defSettings.SecureMethod;
                parameters.PTZNodeToken        = TestParameters.PTZNodeToken;
                parameters.VideoSourceToken    = TestParameters.VideoSourceToken;
                parameters.EventTopic          = TestParameters.EventTopic;
                parameters.SubscriptionTimeout = (0 != TestParameters.SubscriptionTimeout)
                                                     ? TestParameters.SubscriptionTimeout
                                                     : defSettings.SubscriptionTimeout;
                parameters.TopicNamespaces = TestParameters.TopicNamespaces;
                parameters.RelayOutputDelayTimeMonostable = (0 != TestParameters.RelayOutputDelayTime)
                                                                ? TestParameters.RelayOutputDelayTime
                                                                : defSettings.RelayOutputDelayTimeMonostable;
            }

            //

            return(parameters);
        }