Skip to content

Commit 14837a0

Browse files
authored
Merge branch 'develop' into u/jvanderaa_310_ubuntu_version
2 parents ea48fe2 + 12b3e6f commit 14837a0

File tree

140 files changed

+8923
-1057
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+8923
-1057
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: "Check out repository code"
2121
uses: "actions/checkout@v3"
2222
- name: "Setup environment"
23-
uses: "networktocode/gh-action-setup-poetry-environment@v4"
23+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
2424
- name: "Linting: black"
2525
run: "poetry run invoke black"
2626
bandit:
@@ -31,7 +31,7 @@ jobs:
3131
- name: "Check out repository code"
3232
uses: "actions/checkout@v3"
3333
- name: "Setup environment"
34-
uses: "networktocode/gh-action-setup-poetry-environment@v4"
34+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
3535
- name: "Linting: bandit"
3636
run: "poetry run invoke bandit"
3737
needs:
@@ -44,7 +44,7 @@ jobs:
4444
- name: "Check out repository code"
4545
uses: "actions/checkout@v3"
4646
- name: "Setup environment"
47-
uses: "networktocode/gh-action-setup-poetry-environment@v4"
47+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
4848
- name: "Linting: pydocstyle"
4949
run: "poetry run invoke pydocstyle"
5050
needs:
@@ -57,7 +57,7 @@ jobs:
5757
- name: "Check out repository code"
5858
uses: "actions/checkout@v3"
5959
- name: "Setup environment"
60-
uses: "networktocode/gh-action-setup-poetry-environment@v4"
60+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
6161
- name: "Linting: flake8"
6262
run: "poetry run invoke flake8"
6363
needs:
@@ -70,7 +70,7 @@ jobs:
7070
- name: "Check out repository code"
7171
uses: "actions/checkout@v3"
7272
- name: "Setup environment"
73-
uses: "networktocode/gh-action-setup-poetry-environment@v4"
73+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
7474
with:
7575
poetry-install-options: "--with dev"
7676
- name: "Linting: flake8"
@@ -85,7 +85,7 @@ jobs:
8585
- name: "Check out repository code"
8686
uses: "actions/checkout@v3"
8787
- name: "Setup environment"
88-
uses: "networktocode/gh-action-setup-poetry-environment@v4"
88+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
8989
- name: "Linting: yamllint"
9090
run: "poetry run invoke yamllint"
9191
needs:
@@ -98,7 +98,7 @@ jobs:
9898
- name: "Check out repository code"
9999
uses: "actions/checkout@v3"
100100
- name: "Setup environment"
101-
uses: "networktocode/gh-action-setup-poetry-environment@v4"
101+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
102102
with:
103103
poetry-install-options: "--with dev"
104104
- name: "Linting: Pylint"
@@ -113,7 +113,11 @@ jobs:
113113
strategy:
114114
fail-fast: true
115115
matrix:
116-
python-version: ["3.8", "3.9", "3.10", "3.11"]
116+
python-version: ["3.9", "3.10", "3.11", "3.12"]
117+
pydantic: ["2.x"]
118+
include:
119+
- python-version: "3.11"
120+
pydantic: "1.x"
117121
runs-on: "ubuntu-24.04"
118122
env:
119123
INVOKE_LOCAL: "True"
@@ -122,12 +126,15 @@ jobs:
122126
- name: "Check out repository code"
123127
uses: "actions/checkout@v3"
124128
- name: "Setup environment"
125-
uses: "networktocode/gh-action-setup-poetry-environment@v4"
129+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
126130
with:
127131
python-version: "${{ matrix.python-version }}"
128132
poetry-install-options: "--with dev"
129133
- name: "Run poetry Install"
130134
run: "poetry install"
135+
- name: "Run poetry Install"
136+
run: "pip install pydantic==1.10.13"
137+
if: matrix.pydantic == '1.x'
131138
- name: "Run Tests"
132139
run: "poetry run invoke pytest --local"
133140
needs:

CHANGELOG.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,94 @@
11
# Changelog
22

