Skip to content
Merged
2 changes: 1 addition & 1 deletion src/NetAppFiles/NetAppFiles.Test/NetAppFiles.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.NetApp" Version="1.10.0" />
<PackageReference Include="Microsoft.Azure.Management.NetApp" Version="1.11.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="20.3.0" />
</ItemGroup>

Expand Down
10 changes: 10 additions & 0 deletions src/NetAppFiles/NetAppFiles.Test/ScenarioTests/BackupTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public BackupTests(Xunit.Abstractions.ITestOutputHelper output)
}

[Fact(Skip = "Backup service side bug causes this to fail, re-enable when fixed")]
//[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestBackupCrud()
{
Expand All @@ -40,5 +41,14 @@ public void TestBackupPipelines()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-BackupPipelines");
}

[Fact(Skip = "Backup service side bug causes this to fail, re-enable when fixed")]
//[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestVolumeBackupStatusCrud()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-VolumeBackupStatus");
}

}
}
138 changes: 137 additions & 1 deletion src/NetAppFiles/NetAppFiles.Test/ScenarioTests/BackupTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function Test-BackupCrud
WaitForSucceeded

# volume update with backup policy
$retrievedVolume = Update-AzNetAppFilesVolume -ResourceGroupName $resourceGroup -Location $resourceLocation -AccountName $accName1 -PoolName $poolName -VolumeName $volName1 -Backup $backupObject
$retrievedVolume = Update-AzNetAppFilesVolume -ResourceGroupName $resourceGroup -AccountName $accName1 -PoolName $poolName -VolumeName $volName1 -Backup $backupObject
SleepDuringRecord
# create and check Backup
$retrievedBackup = New-AzNetAppFilesBackup -ResourceGroupName $resourceGroup -Location $backupLocation -AccountName $accName1 -PoolName $poolName -VolumeName $volName1 -Name $backupName1 -Label $label
Expand Down Expand Up @@ -292,3 +292,139 @@ function Test-BackupPipelines
Clean-ResourceGroup $resourceGroup
}
}

