当前位置: 首页>>代码示例>>C#>>正文


C# ConfigDataInfo.AzureProvisioningConfigInfo类代码示例

本文整理汇总了C#中Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo.AzureProvisioningConfigInfo的典型用法代码示例。如果您正苦于以下问题:C# AzureProvisioningConfigInfo类的具体用法?C# AzureProvisioningConfigInfo怎么用?C# AzureProvisioningConfigInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AzureProvisioningConfigInfo类属于Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo命名空间,在下文中一共展示了AzureProvisioningConfigInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NewAzureVMWithLinuxAndNoSSHEnpoint

        public void NewAzureVMWithLinuxAndNoSSHEnpoint()
        {
            try
            {
                _serviceName = Utilities.GetUniqueShortName(serviceNamePrefix);
                string newAzureLinuxVMName = Utilities.GetUniqueShortName("PSLinuxVM");

                // Add-AzureProvisioningConfig with NoSSHEndpoint
                var azureVMConfigInfo = new AzureVMConfigInfo(newAzureLinuxVMName, InstanceSize.Small.ToString(), _linuxImageName);
                var azureProvisioningConfig = new AzureProvisioningConfigInfo(username, password, true);
                var persistentVMConfigInfo = new PersistentVMConfigInfo(azureVMConfigInfo, azureProvisioningConfig, null, null);
                PersistentVM vm = vmPowershellCmdlets.GetPersistentVM(persistentVMConfigInfo);

                // New-AzureVM
                vmPowershellCmdlets.NewAzureVM(_serviceName, new[] { vm }, locationName);
                Console.WriteLine("New Azure service with name:{0} created successfully.", _serviceName);
                Collection<InputEndpointContext> endpoints = vmPowershellCmdlets.GetAzureEndPoint(vmPowershellCmdlets.GetAzureVM(newAzureLinuxVMName, _serviceName));

                Console.WriteLine("The number of endpoints: {0}", endpoints.Count);
                foreach (var ep in endpoints)
                {
                    Utilities.PrintContext(ep);
                }
                Assert.AreEqual(0, endpoints.Count);
                pass = true;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                throw;
            }
        }
开发者ID:djrosanova,项目名称:azure-sdk-tools,代码行数:32,代码来源:NewAzureVmTests.cs

示例2: AdvancedProvisioning

        public void AdvancedProvisioning()
        {
            StartTest(MethodBase.GetCurrentMethod().Name, testStartTime);

            string newAzureVM1Name = Utilities.GetUniqueShortName(vmNamePrefix);
            string newAzureVM2Name = Utilities.GetUniqueShortName(vmNamePrefix);
            if (string.IsNullOrEmpty(imageName))
            {
                imageName = vmPowershellCmdlets.GetAzureVMImageName(new[] { "Windows" }, false);
            }

            vmPowershellCmdlets.NewAzureService(serviceName, serviceName, locationName);

            var azureVMConfigInfo1 = new AzureVMConfigInfo(newAzureVM1Name, InstanceSize.ExtraSmall.ToString(), imageName);
            var azureVMConfigInfo2 = new AzureVMConfigInfo(newAzureVM2Name, InstanceSize.ExtraSmall.ToString(), imageName);
            var azureProvisioningConfig = new AzureProvisioningConfigInfo(OS.Windows, username, password);
            var azureDataDiskConfigInfo = new AddAzureDataDiskConfig(DiskCreateOption.CreateNew, 50, "datadisk1", 0);
            var azureEndPointConfigInfo = new AzureEndPointConfigInfo(AzureEndPointConfigInfo.ParameterSet.CustomProbe, ProtocolInfo.tcp, 80, 80, "web", "lbweb", 80, ProtocolInfo.http, @"/", null, null);

            var persistentVMConfigInfo1 = new PersistentVMConfigInfo(azureVMConfigInfo1, azureProvisioningConfig, azureDataDiskConfigInfo, azureEndPointConfigInfo);
            var persistentVMConfigInfo2 = new PersistentVMConfigInfo(azureVMConfigInfo2, azureProvisioningConfig, azureDataDiskConfigInfo, azureEndPointConfigInfo);

            PersistentVM persistentVM1 = vmPowershellCmdlets.GetPersistentVM(persistentVMConfigInfo1);
            PersistentVM persistentVM2 = vmPowershellCmdlets.GetPersistentVM(persistentVMConfigInfo2);

            PersistentVM[] VMs = { persistentVM1, persistentVM2 };
            vmPowershellCmdlets.NewAzureVM(serviceName, VMs);

            // Cleanup
            vmPowershellCmdlets.RemoveAzureVM(newAzureVM1Name, serviceName);
            vmPowershellCmdlets.RemoveAzureVM(newAzureVM2Name, serviceName);

            Assert.AreEqual(null, vmPowershellCmdlets.GetAzureVM(newAzureVM1Name, serviceName));
            Assert.AreEqual(null, vmPowershellCmdlets.GetAzureVM(newAzureVM2Name, serviceName));
            pass = true;
        }
开发者ID:khoatle,项目名称:azure-powershell,代码行数:36,代码来源:ScenarioTest.cs

