Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[uniconfig] Generate models for UniConfig 7.0.4 #118

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions uniconfig/python/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@

# 2.0.1
- Fix version in the RELEASE.md.

# 2.1.0
- Update models based on the UniConfig 7.0.4 OpenAPI.
3 changes: 2 additions & 1 deletion uniconfig/python/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
| 6.1.1 | 1.2.1 |
| 6.1.2 | 1.2.2 |
| 7.0.0 | 2.0.0 |
| 7.0.0 | 2.0.1 |
| 7.0.0 | 2.0.1 |
| 7.1.0 | 2.1.0 |
15 changes: 15 additions & 0 deletions uniconfig/python/frinx_api/uniconfig/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
from .notifications import createsubscription
from .restconf.logging import sethiddenhttpheaders
from .restconf.logging import sethiddenhttpmethods
from .schema.resources import findschemaresources
from .schema.resources import registerrepository
from .snapshot.manager import createsnapshot
from .snapshot.manager import deletesnapshot
Expand Down Expand Up @@ -470,6 +471,20 @@ class OperationsRegisterRepositoryPostRequest(BaseModel):
input: Optional[registerrepository.Input] = None


class OperationsFindSchemaResourcesPostRequest(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
)
input: Optional[findschemaresources.Input] = None


class OperationsFindSchemaResourcesPostResponse(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
)
output: Optional[findschemaresources.Output] = None


