Skip to content

Commit 69c4415

Browse files
Support additional possible statuses for Telstra notifications (#110)
1 parent 9d1c6b7 commit 69c4415

File tree

11 files changed

+960
-2
lines changed

11 files changed

+960
-2
lines changed

circuit_maintenance_parser/parsers/telstra.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,16 @@ def parse_tables(self, tables: ResultSet, data: Dict):
2727
for table in tables:
2828
for td_element in table.find_all("td"):
2929
# TODO: We should find a more consistent way to parse the status of a maintenance note
30-
if "Planned Maintenance has been scheduled" in td_element.text:
30+
if "maintenance has been scheduled" in td_element.text.lower():
3131
data["status"] = Status("CONFIRMED")
32-
elif "This is a reminder notification to notify that a planned maintenance" in td_element.text:
32+
elif "this is a reminder notification to notify that a planned maintenance" in td_element.text.lower():
3333
data["status"] = Status("CONFIRMED")
34+
elif "has been completed" in td_element.text.lower():
35+
data["status"] = Status("COMPLETED")
36+
elif "has been amended" in td_element.text.lower():
37+
data["status"] = Status("RE-SCHEDULED")
38+
elif "has been withdrawn" in td_element.text.lower():
39+
data["status"] = Status("CANCELLED")
3440
else:
3541
continue
3642
break
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DUTF-8">
5+
<title>Maintenance - Telstra</title>
6+
<style type=3D"text/css">
7+
outlook a {
8+
padding: 0;
9+
}
10+
body {
11+
background: #FFF;
12+
width: 100% !important;
13+
-webkit-text-size-adjust: 100%;
14+
-ms-text-size-adjust: 100%;
15+
margin: 0;
16+
padding: 0;
17+
font-family: Arial, Helvetica, sans-serif;
18+
}
19+
p { margin-top: 0.7em; margin-bottom: 0.7em; }
20+
ul { margin: 0; padding: 0 0 0 15px; list-style-type: disc; }
21+
li { padding: 0px; margin: 0 0 0.4em; }
22+
a { color: #B32034; text-decoration: none; }
23+
img { border: 0; }
24+
hr { clear: both; background-color: #CCC; border: none; color: #CCC; height=
25+
: 1px; margin: 1em 0; }
26+
</style>
27+
</head>
28+
29+
<body style=3D"background: #FFF;width: 100% !important;-webkit-text-size-ad=
30+
just: 100%;-ms-text-size-adjust: 100%;margin: 0;padding: 0;font-family: Ari=
31+
al, Helvetica, sans-serif">
32+
<table cellpadding=3D"0" cellspacing=3D"0" border=3D"0" width=3D"600" align=
33+
=3D"center" style=3D"margin: 0 auto;padding: 0;width: 600px !important;line=
34+
-height: 100% !important;background: #FFF">
35+
<tr>
36+
<td>
37+
<table width=3D"600" border=3D"0" cellpadding=3D"15" cellspacing=3D"0=
38+
" style=3D"background: #EEE">
39+
<tr>
40+
<td><table cellpadding=3D"0" cellspacing=3D"0" border=3D"0" align=
41+
=3D"center" width=3D"570" style=3D"background: #FFF;width: 570px;margin: 0 =
42+
auto">
43+
<td valign=3D"top"><img src=3D"https://www.telstraglobal.com/upload_fil=
44+
es/banner_notification_OM.png" alt=3D"Telstra" width=3D"570" height=3D"180"=
45+
border=3D"0" style=3D"border: 0; display: block;"/></td>
46+
<tr><td>
47+
<table width=3D510 border=3D0 bordercolor=3Dred cellspacing=3D"5" =
48+
align=3D"center">
49+
<tr style=3D"font-family: Arial, Helvetica, sans-serif; li=
50+
ne-height: 1.1; font-size:24px; font-weight:bold;color: #B32034; ">
51+
<td style=3D'background: #FFF;' height=3D15>Emergency Mai=
52+
ntenance Notification</td>
53+
</tr>
54+
<!--by reejan-->
55+
<tr style=3D"font-family: Arial, Helvetica, sans-serif; line-heigh=
56+
t: 1.1; font-size: 16px; font-weight:bold;color: #B32034; ">
57+
<td style=3D'background: #FFF;' height=3D15>Service Impacti=
58+
ng</td>
59+
</tr>
60+
<tr style=3D"font-family: Arial, Helvetica, sans-serif; lin=
61+
e-height: 1.1; font-size: 12px; color: #B32034; ">
62+
<td style=3D'background: #FFF;' height=3D25>Emergency Mai=
63+
ntenance has been scheduled that will impact your service.</td>
64+
</tr>
65+
</table>
66+
</td></tr>
67+
</tr>
68+
<td valign=3D"top" style=3D"padding: 0 0 30px;">
69+
<table width=3D"510" border=3D"0" align=3D"center" cellpadding=3D"0" ce=
70+
llspacing=3D"0">
71+
<tr>
72+
<td width=3D"510" colspan=3D"2">
73+
<table width=3D"100%" border=3D"0" cellspacing=3D"2" =
74+
style=3D"font-family: Arial, Helvetica, sans-serif; line-height: 1.1; font-=
75+
size: 11px; color: #000000;">
76+
<br/>
77+
<tr>
78+
<th width=3D"37%" align=3D"left" valign=3D"top" s=
79+
tyle=3D" font-size: 12px; font-weight: bold;"></th>
80+
<td width=3D"63%" valign=3D"top" ></td>
81+
</tr>
82+
<tr>
83+
<th width=3D"37%" align=3D"left" valign=3D"top" s=
84+
tyle=3D" font-size: 12px; font-weight: bold;">To: </th>
85+
<td width=3D"63%" valign=3D"top" >Some Customer</td>
86+
</tr>
87+
<tr>
88+
<th align=3D"left" valign=3D"top" style=3D"f=
89+
ont-size: 12px; font-weight: bold;">Attention: </th>
90+
<td valign=3D"top" style=3D"max-width: 100px; wor=
91+
d-break: break-all;">some engineer ,some user</td>
92+
</tr>
93+
<tr><td width=3D25>&nbsp;</td></tr>
94+
<tr>
95+
<th align=3D"left" valign=3D"top" style=3D"font-s=
96+
ize: 12px; font-weight: bold;">Email :</th>
97+
<td valign=3D"top" style=3D"max-width: 100px; wor=
98+
d-break: break-all;text-decoration:none;"><font style=3D"display: none">@</=
99+
100+
</tr>
101+
<tr><td width=3D25>&nbsp;</td></tr>
102+
<tr>
103+
<th align=3D"left" valign=3D"top" style=3D"font-s=
104+
ize: 12px; font-weight: bold;">Change Reference: </th>
105+
<td valign=3D"top" >PN123456</td>
106+
</tr>
107+
<tr><td width=3D25>&nbsp;</td></tr>
108+
<tr>
109+
<th align=3D"left" valign=3D"top" style=3D"font-s=
110+
ize: 12px; font-weight: bold;">Maintenance Window: </th>
111+
<td valign=3D"top" >17-Nov-2021 13:29:00(UTC) to =
112+
17-Nov-2021 19:30:00(UTC)</td>
113+
</tr>
114+
<tr>
115+
<th align=3D"left" valign=3D"top" style=3D"font-s=
116+
ize: 12px; font-weight: bold;">Expected Impact: </th>
117+
<td valign=3D"top" >1 hour outage during the chan=
118+
ge window</td>
119+
</tr>
120+
<tr><td width=3D25>&nbsp;</td></tr>
121+
<tr colspan=3D2>
122+
<th align=3D"left" valign=3D"top" style=3D"font-s=
123+
ize: 12px; font-weight: bold;">Maintenance Details:</th>
124+
</tr>
125+
<tr><td width=3D25>&nbsp;</td></tr>
126+
<tr>
127+
<td align=3D"left" colspan=3D"2" valign=3D"top" s=
128+
tyle=3D"font-size: 12px; ">Telstra Emergency Maintenance Activity - 2345678=
129+
</td>
130+
131+
</tr>
132+
<tr><td width=3D25>&nbsp;</td></tr>
133+
<tr>
134+
<td align=3D"left" colspan=3D"2" valign=3D"top" s=
135+
tyle=3D"font-size: 12px; ">Telstra will perform an emergency maintenance ac=
136+
tivity for Optic Fibre relocation/repair work - Australia</td>
137+
138+
</tr>
139+
<tr><td width=3D25>&nbsp;</td></tr>
140+
<tr>
141+
<th align=3D"left" valign=3D"top" style=3D"font-s=
142+
ize: 12px; font-weight: bold;">Service(s) Impacted:</th>
143+
<td valign=3D"top" >SNG SYD EPL 9876543<br></td>
144+
</tr>
145+
<tr>
146+
<td width=3D25>&nbsp;</td>
147+
</tr>
148+
<tr>
149+
<td colspan=3D"2"align=3D"left" valign=3D"top" s=
150+
tyle=3D"color: #000000;font-size: 12px; "> <a href=3D"mailto:[email protected]=
151+
tra.com?subject=3DQuery- Telstra Emergency Maintenance - Service Impacting =
152+
- PN123456"
153+
style=3D"color: #FF7F50;"><u>Click here</u></a> If you have any que=
154+
stions, comments or concerns regarding this maintenance activity or telepho=
155+
ne Global 800: +800 8448 8888* or Direct: +852 3192 7420 </td>
156+
157+
</tr>
158+
<tr>
159+
<td width=3D25>&nbsp;</td>
160+
</tr>
161+
<tr>
162+
<td colspan=3D"2"align=3D"left" valign=3D"top" style=3D"color: #00=
163+
0000; font-size: 12px; "><a href=3D"https://connectapp.telstra.com/"
164+
style=3D"color: #FF7F50;"><u>Click here</u></a> for immediate infor=
165+
mation on planned maintenance or viewing your historical planned maintenanc=
166+
e tickets details via our Telstra Connect Portal using your email ID as log=
167+
in.</td>
168+
</tr>
169+
<tr>
170+
<td width=3D25>&nbsp;</td>
171+
</tr>
172+
<tr>
173+
<td colspan=3D"2"align=3D"left" valign=3D"top" s=
174+
tyle=3D"color: #000000; font-size: 12px; ">
175+
<a href=3D"mailto:[email protected]?subject=3DUpdate contact de=
176+
tails- Telstra Emergency Maintenance - Service Impacting - PN123456
177+
&body=3DHi Change Management team,%0D%0A %0D%0AI would like to updat=
178+
e my personal contact information as below:%0D%0A Email id:%0D%0A =
179+
Contact number:"
180+
style=3D"color: #FF7F50;"><u>Click here</u> </a> to email us about a=
181+
ny updates to your contact details or requesting access to Telstra Connect =
182+
Portal.
183+
</td>
184+
185+
</tr>
186+
</tr>
187+
</table>
188+
</td>
189+
</tr>
190+
</table></td>
191+
</tr>
192+
</table></td>
193+
</tr>
194+
</table>
195+
196+
</td>
197+
</tr>
198+
</table>
199+
</body>
200+
</html>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[
2+
{
3+
"account": "Some Customer",
4+
"circuits": [
5+
{
6+
"circuit_id": "SNG SYD EPL 9876543",
7+
"impact": "OUTAGE"
8+
}
9+
],
10+
"end": 1637177400,
11+
"maintenance_id": "PN123456",
12+
"start": 1637155740,
13+
"status": "CONFIRMED",
14+
"summary": "Telstra Emergency Maintenance Activity - 2345678. Telstra will perform an emergency maintenance activity for Optic Fibre relocation/repair work - Australia"
15+
}
16+
]

0 commit comments

Comments
 (0)