@@ -24,9 +24,11 @@ function Test-VolumeCrud
24
24
$resourceGroup = Get-ResourceGroupName
25
25
$accName = Get-ResourceName
26
26
$poolName = Get-ResourceName
27
+ $poolName2 = Get-ResourceName
27
28
$volName1 = Get-ResourceName
28
29
$volName2 = Get-ResourceName
29
30
$volName3 = Get-ResourceName
31
+ $volName4 = Get-ResourceName
30
32
$gibibyte = 1024 * 1024 * 1024
31
33
$usageThreshold = 100 * $gibibyte
32
34
$doubleUsage = 2 * $usageThreshold
@@ -56,13 +58,32 @@ function Test-VolumeCrud
56
58
Nfsv4 = ' false'
57
59
AllowedClients = ' 1.2.3.0/24'
58
60
}
59
-
61
+ $rule3 = @ {
62
+ RuleIndex = 2
63
+ UnixReadOnly = ' false'
64
+ UnixReadWrite = ' true'
65
+ Cifs = ' false'
66
+ Nfsv3 = ' true'
67
+ Nfsv4 = ' false'
68
+ AllowedClients = ' 2.3.4.0/24'
69
+ }
60
70
61
71
$exportPolicy = @ {
62
72
Rules = (
63
73
$rule1 , $rule2
64
74
)
65
75
}
76
+
77
+ $exportPolicyMod = @ {
78
+ Rules = (
79
+ $rule3
80
+ )
81
+ }
82
+
83
+ # create the list of protocol types
84
+ $protocolTypes = New-Object string[] 2
85
+ $protocolTypes [0 ] = " NFSv3"
86
+ $protocolTypes [1 ] = " NFSv4"
66
87
67
88
try
68
89
{
@@ -83,19 +104,24 @@ function Test-VolumeCrud
83
104
# create first volume and check
84
105
$newTagName = " tag1"
85
106
$newTagValue = " tagValue1"
86
- $retrievedVolume = New-AzNetAppFilesVolume - ResourceGroupName $resourceGroup - Location $resourceLocation - AccountName $accName - PoolName $poolName - VolumeName $volName1 - CreationToken $volName1 - UsageThreshold $usageThreshold - ServiceLevel $serviceLevel - SubnetId $subnetId - Tag @ {$newTagName = $newTagValue } - ExportPolicy $exportPolicy
107
+ $retrievedVolume = New-AzNetAppFilesVolume - ResourceGroupName $resourceGroup - Location $resourceLocation - AccountName $accName - PoolName $poolName - VolumeName $volName1 - CreationToken $volName1 - UsageThreshold $usageThreshold - ServiceLevel $serviceLevel - SubnetId $subnetId - Tag @ {$newTagName = $newTagValue } - ExportPolicy $exportPolicy - ProtocolTypes $protocolTypes
87
108
Assert-AreEqual " $accName /$poolName /$volName1 " $retrievedVolume.Name
88
109
Assert-AreEqual $serviceLevel $retrievedVolume.ServiceLevel
89
110
Assert-AreEqual True $retrievedVolume.Tags.ContainsKey ($newTagName )
90
111
Assert-AreEqual " tagValue1" $retrievedVolume.Tags [$newTagName ].ToString()
91
112
Assert-NotNull $retrievedVolume.ExportPolicy
92
113
Assert-AreEqual $retrievedVolume.ExportPolicy.Rules [0 ].AllowedClients ' 0.0.0.0/0'
93
114
Assert-AreEqual $retrievedVolume.ExportPolicy.Rules [1 ].AllowedClients ' 1.2.3.0/24'
115
+ Assert-AreEqual $retrievedVolume.ProtocolTypes [0 ] ' NFSv3'
116
+ Assert-AreEqual $retrievedVolume.ProtocolTypes [1 ] ' NFSv4'
117
+ Assert-NotNull $retrievedVolume.MountTargets
94
118
95
119
# create second volume and check using the confirm flag
96
120
$retrievedVolume = New-AzNetAppFilesVolume - ResourceGroupName $resourceGroup - Location $resourceLocation - AccountName $accName - PoolName $poolName - VolumeName $volName2 - CreationToken $volName2 - UsageThreshold $usageThreshold - ServiceLevel $serviceLevel - SubnetId $subnetId - Confirm:$false
97
121
Assert-AreEqual " $accName /$poolName /$volName2 " $retrievedVolume.Name
98
122
Assert-AreEqual $serviceLevel $retrievedVolume.ServiceLevel
123
+ # default protocol type for new volume
124
+ Assert-AreEqual $retrievedVolume.ProtocolTypes [0 ] ' NFSv3'
99
125
100
126
# create and check a third volume using the WhatIf - it should not be created
101
127
$retrievedVolume = New-AzNetAppFilesVolume - ResourceGroupName $resourceGroup - Location $resourceLocation - AccountName $accName - PoolName $poolName - VolumeName $volName3 - CreationToken $volName2 - UsageThreshold $usageThreshold - ServiceLevel $serviceLevel - SubnetId $subnetId - WhatIf
@@ -156,6 +182,31 @@ function Test-VolumeCrud
156
182
Remove-AzNetAppFilesVolume - ResourceGroupName $resourceGroup - AccountName $accName - PoolName $poolName - VolumeName $volName2
157
183
$retrievedVolume = Get-AzNetAppFilesVolume - ResourceGroupName $resourceGroup - AccountName $accName - PoolName $poolName
158
184
Assert-AreEqual 0 $retrievedVolume.Length
185
+
186
+ # test export policy update with non-default volume (and "Standard" Pool)
187
+ # create pool
188
+ $retrievedPool = New-AzNetAppFilesPool - ResourceGroupName $resourceGroup - Location $resourceLocation - AccountName $accName - PoolName $poolName2 - PoolSize $poolSize - ServiceLevel " Standard"
189
+
190
+ # create the volume and check
191
+ $newTagName = " tag1"
192
+ $newTagValue = " tagValue1"
193
+ $retrievedVolume = New-AzNetAppFilesVolume - ResourceGroupName $resourceGroup - Location $resourceLocation - AccountName $accName - PoolName $poolName2 - VolumeName $volName4 - CreationToken $volName4 - UsageThreshold $doubleUsage - ServiceLevel " Standard" - SubnetId $subnetId - Tag @ {$newTagName = $newTagValue } - ExportPolicy $exportPolicy - ProtocolTypes $protocolTypes
194
+ Assert-AreEqual " $accName /$poolName2 /$volName4 " $retrievedVolume.Name
195
+ Assert-AreEqual " Standard" $retrievedVolume.ServiceLevel
196
+ Assert-AreEqual True $retrievedVolume.Tags.ContainsKey ($newTagName )
197
+ Assert-AreEqual " tagValue1" $retrievedVolume.Tags [$newTagName ].ToString()
198
+ Assert-NotNull $retrievedVolume.ExportPolicy
199
+ Assert-AreEqual ' 0.0.0.0/0' $retrievedVolume.ExportPolicy.Rules [0 ].AllowedClients
200
+ Assert-AreEqual ' 1.2.3.0/24' $retrievedVolume.ExportPolicy.Rules [1 ].AllowedClients
201
+
202
+ # update (patch) export policy and check no change to rest of volume
203
+ $retrievedVolume = Update-AzNetAppFilesVolume - ResourceGroupName $resourceGroup - Location $resourceLocation - AccountName $accName - PoolName $poolName2 - VolumeName $volName4 - ExportPolicy $exportPolicyMod
204
+ Assert-AreEqual ' 2.3.4.0/24' $retrievedVolume.ExportPolicy.Rules [0 ].AllowedClients
205
+ # unchanged, not part of the patch
206
+ Assert-AreEqual " Standard" $retrievedVolume.ServiceLevel
207
+ Assert-AreEqual $doubleUsage $retrievedVolume.usageThreshold
208
+ Assert-AreEqual True $retrievedVolume.Tags.ContainsKey ($newTagName )
209
+ Assert-AreEqual " tagValue1" $retrievedVolume.Tags [$newTagName ].ToString()
159
210
}
160
211
finally
161
212
{
0 commit comments