Skip to content

Instantly share code, notes, and snippets.

@gowatana
Last active June 11, 2018 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gowatana/b62a77772fedbe01d56aa75371572d34 to your computer and use it in GitHub Desktop.
Save gowatana/b62a77772fedbe01d56aa75371572d34 to your computer and use it in GitHub Desktop.
@'
# Usage:
# PowerNSX> .\migrate_hol_nw.ps1 <ESG_IF_NAME>
$if_name = $args[0]
$tz = Get-NsxTransportZone -Name "RegionA0-Global-TZ"
$src_esg = Get-NsxEdge -Name "Perimeter-Gateway-01"
$dst_dlr = Get-NsxLogicalRouter -Name "Distributed-Router-01"
# Disconnect from ESG
$if = $src_esg | Get-NsxEdgeInterface -Name $if_name
$if_ip = $if.addressGroups.addressGroup.primaryAddress
$if_prefix = $if.addressGroups.addressGroup.subnetPrefixLength
$if_pg_name = $if.portgroupName
$if | Clear-NsxEdgeInterface -Confirm:$false
$if_pg = Get-NsxLogicalSwitch -TransportZone $tz -Name $if_pg_name
# Disconnect to DLR
$dlr_if = $dst_dlr | New-NsxLogicalRouterInterface -Name $if_name -Type internal -ConnectedTo $if_pg -PrimaryAddress $if_ip -SubnetPrefixLength $if_prefix
$dst_dlr | Get-NsxLogicalRouterInterface -Name $if_name | %{
$ip = $_.addressGroups.addressGroup
$_ | select `
Index,
type,
name,
connectedToName,
@{N="primaryAddress";E={$ip.primaryAddress}},
@{N="Prefix";E={$ip.subnetPrefixLength}}
}
'@ | Out-File .\migrate_hol_nw.ps1
@gowatana
Copy link
Author

gowatana commented Jun 10, 2018

HOL-1803-01-NET - VMware NSX - Getting Started
http://labs.hol.vmware.com/HOL/catalogs/lab/3661
P.224 むけ。

@gowatana
Copy link
Author

下記の投稿むけ。

NSX の HoL シナリオを PowerNSX でためす。Part.6
https://communities.vmware.com/people/gowatana/blog/2018/06/11/hol1803-powernsx-6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment