vmware-archive / powernsx

PowerShell module that abstracts the VMware NSX-v API to a set of easily used PowerShell functions
173 stars 90 forks source link

How to build XML Element? #613

Open Kyleset opened 4 years ago

Kyleset commented 4 years ago

Hi all, and @alagoutte . Since there isn't a native cmdlet way of submitting BGP filters to a BGP neighbor on an ESG. Trying to get a good example of how to generate a XmlElement to submit bgp filters on a neighbor in an ESG. Can anybody help? I'm making the assumption that I would build the ESG and the neighbors through the normal cmdlet, and then build the XmlElement to submit the BGP filters.

Thanks! -Kyle

alagoutte commented 4 years ago

Hi @Kyleset

It is not easy because there is no API call for only configure BGP (or other routing protocol) You need to push all routing settings on the same times

You can look how to add static route is make, it can be help for this...

Kyleset commented 4 years ago

@alagoutte Thanks for the reply. Sounds like you are saying to construct the whole ESG, with neighbours, bgp filters and all in one XML. Then submit the whole XML via API?

alagoutte commented 4 years ago

@alagoutte Thanks for the reply. Sounds like you are saying to construct the whole ESG, with neighbours, bgp filters and all in one XML. Then submit the whole XML via API?

Yes !

alagoutte commented 4 years ago

do you have found how to build the XML ?

Kyleset commented 4 years ago

I got tied up working on some other issues. I'm going to start looking at this today. Should I build the XML and submit via invoke-nsxrestmethod or invoke-webrequest?

alagoutte commented 4 years ago

Should I build the XML and submit via invoke-nsxrestmethod or invoke-webrequest? Yes or you can use also Set-NSXEdgeRouting (with only Routing XML part)

Kyleset commented 4 years ago

I ended up just building a full xml to submit via an api call, and submitted via invoke-nsxrestmethod. Which worked just fine. Then went back and ripped out all of the creation of routing using cmdlets. Makes me wish I had just built the api call in the first place. Would have saved me a lot of time. Especially since I am also using 4 byte AS numbers. Thanks for your help. -Kyle