VMware Cloud Community
Sany_1973
Enthusiast
Enthusiast

vro code for create a nsx Load Balancer

Anybody have a vro/vco code for creating nsx load balancer ?

19 Replies
GayathriS
Expert
Expert

Could you check for this Doc and see if thats what you are looking for ?

https://docs.vmware.com/en/vRealize-Automation/7.3/sddc-load-balancer-as-a-service.pdf

regards

Gayathri

Sany_1973
Enthusiast
Enthusiast

Thanks for the reply. I am looking for NSX load balancer.

0 Kudos
bdamian
Expert
Expert

Hi there,

What you ask has so many possibilities that makes it very difficult to answer. Load balancer service has several components, Profile, Virtual Server, Pools, Monitor. And can be configured in a new or an existing Edge. My advice is that you configure a Load Balancer by hand and then give us the option you set for each component.

If you want to play around with something, I recommend you to take a look in the object "NSXAdvancedEdgeLBManager" in vRO using NSX plugin 1.2

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
0 Kudos
Sany_1973
Enthusiast
Enthusiast

I created a workflow for NSX edge and I can enable it for LB later.

Thanks

0 Kudos
Sany_1973
Enthusiast
Enthusiast

I created a script for create Edge, But How can I enabled the edge for Loadbalancer?

0 Kudos
Sany_1973
Enthusiast
Enthusiast

I created a script for enable Edge as Loadbalancer.

But how can I bring it in VRA like following picture.

pastedImage_0.png

0 Kudos
bdamian
Expert
Expert

You can't do that. You can't add an external component to a Deployment. The elements in a Deployment are defined in the blueprint.

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
0 Kudos
Sany_1973
Enthusiast
Enthusiast

Thank you for the reply. Can I add the NSX loadbalancer as a custom resource?

So that user can select it and do the reconfigure operation.

0 Kudos
bdamian
Expert
Expert

Yes, you can do that. First you need to define a Custom Resource to map the Orchstrator object, then you can create an XaaS Blueprint pointing to a Orchestrator workflows that returns the load balancer as output parameter. Finally, you create the needed XaaS actions.

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
Sany_1973
Enthusiast
Enthusiast

Thank you. I created NSX edge and enabled the Load balancer portion by vro code.But looking for a vro code to output the loadbalancer object from the NSX Edge.

0 Kudos
bdamian
Expert
Expert

That is the easiest part. Surely you have the edge-id, right? You need to use this:

var edgeObj = NSXEdgeManager.getEdge(NSXConnection, edgeId);

Create an output parameter "outEdge" in your workflow and set the type as NSXEdge and then:

outEdge = edgeObj;

That's it. All you need now is an XaaS Blueprint in vRA pointing to your workflow.

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
0 Kudos
Sany_1973
Enthusiast
Enthusiast

Thank you. In this method it will output Edge not LoadBalancer ?

0 Kudos
bdamian
Expert
Expert

Oh, I see... That is a little bit more difficult.

There is no LoadBalancer object as such in NSX. A load balancer is a group of objects (virtual server, monitor, pool, etc). So, if you provision a NSX Edge and call it "Load Balancer xxx" is a good work around for me (is what Blueprints do).

Another way is to retrieve a NSXLoadBalancerPool and treat it as a load balncer in vRA. The hardest way is to model your own Load Balancer object with Dynamic Types (I've done that) but the learning curve is very high.

Hope this helps

D.

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
Sany_1973
Enthusiast
Enthusiast

Hi bdamian,

So Can we make an object (loadbalancer object) from a vRO workflow, same like vRA create while we deploy a on-demand loadbalancer ?

Thanks,

0 Kudos
bdamian
Expert
Expert

Yes, you can. But...

1) The loadbalancer will be placed in his own tab (not Deployments nor Machines) and cannot be added to an existing deployment.

2) It takes some effort (at least the first time) to develop this solution.

Here is a video I've made with vRA 6.2 but it's almost the same solution for 7.x:

LoadBalancer Service self-management with vRealize Automation and NSX - YouTube

(I have a new version with better looking actions)

In the youtube channel you will find same solution for DNat and Firewall rules.

Is this what you have in mind?

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
Sany_1973
Enthusiast
Enthusiast

Yes. This is what I am looking for.

I am looking for a code to create and present loadbalancer object to the vRA GUI so that users can use custom actions to add node or reconfigure

0 Kudos
bdamian
Expert
Expert

Well, as you could see, it is possible (I've done it). But it's too complex to share it here.

My solution was to create my own custom object with Dynamic Types plugin. But I'm sure that you can use an object from the NSX plugin.

D.

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
Sany_1973
Enthusiast
Enthusiast

Hi Thank you very much bdamian

So we need to create a dynamic type for loadbalancer connect with nsx vro plugin ?

0 Kudos
bdamian
Expert
Expert

If you want something like you saw in the video then yes. But you could find a easier approach using an existing NSX object like "Pool". As I said before, I had to learn a couple of things as prerequisites of what is showed in the video.

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
0 Kudos