示例3: CreateIaaSVMObject

        private PersistentVM CreateIaaSVMObject(string vmName)
        {
            defaultAzureSubscription = vmPowershellCmdlets.SetAzureSubscription(defaultAzureSubscription.SubscriptionName, defaultAzureSubscription.SubscriptionId, CredentialHelper.DefaultStorageName);
            vmPowershellCmdlets.SelectAzureSubscription(defaultAzureSubscription.SubscriptionName, true);


            //Create an IaaS VM with a static CA.
            var azureVMConfigInfo = new AzureVMConfigInfo(vmName, InstanceSize.Small.ToString(), imageName);
            var azureProvisioningConfig = new AzureProvisioningConfigInfo(OS.Windows, username, password);
            var persistentVMConfigInfo = new PersistentVMConfigInfo(azureVMConfigInfo, azureProvisioningConfig, null, null);
            return vmPowershellCmdlets.GetPersistentVM(persistentVMConfigInfo);
        }
开发者ID:khoatle,项目名称:azure-powershell,代码行数:12,代码来源:AzureVMSqlServerExtensionTests.cs

示例4: NewAzureVMWithAffinityGroup

        public void NewAzureVMWithAffinityGroup()
        {
            _serviceName = Utilities.GetUniqueShortName(serviceNamePrefix);
            string _affiniyGroupName1 = Utilities.GetUniqueShortName("aff");
            string _affiniyGroupName2 = Utilities.GetUniqueShortName("aff");

            try
            {
                // New-AzureService
                vmPowershellCmdlets.NewAzureAffinityGroup(_affiniyGroupName1, locationName, "location1", "location1");
                vmPowershellCmdlets.NewAzureAffinityGroup(_affiniyGroupName2, locationName, "location2", "location2");
                vmPowershellCmdlets.NewAzureService(_serviceName, "service1", null, _affiniyGroupName1);

                // New-AzureVMConfig
                string newAzureVMName = Utilities.GetUniqueShortName("PSVM");
                string imageName = vmPowershellCmdlets.GetAzureVMImageName(new[] { "Windows" }, false);

                // Add-AzureProvisioningConfig
                var azureVMConfigInfo = new AzureVMConfigInfo(newAzureVMName, InstanceSize.Small.ToString(), imageName);
                var azureProvisioningConfig = new AzureProvisioningConfigInfo(OS.Windows, username, password);
                var persistentVMConfigInfo = new PersistentVMConfigInfo(azureVMConfigInfo, azureProvisioningConfig, null, null);
                PersistentVM vm = vmPowershellCmdlets.GetPersistentVM(persistentVMConfigInfo);

                // New-AzureVM
                try
                {
                    vmPowershellCmdlets.NewAzureVMWithAG(_serviceName, new[] { vm }, _affiniyGroupName2);
                    Assert.Fail("Should fail, but succeeded!");
                }
                catch (Exception ex)
                {
                    if (ex is AssertFailedException)
                    {
                        throw;
                    }
                    else
                    {
                        Console.WriteLine("Failure is expected.  Continue the tests...");
                    }
                }

                vmPowershellCmdlets.NewAzureVMWithAG(_serviceName, new[] { vm }, _affiniyGroupName1);
                Console.WriteLine("New Azure service with name:{0} created successfully.", _serviceName);
                var vmReturned = vmPowershellCmdlets.GetAzureVM(newAzureVMName, _serviceName);

                Utilities.PrintContext(vmReturned);
                Assert.AreEqual(_serviceName, vmReturned.ServiceName);
                pass = true;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                throw;
            }
        }
开发者ID:djrosanova,项目名称:azure-sdk-tools,代码行数:55,代码来源:NewAzureVmTests.cs

示例5: AddEndPointACLsWithNewDeployment

        public void AddEndPointACLsWithNewDeployment()
        {
            StartTest(MethodBase.GetCurrentMethod().Name, testStartTime);

            string newAzureVM1Name = Utilities.GetUniqueShortName(vmNamePrefix);
            string newAzureVM2Name = Utilities.GetUniqueShortName(vmNamePrefix);
            if (string.IsNullOrEmpty(imageName))
                imageName = vmPowershellCmdlets.GetAzureVMImageName(new[] { "Windows" }, false);

            vmPowershellCmdlets.NewAzureService(serviceName, serviceName, locationName);

            NetworkAclObject aclObj = vmPowershellCmdlets.NewAzureAclConfig();
            vmPowershellCmdlets.SetAzureAclConfig(SetACLConfig.AddRule, aclObj, 100, ACLAction.Permit, "172.0.0.0/8", "notes1");
            vmPowershellCmdlets.SetAzureAclConfig(SetACLConfig.AddRule, aclObj, 200, ACLAction.Deny, "10.0.0.0/8", "notes2");

            var azureVMConfigInfo1 = new AzureVMConfigInfo(newAzureVM1Name, InstanceSize.ExtraSmall.ToString(), imageName);
            var azureVMConfigInfo2 = new AzureVMConfigInfo(newAzureVM2Name, InstanceSize.ExtraSmall.ToString(), imageName);
            var azureProvisioningConfig = new AzureProvisioningConfigInfo(OS.Windows, username, password);
            var azureDataDiskConfigInfo = new AddAzureDataDiskConfig(DiskCreateOption.CreateNew, 50, "datadisk1", 0);
            var azureEndPointConfigInfo = new AzureEndPointConfigInfo(AzureEndPointConfigInfo.ParameterSet.DefaultProbe, ProtocolInfo.tcp, 80, 80, "web", "lbweb", aclObj, true);

            var persistentVMConfigInfo1 = new PersistentVMConfigInfo(azureVMConfigInfo1, azureProvisioningConfig, azureDataDiskConfigInfo, azureEndPointConfigInfo);
            var persistentVMConfigInfo2 = new PersistentVMConfigInfo(azureVMConfigInfo2, azureProvisioningConfig, azureDataDiskConfigInfo, azureEndPointConfigInfo);

            PersistentVM persistentVM1 = vmPowershellCmdlets.GetPersistentVM(persistentVMConfigInfo1);
            PersistentVM persistentVM2 = vmPowershellCmdlets.GetPersistentVM(persistentVMConfigInfo2);

            PersistentVM[] VMs = { persistentVM1, persistentVM2 };
            vmPowershellCmdlets.NewAzureVM(serviceName, VMs);

            // Cleanup
            vmPowershellCmdlets.RemoveAzureVM(newAzureVM1Name, serviceName);
            vmPowershellCmdlets.RemoveAzureVM(newAzureVM2Name, serviceName);

            Assert.AreEqual(null, vmPowershellCmdlets.GetAzureVM(newAzureVM1Name, serviceName));
            Assert.AreEqual(null, vmPowershellCmdlets.GetAzureVM(newAzureVM2Name, serviceName));
            pass = true;
        }
