Skip to content

Commit

Permalink
maintenance: update dependencies, add missing device models (#23)
Browse files Browse the repository at this point in the history
* update dependencies

* mypy: Enum members must be left unannotated

* mypy: Incompatible types in assignment

* mypy: Enum members must be left unannotated 2

* mypy: creation_tools

* add missing device models

* bump to 0.40.1
  • Loading branch information
sbasan authored Jan 17, 2025
1 parent 11efbdb commit 7874ae8
Show file tree
Hide file tree
Showing 17 changed files with 341 additions and 102 deletions.
20 changes: 10 additions & 10 deletions ENDPOINTS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**THIS FILE WAS AUTO-GENERATED DO NOT EDIT**

Generated for: catalystwan-0.36.1
Generated for: catalystwan-0.40.1

All URIs are relative to */dataservice*
HTTP request | Supported Versions | Method | Payload Type | Return Type | Tenancy Mode
Expand Down Expand Up @@ -522,15 +522,15 @@ GET /management/statsconfig||[**ConfigurationSettings.get_stats_config**](https:
GET /settings/configuration/vedgecloud||[**ConfigurationSettings.get_vedge_cloud**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration_settings.py#L386)||DataSequence[[**VEdgeCloud**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration_settings.py#L63)]|PROVIDER, SINGLE_TENANT
GET /settings/configuration/vmanagedatastream||[**ConfigurationSettings.get_vmanage_data_stream**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration_settings.py#L441)||DataSequence[[**VManageDataStream**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration_settings.py#L166)]|PROVIDER, SINGLE_TENANT
GET /settings/configuration/walkme||[**ConfigurationSettings.get_walkme**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration_settings.py#L500)||DataSequence[[**WalkMe**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration_settings.py#L279)]|
POST /device/action/remote-server||[**ConfigurationSoftwareActions.add_new_remote_server**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L169)|[**RemoteServer**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L45)|None|
DELETE /device/action/software/{version_id}||[**ConfigurationSoftwareActions.delete_software_from_software_repository**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L193)||None|
GET /device/action/software/images||[**ConfigurationSoftwareActions.get_list_of_all_images**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L197)||DataSequence[[**SoftwareImageDetails**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L111)]|
GET /device/action/remote-server||[**ConfigurationSoftwareActions.get_list_of_remote_servers**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L165)||DataSequence[[**RemoteServerInfo**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L70)]|
GET /device/action/remote-server/{id}||[**ConfigurationSoftwareActions.get_remote_server**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L173)||[**RemoteServerInfo**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L70)|
GET /device/action/software||[**ConfigurationSoftwareActions.get_software_images**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L185)||DataSequence[[**SoftwareImageDetails**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L111)]|
DELETE /device/action/remote-server/{id}||[**ConfigurationSoftwareActions.remove_remote_server**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L181)||None|
PUT /device/action/remote-server/{id}||[**ConfigurationSoftwareActions.update_remote_server**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L177)|[**SoftwareRemoteServer**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L100)|None|
POST /device/action/software||[**ConfigurationSoftwareActions.upload_software_from_remote_server**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L189)|[**SoftwareRemoteServer**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L100)|None|
POST /device/action/remote-server||[**ConfigurationSoftwareActions.add_new_remote_server**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L173)|[**RemoteServer**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L45)|None|
DELETE /device/action/software/{version_id}||[**ConfigurationSoftwareActions.delete_software_from_software_repository**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L197)||None|
GET /device/action/software/images||[**ConfigurationSoftwareActions.get_list_of_all_images**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L201)||DataSequence[[**SoftwareImageDetails**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L113)]|
GET /device/action/remote-server||[**ConfigurationSoftwareActions.get_list_of_remote_servers**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L169)||DataSequence[[**RemoteServerInfo**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L70)]|
GET /device/action/remote-server/{id}||[**ConfigurationSoftwareActions.get_remote_server**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L177)||[**RemoteServerInfo**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L70)|
GET /device/action/software||[**ConfigurationSoftwareActions.get_software_images**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L189)||DataSequence[[**SoftwareImageDetails**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L113)]|
DELETE /device/action/remote-server/{id}||[**ConfigurationSoftwareActions.remove_remote_server**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L185)||None|
PUT /device/action/remote-server/{id}||[**ConfigurationSoftwareActions.update_remote_server**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L181)|[**SoftwareRemoteServer**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L100)|None|
POST /device/action/software||[**ConfigurationSoftwareActions.upload_software_from_remote_server**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L193)|[**SoftwareRemoteServer**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/software_actions.py#L100)|None|
POST /template/policy/vedge||[**ConfigurationVEdgeTemplatePolicy.create_vedge_template**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/policy/vedge_template.py#L22)|[**LocalizedPolicy**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/models/policy/localized.py#L75)|[**PolicyId**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/models/policy/policy.py#L10)|
DELETE /template/policy/vedge/{id}||[**ConfigurationVEdgeTemplatePolicy.delete_vedge_template**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/policy/vedge_template.py#L26)||None|
PUT /template/policy/vedge/{id}||[**ConfigurationVEdgeTemplatePolicy.edit_vedge_template**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/endpoints/configuration/policy/vedge_template.py#L30)|[**LocalizedPolicy**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/models/policy/localized.py#L75)|[**LocalizedPolicyEditResponse**](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/catalystwan/models/policy/localized.py#L125)|
Expand Down
2 changes: 1 addition & 1 deletion catalystwan/api/templates/models/cisco_bgp_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class Ipv6Neighbor(FeatureTemplateValidator):
address: str
description: Optional[str] = None
shutdown: Optional[BoolStr] = None
remote_as: int = Field(default=None, json_schema_extra={"vmanage_key": "remote-as"})
remote_as: Optional[int] = Field(default=None, json_schema_extra={"vmanage_key": "remote-as"})
keepalive: Optional[int] = Field(default=None, json_schema_extra={"data_path": ["timers"]})
holdtime: Optional[int] = Field(default=None, json_schema_extra={"data_path": ["timers"]})
if_name: Optional[str] = Field(
Expand Down
4 changes: 2 additions & 2 deletions catalystwan/api/templates/models/cisco_snmp_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ class Target(FeatureTemplateValidator):
vpn_id: int = Field(json_schema_extra={"vmanage_key": "vpn-id"})
ip: str
port: int
community_name: str = Field(default=None, json_schema_extra={"vmanage_key": "community-name"})
community_name: Optional[str] = Field(default=None, json_schema_extra={"vmanage_key": "community-name"})
user: Optional[str] = None
source_interface: str = Field(default=None, json_schema_extra={"vmanage_key": "source-interface"})
source_interface: Optional[str] = Field(default=None, json_schema_extra={"vmanage_key": "source-interface"})
model_config = ConfigDict(populate_by_name=True)


Expand Down
4 changes: 3 additions & 1 deletion catalystwan/api/templates/models/cisco_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ class CiscoSystemModel(FeatureTemplate):
default=DeviceVariable(name="system_system_ip"), json_schema_extra={"vmanage_key": "system-ip"}
)
overlay_id: Optional[int] = Field(default=None, json_schema_extra={"vmanage_key": "overlay-id"})
site_id: int = Field(default=DeviceVariable(name="system_site_id"), json_schema_extra={"vmanage_key": "site-id"})
site_id: DeviceVariable = Field(
default=DeviceVariable(name="system_site_id"), json_schema_extra={"vmanage_key": "site-id"}
)
site_type: Optional[List[SiteType]] = Field(default=None, json_schema_extra={"vmanage_key": "site-type"})
port_offset: Optional[int] = Field(default=None, json_schema_extra={"vmanage_key": "port-offset"})
port_hop: Optional[BoolStr] = Field(default=None, json_schema_extra={"vmanage_key": "port-hop"})
Expand Down
2 changes: 1 addition & 1 deletion catalystwan/api/templates/models/cisco_vpn_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class Overload(str, Enum):
class Natpool(FeatureTemplateValidator):
name: int
prefix_length: Optional[int] = Field(default=None, json_schema_extra={"vmanage_key": "prefix-length"})
range_start: str = Field(default=None, json_schema_extra={"vmanage_key": "range-start"})
range_start: Optional[str] = Field(default=None, json_schema_extra={"vmanage_key": "range-start"})
range_end: Optional[str] = Field(default=None, json_schema_extra={"vmanage_key": "range-end"})
overload: Overload = Overload.TRUE
direction: Direction
Expand Down
4 changes: 2 additions & 2 deletions catalystwan/api/templates/models/security_vsmart_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@


class Protocol(str, Enum):
DTLS: str = "dtls"
TLS: str = "tls"
DTLS = "dtls"
TLS = "tls"


class SecurityvSmart(FeatureTemplate):
Expand Down
2 changes: 1 addition & 1 deletion catalystwan/api/templates/models/system_vsmart_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SystemVsmart(FeatureTemplate):
device_groups: Optional[str] = Field(default=None, json_schema_extra={"vmanage_key": "device-groups"})
longitude: Optional[int] = Field(default=None, ge=-180, le=180)
latitude: Optional[int] = Field(default=None, ge=-90, le=90)
system_tunnel_mtu: Optional[str] = Field(default=1024, json_schema_extra={"vmanage_key": "system-tunnel-mtu"})
system_tunnel_mtu: Optional[int] = Field(default=1024, json_schema_extra={"vmanage_key": "system-tunnel-mtu"})
location: Optional[str] = None
host_name: Optional[str] = Field(default=None, json_schema_extra={"vmanage_key": "host-name"})

Expand Down
10 changes: 7 additions & 3 deletions catalystwan/endpoints/configuration/software_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ class RemoteServerInfo(BaseModel):
class SoftwareRemoteServer(BaseModel):
model_config = ConfigDict(populate_by_name=True)

filename: str = Field(default=None, serialization_alias="fileName", validation_alias="fileName")
remote_server_id: str = Field(default=None, serialization_alias="remoteServerId", validation_alias="remoteServerId")
filename: Optional[str] = Field(default=None, serialization_alias="fileName", validation_alias="fileName")
remote_server_id: Optional[str] = Field(
default=None, serialization_alias="remoteServerId", validation_alias="remoteServerId"
)
smu_defect_id: Optional[str] = Field(
default=None, serialization_alias="smuDefectId", validation_alias="smuDefectId"
)
Expand Down Expand Up @@ -158,7 +160,9 @@ class SoftwareImageDetails(BaseModel):
vnf_properties_json: Optional[str] = Field(
default=None, serialization_alias="vnfPropertiesJson", validation_alias="vnfPropertiesJson"
)
remote_server_id: str = Field(default=None, serialization_alias="remoteServerId", validation_alias="remoteServerId")
remote_server_id: Optional[str] = Field(
default=None, serialization_alias="remoteServerId", validation_alias="remoteServerId"
)


class ConfigurationSoftwareActions(APIEndpoints):
Expand Down
4 changes: 2 additions & 2 deletions catalystwan/endpoints/configuration_dashboard_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Validation(BaseModel):
device_id: Optional[str] = Field(default=None, serialization_alias="deviceID", validation_alias="deviceID")
uuid: Optional[str] = Field(default=None, serialization_alias="uuid", validation_alias="uuid")
rid: Optional[int] = Field(default=None, serialization_alias="@rid", validation_alias="@rid")
status_id: str = Field(default=None, serialization_alias="statusId", validation_alias="statusId")
status_id: Optional[str] = Field(default=None, serialization_alias="statusId", validation_alias="statusId")
process_id: Optional[str] = Field(default=None, serialization_alias="processId", validation_alias="processId")
action_config: Optional[Union[str, Dict]] = Field(
default=None, serialization_alias="actionConfig", validation_alias="actionConfig"
Expand All @@ -74,7 +74,7 @@ class Validation(BaseModel):
request_status: Optional[str] = Field(
default=None, serialization_alias="requestStatus", validation_alias="requestStatus"
)
status: OperationStatus = Field(default=None, serialization_alias="status", validation_alias="status")
status: Optional[OperationStatus] = Field(default=None, serialization_alias="status", validation_alias="status")
order: Optional[int] = Field(default=None, serialization_alias="order", validation_alias="order")


Expand Down
2 changes: 1 addition & 1 deletion catalystwan/models/configuration/feature_profile/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class IPv4Prefix(BaseModel):
class WANIPv4StaticRoute(BaseModel):
prefix: IPv4Prefix = Field()
gateway: Global[Literal["nextHop", "null0", "dhcp"]] = Field(default=Global(value="nextHop"), alias="gateway")
next_hops: Optional[List[NextHop]] = Field(default_factory=list, alias="nextHop")
next_hops: Optional[List[NextHop]] = Field(default=None, alias="nextHop")
distance: Optional[Global[int]] = Field(default=None, alias="distance")

def set_to_next_hop(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
class ManagementVPN(BaseModel):
# TODO (mlembke): vpn_id can't have other value, it needs to be constant. How to do that?
vpn_id: Default[int] = Field(default=Default(value=512), frozen=True, alias="vpnId")
ipv4_routes: Optional[List[WANIPv4StaticRoute]] = Field(default=[], alias="ipv4Route")
ipv6_routes: Optional[List[WANIPv6StaticRoute]] = Field(default=[], alias="ipv6Route")
ipv4_routes: Optional[List[WANIPv4StaticRoute]] = Field(default=None, alias="ipv4Route")
ipv6_routes: Optional[List[WANIPv6StaticRoute]] = Field(default=None, alias="ipv6Route")
dns_ipv4: Optional[DNSIPv4] = Field(default=None, alias="dnsIpv4")
dns_ipv6: Optional[DNSIPv6] = Field(default=None, alias="dnsIpv6")
new_host_mapping: Optional[List[HostMapping]] = Field(default=[], alias="newHostMapping")
new_host_mapping: Optional[List[HostMapping]] = Field(default=None, alias="newHostMapping")
# TODO (mlembke): add interfaces
interface: Optional[Any] = Field(default=None)
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class BgpIPv4Neighbor(BaseModel):
description: Optional[Union[Global[str], Variable, Default[None]]] = None
shutdown: Optional[Union[Global[bool], Variable, Default[bool]]] = Default[bool](value=False)
remote_as: Union[Global[int], Variable] = Field(serialization_alias="remoteAs", validation_alias="remoteAs")
local_as: Union[Global[int], Variable] = Field(
local_as: Optional[Union[Global[int], Variable]] = Field(
serialization_alias="localAs", validation_alias="localAs", default=None
)
keepalive: Optional[Union[Global[int], Variable, Default[int]]] = Default[int](value=60)
Expand Down Expand Up @@ -199,7 +199,7 @@ class BgpIPv6Neighbor(BaseModel):
description: Optional[Union[Global[str], Variable, Default[None]]] = None
shutdown: Optional[Union[Global[bool], Variable, Default[bool]]] = Default[bool](value=False)
remote_as: Union[Global[int], Variable] = Field(serialization_alias="remoteAs", validation_alias="remoteAs")
local_as: Union[Global[int], Variable] = Field(
local_as: Optional[Union[Global[int], Variable]] = Field(
serialization_alias="localAs", validation_alias="localAs", default=None
)
keepalive: Optional[Union[Global[int], Variable, Default[int]]] = Default[int](value=60)
Expand Down
12 changes: 6 additions & 6 deletions catalystwan/utils/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@


class PrintColors(Enum):
RED_BACKGROUND: str = "\033[41m"
RED: str = "\033[31m"
YELLOW: str = "\033[33m"
BLUE: str = "\033[34m"
GREEN: str = "\033[32m"
NONE: str = "\033[0m"
RED_BACKGROUND = "\033[41m"
RED = "\033[31m"
YELLOW = "\033[33m"
BLUE = "\033[34m"
GREEN = "\033[32m"
NONE = "\033[0m"
4 changes: 2 additions & 2 deletions catalystwan/utils/creation_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ def filter_fields(available_fields: Iterable[str], data: Dict[str, Any]) -> Dict
return dict(filter(lambda key_value: key_value[0] in available_fields, data.items()))

data_copy = data.copy()
for field in fields(cls): # type: ignore[misc]
for field in fields(cls): # type: ignore[arg-type]
json_field_name = field.metadata.get(FIELD_NAME, None)
if json_field_name and json_field_name in data_copy:
data_copy[field.name] = data_copy.pop(json_field_name)
filtered_data = filter_fields(fields_dict(cls).keys(), data_copy)
filtered_data = filter_fields(fields_dict(cls).keys(), data_copy) # type: ignore[arg-type]
return cls(**filtered_data)


Expand Down
Loading

0 comments on commit 7874ae8

Please sign in to comment.