<#
.SYNOPSIS
Test Volume Test-VolumeBackupStatusCrud operation
#>
function Test-VolumeBackupStatus
{
$currentSub = (Get-AzureRmContext).Subscription
$subsid = $currentSub.SubscriptionId

$resourceGroup = Get-ResourceGroupName
$accName = Get-ResourceName
$poolName = Get-ResourceName
$poolName2 = Get-ResourceName
$volName1 = Get-ResourceName
$backupPolicyName1 = Get-ResourceName
$backupName1 = Get-ResourceName
$gibibyte = 1024 * 1024 * 1024
$usageThreshold = 100 * $gibibyte
#$resourceLocation = Get-ProviderLocation "Microsoft.NetApp" "eastus" -UseCanonical
$resourceLocation = "westus2"
#$backupLocation = "southcentralusstage"
#$backupVNetLocation = "southcentralus"

$backupLocation = "eastus2euap"
$backupVNetLocation = "eastus2euap"

$subnetName = "default"
$poolSize = 4398046511104
$serviceLevel = "Premium"
$serviceLevelStandard = "Premium"
$vnetName = $resourceGroup + "-vnet"
$dailyBackupsToKeep = 4
$weeklyBackupsToKeep = 3
$monthlyBackupsToKeep = 2
$yearlyBackupsToKeep = 1

$subnetId = "/subscriptions/$subsId/resourceGroups/$resourceGroup/providers/Microsoft.Network/virtualNetworks/$vnetName/subnets/$subnetName"

$rule1 = @{
RuleIndex = 1
UnixReadOnly = $false
UnixReadWrite = $true
Cifs = $false
Nfsv3 = $true
Nfsv41 = $false
AllowedClients = '0.0.0.0/0'
}


$exportPolicy = @{
Rules = (
$rule1
)
}

# create the list of protocol types
$protocolTypes = New-Object string[] 1
$protocolTypes[0] = "NFSv3"

function SleepDuringRecord
{
if ($env:AZURE_TEST_MODE -eq "Record")
{
Write-Output "Sleep in record mode"
Start-Sleep -Seconds 30.0
}
}

try
{
# create the resource group
New-AzResourceGroup -Name $resourceGroup -Location $backupVNetLocation

# create virtual network
$virtualNetwork = New-AzVirtualNetwork -ResourceGroupName $resourceGroup -Location $backupVNetLocation -Name $vnetName -AddressPrefix 10.0.0.0/16
$delegation = New-AzDelegation -Name "netAppVolumes" -ServiceName "Microsoft.Netapp/volumes"
Add-AzVirtualNetworkSubnetConfig -Name $subnetName -VirtualNetwork $virtualNetwork -AddressPrefix "10.0.1.0/24" -Delegation $delegation | Set-AzVirtualNetwork
$newTagName = "tag1"
$newTagValue = "tagValue1"
# create account
$retrievedAcc = New-AzNetAppFilesAccount -ResourceGroupName $resourceGroup -Location $backupLocation -AccountName $accName
# create and check BackupPolicy
$retrievedBackupPolicy = New-AzNetAppFilesBackupPolicy -ResourceGroupName $resourceGroup -Location $backupLocation -AccountName $accName -Name $backupPolicyName1 -Tag @{$newTagName = $newTagValue} -Enabled -DailyBackupsToKeep $dailyBackupsToKeep -WeeklyBackupsToKeep $weeklyBackupsToKeep -MonthlyBackupsToKeep $monthlyBackupsToKeep -YearlyBackupsToKeep $yearlyBackupsToKeep
Assert-NotNull $retrievedBackupPolicy.Id

# create pool
$retrievedPool = New-AzNetAppFilesPool -ResourceGroupName $resourceGroup -Location $backupLocation -AccountName $accName -PoolName $poolName -PoolSize $poolSize -ServiceLevel $serviceLevel

# create volume and check
$retrievedVolume = New-AzNetAppFilesVolume -ResourceGroupName $resourceGroup -Location $backupLocation -AccountName $accName -PoolName $poolName -VolumeName $volName1 -CreationToken $volName1 -UsageThreshold $usageThreshold -ServiceLevel $serviceLevel -SubnetId $subnetId -Tag @{$newTagName = $newTagValue} -ExportPolicy $exportPolicy -ProtocolType $protocolTypes
Assert-AreEqual "$accName/$poolName/$volName1" $retrievedVolume.Name
Assert-AreEqual $serviceLevel $retrievedVolume.ServiceLevel
Assert-AreEqual True $retrievedVolume.Tags.ContainsKey($newTagName)
Assert-AreEqual "tagValue1" $retrievedVolume.Tags[$newTagName].ToString()
Assert-NotNull $retrievedVolume.ExportPolicy
Assert-AreEqual '0.0.0.0/0' $retrievedVolume.ExportPolicy.Rules[0].AllowedClients

Assert-AreEqual $retrievedVolume.ProtocolTypes[0] 'NFSv3'
Assert-NotNull $retrievedVolume.MountTargets
Assert-Null $retrievedVolume.VolumeType
Assert-Null $retrievedVolume.DataProtection

# get and check the volume by name
$retrievedVolume = Get-AzNetAppFilesVolume -ResourceGroupName $resourceGroup -AccountName $accName -PoolName $poolName -VolumeName $volName1
Assert-AreEqual "$accName/$poolName/$volName1" $retrievedVolume.Name

# get check Vaults
$retrievedVaultsList = Get-AzNetAppFilesVault -ResourceGroupName $resourceGroup -AccountName $accName
$backupObject = @{
VaultId = $retrievedVaultsList[0].Id
BackupEnabled = $true
PolicyEnforced = $true
BackupPolicyId = $retrievedBackupPolicy.Id
}
SleepDuringRecord
# volume update with backup policy
$retrievedVolume = Update-AzNetAppFilesVolume -ResourceGroupName $resourceGroup -Location $backupLocation -AccountName $accName -PoolName $poolName -VolumeName $volName1 -Backup $backupObject
SleepDuringRecord
# create and check Backup
$retrievedBackup = New-AzNetAppFilesBackup -ResourceGroupName $resourceGroup -Location $backupLocation -AccountName $accName -PoolName $poolName -VolumeName $volName1 -Name $backupName1 -Label $label
Assert-AreEqual "$accName/$poolName/$volName1/$backupName1" $retrievedBackup.Name

# Get volume backup status
$retrievedBackupStatus = Get-AzNetAppFilesBackupStatus -ResourceGroupName $resourceLocation -AccountName $accName -PoolName $poolName -Name $volName1
Assert-NotNull $retrievedBackupStatus

# delete Backup retrieved by id
Remove-AzNetAppFilesBackup -ResourceId $retrievedBackup.Id
}
finally
{
# Cleanup
Clean-ResourceGroup $resourceGroup
}
}
15 changes: 10 additions & 5 deletions src/NetAppFiles/NetAppFiles.Test/ScenarioTests/SnapshotTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ function Test-SnapshotCrud
$usageThreshold = 100 * $gibibyte
$doubleUsage = 2 * $usageThreshold
#$resourceLocation = Get-ProviderLocation "Microsoft.NetApp" "eastus2euap" -UseCanonical
$resourceLocation = "eastus2euap"
#$resourceLocation = "eastus2euap"
$resourceLocation = "eastus"