class OperationsDeleteSnapshotPostRequest(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
Expand Down
2 changes: 0 additions & 2 deletions uniconfig/python/frinx_api/uniconfig/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# generated by datamodel-codegen

from __future__ import annotations
1 change: 0 additions & 1 deletion uniconfig/python/frinx_api/uniconfig/cli/unit/__init__.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# generated by datamodel-codegen

from __future__ import annotations
Original file line number Diff line number Diff line change
Expand Up @@ -1052,23 +1052,29 @@ class NetconfNodeTopologyNetconfParametersModel(BaseModel):
if device doesn't support candidate data-store, this parameter
should be set to 'netconf-customization-alu-ignore-candidate' string.
"""
netconf_node_topology_concurrent_rpc_limit: Optional[int] = Field(
None, alias='netconf-node-topology:concurrent-rpc-limit', ge=0, le=65535
netconf_node_topology_enabled_notifications: Optional[bool] = Field(
None, alias='netconf-node-topology:enabled-notifications'
)
"""
Limit of concurrent messages that can be send before reply messages are received.
If value <1 is provided, no limit will be enforced
If it is set to 'true' and NETCONF device supports notifications, NETCONF mountpoint will
expose NETCONF notification and subscription services.
"""
netconf_node_topology_edit_config_test_option: Optional[
topology_1.EditConfigTestOption
] = Field(None, alias='netconf-node-topology:edit-config-test-option')
netconf_node_topology_dry_run_journal_size: Optional[int] = Field(
None, alias='netconf-node-topology:dry-run-journal-size', ge=0, le=65535
netconf_node_topology_reconnect_on_changed_schema: Optional[bool] = Field(
None, alias='netconf-node-topology:reconnect-on-changed-schema'
)
"""
Size of the DRY RUN netconf mountpoint journal. DRY RUN journal captures netconf RPCs that
would be executed when reading/writing some configuration. However the RPCs are not actually
sent to the device
If it is set to 'true', NETCONF notifications are supported by device, and NETCONF
notifications are enabled ('enabled-notifications' flag), the connector would auto
disconnect/reconnect when schemas are changed in the remote device. The connector subscribes
(right after connect) to base netconf notifications and listens
for netconf-capability-change notification
"""
netconf_node_topology_streaming_session: Optional[bool] = Field(
None, alias='netconf-node-topology:streaming-session'
)
"""
NETCONF session is created and optimized for receiving of NETCONF notifications
from remote server.
"""
netconf_node_topology_max_connection_attempts: Optional[int] = Field(
None, alias='netconf-node-topology:max-connection-attempts', ge=0, le=4294967295
Expand All @@ -1095,29 +1101,23 @@ class NetconfNodeTopologyNetconfParametersModel(BaseModel):
Netconf connector sends keepalive RPCs while the session is idle, this delay specifies the delay between keepalive RPC in seconds
If a value <1 is provided, no keepalives will be sent
"""
netconf_node_topology_enabled_notifications: Optional[bool] = Field(
None, alias='netconf-node-topology:enabled-notifications'
)
"""
If it is set to 'true' and NETCONF device supports notifications, NETCONF mountpoint will
expose NETCONF notification and subscription services.
"""
netconf_node_topology_reconnect_on_changed_schema: Optional[bool] = Field(
None, alias='netconf-node-topology:reconnect-on-changed-schema'
netconf_node_topology_concurrent_rpc_limit: Optional[int] = Field(
None, alias='netconf-node-topology:concurrent-rpc-limit', ge=0, le=65535
)
"""
If it is set to 'true', NETCONF notifications are supported by device, and NETCONF
notifications are enabled ('enabled-notifications' flag), the connector would auto
disconnect/reconnect when schemas are changed in the remote device. The connector subscribes
(right after connect) to base netconf notifications and listens
for netconf-capability-change notification
Limit of concurrent messages that can be send before reply messages are received.
If value <1 is provided, no limit will be enforced
"""
netconf_node_topology_streaming_session: Optional[bool] = Field(
None, alias='netconf-node-topology:streaming-session'
netconf_node_topology_edit_config_test_option: Optional[
topology_1.EditConfigTestOption
] = Field(None, alias='netconf-node-topology:edit-config-test-option')
netconf_node_topology_dry_run_journal_size: Optional[int] = Field(
None, alias='netconf-node-topology:dry-run-journal-size', ge=0, le=65535
)
"""
NETCONF session is created and optimized for receiving of NETCONF notifications
from remote server.
Size of the DRY RUN netconf mountpoint journal. DRY RUN journal captures netconf RPCs that
would be executed when reading/writing some configuration. However the RPCs are not actually
sent to the device
"""


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1052,23 +1052,29 @@ class NetconfNodeTopologyNetconfParametersModel(BaseModel):
if device doesn't support candidate data-store, this parameter
should be set to 'netconf-customization-alu-ignore-candidate' string.
"""
netconf_node_topology_concurrent_rpc_limit: Optional[int] = Field(
None, alias='netconf-node-topology:concurrent-rpc-limit', ge=0, le=65535
netconf_node_topology_enabled_notifications: Optional[bool] = Field(
None, alias='netconf-node-topology:enabled-notifications'
)
"""
Limit of concurrent messages that can be send before reply messages are received.
If value <1 is provided, no limit will be enforced
If it is set to 'true' and NETCONF device supports notifications, NETCONF mountpoint will
expose NETCONF notification and subscription services.
"""
netconf_node_topology_edit_config_test_option: Optional[
topology_1.EditConfigTestOption
] = Field(None, alias='netconf-node-topology:edit-config-test-option')
netconf_node_topology_dry_run_journal_size: Optional[int] = Field(
None, alias='netconf-node-topology:dry-run-journal-size', ge=0, le=65535
netconf_node_topology_reconnect_on_changed_schema: Optional[bool] = Field(
None, alias='netconf-node-topology:reconnect-on-changed-schema'
)
"""
Size of the DRY RUN netconf mountpoint journal. DRY RUN journal captures netconf RPCs that
would be executed when reading/writing some configuration. However the RPCs are not actually
sent to the device
If it is set to 'true', NETCONF notifications are supported by device, and NETCONF
notifications are enabled ('enabled-notifications' flag), the connector would auto
disconnect/reconnect when schemas are changed in the remote device. The connector subscribes
(right after connect) to base netconf notifications and listens
for netconf-capability-change notification
"""
netconf_node_topology_streaming_session: Optional[bool] = Field(
None, alias='netconf-node-topology:streaming-session'
)
"""
NETCONF session is created and optimized for receiving of NETCONF notifications
from remote server.
"""
netconf_node_topology_max_connection_attempts: Optional[int] = Field(
None, alias='netconf-node-topology:max-connection-attempts', ge=0, le=4294967295
Expand All @@ -1095,29 +1101,23 @@ class NetconfNodeTopologyNetconfParametersModel(BaseModel):
Netconf connector sends keepalive RPCs while the session is idle, this delay specifies the delay between keepalive RPC in seconds
If a value <1 is provided, no keepalives will be sent
"""
netconf_node_topology_enabled_notifications: Optional[bool] = Field(
None, alias='netconf-node-topology:enabled-notifications'
)
"""
If it is set to 'true' and NETCONF device supports notifications, NETCONF mountpoint will
expose NETCONF notification and subscription services.
"""
netconf_node_topology_reconnect_on_changed_schema: Optional[bool] = Field(
None, alias='netconf-node-topology:reconnect-on-changed-schema'
netconf_node_topology_concurrent_rpc_limit: Optional[int] = Field(
None, alias='netconf-node-topology:concurrent-rpc-limit', ge=0, le=65535
)
"""
If it is set to 'true', NETCONF notifications are supported by device, and NETCONF
notifications are enabled ('enabled-notifications' flag), the connector would auto
disconnect/reconnect when schemas are changed in the remote device. The connector subscribes
(right after connect) to base netconf notifications and listens
for netconf-capability-change notification
Limit of concurrent messages that can be send before reply messages are received.
If value <1 is provided, no limit will be enforced
"""
netconf_node_topology_streaming_session: Optional[bool] = Field(
None, alias='netconf-node-topology:streaming-session'
netconf_node_topology_edit_config_test_option: Optional[
topology_1.EditConfigTestOption
] = Field(None, alias='netconf-node-topology:edit-config-test-option')
netconf_node_topology_dry_run_journal_size: Optional[int] = Field(
None, alias='netconf-node-topology:dry-run-journal-size', ge=0, le=65535
)
"""
NETCONF session is created and optimized for receiving of NETCONF notifications
from remote server.
Size of the DRY RUN netconf mountpoint journal. DRY RUN journal captures netconf RPCs that
would be executed when reading/writing some configuration. However the RPCs are not actually
sent to the device
"""


Expand Down
1 change: 0 additions & 1 deletion uniconfig/python/frinx_api/uniconfig/gnmi/yang/__init__.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# generated by datamodel-codegen

from __future__ import annotations
9 changes: 9 additions & 0 deletions uniconfig/python/frinx_api/uniconfig/rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
from . import OperationsEnableDefaultDeviceLoggingPostRequest
from . import OperationsEnableDeviceLoggingPostRequest
from . import OperationsEnableLoggingPostRequest
from . import OperationsFindSchemaResourcesPostRequest
from . import OperationsFindSchemaResourcesPostResponse
from . import OperationsGetInstalledNodesPostRequest
from . import OperationsGetInstalledNodesPostResponse
from . import OperationsGetTemplateInfoPostRequest
Expand Down Expand Up @@ -701,6 +703,13 @@ class RegisterRepository(UniconfigRest):
response = OperationsRegisterRepositoryPostResponse


class FindSchemaResources(UniconfigRest):
uri = '/operations/find-schema-resources'
method = 'POST'
request = OperationsFindSchemaResourcesPostRequest
response = OperationsFindSchemaResourcesPostResponse


class SnapshotsMetadataGet(UniconfigRest):
uri = '/data/snapshots-metadata'
method = 'GET'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# generated by datamodel-codegen

from __future__ import annotations

from typing import Any
from typing import Optional

from pydantic import BaseModel
from pydantic import ConfigDict
from pydantic import Field


class Input(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
)
repository_name: Optional[str] = Field(None, alias='repository-name')
"""
Name of the schema repository / directory that is used for persistence of YANG artifacts.
"""
keywords: Optional[list[str]] = None
"""
Keyword to search for in the schema.
"""


class OperPath(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
)
generated_json: Optional[dict[str, Any]] = Field(None, alias='generated-json')
path: Optional[str] = None


class ConfigPath(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
)
generated_json: Optional[dict[str, Any]] = Field(None, alias='generated-json')
path: Optional[str] = None


class Output(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
)
oper_paths: Optional[list[OperPath]] = Field(None, alias='oper-paths')
"""
Path containing the specified keyword. (Operational)
"""
config_paths: Optional[list[ConfigPath]] = Field(None, alias='config-paths')
"""
Path containing the specified keyword. (Configurational)
"""
29 changes: 29 additions & 0 deletions uniconfig/python/patches/05_fix_generated_json_typing.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/uniconfig/python/frinx_api/uniconfig/schema/resources/findschemaresources.py b/uniconfig/python/frinx_api/uniconfig/schema/resources/findschemaresources.py
index 348875a..bdcd9ef 100644
--- a/uniconfig/python/frinx_api/uniconfig/schema/resources/findschemaresources.py
+++ b/uniconfig/python/frinx_api/uniconfig/schema/resources/findschemaresources.py
@@ -2,5 +2,5 @@

from __future__ import annotations

-from typing import Optional
+from typing import Optional, Any

@@ -24,7 +24,7 @@ class OperPath(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
)
- generated_json: Optional[str] = Field(None, alias='generated-json')
+ generated_json: Optional[dict[str, Any]] = Field(None, alias='generated-json')
path: Optional[str] = None


@@ -32,7 +32,7 @@ class ConfigPath(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
)
- generated_json: Optional[str] = Field(None, alias='generated-json')
+ generated_json: Optional[dict[str, Any]] = Field(None, alias='generated-json')
path: Optional[str] = None


Loading
Loading