43a71620b872b8e33df62e0a59fa0c827d15385f
[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 from network_generation.model.python.countries import Country
22
23
24 # Define AdministrativeState enum
25 class AdministrativeState(Enum):
26     LOCKED = "locked"
27     UNLOCKED = "unlocked"
28     SHUTTING_DOWN = "shutting down"
29
30
31 # Define AlarmState type
32 AlarmState = int
33
34 # Define Address type
35 AddressType = {
36     "street": str,
37     "building": str,
38     "room": str,
39     "city": str,
40     "zip": str,
41     "state": str,
42     "country": Country,
43 }
44
45
46 # Define OperationalState enum
47 class OperationalState(Enum):
48     ENABLED = "enabled"
49     DISABLED = "disabled"
50
51
52 # Define LifeCycleState enum
53 class LifeCycleState(Enum):
54     PLANNED = "planned"
55     ORDERED = "ordered"
56     INSTALLED = "installed"
57     COMMISSIONED = "commissioned"
58     TO_BE_DESTROYED = "to be destroyed"
59     DESTROYED = "destroyed"
60
61
62 # Define UsageState enum
63 class UsageState(Enum):
64     USED = "used"
65     UNUSED = "unused"
66
67
68 # Define Enumerate type
69 def Enumerate(N, Acc=None):
70     if Acc is None:
71         Acc = []
72     if len(Acc) == N:
73         return Acc[-1]
74     return Enumerate(N, Acc + [len(Acc)])
75
76
77 # Define Range type
78 def Range(F, T) -> list[int]:
79     return [i for i in range(F, T + 1)]
80
81
82 # Define Procent and Utilization types
83 Procent = Range(0, 100)
84 Utilization = Procent