Active IQ Unified Manager Discussions

Function qith query, function using ontap powershell api,...

RadovanTuran
3,447 Views

Hi all.

 

I'm trying to persuade our manageemnt about qualities of WFA software but I cannot resolve few issues.

Tried to find it on this forum but failed...

 

1.

I want to configure DNS, SMTP, SNMP servers according the location of datacenter.

Input for operator will use pull down list of sites configured as “enum list”.

 

Fine. Then I would like to use as argument of command configuring DNS server some function like getDnsServer(location).

I can do it by simple stupid way:

if (location == ’NY’)
{
return “10.10.10.1”;
}
if (location == ‘LA’)
{
return “10.10.20.1”;
}

 

 

And write it for few tents or even hundreds of location. Any new location will require code modification.

 

But we have playground database. I want to populate some table by name servers according the location

(and even create Data Source for it) and use simple query. But queries are available only in filters.

How to deal with this situation?

 

2.

I want to (within one workflow) resize volume together with resizing of snapmirror destination volume .

There is existing dictionary object for volume – nothing to do.

 

There is no snapmirror object for 7mode, just for cm_storage (why?) but we can clone and/or create it.

 

Then I need a function to get Array and Volume of snapmirror destination of particular source Array,Volume.

Ontap powershell API has the right fuctions. But I cannot use them in WFA functions. I cannot use them in WFA filter.

I can use them only in WFA commands.

 

How to create “WFA command” serving as function? To return pair DestArray,DestVolume based on input

parameters Array,Volume? I cannot find existing command example with playing with return values.

 

Or just anything I will be able to use as:

(DestArray, DestVolume) = getSnapmirrorDestination(SrcArray, SrcVolume)

 

Many thanks.

--

Rado

2 REPLIES 2

korns
3,429 Views

Hi Rado,

 

Here are some thoughts on these two topics. 

 

=======

 

1 - Tables options in WFA - Two ideas here, the first is quick-and-dirty, the second is the better, more extensible, option. You basically want it to be table driven. 

 

----------

Option-1A - Make an MVEL table and use the  MVEL function getValueFrom2DByRowKey() - An MVEL 2-dimensional table is really just an MVEL string that can be manipulated and search with the 'getValue*' group of built-in MVEL functions. Use the Setup -> Constants tab  to create a constant and have it's value be the string which is formatted as the MVEL DataCenter table, say:

 

Name: DC_SERVERS

Description: Table of DataCenters: DataCenter ~ DNSserver ~ SMTPserver ~ SNMPserver

Value: 'NY~10.10.10.1~10.10.10.2~10.10.10.3,LA~10.10.20.1~10.10.20.2~10.10.20.3'

 

Tilda separates each row/column, comma separates rows. Quotas around the whole thing. So that gives you a table of DCs with 3 server IP address for each. Then access with:

 

   getValueFrom2DByRowKey(DC_SERVERS,'NY',2) - to get DNS

   getValueFrom2DByRowKey(DC_SERVERS,'NY',3) - to get SMTP

   getValueFrom2DByRowKey(DC_SERVERS,'NY',4) - to get SNMP

 

To make this easier to deal with I'd create other contants, for example:

 

Name: DC_SELECTED

Description: User Input variable that will be defined as enum list of sites 

Value: $dcSelect (in user inputs this would be you enum list with, say, NY,LA)

 

Name: COMPUTED_DNS_SERVER

Description: The DNS Server for this data center 

Value: getValueFrom2DByRowKey(DC_SERVERS,DC_SELECTED,2) 

 

... etc for SMTP, SNMP

 

Then at other points in your workflow you can simply reference the COMPUTED_DNS_SERVER constant to specify the DNS server for this data center .. and same for SMTP, SNMP and other items. Then someday hen new data centers added you must tweak User Inputs and Constants tabs ... for each workflow ... so option B, a WFA cache table, is the better option ,,,

 

----------

Option-1B - create a WFA Cache table using: schema, dictionary and data source

 

No real need to use the playground db for this. The playground db is really reserved for cases where you need to be able to write to tables. You're requirement just needs to have a workflow read from a table at run-time. Your data source could pull from a spreasheet (csv, excel, etc) or maybe a table in another another SQL DB ... which could be within the playground but not strictly required in your case. Here is a write-up ( http://bit.ly/1CTFdPF ) on a clean and simple method to read from a standard Excel spreadsheet. Since normal WFA user/pswd access to playground gives you R/W to it, you could also just use a SQL-tool to manually populate a playground.dc_servers tables ... but it has been noted that that playground is less secure.

 

Oh, and queries/filter ... yes, you'll have to create a filter or two that 

 

========

 

2 - Determining destination volume - The 7-Mode storage.vsm table should address the issue? You have to write SQL filter to use it to select/find the destination(s) but it's do'able. You could also drop down into a customer WFA command tha resizes both src and dst and using powershell cmdlets to get to the dst.

 

abhit
3,397 Views

1.  There is a good post on how to update information in playground via a command code.

Please look into this post.

http://community.netapp.com/t5/OnCommand-Storage-Management-Software-Articles-and-Resources/WFA-command-to-insert-update-a-record-in-the-Playground-da...

The command works well. 

 

Additional reading:

Also read about invokeMySQLQuery in Workflow Developers guide.

http://community.netapp.com/t5/OnCommand-Storage-Management-Software-Articles-and-Resources/How-to-create-your-own-custom-WFA-dictionary-to-retrieve-d...

 

2.  Regarding resizing volume.

You can look into some of the workflows posted here, you may have to tweak to get exactly what you need.

Specifically "Manage SnapMirror-SnapVault Cascade Relationship" might be helpful. 

Please read the help file of the workflow to get more details.

http://automationstore.netapp.com/pack-list.shtml

Instead of functions, WFA uses SQL queries to get the related information.

 

Let us know if you have any specific questions.

 

Regards

Abhi

 

Public