<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic WFA Function to Reverse DNS Lookup in Active IQ Unified Manager Discussions</title>
    <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-Function-to-Reverse-DNS-Lookup/m-p/105812#M18694</link>
    <description>&lt;P&gt;I have an need to be able to mount an NFS Datastore into VMWare using its DNS Name.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not familiar with MVEL, and there isn't much material that I can find on it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone assist in creating a function that returns back the DNS name when it is passed an IP address?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to do this so that I don't have to customize the certified Mount Datastore command, and it will assist down the line with return parameters.&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jun 2015 21:25:37 GMT</pubDate>
    <dc:creator>coreywanless</dc:creator>
    <dc:date>2015-06-03T21:25:37Z</dc:date>
    <item>
      <title>WFA Function to Reverse DNS Lookup</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-Function-to-Reverse-DNS-Lookup/m-p/105812#M18694</link>
      <description>&lt;P&gt;I have an need to be able to mount an NFS Datastore into VMWare using its DNS Name.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not familiar with MVEL, and there isn't much material that I can find on it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone assist in creating a function that returns back the DNS name when it is passed an IP address?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to do this so that I don't have to customize the certified Mount Datastore command, and it will assist down the line with return parameters.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2015 21:25:37 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-Function-to-Reverse-DNS-Lookup/m-p/105812#M18694</guid>
      <dc:creator>coreywanless</dc:creator>
      <dc:date>2015-06-03T21:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: WFA Function to Reverse DNS Lookup</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-Function-to-Reverse-DNS-Lookup/m-p/105819#M18695</link>
      <description>&lt;P&gt;Hi Corey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would recommend you do this using the "System.Net.Dns" .NET class within your WFA Command using PowerShell (IE your command would accept an IP Address as an input parameter but will perform a DNS lookup of the hostname then mount the datastore using the hostname). You could do it one line of PowerShell&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt; [String]$ipAddress = "192.168.100.10"&lt;BR /&gt;&amp;gt; [String]$hostName = [System.Net.Dns]::GetHostEntry($ipAddress).HostName&lt;/P&gt;&lt;P&gt;&amp;gt; $hostName&lt;BR /&gt;&amp;gt; TESTWFA1.testlab.local&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or...you could create a PowerShell function to include in your WFA Command. EG:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#'------------------------------------------------------------------------------&lt;BR /&gt;Function Get-DNSHostName{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [CmdletBinding()]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Param(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Parameter(Position=0,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mandatory=$True,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ValueFromPipeLine=$True,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ValueFromPipeLineByPropertyName=$True)]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [String]$IPAddress&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [String]$hostName = [System.Net.Dns]::GetHostEntry($ipAddress).HostName&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }Catch{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [String]$hostName = ""&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return $hostName;&lt;BR /&gt;}#End Function&lt;BR /&gt;#'------------------------------------------------------------------------------&lt;BR /&gt;[String]$ipAddress = "192.168.100.10"&lt;BR /&gt;[String]$hostName = Get-DNSHostName -IPAddress $ipAddress&lt;BR /&gt;Write-Host $hostName&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: This assumes you have configured your A &amp;amp; PTR records in DNS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2015 23:34:38 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-Function-to-Reverse-DNS-Lookup/m-p/105819#M18695</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2015-06-03T23:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: WFA Function to Reverse DNS Lookup</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-Function-to-Reverse-DNS-Lookup/m-p/105821#M18696</link>
      <description>&lt;P&gt;Thanks Matt for the reply. I have used a similar method in non-certified commands in WFA. What I am trying to avoid is cloning the "certified" command, and making the modifications to it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my example I'm wanting to use the certified command "Create VMware NFS Datastore". &amp;nbsp;So what I was looking to do was use the function capability inside WFA (not powershell functions), and feed the ip address to the function outside of the command to feed to the certified command.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 01:53:42 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-Function-to-Reverse-DNS-Lookup/m-p/105821#M18696</guid>
      <dc:creator>coreywanless</dc:creator>
      <dc:date>2015-06-04T01:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: WFA Function to Reverse DNS Lookup</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-Function-to-Reverse-DNS-Lookup/m-p/105827#M18698</link>
      <description>&lt;P&gt;WFA MVEL fucntions are java functions. You can do anything with a Java code, you can create a function and do it. For the Reverse DNS lookup, the following function will do.&lt;/P&gt;&lt;P&gt;===&lt;/P&gt;&lt;P&gt;function reverseDns(ip)&lt;BR /&gt;{&lt;BR /&gt;import java.net.*;&lt;/P&gt;&lt;P&gt;InetAddress add = InetAddress.getByName(ip);&lt;BR /&gt;String hostfqdn = add.getCanonicalHostName();&lt;BR /&gt;return hostfqdn;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;===&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now you can use it in your workflow and get the DNS names.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 05:53:37 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-Function-to-Reverse-DNS-Lookup/m-p/105827#M18698</guid>
      <dc:creator>sinhaa</dc:creator>
      <dc:date>2015-06-04T05:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: WFA Function to Reverse DNS Lookup</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-Function-to-Reverse-DNS-Lookup/m-p/105854#M18707</link>
      <description>&lt;P&gt;That's exactly what I'm looking for!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One day I will learn java syntax. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 14:04:24 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-Function-to-Reverse-DNS-Lookup/m-p/105854#M18707</guid>
      <dc:creator>coreywanless</dc:creator>
      <dc:date>2015-06-04T14:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: WFA Function to Reverse DNS Lookup</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-Function-to-Reverse-DNS-Lookup/m-p/142036#M25929</link>
      <description>&lt;P&gt;Hi sinhaa,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this is very helpful and sorry for hi-jacking this thread.&lt;/P&gt;
&lt;P&gt;But I have the issue, when no entry was found in DNS, an error is thrown.&lt;/P&gt;
&lt;P&gt;Since I'm not very familiar with MVEL, how can I achieve it, that a NULL value or a message like 'No DNS entry found!' will be returned?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Tino&lt;/P&gt;</description>
      <pubDate>Fri, 10 Aug 2018 13:36:51 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-Function-to-Reverse-DNS-Lookup/m-p/142036#M25929</guid>
      <dc:creator>TiMatrix</dc:creator>
      <dc:date>2018-08-10T13:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: WFA Function to Reverse DNS Lookup</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-Function-to-Reverse-DNS-Lookup/m-p/142056#M25930</link>
      <description>&lt;P&gt;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/19505"&gt;@TiMatrix&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't put try/catch blocks in WFA functions. Try the below function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Its taken care of all 3 cases.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. IP not pingable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. IP Pingable but, DNS entry not found.&lt;/P&gt;
&lt;P&gt;3. Found DNS entry, return the FQDN.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;function reverseDns(ip)
{
import java.net.*;
InetAddress add = InetAddress.getByName(ip);

if(add.isReachable(10000))
{
String hostfqdn = add.getCanonicalHostName();

if (add.getHostAddress().contentEquals(hostfqdn))
{
	return 'IP pingable but DNS entry NOT found';
}
else
{
return hostfqdn;
}
}

else
{
	return 'Host Not Reachable';
}

}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sinhaa&lt;/P&gt;</description>
      <pubDate>Tue, 14 Aug 2018 07:25:43 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-Function-to-Reverse-DNS-Lookup/m-p/142056#M25930</guid>
      <dc:creator>sinhaa</dc:creator>
      <dc:date>2018-08-14T07:25:43Z</dc:date>
    </item>
  </channel>
</rss>

