You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow Lumen maintenance multiple windows to be parsed (#216)
* Add multiple window checks for Lumen
* NRE-605 fix comments
* Add unit tests with multiple windows Lumen
* Fix linter issues from PR
* Fix another linter typo
* Fix linter pydocstyle
* readme changes for more instructions on local testing
* Added some more instructions and examples for readme
* Update test_e2e tests for Lumen
* remove date tests in e2e file for Lumen8
---------
Co-authored-by: mkekez <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -312,6 +312,28 @@ The project is following Network to Code software development guidelines and is
312
312
- The `Provider` also supports the definition of a `_include_filter` and a `_exclude_filter` to limit the notifications that are actually processed, avoiding false positive errors for notification that are not relevant.
313
313
4. Update the `unit/test_e2e.py` with the new provider, providing some data to test and validate the final `Maintenances` created.
314
314
5.**Expose the new `Provider` class** updating the map `SUPPORTED_PROVIDERS` in `circuit_maintenance_parser/__init__.py` to officially expose the `Provider`.
315
+
6. You can run some tests here to verify that your new unit tests do not cause issues with existing tests, and in general they work as expected. You can do this by running `pytest --log-cli-level=DEBUG --capture=tee-sys`. You can narrow down the tests that you want to execute with the `-k` flag. If successful, your results should look similar to the following:
====================================================== 99 passed, 174 deselected, 17 warnings in 10.35s ======================================================
321
+
```
322
+
7. Run some final CI tests locally to ensure that there is no linting/formatting issues with your changes. You should look to get a code score of 10/10. See the example below: `invoke tests --local`
Copy file name to clipboardExpand all lines: circuit_maintenance_parser/parsers/lumen.py
+21-4Lines changed: 21 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
importlogging
3
3
fromtypingimportDict
4
4
5
+
fromcopyimportdeepcopy
5
6
fromdateutilimportparser
6
7
importbs4# type: ignore
7
8
frombs4.elementimportResultSet# type: ignore
@@ -19,10 +20,22 @@ class HtmlParserLumen1(Html):
19
20
20
21
defparse_html(self, soup):
21
22
"""Execute parsing."""
23
+
maintenances= []
22
24
data= {}
23
25
self.parse_spans(soup.find_all("span"), data)
24
26
self.parse_tables(soup.find_all("table"), data)
25
-
return [data]
27
+
28
+
# Iterates over multiple windows and duplicates other maintenance info to a new dictionary while also updating start and end times for the specific window.
29
+
forwindowindata["windows"]:
30
+
maintenance=deepcopy(data)
31
+
maintenance["start"], maintenance["end"] =window
32
+
delmaintenance["windows"]
33
+
maintenances.append(maintenance)
34
+
35
+
# Deleting the key after we are finished checking for multiple windows and duplicating data.
"summary": "Lumen intends to carry out internal maintenance within its network. This has been designated as ESSENTIAL. The nature of this work is to repair fiber and is required in order to avoid unplanned outages from damages related to natural causes."
20
+
},
21
+
{
22
+
"account": "Customer",
23
+
"circuits": [
24
+
{
25
+
"circuit_id": "123456789",
26
+
"impact": "OUTAGE"
27
+
},
28
+
{
29
+
"circuit_id": "123456789",
30
+
"impact": "OUTAGE"
31
+
}
32
+
],
33
+
"end": 1679565600,
34
+
"maintenance_id": "12345678",
35
+
"stamp": 1678379003,
36
+
"start": 1679544000,
37
+
"status": "IN-PROCESS",
38
+
"summary": "Lumen intends to carry out internal maintenance within its network. This has been designated as ESSENTIAL. The nature of this work is to repair fiber and is required in order to avoid unplanned outages from damages related to natural causes."
0 commit comments