+adapted_types = ["ns3::Node",
+ "ns3::Icmpv4L4Protocol",
+ "ns3::ArpL3Protocol",
+ "ns3::Ipv4L3Protocol",
+ "ns3::PropagationLossModel",
+ "ns3::MobilityModel",
+ "ns3::PropagationDelayModel",
+ "ns3::WifiRemoteStationManager",
+ "ns3::WifiNetDevice",
+ "ns3::WifiChannel",
+ "ns3::WifiPhy",
+ "ns3::WifiMac",
+ "ns3::ErrorModel",
+ "ns3::ErrorRateModel",
+ "ns3::Application",
+ "ns3::FdNetDevice",
+ #"ns3::DceApplication",
+ "ns3::NetDevice",
+ "ns3::Channel",
+ "ns3::Queue"]
+
+base_types = ["ns3::IpL4Protocol"]
+
+def select_base_class(ns3, tid):
+ base_class_import = None
+ base_class = None
+
+ rtype = tid.GetName()
+
+ type_id = ns3.TypeId()
+
+ for type_name in adapted_types:
+ tid_base = type_id.LookupByName(type_name)
+ if type_name == rtype or tid.IsChildOf(tid_base):
+ base_class = "NS3Base" + type_name.replace("ns3::", "")
+ base_module = "ns3" + type_name.replace("ns3::", "").lower()
+ base_class_import = "from nepi.resources.ns3.%s import %s " % (
+ base_module, base_class)
+ return (base_class_import, base_class)
+
+ base_class_import = "from nepi.resources.ns3.ns3base import NS3Base"
+ base_class = "NS3Base"
+
+ for type_name in base_types:
+ tid_base = type_id.LookupByName(type_name)
+ if type_name == rtype or tid.IsChildOf(tid_base):
+ return (base_class_import, base_class)
+
+ return (None, None)
+