Add support for switches in GUI and configuration file
refs: #2583
Change-Id: I051dfe7c9e5fae292a7ca97f26f41dfc403241b8
diff --git a/ndn/conf_parser.py b/ndn/conf_parser.py
index 84add19..a351a68 100644
--- a/ndn/conf_parser.py
+++ b/ndn/conf_parser.py
@@ -86,6 +86,10 @@
' Angle: ' + str(self.angle) + \
' NLSR Parameters: ' + self.nlsrParameters
+class confNdnSwitch:
+ def __init__(self, name):
+ self.name = name
+
class confNDNLink():
def __init__(self,h1,h2,linkDict=None):
@@ -147,6 +151,24 @@
return hosts
+def parse_switches(conf_arq):
+ 'Parse switches section from the conf file.'
+ config = ConfigParser.RawConfigParser()
+ config.read(conf_arq)
+
+ switches = []
+
+ try:
+ items = config.items('switches')
+ except ConfigParser.NoSectionError:
+ return switches
+
+ for item in items:
+ name = item[0]
+ switches.append(confNdnSwitch(name))
+
+ return switches
+
def parse_links(conf_arq):
'Parse links section from the conf file.'
arq = open(conf_arq,'r')