Giter Site home page Giter Site logo

rubrikinc / use-case-powershell-backup-validation Goto Github PK

View Code? Open in Web Editor NEW
10.0 9.0 5.0 848 KB

Recovery Validation Framework with PowerShell

Home Page: https://build.rubrik.com/use-cases/backup-validation/

License: MIT License

PowerShell 100.00%
powershell use-case rubrik

use-case-powershell-backup-validation's Introduction

PowerShell Backup Validation

This project is used to provide a framework for serial and parallel application testing against workloads that have been protected by Rubrik's Cloud Data Management platform.

Using the Invoke-Build framework, this project allows for an administrator to declare the topology of an application across one or more virtual machines. The entire collection of virtual machines are Live Mounted as a group and a battery of user-defined tests are applied. Upon the completion of the tests, the Live Mounts are removed and a summary of results are displayed.

βœ… Prerequisites

There are a few services you'll need in order to get this project off the ground:

πŸ”¨ Installation

This folder can be dropped anywhere on your workstation that has network connectivity to a Rubrik cluster and related vCenter Server.

Configuration

There are three main points of configuration: Environment JSON files, Config JSON files, and Identity XML files.

Environment JSON Files

The Environment folder contains JSON files that describe the Rubrik Cluster and vCenter Server information. A sample configuration looks like:

{
    "rubrikServer": "172.17.28.11",
    "rubrikCred": "rubrikCred.xml",
    "vmwareServer": "172.17.48.22",
    "vmwareCred": "vmwareCred.xml"
}

Config JSON Files

The Config folder contains JSON files that describe the virtual machines being tested. A sample configuration looks like:

{
    "virtualMachines": [
        {
            "name": "SE-CWAHL-WIN",
            "mountName": "MOUNT-2TIER-APP",
            "guestCred": "guestCred.xml",
            "testIp": "172.17.50.121",
            "testNetwork": "VLAN50_Servers_Mount",
            "testGateway": "172.17.50.1",
            "tasks": ["Ping","Netlogon"]
        },
        {
            "name": "SE-CWAHL-WIN",
            "mountName": "MOUNT-2TIER-DB",
            "guestCred": "guestCred.xml",
            "testIp": "172.17.50.122",
            "testNetwork": "VLAN50_Servers_Mount",
            "testGateway": "172.17.50.1",
            "tasks": ["Ping","Netlogon"]
        }
    ]
}

Identity

The Identity folder is not included in this repository. It can be placed anywhere in your environment and should host secure XML files created with Export-Clixml containing the credentials needed to communicate with the Rubrik cluster, vCenter Server, and any guest operating systems involved in the application testing.

Use the generateCreds.ps1 file to create a starter set of credentials or see how the generation process works.

Note: Secure XML files can only be decrypted by the user account that created them.

Usage

Once the Environment, Config, and Identity requirements are met, use the Invoke-Build function to execute a build. Here is a sample command using a splat.

$Splat = @{
    File            = '..\.build.ps1'
    EnvironmentFile = '.\environment\se-2.json'
    ConfigFile      = '.\config\1-tier-app.json'
    IdentityPath    = '.\credential\laptop'
    }

Invoke-Build @Splat -Result Result

πŸ“˜ Documentation

Here are some resources to get you started! If you find any challenges from this project are not properly documented or are unclear, please raise an issue and let us know! This is a fun, safe environment - don't worry if you're a GitHub newbie! ❀️

πŸ’ͺ How You Can Help

We glady welcome contributions from the community. From updating the documentation to adding more tests for this framework, all ideas are welcome. Thank you in advance for all of your issues, pull requests, and comments! ⭐

πŸ“Œ License

πŸ‘‰ About Rubrik Build

We encourage all contributors to become members. We aim to grow an active, healthy community of contributors, reviewers, and code owners. Learn more in our Welcome to the Rubrik Build Community page.

We'd love to hear from you! Email us: [email protected] πŸ’Œ

use-case-powershell-backup-validation's People

Contributors

chriswahl avatar cleygraf avatar drew-russell avatar jaapbrasser avatar mwpreston avatar rfitzhugh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

use-case-powershell-backup-validation's Issues

MountLiveNetwork task isn't taking the -Confirm parameter properly.

Reported via email from build.rubrik.com

Under the MoveLiveMountNetwork task we are trying to pass a -Confirm $false to the Set-NetworkAdapter command but I’m guessing the syntax changed or something because the command wants -Confirm:$false. I’m not sure how to do that the fancy way so I just added to the command as shown below.

OLD:

# Synopsis: Move a Live Mount to a test network