开发者ID:khoatle,项目名称:azure-powershell,代码行数:38,代码来源:LBandEndPointACLsTest.cs

示例6: CreateIaaSVMObject

 private PersistentVM CreateIaaSVMObject(string vmName)
 {
     //Create an IaaS VM with a static CA.
     var azureVMConfigInfo = new AzureVMConfigInfo(vmName, InstanceSize.Small.ToString(), imageName);
     var azureProvisioningConfig = new AzureProvisioningConfigInfo(OS.Windows, username, password);
     var persistentVMConfigInfo = new PersistentVMConfigInfo(azureVMConfigInfo, azureProvisioningConfig, null, null);
     return vmPowershellCmdlets.GetPersistentVM(persistentVMConfigInfo);
 }
开发者ID:jasonnewyork,项目名称:azure-sdk-tools,代码行数:8,代码来源:GenericIaaSExtensionTests.cs

示例7: AzureMultiNicTest

        public void AzureMultiNicTest()
        {
            StartTest(MethodBase.GetCurrentMethod().Name, testStartTime);
            try
            {
                var nic1 = "eth1";
                var nic2 = "eth2";

                var nic1Address = "10.0.1.40";
                var nic2Address = "10.0.1.39";

                // Create a VNet
                var vnetConfig = vmPowershellCmdlets.GetAzureVNetConfig(null);
                if (vnetConfig.Count > 0)
                {
                    vmPowershellCmdlets.RunPSScript("Get-AzureService | Remove-AzureService -Force");
                    Utilities.RetryActionUntilSuccess(() => vmPowershellCmdlets.RemoveAzureVNetConfig(), "in use", 5, 30);
                }
                vmPowershellCmdlets.SetAzureVNetConfig(Directory.GetCurrentDirectory() + "\\VnetconfigWithLocation.netcfg");
                var sites = vmPowershellCmdlets.GetAzureVNetSite(null);
                var subnet = sites[0].Subnets.First().Name;
                var vnetName = sites[0].Name;

                // Create a new service
                vmPowershellCmdlets.NewAzureService(serviceName, locationName);

                // Create the VM
                var azureVMConfigInfo = new AzureVMConfigInfo(vmName, InstanceSize.Large.ToString(), imageName);
                var azureProvisioningConfig = new AzureProvisioningConfigInfo(OS.Windows, username, password);
                var persistentVMConfigInfo = new PersistentVMConfigInfo(azureVMConfigInfo, azureProvisioningConfig, null, null);
                PersistentVM vm = vmPowershellCmdlets.GetPersistentVM(persistentVMConfigInfo);
                vm = (PersistentVM)vmPowershellCmdlets.SetAzureSubnet(vm, new string[] {subnet});

                // AddNetworkInterfaceConfig
                vm = (PersistentVM)vmPowershellCmdlets.AddAzureNetworkInterfaceConfig(nic1, subnet, nic1Address, vm);
                vm = (PersistentVM)vmPowershellCmdlets.AddAzureNetworkInterfaceConfig(nic2, subnet, vm);

                Assert.AreEqual(((NetworkConfigurationSet)vm.ConfigurationSets[1]).NetworkInterfaces.Count, 2);
                Assert.AreEqual(((NetworkConfigurationSet)vm.ConfigurationSets[1]).NetworkInterfaces[0].Name, nic1);
                Assert.AreEqual(((NetworkConfigurationSet)vm.ConfigurationSets[1]).NetworkInterfaces[0].IPConfigurations[0].SubnetName, subnet);
                Assert.AreEqual(((NetworkConfigurationSet)vm.ConfigurationSets[1]).NetworkInterfaces[0].IPConfigurations[0].StaticVirtualNetworkIPAddress, nic1Address);

                Assert.AreEqual(((NetworkConfigurationSet)vm.ConfigurationSets[1]).NetworkInterfaces[1].Name, nic2);
                Assert.AreEqual(((NetworkConfigurationSet)vm.ConfigurationSets[1]).NetworkInterfaces[1].IPConfigurations[0].SubnetName, subnet);
                Assert.IsNull(((NetworkConfigurationSet)vm.ConfigurationSets[1]).NetworkInterfaces[1].IPConfigurations[0].StaticVirtualNetworkIPAddress);

                // Verify SetNetworkInterfaceConfig
                vm = (PersistentVM)vmPowershellCmdlets.SetAzureNetworkInterfaceConfig(nic2, subnet, nic2Address, vm);
                Assert.AreEqual(((NetworkConfigurationSet)vm.ConfigurationSets[1]).NetworkInterfaces[1].Name, nic2);
                Assert.AreEqual(((NetworkConfigurationSet)vm.ConfigurationSets[1]).NetworkInterfaces[1].IPConfigurations[0].SubnetName, subnet);
                Assert.AreEqual(((NetworkConfigurationSet)vm.ConfigurationSets[1]).NetworkInterfaces[1].IPConfigurations[0].StaticVirtualNetworkIPAddress, nic2Address);

                // Verify RemoveNetworkInterfaceConfig
                vm = (PersistentVM)vmPowershellCmdlets.RemoveAzureNetworkInterfaceConfig(nic2, vm);
                Assert.AreEqual(((NetworkConfigurationSet)vm.ConfigurationSets[1]).NetworkInterfaces.Count, 1);
                Assert.AreEqual(((NetworkConfigurationSet)vm.ConfigurationSets[1]).NetworkInterfaces[0].Name, nic1);

                // Verify the create vm using NIC
                vmPowershellCmdlets.NewAzureVM(serviceName, new[] { vm }, vnetName, null, null, null, null, null, null, null, null, null, false );

                // Verify GetNetworkInterfaceConfig
                var getVM = vmPowershellCmdlets.GetAzureVM(vmName, serviceName);

                Assert.AreEqual(getVM.NetworkInterfaces[0].Name, nic1);
                Assert.AreEqual(getVM.NetworkInterfaces[0].IpConfigurations[0].SubnetName, subnet);
                Assert.IsNotNull(getVM.NetworkInterfaces[0].MacAddress);

                var getNic = vmPowershellCmdlets.GetAzureNetworkInterfaceConfig(nic1, getVM);
                Assert.AreEqual(getNic.Name, nic1);
                Assert.AreEqual(getNic.IpConfigurations[0].SubnetName, subnet);
                Assert.IsNotNull(getNic.MacAddress);

                pass = true;
            }
            catch (Exception e)
            {
                pass = false;
                Console.WriteLine("Exception occurred: {0}", e.ToString());
                throw;
            }
        }
