def __init__(self, env, nid, props): super().__init__(env) # Initialize node properties self.nid = nid self.type = env.config['network'].nodes[nid].type self.alias = env.config['network'].nodes[nid].alias self.props = props # Initialize variables self.generators = {} # Map: {generator type: Generator class} self.queues = {} # Map: {neighbor id: DtnNeighborManager} self.neighbors = [] # List of neighbors as specified in config file self.radios = {} # Map: {radio id: Radio class} self.endpoints = {} # Map: {eid: Endpoint class} # Convergence layers. This is a map of map of maps of the following form # {neighbor id: duct id: induct/ouduct: DtnAbstractDuct subclass} self.ducts = defaultdict(lambda: defaultdict(dict)) # Queue to store all bundles that are waiting to be forwarded self.in_queue = DtnQueue(env) # Queue for the limbo self.limbo_queue = DtnQueue(env) # Create variables to store results self.dropped = []
def __init__(self, env, parent, params): # Call parent constructor super().__init__(env) # Store the node that contains this manager, it is a DtnNode self.parent = parent # Create a queue that can be locked and set the capacity to the specified value self.queue = DtnMaxCapacityQueue(env, parent, params.max_buffer_size) # Handshake queue self.handshake_queue = DtnQueue(env) # Lock to ensure that all operations related to putting one bundle in # the queue are "atomic" self.put_lock = DtnLock(env) # Get all connections possible for this node self.cons = { d: c for (o, d), c in self.env.connections.items() if o == self.parent.nid } # Create an engine for each connection in the system for dest, con in self.cons.items(): # Process to get elements out of the queue to transmit env.process(self.queue_extractor(dest, con))
def __init__(self, env, name, parent, neighbor): super(DtnAbstractDuct, self).__init__(env) self.base_name = name # See network architecture file (xml) self.parent = parent # DtnNode self.neighbor = neighbor # A string with the name of the neighbor self.monitor = self.env.monitor # Connection through which data is sent #self.conn = env.connections[parent.nid, neighbor] # Add the queue for the convergence layer. DTN does not control it and # therefore it is assumed to be plain FIFO self.in_queue = DtnQueue(env) # Queue to store messages that were not successfully sent by the duct # and thus must be sent to the node's limbo self.to_limbo = DtnQueue(self.env) # Queue to store messages that were successfully sent by the duct self.success_queue = DtnQueue(self.env)
def initialize_fwd_handler(self, hid): self.fwd_handlers.add(hid) self.fwd_queues[hid] = DtnQueue(self.env) self.env.process(self.run_fwd_handler(hid))
def __init__(self, env, parent, shared=True): # Call parent constructor super(DtnBasicRadio, self).__init__(env, parent, shared) # Create input queue self.in_queue = DtnQueue(env)