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

Disable or turn off feature with PowerNSX #636

Closed dwchan69 closed 3 years ago

dwchan69 commented 3 years ago

I am able to automate most of what I want to a DLR with PowerNSX. However, I can't seem to find the coomandlet or switch to disable the following

I can enable BGP GracefulRestart (which I think is by default) with $dlr2 = Get-NsxLogicalRouter -Name Test-DLR2 $dlr2 | Get-NsxLogicalRouterRouting | Set-NsxLogicalRouterRouting -EnableBgpRouteRedistribution -confirm:$false

But I can't seem to find a way to disable BGP GracefulRestart?

I can enable Route Redistribution Status for BGP with $dlr2 = Get-NsxLogicalRouter -Name Test-DLR2 $dlr2 | Get-NsxLogicalRouterRouting | Set-NsxLogicalRouterRouting -EnableBgpRouteRedistribution -confirm:$false

But I can't seem to find a way to disable it for OSPF

Now, this is not required but would be nice. I can add new entries to Route Redistribution Table with $dlr2 = Get-NsxLogicalRouter -Name Test-DLR2 $dlr2 | Get-NsxLogicalRouterRouting | New-NsxLogicalRouterRedistributionRule -FromConnected -Learner bgp -confirm:$false

But I can't seem to find a way to remove exist OSPF entries

Not sure if this is the limitation to PowerNSX, so any comment or feedback would be appreciated

alagoutte commented 3 years ago

Hi @dwchan69

I am able to automate most of what I want to a DLR with PowerNSX. However, I can't seem to find the coomandlet or switch to disable the following

I can enable BGP GracefulRestart (which I think is by default) with $dlr2 = Get-NsxLogicalRouter -Name Test-DLR2 $dlr2 | Get-NsxLogicalRouterRouting | Set-NsxLogicalRouterRouting -EnableBgpRouteRedistribution -confirm:$false

There is a typo You can to say :

$dlr2 | Get-NsxLogicalRouterRouting | Set-NsxEdgeBGP -GracefulRestart -confirm:$false

But I can't seem to find a way to disable BGP GracefulRestart?

use -Gracefulrestart:$false

I can enable Route Redistribution Status for BGP with $dlr2 = Get-NsxLogicalRouter -Name Test-DLR2 $dlr2 | Get-NsxLogicalRouterRouting | Set-NsxLogicalRouterRouting -EnableBgpRouteRedistribution -confirm:$false

But I can't seem to find a way to disable it for OSPF

use

$dlr2 | Get-NsxLogicalRouterRouting | Set-NsxLogicalRouterRouting -EnableOspfRouteRedistribution:$false -Confirm:$false

Now, this is not required but would be nice. I can add new entries to Route Redistribution Table with $dlr2 = Get-NsxLogicalRouter -Name Test-DLR2 $dlr2 | Get-NsxLogicalRouterRouting | New-NsxLogicalRouterRedistributionRule -FromConnected -Learner bgp -confirm:$false

But I can't seem to find a way to remove exist OSPF entries You can use

Get-NsxLogicalRouter LogicalRouter01 | Get-NsxLogicalRouterRouting | Get-NsxLogicalRouterRedistributionRule -Learner ospf | Remove-NsxLogicalRouterRedistributionRule

i will be remove all OSPF Redistribution Rule

Not sure if this is the limitation to PowerNSX, so any comment or feedback would be appreciated

dwchan69 commented 3 years ago

Awesome, I was declaring the boolean as just $false without the colon and getting XML format error. Will give this a try. Thank you so much again for the speedy response

dwchan69 commented 3 years ago

Update, I was able to disable gracefulRestart on the DLR with this

$dlr2 | Get-NsxLogicalRouterRouting | Set-NsxLogicalRouterBgp -GracefulRestart:$false -confirm:$false

And it turns out that once I disable OSPF Router Redistribution as pointed out by you, the existing OSPF rule got auto deleted ;)

$dlr2 | Get-NsxLogicalRouterRouting | Set-NsxLogicalRouterRouting -EnableOspfRouteRedistribution:$false -Confirm:$false

Thank you again for the helps

alagoutte commented 3 years ago

You're welcome :)