Skip to content

Commit

Permalink
Merge pull request #354 from SpiNNakerManchester/transceiver_by_version
Browse files Browse the repository at this point in the history
Transceiver by version
  • Loading branch information
rowleya authored Oct 11, 2023
2 parents 27295bf + f8b00f6 commit e23c8fe
Show file tree
Hide file tree
Showing 26 changed files with 1,857 additions and 1,177 deletions.
6 changes: 2 additions & 4 deletions quick_tests/quick_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
from spinn_machine.tags import IPTag, ReverseIPTag
from spinnman.data import SpiNNManDataView
from spinnman.config_setup import unittest_setup
from spinnman.extended.extended_transceiver import (
create_transceiver_from_hostname)
from spinnman.transceiver import create_transceiver_from_hostname
from spinnman.model.enums import CPUState
from spinnman.messages.scp.enums import Signal
from spinnman.model import DiagnosticFilter
Expand Down Expand Up @@ -354,7 +353,6 @@ def print_transceiver_tests(transceiver):


with create_transceiver_from_hostname(
board_config.remotehost, board_config.board_version,
bmp_connection_data=board_config.bmp_names,
hostname=board_config.remotehost,
auto_detect_bmp=board_config.auto_detect_bmp) as _transceiver:
print_transceiver_tests(_transceiver)
32 changes: 5 additions & 27 deletions spinnman/board_test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,28 @@
import unittest
from spinn_utilities.config_holder import set_config
from spinn_utilities.ping import Ping
# from spinnman.model import BMPConnectionData

_LOCALHOST = "127.0.0.1"
# Microsoft invalid IP address. For more details see:
# https://answers.microsoft.com/en-us/windows/forum/windows_vista-networking/invalid-ip-address-169254xx/ce096728-e2b7-4d54-80cc-52a4ed342870
_NOHOST = "169.254.254.254"
_PORT = 54321
from spinnman.constants import LOCAL_HOST


class BoardTestConfiguration(object):

def __init__(self):
self.localport = None
self.remotehost = None
self.board_version = None
self.bmp_names = None
self.auto_detect_bmp = None

def set_up_local_virtual_board(self):
self.localport = _PORT
self.remotehost = _LOCALHOST
self.board_version = 5

def set_up_remote_board(self):
def set_up_remote_board(self, version=None):
if Ping.host_is_reachable("192.168.240.253"):
self.remotehost = "192.168.240.253"
self.board_version = 3
set_config("Machine", "version", 3)
self.auto_detect_bmp = False
elif Ping.host_is_reachable("spinn-4.cs.man.ac.uk"):
self.remotehost = "spinn-4.cs.man.ac.uk"
self.board_version = 5
set_config("Machine", "version", 5)
elif Ping.host_is_reachable("192.168.240.1"):
self.remotehost = "192.168.240.1"
self.board_version = 5
set_config("Machine", "version", 5)
elif version is not None:
self.remotehost = LOCAL_HOST
set_config("Machine", "version", version)
else:
raise unittest.SkipTest("None of the test boards reachable")

# it always was None but this is what to do if not
# self.bmp_names = BMPConnectionData(0, 0, self.bmp_names, [0], None)

def set_up_nonexistent_board(self):
self.localport = _PORT
self.remotehost = _NOHOST
self.board_version = None
2 changes: 2 additions & 0 deletions spinnman/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

from enum import Enum

LOCAL_HOST = "127.0.0.1"

#: the amount of time to wait in seconds between powering off and powering
# on a SpiNNaker board.
POWER_CYCLE_WAIT_TIME_IN_SECONDS = 30
Expand Down
4 changes: 2 additions & 2 deletions spinnman/data/spinnman_data_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ def set_transceiver(self, transceiver):
Sets the transceiver object.
:param Transceiver transceiver:
:raises TypeError: If the transceiver is not a Transceiver
:raises TypeError: If the transceiver is not a Transceiver subclass
"""
if not isinstance(transceiver, Transceiver):
raise TypeError("transceiver should be a Transceiver")
raise TypeError("transceiver should be a Transceiver subclass")
if self.__data._transceiver:
raise NotImplementedError(
"Over writing and existing transceiver not supported")
Expand Down
Loading

0 comments on commit e23c8fe

Please sign in to comment.