Merge pull request #395 from effy/dev2

Update javadoc and test codes
diff --git a/cluster-mgmt/make-mininet.sh b/cluster-mgmt/make-mininet.sh
index 8571ce0..207b89e 100755
--- a/cluster-mgmt/make-mininet.sh
+++ b/cluster-mgmt/make-mininet.sh
@@ -8,6 +8,9 @@
 fi
 
 basename=$ONOS_CLUSTER_BASENAME
+## Shell Var can't handle "-" so replace it with "_"
+basename_var=`echo $ONOS_CLUSTER_BASENAME | sed 's/\-/_/g'`
+
 NR_NODES=$ONOS_CLUSTER_NR_NODES
 hosts_file=$1
 
@@ -21,14 +24,16 @@
 done
 cp template/onsdemo_core.py ${basename}1/onsdemo.py
 
-cat $hosts_file  | awk '{printf("%s=%s\n",$2,$1)}' > .tmp
+## Shell var can't handle "-" so replace it with "_"
+cat $hosts_file | sed 's/\-/\_/g' | awk '{printf("%s=%s\n",$2,$1)}' > .tmp
+
 for n in `seq 2 $NR_NODES`; do
   cat template/tunnel_onsdemo_edge_template.sh | awk '{if(NR==2){system("cat .tmp")}else{print $0}}' |\
   sed "s/__NWID__/$n/g" |\
-  sed "s/__TUNNEL__/TUNNEL\=\(\"1 $n ${basename}1\"\)/g" > ${basename}${n}/tunnel_onsdemo.sh
+  sed "s/__TUNNEL__/TUNNEL\=\(\"1 $n ${basename_var}1\"\)/g" > ${basename}${n}/tunnel_onsdemo.sh
   chmod 755 ${basename}${n}/tunnel_onsdemo.sh
 done
 
 cat template/tunnel_onsdemo_core_template.sh | awk '{if(NR==2){system("cat .tmp")}else{print $0}}' |\
-  sed "s/__basename__/$basename/g" > ${basename}1/tunnel_onsdemo.sh 
+  sed "s/__basename__/${basename_var}/g" > ${basename}1/tunnel_onsdemo.sh 
   chmod 755 ${basename}1/tunnel_onsdemo.sh
diff --git a/cluster-mgmt/template/onsdemo_core.py b/cluster-mgmt/template/onsdemo_core.py
index 61d2dcc..a0e184e 100755
--- a/cluster-mgmt/template/onsdemo_core.py
+++ b/cluster-mgmt/template/onsdemo_core.py
@@ -65,14 +65,6 @@
         host5 = self.addHost( 'host5' )
         host6 = self.addHost( 'host6' )
 
-        root1 = self.addHost( 'root1', inNamespace=False )
-        root2 = self.addHost( 'root2', inNamespace=False )
-        root3 = self.addHost( 'root3', inNamespace=False )
-        root4 = self.addHost( 'root4', inNamespace=False )
-        root5 = self.addHost( 'root5', inNamespace=False )
-        root6 = self.addHost( 'root6', inNamespace=False )
-
-
         self.addLink( host1, sw1 )
         self.addLink( host2, sw2 )
         self.addLink( host3, sw3 )
@@ -80,7 +72,6 @@
         self.addLink( host5, sw5 )
         self.addLink( host6, sw6 )
 
-
         self.addLink( sw1, sw2 )
         self.addLink( sw1, sw6 )
         self.addLink( sw2, sw3 )
@@ -90,13 +81,6 @@
         self.addLink( sw5, sw6 )
         self.addLink( sw4, sw6 )
 
-        self.addLink( root1, host1 )
-        self.addLink( root2, host2 )
-        self.addLink( root3, host3 )
-        self.addLink( root4, host4 )
-        self.addLink( root5, host5 )
-        self.addLink( root6, host6 )
-
 def startsshd( host ):
     "Start sshd on host"
     info( '*** Starting sshd\n' )
@@ -154,25 +138,6 @@
     host5.defaultIntf().setIP('192.168.100.145/16')
     host6.defaultIntf().setIP('192.168.100.146/16')
 
-    root1, root2, root3, root4, root5, root6  = net.get( 'root1', 'root2', 'root3', 'root4', 'root5', 'root6' )
-    host1.intf('host1-eth1').setIP('1.1.1.1/24')
-    root1.intf('root1-eth0').setIP('1.1.1.2/24')
-
-    host2.intf('host2-eth1') .setIP('1.1.2.1/24')
-    root2.intf('root2-eth0').setIP('1.1.2.2/24')
-
-    host3.intf('host3-eth1') .setIP('1.1.3.1/24')
-    root3.intf('root3-eth0').setIP('1.1.3.2/24')
-
-    host4.intf('host4-eth1') .setIP('1.1.4.1/24')
-    root4.intf('root4-eth0').setIP('1.1.4.2/24')
-
-    host5.intf('host5-eth1') .setIP('1.1.5.1/24')
-    root5.intf('root5-eth0').setIP('1.1.5.2/24')
-
-    host6.intf('host6-eth1') .setIP('1.1.6.1/24')
-    root6.intf('root6-eth0').setIP('1.1.6.2/24')
-
     hosts = [ host1, host2, host3, host4, host5, host6 ]
     stopsshd ()
     startsshds ( hosts )
diff --git a/cluster-mgmt/template/onsdemo_edge_template.py b/cluster-mgmt/template/onsdemo_edge_template.py
index 1f746f3..e340f38 100755
--- a/cluster-mgmt/template/onsdemo_edge_template.py
+++ b/cluster-mgmt/template/onsdemo_edge_template.py
@@ -56,7 +56,6 @@
 
         switch = []
         host = []
-        root = []
 
         for i in range (NR_NODES):
             name_suffix = '%02d' % NWID + "." + '%02d' % (int(i)+1)
@@ -67,7 +66,6 @@
 
         for i in range (NR_NODES):
             host.append(self.addHost( 'host%d' % (int(i)+1) ))
-            root.append(self.addHost( 'root%d' % (int(i)+1), inNamespace=False ))
 
         for i in range (NR_NODES):
             self.addLink(host[i], switch[i])
@@ -75,9 +73,6 @@
         for i in range (1, NR_NODES):
             self.addLink(switch[0], switch[i])
 
-        for i in range (NR_NODES):
-            self.addLink(root[i], host[i])
-
 def startsshd( host ):
     "Start sshd on host"
     info( '*** Starting sshd\n' )
@@ -139,14 +134,6 @@
          for h in range (25):
            host[i].setARP('192.168.%d.%d' % (n, (int(h)+1)), '00:00:%02x:%02x:%02x:%02x' % (192,168,n,(int(h)+1))) 
 
-    root = []
-    for i in range (NR_NODES):
-        root.append(net.get( 'root%d' % (int(i)+1) ))
-
-    for i in range (NR_NODES):
-        host[i].intf('host%d-eth1' % (int(i)+1)).setIP('1.1.%d.1/24' % (int(i)+1))
-        root[i].intf('root%d-eth0' % (int(i)+1)).setIP('1.1.%d.2/24' % (int(i)+1))
-
     stopsshd ()
 #    stopiperf ()
     startsshds ( host )