--- /dev/null
+#
+# NEPI, a framework to manage network experiments
+# Copyright (C) 2014 INRIA
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Alina Quereilhac <alina.quereilhac@inria.fr>
+
+class NS3Simulator(object):
+
+ @property
+ def client(self):
+ return self._client
+
+ def create(self, clazzname, *args):
+ return self.client.create(clazzname, *args)
+
+ def invoke(self, uuid, operation, *args):
+ return self.client.invoke(uuid, operation, *args)
+
+ def set(self, uuid, name, value):
+ return self.client.set(uuid, name, value)
+
+ def get(self, uuid, name):
+ return self.client.get(uuid, name)
+
+ def trace(self, *args):
+ return self.client.trace(*args)
+
+ def start(self):
+ return self.client.start()
+
+ def stop(self, time = None):
+ return self.client.stop(time)
+
+ def shutdown(self):
+ return self.client.shutdown()
+
import os
import re
-def dump_ns3_rms():
+def create_ns3_rms():
ns3 = load_ns3_module()
type_id = ns3.TypeId()
rtype = tid.GetName()
category = tid.GetGroupName()
+
classname = rtype.replace("ns3::", "NS3").replace("::","")
uncamm_rtype = re.sub('([a-z])([A-Z])', r'\1-\2', rtype).lower()
short_rtype = uncamm_rtype.replace("::","-")
replace('::', ''). \
replace("-","_").lower() + ".py"
- f = open(os.path.join(d, fname), "w")
- print os.path.join(d, fname)
- print template
+ #f = open(os.path.join(d, "classes", fname), "w")
+ #print os.path.join(d, fname)
+ #print template
#f.write(template)
- f.close()
+ #f.close()
def template_attributes(ns3, tid):
d = os.path.dirname(os.path.realpath(__file__))
attr_name = attr_info.name
checker = attr_info.checker
- attr_help = attr_info.help
+ attr_help = attr_info.help.replace('"', '\\"').replace("'", "\\'")
value = attr_info.initialValue
attr_value = value.SerializeToString(checker)
attr_allowed = "None"
for i in xrange(trace_count):
trace_info = tid.GetTraceSource(i)
trace_name = trace_info.name
- trace_help = trace_info.help
+ trace_help = trace_info.help.replace('"', '\\"').replace("'", "\\'")
trace_id = trace_name.lower()
traces += template.replace("<TRACE_ID>", trace_id) \
return traces
if __name__ == "__main__":
- dump_ns3_rms()
+ create_ns3_rms()