summaryrefslogtreecommitdiffstats
path: root/Src/PyCatcher/src/rules.py
diff options
context:
space:
mode:
Diffstat (limited to 'Src/PyCatcher/src/rules.py')
-rw-r--r--Src/PyCatcher/src/rules.py77
1 files changed, 59 insertions, 18 deletions
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