task MoveLiveMountNetwork {

    $i = 0

    foreach ($Mount in $MountArray) {

        $SplatNetAdapter = @{

            NetworkName  = $Config.virtualMachines[$i].testNetwork

            Connected    = $true

            Confirm      = $false

        }

        $ValidateNetwork = Get-NetworkAdapter -VM $Config.virtualMachines[$i].mountName |

            Set-NetworkAdapter @SplatNetAdapter

 

NEW:

# Synopsis: Move a Live Mount to a test network

task MoveLiveMountNetwork {

    $i = 0

    foreach ($Mount in $MountArray) {

        $SplatNetAdapter = @{

            NetworkName  = $Config.virtualMachines[$i].testNetwork

            Connected    = $true

        }

        $ValidateNetwork = Get-NetworkAdapter -VM $Config.virtualMachines[$i].mountName |

            Set-NetworkAdapter @SplatNetAdapter -Confirm:$false

Add a config parameter for subnet size

The current script assumes that the VM live mount will be attached to a subnet with a /24 subnet mask. This value should be able to be specified via configuration parameter.

Email Report

Describe the solution you'd like

Customer is requesting ability for use case/script to email report of success/failure for workloads validated by this project.

Invoke-Build stops at GetConfig

Expected Behavior

Script should continue with build.

Current Behavior

Script stops after IdentityPath.

Failure Information (for bugs)

Please help provide information about the failure if this is a bug.

  • Use verbose outputs to capture any debug information.
PS C:\Users\Martin Hoffman\Desktop\Rubrik\Backup Validations> $Splat = @{
>>     File            = '.\.build.ps1'
>>     EnvironmentFile = '.\environment\TestEnv.json'
>>     ConfigFile      = '.\config\TestVM.json'
>>     IdentityPath    = '.\credential'
>>     }
>>
>> Invoke-Build @Splat -Result Result
ERROR: Cannot bind parameter 'Status'. Cannot convert value "GetConfig" to type "VMware.VimAutomation.Sdk.Types.V1.TaskState". Error: "Unable to match the identifier name GetConfig to a valid enumerator name. Specify one of the following enumerator names and try again:
Queued, Running, Success, Error, Unknown"
Build ABORTED C:\Users\Martin Hoffman\Desktop\Rubrik\Backup Validations\.build.ps1. 0 tasks, 1 errors, 0 warnings 00:00:01.1586066
C:\Users\Martin Hoffman\Documents\WindowsPowerShell\Modules\InvokeBuild\5.4.5\Invoke-Build.ps1 : Cannot bind parameter
'Status'. Cannot convert value "GetConfig" to type "VMware.VimAutomation.Sdk.Types.V1.TaskState". Error: "Unable to mat
ch the identifier name GetConfig to a valid enumerator name. Specify one of the following enumerator names and try agai
n:
Queued, Running, Success, Error, Unknown"
At line:8 char:1
+ Invoke-Build @Splat -Result Result
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-Build.ps1], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Invoke-Build.ps1

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  • Started with a new build.

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Version of project.
  • Version of dependencies.
    Powershell - 5.1.17134.590
    InvokeBuild - 5.4.5
    Rubrik - 4.0.0.216
    RubrikBackupValidation - 1.0.0.0
    VMware.PowerCLI - 11.2.0.12483598
  • Version of operating system.
    Windows 10

Failure Logs

Please include any relevant log snippets or files here.

  • Use verbose outputs to capture any debug information.
Paste into a code block.

Backup Validation Module not available

Expected Behavior

Install-Module -Name RubrikBackupValidation -Scope CurrentUser installs the backup validation modiule

Please describe the behavior you are expecting.

Current Behavior

PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'RubrikBackupValidation'. Try Get-PSRepository to see all available registered
module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21

  • ... $null = PackageManagement\Install-Package @PSBoundParameters
  •                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
    • FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Failure information is above

Please help provide information about the failure if this is a bug.

https://www.powershellgallery.com a quick search online or via PS commands reveals no module with this name

Standardize Credential File Names

The following was reported via email through build.rubrik.com.

build.ps1 and default environment json files are looking for rubrikCred.xml, vmwareCred.xml, and guestCred.xml but if you generate these files with the included β€œgenerateCreds.ps1” script, they are saved with an appended β€œs” making rubrikCreds, vmwareCreds, etc.

GenerateCreds.ps1 should be updated removing the 's' from the credential files generated

tests.ps1 enhancement

To support DHCP assignment to virtual machines, under 'config' folder the JSON parameters have IP details for 'testip' , testnetwork' & 'testgateway' which support tests defined within tests.ps1. Certainly within Gaia labs the DHCP element would be welcomed as it would remove any manual entries & finding free IP's.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.