Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import copy
from common.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID
from context.proto.context_pb2 import (
ConfigActionEnum, DeviceDriverEnum, DeviceOperationalStatusEnum, ServiceStatusEnum, ServiceTypeEnum)
# Some example objects to be used by the tests
## use "copy.deepcopy" to prevent propagating forced changes during tests
CONTEXT_ID = {'context_uuid': {'uuid': DEFAULT_CONTEXT_UUID}}
CONTEXT = {'context_id': copy.deepcopy(CONTEXT_ID)}
TOPOLOGY_ID = {
'context_id': copy.deepcopy(CONTEXT_ID),
'topology_uuid': {'uuid': DEFAULT_TOPOLOGY_UUID},
}
TOPOLOGY = {
'topology_id': copy.deepcopy(TOPOLOGY_ID),
'device_ids': [],
'link_ids': [],
}
DEVICE1_UUID = 'DEV1'
DEVICE1_ID = {'device_uuid': {'uuid': DEVICE1_UUID}}
DEVICE1 = {
'device_id': copy.deepcopy(DEVICE1_ID),
'device_type': 'packet-router',
'device_config': {'config_rules': [
{'action': ConfigActionEnum.CONFIGACTION_SET,
'resource_key': 'device/resource-1/value',
'resource_value': 'value1'},
{'action': ConfigActionEnum.CONFIGACTION_SET,
'resource_key': 'device/resource-2/value',
'resource_value': 'value2'},
{'action': ConfigActionEnum.CONFIGACTION_SET,
'resource_key': 'device/resource-3/value',
'resource_value': 'value3'},
]},
'device_operational_status': DeviceOperationalStatusEnum.DEVICEOPERATIONALSTATUS_ENABLED,
'device_drivers': [DeviceDriverEnum.DEVICEDRIVER_OPENCONFIG, DeviceDriverEnum.DEVICEDRIVER_P4],
'device_endpoints': [
{'endpoint_id': {
'topology_id': copy.deepcopy(TOPOLOGY_ID),
'device_id': copy.deepcopy(DEVICE1_ID),
'endpoint_uuid': {'uuid': 'EP1'},
}, 'endpoint_type': 'port-packet-100G'},
{'endpoint_id': {
'topology_id': copy.deepcopy(TOPOLOGY_ID),
'device_id': copy.deepcopy(DEVICE1_ID),
'endpoint_uuid': {'uuid': 'EP2'},
}, 'endpoint_type': 'port-packet-100G'},
{'endpoint_id': {
'topology_id': copy.deepcopy(TOPOLOGY_ID),
'device_id': copy.deepcopy(DEVICE1_ID),
'endpoint_uuid': {'uuid': 'EP3'},
}, 'endpoint_type': 'port-packet-100G'},
],
}
DEVICE2_UUID = 'DEV2'
DEVICE2_ID = {'device_uuid': {'uuid': DEVICE2_UUID}}
DEVICE2 = {
'device_id': copy.deepcopy(DEVICE2_ID),
'device_type': 'packet-router',
'device_config': {'config_rules': [
{'action': ConfigActionEnum.CONFIGACTION_SET,
'resource_key': 'device/resource-1/value',
'resource_value': 'value4'},
{'action': ConfigActionEnum.CONFIGACTION_SET,
'resource_key': 'device/resource-2/value',
'resource_value': 'value5'},
{'action': ConfigActionEnum.CONFIGACTION_SET,
'resource_key': 'device/resource-3/value',
'resource_value': 'value6'},
]},
'device_operational_status': DeviceOperationalStatusEnum.DEVICEOPERATIONALSTATUS_ENABLED,
'device_drivers': [DeviceDriverEnum.DEVICEDRIVER_OPENCONFIG, DeviceDriverEnum.DEVICEDRIVER_P4],
'device_endpoints': [
{'endpoint_id': {
'topology_id': copy.deepcopy(TOPOLOGY_ID),
'device_id': copy.deepcopy(DEVICE2_ID),
'endpoint_uuid': {'uuid': 'EP1'},
}, 'endpoint_type': 'port-packet-100G'},
{'endpoint_id': {
'topology_id': copy.deepcopy(TOPOLOGY_ID),
'device_id': copy.deepcopy(DEVICE2_ID),
'endpoint_uuid': {'uuid': 'EP2'},
}, 'endpoint_type': 'port-packet-100G'},
{'endpoint_id': {
'topology_id': copy.deepcopy(TOPOLOGY_ID),
'device_id': copy.deepcopy(DEVICE2_ID),
'endpoint_uuid': {'uuid': 'EP3'},
}, 'endpoint_type': 'port-packet-100G'},
],
}
LINK_UUID = 'DEV1/EP2 ==> DEV2/EP1'
LINK_ID = {'link_uuid': {'uuid': LINK_UUID}}
LINK = {
'link_id': copy.deepcopy(LINK_ID),
'link_endpoint_ids' : [
{'topology_id': copy.deepcopy(TOPOLOGY_ID),
'device_id': copy.deepcopy(DEVICE1_ID),
'endpoint_uuid': {'uuid' : 'EP2'}},
{'topology_id': copy.deepcopy(TOPOLOGY_ID),
'device_id': copy.deepcopy(DEVICE2_ID),
'endpoint_uuid': {'uuid' : 'EP1'}},
]
}
SERVICE_UUID = 'SVC:DEV1/EP2-DEV2/EP1'
SERVICE_ID = {
'context_id': copy.deepcopy(CONTEXT_ID),
'service_uuid': {'uuid': SERVICE_UUID},
}
SERVICE = {
'service_id': copy.deepcopy(SERVICE_ID),
'service_type': ServiceTypeEnum.SERVICETYPE_L3NM,
'service_endpoint_ids' : [
{'topology_id': copy.deepcopy(TOPOLOGY_ID),
'device_id': copy.deepcopy(DEVICE1_ID),
'endpoint_uuid': {'uuid' : 'EP2'}},
{'topology_id': copy.deepcopy(TOPOLOGY_ID),
'device_id': copy.deepcopy(DEVICE2_ID),
'endpoint_uuid': {'uuid' : 'EP1'}},
],
'service_constraints': [
{'constraint_type': 'latency_ms', 'constraint_value': '15.2'},
{'constraint_type': 'jitter_us', 'constraint_value': '1.2'},
],
'service_status': {'service_status': ServiceStatusEnum.SERVICESTATUS_ACTIVE},
'service_config': {'config_rules': [
{'action': ConfigActionEnum.CONFIGACTION_SET,
'resource_key': 'service/resource-1/value',
'resource_value': 'value7'},
{'action': ConfigActionEnum.CONFIGACTION_SET,
'resource_key': 'service/resource-2/value',
'resource_value': 'value8'},
{'action': ConfigActionEnum.CONFIGACTION_SET,
'resource_key': 'service/resource-3/value',
'resource_value': 'value9'},
]},
}