{"id":1271,"date":"2016-04-28T09:13:31","date_gmt":"2016-04-28T07:13:31","guid":{"rendered":"http:\/\/vthink.fr\/?p=1271"},"modified":"2017-12-17T14:14:32","modified_gmt":"2017-12-17T13:14:32","slug":"vro-retrieve-nsx-edge-load-balancer-vip-provisioned-by-vra","status":"publish","type":"post","link":"https:\/\/vthink.fr\/en\/2016\/04\/vro-retrieve-nsx-edge-load-balancer-vip-provisioned-by-vra\/","title":{"rendered":"vRO : Retrieve NSX edge load balancer VIP provisioned by vRA"},"content":{"rendered":"\n<!-- Quick Adsense WordPress Plugin: http:\/\/quickadsense.com\/ -->\n<div class=\"e93ad9a1ff002511692efbd236903a83\" data-index=\"1\" style=\"float: left; margin: 10px 10px 10px 0;\">\n<script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- ads1 -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:inline-block;width:300px;height:250px\"\r\n     data-ad-client=\"ca-pub-9785518987307332\"\r\n     data-ad-slot=\"8809267401\"><\/ins>\r\n<script>\r\n(adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n<p>Today, on this blog post i will show you how to retrieve the NSX Edge Load Balancer VIP provisioned by vRA.<\/p>\n<p>Currently i am using 3 VMware components in my LAB : vRealize Automation 7.0 , vRealize Orchestrator 7.0.1 and NSX 6.2.<\/p>\n<p><!--more--><\/p>\n<p>I have created a blueprint for the provisioning\u00a0of 2 VMs behind a load balancer.<\/p>\n<p>In my lab, i want to retrieve all the load balancer&#8217;s VIP provisioned by vRA in NSX. I will used API call for this work and vRO script to achieve my goal.<\/p>\n<p>So, the first thing to do :<\/p>\n<p>In vRO you have to create a <strong>HTTP Rest HOST<\/strong>. In my exemple , it will be <strong>https:\/\/NSXMANAGER\/API\/<\/strong><\/p>\n<p><img data-attachment-id=\"1274\" data-permalink=\"https:\/\/vthink.fr\/en\/2016\/04\/vro-retrieve-nsx-edge-load-balancer-vip-provisioned-by-vra\/nsxvravro1\/#main\" data-orig-file=\"https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO1.png?fit=1200%2C646&amp;ssl=1\" data-orig-size=\"1200,646\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"NSXVRAVRO1\" data-image-description=\"\" data-medium-file=\"https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO1.png?fit=300%2C162&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO1.png?fit=700%2C377&amp;ssl=1\" loading=\"lazy\" class=\"aligncenter wp-image-1274\" src=\"https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO1.png?resize=585%2C315&#038;ssl=1\" alt=\"NSXVRAVRO1\" width=\"585\" height=\"315\" srcset=\"https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO1.png?w=1200&amp;ssl=1 1200w, https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO1.png?resize=300%2C162&amp;ssl=1 300w, https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO1.png?resize=768%2C413&amp;ssl=1 768w, https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO1.png?resize=1024%2C551&amp;ssl=1 1024w, https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO1.png?resize=220%2C118&amp;ssl=1 220w, https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO1.png?resize=460%2C248&amp;ssl=1 460w, https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO1.png?resize=50%2C27&amp;ssl=1 50w\" sizes=\"(max-width: 585px) 100vw, 585px\" data-recalc-dims=\"1\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Create a new workflow and use a generic &#8220;<strong>Scriptable Task<\/strong>&#8220;. \u00a0I will simply named it &#8220;Retrieve Edge&#8221;.<\/p>\n<p><img data-attachment-id=\"1277\" data-permalink=\"https:\/\/vthink.fr\/en\/2016\/04\/vro-retrieve-nsx-edge-load-balancer-vip-provisioned-by-vra\/nsxvravro2\/#main\" data-orig-file=\"https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO2.png?fit=794%2C335&amp;ssl=1\" data-orig-size=\"794,335\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"NSXVRAVRO2\" data-image-description=\"\" data-medium-file=\"https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO2.png?fit=300%2C127&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO2.png?fit=700%2C295&amp;ssl=1\" loading=\"lazy\" class=\"aligncenter wp-image-1277\" src=\"https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO2.png?resize=645%2C272&#038;ssl=1\" alt=\"NSXVRAVRO2\" width=\"645\" height=\"272\" srcset=\"https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO2.png?w=794&amp;ssl=1 794w, https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO2.png?resize=300%2C127&amp;ssl=1 300w, https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO2.png?resize=768%2C324&amp;ssl=1 768w, https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO2.png?resize=220%2C93&amp;ssl=1 220w, https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO2.png?resize=460%2C194&amp;ssl=1 460w, https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO2.png?resize=50%2C21&amp;ssl=1 50w\" sizes=\"(max-width: 645px) 100vw, 645px\" data-recalc-dims=\"1\" \/><\/p>\n<p>The only input that i will add on this generic scriptable task is the &#8220;rest host&#8221; (My NSX Manager).<\/p>\n<p><img data-attachment-id=\"1279\" data-permalink=\"https:\/\/vthink.fr\/en\/2016\/04\/vro-retrieve-nsx-edge-load-balancer-vip-provisioned-by-vra\/nsxvravro3\/#main\" data-orig-file=\"https:\/\/i2.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO3.png?fit=964%2C147&amp;ssl=1\" data-orig-size=\"964,147\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"NSXVRAVRO3\" data-image-description=\"\" data-medium-file=\"https:\/\/i2.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO3.png?fit=300%2C46&amp;ssl=1\" data-large-file=\"https:\/\/i2.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO3.png?fit=700%2C107&amp;ssl=1\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1279\" src=\"https:\/\/i2.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO3.png?resize=700%2C107&#038;ssl=1\" alt=\"NSXVRAVRO3\" width=\"700\" height=\"107\" srcset=\"https:\/\/i2.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO3.png?w=964&amp;ssl=1 964w, https:\/\/i2.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO3.png?resize=300%2C46&amp;ssl=1 300w, https:\/\/i2.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO3.png?resize=768%2C117&amp;ssl=1 768w, https:\/\/i2.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO3.png?resize=220%2C34&amp;ssl=1 220w, https:\/\/i2.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO3.png?resize=460%2C70&amp;ssl=1 460w, https:\/\/i2.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO3.png?resize=50%2C8&amp;ssl=1 50w\" sizes=\"(max-width: 700px) 100vw, 700px\" data-recalc-dims=\"1\" \/><\/p>\n<!-- Quick Adsense WordPress Plugin: http:\/\/quickadsense.com\/ -->\n<div class=\"e93ad9a1ff002511692efbd236903a83\" data-index=\"1\" style=\"float: left; margin: 10px 10px 10px 0;\">\n<script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- ads1 -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:inline-block;width:300px;height:250px\"\r\n     data-ad-client=\"ca-pub-9785518987307332\"\r\n     data-ad-slot=\"8809267401\"><\/ins>\r\n<script>\r\n(adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n\n<p>In the &#8220;Scripting&#8221; tab,\u00a0we will first retrieve all the Edge located in the NSX Manager. We will use this URL . <strong>https:\/\/NSXMANAGER\/API\/4.0\/edges\/<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nvar request = restHost.createRequest(&quot;GET&quot;, &quot;4.0\/edges\/&quot;);  \/\/Get all Edge\r\nrequest.contentType = &quot;application\/xml&quot;;\r\nSystem.log(&quot;Check all Edge - Request URL: &quot; + request.fullUrl); \/\/Display request URL\r\nvar response = request.execute();\r\n\r\nif(response.statusCode != 200) throw(&quot;Could not GET edge list ! : &quot; + response.statusCode + &quot;\\n&quot; + response.contentAsString);\r\nvar edgelistXML = new XML(response.contentAsString); \/\/Convert response as String\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Then, we have to create a list of Edges created by vRA. In this case, vRA create a description with the value &#8220;Edge provisioned and managed by VMware vRealize Automation&#8221;. So basically , we just have to found a match.<\/p>\n<p>We will have a list of Edge&#8217;s ID provisioned by VRA.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\n\/\/ Get EdgeSummary node \r\n\r\nvar EdgeList = edgelistXML.edgePage.edgeSummary;\r\n\r\n\/\/Check for EdgeID provisioned by vRA.\r\n\r\nvar EdgeID = [];\r\n\r\nfor each (var edge in EdgeList) {\r\nif (edge.description.text() == &quot;Edge provisioned and managed by VMware vRealize Automation&quot;) {\r\nEdgeID.push(edge.objectId.text().toString());\r\n}\r\n}\r\n\r\nif (EdgeID.length == null) throw(&quot;No Edge found&quot;);\r\n\r\nSystem.log(&quot;Edge-Id found :&quot;+EdgeID);\r\n<\/pre>\n<p>Finally, if a match is found, we have to retrieve the VIP of our Edge based on our Edge ID. We have to call a &#8220;GET&#8221; on this URL : <strong>https:\/\/NSXMANAGER\/API\/4.0\/edges\/edge-id<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\n\/\/Check for VIP\r\n\r\nvar EdgeIP = [];\r\n\r\nfor each(var ID in EdgeID) {\r\nvar request = restHost.createRequest(&quot;GET&quot;, &quot;4.0\/edges\/&quot;+ID);\r\nrequest.contentType = &quot;application\/xml&quot;;\r\nSystem.log(&quot;Check VIP on Request URL: &quot; + request.fullUrl);\r\nvar response = request.execute();\r\nif(response.statusCode != 200) throw(&quot;Could not GET edge from ID ! : &quot; + response.statusCode + &quot;\\n&quot; + response.contentAsString);\r\nvar edgeconfXML = new XML(response.contentAsString);\r\nEdgeIP.push(edgeconfXML.features.loadBalancer.virtualServer.ipAddress.text().toString());\r\n}\r\n\r\nSystem.log(&quot;Edge IP :&quot;+EdgeIP);\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Then you will display the VIP of your NSX Edge Load Balancer provisioned by vRA.<\/p>\n<p><img data-attachment-id=\"1285\" data-permalink=\"https:\/\/vthink.fr\/en\/2016\/04\/vro-retrieve-nsx-edge-load-balancer-vip-provisioned-by-vra\/nsxvravro4\/#main\" data-orig-file=\"https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO4.png?fit=537%2C236&amp;ssl=1\" data-orig-size=\"537,236\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"NSXVRAVRO4\" data-image-description=\"\" data-medium-file=\"https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO4.png?fit=300%2C132&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO4.png?fit=537%2C236&amp;ssl=1\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1285\" src=\"https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO4.png?resize=537%2C236&#038;ssl=1\" alt=\"NSXVRAVRO4\" width=\"537\" height=\"236\" srcset=\"https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO4.png?w=537&amp;ssl=1 537w, https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO4.png?resize=300%2C132&amp;ssl=1 300w, https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO4.png?resize=220%2C97&amp;ssl=1 220w, https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO4.png?resize=460%2C202&amp;ssl=1 460w, https:\/\/i0.wp.com\/vthink.fr\/wp-content\/uploads\/NSXVRAVRO4.png?resize=50%2C22&amp;ssl=1 50w\" sizes=\"(max-width: 537px) 100vw, 537px\" data-recalc-dims=\"1\" \/><\/p>\n<p>On my next post, i will show you how to add a VM in a existing load balancer.<\/p>\n<p>&nbsp;<\/p>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div><!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Today, on this blog post i will show you how to retrieve the NSX Edge Load Balancer VIP provisioned by vRA. Currently i am using 3 VMware components in my LAB : vRealize Automation 7.0 , vRealize Orchestrator 7.0.1 and NSX 6.2.<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":2,"featured_media":1291,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1746,1747],"tags":[1701,1700,1717,1710,1711,1133,1718,1719,1706,1716,1709,1708,1705,1713,1715,1702,1707,1703,1046,1712,1058,1704,1066,1641,1071,1076,1661,1087,1086,1714,1662,1720],"_links":{"self":[{"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/posts\/1271"}],"collection":[{"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/comments?post=1271"}],"version-history":[{"count":11,"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/posts\/1271\/revisions"}],"predecessor-version":[{"id":1296,"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/posts\/1271\/revisions\/1296"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/media\/1291"}],"wp:attachment":[{"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/media?parent=1271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/categories?post=1271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/tags?post=1271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}