...
In this example, the Mininet driver inherits from the abstract Emulator driver which inherits from the CLI driver. The Mininet driver reuses the execute and disconnect API from the CLI driver. The connect API is the only API that is redefined.
Code Block |
---|
class MininetMininetCliDriver( Emulator ): def __init__( self ): super(Emulator MininetCliDriver, self ).__init__() self.handle = self def connect( self, user_name, ip_address, pwd, options ): self.handle = super(Mininet MininetCliDriver, self ).connect( user_name, ip_address, pwd ) |
Here the connect will call the super (clidriver) connectinherited connect() method from CLI driver (via Emulator class).
Driver specific methods/functions can be specified using the simple execute command in mininetclidriver.
...
The cluster driver combines the CLI, REST, and Bench components as a cluster. This allows the use of a function or variable from another driver without the need to specify that specific driver. For example,
Code Block | ||
---|---|---|
| ||
main.Cluster.active( 0 ).devices() |
can be used instead of
Code Block | ||
---|---|---|
| ||
main.ONOScli1.devices() |
and keeps the same context as the former. This can be helpful in tests where the number of ONOS nodes is not static throughout the test.
However, if the function name is similar across more than one driver, the driver name will need to be specified. For example, in
Code Block |
---|
main.Cluster.active( 0 ).CLI.sendline( "roles" ) |
"CLI" must be specified to avoid ambiguity.
...
Stuck? Found a bug? Questions?
Email us if you’re stuck, think you’ve found a bug, or just want to send some feedback. Please have a look at the guidelines to learn how to efficiently submit a bug report.
...