Send Netdot-users mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://osl.uoregon.edu/mailman/listinfo/netdot-users
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Netdot-users digest..."
Today's Topics:
1. REST API (Bassett, Mark)
2. Re: REST API (Boyer, Eric)
3. Re: REST API (Carlos Vicente)
----------------------------------------------------------------------
Message: 1
Date: Thu, 3 Apr 2014 22:00:44 +0000
From: "Bassett, Mark" <[email protected]>
Subject: [Netdot-users] REST API
To: "[email protected]" <[email protected]>
Message-ID:
<b9afe1a22e5a614aac33fec49e4e157c03a00...@g4w3305.americas.hpqcorp.net>
Content-Type: text/plain; charset="us-ascii"
Are the only 2 interfaces for the rest api /device and /host ? I'd like
to be able to search for IP/mac addresses and the switch port interface they
are associated with through the rest api, but I'm not finding anything.
I suppose I would need to directly query the database or use some of the perl
scripts locally to do this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://osl.uoregon.edu/pipermail/netdot-users/attachments/20140403/03d77448/attachment-0001.html
------------------------------
Message: 2
Date: Fri, 4 Apr 2014 05:54:40 +0000
From: "Boyer, Eric" <[email protected]>
Subject: Re: [Netdot-users] REST API
To: "Bassett, Mark" <[email protected]>
Cc: "[email protected]" <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="windows-1252"
Mark,
>From my experience using the API thus far, I?m not sure of a way to search
>specifically for the switch port that a particular device/host might be on
>using the API. However, if by ?I?d like to be able to search for IP/mac
>addresses? you mean just being able to use the API to find a host/device by
>using those as search terms, you can do that.
For example, doing a GET of /rest/host?address=xxx.xxx.xxx.xxx, where
xxx.xxx.xxx.xxx is an IP you are searching for, you will be able to get
information related to that REST resource. For MAC addresses you can do a GET
/rest/host?ethernet=XXXXXXXXXXXX where the X?s are the MAC address.
Due to the nature of REST APIs (using HTTP GETs), you can point your web
browser to
netdot-install.example.com/netdot/rest/host?<http://netdot-install.example.com/netdot/rest/host?>
and it will display objects that get generated, just so you can play around
with it. I?ve also noticed that you can do things like this: GET
/rest/horizontalcable? and it will display objects in the horizontal cable
table of the underlying database, but you won?t be able to search it.
Looking through the PERL code, it seems the following are a list of searchable
attributes for a host:
RRID, IPID, name, zone, subnet, address, expiration, aliases, ethernet, duid,
cpu, os, and info
If you want to do any deletes, you can only delete a host by its rrid or ipid
Just thought I would share my experiences so far. Hope its somewhat useful. I?m
sure the developers could give you a better idea.
------------
Eric Boyer
Network Engineer
National Center for Supercomputing Applications
On Apr 3, 2014, at 5:00 PM, Bassett, Mark
<[email protected]<mailto:[email protected]>> wrote:
Are the only 2 interfaces for the rest api /device and /host ? I?d like
to be able to search for IP/mac addresses and the switch port interface they
are associated with through the rest api, but I?m not finding anything.
I suppose I would need to directly query the database or use some of the perl
scripts locally to do this?
_______________________________________________
Netdot-users mailing list
[email protected]<mailto:[email protected]>
https://osl.uoregon.edu/mailman/listinfo/netdot-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://osl.uoregon.edu/pipermail/netdot-users/attachments/20140404/c9c66469/attachment-0001.html
------------------------------
Message: 3
Date: Fri, 4 Apr 2014 09:35:27 -0400
From: Carlos Vicente <[email protected]>
Subject: Re: [Netdot-users] REST API
To: "Bassett, Mark" <[email protected]>
Cc: "[email protected]" <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=windows-1252
Hi Mark,
You can access any object in the database via REST. The examples use the Device
object to demonstrate how to GET, POST and DELETE things, including passing
parameters for the search, but the same pattern applies to any other object.
For example:
You can search an Ipblock by address like this:
http://server/netdot/rest/ipblock?address=192.168.0.1
Or a physical address (MAC) address like this:
http://server/netdot/rest/physaddr?address=0050569E753F
etc.
Notice that there is no ?host? object in the database. That is a convenience
rest resource that facilitates dealing with the combination of objects that are
associated with a host (IP address, DHCP scope, RR (DNS) records, etc).
Now, finding the edge switch port given a MAC or IP address is not a direct DB
query. It involves several queries (see PhysAddr::find_edge_port)
There isn?t a REST component to handle that at the moment. Ideally, we should
create one based on similar code as in bin/find_address.pl
I expect to have that in the near future.
cv
On Apr 3, 2014, at 6:00 PM, Bassett, Mark <[email protected]> wrote:
> Are the only 2 interfaces for the rest api /device and /host ? I?d
> like to be able to search for IP/mac addresses and the switch port interface
> they are associated with through the rest api, but I?m not finding anything.
>
> I suppose I would need to directly query the database or use some of the perl
> scripts locally to do this?
> _______________________________________________
> Netdot-users mailing list
> [email protected]
> https://osl.uoregon.edu/mailman/listinfo/netdot-users
------------------------------
_______________________________________________
Netdot-users mailing list
[email protected]
https://osl.uoregon.edu/mailman/listinfo/netdot-users
End of Netdot-users Digest, Vol 65, Issue 2
*******************************************