Hi,
For the 1st query : I guess this is for the Moderator but I don't see any issue with sharing knowledge. Automation is always handy, but it depends how far you want to go with it. You can always share your knowledge and contribition on the current forum section, and also under - Developer Network | SDK . If usure, reach out to Moderator, they will move it to the right place.
Regarding your 2nd query : I don't think there is any special identification between Internal or External shelf except how it's numbered. In instances where the node contains internal disks (disk that resides in the controller module) shelf is set to ID 0, leaving ID's 1-98 available for external shelves.
However, there is no hard-fast rule for that, it's a recommendation following the Best practices that NetApp has laidout. Even for external shelfs the recommendation starts with '0'. So it is difficult to say if the zero really means Internal or External.
1) For a filer with no internal disks : Stack 1 contains shelf ID's 0-9
2) For a filer with internal disks : Stack 1 contains shelf ID's 1-9
In a clustered Data ONTAP environment, the shelf IDs only need to be unique within an HA pair, not across the entire cluster.
In any case, you may already know that Support.netapp.com site has 'Active IQ' feature, its under Tool downloads, which basically gives you complete VISUALIZATION on :
1) Cable
2) Stack
3) Raid
You don't need to login/ssh to Filers to obtain this information. This information is ready-made in the Active IQ tool based on the recent autosupport, I guess this is a good place to get to see your Hardware in VISUALs.
This is a very useful KB:
Shelf numbering best practice for attaching SAS shelves to a storage system:
https://kb.netapp.com/app/answers/answer_view/a_id/1001460
Active IQ Config Avisor: [Additional Tool]
Helps you in determining common configuration errors:
https://mysupport-beta.netapp.com/ui/#/tools/tool-eula/5ddb829ebd393e00015179b2
Thanks!