Ejemplo n.º 1
0
        public bool SetPrerequisiteProperties(Dictionary <string, string> properties)
        {
            detectionInfo.Authentication          = (SecurityPackageType)Enum.Parse(typeof(SecurityPackageType), properties[PropertyDictionaryConstant.AUTHENTICATION]);
            detectionInfo.SUTName                 = properties[PropertyDictionaryConstant.SUTNAME];
            detectionInfo.DomainName              = properties[PropertyDictionaryConstant.DOMAINNAME];
            detectionInfo.UserName                = properties[PropertyDictionaryConstant.SUTUSERNAME];
            detectionInfo.Password                = properties[PropertyDictionaryConstant.SUTPASSWORD];
            detectionInfo.IsWindowsImplementation = Boolean.Parse(properties[PropertyDictionaryConstant.ISWINDOWSIMPLEMENTATION]);
            detectionInfo.ShareFolder             = properties[PropertyDictionaryConstant.SHAREFOLDER];
            detectionInfo.SMBDPort                = UInt16.Parse(properties[PropertyDictionaryConstant.SMBDPORT]);

            detectionInfo.ConnectionTimeout    = TimeSpan.FromSeconds(UInt32.Parse(properties[PropertyDictionaryConstant.CONNECTIONTIMEOUT]));
            detectionInfo.Endian               = (RDMAEndian)Enum.Parse(typeof(RDMAEndian), DetectorUtil.GetPropertyValue(PtfConfigConstant.ENDIANOFBUFFERDESCRIPTOR));
            detectionInfo.SMBDClientCapability = new SMBDClientCapability()
            {
                CreditsRequested  = UInt16.Parse(DetectorUtil.GetPropertyValue(PtfConfigConstant.SENDCREDITTARGET)),
                ReceiveCreditMax  = UInt16.Parse(DetectorUtil.GetPropertyValue(PtfConfigConstant.RECEIVECREDITMAX)),
                PreferredSendSize = UInt32.Parse(DetectorUtil.GetPropertyValue(PtfConfigConstant.MAXSENDSIZE)),
                MaxReceiveSize    = UInt32.Parse(DetectorUtil.GetPropertyValue(PtfConfigConstant.MAXRECEIVESIZE)),
                MaxFragmentedSize = UInt32.Parse(DetectorUtil.GetPropertyValue(PtfConfigConstant.MAXFRAGMENTEDSIZE))
            };
            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get the prerequisites for auto-detection.
        /// </summary>
        /// <returns>A instance of Prerequisites class.</returns>
        public Prerequisites GetPrerequisites()
        {
            var prerequisites = new Prerequisites();

            prerequisites.Title   = "MS-SMBD";
            prerequisites.Summary = "Please input the below info to detect SUT.\r\nIf SUT is in WORKGROUP, leave Domain Name blank.";

            // Properties
            prerequisites.Properties = new Dictionary <string, List <string> >();

            string sutName = DetectorUtil.GetPropertyValue(DeploymentPtfConfigConstant.SUTCOMPUTERNAME);

            prerequisites.Properties.Add(PropertyDictionaryConstant.SUTNAME, new List <string> {
                sutName
            });

            string domainName = DetectorUtil.GetPropertyValue(DeploymentPtfConfigConstant.DOMAINNAME);

            prerequisites.Properties.Add(PropertyDictionaryConstant.DOMAINNAME, new List <string> {
                domainName
            });

            string sutUserName = DetectorUtil.GetPropertyValue(DeploymentPtfConfigConstant.SUTUSERNAME);

            prerequisites.Properties.Add(PropertyDictionaryConstant.SUTUSERNAME, new List <string> {
                sutUserName
            });

            string sutPassword = DetectorUtil.GetPropertyValue(DeploymentPtfConfigConstant.SUTPASSWORD);

            prerequisites.Properties.Add(PropertyDictionaryConstant.SUTPASSWORD, new List <string> {
                sutPassword
            });

            prerequisites.Properties.Add(PropertyDictionaryConstant.AUTHENTICATION, new List <string>()
            {
                SecurityPackageType.Negotiate.ToString(),
                SecurityPackageType.Kerberos.ToString(),
                SecurityPackageType.Ntlm.ToString()
            });

            string shareFolder = DetectorUtil.GetPropertyValue(DeploymentPtfConfigConstant.SHAREFOLDER);

            prerequisites.Properties.Add(PropertyDictionaryConstant.SHAREFOLDER, new List <string> {
                shareFolder
            });

            prerequisites.Properties.Add(PropertyDictionaryConstant.ISWINDOWSIMPLEMENTATION, new List <string> {
                "True", "False"
            });

            string smbdPort = DetectorUtil.GetPropertyValue(PtfConfigConstant.SMBDTCPPORT);

            prerequisites.Properties.Add(PropertyDictionaryConstant.SMBDPORT, new List <string> {
                smbdPort
            });

            string connectionTimeout = DetectorUtil.GetPropertyValue(PtfConfigConstant.SMB2CONNECTIONTIMEOUTINSECONDS);

            prerequisites.Properties.Add(PropertyDictionaryConstant.CONNECTIONTIMEOUT, new List <string> {
                connectionTimeout
            });

            return(prerequisites);
        }
        /// <summary>
        /// Get the prerequisites for auto-detection: Read the configuration values from .ptfconfig file into prerequisites.Properties
        /// </summary>
        /// <returns>A instance of Prerequisites class.</returns>
        public Prerequisites GetPrerequisites()
        {
            Prerequisites prerequisites = new Prerequisites();

            prerequisites.Title   = "Pre-Detect Configure";
            prerequisites.Summary = "Please input below info to detect SUT.\r\nIf SUT is ContentServer, leave \"HostedCache Server Name\" as blank.";

            Dictionary <string, List <string> > propertiesDic = new Dictionary <string, List <string> >();

            #region Set Properties

            //Retrieve saved value from *.ptfconfig file
            string contentServerName     = DetectorUtil.GetPropertyValue("ContentServerComputerName");
            string hostedCacheServerName = DetectorUtil.GetPropertyValue("HostedCacheServerComputerName");
            string domain           = DetectorUtil.GetPropertyValue("DomainName");
            string user             = DetectorUtil.GetPropertyValue("UserName");
            string password         = DetectorUtil.GetPropertyValue("UserPassword");
            string contentTransport = DetectorUtil.GetPropertyValue("ContentTransport");
            string uncSharePath     = DetectorUtil.GetPropertyValue("SharedFolderName");

            List <string> contentServerList     = new List <string>();
            List <string> hostedCacheServerList = new List <string>();
            List <string> domainList            = new List <string>();
            List <string> SUTList          = new List <string>();
            List <string> userList         = new List <string>();
            List <string> passwordList     = new List <string>();
            List <string> transportList    = new List <string>();
            List <string> uncSharePathList = new List <string>();

            if (string.IsNullOrWhiteSpace(contentServerName) ||
                string.IsNullOrWhiteSpace(hostedCacheServerName) ||
                string.IsNullOrWhiteSpace(domain) ||
                string.IsNullOrWhiteSpace(user) ||
                string.IsNullOrWhiteSpace(password) ||
                string.IsNullOrWhiteSpace(contentTransport) ||
                string.IsNullOrWhiteSpace(uncSharePath))
            {
                contentServerList.Add("ContentServer");
                hostedCacheServerList.Add("HostedCacheServer");
                domainList.Add("contoso.com");
                userList.Add("administrator");
                passwordList.Add("Password01!");
                transportList.Add("SMB2");
                uncSharePathList.Add("C:\\FileShare");
            }
            else
            {
                contentServerList.Add(contentServerName);
                hostedCacheServerList.Add(hostedCacheServerName);
                domainList.Add(domain);
                userList.Add(user);
                passwordList.Add(password);
                transportList.Add(contentTransport);
                uncSharePathList.Add(uncSharePath);
            }

            propertiesDic.Add(ContentServerTitle, contentServerList);
            propertiesDic.Add(HostedCacheServerTitle, hostedCacheServerList);
            propertiesDic.Add(domainTitle, domainList);
            propertiesDic.Add(userTitle, userList);
            propertiesDic.Add(passwordTitle, passwordList);
            propertiesDic.Add(contentTransportTitle, transportList);
            propertiesDic.Add(uncSharePathTitle, uncSharePathList);

            //Get the real environment DomainName
            string domainName = IPGlobalProperties.GetIPGlobalProperties().DomainName;

            #endregion

            prerequisites.Properties = propertiesDic;

            return(prerequisites);
        }