NECo: A tool to design and run experiments on arbitrary platforms.
[nepi.git] / test / util / plot.py
1 #!/usr/bin/env python
2
3 from neco.design.box import Box 
4 from neco.util.plot import Plotter
5
6 import subprocess
7 import unittest
8
9 class BoxPlotTestCase(unittest.TestCase):
10     def xtest_plot(self):
11         node1 = Box(label="node1")
12         ping1 = Box(label="ping")
13         mobility1 = Box(label="mob1")
14         node2 = Box(label="node2")
15         mobility2 = Box(label="mob2")
16         iface1 = Box(label="iface1")
17         iface2 = Box(label="iface2")
18         channel = Box(label="chan")
19
20         node1.connect(ping1)
21         node1.connect(mobility1)
22         node1.connect(iface1)
23         channel.connect(iface1)
24         channel.connect(iface2)
25         node2.connect(iface2)
26         node2.connect(mobility2)
27
28         plotter = Plotter(node1)
29         fname = plotter.plot()
30         subprocess.call(["dot", "-Tps", fname, "-o", "%s.ps"%fname])
31         subprocess.call(["evince","%s.ps"%fname])
32        
33 if __name__ == '__main__':
34     unittest.main()
35