Skip to content

Commit

Permalink
Fix baseline audit bug
Browse files Browse the repository at this point in the history
The baseline queries were referencing a technology field in the the baseline.network_baseline table, However, this field does not exist.
  • Loading branch information
erssebaggala authored Mar 4, 2019
1 parent 2a3688b commit eeed41d
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 14 deletions.
8 changes: 3 additions & 5 deletions mediation/dags/network_baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,15 @@ def compute_network_baseline():
python_callable=compute_network_baseline,
dag=dag)

def network_baseline_audit():
def run_network_baseline_audit():
nb.run_baseline_audit()


run_network_baseline_audit = PythonOperator(
network_baseline_audit = PythonOperator(
task_id='run_network_baseline_audit',
python_callable=compute_network_baseline,
python_callable=run_network_baseline_audit,
dag=dag)



ext_dep = ExternalTaskSensor(
external_dag_id='cm_load',
external_task_id='end_cm_load',
Expand Down
111 changes: 102 additions & 9 deletions mediation/packages/bts/network_baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,18 @@ def delete_counts(self):
def run_huawei_2g3g_audit(self, tech='2G'):

vendor = 'HUAWEI'
result = self.engine.execute(text("SELECT * FROM baseline.network_baseline WHERE technology = :tech AND vendor = :vendor"), tech=tech, vendor=vendor)
result = self.engine.execute(text("""
SELECT
*
FROM baseline.network_baseline t1
INNER JOIN baseline.process_config t2
ON t2.mo = t1.mo
AND t2.vendor = t1.vendor
WHERE
t1.vendor = :vendor
AND t2.tech = :tech
"""), tech=tech, vendor=vendor)

for row in result:
vendor = row[2]
nename = row[3]
Expand Down Expand Up @@ -1576,7 +1587,19 @@ def run_huawei_4g_audit(self):

tech = '4G'
vendor = 'HUAWEI'
result = self.engine.execute(text("SELECT * FROM baseline.network_baseline WHERE technology = :tech AND vendor = :vendor"), tech=tech, vendor=vendor)

result = self.engine.execute(text("""
SELECT
*
FROM baseline.network_baseline t1
INNER JOIN baseline.process_config t2
ON t2.mo = t1.mo
AND t2.vendor = t1.vendor
WHERE
t1.vendor = :vendor
AND t2.tech = :tech
"""), tech=tech, vendor=vendor)

for row in result:
vendor = row[2]
nename = row[3]
Expand Down Expand Up @@ -1668,7 +1691,19 @@ def run_ericsson_2g_audit(self):

tech = '2G'
vendor = 'ERICSSON'
result = self.engine.execute(text("SELECT * FROM baseline.network_baseline WHERE technology = :tech AND vendor = :vendor"), tech=tech, vendor=vendor)

result = self.engine.execute(text("""
SELECT
*
FROM baseline.network_baseline t1
INNER JOIN baseline.process_config t2
ON t2.mo = t1.mo
AND t2.vendor = t1.vendor
WHERE
t1.vendor = :vendor
AND t2.tech = :tech
"""), tech=tech, vendor=vendor)

for row in result:
vendor = row[2]
nename = row[3]
Expand All @@ -1683,7 +1718,6 @@ def run_ericsson_2g_audit(self):
SELECT
NEXTVAL('network_audit.seq_network_baseline_pk'),
'{0}' AS "VENDOR",
'{1}' AS "TECHNOLOGY",
'{2}' AS nename,
'{3}' AS mo,
'{4}' AS parameter,
Expand Down Expand Up @@ -1745,7 +1779,19 @@ def run_ericsson_3g_audit(self):

tech = '3G'
vendor = 'ERICSSON'
result = self.engine.execute(text("SELECT * FROM baseline.network_baseline WHERE technology = :tech AND vendor = :vendor"), tech=tech, vendor=vendor)

result = self.engine.execute(text("""
SELECT
*
FROM baseline.network_baseline t1
INNER JOIN baseline.process_config t2
ON t2.mo = t1.mo
AND t2.vendor = t1.vendor
WHERE
t1.vendor = :vendor
AND t2.tech = :tech
"""), tech=tech, vendor=vendor)

for row in result:
vendor = row[2]
nename = row[3]
Expand Down Expand Up @@ -1821,7 +1867,18 @@ def run_ericsson_4g_audit(self):

tech = '4G'
vendor = 'ERICSSON'
result = self.engine.execute(text("SELECT * FROM baseline.network_baseline WHERE technology = :tech AND vendor = :vendor"), tech=tech, vendor=vendor)
result = self.engine.execute(text("""
SELECT
*
FROM baseline.network_baseline t1
INNER JOIN baseline.process_config t2
ON t2.mo = t1.mo
AND t2.vendor = t1.vendor
WHERE
t1.vendor = :vendor
AND t2.tech = :tech
"""), tech=tech, vendor=vendor)

for row in result:
vendor = row[2]
nename = row[3]
Expand Down Expand Up @@ -1897,7 +1954,19 @@ def run_zte_2g_audit(self):

tech = '2G'
vendor = 'ZTE'
result = self.engine.execute(text("SELECT * FROM baseline.network_baseline WHERE technology = :tech AND vendor = :vendor"), tech=tech, vendor=vendor)

result = self.engine.execute(text("""
SELECT
*
FROM baseline.network_baseline t1
INNER JOIN baseline.process_config t2
ON t2.mo = t1.mo
AND t2.vendor = t1.vendor
WHERE
t1.vendor = :vendor
AND t2.tech = :tech
"""), tech=tech, vendor=vendor)

for row in result:
vendor = row[2]
nename = row[3]
Expand Down Expand Up @@ -1973,7 +2042,19 @@ def run_zte_3g_audit(self):

tech = '3G'
vendor = 'ZTE'
result = self.engine.execute(text("SELECT * FROM baseline.network_baseline WHERE technology = :tech AND vendor = :vendor"), tech=tech, vendor=vendor)

result = self.engine.execute(text("""
SELECT
*
FROM baseline.network_baseline t1
INNER JOIN baseline.process_config t2
ON t2.mo = t1.mo
AND t2.vendor = t1.vendor
WHERE
t1.vendor = :vendor
AND t2.tech = :tech
"""), tech=tech, vendor=vendor)

for row in result:
vendor = row[2]
nename = row[3]
Expand Down Expand Up @@ -2049,7 +2130,19 @@ def run_zte_4g_audit(self):

tech = '4G'
vendor = 'ZTE'
result = self.engine.execute(text("SELECT * FROM baseline.network_baseline WHERE technology = :tech AND vendor = :vendor"), tech=tech, vendor=vendor)

result = self.engine.execute(text("""
SELECT
*
FROM baseline.network_baseline t1
INNER JOIN baseline.process_config t2
ON t2.mo = t1.mo
AND t2.vendor = t1.vendor
WHERE
t1.vendor = :vendor
AND t2.tech = :tech
"""), tech=tech, vendor=vendor)

for row in result:
vendor = row[2]
nename = row[3]
Expand Down

0 comments on commit eeed41d

Please sign in to comment.