første xml update
[virt-orchestrator.git] / vFLOWER / content / Actions / com.vmware.library.vc.vm.network / getNicByNumber.action.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <dunes-script-module name="getNicByNumber" result-type="Any" api-version="3.1.0" id="52572177-7426-4652-9477-a3f38dc1b6b9" version="0.2.0" allowed-operations="fv">
3     <description>Return a Network card device (VimVirtualE1000, VimVirtualVmxnet, VimVirtualPCNet32). The network position let you choose if you want to get the 1st, 2nd... 5th network card.</description>
4
5     <param n="vm" t="VC:VirtualMachine">VM from which to get the network card</param>
6
7     <param n="nicPosition" t="number">Let you choose if you want to get the 1st, 2nd... 5th network card. If no valid value, 1st if used.</param>
8
9     <script encoded="false">
10 var devices = vm.config.hardware.device;
11 if (nicPosition &lt;= 0 || nicPosition &gt; 5) nicPosition = 1;
12 var actualPos = 1;
13 for (var i in devices) {
14         if (System.getModule("com.vmware.library.vc.vm.network").isSupportedNic(devices[i])) {
15                 if (actualPos++ == nicPosition) {
16                         System.log("Found a Virtual Ethernet card at " + i + ". Key: " + devices[i].key);
17                         return devices[i];
18                 }
19         }
20
21 }
22 return null
23     </script>
24 </dunes-script-module>