-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
341 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
"""Google parser.""" | ||
import logging | ||
import re | ||
from datetime import datetime | ||
|
||
from circuit_maintenance_parser.parser import Html, Impact, CircuitImpact, Status | ||
|
||
# pylint: disable=too-many-nested-blocks, too-many-branches | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class HtmlParserGoogle1(Html): | ||
"""Notifications Parser for Google notifications.""" | ||
|
||
def parse_html(self, soup): | ||
"""Execute parsing.""" | ||
data = {} | ||
data["circuits"] = [] | ||
data["status"] = Status.CONFIRMED | ||
|
||
for span in soup.find_all("span"): | ||
if span.string is None: | ||
continue | ||
if span.string.strip() == "Start Time:": | ||
dt_str = span.next_sibling.string.strip() | ||
data["start"] = self.dt2ts(datetime.strptime(dt_str, "%Y-%m-%d %H:%M:%S %z UTC")) | ||
elif span.string.strip() == "End Time:": | ||
dt_str = span.next_sibling.string.strip() | ||
data["end"] = self.dt2ts(datetime.strptime(dt_str, "%Y-%m-%d %H:%M:%S %z UTC")) | ||
elif span.string.strip() == "Peer ASN:": | ||
data["account"] = span.parent.next_sibling.string.strip() | ||
elif span.string.strip() == "Google Neighbor Address(es):": | ||
googleaddr = span.parent.next_sibling.string.strip() | ||
elif span.string.strip() == "Peer Neighbor Address(es):": | ||
cid = googleaddr + "-" + span.parent.next_sibling.string.strip() | ||
data["circuits"].append(CircuitImpact(circuit_id=cid, impact=Impact.OUTAGE)) | ||
|
||
summary = list(soup.find("div").find("div").strings)[-1].strip() | ||
match = re.search(r" - Reference (.*)$", summary) | ||
data["summary"] = summary | ||
data["maintenance_id"] = match[1] | ||
|
||
return [data] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
from circuit_maintenance_parser.parsers.crowncastle import HtmlParserCrownCastle1 | ||
from circuit_maintenance_parser.parsers.equinix import HtmlParserEquinix, SubjectParserEquinix | ||
from circuit_maintenance_parser.parsers.gtt import HtmlParserGTT1 | ||
from circuit_maintenance_parser.parsers.google import HtmlParserGoogle1 | ||
from circuit_maintenance_parser.parsers.hgc import HtmlParserHGC1, HtmlParserHGC2, SubjectParserHGC1 | ||
from circuit_maintenance_parser.parsers.lumen import HtmlParserLumen1 | ||
from circuit_maintenance_parser.parsers.megaport import HtmlParserMegaport1 | ||
|
@@ -252,6 +253,15 @@ class EUNetworks(GenericProvider): | |
_default_organizer = "[email protected]" | ||
|
||
|
||
class Google(GenericProvider): | ||
"""Google provider custom class.""" | ||
|
||
_processors: List[GenericProcessor] = [ | ||
CombinedProcessor(data_parsers=[EmailDateParser, HtmlParserGoogle1]), | ||
] | ||
_default_organizer = "[email protected]" | ||
|
||
|
||
class GTT(GenericProvider): | ||
"""EXA (formerly GTT) provider custom class.""" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<div style="font-family: 'Open Sans', sans-serif;"> | ||
<div style="font-weight: bold; font-size: larger;"><span style="color: rgb(51, 105, 232);">G</span><span style="color: rgb(213, 15, 37);">o</span><span style="color: rgb(238, 178, 17);">o</span><span style="color:rgb(51, 105, 232);">g</span><span style="color: rgb(0, 153, 37);">l</span><span style="color: rgb(213, 15, 37);">e</span> Network Maintenance Notification - Reference PCR/123456</div> | ||
<hr /> | ||
|
||
<div style="font-size: smaller;"> | ||
This message was sent to: [[email protected]]<br /> | ||
This address was selected from the <a href="http://peering.google.com/">Google ISP Portal</a>. You can update your preferences by navigating to "Configuration > Contacts" and adjusting Email Subscriptions for each user. You can find additional details about Contacts <a href="https://support.google.com/interconnect/answer/7658597?hl=en&ref_topic=7650153">here</a>. | ||
</div> | ||
|
||
<br /> | ||
<br /> | ||
|
||
<span style="font-weight: bold;">Details:</span><br /> | ||
<span style="font-weight: bold;">Start Time:</span> 2023-12-05 20:55:00 +0000 UTC<br /> | ||
<span style="font-weight: bold;">End Time:</span> 2023-12-06 05:05:00 +0000 UTC<br /> | ||
<span style="font-weight: bold;">Duration:</span> 8h10m0s<br /> | ||
<table> | ||
<tr> | ||
<td><span style="font-weight: bold;">Google ASN:</span></td><td>15169</td> | ||
<td><span style="font-weight: bold;">Peer ASN:</span></td><td>65001</td> | ||
</tr> | ||
=20 | ||
<tr style="vertical-align: top;"> | ||
<td><span style="font-weight: bold;">Google Neighbor Address(es):</span></td><td>192.0.2.1</td> | ||
<td><span style="font-weight: bold;">Peer Neighbor Address(es):</span></td><td>192.0.2.0</td> | ||
</tr> | ||
=20 | ||
<tr style="vertical-align: top;"> | ||
<td><span style="font-weight: bold;">Google Neighbor Address(es):</span></td><td>2001:db8::1</td> | ||
<td><span style="font-weight: bold;">Peer Neighbor Address(es):</span></td><td>2001:db8::</td> | ||
</tr> | ||
=20 | ||
</table> | ||
|
||
<p> | ||
Google systems will automatically re-route the traffic away from the peering link(s) under maintenance. | ||
</p> | ||
<p> | ||
Depending on the nature of the work, your BGP session with Google may stay up through the maintenance window. Traffic may shift to alternate sessions with Google and/or your upstream provider(s). | ||
</p> | ||
<p> | ||
Questions about this event can be sent to [email protected]. | ||
</p> | ||
<p> | ||
Thank you for peering with <span style="color: rgb(51, 105, 232);">G</span><span style="color: rgb(213, 15, 37);">o</span><span style="color: rgb(238, 178, 17);">o</span><span style="color: rgb(51, 105, 232);">g</span><span style="color: rgb(0, 153, 37);">l</span><span style="color: rgb(213, 15, 37);">e</span>!<br /> | ||
</p> | ||
<hr /> | ||
<br /> | ||
<div style="font-size: smaller; color: silver;"> | ||
PRIVILEGE AND CONFIDENTIALITY NOTICE: The information in this | ||
e-mail communication and any attached documents may be privileged, | ||
confidential or otherwise protected from disclosure and is intended only | ||
for the use of the designated recipient(s). If the reader is neither the | ||
intended recipient nor an employee or agent thereof who is responsible | ||
for delivering it to the intended recipient, you are hereby notified | ||
that any review, dissemination, distribution, copying or other use of | ||
this communication is strictly prohibited. If you have received this | ||
communication in error, please immediately notify us by return e-mail | ||
and promptly delete the original electronic e-mail communication and | ||
any attached documentation. Receipt by anyone other than the intended | ||
recipient is not a waiver of any attorney-client or work-product | ||
privilege. | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[ | ||
{ | ||
"account": "65001", | ||
"circuits": [ | ||
{ | ||
"circuit_id": "192.0.2.1-192.0.2.0", | ||
"impact": "OUTAGE" | ||
}, | ||
{ | ||
"circuit_id": "2001:db8::1-2001:db8::", | ||
"impact": "OUTAGE" | ||
} | ||
], | ||
"end": 1701839100, | ||
"maintenance_id": "PCR/123456", | ||
"start": 1701809700, | ||
"status": "CONFIRMED", | ||
"summary": "Network Maintenance Notification - Reference PCR/123456" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
Date: Wed, 06 Dec 2023 00:40:05 +0000 | ||
Subject: [Scheduled] Google Planned Network Maintenance Notification - Reference PCR/123456 | ||
From: Google NOC <[email protected]> | ||
Content-Type: multipart/alternative; boundary="000000000000a556e4060bffffff" | ||
|
||
--000000000000a556e4060bffffff | ||
Content-Type: text/plain; charset="UTF-8"; format=flowed; delsp=yes | ||
Google Network Maintenance Notification - Reference PCR/123456 | ||
This message was sent to: [[email protected]] | ||
This address was selected from the Google ISP Portal. You can update your | ||
preferences by navigating to "Configuration > Contacts" and adjusting Email | ||
Subscriptions for each user. You can find additional details about Contacts | ||
here. | ||
Details: | ||
Start Time: 2023-12-05 20:55:00 +0000 UTC | ||
End Time: 2023-12-06 05:05:00 +0000 UTC | ||
Duration: 8h10m0s | ||
Google ASN: 15169 Peer ASN: 65001 | ||
Google Neighbor Address(es): 192.0.2.1 Peer Neighbor Address(es): | ||
192.0.2.0 | ||
Google Neighbor Address(es): 2001:db8::1 Peer Neighbor | ||
Address(es): 2001:db8:: | ||
Google systems will automatically re-route the traffic away from the | ||
peering link(s) under maintenance. | ||
Depending on the nature of the work, your BGP session with Google may stay | ||
up through the maintenance window. Traffic may shift to alternate sessions | ||
with Google and/or your upstream provider(s). | ||
Questions about this event can be sent to [email protected]. | ||
Thank you for peering with Google! | ||
PRIVILEGE AND CONFIDENTIALITY NOTICE: The information in this e-mail | ||
communication and any attached documents may be privileged, confidential or | ||
otherwise protected from disclosure and is intended only for the use of the | ||
designated recipient(s). If the reader is neither the intended recipient | ||
nor an employee or agent thereof who is responsible for delivering it to | ||
the intended recipient, you are hereby notified that any review, | ||
dissemination, distribution, copying or other use of this communication is | ||
strictly prohibited. If you have received this communication in error, | ||
please immediately notify us by return e-mail and promptly delete the | ||
original electronic e-mail communication and any attached documentation. | ||
Receipt by anyone other than the intended recipient is not a waiver of any | ||
attorney-client or work-product privilege. | ||
--000000000000a556e4060bffffff | ||
Content-Type: text/html; charset="UTF-8" | ||
Content-Transfer-Encoding: quoted-printable | ||
|
||
|
||
<div style=3D"font-family: 'Open Sans', sans-serif;"> | ||
<div style=3D"font-weight: bold; font-size: larger;"><span style=3D"color= | ||
: rgb(51, 105, 232);">G</span><span style=3D"color: rgb(213, 15, 37);">o</s= | ||
pan><span style=3D"color: rgb(238, 178, 17);">o</span><span style=3D"color:= | ||
rgb(51, 105, 232);">g</span><span style=3D"color: rgb(0, 153, 37);">l</spa= | ||
n><span style=3D"color: rgb(213, 15, 37);">e</span> Network Maintenance No= | ||
tification - Reference PCR/123456</div> | ||
<hr /> | ||
=20 | ||
<div style=3D"font-size: smaller;"> | ||
This message was sent to: [[email protected]]<br /> | ||
This address was selected from the <a href=3D"http://peering.google.com/"= | ||
>Google ISP Portal</a>. You can update your preferences by navigating to "C= | ||
onfiguration > Contacts" and adjusting Email Subscriptions for each user. Y= | ||
ou can find additional details about Contacts <a href=3D"https://support.go= | ||
ogle.com/interconnect/answer/7658597?hl=3Den&ref_topic=3D7650153">here</a>. | ||
</div> | ||
|
||
<br /> | ||
<br /> | ||
=20 | ||
<span style=3D"font-weight: bold;">Details:</span><br /> | ||
<span style=3D"font-weight: bold;">Start Time:</span> 2023-12-05 20:55:00= | ||
+0000 UTC<br /> | ||
<span style=3D"font-weight: bold;">End Time:</span> 2023-12-06 05:05:00 &= | ||
#43;0000 UTC<br /> | ||
<span style=3D"font-weight: bold;">Duration:</span> 8h10m0s<br /> | ||
<table> | ||
<tr> | ||
<td><span style=3D"font-weight: bold;">Google ASN:</span></td><td>151= | ||
69</td> | ||
<td><span style=3D"font-weight: bold;">Peer ASN:</span></td><td>65001<= | ||
/td> | ||
</tr> | ||
=20 | ||
<tr style=3D"vertical-align: top;"> | ||
<td><span style=3D"font-weight: bold;">Google Neighbor Address(es):</= | ||
span></td><td>192.0.2.1</td> | ||
<td><span style=3D"font-weight: bold;">Peer Neighbor Address(es):</sp= | ||
an></td><td>192.0.2.0</td> | ||
</tr> | ||
=20 | ||
<tr style=3D"vertical-align: top;"> | ||
<td><span style=3D"font-weight: bold;">Google Neighbor Address(es):</= | ||
span></td><td>2001:db8::1</td> | ||
<td><span style=3D"font-weight: bold;">Peer Neighbor Address(es):</sp= | ||
an></td><td>2001:db8::</td> | ||
</tr> | ||
=20 | ||
</table> | ||
|
||
<p> | ||
Google systems will automatically re-route the traffic away from the peer= | ||
ing link(s) under maintenance. | ||
</p> | ||
<p> | ||
Depending on the nature of the work, your BGP session with Google may sta= | ||
y up through the maintenance window. Traffic may shift to alternate session= | ||
s with Google and/or your upstream provider(s). | ||
</p> | ||
<p> | ||
Questions about this event can be sent to [email protected]. | ||
</p> | ||
<p> | ||
Thank you for peering with <span style=3D"color: rgb(51, 105, 232);">G</s= | ||
pan><span style=3D"color: rgb(213, 15, 37);">o</span><span style=3D"color: = | ||
rgb(238, 178, 17);">o</span><span style=3D"color: rgb(51, 105, 232);">g</sp= | ||
an><span style=3D"color: rgb(0, 153, 37);">l</span><span style=3D"color: rg= | ||
b(213, 15, 37);">e</span>!<br /> | ||
</p> | ||
<hr /> | ||
<br /> | ||
<div style=3D"font-size: smaller; color: silver;"> | ||
PRIVILEGE AND CONFIDENTIALITY NOTICE: The information in this | ||
e-mail communication and any attached documents may be privileged, | ||
confidential or otherwise protected from disclosure and is intended onl= | ||
y | ||
for the use of the designated recipient(s). If the reader is neither th= | ||
e | ||
intended recipient nor an employee or agent thereof who is responsible | ||
for delivering it to the intended recipient, you are hereby notified | ||
that any review, dissemination, distribution, copying or other use of | ||
this communication is strictly prohibited. If you have received this | ||
communication in error, please immediately notify us by return e-mail | ||
and promptly delete the original electronic e-mail communication and | ||
any attached documentation. Receipt by anyone other than the intended | ||
recipient is not a waiver of any attorney-client or work-product | ||
privilege. | ||
</div> | ||
</div> | ||
|
||
--000000000000a556e4060bffffff-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[ | ||
{ | ||
"account": "65001", | ||
"circuits": [ | ||
{ | ||
"circuit_id": "192.0.2.1-192.0.2.0", | ||
"impact": "OUTAGE" | ||
}, | ||
{ | ||
"circuit_id": "2001:db8::1-2001:db8::", | ||
"impact": "OUTAGE" | ||
} | ||
], | ||
"end": 1701839100, | ||
"maintenance_id": "PCR/123456", | ||
"organizer": "[email protected]", | ||
"provider": "google", | ||
"sequence": 1, | ||
"stamp": 1701823205, | ||
"start": 1701809700, | ||
"status": "CONFIRMED", | ||
"summary": "Network Maintenance Notification - Reference PCR/123456", | ||
"uid": "0" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.