1
|
|
|
""" Customized Exceptions """ |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
class ErrorBase(Exception): |
5
|
|
|
"""Exception raised for situations where the |
6
|
|
|
EVC provided is non-existent. |
7
|
|
|
|
8
|
|
|
Attributes: |
9
|
|
|
evc_id -- evc ID provided |
10
|
|
|
message -- explanation of the error |
11
|
|
|
""" |
12
|
|
|
|
13
|
|
|
def __init__(self, evc_id, message): |
14
|
|
|
self.evc_id = evc_id |
15
|
|
|
self.message = message |
16
|
|
|
super().__init__(self.message) |
17
|
|
|
|
18
|
|
|
def __str__(self): |
19
|
|
|
return f"EVC {self.evc_id} {self.message}" |
20
|
|
|
|
21
|
|
|
|
22
|
|
|
class NoProxyPortsAvailable(ErrorBase): |
23
|
|
|
"""Exception in case an UNI doesn't have a proxy port configured or operational. |
24
|
|
|
That's a warning.""" |
25
|
|
|
|
26
|
|
|
def __init__(self, evc_id, message="no proxy ports available."): |
27
|
|
|
super().__init__(evc_id, message) |
28
|
|
|
|
29
|
|
|
|
30
|
|
|
class EvcHasNoINT(ErrorBase): |
31
|
|
|
"""Exception in case the EVC doesn't have INT/telemetry enabled but it was |
32
|
|
|
treated as if. That's a warning.""" |
33
|
|
|
|
34
|
|
|
def __init__(self, evc_id, message="INT was not enabled for this EVC."): |
35
|
|
|
super().__init__(evc_id, message) |
36
|
|
|
|
37
|
|
|
|
38
|
|
|
class FlowsNotFound(ErrorBase): |
39
|
|
|
"""Exception in case the EVC's flows are not there. Used for testing and debugging. |
40
|
|
|
That's an warning. Maybe it requires some investigation.""" |
41
|
|
|
|
42
|
|
|
def __init__(self, evc_id, message="Flow not found."): |
43
|
|
|
super().__init__(evc_id, message) |
44
|
|
|
|