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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListType
from pyangbind.lib.yangtypes import YANGDynClass
from pyangbind.lib.yangtypes import ReferenceType
from pyangbind.lib.base import PybindBase
from collections import OrderedDict
from decimal import Decimal
from bitarray import bitarray
import six
# PY3 support of some PY2 keywords (needs improved)
if six.PY3:
import builtins as __builtin__
long = int
elif six.PY2:
import __builtin__
class yc_connection_connection__connection(PybindBase):
"""
This class was auto-generated by the PythonClass plugin for PYANG
from YANG module connection - based on the path /connection. Each member element of
the container is represented as a class variable - with a specific
YANG type.
"""
__slots__ = ('_path_helper', '_extmethods', '__connection_id','__source_node','__target_node','__source_port','__target_port','__bandwidth','__layer_protocol_name',)
_yang_name = 'connection'
_yang_namespace = 'urn:connection'
_pybind_generated_by = 'container'
def __init__(self, *args, **kwargs):
self._path_helper = False
self._extmethods = False
self.__target_node = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="target-node", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='leafref', is_config=True)
self.__layer_protocol_name = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ETH': {}, u'OPTICAL': {}},), is_leaf=True, yang_name="layer-protocol-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='topology:layer-protocol-name', is_config=True)
self.__connection_id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="connection-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='urn:connection', defining_module='connection', yang_type='string', is_config=True)
self.__bandwidth = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="bandwidth", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='uint32', is_config=True)
self.__target_port = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="target-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='leafref', is_config=True)
self.__source_node = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="source-node", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='leafref', is_config=True)
self.__source_port = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='leafref', is_config=True)
load = kwargs.pop("load", None)
if args:
if len(args) > 1:
raise TypeError("cannot create a YANG container with >1 argument")
all_attr = True
for e in self._pyangbind_elements:
if not hasattr(args[0], e):
all_attr = False
break
if not all_attr:
raise ValueError("Supplied object did not have the correct attributes")
for e in self._pyangbind_elements:
nobj = getattr(args[0], e)
if nobj._changed() is False:
continue
setmethod = getattr(self, "_set_%s" % e)
if load is None:
setmethod(getattr(args[0], e))
else:
setmethod(getattr(args[0], e), load=load)
def _path(self):
if hasattr(self, "_parent"):
return self._parent._path()+[self._yang_name]
else:
return [u'connection']
def _get_connection_id(self):
"""
Getter method for connection_id, mapped from YANG variable /connection/connection_id (string)
"""
return self.__connection_id
def _set_connection_id(self, v, load=False):
"""
Setter method for connection_id, mapped from YANG variable /connection/connection_id (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_connection_id is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_connection_id() directly.
"""
parent = getattr(self, "_parent", None)
if parent is not None and load is False:
raise AttributeError("Cannot set keys directly when" +
" within an instantiated list")
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="connection-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='urn:connection', defining_module='connection', yang_type='string', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """connection_id must be of a type compatible with string""",
'defined-type': "string",
'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="connection-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='urn:connection', defining_module='connection', yang_type='string', is_config=True)""",
})
self.__connection_id = t
if hasattr(self, '_set'):
self._set()
def _unset_connection_id(self):
self.__connection_id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="connection-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='urn:connection', defining_module='connection', yang_type='string', is_config=True)
def _get_source_node(self):
"""
Getter method for source_node, mapped from YANG variable /connection/source_node (leafref)
"""
return self.__source_node
def _set_source_node(self, v, load=False):
"""
Setter method for source_node, mapped from YANG variable /connection/source_node (leafref)
If this variable is read-only (config: false) in the
source YANG file, then _set_source_node is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_source_node() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="source-node", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='leafref', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """source_node must be of a type compatible with leafref""",
'defined-type': "leafref",
'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="source-node", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='leafref', is_config=True)""",
})
self.__source_node = t
if hasattr(self, '_set'):
self._set()
def _unset_source_node(self):
self.__source_node = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="source-node", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='leafref', is_config=True)
def _get_target_node(self):
"""
Getter method for target_node, mapped from YANG variable /connection/target_node (leafref)
"""
return self.__target_node
def _set_target_node(self, v, load=False):
"""
Setter method for target_node, mapped from YANG variable /connection/target_node (leafref)
If this variable is read-only (config: false) in the
source YANG file, then _set_target_node is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_target_node() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="target-node", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='leafref', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """target_node must be of a type compatible with leafref""",
'defined-type': "leafref",
'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="target-node", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='leafref', is_config=True)""",
})
self.__target_node = t
if hasattr(self, '_set'):
self._set()
def _unset_target_node(self):
self.__target_node = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="target-node", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='leafref', is_config=True)
def _get_source_port(self):
"""
Getter method for source_port, mapped from YANG variable /connection/source_port (leafref)
"""
return self.__source_port
def _set_source_port(self, v, load=False):
"""
Setter method for source_port, mapped from YANG variable /connection/source_port (leafref)
If this variable is read-only (config: false) in the
source YANG file, then _set_source_port is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_source_port() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='leafref', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """source_port must be of a type compatible with leafref""",
'defined-type': "leafref",
'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='leafref', is_config=True)""",
})
self.__source_port = t
if hasattr(self, '_set'):
self._set()
def _unset_source_port(self):
self.__source_port = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='leafref', is_config=True)
def _get_target_port(self):
"""
Getter method for target_port, mapped from YANG variable /connection/target_port (leafref)
"""
return self.__target_port
def _set_target_port(self, v, load=False):
"""
Setter method for target_port, mapped from YANG variable /connection/target_port (leafref)
If this variable is read-only (config: false) in the
source YANG file, then _set_target_port is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_target_port() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="target-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='leafref', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """target_port must be of a type compatible with leafref""",
'defined-type': "leafref",
'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="target-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='leafref', is_config=True)""",
})
self.__target_port = t
if hasattr(self, '_set'):
self._set()
def _unset_target_port(self):
self.__target_port = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="target-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='leafref', is_config=True)
def _get_bandwidth(self):
"""
Getter method for bandwidth, mapped from YANG variable /connection/bandwidth (uint32)
"""
return self.__bandwidth
def _set_bandwidth(self, v, load=False):
"""
Setter method for bandwidth, mapped from YANG variable /connection/bandwidth (uint32)
If this variable is read-only (config: false) in the
source YANG file, then _set_bandwidth is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_bandwidth() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="bandwidth", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='uint32', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """bandwidth must be of a type compatible with uint32""",
'defined-type': "uint32",
'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="bandwidth", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='uint32', is_config=True)""",
})
self.__bandwidth = t
if hasattr(self, '_set'):
self._set()
def _unset_bandwidth(self):
self.__bandwidth = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="bandwidth", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='uint32', is_config=True)
def _get_layer_protocol_name(self):
"""
Getter method for layer_protocol_name, mapped from YANG variable /connection/layer_protocol_name (topology:layer-protocol-name)
"""
return self.__layer_protocol_name
def _set_layer_protocol_name(self, v, load=False):
"""
Setter method for layer_protocol_name, mapped from YANG variable /connection/layer_protocol_name (topology:layer-protocol-name)
If this variable is read-only (config: false) in the
source YANG file, then _set_layer_protocol_name is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_layer_protocol_name() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ETH': {}, u'OPTICAL': {}},), is_leaf=True, yang_name="layer-protocol-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='topology:layer-protocol-name', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """layer_protocol_name must be of a type compatible with topology:layer-protocol-name""",
'defined-type': "topology:layer-protocol-name",
'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ETH': {}, u'OPTICAL': {}},), is_leaf=True, yang_name="layer-protocol-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='topology:layer-protocol-name', is_config=True)""",
})
self.__layer_protocol_name = t
if hasattr(self, '_set'):
self._set()
def _unset_layer_protocol_name(self):
self.__layer_protocol_name = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={u'ETH': {}, u'OPTICAL': {}},), is_leaf=True, yang_name="layer-protocol-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:connection', defining_module='connection', yang_type='topology:layer-protocol-name', is_config=True)
connection_id = __builtin__.property(_get_connection_id, _set_connection_id)
source_node = __builtin__.property(_get_source_node, _set_source_node)
target_node = __builtin__.property(_get_target_node, _set_target_node)
source_port = __builtin__.property(_get_source_port, _set_source_port)
target_port = __builtin__.property(_get_target_port, _set_target_port)
bandwidth = __builtin__.property(_get_bandwidth, _set_bandwidth)
layer_protocol_name = __builtin__.property(_get_layer_protocol_name, _set_layer_protocol_name)
_pyangbind_elements = OrderedDict([('connection_id', connection_id), ('source_node', source_node), ('target_node', target_node), ('source_port', source_port), ('target_port', target_port), ('bandwidth', bandwidth), ('layer_protocol_name', layer_protocol_name), ])
class connection(PybindBase):
"""
This class was auto-generated by the PythonClass plugin for PYANG
from YANG module connection - based on the path /connection. Each member element of
the container is represented as a class variable - with a specific
YANG type.
YANG Description: Basic example of network topology
"""
__slots__ = ('_path_helper', '_extmethods', '__connection',)
_yang_name = 'connection'
_yang_namespace = 'urn:connection'
_pybind_generated_by = 'container'
def __init__(self, *args, **kwargs):
self._path_helper = False
self._extmethods = False
self.__connection = YANGDynClass(base=YANGListType("connection_id",yc_connection_connection__connection, yang_name="connection", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='connection-id', extensions=None), is_container='list', yang_name="connection", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:connection', defining_module='connection', yang_type='list', is_config=True)
load = kwargs.pop("load", None)
if args:
if len(args) > 1:
raise TypeError("cannot create a YANG container with >1 argument")
all_attr = True
for e in self._pyangbind_elements:
if not hasattr(args[0], e):
all_attr = False
break
if not all_attr:
raise ValueError("Supplied object did not have the correct attributes")
for e in self._pyangbind_elements:
nobj = getattr(args[0], e)
if nobj._changed() is False:
continue
setmethod = getattr(self, "_set_%s" % e)
if load is None:
setmethod(getattr(args[0], e))
else:
setmethod(getattr(args[0], e), load=load)
def _path(self):
if hasattr(self, "_parent"):
return self._parent._path()+[self._yang_name]
else:
return []
def _get_connection(self):
"""
Getter method for connection, mapped from YANG variable /connection (list)
"""
return self.__connection
def _set_connection(self, v, load=False):
"""
Setter method for connection, mapped from YANG variable /connection (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_connection is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_connection() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=YANGListType("connection_id",yc_connection_connection__connection, yang_name="connection", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='connection-id', extensions=None), is_container='list', yang_name="connection", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:connection', defining_module='connection', yang_type='list', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """connection must be of a type compatible with list""",
'defined-type': "list",
'generated-type': """YANGDynClass(base=YANGListType("connection_id",yc_connection_connection__connection, yang_name="connection", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='connection-id', extensions=None), is_container='list', yang_name="connection", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:connection', defining_module='connection', yang_type='list', is_config=True)""",
})
self.__connection = t
if hasattr(self, '_set'):
self._set()
def _unset_connection(self):
self.__connection = YANGDynClass(base=YANGListType("connection_id",yc_connection_connection__connection, yang_name="connection", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='connection-id', extensions=None), is_container='list', yang_name="connection", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:connection', defining_module='connection', yang_type='list', is_config=True)
connection = __builtin__.property(_get_connection, _set_connection)
_pyangbind_elements = OrderedDict([('connection', connection), ])