Add support for switches in GUI and configuration file

refs: #2583

Change-Id: I051dfe7c9e5fae292a7ca97f26f41dfc403241b8
diff --git a/bin/minindn b/bin/minindn
index bf5a525..836beed 100755
--- a/bin/minindn
+++ b/bin/minindn
@@ -68,7 +68,7 @@
 
 from ndn import ExperimentManager
 from ndn.ndn_host import NdnHost, CpuLimitedNdnHost
-from ndn.conf_parser import parse_hosts, parse_links
+from ndn.conf_parser import parse_hosts, parse_switches, parse_links
 
 import os.path, time
 import optparse
@@ -175,6 +175,7 @@
         global hosts_conf
         global links_conf
         hosts_conf = parse_hosts(conf_arq)
+        switches_conf = parse_switches(conf_arq)
         links_conf = parse_links(conf_arq)
 
         self.isTCLink = False
@@ -185,6 +186,9 @@
                 self.isLimited = True
             self.addHost(host.name, app=host.app, params=host.uri_tuples, cpu=host.cpu,cores=host.cores,cache=host.cache, workdir=workDir)
 
+        for switch in switches_conf:
+            self.addSwitch(switch.name)
+
         for link in links_conf:
             if len(link.linkDict) == 0:
                 self.addLink(link.h1, link.h2)
@@ -245,6 +249,11 @@
         for intf in host.intfList():
             link = intf.link
             node1, node2 = link.intf1.node, link.intf2.node
+
+            if node1 in net.switches or node2 in net.switches:
+                print "%s or %s is a switch" % (node1.name, node2.name)
+                continue
+
             if link.intf1 not in interfaces and link.intf2 not in interfaces:
                 interfaces.append(link.intf1)
                 interfaces.append(link.intf2)