def testSpin2(self): if not Ping.host_is_reachable(self.spalloc): raise unittest.SkipTest(self.spalloc + " appears to be down") spallocAlgo = SpallocAllocator() try: (hostname, version, _, _, _, _, _, m_allocation_controller) = \ spallocAlgo(self.spalloc, "Integration testing ok to kill", 20, self.spin2Port) except (JobDestroyedError): self.skipTest("Skipping as getting Job failed") trans = transceiver.create_transceiver_from_hostname(hostname, 5) trans.ensure_board_is_ready() machine = trans.get_machine_details() m_allocation_controller.close() jsonAlgo = ConvertToJavaMachine() fn = "test_spinn2.json" filename = jsonAlgo(machine, str(fn)) self.json_compare(filename, "spinn2.json") trans.close()
def testSpin4(self): if not Ping.host_is_reachable(self.spin4Host): raise unittest.SkipTest(self.spin4Host + " appears to be down") trans = transceiver.create_transceiver_from_hostname(self.spin4Host, 5) trans.ensure_board_is_ready() machine = trans.get_machine_details() jsonAlgo = ConvertToJavaMachine() fn = "test_spinn4.json" filename = jsonAlgo(machine, str(fn)) self.json_compare(filename, "spinn4.json") # Create a machine with Exception chip = machine.get_chip_at(1, 1) chip._sdram._size = chip._sdram._size - 100 chip._router._n_available_multicast_entries -= 10 chip._virtual = not chip._virtual chip = machine.get_chip_at(1, 2) chip._sdram._size = chip._sdram._size - 101 fn = "test_spinn4_fiddle.json" filename = jsonAlgo(machine, str(fn)) self.json_compare(filename, "spinn4_fiddle.json") trans.close()
def testSpin2(self): if not Ping.host_is_reachable(self.spalloc): raise unittest.SkipTest(self.spalloc + " appears to be down") spallocAlgo = SpallocAllocator() try: (hostname, version, _, _, _, _, _, m_allocation_controller) = \ spallocAlgo(spalloc_server=self.spalloc, spalloc_user="******", n_chips=20, spalloc_port=self.spin2Port) except (JobDestroyedError): self.skipTest("Skipping as getting Job failed") trans = transceiver.create_transceiver_from_hostname(hostname, 5) trans.ensure_board_is_ready() machine = trans.get_machine_details() m_allocation_controller.close() jsonAlgo = WriteJsonMachine() folder = "spinn2" self._remove_old_json(folder) filename = jsonAlgo(machine, folder) self.json_compare(filename, "spinn2.json") trans.close()
def set_up_remote_board(self): self.remotehost = self._config.get("Machine", "machineName") if not Ping.host_is_reachable(self.remotehost): raise unittest.SkipTest("test board appears to be down") self.board_version = self._config.getint("Machine", "version") self.bmp_names = self._config.get("Machine", "bmp_names") if self.bmp_names == "None": self.bmp_names = None else: self.bmp_names = [ BMPConnectionData(0, 0, self.bmp_names, [0], None) ] self.auto_detect_bmp = \ self._config.getboolean("Machine", "auto_detect_bmp") self.localport = _PORT with closing(socket.socket(socket.AF_INET, socket.SOCK_DGRAM)) as s: s.connect((self.remotehost, _PORT)) self.localhost = s.getsockname()[0]
def set_up_remote_board(self): self.remotehost = self._config.get("Machine", "machineName") if not Ping.host_is_reachable(self.remotehost): raise unittest.SkipTest("test board appears to be down") self.board_version = self._config.getint("Machine", "version") self.bmp_names = self._config.get("Machine", "bmp_names") if self.bmp_names == "None": self.bmp_names = None else: self.bmp_names = [BMPConnectionData( 0, 0, self.bmp_names, [0], None)] self.auto_detect_bmp = \ self._config.getboolean("Machine", "auto_detect_bmp") self.localport = _PORT s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: s.connect((self.remotehost, _PORT)) self.localhost = s.getsockname()[0] finally: s.close()
def test_ping_down_host(): # Definitely unpingable host assert (not Ping.host_is_reachable("169.254.254.254"))
def test_localhost(): # Can't ping localhost? Network catastrophically bad! assert (Ping.host_is_reachable("localhost"))
def test_google_dns(): # *REALLY* should be able to reach Google's DNS.. assert (Ping.host_is_reachable("8.8.8.8"))
def test_spalloc(): # Should be able to reach Spalloc... assert (Ping.host_is_reachable("spinnaker.cs.man.ac.uk"))