last version using pyro4
[osm/vim-emu.git] / dockernetrpc / example_client.py
index 55973e1..213905c 100644 (file)
@@ -1,4 +1,5 @@
 import Pyro4
+import time
 
 
 def main():
@@ -8,18 +9,29 @@ def main():
     # do some API tests
     h1 = rmn.addHost('h1')
     h2 = rmn.addHost('h2')
-    #d1 = rmn.addDocker('d1', ip='10.0.0.253', dimage="ubuntu")
+    d1 = rmn.addDocker('d1', ip='10.0.0.253', dimage="ubuntu")
 
     s1 = rmn.addSwitch("s1")
 
     rmn.addLink(h1, s1)
     rmn.addLink(h2, s1)
+    rmn.addLink(d1, s1)
 
     rmn.start()
 
+    # check functionality at runtime
+    """
+    d2 = rmn.addDocker('d2', dimage="ubuntu")
     h3 = rmn.addHost('h3', ip='10.0.0.200')
-    rmn.addLink(h3, s1)
+    rmn.addLink(d2, s1, params1={"ip": "10.0.0.251/8"})
 
+    time.sleep(2)
+    rmn.removeLink(node1="h1", node2="s1")
+    rmn.removeHost('h1')
+    #rmn.removeHost('d1')
+    """
+
+    time.sleep(2)
     rmn.stop()