Device class natively only contains the meta-data and the interconnectinformation related to testbed device. For example, device connectionsattribute is simply a dictionary describing the many ways to connect to theactual device it represent. With the help of ConnectionManager class,Device objects are effectively transformed into a compound object that bothhandles the above, as well as the actual connections (Eg. telnet/ssh).
device attributes are compounded with attributes of this connection manager.Eg. calling device.connect() is the same as callingdevice.connectionmgr.connect(), and calling each connection usingdevice..execute() is the same asdevice.connectionmgr..execute()
Testbed object provides Testbed.destroy() function, allowing youto destroy connections asynchronously to multiple testbed devices. Unlike.disconnect(), if .destroy() is used, then all connection objectswill be completely removed.
Link and Testbed also have aliases, but since they are not stored asMutableMappings like Testbed.devices and Device.interfaces, theyneed to be accessed directly and tested for their alias instead. Example,if intf.link.alias == 'linkAlias'.
As well, because the topology is represented by physical relationships, theircontained objects move with them. Eg, if you move an interface object from onedevice to another, the link that is connected to that interface moves with it.Ditto for devices and their interfaces, etc.
The above example may be elaborate (involving new testbeds), but is only usedas an example to show how everything works together. Attribute collection (suchas links) is a combined iterative computation of parent/child relationships,as shown above.
Therefore, all rules of python garbage collection apply. For example, if youdereference a device object entirely, all of its interface objects will be gone.However, the only exception is Link objects: if more than one interfaceconnects to the same link, then unless all of those interfaces are removed, thelink will continue to exist.
760c119bf3