Skip to main content
OnCommand Workflow Automation 5.1

PowerShell and Perl WFA modules

Contributors

You must be aware of the PowerShell or Perl modules for OnCommand Workflow Automation (WFA) to write scripts for your workflows.

PowerShell modules

Guidelines Example

Use the Data ONTAP PS Toolkit to invoke APIs whenever the toolkit is available.

The Add VLAN command uses the toolkit as follows:

Add-NaNetVlan-Interface $Interface-Vlans$VlanID

If there are no cmdlets available in the Data ONTAP PS Toolkit, use the Invoke-SSH command to invoke the CLI on Data ONTAP.

Invoke-NaSsh-Name $ArrayName-Command "ifconfig -a"-Credential $Credentials

Perl modules

The NaServer module is used in WFA commands. The NaServer module allows the invocation of Data ONTAP APIs, which are used in active management of Data ONTAP systems.

Guidelines Example

Use the NaServer module to invoke APIs whenever the NetApp Manageability SDK is available.

The following example shows how the NaServer module is used for a resume SnapMirror operation:

  eval {

    $wfa_util->sendLog('INFO',
        "Connecting to the cluster: $DestinationCluster"
    );
    my $server
        = $wfa_util->connect($DestinationClusterIp, $DestinationVserver);

    my $sm_info = $server->snapmirror_get(
        'destination-vserver' => $DestinationVserver,
        'destination-volume'  => $DestinationVolume
    );

    my $sm_state  = $sm_info->{'attributes'}->{'snapmirror-info'}->{'mirror-state'};
    my  $sm_status = $sm_info->{'attributes'}->{'snapmirror-info'}->{'relationship-status'};

    $wfa_util->sendLog('INFO',
        "SnapMirror relationship is $sm_state ($sm_status)");

    if ($sm_status ne 'quiesced') {
        $wfa_util->sendLog('INFO',
            'The status needs to be quiesced to resume transfer.');
    } else {
        my $result = $server->snapmirror_resume(
            'destination-vserver' => $DestinationVserver,
            'destination-volume'  => $DestinationVolume
        );
        $wfa_util->sendLog('INFO', "Result of resume:  $result");
        $wfa_util->sendLog('INFO', 'Resume operation started successfully.');
    }
}

If a Data ONTAP API is not available, invoke the Data ONTAP CLI using the executeSystemCli utility method.

Note

executeSystemCli is not supported and is currently available only for Data ONTAP operating in 7-Mode.

None