Reformat files according to template
[oam.git] / code / network-generator / network_generation / model / python / type_definitions.py
1 # Copyright 2023 highstreet technologies GmbH
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 #!/usr/bin/python
16
17 """
18 A collection of TypeDefinitions
19 """
20 from enum import Enum
21
22 from network_generation.model.python.countries import Country
23
24
25 # Define AdministrativeState enum
26 class AdministrativeState(Enum):
27     LOCKED = "locked"
28     UNLOCKED = "unlocked"
29     SHUTTING_DOWN = "shutting down"
30
31
32 # Define AlarmState type
33 AlarmState = int
34
35 # Define Address type
36 AddressType = {
37     "street": str,
38     "building": str,
39     "room": str,
40     "city": str,
41     "zip": str,
42     "state": str,
43     "country": Country,
44 }
45
46
47 # Define OperationalState enum
48 class OperationalState(Enum):
49     ENABLED = "enabled"
50     DISABLED = "disabled"
51
52
53 # Define LifeCycleState enum
54 class LifeCycleState(Enum):
55     PLANNED = "planned"
56     ORDERED = "ordered"
57     INSTALLED = "installed"
58     COMMISSIONED = "commissioned"
59     TO_BE_DESTROYED = "to be destroyed"
60     DESTROYED = "destroyed"
61
62
63 # Define UsageState enum
64 class UsageState(Enum):
65     USED = "used"
66     UNUSED = "unused"
67
68
69 # Define Enumerate type
70 def Enumerate(N, Acc=None):
71     if Acc is None:
72         Acc = []
73     if len(Acc) == N:
74         return Acc[-1]
75     return Enumerate(N, Acc + [len(Acc)])
76
77
78 # Define Range type
79 def Range(F, T) -> list[int]:
80     return [i for i in range(F, T + 1)]
81
82
83 # Define Procent and Utilization types
84 Procent = Range(0, 100)
85 Utilization = Procent