Skip to content

Commit f784429

Browse files
authored
Improve Equinix parsing (#256)
* Improve Equinix parsing * Remove unnecessary debugging print * Make pylint happy * Equinix: Looking at the text of the next sibling for impact in some cases * Handle multi-lingual Equinix messages where other language is in ASCII
1 parent 4bac2c4 commit f784429

16 files changed

Lines changed: 1408 additions & 5 deletions

circuit_maintenance_parser/parsers/equinix.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ def parse_html(self, soup: ResultSet) -> List[Dict]:
2323
"""
2424
data: Dict[str, Any] = {"circuits": []}
2525

26-
impact = self._parse_b(soup.find_all("b"), data)
26+
bolded_elems = soup.find_all(["b", "strong"])
27+
impact = self._parse_bolded(bolded_elems, data)
2728
self._parse_table(soup.find_all("th"), data, impact)
2829
return [data]
2930

@@ -43,8 +44,8 @@ def _isascii(string):
4344
except UnicodeEncodeError:
4445
return False
4546

46-
def _parse_b(self, b_elements, data):
47-
"""Parse the <b> elements from the notification to capture start and end times, description, and impact.
47+
def _parse_bolded(self, b_elements, data):
48+
"""Parse the <b> / <strong> elements from the notification to capture start and end times, description, and impact.
4849
4950
Args:
5051
b_elements (): resulting soup object with all <b> elements
@@ -63,7 +64,7 @@ def _parse_b(self, b_elements, data):
6364
raw_year_span = b_elem.text.strip().split()
6465
start_year = raw_year_span[1].split("-")[-1]
6566
end_year = raw_year_span[-1].split("-")[-1]
66-
if "UTC:" in b_elem:
67+
if start_year != 0 and "UTC:" in b_elem.text:
6768
raw_time = b_elem.next_sibling
6869
# for non english equinix notifications
6970
# english section is usually at the bottom
@@ -80,9 +81,13 @@ def _parse_b(self, b_elements, data):
8081
# all circuits in the notification share the same impact
8182
if "IMPACT:" in b_elem:
8283
impact_line = b_elem.next_sibling
84+
impact_sibling_line = (impact_line.next_sibling and impact_line.next_sibling.text) or ""
85+
8386
if "No impact to your service" in impact_line:
8487
impact = Impact.NO_IMPACT
85-
elif "There will be service interruptions" in impact_line.next_sibling.text:
88+
elif "There will be service interruptions" in impact_line:
89+
impact = Impact.OUTAGE
90+
elif "There will be service interruptions" in impact_sibling_line:
8691
impact = Impact.OUTAGE
8792
elif "Loss of redundancy" in impact_line:
8893
impact = Impact.REDUCED_REDUNDANCY
@@ -158,6 +163,8 @@ def parse_subject(self, subject: str) -> List[Dict]:
158163
data["status"] = Status.RE_SCHEDULED
159164
elif "scheduled" in subject.lower() or "reminder" in subject.lower():
160165
data["status"] = Status.CONFIRMED
166+
elif "cancelled" in subject.lower():
167+
data["status"] = Status.CANCELLED
161168
else:
162169
# Some Equinix notifications don't clearly state a status in their subject.
163170
# From inspection of examples, it looks like "Confirmed" would be the most appropriate in this case.
Lines changed: 333 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,333 @@
1+
Delivered-To: foobar@example.com
2+
Date: Tue, 19 Dec 2023 13:54:45 -0800 (PST)
3+
From: Equinix Network Maintenance <no-reply@equinix.com>
4+
Reply-To: <no-reply@equinix.com>
5+
Message-ID: <xxx@xxx.service-now.com>
6+
Subject: CANCELLED - Remedial 3rd Party Dark Fiber OTDR testing between SV2 and SV8 - SV Metro Area Network Maintenance - 19-DEC-2023 [CHG0031000]
7+
MIME-Version: 1.0
8+
Content-Type: multipart/mixed; boundary="----=_Part_123455_12375292.1234567"
9+
Precedence: bulk
10+
Auto-Submitted: auto-generated
11+
X-ServiceNow-Generated: true
12+
13+
------=_Part_123455_12375292.1234567
14+
Content-Type: multipart/alternative; boundary="----=_Part_123456_54321.1234567"
15+
16+
------=_Part_123456_54321.1234567
17+
Content-Transfer-Encoding: quoted-printable
18+
Content-Type: text/plain; charset=UTF-8
19+
20+
21+
22+
23+
24+
25+
26+
27+
=C2=A0=C2=A0=C2=A0
28+
=C2=A0Dear Equinix Customers,=C2=A0
29+
=C2=A0
30+
The notification indicating maintenance on the systems below has been cance=
31+
lled. Any follow up or new system maintenance requests will follow our stan=
32+
dard notification protocol.
33+
=C2=A0=C2=A0=C2=A0
34+
**************************************************************************=
35+
***
36+
From: Equinix Network Maintenance <no-reply@equinix.com>
37+
Sent: 2023-12-18 23:23:55
38+
Subject: Remedial 3rd Party Dark Fiber OTDR testing between SV2 and SV8 - S=
39+
V Metro Area Network Maintenance - 19-DEC-2023 [CHG0031000]
40+
=C2=A0=C2=A0=C2=A0
41+
=C2=A0Dear Equinix Customers,=C2=A0
42+
=C2=A0
43+
DATE: 19-DEC-2023 - 19-DEC-2023
44+
45+
SPAN: 19-DEC-2023 - 19-DEC-2023
46+
47+
LOCAL: TUESDAY, 19 DEC 14:00 - TUESDAY, 19 DEC 18:00
48+
UTC: TUESDAY, 19 DEC 22:00 - WEDNESDAY, 20 DEC 02:00
49+
50+
IBX(s): SV2, SV8
51+
=C2=A0
52+
DESCRIPTION: Please be advised that one of our dark fiber providers will be=
53+
performing a planned maintenance activity.
54+
55+
EXPECTED SERVICE IMPACT:=20
56+
1. Unprotected Metro Connect (MC) circuits or Metro Remote ports will exper=
57+
ience service interruption.
58+
2. Protected Metro Connect circuits will experience multiple switching hits=
59+
as traffic switches to protection path.
60+
3. One of your Dual Diverse Metro Connect circuits will experience port dow=
61+
ntime of up to 60 Minutes while Redundant circuits will not be affected.
62+
4. Equinix Fabric Metro Remote Port will experience service interruption.
63+
5. Network Edge circuits will experience service interruption.
64+
65+
EXPECTED DURATION:=20
66+
1.Up to 60 minutes for Unprotected MC
67+
2.Up to 15 minutes for one of your Dual Diverse MC
68+
3.Up to 15 minutes for Equinix Fabric Metro Remote ports
69+
4.Up to 15 minutes for Network Edge circuits=C2=A0
70+
=C2=A0
71+
PRODUCTS: Metro Connect=C2=A0
72+
=C2=A0
73+
IMPACT: Loss of redundancy to your service
74+
=C2=A0
75+
RECOMMENDED ACTION: Please be advised that one of our dark fiber providers =
76+
will be performing a planned maintenance activity.
77+
78+
EXPECTED SERVICE IMPACT:=20
79+
1. Unprotected Metro Connect (MC) circuits or Metro Remote ports will exper=
80+
ience service interruption.
81+
2. Protected Metro Connect circuits will experience multiple switching hits=
82+
as traffic switches to protection path.
83+
3. One of your Dual Diverse Metro Connect circuits will experience port dow=
84+
ntime of up to 60 Minutes while Redundant circuits will not be affected.
85+
4. Equinix Fabric Metro Remote Port will experience service interruption.
86+
5. Network Edge circuits will experience service interruption.
87+
88+
EXPECTED DURATION:=20
89+
1.Up to 60 minutes for Unprotected MC
90+
2.Up to 15 minutes for one of your Dual Diverse MC
91+
3.Up to 15 minutes for Equinix Fabric Metro Remote ports
92+
4.Up to 15 minutes for Network Edge circuits
93+
=C2=A0
94+
95+
Impacted Assets
96+
97+
Equinix Connect
98+
99+
Account #ProductIBXService Serial #
100+
555555Equinix ConnectSV82345678
101+
102+
=C2=A0
103+
We apologize for any inconvenience you may experience during this activity.=
104+
Your cooperation and understanding are=C2=A0greatly appreciated.
105+
=C2=A0
106+
Please do not reply to this email address. If you have any questions or con=
107+
cerns regarding this notification, please log a network ticket via the Equi=
108+
nix Customer Portal or contact Global Service Desk and quote the ticket ref=
109+
erence.
110+
=C2=A0
111+
Equinix is available to answer questions, provide up-to-date status informa=
112+
tion or additional details regarding the maintenance. Please reference CHG0=
113+
031000.=C2=A0
114+
=C2=A0=C2=A0=C2=A0
115+
116+
117+
118+
119+
120+
121+
122+
123+
124+
125+
126+
127+
128+
129+
Service Insight | Notification Preferences | Equinix Status Page | Support =
130+
Case=20
131+
132+
Glossary of terms | Equinix Customer Portal=20
133+
134+
135+
136+
137+
138+
139+
140+
141+
142+
143+
144+
145+
Equinix | Legal | Privacy =20
146+
=E2=80=AF =E2=80=AF =E2=80=AF =20
147+
148+
149+
150+
151+
152+
153+
------=_Part_123456_54321.1234567
154+
Content-Transfer-Encoding: quoted-printable
155+
Content-Type: text/html; charset=UTF-8
156+
157+
<html><head></head><body><table style=3D"border-collapse: collapse; margin:=
158+
auto;border:1px solid #CFCFCF" border=3D"1" width=3D"700" cellspacing=3D"0=
159+
" cellpadding=3D"0" align=3D"center"><tbody><tr><td><table border=3D"0" sty=
160+
le=3D"width: 100%;">
161+
<tbody>
162+
<tr>
163+
<td height=3D"111" style=3D"text-align: center;"><img src=3D"http://info.eq=
164+
uinix.com/rs/equinixinc/images/banner-network-maintenance.gif" alt=3D"Meet =
165+
Equinix" width=3D"700" height=3D"115" border=3D"0"></td>
166+
</tr>
167+
</tbody>
168+
</table><table style=3D"border-collapse: collapse; margin: auto;" border=3D=
169+
"0" width=3D"700" cellspacing=3D"0" cellpadding=3D"0" align=3D"center"><tbo=
170+
dy><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td width=3D"3=
171+
0">&nbsp;</td><td width=3D"642"><span style=3D"font-family: arial, helvetic=
172+
a, sans-serif; font-size: 10pt;">Dear Equinix Customers,&nbsp;</span><br><s=
173+
pan style=3D"font-family: arial, helvetica, sans-serif; font-size: 10pt;">&=
174+
nbsp;</span><br><span style=3D"font-family: arial, helvetica, sans-serif; f=
175+
ont-size: 10pt;">The notification indicating maintenance on the systems bel=
176+
ow has been cancelled. Any follow up or new system maintenance requests wil=
177+
l follow our standard notification protocol.</span></td></tr><tr style=3D"h=
178+
eight: 15.4px;"><td style=3D"height: 15.4px;">&nbsp;</td><td style=3D"heigh=
179+
t: 15.4px;">&nbsp;</td><td style=3D"height: 15.4px;">&nbsp;</td></tr></tbod=
180+
y></table><table style=3D"margin: auto; word-break: break-word; border-coll=
181+
apse: collapse; font-family: arial, helvetica, sans-serif; font-size: 10pt;=
182+
" width=3D"700" cellspacing=3D"0" cellpadding=3D"0" align=3D"center" bgcolo=
183+
r=3D"#FFFFFF"><tbody><tr><td width=3D"30">&nbsp;</td><td>******************=
184+
***********************************************************<br>From: Equini=
185+
x Network Maintenance &lt;no-reply@equinix.com&gt;<br>Sent: 2023-12-18 23:2=
186+
3:55<br>Subject: Remedial 3rd Party Dark Fiber OTDR testing between SV2 and=
187+
SV8 - SV Metro Area Network Maintenance - 19-DEC-2023 [CHG0031000]</td></t=
188+
r></tbody></table><table style=3D"border-collapse: collapse; margin: auto; =
189+
height: 327.85px;" border=3D"0" width=3D"700" cellspacing=3D"0" cellpadding=
190+
=3D"0" align=3D"center"><tbody><tr style=3D"height: 15.4px;"><td style=3D"h=
191+
eight: 15.4px; width: 29.7px;">&nbsp;</td><td style=3D"height: 15.4px; widt=
192+
h: 637.375px;">&nbsp;</td><td style=3D"height: 15.4px; width: 29.725px;">&n=
193+
bsp;</td></tr><tr style=3D"height: 297.05px;"><td style=3D"height: 297.05px=
194+
; width: 29.7px;" width=3D"30">&nbsp;</td><td style=3D"height: 297.05px; wi=
195+
dth: 637.375px;" width=3D"642"><span style=3D"font-family: arial, helvetica=
196+
, sans-serif; font-size: 10pt;">Dear Equinix Customers,&nbsp;</span><br><sp=
197+
an style=3D"font-family: arial, helvetica, sans-serif; font-size: 10pt;">&n=
198+
bsp;</span><br><span style=3D"font-family: arial, helvetica, sans-serif; fo=
199+
nt-size: 10pt;"><strong>DATE:</strong> 19-DEC-2023 - 19-DEC-2023</span><br>=
200+
<span style=3D"font-family: arial, helvetica, sans-serif; font-size: 10pt;"=
201+
><br><b>SPAN: 19-DEC-2023 - 19-DEC-2023</b><br><br><b>LOCAL: </b>TUESDAY, 1=
202+
9 DEC 14:00 - TUESDAY, 19 DEC 18:00<br><b>UTC: </b>TUESDAY, 19 DEC 22:00 - =
203+
WEDNESDAY, 20 DEC 02:00<br></span><br><span style=3D"font-family: arial, he=
204+
lvetica, sans-serif; font-size: 10pt;"><b>IBX(s): </b>SV2, SV8</span><br><s=
205+
pan style=3D"font-family: arial, helvetica, sans-serif; font-size: 10pt;">&=
206+
nbsp;</span><br><span style=3D"font-family: arial, helvetica, sans-serif; f=
207+
ont-size: 10pt;"><strong>DESCRIPTION:</strong> Please be advised that one o=
208+
f our dark fiber providers will be performing a planned maintenance activit=
209+
y.
210+
<br>
211+
<br>EXPECTED SERVICE IMPACT:=20
212+
<br>1. Unprotected Metro Connect (MC) circuits or Metro Remote ports will e=
213+
xperience service interruption.
214+
<br>2. Protected Metro Connect circuits will experience multiple switching =
215+
hits as traffic switches to protection path.
216+
<br>3. One of your Dual Diverse Metro Connect circuits will experience port=
217+
downtime of up to 60 Minutes while Redundant circuits will not be affected=
218+
.
219+
<br>4. Equinix Fabric Metro Remote Port will experience service interruptio=
220+
n.
221+
<br>5. Network Edge circuits will experience service interruption.
222+
<br>
223+
<br>EXPECTED DURATION:=20
224+
<br>1.Up to 60 minutes for Unprotected MC
225+
<br>2.Up to 15 minutes for one of your Dual Diverse MC
226+
<br>3.Up to 15 minutes for Equinix Fabric Metro Remote ports
227+
<br>4.Up to 15 minutes for Network Edge circuits&nbsp;</span><br><span sty=
228+
le=3D"font-family: arial, helvetica, sans-serif; font-size: 10pt;">&nbsp;</=
229+
span><br><span style=3D"font-family: arial, helvetica, sans-serif; font-siz=
230+
e: 10pt;"><strong>PRODUCTS:</strong> Metro Connect&nbsp;</span><br><span st=
231+
yle=3D"font-family: arial, helvetica, sans-serif; font-size: 10pt;">&nbsp;<=
232+
/span><br><span style=3D"font-family: arial, helvetica, sans-serif; font-si=
233+
ze: 10pt;"><strong>IMPACT:</strong> Loss of redundancy to your service</spa=
234+
n><br><span style=3D"font-family: arial, helvetica, sans-serif; font-size: =
235+
10pt;">&nbsp;</span><br><span style=3D"font-family: arial, helvetica, sans-=
236+
serif; font-size: 10pt;"><strong>RECOMMENDED ACTION:</strong> Please be adv=
237+
ised that one of our dark fiber providers will be performing a planned main=
238+
tenance activity.
239+
<br>
240+
<br>EXPECTED SERVICE IMPACT:=20
241+
<br>1. Unprotected Metro Connect (MC) circuits or Metro Remote ports will e=
242+
xperience service interruption.
243+
<br>2. Protected Metro Connect circuits will experience multiple switching =
244+
hits as traffic switches to protection path.
245+
<br>3. One of your Dual Diverse Metro Connect circuits will experience port=
246+
downtime of up to 60 Minutes while Redundant circuits will not be affected=
247+
.
248+
<br>4. Equinix Fabric Metro Remote Port will experience service interruptio=
249+
n.
250+
<br>5. Network Edge circuits will experience service interruption.
251+
<br>
252+
<br>EXPECTED DURATION:=20
253+
<br>1.Up to 60 minutes for Unprotected MC
254+
<br>2.Up to 15 minutes for one of your Dual Diverse MC
255+
<br>3.Up to 15 minutes for Equinix Fabric Metro Remote ports
256+
<br>4.Up to 15 minutes for Network Edge circuits</span><br><span style=3D"=
257+
font-family: arial, helvetica, sans-serif; font-size: 10pt;">&nbsp;</span><=
258+
br><span style=3D"font-family: arial, helvetica, sans-serif; font-size: 10p=
259+
t;"><br><table style=3D"border-collapse: collapse;height:40px;" border=3D"0=
260+
" cellspacing=3D"0" cellpadding=3D"0"><tbody><tr><td><span style=3D"text-de=
261+
coration: underline;"><strong>Impacted Assets</strong></span></td></tr></tb=
262+
ody></table><br><div style=3D"text-decoration:underline;"><b>Equinix Connec=
263+
t</b></div><br><table style=3D"border-collapse: collapse; width: 99%;" bord=
264+
er=3D"1"><tbody><tr><th style=3D"width: 25%;">Account #</th><th style=3D"wi=
265+
dth: 25%;">Product</th><th style=3D"width: 25%;">IBX</th><th style=3D"width=
266+
: 25%;">Service Serial #</th></tr><tr><td style=3D"text-align: center;">555=
267+
555</td><td style=3D"text-align: center;">Equinix Connect</td><td style=3D"=
268+
text-align: center;">SV8</td><td style=3D"text-align: center;">2345678</td=
269+
></tr></tbody></table></span><br><span style=3D"font-family: arial, helveti=
270+
ca, sans-serif; font-size: 10pt;">&nbsp;</span><br><span style=3D"font-fami=
271+
ly: arial, helvetica, sans-serif; font-size: 10pt;">We apologize for any in=
272+
convenience you may experience during this activity. Your cooperation and u=
273+
nderstanding are&nbsp;greatly appreciated.</span><br><span style=3D"font-fa=
274+
mily: arial, helvetica, sans-serif; font-size: 10pt;">&nbsp;</span><br><spa=
275+
n style=3D"font-family: arial, helvetica, sans-serif; font-size: 10pt;">Ple=
276+
ase do not reply to this email address. If you have any questions or concer=
277+
ns regarding this notification, please log a network ticket via the Equinix=
278+
Customer Portal or contact Global Service Desk and quote the ticket refere=
279+
nce.</span><br><span style=3D"font-family: arial, helvetica, sans-serif; fo=
280+
nt-size: 10pt;">&nbsp;</span><br><span style=3D"font-family: arial, helveti=
281+
ca, sans-serif; font-size: 10pt;">Equinix is available to answer questions,=
282+
provide up-to-date status information or additional details regarding the =
283+
maintenance. Please reference CHG0031000.</span></td><td style=3D"height: 2=
284+
97.05px; width: 29.725px;" width=3D"30">&nbsp;</td></tr><tr style=3D"height=
285+
: 15.4px;"><td style=3D"height: 15.4px; width: 29.7px;">&nbsp;</td><td styl=
286+
e=3D"height: 15.4px; width: 637.375px;">&nbsp;</td><td style=3D"height: 15.=
287+
4px; width: 29.725px;">&nbsp;</td></tr></tbody></table><table width=3D"700"=
288+
cellspacing=3D"0" cellpadding=3D"0" align=3D"center">
289+
<tbody>
290+
<tr>
291+
<td height=3D"20"><img src=3D"http://na-g.marketo.com/rs/equinixinc/images/=
292+
Event_Offering-seperator.jpg" width=3D"700" height=3D"20" style=3D"display:=
293+
block; margin-left: auto; margin-right: auto;"></td>
294+
</tr>
295+
</tbody>
296+
</table>
297+
<table width=3D"700" cellspacing=3D"0" cellpadding=3D"0" align=3D"center">
298+
<tbody>
299+
<tr>
300+
<td>
301+
<p style=3D"text-align: center;"></p>
302+
<p style=3D"text-align: center; font-family: Arial, Helvetica, sans-serif; =
303+
color: #00a3e0;"><span style=3D"font-size: 10pt; color: #707073;"><a href=
304+
=3D"https://customerportal.equinix.com/cid/" target=3D"_blank" style=3D"col=
305+
or: #00a3e0;" rel=3D"noopener">Service Insight </a>| <a href=3D"https://cus=
306+
tomerportal.equinix.com/ecp/user/notifications" target=3D"_blank" rel=3D"no=
307+
opener" style=3D"color: #00a3e0;">Notification Preferences</a> | <a href=3D=
308+
"https://status.equinix.com" target=3D"_blank" rel=3D"noopener" style=3D"co=
309+
lor: #00a3e0;">Equinix Status Page</a> | <a href=3D"https://customerportal.=
310+
equinix.com/ecp/casemanagement" target=3D"_blank" rel=3D"noopener" style=3D=
311+
"color: #00a3e0;">Support Case</a>&nbsp;</span></p>
312+
<p style=3D"text-align: center; font-family: Arial, Helvetica, sans-serif; =
313+
color: #707073;"><span style=3D"font-size: 10pt;">&nbsp;<a href=3D"https://=
314+
www.equinix.com/welcome-guide/glossary" target=3D"_blank" rel=3D"noopener" =
315+
style=3D"color: #00a3e0;">Glossary of terms</a> | <a href=3D"https://custom=
316+
erportal.equinix.com" target=3D"_blank" rel=3D"noopener" style=3D"color: #0=
317+
0a3e0;">Equinix Customer Portal</a>&nbsp;</span></p>
318+
<p style=3D"text-align: center;"></p>
319+
</td>
320+
</tr>
321+
</tbody>
322+
</table>
323+
<table width=3D"700" cellspacing=3D"0" cellpadding=3D"0" align=3D"center" s=
324+
tyle=3D"height: 22.3958px;">
325+
<tbody>
326+
<tr style=3D"height: 22.3958px;">
327+
<td width=3D"10px;" td=3D""></td>
328+
<td width=3D"10px;"></td>
329+
</tr>
330+
</tbody>
331+
</table></td></tr></tbody></table></body></html>
332+
------=_Part_123456_54321.1234567--
333+
------=_Part_123455_12375292.1234567--

0 commit comments

Comments
 (0)