added basic API registration and connection mechanism
[osm/vim-emu.git] / emuvim / cli / __main__.py
1 """
2 For now only a dummy client. Connects to the zerorpc interface of the
3 emulator and performs some actions (start/stop/list).
4 """
5 import time
6 import zerorpc
7
8
9 def main():
10 print "Example CLI client"
11 # create connection to remote Mininet instance
12 c = zerorpc.Client()
13 c.connect("tcp://127.0.0.1:4242")
14
15 # do some API tests
16 print c.compute_action_start("dc2", "my_new_container1")
17
18 time.sleep(5)
19
20 print c.compute_action_stop("dc2", "my_new_container1")
21
22
23 if __name__ == '__main__':
24 main()