vRealize Orchestrator : Remove network card by MAC

0 Flares Filament.io 0 Flares ×

In one of my previous posts I showed you the vRO action to find network card by its MAC address. Today is the time to create vRO workflow to remove the card with the specific MAC addressThis action I created because I really needed one time to create a workflow to delete a network interface from VM, as VM has more than one interface, the best way to have it unique is to do this with MAC address. Of course such workflow is not available by default in vRO so I had to create it. As it had to be developed quickly, so there is no data validation implemented. If anyone would like to reuse it, I strongly encourage you to do the implement data validation

Workflow will take 2 input values

  • VM of type VC:VirtualMachine
  • macAddress, type string

Basically it’s pretty easy. At the beginning I’m making use of an action I presented in previous port. Action returns a value of “any” type – which in fact is a “device” type or “null” if card is not found. Then I’m using a “Custom decision” and I check if the returned value is not “null”

So if the returned value is “null” I’m just displaying information that no network card was found with provided MAC address.
If value returned from action is not “null”, I have a scriptable task to remove device returned from the action.
The scriptable task will take 2 input values : networkCard of “Any” type, vm of “VC:VirtualMachine” type and it will return one value of type “VC:Task”

The code for the scriptable task is as follows

So except displaying some information, the general code is to prepare a device configuration specification and finally create a virtual machine task to apply prepared configuration.
Last step in this workflow is built-in action to wait till the task returned from “Scriptable task” is finished.

0 Flares LinkedIn 0 Google+ 0 Facebook 0 Twitter 0 Filament.io 0 Flares ×

Leave a Reply

Your email address will not be published. Required fields are marked *