public override void Run() { // Login VapiAuthHelper = new VapiAuthenticationHelper(); SessionStubConfiguration = VapiAuthHelper.LoginByUsernameAndPassword( Server, UserName, Password); this.sataService = VapiAuthHelper.StubFactory.CreateStub <Sata>( SessionStubConfiguration); Console.WriteLine("\n\n#### Setup: Get the virtual machine id"); this.vmId = VmHelper.GetVm(VapiAuthHelper.StubFactory, SessionStubConfiguration, VmName); Console.WriteLine("Using VM: " + VmName + " (vmId=" + this.vmId + ") for SATA adapter configuration sample"); Console.WriteLine("\n\n#### Example: List of all SATA adapters " + "on the VM"); List <SataTypes.Summary> sataSummaries = this.sataService.List(this.vmId); sataSummaries.ForEach(i => Console.WriteLine(i)); Console.WriteLine("\n\n#### Display information about each " + "adapter"); foreach (SataTypes.Summary sataSummary in sataSummaries) { SataTypes.Info info = this.sataService.Get(this.vmId, sataSummary.GetAdapter()); Console.WriteLine(info); } Console.WriteLine("\n\n#### Example: Create SATA adapter with " + "defaults."); SataTypes.CreateSpec sataCreateSpec = new SataTypes.CreateSpec(); string sataId = this.sataService.Create(this.vmId, sataCreateSpec); Console.WriteLine(sataCreateSpec); SataTypes.Info sataInfo = this.sataService.Get(this.vmId, sataId); Console.WriteLine("SATA Adapter ID=" + sataId); Console.WriteLine(sataInfo); this.createdSataAdapters.Add(sataId); Console.WriteLine("\n\n#### Create SATA adapter with specific " + "bus"); sataCreateSpec = new SataTypes.CreateSpec(); sataCreateSpec.SetBus(2L); sataId = this.sataService.Create(this.vmId, sataCreateSpec); Console.WriteLine(sataCreateSpec); sataInfo = this.sataService.Get(this.vmId, sataId); Console.WriteLine("SATA Adapter ID=" + sataId); Console.WriteLine(sataInfo); this.createdSataAdapters.Add(sataId); // List all SATA adapters for a VM Console.WriteLine("\n\n#### List all SATA adapters on the VM"); sataSummaries = this.sataService.List(this.vmId); sataSummaries.ForEach(i => Console.WriteLine(i)); }
public override void Run() { // Login VapiAuthHelper = new VapiAuthenticationHelper(); SessionStubConfiguration = VapiAuthHelper.LoginByUsernameAndPassword( Server, UserName, Password); this.bootService = VapiAuthHelper.StubFactory.CreateStub <Boot>( SessionStubConfiguration); Console.WriteLine("\n\n#### Setup: Get the virtual machine id"); this.vmId = VmHelper.GetVm(VapiAuthHelper.StubFactory, SessionStubConfiguration, VmName); Console.WriteLine("Using VM: " + VmName + " (vmId=" + this.vmId + ") for boot configuration sample"); // Print the current boot configuration Console.WriteLine("\n\n#### Print the original Boot Info"); BootTypes.Info bootInfo = this.bootService.Get(this.vmId); Console.WriteLine(bootInfo); // Save the current boot info to revert settings after cleanup this.originalBootInfo = bootInfo; Console.WriteLine("\n\n#### Example: Update firmware to EFI for " + "boot configuration"); BootTypes.UpdateSpec bootUpdateSpec = new BootTypes.UpdateSpec(); bootUpdateSpec.SetType(BootTypes.Type.EFI); this.bootService.Update(this.vmId, bootUpdateSpec); bootInfo = this.bootService.Get(this.vmId); Console.WriteLine("\n\n#### Example: Update boot firmware to tell " + "it to enter setup mode on next boot."); bootUpdateSpec = new BootTypes.UpdateSpec(); bootUpdateSpec.SetEnterSetupMode(true); this.bootService.Update(this.vmId, bootUpdateSpec); Console.WriteLine(bootUpdateSpec); bootInfo = this.bootService.Get(this.vmId); Console.WriteLine(bootInfo); Console.WriteLine("\n\n#### Example: Update firmware to introduce " + "a delay in boot process and automatically reboot after a " + "failure to boot, retry delay = 30000 ms"); bootUpdateSpec = new BootTypes.UpdateSpec(); bootUpdateSpec.SetDelay(10000L); bootUpdateSpec.SetRetry(true); bootUpdateSpec.SetRetryDelay(30000L); this.bootService.Update(this.vmId, bootUpdateSpec); bootInfo = this.bootService.Get(this.vmId); Console.WriteLine(bootInfo); }
public ObjectChoices[] Choices(PropertyVm model) //why is this needed? HM { var html = this; var choices = (from obj in model.Choices.Cast <object>().ToArray() let choiceType = obj == null ? model.Type : obj.GetType() let properties = VmHelper.PropertiesFor(new Encoder(), obj, choiceType) .Each(p => p.Name = model.Name + "." + p.Name) .Each(p => p.Readonly |= model.Readonly) .Each(p => p.Id = Guid.NewGuid().ToString()) select new ObjectChoices { obj = obj, choiceType = choiceType, properties = properties, name = (obj != null ? obj.DisplayName() : choiceType.DisplayName()) }).ToArray(); return(choices); }
public override void Run() { // Login VapiAuthHelper = new VapiAuthenticationHelper(); SessionStubConfiguration = VapiAuthHelper.LoginByUsernameAndPassword( Server, UserName, Password); this.memoryService = VapiAuthHelper.StubFactory.CreateStub <Memory>( SessionStubConfiguration); Console.WriteLine("\n\n#### Get the virtual machine id"); this.vmId = VmHelper.GetVm(VapiAuthHelper.StubFactory, SessionStubConfiguration, VmName); Console.WriteLine("Using VM: " + VmName + " (vmId=" + this.vmId + " ) for memory configuration sample."); // Get the current memory info Console.WriteLine("\n\n#### Print original memory info."); MemoryTypes.Info memoryInfo = memoryService.Get(this.vmId); Console.WriteLine(memoryInfo); /* * Save the current memory info to verify that we have cleaned up * properly. */ this.originalMemoryInfo = memoryInfo; Console.WriteLine("\n\n#### Example: Update memory size field of " + "memory configuration."); MemoryTypes.UpdateSpec memoryUpdateSpec = new MemoryTypes.UpdateSpec(); memoryUpdateSpec.SetSizeMiB(8 * 1024L); memoryService.Update(this.vmId, memoryUpdateSpec); Console.WriteLine(memoryUpdateSpec); memoryInfo = memoryService.Get(this.vmId); Console.WriteLine(memoryInfo); Console.WriteLine("\n\n#### Example: Update hot add enabled field " + "of memory configuration."); memoryUpdateSpec = new MemoryTypes.UpdateSpec(); memoryUpdateSpec.SetHotAddEnabled(true); memoryService.Update(this.vmId, memoryUpdateSpec); Console.WriteLine(memoryUpdateSpec); memoryInfo = memoryService.Get(this.vmId); Console.WriteLine(memoryInfo); }
public override void Run() { // Login VapiAuthHelper = new VapiAuthenticationHelper(); SessionStubConfiguration = VapiAuthHelper.LoginByUsernameAndPassword( Server, UserName, Password); this.cpuService = VapiAuthHelper.StubFactory.CreateStub <Cpu>( SessionStubConfiguration); Console.WriteLine("\n\n### Setup: Get the virtual machine id"); this.vmId = VmHelper.GetVm(VapiAuthHelper.StubFactory, SessionStubConfiguration, VmName); Console.WriteLine("Using VM: " + VmName + " (vmId=" + this.vmId + " ) for CPU configuration sample."); Console.WriteLine("\n\n### Example: Print original cpu info"); CpuTypes.Info cpuInfo = cpuService.Get(this.vmId); Console.WriteLine(cpuInfo); /* * Save the current cpu info to verify that we have cleaned up * properly */ this.originalCpuInfo = cpuInfo; Console.WriteLine("\n\n### Example: Update count field of CPU " + "configuration"); CpuTypes.UpdateSpec cpuUpdateSpec = new CpuTypes.UpdateSpec(); cpuUpdateSpec.SetCount(2L); cpuService.Update(this.vmId, cpuUpdateSpec); Console.WriteLine(cpuUpdateSpec); cpuInfo = cpuService.Get(this.vmId); Console.WriteLine(cpuInfo); Console.WriteLine("\n\n### Example: Update cpu fields, number of " + "cores per socket=2, enable hot add"); cpuUpdateSpec = new CpuTypes.UpdateSpec(); cpuUpdateSpec.SetCoresPerSocket(2L); cpuUpdateSpec.SetHotAddEnabled(true); cpuService.Update(this.vmId, cpuUpdateSpec); Console.WriteLine(cpuUpdateSpec); cpuInfo = this.cpuService.Get(this.vmId); Console.WriteLine(cpuInfo); }
public override void Run() { // Login VapiAuthHelper = new VapiAuthenticationHelper(); SessionStubConfiguration = VapiAuthHelper.LoginByUsernameAndPassword( Server, UserName, Password); this.scsiService = VapiAuthHelper.StubFactory.CreateStub <Scsi>( SessionStubConfiguration); Console.WriteLine("\n\n#### Setup: Get the virtual machine id"); this.vmId = VmHelper.GetVm(VapiAuthHelper.StubFactory, SessionStubConfiguration, VmName); Console.WriteLine("Using VM: " + VmName + " (vmId=" + this.vmId + ") for SCSI adapter configuration sample"); Console.WriteLine("\n\n#### Example: List of all SCSI adapters " + "on the VM"); List <ScsiTypes.Summary> scsiSummaries = this.scsiService.List(this.vmId); scsiSummaries.ForEach(i => Console.WriteLine(i)); Console.WriteLine("\n\n#### Display information about each " + "adapter"); foreach (ScsiTypes.Summary scsiSummary in scsiSummaries) { ScsiTypes.Info info = this.scsiService.Get(this.vmId, scsiSummary.GetAdapter()); Console.WriteLine(info); } Console.WriteLine("\n\n#### Example: Create SCSI adapter with " + "defaults."); ScsiTypes.CreateSpec scsiCreateSpec = new ScsiTypes.CreateSpec(); string scsiId = this.scsiService.Create(this.vmId, scsiCreateSpec); Console.WriteLine(scsiCreateSpec); ScsiTypes.Info scsiInfo = this.scsiService.Get(this.vmId, scsiId); Console.WriteLine("SCSI Adapter ID=" + scsiId); Console.WriteLine(scsiInfo); this.createdScsiAdapters.Add(scsiId); Console.WriteLine("\n\n#### Create SCSI adapter with specific " + "bus and sharing=true"); scsiCreateSpec = new ScsiTypes.CreateSpec(); scsiCreateSpec.SetBus(2L); scsiCreateSpec.SetSharing(ScsiTypes.Sharing.VIRTUAL); scsiId = this.scsiService.Create(this.vmId, scsiCreateSpec); Console.WriteLine(scsiCreateSpec); scsiInfo = this.scsiService.Get(this.vmId, scsiId); Console.WriteLine("SCSI Adapter ID=" + scsiId); Console.WriteLine(scsiInfo); this.createdScsiAdapters.Add(scsiId); Console.WriteLine("\n\n#### Update SCSI adapter by setting " + "sharing=false"); ScsiTypes.UpdateSpec scsiUpdateSpec = new ScsiTypes.UpdateSpec(); scsiUpdateSpec.SetSharing(ScsiTypes.Sharing.NONE); this.scsiService.Update(this.vmId, scsiId, scsiUpdateSpec); Console.WriteLine(scsiUpdateSpec); scsiInfo = this.scsiService.Get(this.vmId, scsiId); Console.WriteLine("SCSI Adapter ID=" + scsiId); Console.WriteLine(scsiInfo); // List all SCSI adapters for a VM Console.WriteLine("\n\n#### List all SCSI adapters on the VM"); scsiSummaries = this.scsiService.List(this.vmId); scsiSummaries.ForEach(i => Console.WriteLine(i)); }
public IEnumerable <PropertyVm> PropertiesFor(object model, Type type = null) { type = type ?? model.GetType(); return(VmHelper.GetPropertyVmsUsingReflection(new RazorEngineTypeEncoder(), model, type)); }
public override void Run() { // Login VapiAuthHelper = new VapiAuthenticationHelper(); SessionStubConfiguration = VapiAuthHelper.LoginByUsernameAndPassword( Server, UserName, Password); this.diskService = VapiAuthHelper.StubFactory.CreateStub <Disk>( SessionStubConfiguration); this.ethernetService = VapiAuthHelper.StubFactory.CreateStub <Ethernet>( SessionStubConfiguration); this.bootDeviceService = VapiAuthHelper.StubFactory.CreateStub <Device>( SessionStubConfiguration); Console.WriteLine("\n\n#### Setup: Get the virtual machine id"); this.vmId = VmHelper.GetVm(VapiAuthHelper.StubFactory, SessionStubConfiguration, VmName); Console.WriteLine("\nUsing VM: " + VmName + " (vmId=" + this.vmId + " ) for boot device configuration sample"); Console.WriteLine("\nValidate whether the VM has the required " + "minimum number of devices"); VM vmService = VapiAuthHelper.StubFactory.CreateStub <VM>( SessionStubConfiguration); VMTypes.Info vmInfo = vmService.Get(this.vmId); if (vmInfo.GetCdroms().Count < 1 || vmInfo.GetFloppies().Count < 1 || vmInfo.GetDisks().Count < 1 || vmInfo.GetNics().Count < 1) { throw new Exception("\n Selected VM does not have the required " + "minimum number of devices: i.e. 1 Ethernet adapter, " + "1 CD-ROM, 1 Floppy drive, 3 disks"); } Console.WriteLine("\n\n#### Example: Print the current boot device" + " configuration"); List <DeviceTypes.Entry> bootDeviceEntries = this.bootDeviceService.Get(this.vmId); bootDeviceEntries.ForEach(i => Console.WriteLine(i)); // Save the current boot info to revert it during cleanup this.orginalBootDeviceEntries = bootDeviceEntries; Console.WriteLine("\n\n#### Example: Set boot order to be Floppy, " + "Disk1, Disk2, Disk3, Ethernet NIC, CD-ROM"); // Get the device identifiers for disks List <DiskTypes.Summary> diskSummaries = this.diskService.List(this.vmId); Console.WriteLine("\nList of disks attached to the VM: \n"); diskSummaries.ForEach(i => Console.WriteLine(i)); List <String> diskIds = new List <String>(); foreach (DiskTypes.Summary diskSummary in diskSummaries) { diskIds.Add(diskSummary.GetDisk()); } // Get device identifiers for Ethernet NICs List <EthernetTypes.Summary> ethernetSummaries = this.ethernetService.List(this.vmId); Console.WriteLine("\nList of Ethernet NICs attached to the VM:\n"); ethernetSummaries.ForEach(i => Console.WriteLine(i)); List <String> ethernetIds = new List <String>(); foreach (EthernetTypes.Summary ethernetSummary in ethernetSummaries) { ethernetIds.Add(ethernetSummary.GetNic()); } List <DeviceTypes.Entry> devices = new List <DeviceTypes.Entry>(4); devices.Add(new DeviceTypes.Entry()); devices[0].SetType(DeviceTypes.Type.FLOPPY); devices.Add(new DeviceTypes.Entry()); devices[1].SetDisks(diskIds); devices[1].SetType(DeviceTypes.Type.DISK); devices.Add(new DeviceTypes.Entry()); devices[2].SetNic(ethernetIds[0]); devices[2].SetType(DeviceTypes.Type.ETHERNET); devices.Add(new DeviceTypes.Entry()); devices[3].SetType(DeviceTypes.Type.CDROM); this.bootDeviceService.Set(this.vmId, devices); bootDeviceEntries = this.bootDeviceService.Get(this.vmId); Console.WriteLine("\nNew boot device configuration"); bootDeviceEntries.ForEach(i => Console.WriteLine(i)); }
public override void Run() { // Login VapiAuthHelper = new VapiAuthenticationHelper(); SessionStubConfiguration = VapiAuthHelper.LoginByUsernameAndPassword( Server, UserName, Password); this.cdromService = VapiAuthHelper.StubFactory.CreateStub <Cdrom>( SessionStubConfiguration); this.powerService = VapiAuthHelper.StubFactory.CreateStub <Power>( SessionStubConfiguration); this.sataService = VapiAuthHelper.StubFactory.CreateStub <Sata>( SessionStubConfiguration); Console.WriteLine("\n\n#### Setup: Get the virtual machine id"); this.vmId = VmHelper.GetVm(VapiAuthHelper.StubFactory, SessionStubConfiguration, VmName); Console.WriteLine("Using VM: " + VmName + " (vmId=" + this.vmId + " ) for the CD-ROM configuration sample."); Console.WriteLine("\n\n#### Setup: Create SATA controller"); SataTypes.CreateSpec sataCreateSpec = new SataTypes.CreateSpec(); this.sataId = sataService.Create(this.vmId, sataCreateSpec); Console.WriteLine(sataCreateSpec); Console.WriteLine("\n\n### Example: List all CD-ROMs"); ListAllCdroms(); Console.WriteLine("\n\n### Example: Create CD-ROM with ISO_FILE" + " backing"); CreateCdrom(CdromTypes.BackingType.ISO_FILE); Console.WriteLine("\n\n### Example: Create CD-ROM with " + "CLIENT_DEVICE backing"); CreateCdrom(CdromTypes.BackingType.CLIENT_DEVICE); Console.WriteLine("\n\n### Example: Create SATA CD-ROM with" + " CLIENT_DEVICE backing"); CreateCdromForAdapterType(CdromTypes.HostBusAdapterType.SATA, CdromTypes.BackingType.CLIENT_DEVICE); Console.WriteLine("\n\n### Example: Create SATA CD-ROM on specific" + " bus with CLIENT_DEVICE backing"); CreateSataCdromAtSpecificLocation( CdromTypes.BackingType.CLIENT_DEVICE, 0L, null); Console.WriteLine("\n\n### Example: Create SATA CD-ROM on specific" + " bus and unit number with CLIENT_DEVICE " + "backing"); CreateSataCdromAtSpecificLocation( CdromTypes.BackingType.CLIENT_DEVICE, 0L, 10L); Console.WriteLine("\n\n### Example: Create IDE CD-ROM with" + " CLIENT_DEVICE backing"); CreateCdromForAdapterType(CdromTypes.HostBusAdapterType.IDE, CdromTypes.BackingType.CLIENT_DEVICE); Console.WriteLine("\n\n### Example: Create IDE CD-ROM as a slave" + " device with HOST_DEVICE backing"); CreateIdeCdromAsSpecificDevice( CdromTypes.BackingType.HOST_DEVICE, false); }
public override void Run() { // Login VapiAuthHelper = new VapiAuthenticationHelper(); SessionStubConfiguration = VapiAuthHelper.LoginByUsernameAndPassword( Server, UserName, Password); this.powerService = VapiAuthHelper.StubFactory.CreateStub <Power>( SessionStubConfiguration); this.ethernetService = VapiAuthHelper.StubFactory.CreateStub <Ethernet>( SessionStubConfiguration); Console.WriteLine("\n\n#### Setup: Get the virtual machine id"); this.vmId = VmHelper.GetVm(VapiAuthHelper.StubFactory, SessionStubConfiguration, VmName); Console.WriteLine("Using VM: " + VmName + " (vmId=" + this.vmId + ") for ethernet adapter configuration sample"); // List all ethernet adapters of the virtual machine List <EthernetTypes.Summary> nicSummaries = this.ethernetService.List(this.vmId); nicSummaries.ForEach(i => Console.WriteLine(i)); Console.WriteLine("\n\n#### Print info for each Ethernet NIC on " + "the vm."); foreach (EthernetTypes.Summary nicSummary in nicSummaries) { EthernetTypes.Info info = this.ethernetService.Get(this.vmId, nicSummary.GetNic()); Console.WriteLine(info); } Console.WriteLine("\n\n#### Example: Create ethernet NIC using " + "standard portgroup and default settings"); string stdNetworkId = NetworkHelper.GetStandardNetworkBacking( VapiAuthHelper.StubFactory, SessionStubConfiguration, Datacenter, StandardPortGroup); EthernetTypes.CreateSpec nicCreateSpec = new EthernetTypes.CreateSpec(); EthernetTypes.BackingSpec nicBackingSpec = new EthernetTypes.BackingSpec(); nicBackingSpec.SetNetwork(stdNetworkId); nicBackingSpec.SetType( EthernetTypes.BackingType.STANDARD_PORTGROUP); nicCreateSpec.SetBacking(nicBackingSpec); string nicId = this.ethernetService.Create(this.vmId, nicCreateSpec); this.createdNics.Add(nicId); Console.WriteLine(nicCreateSpec); EthernetTypes.Info nicInfo = this.ethernetService.Get(this.vmId, nicId); Console.WriteLine("VM ID=" + this.vmId); Console.WriteLine("Ethernet NIC ID=" + nicId); Console.WriteLine(nicInfo); Console.WriteLine("\n\n#### Example: Create Ethernet NIC using" + " standard portgroup and specifying start_connected=true," + " allow_guest_control=true, mac_type, mac_address," + " wake_on_lan=enabled."); nicBackingSpec = new EthernetTypes.BackingSpec(); nicBackingSpec.SetNetwork(stdNetworkId); nicBackingSpec.SetType( EthernetTypes.BackingType.STANDARD_PORTGROUP); nicCreateSpec = new EthernetTypes.CreateSpec(); nicCreateSpec.SetAllowGuestControl(true); nicCreateSpec.SetMacType(EthernetTypes.MacAddressType.MANUAL); nicCreateSpec.SetMacAddress("01:23:45:67:89:10"); nicCreateSpec.SetBacking(nicBackingSpec); nicId = this.ethernetService.Create(this.vmId, nicCreateSpec); this.createdNics.Add(nicId); Console.WriteLine(nicCreateSpec); nicInfo = this.ethernetService.Get(this.vmId, nicId); Console.WriteLine("VM ID=" + this.vmId); Console.WriteLine("Ethernet NIC ID=" + nicId); Console.WriteLine(nicInfo); Console.WriteLine("\n\n#### Example: Create Ethernet NIC using" + " distributed portgroup and specifying start_connected=true," + " allow_guest_control=true, mac_type, mac_address," + " wake_on_lan=enabled."); nicBackingSpec = new EthernetTypes.BackingSpec(); nicBackingSpec.SetNetwork(stdNetworkId); nicBackingSpec.SetType( EthernetTypes.BackingType.STANDARD_PORTGROUP); nicCreateSpec = new EthernetTypes.CreateSpec(); nicCreateSpec.SetAllowGuestControl(true); nicCreateSpec.SetMacType(EthernetTypes.MacAddressType.MANUAL); nicCreateSpec.SetMacAddress("24:68:10:12:14:16"); nicCreateSpec.SetBacking(nicBackingSpec); nicId = this.ethernetService.Create(this.vmId, nicCreateSpec); this.createdNics.Add(nicId); Console.WriteLine(nicCreateSpec); nicInfo = this.ethernetService.Get(this.vmId, nicId); Console.WriteLine("VM ID=" + this.vmId); Console.WriteLine("Ethernet NIC ID=" + nicId); Console.WriteLine(nicInfo); String lastNicId = nicId; Console.WriteLine( "\n\n#### Example: Update Ethernet NIC with different" + " backing."); nicBackingSpec = new EthernetTypes.BackingSpec(); nicBackingSpec.SetType( EthernetTypes.BackingType.STANDARD_PORTGROUP); nicBackingSpec.SetNetwork(stdNetworkId); EthernetTypes.UpdateSpec nicUpdateSpec = new EthernetTypes.UpdateSpec(); nicUpdateSpec.SetBacking(nicBackingSpec); this.ethernetService.Update(this.vmId, lastNicId, nicUpdateSpec); Console.WriteLine(nicUpdateSpec); nicInfo = this.ethernetService.Get(this.vmId, lastNicId); Console.WriteLine("VM ID=" + this.vmId); Console.WriteLine("Ethernet NIC ID=" + lastNicId); Console.WriteLine(nicInfo); Console.WriteLine("\n\n#### Example: Update the Ethernet NIC," + " wake_on_lan = false, mac_type=GENERATED," + " startConnected = false, allowGuestControl = false."); nicUpdateSpec = new EthernetTypes.UpdateSpec(); nicUpdateSpec.SetAllowGuestControl(false); nicUpdateSpec.SetStartConnected(false); nicUpdateSpec.SetWakeOnLanEnabled(false); this.ethernetService.Update(this.vmId, lastNicId, nicUpdateSpec); Console.WriteLine(nicUpdateSpec); nicInfo = this.ethernetService.Get(this.vmId, lastNicId); Console.WriteLine("VM ID=" + this.vmId); Console.WriteLine("Ethernet NIC ID=" + lastNicId); Console.WriteLine(nicInfo); Console.WriteLine("\n\n#### Powering on VM to run " + "connect/disconnect example."); this.powerService.Start(this.vmId); nicInfo = this.ethernetService.Get(this.vmId, lastNicId); Console.WriteLine("VM ID=" + this.vmId); Console.WriteLine("Ethernet NIC ID=" + lastNicId); Console.WriteLine(nicInfo); Console.WriteLine("\n\n#### Example: Connect Ethernet NIC after" + " powering on VM."); this.ethernetService.Connect(this.vmId, lastNicId); nicInfo = this.ethernetService.Get(this.vmId, lastNicId); Console.WriteLine("VM ID=" + this.vmId); Console.WriteLine("Ethernet NIC ID=" + lastNicId); Console.WriteLine(nicInfo); Console.WriteLine("\n\n#### Example: Disconnect Ethernet NIC after" + " powering on VM."); this.ethernetService.Disconnect(this.vmId, lastNicId); nicInfo = this.ethernetService.Get(this.vmId, lastNicId); Console.WriteLine("VM ID=" + this.vmId); Console.WriteLine("Ethernet NIC ID=" + lastNicId); Console.WriteLine(nicInfo); // Power off the VM Console.WriteLine("\n\n#### Powering off the VM after" + " connect/disconnect example."); this.powerService.Stop(this.vmId); nicInfo = this.ethernetService.Get(this.vmId, lastNicId); Console.WriteLine("VM ID=" + this.vmId); Console.WriteLine("Ethernet NIC ID=" + lastNicId); Console.WriteLine(nicInfo); }