Пример #1
0
 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
Пример #2
0
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)
Пример #3
0
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)
Пример #4
0
 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
Пример #5
0
 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
Пример #6
0
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
Пример #7
0
 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)