Skip to content

Commit

Permalink
Merge pull request #278 from jmaslak/bugfix/crown-castle-increase-des…
Browse files Browse the repository at this point in the history
…cription-robustness

Increase robustness of Crown Castle parsing
  • Loading branch information
chadell authored Mar 21, 2024
2 parents 7162407 + 4b0f8d7 commit 8fe88f6
Show file tree
Hide file tree
Showing 4 changed files with 280 additions and 5 deletions.
7 changes: 2 additions & 5 deletions circuit_maintenance_parser/parsers/crowncastle.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,8 @@ def parse_strong(self, soup, data):
for strong in soup.find_all("strong"):
if strong.string.strip() == "Ticket Number:":
data["maintenance_id"] = strong.next_sibling.strip()
if strong.string.strip() == "Description:":
summary = strong.parent.next_sibling.next_sibling.contents[0].string.strip()
summary = re.sub(r"[\n\r]", "", summary)
data["summary"] = summary
if strong.string.strip().startswith("Work Description:"):
val = strong.string.strip()
if val == "Description:" or val.startswith("Work Description:"):
for sibling in strong.parent.next_siblings:
summary = "".join(sibling.strings)
summary = re.sub(r"[\n\r]", "", summary)
Expand Down
257 changes: 257 additions & 0 deletions tests/unit/data/crowncastle/crowncastle9.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<style>
.timezonegrid, #circuitgrid {
font-family: Arial;
border-collapse: collapse;
font-size: 12px;
}

.timezonegrid td, .timezonegrid th, #circuitgrid td, #circuitgrid th {
border: 1px solid #ddd;
padding: 8px;
}

.timezonegrid thead, #circuitgrid thead {
padding-top: 2px;
padding-bottom: 2px;
border: 1px solid #ddd;
text-align: left;
}

