def _get_v0x04_iface(*args, **kwargs): """Create a v0x04 interface object with optional extra arguments.""" switch = Switch('dpid') switch.connection = Mock() switch.connection.protocol.version = 0x04 switch.update_lastseen() return Interface('name', 42, switch, *args, **kwargs)
def create_switch(): """Create a new switch.""" connection = MagicMock() connection.address = 'addr' connection.port = 'port' connection.protocol.version = 0x04 switch = Switch('00:00:00:00:00:00:00:01', connection) switch._enabled = True switch.update_lastseen() return switch