def __init__(self): super(Host, self).__init__(n_tips=1) self.tip = self.tips[0] self.mac = self.index + 1 self.framer = BitFramer(self.tip) self._status['mac'] = '{:02x}'.format(self.mac) self._status['framer'] = self.framer self._status['tip'] = self.tip
class Host(Entity): def __init__(self): super(Host, self).__init__(n_tips=1) self.tip = self.tips[0] self.mac = self.index + 1 self.framer = BitFramer(self.tip) self._status['mac'] = '{:02x}'.format(self.mac) self._status['framer'] = self.framer self._status['tip'] = self.tip def send(self, data, to): header = struct.pack('!BB', to, self.mac) self.framer.send(header + data)
def __init__(self): super(Host, self).__init__(n_tips=1) self.tip = self.tips[0] self.mac = self.index + 1 self.framer = BitFramer(self.tip) self._status["mac"] = "{:02x}".format(self.mac) self._status["framer"] = self.framer self._status["tip"] = self.tip
class Host(Entity): def __init__(self): super(Host, self).__init__(n_tips=1) self.tip = self.tips[0] self.mac = self.index + 1 self.framer = BitFramer(self.tip) self._status["mac"] = "{:02x}".format(self.mac) self._status["framer"] = self.framer self._status["tip"] = self.tip def send(self, data, to): header = struct.pack("!BB", to, self.mac) self.framer.send(header + data) def sending(self, at): return self.framer.sending def sent(self, at): return self.framer.sent
def __init__(self, n_tips=3): super(Switch, self).__init__(n_tips) self.ports = [BitFramer(tip) for tip in self.tips] self.routes = Switch.Routes(self.ports) mint.worker(self.run, priority=simulation.SWITCH_PRIORITY)