ONTAP Rest API Discussions

CLI passthrough fields unavailable, visible in SVM console

RobertSimac
1,445 Views

We have an interesting case here. Bit older Ontap version, 9.7, but may apply to newer versions too. Also a bit of show stopper for our ongoing zapi-to-rest porting, otherwise progressing very well, and rest apis both performing well and simplifying existing code greatly.

 

Problem:

 

As documented https://library.netapp.com/ecmdocs/ECMLP2862544/html/, this should work, but as the test below show, it does not, ontap rest cli passthrough is not retreiving the available_size field even though that field is visible in the vserver CLI console, under exact same user/lif.

 

Documentation states the security for both console CLI and ontap cli passthru is exactly the same: Security: All CLI-based REST APIs are RBAC-controlled, based on the role of the authenticated user and have the same protections they have in the CLI.

Ontap CLI console, at SVM lif, shows all the fields we need, especially the aggr available size:

devzzy::> vserver show-aggregates
                                       Available
Vserver        Aggregate      State         Size Type    SnapLock Type
-------------- -------------- ------- ---------- ------- --------------
devzzy         dev_stor_01_ssd1  online     14.09TB ssd     non-snaplock
devzzy         dev_stor_02_ssd1  online     16.34TB ssd     non-snaplock
2 entries were displayed.

devzzy::> version
NetApp Release 9.7P13: Thu Apr 15 02:06:46 UTC 2021

Ontap REST to CLI passthrough, showing nothing but vserver and aggr name and ignores the fields required. At he end, positive test confirming the calling syntax is ok:

simacr@simacr-linux:~$curl --insecure --user user:pass "https://devzzy/api/private/cli/vserver/aggregates"
{
  "records": [
    {
      "vserver": "devzzy",
      "aggregate": "dev_stor_01_ssd1"
    },
    {
      "vserver": "devzzy",
      "aggregate": "dev_stor_02_ssd1"
    }
  ],
  "num_records": 2
}
simacr@simacr-linux:~$ curl --insecure --user user:pass "https://devzzy/api/private/cli/vserver/aggregates?fields=available_size"
{
  "error": {
    "message": "The value \"available_size\" is invalid for field \"fields\" (<field,...>)",
    "code": "262197",
    "target": "fields"
  }
}simacr@simacr-linux:~$ curl --insecure --user user:pass "https://devzzy/api/private/cli/vserver/aggregates?fields=size"
{
  "error": {
    "message": "The value \"size\" is invalid for field \"fields\" (<field,...>)",
    "code": "262197",
    "target": "fields"
  }
}simacr@simacr-linux:~$ curl --insecure --user user:pass "https://devzzy/api/private/cli/vserver/aggregates?fields=state"
{
  "error": {
    "message": "The value \"state\" is invalid for field \"fields\" (<field,...>)",
    "code": "262197",
    "target": "fields"
  }
}simacr@simacr-linux:~$ curl --insecure --user user:pass "https://devzzy/api/private/cli/vserver/aggregates?fields=vserver"
{
  "records": [
    {
      "vserver": "devzzy",
      "aggregate": "dev_stor_01_ssd1"
    },
    {
      "vserver": "devzzy",
      "aggregate": "dev_stor_02_ssd1"
    }
  ],
  "num_records": 2
}

 

 

1 ACCEPTED SOLUTION

RobertSimac
553 Views

Found the problem, it was my 'user error' not figuring out the field name is `availsize`. I tried with `available_size` and `size` but failed to figure out the proper naming. As kindly pointed to by my teammate, the field names, if not visible in documentation, can be obtained from CLI while typing the command and pressing TAB after -field option...

This makes the REST CLI proxy usable for getting the svm aggrs available sizes. It would be nice to have it in native svm rest, but the CLI proxy will do for now...

View solution in original post

2 REPLIES 2

RobertSimac
836 Views

This inconsistency still exists in Ontap 9.11...

 

Aggregate sizes are very much visible from within Ontap CLI 'vserver show-aggregates' but the aggr size not visible using REST apis native nor thru CLI proxy for the exact same user authenticated to SVM... The aggr name and uuid are visible in both cases... Only the aggr size is missing when queried via REST apis...

 

Our use case queries SVM for its aggregates, check the aggregate sizes, and picks the most appropriate for further operations. All worked (and still works) well with ZAPIs but now we are unable to get the aggr sizes using REST apis...

 

From our perspective this looks like slight inconsistency, especially the fact the Ontap CLI 'vserver show-aggregates' displays the aggr sizes, while REST apis are not, for exact same SVM user....

 

RobertSimac
554 Views

Found the problem, it was my 'user error' not figuring out the field name is `availsize`. I tried with `available_size` and `size` but failed to figure out the proper naming. As kindly pointed to by my teammate, the field names, if not visible in documentation, can be obtained from CLI while typing the command and pressing TAB after -field option...

This makes the REST CLI proxy usable for getting the svm aggrs available sizes. It would be nice to have it in native svm rest, but the CLI proxy will do for now...

Public