05-09-2016 01:28 PM
I'm trying to query our NetMRI device for a list of devices who have a particular VLAN configured. For example, if I take a VLAN name or index I would like to get all devices with that VLAN. I've been using the below query but can't get it to return a specific device; it only will return all devices. I've tried search and show to filter this out, but haven't had any success with either. Any assistance that can be provided would much appreciated. Thanks in advance!
Solved! Go to Solution.
05-09-2016 01:42 PM
That said, I don't think most of the _grids APIs, which are made for the UI grids, are published as external APIs and so they may change at any time. Unless that one appears in the API docs, you can't rely on it not changing from version to version (typically it would just add columns, but you never know).
I would use the VlanMember API for that, though it also will have limited searching. If you use VlanMember, you can use the "include" parameter to avoid multiple queries to fetch the device details.
05-09-2016 01:54 PM
Thanks for the quick reply! I tried using search instead of index on that class but wasn't able to get it to return any objects for me.
I did find this in the documentation on the appliance, but wasn't aware they weren't typically externally facing APIs. Are they typically just used as an integration point for the Grid?
Would the VlanMember API give me the ability to search based on VLAN rather than a device? In my use case I can expect to have a network and a VLAN but no other identifying information on which to base a query, hence the need to search by VLAN.
Thanks again for the assistance!
05-09-2016 02:20 PM
If you first query the VLAN API:
The result will contain VlanID (our internal ID, as opposed to VlanIndex which is the switch VLAN ID). Then:
If you are only searching for actual switches participating in the VLAN (as opposed to things attached to access ports that are in the VLAN), then you can use VlanName directly in the VlanMember "search". Note though that that will use whatever VLAN name is configured on that particular switch, whereas the Vlan API will search by the name of the VLAN on the root bridge. VlanMember essentially represents the configuration of a particular VLAN on a particular switch (for BridgeMemberInd = 1).
05-09-2016 08:25 PM
That makes sense. I tried to search by VLAN ID after using the VLAN object and searching for the appropriate VLAN. However, when I tried to use the second search (for VLAN members) it failed to return a device object.
What was interesting is that the output mirrored the input options listed in the API documentation, but were much more verbose than what the documentation indicated would be an expected output. I'm not sure if you've seen this behavior before or not.
Thanks again for the help and let me know if there's anything else I can provide for you regarding this.
05-10-2016 07:22 AM
Nevermind; I figured it out. The device information is after the VLAN information. Clearly yesterday was a Monday . Sorry about the confusion and thanks for all of the help. I think I'm good now. Very much appreciate the quick assistance with this - will definitely reach out in the future with any questions I have.
05-10-2016 07:33 AM
05-11-2016 09:32 AM
Yep I figured that part out but thank you for the confirmation. I think based on what you've provided plus what I ran across in the documentation I should be good to go. Thanks again for all of your help; I'll definitely reach out if I have any questions in the future.