body {
font-family: Arial;
border-collapse: collapse;
font-size: 12px;
}
</style>
</head>
<body>
<div>
<table style="width: 90%; border:none; border-spacing:0; padding:0;">
<tbody>
<tr>
<td valign="top">
<p align="center"><b><u><span><img src="https://tempgo.crowncastle.com/rs/343-LQR-650/images/image01_CCLogo2.png" height="65" width="246"></span></u></b></p>
</td>
</tr>
<tr>
<td valign="top">
<p align="center">&nbsp;</p>
</td>
</tr>
<tr>
<td valign="top">
<p align="center"><b><span style="color:#5A6771;font-size:24px"><u>Maintenance Notification</u></span></b></p>
</td>
</tr>
<tr>
<td>
<p></p>
</td>
</tr>
<tr>
<td>
<p></p>
</td>
</tr>
<tr>
<td valign="top">
<p>&nbsp;</p>
<p>&nbsp;</p>
<p></p>
<p></p>
<p>Dear Example Customer, <br>
<br>
This notice is being sent to notify you of the following planned maintenance event on the Crown Castle Fiber network.
<br>
<br>
</p>
<p><strong>Ticket Number: </strong>CM20231201000</p>
<p><strong>Location of Work: </strong>Northern VA</p>
<p></p>
<p>
<table class="timezonegrid">
<tbody>
<tr>
<th colspan="2">Scheduled Start Date &amp; Time </th>
<th colspan="2">Scheduled End Date &amp; Time </th>
<th>Time Zone </th>
</tr>
<tr>
<td>1/25/2024 </td>
<td>1:00 AM </td>
<td>1/29/2024 </td>
<td>7:00 AM </td>
<td>Eastern </td>
</tr>
<tr>
<td>1/25/2024 </td>
<td>12:00 AM </td>
<td>1/29/2024 </td>
<td>6:00 AM </td>
<td>Central </td>
</tr>
<tr>
<td>1/24/2024 </td>
<td>11:00 PM </td>
<td>1/29/2024 </td>
<td>5:00 AM </td>
<td>Mountain </td>
</tr>
<tr>
<td>1/24/2024 </td>
<td>10:00 PM </td>
<td>1/29/2024 </td>
<td>4:00 AM </td>
<td>Pacific </td>
</tr>
<tr>
<td>1/25/2024 </td>
<td>5:00 AM </td>
<td>1/29/2024 </td>
<td>11:00 AM </td>
<td>GMT </td>
</tr>
</tbody>
</table>
</p>
<p><strong>Expected Customer Impact:</strong> Potential Service Affecting</p>
<p><strong>Expected Impact Duration:</strong> None Expected</p>
<p><strong>Days Recurring:</strong> 5</p>
<p><strong>Work</strong> <strong>Description:</strong></p>
<p></p>
<p style="margin-top:5pt;margin-bottom:5pt;font-family:Calibri;font-size:11.5pt;">
Crown Castle Fiber partner carrier will be conducting a required maintenance at the above-listed location for a splice case audit. No impact to your circuit(s) listed below is expected. The work will not occur during business hours.</p>
<p style="margin-top:5pt;margin-bottom:5pt;font-family:Calibri;font-size:11.5pt;">
30.0000, -75.0000 <br>
SE corner of Main &amp; 1st Ave</p>
<div style="direction:ltr;">
<table border="1" cellpadding="0" cellspacing="0" valign="top" style="border:1pt solid #A3A3A3;direction:ltr;
border-collapse:collapse;">
<tbody>
<tr>
<td style="border:1pt solid #A3A3A3;
vertical-align:top;width:.7513in;padding:4pt 4pt 4pt 4pt;">
<p style="margin-top:5pt;margin-bottom:5pt;font-family:Calibri;font-size:
11.5pt;">
3/25/24</p>
</td>
<td style="border:1pt solid #A3A3A3;
vertical-align:top;width:1.8298in;padding:4pt 4pt 4pt 4pt;">
<p style="margin:0in;font-family:Calibri;font-size:11.5pt;">01:00 am to 07:00 am EST</p>
</td>
</tr>
<tr>
<td style="border:1pt solid #A3A3A3;
vertical-align:top;width:.7513in;padding:4pt 4pt 4pt 4pt;">
<p style="margin:0in;font-family:Calibri;font-size:11.5pt;">3/26/24</p>
</td>
<td style="border:1pt solid #A3A3A3;
vertical-align:top;width:1.8298in;padding:4pt 4pt 4pt 4pt;">
<p style="margin:0in;font-family:Calibri;font-size:11.5pt;">01:00 am to 07:00 am EST</p>
</td>
</tr>
<tr>
<td style="border:1pt solid #A3A3A3;
vertical-align:top;width:.7513in;padding:4pt 4pt 4pt 4pt;">
<p style="margin:0in;font-family:Calibri;font-size:11.5pt;">3/27/24</p>
</td>
<td style="border:1pt solid #A3A3A3;
vertical-align:top;width:1.8298in;padding:4pt 4pt 4pt 4pt;">
<p style="margin:0in;font-family:Calibri;font-size:11.5pt;">01:00 am to 07:00 am EST</p>
</td>
</tr>
<tr>
<td style="border:1pt solid #A3A3A3;
vertical-align:top;width:.7513in;padding:4pt 4pt 4pt 4pt;">
<p style="margin:0in;font-family:Calibri;font-size:11.5pt;">3/28/24</p>
</td>
<td style="border:1pt solid #A3A3A3;
vertical-align:top;width:1.8298in;padding:4pt 4pt 4pt 4pt;">
<p style="margin:0in;font-family:Calibri;font-size:11.5pt;">01:00 am to 07:00 am EST</p>
</td>
</tr>
<tr>
<td style="border:1pt solid #A3A3A3;
vertical-align:top;width:.7513in;padding:4pt 4pt 4pt 4pt;">
<p style="margin:0in;font-family:Calibri;font-size:11.5pt;">3/29/24</p>
</td>
<td style="border:1pt solid #A3A3A3;
vertical-align:top;width:1.8298in;padding:4pt 4pt 4pt 4pt;">
<p style="margin:0in;font-family:Calibri;font-size:11.5pt;">01:00 am to 07:00 am EST</p>
</td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p><br>
Customer Circuits: </p>
<p>
<table id="circuitgrid">
<thead>
<tr>
<th>Circuit ID</th>
<th>Active Product</th>
<th>A Location</th>
<th>Z Location</th>
<th>Impact</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td>666666-WAVE-CCF</td>
<td>Wavelength / DC to DC Connectivity - Inter Market / 10GigE</td>
<td>123 Main, Anytown, USA</td>
<td>321 Main, Anytown, USA</td>
<td>None Expected</td>
<td></td>
</tr>
</tbody>
</table>
</p>
<p></p>
<p></p>
<p></p>
<p><strong>Dark-Fiber Customers:</strong> <br>
<br>
Dark Fiber services cannot be monitored by Crown Castle, we are reliant on customer feed back for confirmation that services have restored. To ensure your services have restored, we are requesting that you provide a contact which is both familiar with the service
and would be able to promptly confirm service restoration once the CM is complete. The request for confirmation may be needed after hours, please provide both a name and contact phone number in response to this email.
<br>
<br>
If you have any questions or concerns prior to this event, please reply to this notification as soon as possible.
<br>
<br>
By responding to this notification in a timely manner, Crown Castle Fiber Change Management can attempt to resolve any potential conflicts that may arise.
<br>
<br>
If you have any questions, concerns or issues before, during or after this maintenance window, please contact our Change Management Department at 1-508-621-1888 and reference this ticket number.
<br>
<br>
If you have any service/performance related issues after this maintenance window, please contact our Network Operations Center at 1-855-93-FIBER (1-855-933-4237) and reference this ticket number.
</p>
<p></p>
<br>
Thank You,<br>
<br>
<i>Change Control<br>
Email: <a class="auto-style1" href="mailto:[email protected]"><span style="color:#0066cc;">[email protected]</span></a><br>
508-621-1888</i>
<p></p>
<p><img width="208" height="55" src="https://tempgo.crowncastle.com/rs/343-LQR-650/images/image01_CCLogo2.png"></p>
</td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p align="center"><i><span style="color:black;font-size:9.5px">Please note: every maintenance entails a certain level of risk and although Crown Castle Fiber makes every effort to provide accurate expected customer impact, conditions outside of Crown Castle
Fiber's control may cause impact to be greater than anticipated.</span></i></p>
This email may contain confidential or privileged material. Use or disclosure of it by anyone other than the recipient is unauthorized. If you are not an intended recipient, please delete this email.
</body>
</html>
16 changes: 16 additions & 0 deletions tests/unit/data/crowncastle/crowncastle9_parser_result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"account": "Example Customer",
"circuits": [
{
"circuit_id": "666666-WAVE-CCF",
"impact": "OUTAGE"
}
],
"end": 1706526000,
"maintenance_id": "CM20231201000",
"start": 1706158800,
"status": "CONFIRMED",
"summary": "Crown Castle Fiber partner carrier will be conducting a required maintenance at the above-listed location for a splice case audit. No impact to your circuit(s) listed below is expected. The work will not occur during business hours."
}
]
5 changes: 5 additions & 0 deletions tests/unit/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ def default(self, o):
Path(dir_path, "data", "crowncastle", "crowncastle8.html"),
Path(dir_path, "data", "crowncastle", "crowncastle8_parser_result.json"),
),
(
HtmlParserCrownCastle1,
Path(dir_path, "data", "crowncastle", "crowncastle9.html"),
Path(dir_path, "data", "crowncastle", "crowncastle9_parser_result.json"),
),
# Equinix
(
HtmlParserEquinix,
Expand Down

0 comments on commit 8fe88f6

Please sign in to comment.