summaryrefslogtreecommitdiffstats
path: root/Src/PyCatcher/src
diff options
context:
space:
mode:
Diffstat (limited to 'Src/PyCatcher/src')
-rw-r--r--Src/PyCatcher/src/driverConnector.py10
-rw-r--r--Src/PyCatcher/src/evaluators.py10
-rw-r--r--Src/PyCatcher/src/pyCatcherController.py39
-rw-r--r--Src/PyCatcher/src/pyCatcherModel.py2
-rw-r--r--Src/PyCatcher/src/pyCatcherView.py15
-rw-r--r--Src/PyCatcher/src/rules.py77
-rw-r--r--Src/PyCatcher/src/settings.py12
7 files changed, 117 insertions, 48 deletions
diff --git a/Src/PyCatcher/src/driverConnector.py b/Src/PyCatcher/src/driverConnector.py
index 0b0703b..de8a0d4 100644
--- a/Src/PyCatcher/src/driverConnector.py
+++ b/Src/PyCatcher/src/driverConnector.py
@@ -123,16 +123,16 @@ class ScanThread(threading.Thread):
match = re.search(r'si2\s(.+)',line)
if match:
base_station.system_info_t2 = match.group(1).split(' ')
- #get si2bis
- line = scan_process.stdout.readline()
- match = re.search(r'si2bis\s(.+)',line)
- if match:
- base_station.system_info_t2bis = match.group(1).split(' ')
#get si2ter
line = scan_process.stdout.readline()
match = re.search(r'si2ter\s(.+)',line)
if match:
base_station.system_info_t2ter = match.group(1).split(' ')
+ #get si2bis
+ line = scan_process.stdout.readline()
+ match = re.search(r'si2bis\s(.+)',line)
+ if match:
+ base_station.system_info_t2bis = match.group(1).split(' ')
#endinfo
scan_process.stdout.readline()
diff --git a/Src/PyCatcher/src/evaluators.py b/Src/PyCatcher/src/evaluators.py
index 3170f4a..de624fa 100644
--- a/Src/PyCatcher/src/evaluators.py
+++ b/Src/PyCatcher/src/evaluators.py
@@ -4,6 +4,11 @@ class EvaluatorSelect:
CONSERVATIVE = 0
WEIGHTED = 1
BAYES = 2
+ MACHINE = 3
+
+class StationClass:
+ BASE_STATION = 0
+ CATCHER = 1
class Evaluator:
@@ -28,4 +33,7 @@ class BayesEvaluator(Evaluator):
return_type = type(int)
class WeightedEvaluator(Evaluator):
- return_type = type(int) \ No newline at end of file
+ return_type = type(int)
+
+class MachineLearningEvaluator(Evaluator):
+ return_type = type(StationClass) \ No newline at end of file
diff --git a/Src/PyCatcher/src/pyCatcherController.py b/Src/PyCatcher/src/pyCatcherController.py
index af2e0a5..9dce790 100644
--- a/Src/PyCatcher/src/pyCatcherController.py
+++ b/Src/PyCatcher/src/pyCatcherController.py
@@ -5,7 +5,7 @@ from pyCatcherModel import BaseStationInformation, BaseStationInformationList
from pyCatcherView import PyCatcherGUI
from filters import ARFCNFilter,FoundFilter,ProviderFilter
from evaluators import EvaluatorSelect, BayesEvaluator, ConservativeEvaluator, WeightedEvaluator
-from rules import ProviderRule
+from rules import ProviderRule, ARFCNMappingRule, CountryMappingRule, LACMappingRule, UniqueCellIDRule, LACIntegrityRule
import pickle
class PyCatcherController:
@@ -17,10 +17,10 @@ class PyCatcherController:
self._gui = PyCatcherGUI(self)
self._driver_connector = DriverConnector()
self._gui.log_line('GUI initialized')
-
- self.arfcn_filter = ARFCNFilter()
+
+ self.arfcn_filter = ARFCNFilter()
self.provider_filter = ProviderFilter()
- self.found_filter = FoundFilter()
+ #self.found_filter = FoundFilter()
self._filters = [self.arfcn_filter, self.provider_filter]
@@ -31,7 +31,17 @@ class PyCatcherController:
self.provider_rule = ProviderRule()
self.provider_rule.is_active = True
- self._rules = [self.provider_rule]
+ self.country_mapping_rule = CountryMappingRule()
+ self.country_mapping_rule.is_active = True
+ self.arfcn_mapping_rule = ARFCNMappingRule()
+ self.arfcn_mapping_rule.is_active = True
+ self.lac_mapping_rule = LACMappingRule()
+ self.lac_mapping_rule.is_active = True
+ self.unique_cell_id_rule = UniqueCellIDRule()
+ self.unique_cell_id_rule.is_active = True
+
+ self._rules = [self.provider_rule, self.country_mapping_rule, self.arfcn_mapping_rule, self.lac_mapping_rule,
+ self.unique_cell_id_rule]
gtk.main()
@@ -60,16 +70,13 @@ class PyCatcherController:
def _found_base_station_callback(self, base_station):
self._gui.log_line("found " + base_station.provider + ' (' + str(base_station.arfcn) + ')')
self._base_station_list.add_station(base_station)
- self._base_station_list.evaluate(self._rules, self._active_evaluator)
- self._base_station_list.refill_store(self.bs_tree_list_data)
- dotcode = self._base_station_list.get_dot_code(self._filters, self.found_filter)
- self._gui.load_dot(dotcode)
+ self.trigger_evaluation()
def trigger_redraw(self):
- dotcode = self._base_station_list.get_dot_code(self._filters,self.found_filter)
+ dotcode = self._base_station_list.get_dot_code(self._filters)#,self.found_filter)
if dotcode != 'digraph bsnetwork { }':
self._gui.load_dot(dotcode)
-
+
def _firmware_waiting_callback(self):
self._gui.log_line("firmware waiting for device")
self._gui.show_info('Switch on the phone now.', 'Firmware')
@@ -99,9 +106,11 @@ class PyCatcherController:
filehandler = open(path, 'r')
base_station_list = pickle.load(filehandler)
self._base_station_list = base_station_list
+ self.trigger_evaluation()
+ filehandler.close()
+ self._gui.log_line('Project loaded from ' + path)
+
+ def trigger_evaluation(self):
self._base_station_list.evaluate(self._rules, self._active_evaluator)
self._base_station_list.refill_store(self.bs_tree_list_data)
- dotcode = self._base_station_list.get_dot_code(self._filters, self.found_filter)
- self._gui.load_dot(dotcode)
- filehandler.close()
- self._gui.log_line('Project leaded from ' + path) \ No newline at end of file
+ self.trigger_redraw() \ No newline at end of file
diff --git a/Src/PyCatcher/src/pyCatcherModel.py b/Src/PyCatcher/src/pyCatcherModel.py
index 0d5fb91..20f4ab7 100644
--- a/Src/PyCatcher/src/pyCatcherModel.py
+++ b/Src/PyCatcher/src/pyCatcherModel.py
@@ -64,7 +64,7 @@ Evaluation: %s\n
report_rules ='------- Rule Results -----------\n'
for key in self.rules_report.keys():
- report_rules += str(key) + ': ' + str(self.rules_report[key])
+ report_rules += str(key) + ': ' + str(self.rules_report[key]) + '\n'
report_rules +='\n\n'
report_raw = '''------- Raw Information -----------
SystemInfo_2: %s
diff --git a/Src/PyCatcher/src/pyCatcherView.py b/Src/PyCatcher/src/pyCatcherView.py
index b9613f0..d20e8ca 100644
--- a/Src/PyCatcher/src/pyCatcherView.py
+++ b/Src/PyCatcher/src/pyCatcherView.py
@@ -69,15 +69,20 @@ class PyCatcherGUI:
else:
self._catcher_controller.arfcn_filter.is_active = False
- if self._builder.get_object('cb_only_scanned_bs').get_active():
- self._catcher_controller.found_filter.is_active = True
- else:
- self._catcher_controller.found_filter.is_active = False
+ #if self._builder.get_object('cb_only_scanned_bs').get_active():
+ # self._catcher_controller.found_filter.is_active = True
+ #else:
+ # self._catcher_controller.found_filter.is_active = False
self._catcher_controller.trigger_redraw()
def _update_rules(self):
- pass
+ self._catcher_controller.provider_rule.is_active = self._builder.get_object('cb_provider_known').get_active()
+ self._catcher_controller.country_mapping_rule.is_active = self._builder.get_object('cb_country_provider').get_active()
+ self._catcher_controller.arfcn_mapping_rule.is_active = self._builder.get_object('cb_arfcn_provider').get_active()
+ self._catcher_controller.lac_mapping_rule.is_active = self._builder.get_object('cb_lac_provider').get_active()
+ self._catcher_controller.unique_cell_id_rule.is_active = self._builder.get_object('cb_uniqueness').get_active()
+ self._catcher_controller.trigger_evaluation()
def _update_evaluators(self):
pass
diff --git a/Src/PyCatcher/src/rules.py b/Src/PyCatcher/src/rules.py
index 8575766..6ec7f3e 100644
--- a/Src/PyCatcher/src/rules.py
+++ b/Src/PyCatcher/src/rules.py
@@ -1,5 +1,4 @@
-import pyCatcherModel
-from settings import Provider_list, Provider_Country_list
+from settings import Provider_list, Provider_Country_list, LAC_mapping, ARFCN_mapping
class RuleResult:
OK = 'Ok'
@@ -7,7 +6,6 @@ class RuleResult:
CRITICAL = 'Critical'
class Rule:
-
is_active = False
identifier = 'Rule'
@@ -15,7 +13,6 @@ class Rule:
return RuleResult.CRITICAL
class ProviderRule (Rule):
-
identifier = 'Provider Check'
def check(self, arfcn, base_station_list):
@@ -27,23 +24,67 @@ class ProviderRule (Rule):
break
return result
-class CountryProvider (Rule):
- pass
+class CountryMappingRule (Rule):
+ identifier = 'Country Provider Mapping'
+
+ def check(self, arfcn, base_station_list):
+ result = RuleResult.OK
+ for station in base_station_list:
+ if station.arfcn == arfcn:
+ if station.provider in Provider_Country_list:
+ if station.country != Provider_Country_list[station.provider]:
+ result = RuleResult.CRITICAL
+ else:
+ result = RuleResult.CRITICAL
+ return result
+
+class ARFCNMappingRule (Rule):
+ identifier = 'ARFCN Mapping'
+
+ def check(self, arfcn, base_station_list):
+ result = RuleResult.CRITICAL
+ for station in base_station_list:
+ if station.arfcn == arfcn:
+ if station.provider in ARFCN_mapping:
+ if ARFCN_mapping[station.provider][0] < station.arfcn < ARFCN_mapping[station.provider][1]:
+ result = RuleResult.OK
+ return result
+
+class LACMappingRule (Rule):
+ identifier = 'LAC Mapping'
-class BSICIntegrity (Rule):
- pass
+ def check(self, arfcn, base_station_list):
+ result = RuleResult.CRITICAL
+ for station in base_station_list:
+ if station.arfcn == arfcn:
+ if station.provider in LAC_mapping:
+ if LAC_mapping[station.provider][0] < station.lac < LAC_mapping[station.provider][1]:
+ result = RuleResult.OK
+ return result
-class Uniqueness (Rule):
- pass
+class LACIntegrityRule (Rule):
+ identifier = 'LAC Integrity'
-class NeighbourhoodStructure (Rule):
- pass
+class UniqueCellIDRule (Rule):
+ identifier = 'Unique CellID'
+
+ def check(self, arfcn, base_station_list):
+ result = RuleResult.OK
+ cell_id = 0
+ for station in base_station_list:
+ if station.arfcn == arfcn:
+ cell_id = station.cell
+ for station in base_station_list:
+ if station.arfcn != arfcn:
+ if station.cell == cell_id:
+ result = RuleResult.CRITICAL
+ return result
-class LACIntegrity (Rule):
- pass
+class NeighbourhoodStructureRule (Rule):
+ identifier = 'Neighbourhood Structure'
-class CellIDDatabase (Rule):
- pass
+class CellIDDatabaseRule (Rule):
+ identifier = 'CellID Database'
-class MachineLearning (Rule):
- pass \ No newline at end of file
+class BDDLearningRule (Rule):
+ identifier = 'BDD Learning' \ No newline at end of file
diff --git a/Src/PyCatcher/src/settings.py b/Src/PyCatcher/src/settings.py
index 7ad42fe..048a8aa 100644
--- a/Src/PyCatcher/src/settings.py
+++ b/Src/PyCatcher/src/settings.py
@@ -22,12 +22,18 @@ Commands = {'osmocon_command' : [Osmocon_lib + '/host/osmocon/osmocon',
Provider_list = ['T-Mobile', 'O2']
Provider_Country_list = {
-'T-Mobile':'Germany',
-'O2':'France'
+ 'T-Mobile':'Germany',
+ 'O2':'France'
}
-LAC_mappings = {
+LAC_mapping = {
+ 'T-Mobile' : [21000,22000],
+ 'O2' : [0,9999]
+}
+ARFCN_mapping = {
+ 'T-Mobile' : [0,9999],
+ 'O2' : [0,9999]
}
BSIC_database = ''