Exemple #1
0
    def time_register(self, _rpc_caller, radar_id, netid):
        """save each node's rtt"""

        if radar_id != self.radar_id:
            # drop. It isn't a reply to our current bouquet
            return

        ip = str_to_ip(_rpc_caller.ip)
        net_device = _rpc_caller.dev

        # this is the rtt
        time_elapsed = int((self.xtime.time() - self.bcast_send_time) / 2)
        # let's store it in the bcast_arrival_time table
        if ip in self.bcast_arrival_time:
            if net_device in self.bcast_arrival_time[ip]:
                self.bcast_arrival_time[ip][net_device].append(time_elapsed)
            else:
                self.bcast_arrival_time[ip][net_device] = [time_elapsed]
        else:
            self.bcast_arrival_time[ip] = {}
            self.bcast_arrival_time[ip][net_device] = [time_elapsed]
            logging.info("Radar: new IP %s detected", ip_to_str(ip))

        self.neigh.netid_table[ip] = netid
Exemple #2
0
    def time_register(self, _rpc_caller, radar_id, netid):
        """save each node's rtt"""

        if radar_id != self.radar_id:
            # drop. It isn't a reply to our current bouquet
            return

        ip = str_to_ip(_rpc_caller.ip)
        net_device = _rpc_caller.dev

        # this is the rtt
        time_elapsed = int((self.xtime.time() - self.bcast_send_time) / 2)
        # let's store it in the bcast_arrival_time table
        if ip in self.bcast_arrival_time:
            if net_device in self.bcast_arrival_time[ip]:
                self.bcast_arrival_time[ip][net_device].append(time_elapsed)
            else:
                self.bcast_arrival_time[ip][net_device] = [time_elapsed]
        else:
            self.bcast_arrival_time[ip] = {}
            self.bcast_arrival_time[ip][net_device] = [time_elapsed]
            logging.info("Radar: new IP %s detected", ip_to_str(ip))

        self.neigh.netid_table[ip] = netid
Exemple #3
0
 def testStrToIP(self):
     ''' Test conversion str --> ip '''
     self.assertEqual(inet.str_to_ip(self.ps), 16909060)
Exemple #4
0
 def testStrToIP(self):
     ''' Test conversion str --> ip '''
     self.assertEqual(inet.str_to_ip(self.ps), 16909060)
Exemple #5
0
    def _get_net_node(self, addr):
        addr = str_to_ip(addr)
        if not self.net.node_is_alive(addr):
            raise error, (ENETUNREACH, os.strerror(ENETUNREACH))

        return self.net.node_get(addr)