示例#1
0
 def test__scan_failed_on_at_least_one_rack(self):
     results = make_RPCResults(
         available=['x'], failed=['v', 'w'], unavailable=['y', 'z'])
     result = get_scan_result_string_for_humans(results)
     self.assertThat(result, DocTestMatches(
         "Scanning could not be started...In addition, a scan was already "
         "in-progress on 2..."))
示例#2
0
 def test__failed_rack(self):
     results = make_RPCResults(available=['w'],
                               failed=['w'],
                               unavailable=[])
     result = get_scan_result_string_for_humans(results)
     self.assertThat(
         result,
         DocTestMatches("A scan was already in-progress on 1 rack..."))
示例#3
0
 def test__scan_not_started_on_at_least_one_rack(self):
     results = make_RPCResults(available=['x'],
                               unavailable=['y', 'z'],
                               failed=[])
     result = get_scan_result_string_for_humans(results)
     self.assertThat(
         result,
         DocTestMatches("Scanning could not be started on 2 rack..."))
示例#4
0
 def test__no_racks_available(self):
     results = make_RPCResults(available=[], failed=[])
     result = get_scan_result_string_for_humans(results)
     self.assertThat(
         result,
         DocTestMatches(
             "Unable to initiate network scanning on any rack controller..."
         ))
示例#5
0
    def scan_all_subnets(self, cidrs):
        """Scans the specified list of subnet CIDRs.

        Updates the last_scan time if a scan was initiated.

        :return: human readable string indicating scan results.
        """
        assert len(cidrs) != 0
        scan_results = scan_all_rack_networks(cidrs=cidrs)
        # Don't increment the last_scan value if we couldn't contact any
        # rack controllers to initiate the scan.
        if len(scan_results.available) > 0:
            self._update_last_scan_time()
        return get_scan_result_string_for_humans(scan_results)
示例#6
0
 def test__scan_in_progress(self):
     results = make_RPCResults(available=['x'], unavailable=[], failed=[])
     result = get_scan_result_string_for_humans(results)
     self.assertThat(result, DocTestMatches("Scanning is in-progress..."))