Showing posts with label IAAS. Show all posts
Showing posts with label IAAS. Show all posts

Friday, March 9, 2018

Infrastructure testing using Pester - Part 2

In my previous post I explained briefly about the basics of using Pester to test and validate your infrastructure. This article is about how to create/ output custom messages on Pester test failures. Let's have a look at the below example.

#example_test.ps1
Describe "Verify drive D" {
    Context "Check file system type and AUS" {
        It "Test 1: Should be NTFS" {
            $drive_stat = fsutil fsinfo statistics D:
            ($drive_stat[0]) -match 'File System Type :\s+NTFS' | Should Be $true
        }
        It "Test 2: Should have 4K AUS" {
            $AUS_stat = fsutil fsinfo refsinfo D:
            ($AUS_stat[8]) -match 'Bytes Per Cluster :\s+4096' | Should Be $true
        }
    }
}

Describe "Verify Hyper-V vSwitch" {
    Context "Check for Corp vSwitch, its type and connected NIC" {
       
        $check = Get-VMSwitch | where name -eq Corp

        It "Test 3: Corp vSwitch should be present" {
            ($check.Name) | Should -BeExactly "Corp"
        }
        It "Test 4: Corp vSwitch type should be Internal" {
            ($check.SwitchType) | Should -BeExactly "Internal"  
        }
    }
}


I get the following output, when I run it against one of my test machine.


The above screenshot shows, Test 1 and Test 4 is failed. Eventhough you get the error message, some users/ admins prefer to have a custom message when a test fails. So that it will be very easy to troubleshoot for the one who is validating the infrastructure. To save custom messages for each test, I am using a hash table, and if a test is found to be failed, it will pick the respective custom message from the hash table and displays it and the end of the test. Here I created a new ps1 file as below.

#invoke_test.ps1
$test = Invoke-Pester .\example_test.ps1 -PassThru

$failmsg_table = @{
    "Test 1: Should be NTFS"                        = "Test 1: Failed because the filesystem of drive D is not NTFS"
    "Test 2: Should have 4K AUS"                    = "Test 2: Failed because the AUS of drive D is not 4K"
    "Test 3: Corp vSwitch should be present"        = "Test 3: Failed becuase Corp vSwitch is not present"
    "Test 4: Corp vSwitch type should be Internal"  = "Test 4: Failed because Corp vSwitch type is not Internal"
}

for ($i=0; $i -le $test.TotalCount; $i++){
    if ($test.TestResult[$i].Result -eq "Failed") {
        write-output $failmsg_table[$($test.TestResult[$i].Name)]
    }
}



When I execute "invoke_test.ps1", it invokes "example_test.ps1" and the output is saved to variable "test". The hash table has the list of tests and the corresponding custom message. If any of the "TestResult" is Failed, the corresponding custom message will be displayed. Sample output screenshot is given below.


 Hope this was useful. Cheers!

Sunday, April 26, 2015

OpenStack

  • OpenStack is an open source cloud operating system
  • It can be used to control large pools of compute, storage and networking resources throughout a datacentre, all managed through a dashboard that gives administrators control while permitting their users to provision resources through a web interface
  • It provides IAAS - Infrastructure-As-A-Service
  • OpenStack is a software platform that can be used to convert your traditional private datacentre to a private cloud
  • There are several components of OpenStack : Compute, Storage, Networking, Dashboard and Shared services
  • A conceptual relationship diagram of these components is shown below :

 
 
Reference :
www.openstack.org
 

Thursday, April 2, 2015

Cloud

Cloud computing or simply cloud refers to the delivery of computing resources on demand, which includes mostly everything from applications to data centers over the internet on a pay-for-use basis. It can be private cloud, public cloud or hybrid cloud. A private cloud is owned and operated by a specific enterprise where as in a public cloud like Amazon AWS or Microsoft Azure, any one can create an account and build up their virtual infrastructure following the rules and regulations of the cloud service provider. A hybrid cloud is nothing but a combination of private and public cloud, where enterprises have most of their infrastructure running on a private cloud and a part of their infrastructure is running on the public cloud. Cloud offers SAAS (Software-As-A-Service), PAAS (Platform-As-A-Service) and IAAS (Infrastructure-As-A-Service).

Considering the public cloud, high performance tier 4 data centers are the basic building blocks or foundation of the cloud infrastructure. Several virtualized data center clusters which are geographically distributed across the globe and interconnected by multiple high speed and redundant communication links that are backed up by multiple power sources and disaster recovery (DR) plans forms the backbone of public cloud architecture. It mainly provides IAAS (Infrastructure-As-A-Service) platform that manages and orchestrates pools of storage, network and compute resources. You can setup an on-demand elastic cloud computing service. It allows end users to provision resources. They are massively scalable infrastructure. Everything is virtualized. Internally, a pool of virtual appliances support the operation and configuration of the cloud itself. It will be having a GUI, web interface for provisioning resources and managing the cloud infrastructure. It will also have high availability and metering of resource usage.

You can setup your own private cloud using open source cloud platforms like Open Stack, Apache Cloud Stack etc.