Subscribe
Accepted Solution

how should I find out child element name for new API ?

I am trying to write a perl script to configure the IP/vlan/vif and make them persistent how should I proceed ?

  • net-config-get-active
  • net-config-get-persistent
  • net-config-set-persistent
  • net-ifconfig-get
  • net-ifconfig-set
  • net-ipspace-assign
  • net-ipspace-create
  • net-ipspace-destroy
  • net-ipspace-list
  • net-route-add
  • net-route-delete
  • net-vlan-create
  • net-vlan-delete

Thanks for all the help

rle Former NetApp Employee

Re: how should I find out child element name for new API ?

Hi,

Please consult the documentation for child elements on any API.  Documentation can be found at the NetApp Developer Page.

If you make a configuration change and want to keep it persistent, make the change using the appropriate net- API.  Then use net-config-get-active and take net-config-info output and use it as input to net-config-set-persistent.

Regards,

   - Rick -

rle Former NetApp Employee

Re: how should I find out child element name for new API ?

I would like add that I would start off by saving a copy of the .rc file, and then execute the set persistent code and compare .rc files.  After that, make one change in the active configuration, set persistent and compare the changes.  Keep it simple at first for testing.

Regards,

   - Rick -

Re: how should I find out child element name for new API ?

Should i be using net-ifconfig-get of net-config-info for 7 mode .

rle Former NetApp Employee

Re: how should I find out child element name for new API ?

Hi Ashutosh,

All the APIs that have been mentioned, net-ifconfig-get, net-config-get-active, and net-config-set-persistent are 7-mode APIs.  I assume that you are reading the API documentation under 7-mode APIs.

If you look at net-ifconfig-get, net-config-info is not an input or output; however, interface-config-info is an output.  Please read the API documentation.

Regards,

   - Rick -

Re: how should I find out child element name for new API ?

I am trying to fetch , IP  address and interface name etc information from the following code, is there something i am missing. Glad anyone could help

my $volume_info = $out->child_get("net-config-info");

    my @vol = $volume_info->child_get('interface-config-info');

   

        my $vol_name = $vol->child_get_string('interface-name');

        print  "interface-name: $vol_name \n";

        my $size_total = $vol->child_get_string('mediatype');

        print  "mediatype: $size_total \n";

        my $size_used = $vol->child_get_int('mtusize');

       

        print  "mtusize: $size_used  \n";

        print "--------------------------------------\n";

        my $ipv4_addresses = $volume_info->child_get("v4-primary-address");

       

        if ($ipv4_addresses) {

        my $ipaddr_info = $ipv4_addresses->child_get("ip-address-info");

        print("IP Address:      " . $ipaddr_info->child_get_string("address") . "\n");

rle Former NetApp Employee

Re: how should I find out child element name for new API ?

It should be something like this:

$out = $s->invoke("net-ifconfig-get");

if ($out->results_status() eq "failed) {

         print($out->results_reason() ."\n");

         exit(-2)

}

my $interface_info = $out->child_get("interface-config-info");

my @info = $interface_info->children_get();

my $interface;

foreach $interface (@info) {

        my $name = $interface->child_get_string('interface-name');

        print  "interface-name: $name \n";

        my $size_total = $interface->child_get_string('mediatype');

        print  "mediatype: $size_total \n";

        my $size_used = $interface->child_get_int('mtusize');

        print  "mtusize: $size_used  \n";

        print "--------------------------------------\n";

        my $ipv4_addresses = $interface->child_get("v4-primary-address");  

        if ($ipv4_addresses) {

                my $ipaddr_info = $ipv4_addresses->child_get("ip-address-info");

                print("IP Address:      " . $ipaddr_info->child_get_string("address") . "\n");

        }

}

I don't have a 7-mode machine to test, so you'll have try the code.  BTW, you can use ZEDI to explore APIs.  Check-out http://developer.netapp.com for the download.

Regards,

   - Rick -

how should I find out child element name for new API ?

http://developer.netapp.com page is amazing source of info Baba Rick ... with my adventures in started in SDK .. many thanks to you for all the  awesome help

Re: how should I find out child element name for new API ?

This time i am trying to create a ifgrp , program runs well without error but no ifgrp is created

my $ifgrpapi  =  new NaElement('net-config-set-persistent');

my $api = new NaElement('net-config-info');

   $ifgrpapi->child_add($api);

my $ui = new NaElement('ifgrps');

$api->child_add($ui);

my $yi  = new NaElement('ifgrp-info');

$ui->child_add($yi);

my $wi =  new NaElement('interfaces');

$api->child_add($wi);

my $wi =  new NaElement('interfaces');

$api->child_add($wi);

my $vi = new NaElement('interface-config-info');

$wi->child_add($vi);

$wi->child_add_string('ipspace-name','default-ipspace');

$yi->child_add_string('interface-name','vif0');

$yi->child_add_string('ifgrp-type','single');

Any help to create a vif minus the vlan tagging would be much appreciated .

rle Former NetApp Employee

Re: how should I find out child element name for new API ?

I don't see where the code invokes any API.

Also, it seems weird that the code sets persistence and then addes a new vif.

As I stated earlier, please download ZEDI and use it to experiment with.

Regards,

   - Rick -