开发者ID:khoatle,项目名称:azure-powershell,代码行数:81,代码来源:FunctionalTest.cs

示例8: AzureDnsTest

        public void AzureDnsTest()
        {
            StartTest(MethodBase.GetCurrentMethod().Name, testStartTime);

            const string dnsName = "OpenDns1";
            const string ipAddress = "208.67.222.222";

            try
            {
                vmPowershellCmdlets.NewAzureService(serviceName, locationName);

                DnsServer dns = vmPowershellCmdlets.NewAzureDns(dnsName, ipAddress);

                var azureVMConfigInfo = new AzureVMConfigInfo(vmName, InstanceSize.ExtraSmall.ToString(), imageName);
                var azureProvisioningConfig = new AzureProvisioningConfigInfo(OS.Windows, username, password);
                var persistentVMConfigInfo = new PersistentVMConfigInfo(azureVMConfigInfo, azureProvisioningConfig, null, null);
                PersistentVM vm = vmPowershellCmdlets.GetPersistentVM(persistentVMConfigInfo);

                vmPowershellCmdlets.NewAzureVM(serviceName, new[] { vm }, null, new[] { dns }, null, null, null, null);

                Assert.IsTrue(Verify.AzureDns(vmPowershellCmdlets.GetAzureDeployment(serviceName).DnsSettings, dns));
                pass = true;

            }
            catch (Exception e)
            {
                pass = false;
                Console.WriteLine("Exception occurred: {0}", e.ToString());
                throw;
            }
        }
开发者ID:khoatle,项目名称:azure-powershell,代码行数:31,代码来源:FunctionalTest.cs

