Subscribe
Accepted Solution

OnTAP API - Can't seem to figure out how to show/list all VIF's

Hello Community,

 

First time posting, so hopefully its not a dumb question.

 

 

I've looked up and down the OnTAP API but cannot figure out a way to list and identify all VIF's (virtual interfaces).

 

The CLI makes it incredibly easy, but I can't figure out how to get the relavent info via the API.

 

Any help would be greatly appreciated.

Re: OnTAP API - Can't seem to figure out how to show/list all VIF's

Maybe this ruby implementation can help you:

 

def get_data_interfaces(primary_or_secondary,protocol)
data_interfaces=[]

xcommand = NaElement.new("net-interface-get-iter")
netattribs_desired = NaElement.new("desired-attributes")
interfaceinfo_desired = NaElement.new("net-interface-info")
vserver_name_desired = NaElement.new("vserver")
dataprotocols_desired = NaElement.new("data-protocols")

dataprotocols_array_desired = NaElement.new("data-protocol")
dataprotocols_desired.child_add(dataprotocols_array_desired)

administrativestatus_desired = NaElement.new("administrative-status")

interfaceinfo_desired.child_add(vserver_name_desired)
interfaceinfo_desired.child_add(dataprotocols_desired)
interfaceinfo_desired.child_add(administrativestatus_desired)

netattribs_desired.child_add(interfaceinfo_desired)

netattribs_query = NaElement.new("query")
interfaceinfo_query = NaElement.new("net-interface-info")

svm = ""
if primary_or_secondary.eql?("primary") then
svm = @primary_svm
else
svm = @secondary_svm
end

interfaceinfo_query.child_add_string("vserver",svm)

dataprotocols_query = NaElement.new("data-protocols")
dataprotocols_query.child_add_string("data-protocol",protocol)
interfaceinfo_query.child_add(dataprotocols_query)

netattribs_query.child_add(interfaceinfo_query)

xcommand.child_add(netattribs_desired)
xcommand.child_add(netattribs_query)

output = @connection.invoke_elem(xcommand)
if (output.results_status() == "failed") then
@logger.fatal "#{@config_name}: Unable to connect to #{svm} for getting data interfaces: #{output.results_reason()}"
return nil
end

result_count = output.child_get_int("num-records")

if result_count>0 then
info_interfaces = output.children_get()
info_interfaces.each { |interface_element_info|
if interface_element_info.class.name.eql?("NaElement") then
interface_info = interface_element_info.children_get()
interface_info.each{|interface|
data_interface = Hash.new
data_interface["interface-name"] = interface.child_get_string("interface-name")
data_interface["administrative-status"] = interface.child_get_string("administrative-status")
data_interface["data-protocol"] = protocol
data_interfaces.push(data_interface)
}
end
}
else
end # result_count>0 then
@logger.info "#{@config_name}: Retrieved data interfaces from #{svm} (#{primary_or_secondary}): #{data_interfaces.inspect}"
return data_interfaces
end # get_data_interfaces(primary_or_secondary)

Re: OnTAP API - Can't seem to figure out how to show/list all VIF's

Well, with clustered ONTAP, you would use the net-port-ifgrp-get API (if you're using PowerShell, use the Get-NcNetPortIfgrp cmdlet).

 

For 7-mode, I'm not sure...I don't have any 7-mode systems to test with.

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Re: OnTAP API - Can't seem to figure out how to show/list all VIF's

If you don't have to use the API, have you considered creating a user account on the filer that uses ssh keys for authentication?

You could then do someting like

ssh user@filer net int show ...

 

Re: OnTAP API - Can't seem to figure out how to show/list all VIF's

For one reason I don't like using ssh, because output of cli can be changed release by release

Re: OnTAP API - Can't seem to figure out how to show/list all VIF's

Mainly don't want to use SSH because I want this as an automated process. Since I've got all my netapp monitoring all done via the API, I kind of want to keep it consistent.

Re: OnTAP API - Can't seem to figure out how to show/list all VIF's

 

I'm pretty sure I tried those endpoints... but I'll check again.

 

I'll let you know what I find.