3+
# Changelog
4+
5+
## v2.7.0 - 2025-01-10
6+
7+
### Added
8+
9+
- [#303](https://github.com/networktocode/circuit-maintenance-parser/pull/303) - Add new parser for Apple
10+
- [#302](https://github.com/networktocode/circuit-maintenance-parser/pull/302) - Add support for Python 3.12
11+
- [#301](https://github.com/networktocode/circuit-maintenance-parser/pull/301) - Add new parser for PCCW
12+
- [#297](https://github.com/networktocode/circuit-maintenance-parser/pull/297) - Add new parser for Tata Communications
13+
14+
### Changed
15+
16+
- [#302](https://github.com/networktocode/circuit-maintenance-parser/pull/302) - Drop support for Python 3.8
17+
- [#291](https://github.com/networktocode/circuit-maintenance-parser/pull/291) - Update Windstream Parser for new emails
18+
19+
### Dependencies
20+
21+
- [#295](https://github.com/networktocode/circuit-maintenance-parser/pull/295) - Remove pydantic dotenv extra
22+
23+
## v2.6.1 - 2024-06-04
24+
25+
### Fixed
26+
27+
- [#288](https://github.com/networktocode/circuit-maintenance-parser/pull/288) - Fixed exceptions under Pydantic 1.x.
28+
29+
### Dependencies
30+
31+
- [#286](https://github.com/networktocode/circuit-maintenance-parser/pull/286) - Added support for `lxml` 5.x.
32+
33+
## v2.6.0 - 2024-04-04
34+
35+
### Added
36+
37+
- [#273](https://github.com/networktocode/circuit-maintenance-parser/pull/273) - Add iCal parsing to GTT/EXA
38+
- [#280](https://github.com/networktocode/circuit-maintenance-parser/pull/280) - Add new Windstream Parser
39+
40+
### Changed
41+
42+
- [#277](https://github.com/networktocode/circuit-maintenance-parser/pull/277) - Refactor the output validator `validate_empty_circuit`
43+
- [#281](https://github.com/networktocode/circuit-maintenance-parser/pull/281) Add the ability to support pydantic 1 and 2
44+
45+
### Fixed
46+
47+
- [#272](https://github.com/networktocode/circuit-maintenance-parser/pull/272) - Fix the logic in the output validator `validate_empty_circuit`
48+
- [#278](https://github.com/networktocode/circuit-maintenance-parser/pull/278) - Increase robustness of Crown Castle parsing
49+
50+
## v2.5.0 - 2024-03-13
51+
52+
### Added
53+
54+
- [#274](https://github.com/networktocode/circuit-maintenance-parser/pull/274) - Add Global Cloud XChange Parser
55+
56+
## v2.4.0 - 2024-02-20
57+
58+
### Added
59+
60+
- [#260](https://github.com/networktocode/circuit-maintenance-parser/pull/260) - Add Google parser
61+
- [#259](https://github.com/networktocode/circuit-maintenance-parser/pull/259) - Add Crown Castle fiber parser
62+
- [#258](https://github.com/networktocode/circuit-maintenance-parser/pull/258) - Add Netflix parser
63+
64+
### Changed
65+
66+
- [#264](https://github.com/networktocode/circuit-maintenance-parser/pull/264) - Adopt Pydantic 2.0
67+
- [#256](https://github.com/networktocode/circuit-maintenance-parser/pull/256) - Improved Equinix parser
68+
69+
### Fixed
70+
71+
- [#257](https://github.com/networktocode/circuit-maintenance-parser/pull/257) - Update incorrect file comment
72+
- [#255](https://github.com/networktocode/circuit-maintenance-parser/pull/255) -
73+
Properly process Amazon emergency maintenance notifications
74+
75+
## v2.3.0 - 2023-12-15
76+
77+
### Added
78+
79+
- [#245](https://github.com/networktocode/circuit-maintenance-parser/pull/245) [#250](https://github.com/networktocode/circuit-maintenance-parser/pull/250) [#252](https://github.com/networktocode/circuit-maintenance-parser/pull/252) - OpenAI parser by @chadell
80+
81+
- [#249](https://github.com/networktocode/circuit-maintenance-parser/pull/249) - Add Metadata to every Maintenance, addresses issue #246 by @chadell
82+
83+
### Changed
84+
85+
- [#237](https://github.com/networktocode/circuit-maintenance-parser/pull/237) - Remove Python 3.7 support by @slyngshede
86+
87+
### Fixed
88+
89+
- [#243](https://github.com/networktocode/circuit-maintenance-parser/pull/243) - Handle broken EUNetworks cancellation messages by @jmaslak
90+
- [#251](https://github.com/networktocode/circuit-maintenance-parser/pull/251) Add missing Arelion entry to SUPPORTED_PROVIDERS by @glennmatthews
91+
392
## v2.2.4 - 2023-07-12
493

594
- #230 - Swap out tzwhere for TimezoneFinder

README.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ You can leverage this library in your automation framework to process circuit ma
2424
- **provider**: identifies the provider of the service that is the subject of the maintenance notification.
2525
- **account**: identifies an account associated with the service that is the subject of the maintenance notification.
2626
- **maintenance_id**: contains text that uniquely identifies (at least within the context of a specific provider) the maintenance that is the subject of the notification.
27-
- **circuits**: list of circuits affected by the maintenance notification and their specific impact. Note that in a maintenance canceled notification, some providers omit the circuit list, so this may be blank for maintenance notifications with a status of CANCELLED.
27+
- **circuits**: list of circuits affected by the maintenance notification and their specific impact. Note that in a maintenance canceled or completed notification, some providers omit the circuit list, so this may be blank for maintenance notifications with a status of CANCELLED or COMPLETED.
2828
- **start**: timestamp that defines the starting date/time of the maintenance in GMT.
2929
- **end**: timestamp that defines the ending date/time of the maintenance in GMT.
3030
- **stamp**: timestamp that defines the update date/time of the maintenance in GMT.
@@ -60,35 +60,47 @@ By default, there is a `GenericProvider` that supports a `SimpleProcessor` using
6060

6161
- Arelion (previously Telia)
6262
- EuNetworks
63+
- EXA (formerly GTT) (\*)
6364
- NTT
6465
- PacketFabric
65-
- Telstra
66+
- PCCW
67+
- Telstra (\*)
6668

6769
#### Supported providers based on other parsers
6870

71+
- Apple
6972
- AWS
7073
- AquaComms
7174
- BSO
7275
- Cogent
7376
- Colt
77+
- Crown Castle Fiber
7478
- Equinix
75-
- EXA (formerly GTT)
79+
- EXA (formerly GTT) (\*)
7680
- HGC
81+
- Global Cloud Xchange
82+
- Google
7783
- Lumen
7884
- Megaport
7985
- Momentum
86+
- Netflix (AS2906 only)
87+
- PCCW
8088
- Seaborn
8189
- Sparkle
82-
- Telstra
90+
- Tata
91+
- Telstra (\*)
8392
- Turkcell
8493
- Verizon
94+
- Windstream
8595
- Zayo
8696

97+
(\*) Providers in both lists, with BCOP standard and nonstandard parsers.
98+
8799
> Note: Because these providers do not support the BCOP standard natively, maybe there are some gaps on the implemented parser that will be refined with new test cases. We encourage you to report related **issues**!
88100
89101
#### LLM-powered Parsers
90102

91-
The library supports an optional parser option leveraging Large Language Model (LLM) to provide best-effort parsing when the specific parsers have not been successful.
103+
The library supports an optional parser option leveraging Large Language Models (LLM) to provide best-effort parsing when the specific parsers have not been successful.
92104

93105
> Warning: Some of these integrations, such as OpenAI, require of extras installations parameters. Check the [extras section](#extras)
94106
@@ -98,9 +110,12 @@ When the appropriate environment variable(s) are set (see below), these LLM pars
98110
99111
These are the currently supported LLM integrations:
100112

113+
- `PARSER_LLM_QUESTION_STR` (Optional), question to overwrite the default one. Change it carefully. It has precedence over `PARSER_LLM_QUESTION_FILEPATH`
114+
- `PARSER_LLM_QUESTION_FILEPATH` (Optional), a path to a file that contains a question to overwrite the default one.
115+
101116
- [OpenAI](https://openai.com/product), these are the supported ENVs:
102-
- `OPENAI_API_KEY` (Required): OpenAI API Key.
103-
- `OPENAI_MODEL` (Optional): The LLM model to use, defaults to "gpt-3.5-turbo".
117+
- `PARSER_OPENAI_API_KEY` (Required): OpenAI API Key.
118+
- `PARSER_OPENAI_MODEL` (Optional): The LLM model to use, defaults to "gpt-3.5-turbo".
104119

105120
### Metadata
106121

circuit_maintenance_parser/__init__.py

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,75 @@
11
"""Circuit-maintenance-parser init."""
2-
from typing import Type, Optional
2+
3+
from typing import Optional, Type
34

45
from .data import NotificationData
5-
from .output import Maintenance
66
from .errors import NonexistentProviderError, ProviderError
7+
from .output import Maintenance
78
from .provider import (
8-
GenericProvider,
9-
AquaComms,
10-
Arelion,
119
AWS,
1210
BSO,
11+
GTT,
12+
HGC,
13+
NTT,
14+
AquaComms,
15+
Apple,
16+
Arelion,
1317
Cogent,
1418
Colt,
19+
CrownCastle,
1520
Equinix,
1621
EUNetworks,
17-
GTT,
18-
HGC,
22+
GenericProvider,
23+
GlobalCloudXchange,
24+
Google,
1925
Lumen,
2026
Megaport,
2127
Momentum,
22-
NTT,
28+
Netflix,
2329
PacketFabric,
30+
PCCW,
2431
Seaborn,
2532
Sparkle,
33+
Tata,
2634
Telia,
2735
Telstra,
2836
Turkcell,
2937
Verizon,
38+
Windstream,
3039
Zayo,
3140
)
3241

3342
SUPPORTED_PROVIDERS = (
3443
GenericProvider,
44+
Apple,
3545
AquaComms,
3646
Arelion,
3747
AWS,
3848
BSO,
3949
Cogent,
4050
Colt,
51+
CrownCastle,
4152
Equinix,
4253
EUNetworks,
54+
GlobalCloudXchange,
55+
Google,
4356
GTT,
4457
HGC,
4558
Lumen,
4659
Megaport,
4760
Momentum,
61+
Netflix,
4862
NTT,
4963
PacketFabric,
64+
PCCW,
5065
Seaborn,
5166
Sparkle,
67+
Tata,
5268
Telia,
5369
Telstra,
5470
Turkcell,
5571
Verizon,
72+
Windstream,
5673
Zayo,
5774
)
5875

@@ -80,7 +97,6 @@ def get_provider_class(provider_name: str) -> Type[GenericProvider]:
8097
if provider_parser.get_provider_type() == provider_name:
8198
break
8299
else:
83-
84100
raise NonexistentProviderError(
85101
f"{provider_name} is not a currently supported provider. Only {', '.join(SUPPORTED_PROVIDER_NAMES)}"
86102
)
@@ -90,7 +106,6 @@ def get_provider_class(provider_name: str) -> Type[GenericProvider]:
90106

91107
def get_provider_class_from_sender(email_sender: str) -> Type[GenericProvider]:
92108
"""Returns the notification parser class for an email sender address."""
93-
94109
for provider_parser in SUPPORTED_PROVIDERS:
95110
if provider_parser.get_default_organizer() == email_sender:
96111
break

circuit_maintenance_parser/data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import List, NamedTuple, Optional, Type, Set
44

55
import email
6-
from pydantic import BaseModel, Extra
6+
from pydantic import BaseModel
77
from circuit_maintenance_parser.constants import EMAIL_HEADER_SUBJECT, EMAIL_HEADER_DATE
88

99

@@ -18,7 +18,7 @@ class DataPart(NamedTuple):
1818
content: bytes
1919

2020

21-
class NotificationData(BaseModel, extra=Extra.forbid):
21+
class NotificationData(BaseModel, extra="forbid"):
2222
"""Base class for Notification Data types."""
2323

2424
data_parts: List[DataPart] = []

0 commit comments

Comments
 (0)