$subnetName = "default"
$standardPoolSize = 4398046511104
$serviceLevel = "Premium"
Expand Down Expand Up @@ -119,7 +121,8 @@ function Test-SnapshotPipelines
$usageThreshold = 100 * $gibibyte
$doubleUsage = 2 * $usageThreshold
#$resourceLocation = Get-ProviderLocation "Microsoft.NetApp" "eastus" -UseCanonical
$resourceLocation = "eastus2euap"
$resourceLocation = "eastus"
#$resourceLocation = "eastus2euap"
$subnetName = "default"
$poolSize = 4398046511104
$serviceLevel = "Premium"
Expand Down Expand Up @@ -181,8 +184,9 @@ function Test-CreateVolumeFromSnapshot
$gibibyte = 1024 * 1024 * 1024
$usageThreshold = 100 * $gibibyte
$doubleUsage = 2 * $usageThreshold
$resourceLocation = Get-ProviderLocation "Microsoft.NetApp" "eastus" -UseCanonical
$resourceLocation = "eastus2euap"
#$resourceLocation = Get-ProviderLocation "Microsoft.NetApp" "eastus" -UseCanonical
#$resourceLocation = "eastus2euap"
$resourceLocation = "eastus"
$subnetName = "default"
$standardPoolSize = 4398046511104
$serviceLevel = "Premium"
Expand Down Expand Up @@ -256,7 +260,8 @@ function Test-RestoreVolumeFromSnapshot
$usageThreshold = 100 * $gibibyte
$doubleUsage = 2 * $usageThreshold
#$resourceLocation = Get-ProviderLocation "Microsoft.NetApp" "eastus" -UseCanonical
$resourceLocation = "eastus2euap"
#$resourceLocation = "eastus2euap"
$resourceLocation = "eastus"
$subnetName = "default"
$standardPoolSize = 4398046511104
$serviceLevel = "Premium"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ function Test-VolumeCrud
$usageThreshold = 100 * $gibibyte
$doubleUsage = 2 * $usageThreshold
#$resourceLocation = Get-ProviderLocation "Microsoft.NetApp" "eastus" -UseCanonical
$resourceLocation = "eastus2euap"
#$resourceLocation = "eastus2euap"
$resourceLocation = "eastus"

$subnetName = "default"
$poolSize = 4398046511104
$serviceLevel = "Premium"
Expand Down Expand Up @@ -601,4 +603,4 @@ function Test-VolumePipelines
# Cleanup
Clean-ResourceGroup $resourceGroup
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ public class NewAzureRmNetAppFilesActiceDirectory : AzureNetAppFilesCmdletBase
HelpMessage = "When LDAP over SSL/TLS is enabled, specifies whether or not the LDAP traffic needs to be secured via TLS.")]
[ValidateNotNullOrEmpty]
public SwitchParameter LdapOverTLS { get; set; }


[Parameter(
Mandatory = false,
HelpMessage = "If enabled, NFS client local users can also (in addition to LDAP users) access the NFS volumes.")]
[ValidateNotNullOrEmpty]
public SwitchParameter AllowLocalNfsUsersWithLdap { get; set; }