示例9: StopAzureVMsDeprovisionedTest

        public void StopAzureVMsDeprovisionedTest()
        {

            StartTest(MethodBase.GetCurrentMethod().Name, testStartTime);

            try
            {
                // starting the test.
                var azureVMConfigInfo1 = new AzureVMConfigInfo(vmName1, InstanceSize.ExtraSmall.ToString(), imageName);
                var azureProvisioningConfig1 = new AzureProvisioningConfigInfo(OS.Windows, username, password);
                var persistentVMConfigInfo1 = new PersistentVMConfigInfo(azureVMConfigInfo1, azureProvisioningConfig1, null, null);
                PersistentVM persistentVM1 = vmPowershellCmdlets.GetPersistentVM(persistentVMConfigInfo1);

                var azureVMConfigInfo2 = new AzureVMConfigInfo(vmName2, InstanceSize.Small.ToString(), imageName);
                var azureProvisioningConfig2 = new AzureProvisioningConfigInfo(OS.Windows, username, password);
                var persistentVMConfigInfo2 = new PersistentVMConfigInfo(azureVMConfigInfo2, azureProvisioningConfig2, null, null);
                PersistentVM persistentVM2 = vmPowershellCmdlets.GetPersistentVM(persistentVMConfigInfo2);

                PersistentVM[] VMs = { persistentVM1, persistentVM2 };
                vmPowershellCmdlets.NewAzureVM(svcName, VMs);
                Console.WriteLine("The VM is successfully created: {0}", vmName1);
                Console.WriteLine("The VM is successfully created: {0}", vmName2);

                WaitForReadyState(svcName, vmName1);
                WaitForReadyState(svcName, vmName2);

                var vm1 = vmPowershellCmdlets.GetAzureVM(vmName1, svcName);
                var vm2 = vmPowershellCmdlets.GetAzureVM(vmName2, svcName);

                Assert.AreEqual(vm1.HostName, vmName1);
                Assert.AreEqual(vm2.HostName, vmName2);

                // Stop and deallocate the VMs
                vmPowershellCmdlets.StopAzureVM("*", svcName, false, true);

                WaitForStoppedState(svcName, vmName1);
                WaitForStoppedState(svcName, vmName2);

                Assert.IsTrue(CheckRoleInstanceState(svcName, vmName1, new string[] { stoppedDeallocatedState }));
                Assert.IsTrue(CheckRoleInstanceState(svcName, vmName2, new string[] { stoppedDeallocatedState }));

                // Start the VMs
                Utilities.RetryActionUntilSuccess(() => vmPowershellCmdlets.StartAzureVM("*", svcName), "HTTP Status Code: 409", 10, 60);
                //StartAzureVMs("*", svcName);

                WaitForStartedState(svcName, vmName1);
                WaitForStartedState(svcName, vmName2);

                Assert.IsTrue(CheckRoleInstanceState(svcName, vmName1, new string[] { readyState, provisioningState }));
                Assert.IsTrue(CheckRoleInstanceState(svcName, vmName2, new string[] { readyState, provisioningState }));

                try
                {
                    // Try to Stop and deallocate VM2 without Force.  Should fail and give a warning message.
                    vmPowershellCmdlets.StopAzureVM("*", svcName);
                    Assert.Fail();
                }
                catch (Exception e)
                {
                    if (e is AssertFailedException)
                    {
                        throw;
                    }
                    else
                    {
                        Console.WriteLine(e.ToString());
                    }
                }
                Assert.IsTrue(CheckRoleInstanceState(svcName, vmName1, new string[] { readyState, provisioningState }));
                Assert.IsTrue(CheckRoleInstanceState(svcName, vmName2, new string[] { readyState, provisioningState }));

                // Stop and deallocate VMs
                vmPowershellCmdlets.StopAzureVM("*", svcName, false, true);

                WaitForStoppedState(svcName, vmName1);
                WaitForStoppedState(svcName, vmName2);

                Assert.IsTrue(CheckRoleInstanceState(svcName, vmName1, new string[] { stoppedDeallocatedState }));
                Assert.IsTrue(CheckRoleInstanceState(svcName, vmName2, new string[] { stoppedDeallocatedState }));

                pass = true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                throw;
            }
            finally
            {
                if ((cleanupIfPassed && pass) || (cleanupIfFailed && !pass))
                {
                    vmPowershellCmdlets.RemoveAzureService(svcName);
                }
            }
        }
开发者ID:FrankSiegemund,项目名称:azure-powershell,代码行数:95,代码来源:StopAzureVMTest.cs

示例10: StopAzureVMsStayProvisionedTest

        public void StopAzureVMsStayProvisionedTest()
        {
            StartTest(MethodBase.GetCurrentMethod().Name, testStartTime);

            try
            {
                // starting the test.
                var azureVMConfigInfo1 = new AzureVMConfigInfo(vmName1, InstanceSize.ExtraSmall.ToString(), imageName);
                var azureProvisioningConfig1 = new AzureProvisioningConfigInfo(OS.Windows, username, password);
                var persistentVMConfigInfo1 = new PersistentVMConfigInfo(azureVMConfigInfo1, azureProvisioningConfig1, null, null);
                PersistentVM persistentVM1 = vmPowershellCmdlets.GetPersistentVM(persistentVMConfigInfo1);

                var azureVMConfigInfo2 = new AzureVMConfigInfo(vmName2, InstanceSize.Small.ToString(), imageName);
                var azureProvisioningConfig2 = new AzureProvisioningConfigInfo(OS.Windows, username, password);
                var persistentVMConfigInfo2 = new PersistentVMConfigInfo(azureVMConfigInfo2, azureProvisioningConfig2, null, null);
                PersistentVM persistentVM2 = vmPowershellCmdlets.GetPersistentVM(persistentVMConfigInfo2);

                PersistentVM[] VMs = { persistentVM1, persistentVM2 };
                vmPowershellCmdlets.NewAzureVM(svcName, VMs);
                Console.WriteLine("The VM is successfully created: {0}", vmName1);
                Console.WriteLine("The VM is successfully created: {0}", vmName2);

                WaitForStartingState(svcName, vmName1);
                WaitForStartingState(svcName, vmName2);

                vmPowershellCmdlets.StopAzureVM("*", svcName, true, true);

                WaitForStoppedState(svcName, vmName1);
                WaitForStoppedState(svcName, vmName2);

                Assert.IsTrue(CheckRoleInstanceState(svcName, vmName1, new string[] { stoppedProvisionedState }));
                Assert.IsTrue(CheckRoleInstanceState(svcName, vmName2, new string[] { stoppedProvisionedState }));

                pass = true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                throw;
            }
            finally
            {
                if ((cleanupIfPassed && pass) || (cleanupIfFailed && !pass))
                {
                    vmPowershellCmdlets.RemoveAzureService(svcName);
                }
            }
        }
开发者ID:FrankSiegemund,项目名称:azure-powershell,代码行数:48,代码来源:StopAzureVMTest.cs

