Software Development Kit (SDK) and API Discussions

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

ashutosk
7,669 Views

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

1 ACCEPTED SOLUTION

rle
NetApp Alumni
7,668 Views

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 -

View solution in original post

12 REPLIES 12

rle
NetApp Alumni
7,669 Views

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
NetApp Alumni
7,648 Views

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 -

ashutosk
7,648 Views

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

rle
NetApp Alumni
7,648 Views

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 -

ashutosk
7,648 Views

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
NetApp Alumni
7,648 Views

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 -

ashutosk
7,648 Views

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

ashutosk
7,648 Views

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
NetApp Alumni
7,648 Views

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 -

ashutosk
6,146 Views

Thanks Rick I am referring to the ZEDI engine you suggested. Based on the information in that I have created this code. However I am noticing that when I run this code on my 8.2 7 mode Ontap simulator the Simulator crashes , something funny somewhere .

There is no other way of approaching ifgrp-info to create a ifgrp except persistent api .Please let me know if there is a better solution than this .

rle
NetApp Alumni
6,146 Views

Repeating what I put in a private email:

There is no API to create interface groups (ifgrp), so you will have to use the system-cli API.  After that obtain the active configuration and set the persistent configuration.

Regards,

   - Rick -

ashutosk
6,146 Views

Hi Rick

Sorry for the late response, Thanks again I used system-cli API and that resolved my issue .

I would say ZEDI is great tool .. works on windows though but its ok . !!

As always thanks for great help

Ashu

Public