#region Copyright
/*
* Copyright © 2014-2016 NetApp, Inc. All Rights Reserved.
*
* CONFIDENTIALITY NOTICE: THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION OF
* NETAPP, INC. USE, DISCLOSURE OR REPRODUCTION IS PROHIBITED WITHOUT THE PRIOR
* EXPRESS WRITTEN PERMISSION OF NETAPP, INC.
*/
#endregion
#region Using Directives
using System;
using System.ComponentModel;
using System.Management.Automation;
using SolidFire.Core;
using SolidFire.Element.Api;
using System.Linq;
using SolidFire.Core.Helpers;
#endregion
namespace SolidFire.Test
{
///
/// Used to test the management connection to the cluster. The test pings the MVIP and executes a simple API method to verify connectivity.
///
[Cmdlet(VerbsDiagnostic.Test, "SFConnectMvip")]
public class TestSFConnectMvip : SFCmdlet
{
#region CmdLet Parameters
[Parameter(HelpMessage = "Use this to test the management connection of a different MVIP. This is not needed to test the connection to the target cluster.")]
public string Mvip { get; set; }
#endregion
#region Cmdlet Overrides
protected override void BeginProcessing()
{
base.BeginProcessing();
CheckConnection(endPoint: SolidFireUtilities.SFEndPoint.Node);
}
protected override void ProcessRecord()
{
base.ProcessRecord();
var request = new TestConnectMvipRequest()
{
Mvip = Mvip
};
var objsFromAPI = SendRequest("TestConnectMvip", request);
WriteObject(objsFromAPI.Select(o => o.Result), true);
}
#endregion
}
}