mirror of
https://github.com/Wojtek242/route0.git
synced 2024-10-29 21:40:50 +01:00
28 lines
601 B
Python
28 lines
601 B
Python
|
from mininet.node import Switch, Node
|
||
|
|
||
|
|
||
|
class Router(Switch):
|
||
|
"""Defines a new router that is inside a network namespace so that the
|
||
|
individual routing entries don't collide.
|
||
|
|
||
|
"""
|
||
|
|
||
|
ID = 0
|
||
|
|
||
|
def __init__(self, name, **kwargs):
|
||
|
|
||
|
kwargs['inNamespace'] = True
|
||
|
Switch.__init__(self, name, **kwargs)
|
||
|
|
||
|
Router.ID += 1
|
||
|
self.switch_id = Router.ID
|
||
|
|
||
|
def start(self, controllers):
|
||
|
pass
|
||
|
|
||
|
def defaultIntf(self):
|
||
|
if hasattr(self, "controlIntf") and self.controlIntf:
|
||
|
return self.controlIntf
|
||
|
|
||
|
return Node.defaultIntf(self)
|