Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
mtboren committed Jan 11, 2018
2 parents 7adda3a + 5484819 commit 6b2e1d8
Show file tree
Hide file tree
Showing 12 changed files with 258 additions and 217 deletions.
9 changes: 8 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
### ChangeLog for vNugglets.VDNetworking PowerShell module

#### v1.0, Jan 2017
#### v1.1.0, Jan 2018
- \[update] Added `-WhatIf` support to `New-VNVDTrafficRuleAction`, `New-VNVDTrafficRuleQualifier`
- \[bugfix] `-Enabled` parameter on `Set-VNVDTrafficRuleSet` was not working as expected. Fixed
- \[bugfix] Corrected issue where module loaded improperly if required VDS module was not already loaded
- \[enhancement] Added check in ModuleManifest update code to report FileList accuracy every time
- \[miscellaneous] Other various updates and optimizations

#### v1.0, Jan 2018
- initial public "prod" release of `master` branch
- published module in PowerShell Gallery

Expand Down
2 changes: 1 addition & 1 deletion ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Chomping at the bit to get going with using this module? Of course you are! Go l
<a id="examplesSection"></a>
### Examples
Examples are in two places:
- periodically updated in the docs/ folder for the project at [docs/examples.md](docs/examples.md)
- 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)
- 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)

<a id="gettingHelpSection"></a>
Expand Down
29 changes: 20 additions & 9 deletions Update-ThisModuleManifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,52 @@ param(
)
begin {
$strModuleName = "vNugglets.VDNetworking"
## some code to generate the module manifest
$strFilespecForPsd1 = "$PSScriptRoot\$strModuleName\${strModuleName}.psd1"
$strModuleFolderFilespec = "$PSScriptRoot\$strModuleName"
$strFilespecForPsd1 = Join-Path $strModuleFolderFilespec "${strModuleName}.psd1"

$hshModManifestParams = @{
## parameters for use by both New-ModuleManifest and Update-ModuleManifest
$hshManifestParams = @{
# Confirm = $true
Path = $strFilespecForPsd1
ModuleVersion = "1.0.0"
ModuleVersion = "1.1.0"
Author = "Matt Boren (@mtboren)"
CompanyName = 'vNugglets for the VMware PowerCLI community'
Copyright = "MIT License"
Description = "Module with functions for managing VMware vSphere Virtual Distributed Networking components like traffic filtering and marking"
# AliasesToExport = @()
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"
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"
FormatsToProcess = "${strModuleName}.format.ps1xml"
FunctionsToExport = Write-Output Get-VNVDTrafficFilterPolicyConfig Get-VNVDTrafficRuleSet Get-VNVDTrafficRule Get-VNVDTrafficRuleQualifier Get-VNVDTrafficRuleAction New-VNVDTrafficRuleQualifier New-VNVDTrafficRuleAction New-VNVDTrafficRule Remove-VNVDTrafficRule Set-VNVDTrafficRuleSet
IconUri = "https://avatars0.githubusercontent.com/u/10615837"
LicenseUri = "https://github.com/vNugglets/vNuggletsPSMod_vDNetworking/blob/master/License"
NestedModules = Write-Output GetItems.ps1 NewItems.ps1 RemoveItems.ps1 SetItems.ps1 "${strModuleName}_SupportingFunctions.ps1"
PowerShellVersion = [System.Version]"5.0"
ProjectUri = "https://github.com/vNugglets/vNuggletsPSMod_vDNetworking"
ReleaseNotes = "See release notes at https://github.com/vNugglets/vNuggletsPSMod_vDNetworking/blob/master/ChangeLog.md"
ReleaseNotes = "See ReadMe and other docs at https://github.com/vNugglets/vNuggletsPSMod_vDNetworking"
RequiredModules = "VMware.VimAutomation.Vds"
RootModule = "${strModuleName}_ModRoot.psm1"
ScriptsToProcess = "${strModuleName}_ClassDefinition.ps1"
ScriptsToProcess = "${strModuleName}_init.ps1", "${strModuleName}_ClassDefinition.ps1"
Tags = Write-Output vNugglets VMware vSphere PowerCLI VDPortGroup TrafficFiltering Filter Filtering TrafficMarking Mark Marking VDSwitch
# Verbose = $true
} ## end hashtable

# $hshUpdateManifestParams = @{
# ## modules that are external to this module and that this module requires; per help, "Specifies an array of external module dependencies"
# ExternalModuleDependencies = VMware.VimAutomation.Vds
# }
} ## end begin

process {
$bManifestFileAlreadyExists = Test-Path $strFilespecForPsd1
## check that the FileList property holds the names of all of the files in the module directory, relative to the module directory
## 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.)
$arrRelativeNameOfFilesInModuleDirectory = Get-ChildItem $strModuleFolderFilespec -Recurse | Where-Object {-not $_.PSIsContainer} | ForEach-Object {$_.FullName.Replace($strModuleFolderFilespec, "").TrimStart("\")}
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."}
$strMsgForShouldProcess = "{0} module manifest" -f $(if ((-not $bManifestFileAlreadyExists) -or $Recreate) {"Create"} else {"Update"})
if ($PsCmdlet.ShouldProcess($strFilespecForPsd1, $strMsgForShouldProcess)) {
## do the actual module manifest creation/update
if ((-not $bManifestFileAlreadyExists) -or $Recreate) {Microsoft.PowerShell.Core\New-ModuleManifest @hshModManifestParams}
else {PowerShellGet\Update-ModuleManifest @hshModManifestParams}
if ((-not $bManifestFileAlreadyExists) -or $Recreate) {Microsoft.PowerShell.Core\New-ModuleManifest @hshManifestParams}
else {PowerShellGet\Update-ModuleManifest @hshManifestParams}
## replace the comment in the resulting module manifest that includes "PSGet_" prefixed to the actual module name with a line without "PSGet_" in it
(Get-Content -Path $strFilespecForPsd1 -Raw).Replace("# Module manifest for module 'PSGet_$strModuleName'", "# Module manifest for module '$strModuleName'") | Set-Content -Path $strFilespecForPsd1
} ## end if
Expand Down
3 changes: 3 additions & 0 deletions testing/vNugglets.VDNetworking.Tests_Get.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ $oTestVDPG = New-VDPortgroup -VDSwitch $oTestVDSwitch -Name "vNuggsTestVDPG_toDe
- get TrafficRuleSet (should be disabled)
$oTestVDPG | Get-VNVDTrafficRuleSet
- get TrafficRule (should be 0)
$oTestVDPG | Get-VNVDTrafficRuleSet | Get-VNVDTrafficRule
- create three TrafficRules
$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)
$oTestVDPG | Get-VNVDTrafficRuleSet | New-VNVDTrafficRule -Name "testRule1_toDelete_${strGuidForThisTest}" -Action (New-VNVDTrafficRuleAction -QosTag 5 -DscpTag 23) -Direction both -Qualifier (New-VNVDTrafficRuleQualifier -SystemTrafficType vsan)
$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)
- get TrafficRuleSet (should have three TrafficRules)
$oTestVDPG | Get-VNVDTrafficRuleSet
- enable the TrafficRuleSet
$oTestVDPG | Get-VNVDTrafficRuleSet | Set-VNVDTrafficRuleSet -Enabled
- get TrafficRules (should be three)
$oTestVDPG | Get-VNVDTrafficRuleSet | Get-VNVDTrafficRule | Measure-Object
- remove two TrafficRules
Expand Down
4 changes: 2 additions & 2 deletions vNugglets.VDNetworking/GetItems.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ function Get-VNVDTrafficFilterPolicyConfig {
$VDPortgroup | Foreach-Object {
$oThisVDPG = $_
New-Object -Type VNVDTrafficFilterPolicyConfig -Property @{
TrafficFilterPolicyConfig = $_.ExtensionData.Config.DefaultPortConfig.FilterPolicy.FilterConfig
VDPortgroupView = $_.ExtensionData
TrafficFilterPolicyConfig = $oThisVDPG.ExtensionData.Config.DefaultPortConfig.FilterPolicy.FilterConfig
VDPortgroupView = $oThisVDPG.ExtensionData
} ## end new-object
} ## end foreach-object
} ## end process
Expand Down
Loading

0 comments on commit 6b2e1d8

Please sign in to comment.