første xml update
[virt-orchestrator.git] / vFLOWER / content / Actions / no.uio / createVirtualEthernetCardDvNetworkConfigSpec.action.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <dunes-script-module name="createVirtualEthernetCardDvNetworkConfigSpec" result-type="Any" api-version="3.1.0" id="a6ec564a-c18b-4b40-abc1-4270d7fd4a4d" version="2.0.0" allowed-operations="fve">
3     <description>
4 Create a new VimVirtualDeviceConfigSpec for a VimVirtualEthernetCardNetworkBackingInfo
5 The virtual Ethernet card backing class.
6     </description>
7
8     <param n="dvPortgroup" t="VC:DistributedVirtualPortgroup"/>
9
10     <param n="macAddress" t="string"/>
11
12     <script encoded="false">
13 // Create connectable info for dvPortgroup
14 var connectInfo = new VcVirtualDeviceConnectInfo();
15 connectInfo.allowGuestControl = false;
16 connectInfo.connected = false;
17 connectInfo.startConnected = true;
18 // Create Network BackingInfo
19 var dvsPortConnection = new VcDistributedVirtualSwitchPortConnection();
20 var dvSwitch = VcPlugin.convertToVimManagedObject(dvPortgroup, dvPortgroup.config.distributedVirtualSwitch);
21 dvsPortConnection.switchUuid = dvSwitch.uuid;
22 dvsPortConnection.portgroupKey = dvPortgroup.key;
23
24 var netBackingInfo = new VcVirtualEthernetCardDistributedVirtualPortBackingInfo() ;
25 netBackingInfo.port = dvsPortConnection;
26
27 //new VimVirtualEthernetCardNetworkBackingInfo();
28 //netBackingInfo.deviceName = dvPortGroup.name;
29
30 // Create VirtualNetwork
31 //var vNetwork = new VcVirtualPCNet32();
32 var vNetwork = new VcVirtualVmxnet3();
33 vNetwork.backing = netBackingInfo;
34 vNetwork.key = 0;
35 vNetwork.unitNumber = 0;
36 if ( macAddress != null  &amp;&amp;  macAddress != "" )  {
37         vNetwork.addressType = "Manual";
38         vNetwork.macAddress = macAddress;
39 }
40 else  {
41         vNetwork.addressType = "Generated";
42 }
43 vNetwork.connectable = connectInfo;
44 // Create Network ConfigSpec
45 var deviceConfigSpec = new VcVirtualDeviceConfigSpec();
46 deviceConfigSpec.device = vNetwork;
47 deviceConfigSpec.operation = VcVirtualDeviceConfigSpecOperation.add;
48
49 return deviceConfigSpec;
50     </script>
51 </dunes-script-module>