How can I configure a network interface controller name by using extensibility actions
You can configure the interface name of a network interface controller (NIC) by using
IaaS API calls applied through extensibility actions.
- You can only configure the NIC interface name prior to provisioning a compute resource. Therefore, only theCompute Provisionevent topic can be selected for relevant extensibility subscriptions.
- You can only configure NIC interface names for NICs that useMicrosoft Azureas a provider.
To configure the interface name of a NIC,
you must make
GET
and PATCH
calls to the
VMware Aria
Automation
IaaS API. By making a GET
call to
https://your_vRA_fqdn
/iaas/api/machines/{id}
,
you can retrieve the NIC link for the compute resource you want to modify. Then you
can make a PATCH
call to
https://your_vRA_fqdn
/iaas/api/machines/{id}
/network-interfaces/{nicld}
,
which includes the NIC interface name as a payload, to add the new name for your
NIC.The following scenario uses a sample Python script that can be used for NIC interface
name configuration. For your own use cases, you can use a different script and
script language, such as Node.js.
- Create the extensibility action.
- Navigate to.
- ClickNew Action.
- Enter a name and project for the extensibility action andNext.
- Add the NIC configuration script.The following is a sample Python script:import json def handler(context, inputs): # Get the machine info, which contains machine nic link response = context.request('/iaas/api/machines/'+inputs["resourceIds"][0], "GET", {}) # Build PATCH machine nic payload here name = "customized-nic-02"; data = {'name':name}; # Convert machine data string to json object response_json = json.loads(response["content"]) # Patch machine nic response_patch = context.request(response_json["_links"]["network-interfaces"]["hrefs"][0] + "?apiVersion=2021-07-15", 'PATCH', data) # return value is empty since we are not changing any compute provisioning parameters outputs = {} return outputsThe preceding sample script performs two primary operations through the IaaS API. First, the script uses aGETcall to retrieve the NIC link and then uses aPATCHcall to apply the interface name. In this sample, the NIC interface name is hard-coded into the script as"customized-nic-02".
- To finish editing the extensibility action, clickSave.
- Create a extensibility subscription.
- Navigate to.
- ClickNew Subscription.
- Enter a name for the extensibility subscription.
- UnderEvent Topic, selectCompute Provisionas the event topic for the extensibility subscription.
- UnderAction/workflow, select the extensibility action you created for NIC configuration.
- Enable event blocking.By enabling blocking, you make sure that the provisioning process is blocked until the extensibility action finishes its run.
- To finish editing the extensibility subscription, clickSave.
The new extensibility subscription runs when a compute provision event is triggered
and configures the NIC interface name for the compute resources to be provisioned.