Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.

Commit 5ded2d7

Browse files
authored
[uniconfig] Swagger update (#95)
* [uniconfig] Update swagger models Signed-off-by: Jakub Boguščiak <[email protected]> * Bump version and add CHANGELOG.md entry Signed-off-by: Jakub Boguščiak <[email protected]> * Update patches Signed-off-by: Jakub Boguščiak <[email protected]> * Add check nodes connection RPC Signed-off-by: Jakub Boguščiak <[email protected]> * Add SNMP topology Signed-off-by: Jakub Boguščiak <[email protected]> * Add new patch for SNMP topology field name Signed-off-by: Jakub Boguščiak <[email protected]> --------- Signed-off-by: Jakub Boguščiak <[email protected]>
1 parent 9a8c1d9 commit 5ded2d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2600
-1004
lines changed

uniconfig/python/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@
2222
1. ignore createsubscription ruff errors
2323
2. fix discover address spell error
2424
3. fix generated port constraints in discover model
25+
26+
# 1.1.2
27+
- Update models based on new OpenAPI fixed in UniConfig 6.1.x

uniconfig/python/frinx_api/uniconfig/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
from enum import Enum
56
from typing import Optional
67

78
from pydantic import BaseModel
@@ -14,6 +15,7 @@
1415
from .cli.unit.generic import executeandreaduntil
1516
from .connection.manager import changeadminstate
1617
from .connection.manager import checkinstallednodes
18+
from .connection.manager import checknodesconnection
1719
from .connection.manager import connectnode
1820
from .connection.manager import disconnectnode
1921
from .connection.manager import dryrunmountnode
@@ -84,6 +86,12 @@
8486
from .uniconfig.query import queryconfig
8587

8688

89+
class Content(Enum):
90+
nonconfig = 'nonconfig'
91+
config = 'config'
92+
all = 'all'
93+
94+
8795
class OperationsReadJournalPostRequest(BaseModel):
8896
pass
8997
model_config = ConfigDict(
@@ -251,6 +259,13 @@ class OperationsDisconnectNodePostRequest(BaseModel):
251259
input: Optional[disconnectnode.Input] = None
252260

253261

262+
class OperationsCheckNodesConnectionPostRequest(BaseModel):
263+
model_config = ConfigDict(
264+
populate_by_name=True,
265+
)
266+
input: Optional[checknodesconnection.Input] = None
267+
268+
254269
class OperationsChangeEncryptionStatusPostRequest(BaseModel):
255270
model_config = ConfigDict(
256271
populate_by_name=True,

uniconfig/python/frinx_api/uniconfig/cli/topology.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,36 @@
66

77

88
class JournalLevel(Enum):
9+
"""
10+
Sets how much information should be stored in the journal. Command-only stores only the actual
11+
commands executed on device. Extended records additional information such as: transaction
12+
life-cycle, which handlers were invoked etc.
13+
14+
"""
15+
916
command_only = 'command-only'
1017
extended = 'extended'
1118

1219

1320
class ParsingEngine(Enum):
21+
"""
22+
Specification of the parsing engine that is used for parsing of the running-configuration
23+
and lookup for target sections in the configuration using query commands.
24+
* batch-parser - Running-configuration must be traversed from the beginning each time when the new
25+
target section must be extracted from the configuration.
26+
* tree-parser - Running-configuration is mapped into the tree structure before the first command
27+
lookup. This tree can be reused in the same transaction for faster lookup process.
28+
* one-line-parser - Parsing engine that uses grep function for parsing running-configuration.
29+
30+
"""
31+
1432
batch_parser = 'batch-parser'
1533
tree_parser = 'tree-parser'
1634
one_line_parser = 'one-line-parser'
1735

1836

1937
class TransportTypeEnumeration(Enum):
38+
""" """
39+
2040
ssh = 'ssh'
2141
telnet = 'telnet'

uniconfig/python/frinx_api/uniconfig/cli/unit/generic/configcoverage.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Optional
6+
from typing import Union
67

78
from pydantic import BaseModel
89
from pydantic import ConfigDict
@@ -28,17 +29,30 @@ class ComplexOutputItem(BaseModel):
2829
covered: Optional[bool] = None
2930

3031

31-
class Output(BaseModel):
32+
class Result(BaseModel):
3233
model_config = ConfigDict(
3334
populate_by_name=True,
3435
)
35-
simple_output: Optional[str] = Field(None, alias='simple-output')
36+
complex_output: Optional[list[ComplexOutputItem]] = Field(
37+
None, alias='complex-output'
38+
)
3639
"""
3740
Simple output contains commands marked with '+' if it is covered or '-' if not.
3841
"""
39-
complex_output: Optional[list[ComplexOutputItem]] = Field(
40-
None, alias='complex-output'
42+
43+
44+
class ResultModel(BaseModel):
45+
model_config = ConfigDict(
46+
populate_by_name=True,
4147
)
48+
simple_output: Optional[str] = Field(None, alias='simple-output')
4249
"""
4350
Simple output contains commands marked with '+' if it is covered or '-' if not.
4451
"""
52+
53+
54+
class Output(BaseModel):
55+
model_config = ConfigDict(
56+
populate_by_name=True,
57+
)
58+
result: Optional[Union[Result, ResultModel]] = None

uniconfig/python/frinx_api/uniconfig/connection/manager/__init__.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,38 @@
66

77

88
class AdminState(Enum):
9+
"""
10+
11+
* locked - When a device is administratively locked, it is not possible
12+
to modify its configuration, and no changes are ever pushed
13+
to the device
14+
* unlocked - Device is assumed to be operational. All changes are attempted
15+
to be sent southbound. This is the default when a new device is created.
16+
* southbound_locked - It is possible to configure the device, but no changes are sent
17+
to the device. Useful admin mode when pre provisioning devices.
18+
19+
"""
20+
921
locked = 'locked'
1022
unlocked = 'unlocked'
1123
southbound_locked = 'southbound_locked'
1224

1325

1426
class ConnectionType(Enum):
27+
"""
28+
Type of the mountpoint that is awaited:
29+
a. cli - CLI mountpoint,
30+
b. netconf - NETCONF mountpoint,
31+
c. uniconfig-preferred-connection - Unified mounpoint (type of the southbound protocol
32+
is read from database).
33+
d. gnmi - gNMI mountpoint,
34+
e. snmp - snmp mountpoin,
35+
f. netconf-dryrun-connection - DRYRUN mountpoint
36+
g. cli-dryrun-connection - DRYRUN mountpoint
37+
f. gnmi-dryrun-connection - DRYRUN mountpoint
38+
39+
"""
40+
1541
cli = 'cli'
1642
netconf = 'netconf'
1743
uniconfig_preferred_connection = 'uniconfig-preferred-connection'
@@ -23,6 +49,16 @@ class ConnectionType(Enum):
2349

2450

2551
class MountType(Enum):
52+
"""
53+
Type of the nodes that have been installed:
54+
a. cli - nodes that are installed using CLI protocol,
55+
b. netconf - nodes that are installed using NETCONF protocol,
56+
c. gnmi - nodes that are installed using GNMI protocol,
57+
d. uniconfig-preferred-connection - nodes that are installed in the UniConfig layer
58+
(output may contain nodes mounted on CLI, NETCONF or GNMI protocol).
59+
60+
"""
61+
2662
cli = 'cli'
2763
netconf = 'netconf'
2864
uniconfig_preferred_connection = 'uniconfig-preferred-connection'

uniconfig/python/frinx_api/uniconfig/connection/manager/checkinstallednodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ class NodeResultItem(BaseModel):
3232
populate_by_name=True,
3333
)
3434
node_id: Optional[str] = Field(None, alias='node-id')
35-
topology_id: Optional[str] = Field(None, alias='topology-id')
3635
uniconfig_layer: Optional[bool] = Field(None, alias='uniconfig-layer')
3736
"""
3837
Indicates whether node is installed in UniConfig layer.
3938
"""
39+
topology_id: Optional[str] = Field(None, alias='topology-id')
4040

4141

4242
class NodeResults(BaseModel):
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# generated by datamodel-codegen
2+
3+
from __future__ import annotations
4+
5+
from typing import Optional
6+
7+
from pydantic import BaseModel
8+
from pydantic import ConfigDict
9+
from pydantic import Field
10+
11+
12+
class TargetNodes(BaseModel):
13+
model_config = ConfigDict(
14+
populate_by_name=True,
15+
)
16+
node: Optional[list[str]] = None
17+
18+
19+
class Input(BaseModel):
20+
model_config = ConfigDict(
21+
populate_by_name=True,
22+
)
23+
connection_timeout: Optional[int] = Field(
24+
None, alias='connection-timeout', ge=0, le=65535
25+
)
26+
"""
27+
Timeout for each health-check session to be established individually. Default 5 seconds.
28+
"""
29+
target_nodes: Optional[TargetNodes] = Field(
30+
None,
31+
alias='target-nodes',
32+
title='uniconfig.manager.targetuniconfignodesfields.TargetNodes',
33+
)

uniconfig/python/frinx_api/uniconfig/connection/manager/getinstallednodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ class NodeResultItem(BaseModel):
1616
populate_by_name=True,
1717
)
1818
node_id: Optional[str] = Field(None, alias='node-id')
19-
topology_id: Optional[str] = Field(None, alias='topology-id')
2019
uniconfig_layer: Optional[bool] = Field(None, alias='uniconfig-layer')
2120
"""
2221
Indicates whether node is installed in UniConfig layer.
2322
"""
23+
topology_id: Optional[str] = Field(None, alias='topology-id')
2424

2525

2626
class NodeResults(BaseModel):

0 commit comments

Comments
 (0)