Hi Dan,

Thanks for the quick response. Looking at the info you've given I think 
that the bindings storage component would probably do what I need -- I 
want to be able to translate IPs into locations and I think this would 
allow me to do it without tracking that info myself.

If you have sample code (or are able to throw some together quickly) I'd 
certainly appreciate it, but I can also take a poke around in 
bindings_storage to see what's there at the moment.

Glen


Daniel Wendlandt wrote:
> Hi Glen,
>
> As a caveat, I can't speak to how much of the authenticator interface 
> may soon be exposed to python, so there may well be an easier and more 
> efficient way to accomplish what you want than what I describe below.
>
> You can use the "bindings storage" component ( 
> nox/src/nox/apps.bindings_storage ) to access the information you 
> what, but the interface is somewhat cumbersome.  Bindings storage is a 
> fairly generic mechanism that let's you look up a hostname based on 
> any network identifier (i.e., a mac, a location, or an IP) and let's 
> also let's you lookup the set of network identifiers (a 
> ip,mac,location tuple) that is associated with any hostname.   Using 
> two such calls in succession would let you go from a single network 
> identifier to a couple of all network identifiers.
> The python interface for bindings storage is in 
> nox/src/nox/apps/bindings_storage/pybindings_storage.i
> to get a name based on a network identifier, use a function like:
>      def get_names_by_ap(self,dpid, port, cb):
>
>      def get_names_by_mac(self,mac, cb):
>
>      def get_names_by_ip(self,ip, cb):
>
> These functions returns (via a callback) a list of all host or user 
> names associated with that network identifier.  Each list element is a 
> tuple, with the first element being the string name, and the second 
> being an integer indicating the type of name (e.g., HOST, USER, etc. 
> see nox/src/nox/apps/bindings_storage/bs_datastructures.i ).   "ap" is 
> an old name for a location, that is, a datapathid, port pair.
> You can then take one of the (name,name_type) tuples from the list and 
> use this call:
>
>      def get_entities_by_name(self,name, name_type, cb):
>
> This returns (via a callback) a list of (dpid,port,mac,ip) tuples 
> associated with that name.  I'm not sure what (if any) names 
> authenticator is currently assigning to the hosts in your network.  If 
> you have no static name bindings, it seems that authenticator would 
> assign all hosts the name "unknown", in which case calling 
> get_entities_by_name with "unknown" would return tuples representing 
> all hosts in the network.  I'm not sure what the most recent 
> authenticator does.
> Another downside to this approach is that it is somewhat slow, as 
> queries to bindings storage access NOX's in memory database, not local 
> datastructures.
> If it turns out that this is your best option, i can help you out with 
> sample code if you like,
>
> dan
>
>
> Glen Gibb wrote:
>> Hi all,
>>
>> I'm wanting to access information kept by the authenticator from a 
>> Python application. Specifically, I'm wanting to get MAC:IP:location 
>> mappings but I don't seem to be able to query the authenticator to do 
>> this. Ideally I'd like to be able to say "Give me info about 
>> 192.168.0.1" and it would return the MAC and location info.
>>
>> In the C++ code, functions like get_dlconns and get_nwconns seem 
>> almost to do what I need but they don't seem to be exported to 
>> Python. (Also, these functions seem to require a MAC address -- I 
>> don't necessarily want to use the MAC address but at least get_dlconn 
>> would be a start.)
>>
>> Any advice would be greatly appreciated,
>> Glen
>>
>> _______________________________________________
>> nox-dev mailing list
>> [email protected]
>> http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
>>   
>
>


_______________________________________________
nox-dev mailing list
[email protected]
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org

Reply via email to