Steve Holden wrote:
while not impossible (using Python's excellent
> introspection facilities) is way beyond what most people would consider
> practical. Obviously the garbage collector has to solve this problem,
> but you *really* don't want to be doing this stuff in Python unless you
> absolutely *must*.
> 
> regards
>  Steve


Thanks very much for the detailed reply. Let me explain in a little more
detail what I am doing, and perhaps you could let me know if I am going
about it the wrong way.


I am creating an object database to store information about network
devices, e.g. switches and routers.

At the top level there are device objects, every device object contains
a mib object--and other various properties--where the actual data is
stored. The mib object is a dicitionary--or at least subclasses
dictionary--where the key is the oid (a unique string) and the value is
a special object called Datapoint. Datapoints come in two types Static
and Dynamic, and every Datapoint is unique.

So a simple structure looks something like this:

Device1
  Mib1
     {'1.3.6.1':Datapoint-x1,
      '1.3.6.2':Datapoint-y1,
      '1.1.5.4':Datapoint-z1,
      '1.2.7.3':Datapoint-q1}

Device2
  Mib2
     {'1.3.6.1':Datapoint-x2,
      '1.3.6.2':Datapoint-y2,
      '1.1.5.4':Datapoint-z2,
      '1.2.7.3':Datapoint-q2}

In the example Datapoint-xx should be read as, some unique data point in
memory.

The key in the Mib object is important because it is used by the
Datapoint is points to to look up its current value on the given device,
which is why I asked the two questions.

In my program I use snmp to look up values on network devices. i.e. 'Go
find the value of 1.3.6.1 from device1.' I want to be able to say
something like Device1.Mib['1.3.6.1].update(), and the correct Datapoint
discovers its key (oid) and parent device, then executes an snmp query
that looks something like this snmpget(keyThatPointsToSelf,
parentObj.ipAddress, parentObj.paramx)

I know of course I could keep all this in a relational database and do a
bunch of queries, but that would really suck! and I would have to track
all the Devices and oids my self. What I really want is smart objects
that think for me--thats what computers are for, right? ;)

I thought my design was a wonderfuly beautiful use of python an oop, but
perhaps I am mistaken and there is a much more pragmatic way to get the
job done. In the end preformance doesn't matter a lot. The front end
will be web based, so if the db can process faster than http/javascript
and user Bob who has to mouse, then everything will be fine.

Let me know what you think
Thanks much
--Matthew
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to