Beispiel #1
0
    def __init__(self, instanceID, version, G, MOP, Prf, DTSN, dodagID, rplnode,\
                 advertised_prefixes=[], of = of_zero(), active=False, is_root=False):
        """ Creates DODAG Object identified by instanceID, dodagID, version
        """
        super(dodag, self).__init__()
        
        
        self.of = of #Instance of objective function object
        self.__lock               = RLock()
        self.instanceID           = instanceID
        self.version              = Lollipop(version)
        self.dodagID              = dodagID
        self.G                    = G
        self.MOP                  = MOP
        self.Prf                  = Prf
        self.DTSN                 = Lollipop(DTSN)
        self.active               = active
        self.advertised_prefixes  = advertised_prefixes
        self.last_DAOSequence     = Lollipop()  # used during DAO - DAO_ACK exchanges
        self.last_PathSequence    = Lollipop()
        self.DAO_ACK_source       = None
        self.DAO_ACK_source_iface = None
        self.DAO_trans_retry      = 0
        self.downward_routes      = set()  # set of tuple in the form of (destination, prefix_len, prefix)
        self.preferred_parent     = None
        
        
        

        # cleanup purposes
        self.no_path_routes       = set()  # store the routes for which we received a No-Path DAO
        self.no_path_routes_trans = 0  # how many times the No-Path DAO have been transmitted

        # there are open flow ports, rpl_node ip and datapath
        self.rplnode = rplnode
#        self.ports = ports 
#        self.ip = ip
#        self.datapath = datapath
        
        if is_root:
            self.is_dodagRoot = True
            self.rank = ROOT_RANK 
            if IPAddress(dodagID).is_link_local():
                raise Exception("DODAG ID must be a routable address (not a link local address)")
            self.dodagID = dodagID
        else:
            self.rank = INFINITE_RANK

        # import objective function related function
        self.compute_rank_increase = self.of.compute_rank_increase
        self.OCP                   = of.OCP

        self.last_dio = time()

        self.setDIOtimer()

        if self.is_dodagRoot:
            self.DIOtimer.hear_inconsistent()
 def __init__(self, of=of_zero(), rplnode):
     super(NeighborCache, self).__init__()
     self.of = of
     self.__lock = RLock()
     self.rplnode = rplnode