[Parameter(
ParameterSetName = ParentObjectParameterSet,
Expand Down Expand Up @@ -192,7 +197,8 @@ public override void ExecuteCmdlet()
SecurityOperators = SecurityOperator,
AesEncryption = AesEncryption,
LdapSigning = LdapSigning,
LdapOverTLS = LdapOverTLS
LdapOverTLS = LdapOverTLS,
AllowLocalNfsUsersWithLdap = AllowLocalNfsUsersWithLdap
};
if (anfAccount.ActiveDirectories == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ public class UpdateAzureRmNetAppFilesActiveDirectory : AzureNetAppFilesCmdletBas
[ValidateNotNullOrEmpty]
public SwitchParameter LdapOverTLS { get; set; }

[Parameter(
Mandatory = false,
HelpMessage = "If enabled, NFS client local users can also (in addition to LDAP users) access the NFS volumes.")]
[ValidateNotNullOrEmpty]
public SwitchParameter AllowLocalNfsUsersWithLdap { get; set; }

[Parameter(
ParameterSetName = ParentObjectParameterSet,
Mandatory = true,
Expand Down Expand Up @@ -233,6 +239,10 @@ public override void ExecuteCmdlet()
{
anfADConfig.LdapOverTLS = LdapOverTLS;
}
if (AllowLocalNfsUsersWithLdap)
{
anfADConfig.AllowLocalNfsUsersWithLdap = AllowLocalNfsUsersWithLdap;
}
}
else
{
Expand Down Expand Up @@ -267,6 +277,10 @@ public override void ExecuteCmdlet()
{
anfADConfig.LdapOverTLS = LdapOverTLS;
}
if (AllowLocalNfsUsersWithLdap)
{
anfADConfig.AllowLocalNfsUsersWithLdap = AllowLocalNfsUsersWithLdap;
}
}
}

Expand Down
15 changes: 14 additions & 1 deletion src/NetAppFiles/NetAppFiles/Helpers/BackupExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public static PSNetAppFilesBackup ConvertToPs(this Management.NetApp.Models.Back
BackupType = backup.Type,
Label = backup.Label,
ProvisioningState = backup.ProvisioningState,
Size = backup.Size
Size = backup.Size,
VolumeName = backup.VolumeName
};
return psBackup;
}
Expand All @@ -45,5 +46,17 @@ public static List<PSNetAppFilesBackup> ConvertToPS(this IList<Management.NetApp
return volumeBackups.Select(e => e.ConvertToPs()).ToList();
}

public static PSNetAppFilesVolumeBackupStatus ConvertToPs(this Management.NetApp.Models.BackupStatus backupStatus)
{
var psBackupStatus = new PSNetAppFilesVolumeBackupStatus
{
Healthy = backupStatus.Healthy,
MirrorState = backupStatus.MirrorState,
RelationshipStatus = backupStatus.RelationshipStatus,
UnhealthyReason = backupStatus.UnhealthyReason,
ErrorMessage = backupStatus.ErrorMessage
};
return psBackupStatus;
}
}
}
13 changes: 11 additions & 2 deletions src/NetAppFiles/NetAppFiles/Helpers/ModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ public static class ModelExtensions
BackupOperators = psActiveDirectory.BackupOperators,
KdcIP = psActiveDirectory.KdcIP,
AdName = psActiveDirectory.AdName,
ServerRootCACertificate = psActiveDirectory.ServerRootCACertificate
ServerRootCACertificate = psActiveDirectory.ServerRootCACertificate,
AesEncryption = psActiveDirectory.AesEncryption,
LdapSigning = psActiveDirectory.LdapSigning,
SecurityOperators = psActiveDirectory.SecurityOperators,
LdapOverTLS = psActiveDirectory.LdapOverTLS,
AllowLocalNfsUsersWithLdap = psActiveDirectory.AllowLocalNfsUsersWithLdap

}).ToList();
}
Expand Down Expand Up @@ -67,7 +72,11 @@ public static PSNetAppFilesActiveDirectory ConvertToPs(this Management.NetApp.Mo
KdcIP = activeDirectory.KdcIP,
AdName = activeDirectory.AdName,
ServerRootCACertificate = activeDirectory.ServerRootCACertificate,
SecurityOperators = activeDirectory.SecurityOperators
AesEncryption = activeDirectory.AesEncryption,
LdapSigning = activeDirectory.LdapSigning,
SecurityOperators = activeDirectory.SecurityOperators,
LdapOverTLS = activeDirectory.LdapOverTLS,
AllowLocalNfsUsersWithLdap = activeDirectory.AllowLocalNfsUsersWithLdap
};
return psActiveDirectory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,12 @@ public class PSNetAppFilesActiveDirectory
/// </value>
public bool? LdapOverTLS { get; set; }

/// <summary>
/// Gets or sets AllowLocalNfsUsersWithLdap
/// </summary>
/// <value>If enabled, NFS client local users can also (in addition to LDAP users) access the NFS volumes.
/// </value>
public bool? AllowLocalNfsUsersWithLdap { get; set; }

}
}
6 changes: 6 additions & 0 deletions src/NetAppFiles/NetAppFiles/Models/PSNetAppFilesBackup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,11 @@ public class PSNetAppFilesBackup
/// Gets azure lifecycle management
/// </summary>
public string ProvisioningState { get; set; }

/// <summary>
/// Gets or sets Volume name
/// </summary>
public string VolumeName { get; set; }

}
}
8 changes: 8 additions & 0 deletions src/NetAppFiles/NetAppFiles/Models/PSNetAppFilesVolume.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,13 @@ public class PSNetAppFilesVolume
/// Enables continuously available share property for SMB volume. Only applicable for SMB volume
/// </remarks>
public bool? SmbContinuouslyAvailable { get; set; }

/// <summary>
/// Gets or sets LdapEnabled
/// </summary>
/// <remarks>
/// Specifies whether LDAP is enabled or not for a given NFS volume.
/// </remarks>
public bool? LdapEnabled { get; set; }
}
}
Loading