Hello,
I'm trying to figure out how can I allow user to select network from dropdown list while filling out deployment form.
In my Project I use network constraints to select Network Profile. Within Network Profile I have two existing Networks added.
I would like to allow user to select one of those Networks while filling the blueprint form.
Could you please provide some examples how to achieve such functionality.
Thanks,
Michal
What's the use case for network selection after you have scoped it down with tagging?
You could always add an additional tagging contraint on the networks within the profile itself and add an input that the user then selects an option for that tag. For example, we have networks bundled with tags for regions, tenants, etc. Within a profile, I have networks for app/web/db. Those are selected by the "Server type" input (just as an example..) and then the placement engine should scope it down to the right network for you.
To make it prettier, you coud always use the 'oneOf' operator on the input list to give a pretty name with a corresponding value. Then use that value as a tag constraint on your network interface.
I assume this is a generic blueprint form and you don't necessarily know which network it will fall into until the options are selected by the user.
@ j_dubs
Thanks for your reply.
The use case is as you guessed.
I want to allow users within Project to select ServerType. The case is that for single ServerType there might be many available networks (for example for ApplicationServerType there might be two networks: APP1 network and APP2 network). So after user selects ServerType from custom form dropdown field, the Network dropdown should update its items to match networks available for this specific ServerType.
I have achieved such behaviour by writing vRO action that takes ServerType and Project as an input parameters and returns array of network tags. Unfortunatly mapping between [project, serverType] -> [network:tag1, network:tag2, ...] is embedded into code. I don't know (for now) how to retrieve networks assigned to project by network constraints.
It would be very nice if somebody could share some code to retrieve Networks available for Project. Unless there is some simpler solution...
I have the same use case and in fact this was pretty easy to achieve in 7.6 by using the getApplicableNetworks action. This action would look at the networks assigned to the business group and return it. Since the move to selection by tag this is making it a bit more difficult for us as well. We could tag all of these networks and then populate a list based on those tags, but we still need to figure out the 8.1 equivalent of getApplicableNetworks that existed previously.
formatVersion: 1
inputs:
environment:
type: string
oneOf:
- title: Development
const: D
- title: Lab
const: L
- title: Management
const: M
- title: Production
const: P
- title: Staging
const: S
- title: Testing
const: T
title: Select Environment
description: Specify which environment this VM should be deployed in.
image1:
type: string
oneOf:
- title: Windows Server 2019
const: Windows Server 2019
- title: Windows SQL Server 2019
const: Windows SQL Server 2019
- title: Windows Server 2016
const: Windows Server 2016
- title: Windows SQL Server 2016
const: Windows SQL Server 2016
- title: REDHAT Enterprise Linux 7
const: REDHAT Enterprise Linux 7
- title: SUSE Enterprise Linux 12
const: SUSE Enterprise Linux 12
- title: SUSE Enterprise Linux 15
const: SUSE Enterprise Linux 15
title: Select Image/OS
image2:
type: string
oneOf:
- title: Windows Server 2019
const: Windows Server 2019
- title: Windows SQL Server 2019
const: Windows SQL Server 2019
- title: Windows Server 2016
const: Windows Server 2016
- title: Windows SQL Server 2016
const: Windows SQL Server 2016
- title: REDHAT Enterprise Linux 7
const: REDHAT Enterprise Linux 7
- title: SUSE Enterprise Linux 12
const: SUSE Enterprise Linux 12
- title: SUSE Enterprise Linux 15
const: SUSE Enterprise Linux 15
title: Select Image/OS
image3:
type: string
oneOf:
- title: Windows Server 2019
const: Windows Server 2019
- title: Windows SQL Server 2019
const: Windows SQL Server 2019
- title: Windows Server 2016
const: Windows Server 2016
- title: Windows SQL Server 2016
const: Windows SQL Server 2016
- title: REDHAT Enterprise Linux 7
const: REDHAT Enterprise Linux 7
- title: SUSE Enterprise Linux 12
const: SUSE Enterprise Linux 12
- title: SUSE Enterprise Linux 15
const: SUSE Enterprise Linux 15
title: Select Image/OS
nets1:
type: string
oneOf:
- title: Web Server
const: web
- title: Application Server
const: app
- title: Database Server
const: db
nets2:
type: string
oneOf:
- title: Web Server
const: web
- title: Application Server
const: app
- title: Database Server
const: db
nets3:
type: string
oneOf:
- title: Web Server
const: web
- title: Application Server
const: app
- title: Database Server
const: db
flavor1:
type: string
oneOf:
- title: 'X-Small: 1 vCPU w/ 2GB RAM'
const: 'X-Small: 1 vCPU w/ 2GB RAM'
- title: 'Small: 2 vCPU w/ 4GB RAM'
const: 'Small: 2 vCPU w/ 4GB RAM'
- title: 'Medium: 4 vCPU w/ 8GB RAM'
const: 'Medium: 4 vCPU w/ 8GB RAM'
- title: 'Large: 6 vCPU w/ 12GB RAM'
const: 'Large: 6 vCPU w/ 12GB RAM'
- title: 'X-Large: 8 vCPU w/ 16GB RAM'
const: 'X-Large: 8 vCPU w/ 16GB RAM'
- title: '2X-Large: 12 vCPU w/ 32GB RAM'
const: '2X-Large: 12 vCPU w/ 32GB RAM'
flavor2:
type: string
oneOf:
- title: 'X-Small: 1 vCPU w/ 2GB RAM'
const: 'X-Small: 1 vCPU w/ 2GB RAM'
- title: 'Small: 2 vCPU w/ 4GB RAM'
const: 'Small: 2 vCPU w/ 4GB RAM'
- title: 'Medium: 4 vCPU w/ 8GB RAM'
const: 'Medium: 4 vCPU w/ 8GB RAM'
- title: 'Large: 6 vCPU w/ 12GB RAM'
const: 'Large: 6 vCPU w/ 12GB RAM'
- title: 'X-Large: 8 vCPU w/ 16GB RAM'
const: 'X-Large: 8 vCPU w/ 16GB RAM'
- title: '2X-Large: 12 vCPU w/ 32GB RAM'
const: '2X-Large: 12 vCPU w/ 32GB RAM'
flavor3:
type: string
oneOf:
- title: 'X-Small: 1 vCPU w/ 2GB RAM'
const: 'X-Small: 1 vCPU w/ 2GB RAM'
- title: 'Small: 2 vCPU w/ 4GB RAM'
const: 'Small: 2 vCPU w/ 4GB RAM'
- title: 'Medium: 4 vCPU w/ 8GB RAM'
const: 'Medium: 4 vCPU w/ 8GB RAM'
- title: 'Large: 6 vCPU w/ 12GB RAM'
const: 'Large: 6 vCPU w/ 12GB RAM'
- title: 'X-Large: 8 vCPU w/ 16GB RAM'
const: 'X-Large: 8 vCPU w/ 16GB RAM'
- title: '2X-Large: 12 vCPU w/ 32GB RAM'
const: '2X-Large: 12 vCPU w/ 32GB RAM'
count1:
type: integer
maxItems: 5
count2:
type: integer
maxItems: 5
count3:
type: integer
maxItems: 5
busUnit:
type: string
oneOf:
- title: Corporate Services
const: C
- title: External DMZ
const: E
- title: Lender Services
const: L
- title: Healthcare
const: H
- title: Personal Lines
const: P
- title: Quotit
const: Q
- title: Shared Services
const: S
title: Select Business Unit
description: Specify which Business Unit is associated with this request.
servRole:
type: string
oneOf:
- title: Application
const: AP
- title: Citrix
const: CX
- title: Domain Controller
const: DC
- title: File
const: FL
- title: Messaging
const: ME
- title: Utility
const: UT
title: Select Server Role
description: Specify what the server role/purpose will be.
servRole1:
type: string
oneOf:
- title: Web
const: WE
servRole3:
type: string
oneOf:
- title: Database
const: DB
resources:
Cloud_vSphere_Network_1:
type: Cloud.vSphere.Network
properties:
networkType: existing
name: web
constraints:
- tag: '${"network:" + to_lower(input.nets1)}'
- tag: '${input.environment == "P" ? "env:prod" : "env:nonprod"}'
CLoud_vSphere_Machine_1:
type: Cloud.vSphere.Machine
properties:
image: '${input.image1}'
flavor: '${input.flavor1}'
folderName: 'VRA_Machines/${env.projectName}'
name: null
count: '${input.count1}'
customizationSpec: '${contains(input.image1,"Windows") ? "W2k16w1" : "LinuxOS"}'
busUnit: '${input.busUnit}'
os-image: '${contains(input.image1, "Windows") ?"WV": "LV"}'
environment: '${input.environment}'
servRole: '${input.servRole1}'
networks:
- tags: []
network: '${resource.Cloud_vSphere_Network_1.id}'
assignment: static
assignIPv6Address: false
assignPublicIpAddress: false
Cloud_vSphere_Network_2:
type: Cloud.vSphere.Network
properties:
networkType: existing
name: app
constraints:
- tag: '${"network:" + to_lower(input.nets2)}'
- tag: '${input.environment == "P" ? "env:prod" : "env:nonprod"}'
Cloud_vSphere_Machine_2:
type: Cloud.vSphere.Machine
properties:
image: '${input.image2}'
flavor: '${input.flavor2}'
folderName: 'VRA_Machines/${env.projectName}'
name: null
count: '${input.count2}'
customizationSpec: '${contains(input.image2,"Windows") ? "W2k16w1" : "LinuxOS"}'
busUnit: '${input.busUnit}'
os-image: '${contains(input.image2, "Windows") ?"WV": "LV"}'
environment: '${input.environment}'
servRole: '${input.servRole}'
networks:
- tags: []
network: '${resource.Cloud_vSphere_Network_2.id}'
assignment: static
assignIPv6Address: false
assignPublicIpAddress: false
Cloud_vSphere_Network_3:
type: Cloud.vSphere.Network
properties:
networkType: existing
name: db
constraints:
- tag: '${"network:" + to_lower(input.nets3)}'
- tag: '${input.environment == "P" ? "env:prod" : "env:nonprod"}'
Cloud_vSphere_Machine_3:
type: Cloud.vSphere.Machine
properties:
image: '${input.image3}'
flavor: '${input.flavor3}'
folderName: 'VRA_Machines/${env.projectName}'
name: null
count: '${input.count3}'
customizationSpec: '${contains(input.image3,"Windows") ? "W2k16w1" : "LinuxOS"}'
busUnit: '${input.busUnit}'
os-image: '${contains(input.image3, "Windows") ?"WV": "LV"}'
environment: '${input.environment}'
servRole: '${input.servRole3}'
networks:
- tags: []
network: '${resource.Cloud_vSphere_Network_3.id}'
assignment: static
assignIPv6Address: false
assignPublicIpAddress: false
Thanks for posting an example of your setup!
I am familiar with selecting networks based on tags. The problem is we've got 100's of networks and with more created every day. We operate as somewhat of a MSP to our customers and so dynamically loading these fields was key in 7.6. We could certainly go through and tag each network, or better yet automate the tagging of the network. But we need a way to determine which networks are associated with a particular customer for the purpose of displaying this in a dropdown.
Also to the original poster, I hope you don't mind me chiming in. I almost started my own post, but figured I should search to see if had been answered before. This thread looked almost identical to my request. So I chimed in here.
So TAG each network. That is important. Then ll you have to do (in which I did in the request) is figure out a logical way to choose that network. I use hidden fields based off responses and proects to determine the network that it needs to be deployed on.
I want to achieve something similar, but not sure about the best approach.
Environments and networks are also separated by tags here, but not all projects are authorized to use all combinations. I need to track which are allowed in vRA8 admin interface and Service Broker as well.
So I was thinking about tagging the networks with the project name, but if I have many projects this can become a mess. How can I replicate the functionality of vRA7 reservations?
I think I could create a REST API request to fetch the networks tagged with the project name...
https://www.vrealize.it/2020/06/25/vrealize-automation-network-selection-in-request-form/ seemed to be a good idea, but does not prevent a user to request a network not entitled to via REST API. So I want to solve this with constraints instead.
Having multiple networks within a single profile and tagged differently sounds an interesting idea as well, not sure about where can this be a good fit.
Any suggestions appreciated.
I am also looking for a dropdown option to select networks when the user fills/requests the catalog based on cluster.
If anyone had a successful implementation of this. please help us