示例11: CaptureImagingExportingImportingVMConfig

        public void CaptureImagingExportingImportingVMConfig()
        {
            StartTest(MethodBase.GetCurrentMethod().Name, testStartTime);

            // Create a unique VM name
            string newAzureVMName = Utilities.GetUniqueShortName("PSTestVM");
            Console.WriteLine("VM Name: {0}", newAzureVMName);

            // Create a unique Service Name
            vmPowershellCmdlets.NewAzureService(serviceName, serviceName, locationName);
            Console.WriteLine("Service Name: {0}", serviceName);
            if (string.IsNullOrEmpty(imageName))
                imageName = vmPowershellCmdlets.GetAzureVMImageName(new[] { "Windows" }, false);

            // starting the test.
            var azureVMConfigInfo = new AzureVMConfigInfo(newAzureVMName, InstanceSize.Small.ToString(), imageName); // parameters for New-AzureVMConfig (-Name -InstanceSize -ImageName)
            var azureProvisioningConfig = new AzureProvisioningConfigInfo(OS.Windows, username, password); // parameters for Add-AzureProvisioningConfig (-Windows -Password)
            var persistentVMConfigInfo = new PersistentVMConfigInfo(azureVMConfigInfo, azureProvisioningConfig, null, null);
            PersistentVM persistentVM = vmPowershellCmdlets.GetPersistentVM(persistentVMConfigInfo); // New-AzureVMConfig & Add-AzureProvisioningConfig

            PersistentVM[] VMs = { persistentVM };
            vmPowershellCmdlets.NewAzureVM(serviceName, VMs); // New-AzureVM
            Console.WriteLine("The VM is successfully created: {0}", persistentVM.RoleName);
            PersistentVMRoleContext vmRoleCtxt = vmPowershellCmdlets.GetAzureVM(persistentVM.RoleName, serviceName);
            Assert.AreEqual(vmRoleCtxt.Name, persistentVM.RoleName, true);


            vmPowershellCmdlets.StopAzureVM(newAzureVMName, serviceName, true); // Stop-AzureVM
            for (int i = 0; i < 3; i++)
            {
                vmRoleCtxt = vmPowershellCmdlets.GetAzureVM(persistentVM.RoleName, serviceName);
                if (vmRoleCtxt.InstanceStatus == "StoppedVM")
                {
                    Console.WriteLine("The status of the VM {0} : {1}", persistentVM.RoleName, vmRoleCtxt.InstanceStatus);
                    break;
                }
                Console.WriteLine("The status of the VM {0} : {1}", persistentVM.RoleName, vmRoleCtxt.InstanceStatus);
                Thread.Sleep(120000);
            }
            Assert.AreEqual(vmRoleCtxt.InstanceStatus, "StoppedVM", true);

            // Save-AzureVMImage
            vmPowershellCmdlets.SaveAzureVMImage(serviceName, newAzureVMName, newAzureVMName);

            // Verify VM image.
            var image = vmPowershellCmdlets.GetAzureVMImage(newAzureVMName)[0];

            Assert.AreEqual("Windows", image.OS, "OS is not matching!");
            Assert.AreEqual(newAzureVMName, image.ImageName, "Names are not matching!");

            // Verify that the VM is removed
            Assert.AreEqual(null, vmPowershellCmdlets.GetAzureVM(persistentVM.RoleName, serviceName));

            // Cleanup the registered image
            vmPowershellCmdlets.RemoveAzureVMImage(newAzureVMName, true);

            pass = true;
        }
开发者ID:kjohn-msft,项目名称:azure-powershell,代码行数:58,代码来源:ScenarioTest.cs

示例12: DevTestProvisioning

        public void DevTestProvisioning()
        {
            StartTest(MethodBase.GetCurrentMethod().Name, testStartTime);

            string newAzureVM1Name = Utilities.GetUniqueShortName(vmNamePrefix);
            //Find a Windows VM Image
            imageName = vmPowershellCmdlets.GetAzureVMImageName(new[] { "Windows" }, false);

            //Specify a small Windows image, with username and pw
            AzureVMConfigInfo azureVMConfigInfo1 = new AzureVMConfigInfo(newAzureVM1Name, InstanceSize.ExtraSmall.ToString(), imageName);
            AzureProvisioningConfigInfo azureProvisioningConfig = new AzureProvisioningConfigInfo(OS.Windows, username, password);
            AzureEndPointConfigInfo azureEndPointConfigInfo = new AzureEndPointConfigInfo(AzureEndPointConfigInfo.ParameterSet.NoLB, ProtocolInfo.tcp, 80, 80, "Http");

            PersistentVMConfigInfo persistentVMConfigInfo1 = new PersistentVMConfigInfo(azureVMConfigInfo1, azureProvisioningConfig, null, azureEndPointConfigInfo);
            PersistentVM persistentVM1 = vmPowershellCmdlets.GetPersistentVM(persistentVMConfigInfo1);

            //Add all the endpoints that are added by the Dev Test feature in Azure Tools
            azureEndPointConfigInfo = new AzureEndPointConfigInfo(AzureEndPointConfigInfo.ParameterSet.NoLB, ProtocolInfo.tcp, 443, 443, "Https");
            azureEndPointConfigInfo.Vm = persistentVM1;
            persistentVM1 = vmPowershellCmdlets.AddAzureEndPoint(azureEndPointConfigInfo);
            azureEndPointConfigInfo = new AzureEndPointConfigInfo(AzureEndPointConfigInfo.ParameterSet.NoLB, ProtocolInfo.tcp, 1433, 1433, "MSSQL");
            azureEndPointConfigInfo.Vm = persistentVM1;
            persistentVM1 = vmPowershellCmdlets.AddAzureEndPoint(azureEndPointConfigInfo);
            azureEndPointConfigInfo = new AzureEndPointConfigInfo(AzureEndPointConfigInfo.ParameterSet.NoLB, ProtocolInfo.tcp, 8172, 8172, "WebDeploy");
            azureEndPointConfigInfo.Vm = persistentVM1;
            persistentVM1 = vmPowershellCmdlets.AddAzureEndPoint(azureEndPointConfigInfo);

            // Make a storage account named "devtestNNNNN"
            string storageAcctName = "devtest" + new Random().Next(10000, 99999);
            vmPowershellCmdlets.NewAzureStorageAccount(storageAcctName, locationName);

            // When making a new azure VM, you can't specify a location if you want to use the existing service
            PersistentVM[] VMs = { persistentVM1 };
            vmPowershellCmdlets.NewAzureVM(serviceName, VMs, locationName);

            var svcDeployment = vmPowershellCmdlets.GetAzureDeployment(serviceName);
            Assert.AreEqual(svcDeployment.ServiceName, serviceName);
            var vmDeployment = vmPowershellCmdlets.GetAzureVM(newAzureVM1Name, serviceName);
            Assert.AreEqual(vmDeployment.InstanceName, newAzureVM1Name);

            // Cleanup
            vmPowershellCmdlets.RemoveAzureVM(newAzureVM1Name, serviceName);
            Assert.AreEqual(null, vmPowershellCmdlets.GetAzureVM(newAzureVM1Name, serviceName));
            Utilities.RetryActionUntilSuccess(() => vmPowershellCmdlets.RemoveAzureStorageAccount(storageAcctName), "in use", 10, 30);
            pass = true;
        }
