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

New-NsxLogicalRouterStaticRoute error #585

Open drewloveland opened 5 years ago

drewloveland commented 5 years ago

Attempting to add a static route to a logical router:

Get-NsxLogicalRouter "myDLR" | Get-NsxLogicalRouterRouting | `
New-NsxLogicalRouterStaticRoute -Vnic 3 -AdminDistance 1 -NextHop "100.99.255.13"  -Network "100.99.1.0/24"

...produces the following error:

invoke-nsxwebrequest : Invoke-NsxWebRequest : The NSX API response received indicates a failure. 400 : Bad Request : Response Body: <?xml version="1.0" encoding="UTF-8"?>
<error><errorCode>10105</errorCode><details>Failed to publish configuration on NSX Edge appliance. null</details><moduleName>vShield Edge</moduleName></error>
At C:\Program Files (x86)\WindowsPowerShell\Modules\PowerNSX\3.0.1125\PowerNSX.psm1:19998 char:21

Note that the first 2 piped commands return normally (Get-NsxLogicalRouter and Get-NsxLogicalRouterRouting).

alagoutte commented 5 years ago

Hi,

What release of NSX do you are using ?

do you have try to don't specify some parameter ? (like Vnic or AdminDistance)

drewloveland commented 5 years ago

6.4.1 I tried with just -NextHop and -Network and the error was the same.

alagoutte commented 5 years ago

what do you have with Get-NsxLogicalRouter "myDLR" | Get-NsxLogicalRouterRoutin

there is interface with IP on range 100.99.255.x ?

drewloveland commented 5 years ago
PS C:\windows\System32> Get-NsxLogicalRouter "Private Services DLR" | Get-NsxLogicalRouterRouting

version             : 54
enabled             : true
routingGlobalConfig : routingGlobalConfig
staticRouting       : staticRouting
ospf                : ospf
bgp                 : bgp
logicalrouterId     : edge-5

Yes, there is an interface for the IP range in question (the IPs I posted above are not the actual IPs I'm using). In fact there are already 2 other static routes created but they were done manually. Creating this route is successful if done manually using the vSphere web interface.

alagoutte commented 5 years ago

what do you have on staticRouting ? (Get-NsxLogicalRouter "Private Services DLR" | Get-NsxLogicalRouterRouting).staticRouting

Do you have a defaultRoute ?

drewloveland commented 5 years ago

Yes there is a default route.

PS C:\Windows\System32> (Get-NsxLogicalRouter "Private Services DLR" | Get-NsxLogicalRouterRouting)

version             : 108
enabled             : true
routingGlobalConfig : routingGlobalConfig
staticRouting       : staticRouting
ospf                : ospf
bgp                 : bgp
logicalrouterId     : edge-5

PS C:\Windows\System32> (Get-NsxLogicalRouter "Private Services DLR" | Get-NsxLogicalRouterRouting).staticRouting

defaultRoute staticRoutes
------------ ------------
defaultRoute staticRoutes

PS C:\Windows\System32> (Get-NsxLogicalRouter "Private Services DLR" | Get-NsxLogicalRouterRouting).staticRouting.defaultRoute

vnic description gatewayAddress adminDistance
---- ----------- -------------- -------------
2                100.82.254.10  1            
alagoutte commented 5 years ago

and on staticRoutes ?

alagoutte commented 5 years ago

Try on NSX-V 6.4.5 and work on for me...

drewloveland commented 5 years ago

Static routes:

PS C:\Windows\system32> (Get-NsxLogicalRouter "Private Services DLR" | Get-NsxLogicalRouterRouting).staticRouting.staticRoutes.route

description   : 
type          : user
vnic          : 3
network       : 100.82.3.0/24
nextHop       : 100.82.255.10
adminDistance : 1

description   : 
type          : user
vnic          : 3
network       : 100.82.4.0/24
nextHop       : 100.82.255.11
adminDistance : 1

description   : 
type          : user
vnic          : 3
network       : 10.160.26.192/26
nextHop       : 100.82.255.12
adminDistance : 1