Skip to content

Commit 6b2e1d8

Browse files
committed
Merge branch 'dev'
2 parents 7adda3a + 5484819 commit 6b2e1d8

12 files changed

+258
-217
lines changed

ChangeLog.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
### ChangeLog for vNugglets.VDNetworking PowerShell module
22

3-
#### v1.0, Jan 2017
3+
#### v1.1.0, Jan 2018
4+
- \[update] Added `-WhatIf` support to `New-VNVDTrafficRuleAction`, `New-VNVDTrafficRuleQualifier`
5+
- \[bugfix] `-Enabled` parameter on `Set-VNVDTrafficRuleSet` was not working as expected. Fixed
6+
- \[bugfix] Corrected issue where module loaded improperly if required VDS module was not already loaded
7+
- \[enhancement] Added check in ModuleManifest update code to report FileList accuracy every time
8+
- \[miscellaneous] Other various updates and optimizations
9+
10+
#### v1.0, Jan 2018
411
- initial public "prod" release of `master` branch
512
- published module in PowerShell Gallery
613

ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Chomping at the bit to get going with using this module? Of course you are! Go l
4343
<a id="examplesSection"></a>
4444
### Examples
4545
Examples are in two places:
46-
- periodically updated in the docs/ folder for the project at [docs/examples.md](docs/examples.md)
46+
- periodically updated in the docs/ folder for the project at [docs/examples.md](docs/examples.md), which is also accessible via the project's [GitHub Pages examples page](https://vnugglets.github.io/vNuggletsPSMod_vDNetworking/examples.html)
4747
- always up to date in the `Get-Help` examples for each cmdlet by checking out the help for each cmdlet (see [Getting Help](#gettingHelpSection) section below)
4848

4949
<a id="gettingHelpSection"></a>

Update-ThisModuleManifest.ps1

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,52 @@ param(
88
)
99
begin {
1010
$strModuleName = "vNugglets.VDNetworking"
11-
## some code to generate the module manifest
12-
$strFilespecForPsd1 = "$PSScriptRoot\$strModuleName\${strModuleName}.psd1"
11+
$strModuleFolderFilespec = "$PSScriptRoot\$strModuleName"
12+
$strFilespecForPsd1 = Join-Path $strModuleFolderFilespec "${strModuleName}.psd1"
1313

14-
$hshModManifestParams = @{
14+
## parameters for use by both New-ModuleManifest and Update-ModuleManifest
15+
$hshManifestParams = @{
1516
# Confirm = $true
1617
Path = $strFilespecForPsd1
17-
ModuleVersion = "1.0.0"
18+
ModuleVersion = "1.1.0"
1819
Author = "Matt Boren (@mtboren)"
1920
CompanyName = 'vNugglets for the VMware PowerCLI community'
2021
Copyright = "MIT License"
2122
Description = "Module with functions for managing VMware vSphere Virtual Distributed Networking components like traffic filtering and marking"
2223
# AliasesToExport = @()
23-
FileList = Write-Output "${strModuleName}.psd1" "${strModuleName}_ModRoot.psm1" "en-US\about_${strModuleName}.help.txt" GetItems.ps1 NewItems.ps1 RemoveItems.ps1 SetItems.ps1 "${strModuleName}_SupportingFunctions.ps1" "${strModuleName}.format.ps1xml"
24+
FileList = Write-Output "${strModuleName}.psd1" "${strModuleName}_ModRoot.psm1" "en-US\about_${strModuleName}.help.txt" GetItems.ps1 NewItems.ps1 RemoveItems.ps1 SetItems.ps1 "${strModuleName}_SupportingFunctions.ps1" "${strModuleName}.format.ps1xml" "${strModuleName}_init.ps1" "${strModuleName}_ClassDefinition.ps1"
2425
FormatsToProcess = "${strModuleName}.format.ps1xml"
2526
FunctionsToExport = Write-Output Get-VNVDTrafficFilterPolicyConfig Get-VNVDTrafficRuleSet Get-VNVDTrafficRule Get-VNVDTrafficRuleQualifier Get-VNVDTrafficRuleAction New-VNVDTrafficRuleQualifier New-VNVDTrafficRuleAction New-VNVDTrafficRule Remove-VNVDTrafficRule Set-VNVDTrafficRuleSet
2627
IconUri = "https://avatars0.githubusercontent.com/u/10615837"
2728
LicenseUri = "https://github.com/vNugglets/vNuggletsPSMod_vDNetworking/blob/master/License"
2829
NestedModules = Write-Output GetItems.ps1 NewItems.ps1 RemoveItems.ps1 SetItems.ps1 "${strModuleName}_SupportingFunctions.ps1"
2930
PowerShellVersion = [System.Version]"5.0"
3031
ProjectUri = "https://github.com/vNugglets/vNuggletsPSMod_vDNetworking"
31-
ReleaseNotes = "See release notes at https://github.com/vNugglets/vNuggletsPSMod_vDNetworking/blob/master/ChangeLog.md"
32+
ReleaseNotes = "See ReadMe and other docs at https://github.com/vNugglets/vNuggletsPSMod_vDNetworking"
33+
RequiredModules = "VMware.VimAutomation.Vds"
3234
RootModule = "${strModuleName}_ModRoot.psm1"
33-
ScriptsToProcess = "${strModuleName}_ClassDefinition.ps1"
35+
ScriptsToProcess = "${strModuleName}_init.ps1", "${strModuleName}_ClassDefinition.ps1"
3436
Tags = Write-Output vNugglets VMware vSphere PowerCLI VDPortGroup TrafficFiltering Filter Filtering TrafficMarking Mark Marking VDSwitch
3537
# Verbose = $true
3638
} ## end hashtable
39+
40+
# $hshUpdateManifestParams = @{
41+
# ## modules that are external to this module and that this module requires; per help, "Specifies an array of external module dependencies"
42+
# ExternalModuleDependencies = VMware.VimAutomation.Vds
43+
# }
3744
} ## end begin
3845

3946
process {
4047
$bManifestFileAlreadyExists = Test-Path $strFilespecForPsd1
48+
## check that the FileList property holds the names of all of the files in the module directory, relative to the module directory
49+
## the relative names of the files in the module directory (just filename for those in module directory, "subdir\filename.txt" for a file in a subdir, etc.)
50+
$arrRelativeNameOfFilesInModuleDirectory = Get-ChildItem $strModuleFolderFilespec -Recurse | Where-Object {-not $_.PSIsContainer} | ForEach-Object {$_.FullName.Replace($strModuleFolderFilespec, "").TrimStart("\")}
51+
if ($null -eq (Compare-Object -ReferenceObject $hshManifestParams.FileList -DifferenceObject $arrRelativeNameOfFilesInModuleDirectory)) {Write-Verbose -Verbose "Hurray, all of the files in the module directory are named in the FileList property to use for the module manifest"} else {Write-Error "Uh-oh -- FileList property value for making/updating module manifest and actual files present in module directory do not match. Better check that."}
4152
$strMsgForShouldProcess = "{0} module manifest" -f $(if ((-not $bManifestFileAlreadyExists) -or $Recreate) {"Create"} else {"Update"})
4253
if ($PsCmdlet.ShouldProcess($strFilespecForPsd1, $strMsgForShouldProcess)) {
4354
## do the actual module manifest creation/update
44-
if ((-not $bManifestFileAlreadyExists) -or $Recreate) {Microsoft.PowerShell.Core\New-ModuleManifest @hshModManifestParams}
45-
else {PowerShellGet\Update-ModuleManifest @hshModManifestParams}
55+
if ((-not $bManifestFileAlreadyExists) -or $Recreate) {Microsoft.PowerShell.Core\New-ModuleManifest @hshManifestParams}
56+
else {PowerShellGet\Update-ModuleManifest @hshManifestParams}
4657
## replace the comment in the resulting module manifest that includes "PSGet_" prefixed to the actual module name with a line without "PSGet_" in it
4758
(Get-Content -Path $strFilespecForPsd1 -Raw).Replace("# Module manifest for module 'PSGet_$strModuleName'", "# Module manifest for module '$strModuleName'") | Set-Content -Path $strFilespecForPsd1
4859
} ## end if

testing/vNugglets.VDNetworking.Tests_Get.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ $oTestVDPG = New-VDPortgroup -VDSwitch $oTestVDSwitch -Name "vNuggsTestVDPG_toDe
2828
- get TrafficRuleSet (should be disabled)
2929
$oTestVDPG | Get-VNVDTrafficRuleSet
3030
- get TrafficRule (should be 0)
31+
$oTestVDPG | Get-VNVDTrafficRuleSet | Get-VNVDTrafficRule
3132
- create three TrafficRules
3233
$oTestVDPG | Get-VNVDTrafficRuleSet | New-VNVDTrafficRule -Name "testRule0_toDelete_${strGuidForThisTest}" -Action (New-VNVDTrafficRuleAction -Allow) -Direction both -Qualifier (New-VNVDTrafficRuleQualifier -SystemTrafficType faultTolerance -NegateSystemTrafficType), (New-VNVDTrafficRuleQualifier -SourceIpAddress 172.16.10.0/24 -DestinationIpAddress 10.0.0.0/8 -SourceIpPort 443-444)
3334
$oTestVDPG | Get-VNVDTrafficRuleSet | New-VNVDTrafficRule -Name "testRule1_toDelete_${strGuidForThisTest}" -Action (New-VNVDTrafficRuleAction -QosTag 5 -DscpTag 23) -Direction both -Qualifier (New-VNVDTrafficRuleQualifier -SystemTrafficType vsan)
3435
$oTestVDPG | Get-VNVDTrafficRuleSet | New-VNVDTrafficRule -Name "testRule2_toDelete_${strGuidForThisTest}" -Action (New-VNVDTrafficRuleAction -QosTag 7 -DscpTag 30) -Direction both -Qualifier (New-VNVDTrafficRuleQualifier -SystemTrafficType vdp), (New-VNVDTrafficRuleQualifier -DestinationIpAddress 172.16.100.0/24)
3536
- get TrafficRuleSet (should have three TrafficRules)
3637
$oTestVDPG | Get-VNVDTrafficRuleSet
38+
- enable the TrafficRuleSet
39+
$oTestVDPG | Get-VNVDTrafficRuleSet | Set-VNVDTrafficRuleSet -Enabled
3740
- get TrafficRules (should be three)
3841
$oTestVDPG | Get-VNVDTrafficRuleSet | Get-VNVDTrafficRule | Measure-Object
3942
- remove two TrafficRules

vNugglets.VDNetworking/GetItems.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ function Get-VNVDTrafficFilterPolicyConfig {
2020
$VDPortgroup | Foreach-Object {
2121
$oThisVDPG = $_
2222
New-Object -Type VNVDTrafficFilterPolicyConfig -Property @{
23-
TrafficFilterPolicyConfig = $_.ExtensionData.Config.DefaultPortConfig.FilterPolicy.FilterConfig
24-
VDPortgroupView = $_.ExtensionData
23+
TrafficFilterPolicyConfig = $oThisVDPG.ExtensionData.Config.DefaultPortConfig.FilterPolicy.FilterConfig
24+
VDPortgroupView = $oThisVDPG.ExtensionData
2525
} ## end new-object
2626
} ## end foreach-object
2727
} ## end process

0 commit comments

Comments
 (0)