开发者ID:kjohn-msft,项目名称:azure-powershell,代码行数:46,代码来源:ScenarioTest.cs

示例13: NewAzureVMDomainJoinTest

        public void NewAzureVMDomainJoinTest()
        {
            StartTest(MethodBase.GetCurrentMethod().Name, testStartTime);

            var newAzureVMName = Utilities.GetUniqueShortName(vmNamePrefix);

            const string joinDomainStr = "www.microsoft.com";
            const string domainStr = "microsoft.com";
            const string domainUser = "pstestdomainuser";
            const string domainPassword = "[email protected]";

            try
            {
                if (string.IsNullOrEmpty(imageName))
                {
                    imageName = vmPowershellCmdlets.GetAzureVMImageName(new[] { "Windows" }, false);
                }

                vmPowershellCmdlets.NewAzureService(serviceName, serviceName, locationName);

                var azureVMConfigInfo = new AzureVMConfigInfo(newAzureVMName, InstanceSize.Small.ToString(), imageName);
                var azureProvisioningConfig = new AzureProvisioningConfigInfo("WindowsDomain", username, password,
                                                                              joinDomainStr, domainStr, domainUser,
                                                                              domainPassword);
                var persistentVMConfigInfo = new PersistentVMConfigInfo(azureVMConfigInfo, azureProvisioningConfig, null,
                                                                        null);
                PersistentVM persistentVM = vmPowershellCmdlets.GetPersistentVM(persistentVMConfigInfo);

                PersistentVM[] VMs = { persistentVM };
                vmPowershellCmdlets.NewAzureVM(serviceName, VMs);

                // Todo: Check the domain of the VM
                pass = true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                throw;
            }
        }
开发者ID:kjohn-msft,项目名称:azure-powershell,代码行数:40,代码来源:ScenarioTest.cs

示例14: AzureIaaSBVT


