+ self._setlog[guid] = dict()
+ if time not in self._setlog[guid]:
+ self._setlog[guid][time] = dict()
+ self._setlog[guid][time][name] = value
+ self._set[guid][name] = value
+
+ def get(self, guid, name, time = TIME_NOW):
+ """
+ gets an attribute from box definitions if available.
+ Throws KeyError if the GUID wasn't created
+ through the defer_create interface, and AttributeError if the
+ attribute isn't available (doesn't exist or is design-only)
+ """
+ if not guid in self._create:
+ raise KeyError, "Element guid %d doesn't exist" % guid
+ factory = self._get_factory(guid)
+ if not factory.box_attributes.has_attribute(name):
+ raise AttributeError, "Invalid attribute %s for element type %s" % \
+ (name, factory.factory_id)
+ if guid in self._set and name in self._set[guid]:
+ return self._set[guid][name]
+ if guid in self._create_set and name in self._create_set[guid]:
+ return self._create_set[guid][name]
+ return factory.box_attributes.get_attribute_value(name)
+
+ def get_route(self, guid, index, attribute):
+ """
+ returns information given to defer_add_route.
+
+ Raises AttributeError if an invalid attribute is requested
+ or if the indexed routing rule does not exist.
+
+ Raises KeyError if the GUID has not been seen by
+ defer_add_route
+ """
+ ATTRIBUTES = ['Destination', 'NetPrefix', 'NextHop']
+
+ if attribute not in ATTRIBUTES:
+ raise AttributeError, "Attribute %r invalid for addresses of %r" % (attribute, guid)
+
+ attribute_index = ATTRIBUTES.index(attribute)
+
+ routes = self._add_route.get(guid)
+ if not routes:
+ raise KeyError, "GUID %r not found in %s" % (guid, self._testbed_id)
+
+ index = int(index)
+ if not (0 <= index < len(addresses)):
+ raise AttributeError, "GUID %r at %s does not have a routing entry #%s" % (
+ guid, self._testbed_id, index)
+
+ return routes[index][attribute_index]
+
+ def get_address(self, guid, index, attribute='Address'):
+ """
+ returns information given to defer_add_address
+
+ Raises AttributeError if an invalid attribute is requested
+ or if the indexed routing rule does not exist.
+
+ Raises KeyError if the GUID has not been seen by
+ defer_add_address
+ """
+ ATTRIBUTES = ['Address', 'NetPrefix', 'Broadcast']
+
+ if attribute not in ATTRIBUTES:
+ raise AttributeError, "Attribute %r invalid for addresses of %r" % (attribute, guid)
+
+ attribute_index = ATTRIBUTES.index(attribute)
+
+ addresses = self._add_address.get(guid)
+ if not addresses:
+ raise KeyError, "GUID %r not found in %s" % (guid, self._testbed_id)
+
+ index = int(index)
+ if not (0 <= index < len(addresses)):
+ raise AttributeError, "GUID %r at %s does not have an address #%s" % (
+ guid, self._testbed_id, index)
+
+ return addresses[index][attribute_index]
+
+ def get_attribute_list(self, guid):
+ factory = self._get_factory(guid)
+ attribute_list = list()
+ return factory.box_attributes.attributes_list