Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

Add ip route in vRO

$
0
0

I am trying to add a new route to our ESXi host using vRO. I've tried a few different things, but nothing seems to be working. My current script successfully launches a task to 'update the IP route table configuration', but the changes are not applied.

 

Before anyone suggests it, I am already calling a powershell script to use the 'New-VMHostRoute' cmdlet, but I want to do this via the API, and remove powershell altogether.

 

Has anyone done this before?

 

 

Current script:

var configmanager = host.configManager;
var networkSystem = configmanager.networkSystem;
var netStackArray = networkSystem.networkConfig.netStackSpec;


for each (var netStack in netStackArray) {

System.log(netStack.netStackInstance.name);
if (netStack.netStackInstance.name == "defaultTcpipStack") {
  var routeTableConfig = netStack.netStackInstance.routeTableConfig;
 
  //Build IP route entry
  myRoute = new VcHostIpRouteEntry() ;
  myRoute.deviceName = "vmk0" ;
  myRoute.gateway = "192.168.1.1";
  myRoute.network = "192.168.1.0";
  myRoute.prefixLength = 24 ;
 
  var myVcHostIpRouteOp = new VcHostIpRouteOp() ;
  myVcHostIpRouteOp.changeOperation = "add" ;
  myVcHostIpRouteOp.route = myRoute ;
 
  // Add Ip route entry to the array of routes
  routeTableConfig.ipRoute.push(myVcHostIpRouteOp);
 
  // Apply change to host
  networkSystem.updateIpRouteTableConfig(routeTableConfig);
 

 

}
}


Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>