-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy path__init__.py
771 lines (594 loc) · 25.6 KB
/
__init__.py
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
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: onos/config/admin/admin.proto
# plugin: python-betterproto
import warnings
from dataclasses import dataclass
from typing import AsyncIterable, AsyncIterator, Iterable, List, Optional, Union
import betterproto
import grpclib
@dataclass(eq=False, repr=False)
class ReadOnlySubPath(betterproto.Message):
"""
ReadOnlySubPath is an extension to the ReadOnlyPath to define the datatype
of the subpath
"""
# sub_path is the relative path of a child object e.g. /list2b/index
sub_path: str = betterproto.string_field(1)
# value_type is the datatype of the read only path
value_type: "_v2__.ValueType" = betterproto.enum_field(2)
type_opts: List[int] = betterproto.uint64_field(3)
description: str = betterproto.string_field(4)
units: str = betterproto.string_field(5)
is_a_key: bool = betterproto.bool_field(6)
attr_name: str = betterproto.string_field(7)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class ReadOnlyPath(betterproto.Message):
"""
ReadOnlyPath extracted from the model plugin as the definition of a tree of
read only items. In YANG models items are defined as ReadOnly with the
`config false` keyword. This can be applied to single items (leafs) or
collections (containers or lists). When this `config false` is applied to
an object every item beneath it will also become readonly - here these are
shown as subpaths. The complete read only path then will be a concatenation
of both e.g. /cont1a/cont1b-state/list2b/index and the type is defined in
the SubPath as UInt8.
"""
# path of the topmost `config false` object e.g. /cont1a/cont1b-state
path: str = betterproto.string_field(1)
# ReadOnlySubPath is a set of children of the path including an entry for the
# type of the topmost object with subpath `/` An example is /list2b/index
sub_path: List["ReadOnlySubPath"] = betterproto.message_field(2)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class ReadWritePath(betterproto.Message):
"""
ReadWritePath is extracted from the model plugin as the definition of a
writeable attributes. In YANG models items are writable by default unless
they are specified as `config false` or have an item with `config false` as
a parent. Each configurable item has metadata with meanings taken from the
YANG specification RFC 6020.
"""
# path is the full path to the attribute (leaf or leaf-list)
path: str = betterproto.string_field(1)
# value_type is the data type of the attribute
value_type: "_v2__.ValueType" = betterproto.enum_field(2)
# units is the unit of measurement e.g. dB, mV
units: str = betterproto.string_field(3)
# description is an explaination of the meaning of the attribute
description: str = betterproto.string_field(4)
# mandatory shows whether the attribute is optional (false) or required
# (true)
mandatory: bool = betterproto.bool_field(5)
# default is a default value used with optional attributes. Replaced by
# 'defaults' below
default: str = betterproto.string_field(6)
# range is definition of the range of values a value is allowed
range: List[str] = betterproto.string_field(7)
# length is a defintion of the length restrictions for the attribute
length: List[str] = betterproto.string_field(8)
type_opts: List[int] = betterproto.uint64_field(9)
is_a_key: bool = betterproto.bool_field(10)
attr_name: str = betterproto.string_field(11)
# defaults is a default value(s) used with optional attributes. For leaf-list
# can have repeated values replaces the 'default' attribute above
defaults: List[str] = betterproto.string_field(12)
def __post_init__(self) -> None:
super().__post_init__()
if self.default:
warnings.warn("ReadWritePath.default is deprecated", DeprecationWarning)
@dataclass(eq=False, repr=False)
class Namespace(betterproto.Message):
"""
Namespace is a mapping between a module name and its shorthand prefix
"""
module: str = betterproto.string_field(1)
prefix: str = betterproto.string_field(2)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class ModelInfo(betterproto.Message):
"""ModelInfo is general information about a model plugin."""
# name is the name given to the model plugin - no spaces and title case.
name: str = betterproto.string_field(1)
# version is the semantic version of the Plugin e.g. 1.0.0.
version: str = betterproto.string_field(2)
# model_data is a set of metadata about the YANG files that went in to
# generating the model plugin. It includes name, version and organization for
# each YANG file, similar to how they are represented in gNMI Capabilities.
model_data: List["___gnmi__.ModelData"] = betterproto.message_field(3)
# module is no longer used
module: str = betterproto.string_field(4)
# getStateMode is flag that defines how the "get state" operation works. 0)
# means that no retrieval of state is attempted 1) means that the
# synchronizer will make 2 requests to the device - one for Get with
# State and another for Get with Operational. 2) means that the synchronizer
# will do a Get request comprising of each one of the ReadOnlyPaths and
# their sub paths. If there is a `list` in any one of these paths it
# will be sent down as is, expecting the devices implementation of gNMI
# will be able to expand wildcards. 3) means that the synchronizer will do a
# Get request comprising of each one of the ReadOnlyPaths and their sub
# paths. If there is a `list` in any one of these paths, a separate call
# will be made first to find all the instances in the list and a Get
# including these expanded wildcards will be sent down to the device.
get_state_mode: int = betterproto.uint32_field(5)
# read_only_path is all of the read only paths for the model plugin.
read_only_path: List["ReadOnlyPath"] = betterproto.message_field(7)
# read_write_path is all of the read write paths for the model plugin.
read_write_path: List["ReadWritePath"] = betterproto.message_field(8)
supported_encodings: List["___gnmi__.Encoding"] = betterproto.enum_field(9)
# namespace_mappings is a set of all prefix to module name mapping in the
# model
namespace_mappings: List["Namespace"] = betterproto.message_field(10)
# southboundUsePrefix indicates that the southbound should add prefixes in
# gNMI paths
southbound_use_prefix: bool = betterproto.bool_field(11)
def __post_init__(self) -> None:
super().__post_init__()
if self.module:
warnings.warn("ModelInfo.module is deprecated", DeprecationWarning)
@dataclass(eq=False, repr=False)
class ModelPlugin(betterproto.Message):
id: str = betterproto.string_field(1)
endpoint: str = betterproto.string_field(2)
info: "ModelInfo" = betterproto.message_field(3)
status: str = betterproto.string_field(10)
error: str = betterproto.string_field(11)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class ListModelsRequest(betterproto.Message):
"""
ListModelsRequest carries data for querying registered model plugins.
"""
# verbose option causes all of the ReadWrite and ReadOnly paths to be
# included.
verbose: bool = betterproto.bool_field(1)
# An optional filter on the name of the model plugins to list.
model_name: str = betterproto.string_field(2)
# An optional filter on the version of the model plugins to list
model_version: str = betterproto.string_field(3)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class RollbackRequest(betterproto.Message):
"""
RollbackRequest carries the index of the configuration change transaction
to rollback.
"""
# index of the transaction that should be rolled back
index: int = betterproto.uint64_field(1)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class RollbackResponse(betterproto.Message):
"""RollbackResponse carries the response of the rollback operation"""
# ID of the rollback transaction
id: str = betterproto.string_field(1)
# index of the rollback transaction
index: int = betterproto.uint64_field(2)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class LeafSelectionQueryRequest(betterproto.Message):
"""
LeafSelectionQueryRequest carries request for the selection of leaf values
"""
# target is the name of the target (device) to perform the query on
target: str = betterproto.string_field(1)
# type of model plugin to perform the query on
type: str = betterproto.string_field(2)
# version of model plugin to perform the query on
version: str = betterproto.string_field(3)
# selectionPath is a configuration path to a leaf in the format:
# /a/b[key1=index][key2=index2]/c/d where d is a leaf node
selection_path: str = betterproto.string_field(4)
# changeContext is the set of changes (e.g. from the GUI form) that have to
# be superimposed on the current configuration before the leaf selection can
# be made All the changes in this request should match the target given above
# optional
change_context: "___gnmi__.SetRequest" = betterproto.message_field(5)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class LeafSelectionQueryResponse(betterproto.Message):
"""
LeafSelectionQueryResponse carries response for the model information query
"""
# selection is an array of string values
selection: List[str] = betterproto.string_field(1)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class ModelInfoRequest(betterproto.Message):
"""ModelInfoRequest carries request for the model information"""
pass
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class ModelInfoResponse(betterproto.Message):
"""ModelInfoResponse carries response for the model information query"""
model_info: "ModelInfo" = betterproto.message_field(1)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class ValidateConfigRequest(betterproto.Message):
"""
ValidateConfigRequest carries configuration data to be validated as a JSON
blob
"""
json: bytes = betterproto.bytes_field(1)
def __post_init__(self) -> None:
warnings.warn("ValidateConfigRequest is deprecated", DeprecationWarning)
super().__post_init__()
@dataclass(eq=False, repr=False)
class ValidateConfigRequestChunk(betterproto.Message):
"""
ValidateConfigRequestChunk carries configuration data to be validated as a
JSON blob Recommended maximum size is 100kB
"""
json: bytes = betterproto.bytes_field(1)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class ValidateConfigChunkRequest(betterproto.Message):
"""
ValidateConfigRequest carries configuration data to be validated as a JSON
blob
"""
json: bytes = betterproto.bytes_field(1)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class ValidateConfigResponse(betterproto.Message):
"""ValidateConfigResponse carries the result of the validation"""
valid: bool = betterproto.bool_field(1)
message: str = betterproto.string_field(2)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class PathValuesRequest(betterproto.Message):
"""PathValuesRequest carries configuration change as a JSON blob"""
path_prefix: str = betterproto.string_field(1)
json: bytes = betterproto.bytes_field(2)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class PathValuesResponse(betterproto.Message):
"""PathValuesResponse carries a list of typed path values"""
path_values: List["_v2__.PathValue"] = betterproto.message_field(1)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class ValueSelectionRequest(betterproto.Message):
"""
ValueSelectionRequest carries the necessary parts to form a selection
context
"""
# selectionPath is a configuration path to a leaf in the format:
# /a/b[key1=index][key2=index2]/c/d where d is a leaf node
selection_path: str = betterproto.string_field(1)
# configJson is a JSON tree view of the complete Configuration for a Target
config_json: bytes = betterproto.bytes_field(2)
def __post_init__(self) -> None:
warnings.warn("ValueSelectionRequest is deprecated", DeprecationWarning)
super().__post_init__()
@dataclass(eq=False, repr=False)
class ValueSelectionRequestChunk(betterproto.Message):
"""
ValueSelectionRequestChunk carries the necessary parts to form a selection
context Recommended maximum size is 100kB
"""
# selectionPath is a configuration path to a leaf in the format:
# /a/b[key1=index][key2=index2]/c/d where d is a leaf node
selection_path: str = betterproto.string_field(1)
# configJson is a JSON tree view of the complete Configuration for a Target
config_json: bytes = betterproto.bytes_field(2)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class ValueSelectionResponse(betterproto.Message):
"""
ValueSelectionResponse returns the result of applying the selection rules
to the selection context
"""
# selection is an array of string values
selection: List[str] = betterproto.string_field(1)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class GetTransactionRequest(betterproto.Message):
# ID of transaction to get
id: str = betterproto.string_field(1)
# index of transaction to get; leave 0 for lookup by ID; if specified takes
# precedence
index: int = betterproto.uint64_field(2)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class GetTransactionResponse(betterproto.Message):
transaction: "_v2__.Transaction" = betterproto.message_field(1)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class ListTransactionsRequest(betterproto.Message):
pass
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class ListTransactionsResponse(betterproto.Message):
transaction: "_v2__.Transaction" = betterproto.message_field(1)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class WatchTransactionsRequest(betterproto.Message):
id: str = betterproto.string_field(1)
noreplay: bool = betterproto.bool_field(2)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class WatchTransactionsResponse(betterproto.Message):
event: "_v2__.TransactionEvent" = betterproto.message_field(1)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class GetConfigurationRequest(betterproto.Message):
configuration_id: str = betterproto.string_field(1)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class GetConfigurationResponse(betterproto.Message):
configuration: "_v2__.Configuration" = betterproto.message_field(1)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class ListConfigurationsRequest(betterproto.Message):
pass
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class ListConfigurationsResponse(betterproto.Message):
configuration: "_v2__.Configuration" = betterproto.message_field(1)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class WatchConfigurationsRequest(betterproto.Message):
configuration_id: str = betterproto.string_field(1)
noreplay: bool = betterproto.bool_field(2)
def __post_init__(self) -> None:
super().__post_init__()
@dataclass(eq=False, repr=False)
class WatchConfigurationsResponse(betterproto.Message):
event: "_v2__.ConfigurationEvent" = betterproto.message_field(1)
def __post_init__(self) -> None:
super().__post_init__()
class ConfigAdminServiceStub(betterproto.ServiceStub):
"""
ConfigAdminService provides means for enhanced interactions with the
configuration subsystem.
"""
async def list_registered_models(
self, *, verbose: bool = False, model_name: str = "", model_version: str = ""
) -> AsyncIterator["ModelPlugin"]:
"""ListRegisteredModels returns a stream of registered models."""
request = ListModelsRequest()
request.verbose = verbose
request.model_name = model_name
request.model_version = model_version
async for response in self._unary_stream(
"/onos.config.admin.ConfigAdminService/ListRegisteredModels",
request,
ModelPlugin,
):
yield response
async def rollback_transaction(self, *, index: int = 0) -> "RollbackResponse":
"""
RollbackTransaction rolls back the specified configuration change
transaction.
"""
request = RollbackRequest()
request.index = index
return await self._unary_unary(
"/onos.config.admin.ConfigAdminService/RollbackTransaction",
request,
RollbackResponse,
)
async def leaf_selection_query(
self,
*,
target: str = "",
type: str = "",
version: str = "",
selection_path: str = "",
change_context: "___gnmi__.SetRequest" = None,
) -> "LeafSelectionQueryResponse":
"""
LeafSelectionQuery selects values allowable for leaf. It supports the
ROC GUI by supplying a list of valid leaf values based off an XPath
query defined in a 'leaf-selection' YANG extension Calls on
GetValueSelection RPC on Model Plugin
"""
request = LeafSelectionQueryRequest()
request.target = target
request.type = type
request.version = version
request.selection_path = selection_path
if change_context is not None:
request.change_context = change_context
return await self._unary_unary(
"/onos.config.admin.ConfigAdminService/LeafSelectionQuery",
request,
LeafSelectionQueryResponse,
)
class ModelPluginServiceStub(betterproto.ServiceStub):
"""ModelPluginService is to be implemented by model plugin sidecar"""
async def get_model_info(self) -> "ModelInfoResponse":
"""GetModelInfo provides information about the model"""
request = ModelInfoRequest()
return await self._unary_unary(
"/onos.config.admin.ModelPluginService/GetModelInfo",
request,
ModelInfoResponse,
)
async def validate_config(self, *, json: bytes = b"") -> "ValidateConfigResponse":
"""
ValidateConfig validates the provided configuration data against the
model
"""
request = ValidateConfigRequest()
request.json = json
return await self._unary_unary(
"/onos.config.admin.ModelPluginService/ValidateConfig",
request,
ValidateConfigResponse,
)
async def validate_config_chunked(
self,
request_iterator: Union[
AsyncIterable["ValidateConfigRequestChunk"],
Iterable["ValidateConfigRequestChunk"],
],
) -> "ValidateConfigResponse":
"""
ValidateConfigChunked validates the provided configuration data against
the model
"""
return await self._stream_unary(
"/onos.config.admin.ModelPluginService/ValidateConfigChunked",
request_iterator,
ValidateConfigRequestChunk,
ValidateConfigResponse,
)
async def get_path_values(
self, *, path_prefix: str = "", json: bytes = b""
) -> "PathValuesResponse":
"""
GetPathValues produces list of typed path value entries from the
specified configuration change JSON tree
"""
request = PathValuesRequest()
request.path_prefix = path_prefix
request.json = json
return await self._unary_unary(
"/onos.config.admin.ModelPluginService/GetPathValues",
request,
PathValuesResponse,
)
async def get_value_selection(
self, *, selection_path: str = "", config_json: bytes = b""
) -> "ValueSelectionResponse":
"""
GetValueSelection gets a list of valid options for a leaf by applying
selection rules in YANG. Replaced by GetValueSelectionChunked
"""
request = ValueSelectionRequest()
request.selection_path = selection_path
request.config_json = config_json
return await self._unary_unary(
"/onos.config.admin.ModelPluginService/GetValueSelection",
request,
ValueSelectionResponse,
)
async def get_value_selection_chunked(
self,
request_iterator: Union[
AsyncIterable["ValueSelectionRequestChunk"],
Iterable["ValueSelectionRequestChunk"],
],
) -> "ValueSelectionResponse":
"""
GetValueSelectionChunked gets a list of valid options for a leaf by
applying selection rules in YANG. The selection rules should be defined
as an XPath expression, as an argument to a `leaf-selection` extension
in the YANG model (Used to support the ROC GUI)
"""
return await self._stream_unary(
"/onos.config.admin.ModelPluginService/GetValueSelectionChunked",
request_iterator,
ValueSelectionRequestChunk,
ValueSelectionResponse,
)
class TransactionServiceStub(betterproto.ServiceStub):
"""
TransactionService provides means to inspect the contents of the internal
transactions store.
"""
async def get_transaction(
self, *, id: str = "", index: int = 0
) -> "GetTransactionResponse":
"""Get transaction by its ID or index"""
request = GetTransactionRequest()
request.id = id
request.index = index
return await self._unary_unary(
"/onos.config.admin.TransactionService/GetTransaction",
request,
GetTransactionResponse,
)
async def list_transactions(self) -> AsyncIterator["ListTransactionsResponse"]:
"""List returns all configuration transactions"""
request = ListTransactionsRequest()
async for response in self._unary_stream(
"/onos.config.admin.TransactionService/ListTransactions",
request,
ListTransactionsResponse,
):
yield response
async def watch_transactions(
self, *, id: str = "", noreplay: bool = False
) -> AsyncIterator["WatchTransactionsResponse"]:
"""
Watch returns a stream of configuration transaction change
notifications
"""
request = WatchTransactionsRequest()
request.id = id
request.noreplay = noreplay
async for response in self._unary_stream(
"/onos.config.admin.TransactionService/WatchTransactions",
request,
WatchTransactionsResponse,
):
yield response
class ConfigurationServiceStub(betterproto.ServiceStub):
"""
ConfigurationService provides means to inspect the contents of the internal
configurations store.
"""
async def get_configuration(
self, *, configuration_id: str = ""
) -> "GetConfigurationResponse":
"""Get configuration by its target ID"""
request = GetConfigurationRequest()
request.configuration_id = configuration_id
return await self._unary_unary(
"/onos.config.admin.ConfigurationService/GetConfiguration",
request,
GetConfigurationResponse,
)
async def list_configurations(self) -> AsyncIterator["ListConfigurationsResponse"]:
"""List returns all target configurations"""
request = ListConfigurationsRequest()
async for response in self._unary_stream(
"/onos.config.admin.ConfigurationService/ListConfigurations",
request,
ListConfigurationsResponse,
):
yield response
async def watch_configurations(
self, *, configuration_id: str = "", noreplay: bool = False
) -> AsyncIterator["WatchConfigurationsResponse"]:
"""Watch returns a stream of configuration change notifications"""
request = WatchConfigurationsRequest()
request.configuration_id = configuration_id
request.noreplay = noreplay
async for response in self._unary_stream(
"/onos.config.admin.ConfigurationService/WatchConfigurations",
request,
WatchConfigurationsResponse,
):
yield response
from .. import v2 as _v2__
from .... import gnmi as ___gnmi__