//.........这里部分代码省略.........
                Assert.IsTrue(Verify.AzureCertificate(serviceName, certCreated.Thumbprint, thumbprintAlgorithm, certData));
                RecordTimeTaken(ref prevTime);

                //
                // Remove-AzureCertificate
                //
                vmPowershellCmdlets.RemoveAzureCertificate(serviceName, certCreated.Thumbprint, thumbprintAlgorithm);
                Assert.IsTrue(Utilities.CheckRemove(vmPowershellCmdlets.GetAzureCertificate, serviceName, certCreated.Thumbprint, thumbprintAlgorithm));
                RecordTimeTaken(ref prevTime);

                //
                // New-AzureVMConfig
                //
                AzureVMConfigInfo azureVMConfigInfo = new AzureVMConfigInfo(newAzureVMName, InstanceSize.Small, imageName);
                PersistentVM vm = vmPowershellCmdlets.NewAzureVMConfig(azureVMConfigInfo);

                RecordTimeTaken(ref prevTime);

                //
                // Add-AzureCertificate
                //
                vmPowershellCmdlets.AddAzureCertificate(serviceName, certToUpload);

                //
                // New-AzureCertificateSetting
                //
                CertificateSettingList certList = new CertificateSettingList();
                certList.Add(vmPowershellCmdlets.NewAzureCertificateSetting(certStoreName.ToString(), installedCert.Thumbprint));
                RecordTimeTaken(ref prevTime);

                //
                // Add-AzureProvisioningConfig
                //
                AzureProvisioningConfigInfo azureProvisioningConfig = new AzureProvisioningConfigInfo(OS.Windows, certList, username, password);
                azureProvisioningConfig.Vm = vm;
                vm = vmPowershellCmdlets.AddAzureProvisioningConfig(azureProvisioningConfig);
                RecordTimeTaken(ref prevTime);

                //
                // Add-AzureDataDisk (two disks)
                //
                AddAzureDataDiskConfig azureDataDiskConfigInfo1 = new AddAzureDataDiskConfig(DiskCreateOption.CreateNew, diskSize1, diskLabel1, lunSlot1);
                azureDataDiskConfigInfo1.Vm = vm;
                vm = vmPowershellCmdlets.AddAzureDataDisk(azureDataDiskConfigInfo1);

                AddAzureDataDiskConfig azureDataDiskConfigInfo2 = new AddAzureDataDiskConfig(DiskCreateOption.CreateNew, diskSize2, diskLabel2, lunSlot2);
                azureDataDiskConfigInfo2.Vm = vm;
                vm = vmPowershellCmdlets.AddAzureDataDisk(azureDataDiskConfigInfo2);

                RecordTimeTaken(ref prevTime);

                //
                // Add-AzureEndpoint (two endpoints)
                //
                AzureEndPointConfigInfo azureEndPointConfigInfo1 = new AzureEndPointConfigInfo(
                    AzureEndPointConfigInfo.ParameterSet.CustomProbe,
                    ProtocolInfo.tcp,
                    ep1LocalPort,
                    ep1PublicPort,
                    ep1Name,
                    ep1LBSetName,
                    ep1ProbePort,
                    ProtocolInfo.tcp,
                    ep1ProbePath,
                    ep1ProbeInterval,
                    ep1ProbeTimeout,
开发者ID:ranjitk9,项目名称:azure-sdk-tools,代码行数:67,代码来源:BVTTest.cs

示例15: AddAzureProvisioningConfigCmdletInfo

        public AddAzureProvisioningConfigCmdletInfo(AzureProvisioningConfigInfo provConfig)
        {
            this.cmdletName = Utilities.AddAzureProvisioningConfigCmdletName;

            this.cmdletParams.Add(new CmdletParam("VM", provConfig.Vm));

            var parameterSet = string.IsNullOrEmpty(provConfig.Option) ? provConfig.OS.ToString() : provConfig.Option;

            this.cmdletParams.Add(new CmdletParam(parameterSet));

            if (!string.IsNullOrEmpty(provConfig.Password))
            {
                this.cmdletParams.Add(new CmdletParam("Password", provConfig.Password));
            }

            if (!string.IsNullOrEmpty(provConfig.CustomDataFile))
            {
                this.cmdletParams.Add(new CmdletParam("CustomDataFile", provConfig.CustomDataFile));
            }

            // For Linux parameter set
            if (parameterSet.Equals(OS.Linux.ToString()))
            {
                this.cmdletParams.Add(new CmdletParam("LinuxUser", provConfig.LinuxUser));

                if (provConfig.DisableSSH)
                {
                    this.cmdletParams.Add(new CmdletParam("DisableSSH"));
                }
                if (provConfig.NoSSHEndpoint)
                {
                    this.cmdletParams.Add(new CmdletParam("NoSSHEndpoint"));
                }
                if (provConfig.SSHKeyPairs != null && provConfig.SSHKeyPairs.Count != 0)
                {
                    this.cmdletParams.Add(new CmdletParam("SSHKeyPairs", provConfig.SSHKeyPairs));
                }
                if (provConfig.SshPublicKeys != null && provConfig.SshPublicKeys.Count != 0)
                {
                    this.cmdletParams.Add(new CmdletParam("SSHPublicKeys", provConfig.SshPublicKeys));
                }
                if(provConfig.NoSSHPassword)
                {
                    this.cmdletParams.Add(new CmdletParam("NoSSHPassword"));
                }
            }

            // For Windows/WindowsDomain parameter set
            if (parameterSet.Equals(provConfig.WindowsDomain) || parameterSet.Equals(OS.Windows.ToString()))
            {
                this.cmdletParams.Add(new CmdletParam("AdminUsername", provConfig.AdminUsername));

                if (provConfig.DisableAutomaticUpdate)
                {
                    this.cmdletParams.Add(new CmdletParam("DisableAutomaticUpdates"));
                }
                if (provConfig.DisableGuestAgent)
                {
                    this.cmdletParams.Add(new CmdletParam("DisableGuestAgent"));
                }
                if (provConfig.DisableWinRMHttps)
                {
                    this.cmdletParams.Add(new CmdletParam("DisableWinRMHttps"));
                }
                if (provConfig.EnableWinRMHttp)
                {
                    this.cmdletParams.Add(new CmdletParam("EnableWinRMHttp"));
                }
                if (provConfig.NoWinRMEndpoint)
                {
                    this.cmdletParams.Add(new CmdletParam("NoWinRMEndpoint"));
                }
                if (provConfig.Reset)
                {
                    this.cmdletParams.Add(new CmdletParam("ResetPasswordOnFirstLogon"));
                }
                if (provConfig.NoExportPrivateKey)
                {
                    this.cmdletParams.Add(new CmdletParam("NoExportPrivateKey"));
                }
                if (provConfig.NoRDPEndpoint)
                {
                    this.cmdletParams.Add(new CmdletParam("NoRDPEndpoint"));
                }
                if (!string.IsNullOrEmpty(provConfig.TimeZone))
                {
                    this.cmdletParams.Add(new CmdletParam("TimeZone", provConfig.TimeZone));
                }

                if (provConfig.Certs != null && provConfig.Certs.Count != 0)
                {
                    this.cmdletParams.Add(new CmdletParam("Certificates", provConfig.Certs));
                }
                if (provConfig.WinRMCertificate != null)
                {
                    this.cmdletParams.Add(new CmdletParam("WinRMCertificate", provConfig.WinRMCertificate));
                }
                if (provConfig.X509Certificates != null)
                {
                    this.cmdletParams.Add(new CmdletParam("X509Certificates", provConfig.X509Certificates));
//.........这里部分代码省略.........
开发者ID:FrankSiegemund,项目名称:azure-powershell,代码行数:101,代码来源:AddAzureProvisioningConfigCmdletInfo.cs


注:本文中的Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo.AzureProvisioningConfigInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。