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