box_get removed and replaced for get in testbed_impl
[nepi.git] / test / lib / mock / execute.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 from constants import TESTBED_ID
5 from nepi.core import testbed_impl
6
7 class TestbedController(testbed_impl.TestbedController):
8     def __init__(self, testbed_version):
9         super(TestbedController, self).__init__(TESTBED_ID, testbed_version)
10
11     def do_configure(self):
12         pass
13
14     def get_route(self, guid, index, attribute):
15         try:
16             return self.box_get_route(guid, int(index), attribute)
17         except KeyError, AttributeError:
18             return None
19
20     def get_address(self, guid, index, attribute='Address'):
21         try:
22             return self.box_get_address(guid, int(index), attribute)
23         except KeyError, AttributeError:
24             return None
25
26     def action(self, time, guid, action):
27         raise NotImplementedError
28
29     def trace(self, guid, trace_id, attribute='value'):
30         if attribute == 'value':
31             return """PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
32
33 --- 10.0.0.2 ping statistics ---
34 1 packets transmitted, 1 received, 0% packet loss, time 0ms
35 """
36         elif attribute == 'path':
37             return '<test>'
38         else:
39             return None
40
41     def shutdown(self):
42             pass
43