public void StartVMFromTemplate(string ServerIP, string ServerUserName, string ServerPassword, string VMName, string TemplateIdentifier) { XenServer XenObj = new XenServer(); XenObj.InstallVMFromTemplate(ServerIP, ServerUserName, ServerPassword, VMName, TemplateIdentifier); XenObj.StartVM(ServerIP, ServerUserName, ServerPassword, "name-label", VMName); }
/// <summary> /// Validates the options and also ensures that all <c>null</c> properties are /// initialized to their default values. /// </summary> /// <param name="clusterDefinition">The cluster definition.</param> /// <exception cref="ClusterDefinitionException">Thrown if the definition is not valid.</exception> public void Validate(ClusterDefinition clusterDefinition) { Covenant.Requires <ArgumentNullException>(clusterDefinition != null, nameof(clusterDefinition)); switch (Environment) { case HostingEnvironment.Aws: if (Aws == null) { throw new ClusterDefinitionException($"[{nameof(ClusterDefinition.Hosting)}.{nameof(Aws)}] must be initialized when cloud provider is [{Environment}]."); } Aws.Validate(clusterDefinition); Cloud = Cloud ?? new CloudOptions(); Cloud.Validate(clusterDefinition); break; case HostingEnvironment.Azure: if (Azure == null) { throw new ClusterDefinitionException($"[{nameof(ClusterDefinition.Hosting)}.{nameof(Azure)}] must be initialized when cloud provider is [{Environment}]."); } Azure.Validate(clusterDefinition); Cloud = Cloud ?? new CloudOptions(); Cloud.Validate(clusterDefinition); break; case HostingEnvironment.BareMetal: Machine = Machine ?? new MachineHostingOptions(); Machine.Validate(clusterDefinition); break; case HostingEnvironment.Google: if (Google == null) { throw new ClusterDefinitionException($"[{nameof(ClusterDefinition.Hosting)}.{nameof(Google)}] must be initialized when cloud provider is [{Environment}]."); } Google.Validate(clusterDefinition); Cloud = Cloud ?? new CloudOptions(); Cloud.Validate(clusterDefinition); break; case HostingEnvironment.HyperV: HyperV = HyperV ?? new HyperVHostingOptions(); HyperV.Validate(clusterDefinition); Vm = Vm ?? new VmHostingOptions(); Vm.Validate(clusterDefinition); break; case HostingEnvironment.XenServer: XenServer = XenServer ?? new XenServerHostingOptions(); XenServer.Validate(clusterDefinition); Cloud = Cloud ?? new CloudOptions(); Cloud.Validate(clusterDefinition); Vm = Vm ?? new VmHostingOptions(); Vm.Validate(clusterDefinition); break; default: throw new NotImplementedException(); } }
public void Validate(ClusterDefinition clusterDefinition) { Covenant.Requires <ArgumentNullException>(clusterDefinition != null, nameof(clusterDefinition)); switch (Environment) { case HostingEnvironments.Aws: if (Aws == null) { throw new ClusterDefinitionException($"[{nameof(HostingOptions)}.{nameof(Aws)}] must be initialized when cloud provider is [{Environment}]."); } Aws.Validate(clusterDefinition); break; case HostingEnvironments.Azure: if (Azure == null) { throw new ClusterDefinitionException($"[{nameof(HostingOptions)}.{nameof(Azure)}] must be initialized when cloud provider is [{Environment}]."); } Azure.Validate(clusterDefinition); break; case HostingEnvironments.Google: if (Google == null) { throw new ClusterDefinitionException($"[{nameof(HostingOptions)}.{nameof(Google)}] must be initialized when cloud provider is [{Environment}]."); } Google.Validate(clusterDefinition); break; case HostingEnvironments.HyperV: HyperV = HyperV ?? new HyperVOptions(); HyperV.Validate(clusterDefinition); break; case HostingEnvironments.HyperVLocal: HyperVDev = HyperVDev ?? new LocalHyperVOptions(); HyperVDev.Validate(clusterDefinition); break; case HostingEnvironments.Machine: Machine = Machine ?? new MachineOptions(); Machine.Validate(clusterDefinition); break; case HostingEnvironments.XenServer: XenServer = XenServer ?? new XenServerOptions(); XenServer.Validate(clusterDefinition); break; default: throw new NotImplementedException(); } if (!string.IsNullOrWhiteSpace(VmNamePrefix)) { if (!ClusterDefinition.IsValidName(VmNamePrefix)) { throw new ClusterDefinitionException($"[{nameof(HostingOptions)}.{nameof(VmNamePrefix)}={VmNamePrefix}] must include only letters, digits, underscores, or periods."); } } }
public void Validate(HiveDefinition hiveDefinition) { Covenant.Requires <ArgumentNullException>(hiveDefinition != null); switch (Environment) { case HostingEnvironments.Aws: if (Aws == null) { throw new HiveDefinitionException($"[{nameof(HostingOptions)}.{nameof(Aws)}] must be initialized when cloud provider is [{Environment}]."); } Aws.Validate(hiveDefinition); break; case HostingEnvironments.Azure: if (Azure == null) { throw new HiveDefinitionException($"[{nameof(HostingOptions)}.{nameof(Azure)}] must be initialized when cloud provider is [{Environment}]."); } Azure.Validate(hiveDefinition); break; case HostingEnvironments.Google: if (Google == null) { throw new HiveDefinitionException($"[{nameof(HostingOptions)}.{nameof(Google)}] must be initialized when cloud provider is [{Environment}]."); } Google.Validate(hiveDefinition); break; case HostingEnvironments.HyperV: HyperV = HyperV ?? new HyperVOptions(); HyperV.Validate(hiveDefinition); break; case HostingEnvironments.HyperVDev: LocalHyperV = LocalHyperV ?? new LocalHyperVOptions(); LocalHyperV.Validate(hiveDefinition); break; case HostingEnvironments.Machine: Machine = Machine ?? new MachineOptions(); Machine.Validate(hiveDefinition); break; case HostingEnvironments.XenServer: XenServer = XenServer ?? new XenServerOptions(); XenServer.Validate(hiveDefinition); break; default: throw new NotImplementedException(); } if (IsCloudProvider && !hiveDefinition.Vpn.Enabled) { // VPN is implicitly enabled when hosting on a cloud. hiveDefinition.Vpn.Enabled = true; } if (!string.IsNullOrWhiteSpace(VmNamePrefix)) { if (!HiveDefinition.IsValidName(VmNamePrefix)) { throw new HiveDefinitionException($"[{nameof(HostingOptions)}.{nameof(VmNamePrefix)}={VmNamePrefix}] must include only letters, digits, underscores, or periods."); } } }
static void Main(string[] args) { XenCenter NewOprtorObj = new XenCenter(); Logger NewLogObj = new Logger(); NewLogObj.CreateLogFolder(); string LogFilePath = NewLogObj.CreateLogFile(); AutomationElementIdentity GuiObj = new AutomationElementIdentity(); Guizard NewGuiZardObj = new Guizard(); FileOperations FileObj = new FileOperations(); Generic GenericObj = new Generic(); XenServer XenObj = new XenServer(); // Session session =XenObj.Login("10.105.83.51", 80, "root", "citrix"); // XenObj.GetVMParam(session, "GSEN-Win7x86_29aug2012_1", "IP"); Generic NewGenericObj = new Generic(); //int ProcessStatus = NewGenericObj.CheckIfProcessIsRunning("GUIzard_3"); FileObj.FinishCurrentTest("MyTest"); //string cur = Thread.CurrentThread.CurrentCulture.Name; //CultureInfo us = new CultureInfo("zh-CN"); //string shortUsDateFormatString = us.DateTimeFormat.ShortDatePattern; // string shortUsTimeFormatString = us.DateTimeFormat.ShortTimePattern; // string LabelPanel1 = "General"; // string LabelPanel2 = "Custom Fields"; // string InputFilePath = FileObj.GetInputFilePath(LogFilePath, "Inputs.txt"); // string XenServerName = FileObj.GetInputPattern(InputFilePath, "AddedXenServerDisplayName"); // string ChangeHyperlink = "Change..."; // string EditTagsHyperlink = "Edit tags..."; // string LocalizedFilePath = FileObj.GetLocalizedFilePath(); // if (LocalizedFilePath != null) // { // LabelPanel1 = FileObj.GetLocalizedMappedPattern(LocalizedFilePath, LabelPanel1); // LabelPanel2 = FileObj.GetLocalizedMappedPattern(LocalizedFilePath, LabelPanel2); // ChangeHyperlink = FileObj.GetLocalizedMappedPattern(LocalizedFilePath, ChangeHyperlink); // EditTagsHyperlink = FileObj.GetLocalizedMappedPattern(LocalizedFilePath, EditTagsHyperlink); // } // AutomationElement XenCenterObj = NewOprtorObj.SetFocusOnWindow(AutomationElement.RootElement, "NameProperty", "XenCenter", TreeScope.Children, "XenCenter", 1, LogFilePath); // AutomationElement ServerObj = NewOprtorObj.CheckXenCenterServerNodetree(XenCenterObj, XenServerName, LogFilePath, 1, 1, "Right"); // // Open properties // System.Windows.Forms.SendKeys.SendWait("r"); // Thread.Sleep(2000); // AutomationElement PropertiesWindow=GenericObj.VerifyWindowOnScreen(XenCenterObj, "EditHostGeneralSettingsDialog", "TabTitle", LabelPanel1, 1); // PropertyCondition ParentListCondition = GuiObj.SetPropertyCondition("AutomationIdProperty", "verticalTabs", 1, LogFilePath); // AutomationElement ParentListObj = GuiObj.FindAutomationElement(PropertiesWindow, ParentListCondition, TreeScope.Descendants, "ParentListCondition", 1, LogFilePath); // //Select customfields tab // //GuiObj.SelectItemFromParent(ParentListObj, LabelPanel2, 1); //AutomationElement ListElement= GuiObj.GetListElementAndSelect(ParentListObj,1,3,LabelPanel2, 1); //System.Windows.Point ClickablePoint = ListElement.GetClickablePoint(); //System.Drawing.Point p = new System.Drawing.Point(Convert.ToInt32(ClickablePoint.X), Convert.ToInt32(ClickablePoint.Y)); //Microsoft.Test.Input.Mouse.MoveTo(p); // Thread.Sleep(2000); //Microsoft.Test.Input.Mouse.Click(Microsoft.Test.Input.MouseButton.Left); // NewGuiZardObj.VerifyGuiZardResults(); //NewGuiZardObj.KillGuizard(); System.Console.WriteLine("Finsihed"); //string LogFilePath = NewLogObj.GetLogFilePath(); //NewGuiZardObj.VerifyGuiZardHasFinishedCapturing(AddServerDialog, "AddServerDialog"); //string AddServerDialog = "Add New Server"; //string LocalizedFilePath = FileObj.GetLocalizedFilePath(); //if (LocalizedFilePath != null) //{ // AddServerDialog = FileObj.GetLocalizedMappedPattern(LocalizedFilePath, AddServerDialog); //} //NewGuiZardObj.VerifyGuiZardHasFinishedCapturing(AddServerDialog, "AddServerDialog"); }
public void StartVM(string ServerIP, string ServerUserName, string ServerPassword, string VMParamType, string VMIdentifier) { XenServer XenObj = new XenServer(); XenObj.StartVM(ServerIP, ServerUserName, ServerPassword, VMParamType, VMIdentifier); }
public void ImportTemplateFromCIFSShareAndCreateVM(string ServerIP, string ServerUserName, string ServerPassword, string CIFSSharePath, string CIFSUserName, string CIFSPassword, string TemplateNameLabel, string NewVMName) { XenServer XenObj = new XenServer(); XenObj.ImportTemplateFromCIFSShareAndStartVM(ServerIP, ServerUserName, ServerPassword, CIFSSharePath, CIFSUserName, CIFSPassword, TemplateNameLabel, NewVMName); }
public void ImportTemplateFromCIFSShare(string ServerIP, string ServerUserName, string ServerPassword, string CIFSSharePath, string CIFSUserName, string CIFSPassword, string VMNameLabel) { XenServer XenObj = new XenServer(); XenObj.ImportVM(ServerIP, ServerUserName, ServerPassword, CIFSSharePath, CIFSUserName, CIFSPassword, VMNameLabel); }
public void WaitTillVMIPIsObtained(string ServerIP, string ServerUserName, string ServerPassword, string VMNameLabel) { XenServer XenObj = new XenServer(); XenObj.GetVMIP(ServerIP, ServerUserName, ServerPassword, VMNameLabel, 0); }
public void WaitTillVMIsAvailable(string ServerIP, string ServerUserName, string ServerPassword, string VMNameLabel, int WaitTimeOutInMins) { XenServer XenObj = new XenServer(); XenObj.WaitTillVMIsAvailable(ServerIP, ServerUserName, ServerPassword, VMNameLabel, WaitTimeOutInMins); }
public void DeleteAllVMs(string ServerIP, string ServerUserName, string ServerPassword) { XenServer XenObj = new XenServer(); XenObj.DeleteAllVMs(ServerIP, ServerUserName, ServerPassword); }
public void ShutDownAllVMs(string ServerIP, string ServerUserName, string ServerPassword) { XenServer XenObj = new XenServer(); XenObj.ShutdownAllVMs(ServerIP, ServerUserName, ServerPassword); }
public void MoveVM(string ServerIP, string ServerUserName, string ServerPassword, string VMNameLabel, string SRNameLabel, string NewVMNameLabel) { XenServer XenObj = new XenServer(); XenObj.MoveVM(ServerIP, ServerUserName, ServerPassword, VMNameLabel, SRNameLabel, NewVMNameLabel); }
public void StoreServerKeyInPuttyCache(string ServerIP, string ServerUserName, string ServerPassword) { XenServer XenObj = new XenServer(); XenObj.StoreServerKeyInPuttyCache(ServerIP, ServerUserName, ServerPassword); }
public void StartHostBackUp(string ServerIP, string ServerUserName, string ServerPassword, string BackUpLocationWithFileName) { XenServer XenObj = new XenServer(); XenObj.StartHostBackup(ServerIP, ServerUserName, ServerPassword, BackUpLocationWithFileName); }