Migration/vSphere/RiverMeadow.VSphereNetworkConfiguration/RiverMeadow.VSphereNetworkConfiguration.psm1
class RMVSphereBaseNetworkConfiguration { [string] $IPType [string] $IPAddress [string] $Netmask [string] $DefaultGateway [string] $PrimaryDNS [string] $SecondaryDNS RMVSphereBaseNetworkConfiguration([string] $IPType, [string] $IPAddress, [string] $Netmask, [string] $DefaultGateway, [string] $PrimaryDNS, [string] $SecondaryDNS) { if ([string]::IsNullOrEmpty($IPType)) { $this.IPType = "dhcp" } else { $this.IPType = $IPType.ToLower() } $this.IPAddress = $IPAddress $this.Netmask = $Netmask $this.DefaultGateway = $DefaultGateway $this.PrimaryDNS = $PrimaryDNS $this.SecondaryDNS = $SecondaryDNS } [string[]] GetNetworkAndDvSwitchName([string] $NetworkName) { [string[]] $SplitData = $NetworkName -split "/" if ($SplitData.Count -eq 2) { return $SplitData[1], $SplitData[0] } return $SplitData[0], "" } } class RMVSphereDestinationNetworkConfiguration : RMVSphereBaseNetworkConfiguration{ [string] $DestinationNetworkName RMVSphereDestinationNetworkConfiguration () : base("dhcp", "", "", "", "", "") { } RMVSphereDestinationNetworkConfiguration ([string] $DestinationNetworkName, [string] $IPType, [string] $IPAddress, [string] $Netmask, [string] $DefaultGateway, [string] $PrimaryDNS, [string] $SecondaryDNS) : base ($IPType, $IPAddress, $Netmask, $DefaultGateway, $PrimaryDNS, $SecondaryDNS) { $this.DestinationNetworkName = $DestinationNetworkName } RMVSphereDestinationNetworkConfiguration ([string] $DestinationNetworkName, [string] $IPType, [string] $IPAddress, [string] $Netmask) : base ($IPType, $IPAddress, $Netmask, "", "", ""){ $this.DestinationNetworkName = $DestinationNetworkName } RMVSphereDestinationNetworkConfiguration ([string] $DestinationNetworkName, [string] $IPType) : base ($IPType, "", "", "", "", ""){ $this.DestinationNetworkName = $DestinationNetworkName } } class RMVSphereMigrationNetworkConfiguration : RMVSphereBaseNetworkConfiguration{ [string] $MigrationNetworkName RMVSphereMigrationNetworkConfiguration () : base("dhcp", "", "", "", "", "") { } RMVSphereMigrationNetworkConfiguration ([string] $MigrationNetworkName, [string] $IPType, [string] $IPAddress, [string] $Netmask, [string] $DefaultGateway, [string] $PrimaryDNS, [string] $SecondaryDNS) : base ($IPType, $IPAddress, $Netmask, $DefaultGateway, $PrimaryDNS, $SecondaryDNS) { $this.MigrationNetworkName = $MigrationNetworkName } RMVSphereMigrationNetworkConfiguration ([string] $MigrationNetworkName, [string] $IPType, [string] $IPAddress, [string] $Netmask) : base ($IPType, $IPAddress, $Netmask, "", "", ""){ $this.MigrationNetworkName = $MigrationNetworkName } RMVSphereMigrationNetworkConfiguration ([string] $MigrationNetworkName, [string] $IPType) : base ($IPType, "", "", "", "", ""){ $this.MigrationNetworkName = $MigrationNetworkName } } class RMVSphereIsolatedNetworkConfiguration : RMVSphereBaseNetworkConfiguration{ [string] $IsolatedNetworkName RMVSphereIsolatedNetworkConfiguration () : base("dhcp", "", "", "", "", "") { } RMVSphereIsolatedNetworkConfiguration ([string] $IsolatedNetworkName, [string] $IPType, [string] $IPAddress, [string] $Netmask, [string] $DefaultGateway, [string] $PrimaryDNS, [string] $SecondaryDNS) : base ($IPType, $IPAddress, $Netmask, $DefaultGateway, $PrimaryDNS, $SecondaryDNS) { $this.IsolatedNetworkName = $IsolatedNetworkName } RMVSphereIsolatedNetworkConfiguration ([string] $IsolatedNetworkName, [string] $IPType, [string] $IPAddress, [string] $Netmask) : base ($IPType, $IPAddress, $Netmask, "", "", ""){ $this.IsolatedNetworkName = $IsolatedNetworkName } RMVSphereIsolatedNetworkConfiguration ([string] $IsolatedNetworkName, [string] $IPType) : base ($IPType, "", "", "", "", ""){ $this.IsolatedNetworkName = $IsolatedNetworkName } } |