Skip to content

Commit

Permalink
fix: mypy violations
Browse files Browse the repository at this point in the history
  • Loading branch information
sbasan committed Nov 22, 2024
1 parent 96f74d2 commit d0fc202
Show file tree
Hide file tree
Showing 17 changed files with 82 additions and 107 deletions.
10 changes: 5 additions & 5 deletions catalystwan/api/templates/models/aaa_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class RadiusServer(FeatureTemplateValidator):
json_schema_extra={"vmanage_key": "acct-port"},
description="The accounting port for the RADIUS server",
)
vpn: Optional[str] = Field(
vpn: Optional[int] = Field(
default=0,
json_schema_extra={"vmanage_key": "vpn"},
description="Set VPN in which RADIUS server is located",
Expand Down Expand Up @@ -158,7 +158,7 @@ class TacacsServer(FeatureTemplateValidator):
json_schema_extra={"vmanage_key": "auth-port"},
description="The authentication port for the TACACS+ server",
)
vpn: Optional[str] = Field(
vpn: Optional[int] = Field(
default=0,
json_schema_extra={"vmanage_key": "vpn"},
description="Set VPN in which TACACS+ server is located",
Expand All @@ -185,7 +185,7 @@ class TaskPermissions(FeatureTemplateValidator):
description="Select the task to set privileges for",
)
permission: List[TaskPermission] = Field(
default="pap",
default=["read"], # type: ignore
json_schema_extra={
"vmanage_key": "permission",
},
Expand All @@ -208,7 +208,7 @@ class UserGroup(FeatureTemplateValidator):
description="Set name of user group",
)
task: List[TaskPermissions] = Field(
default=None,
default_factory=list,
json_schema_extra={"vmanage_key": "task", "priority_order": ["mode", "permission"]},
description="Set the user group's tasks and task privileges. Skipping tasks sets all as read and write",
)
Expand All @@ -220,7 +220,7 @@ class AAAModel(FeatureTemplate):

auth_order: Optional[List[AuthenticationOrder]] = Field(
validate_default=True,
default=["local", "radius", "tacacs"],
default=["local", "radius", "tacacs"], # type: ignore
json_schema_extra={"vmanage_key": "auth-order", "data_path": ["aaa"]},
description="ServerGroups authentication order to user access",
)
Expand Down
1 change: 0 additions & 1 deletion catalystwan/api/templates/models/cisco_aaa_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ class RadiusVPN(FeatureTemplateValidator):
},
)
server_key: str = Field(
default=None,
description="Specify a RADIUS client server-key",
json_schema_extra={
"vmanage_key": "server-key",
Expand Down
2 changes: 1 addition & 1 deletion catalystwan/api/templates/models/cisco_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class CiscoSystemModel(FeatureTemplate):
overlay_id: Optional[int] = Field(
default=None, description="The overlay ID of the device.", json_schema_extra={"vmanage_key": "overlay-id"}
)
site_id: int = Field(
site_id: DeviceVariable = Field(
default=DeviceVariable(name="system_site_id"),
description="The site ID of the device.",
json_schema_extra={"vmanage_key": "site-id"},
Expand Down
1 change: 0 additions & 1 deletion catalystwan/api/templates/models/cisco_vpn_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ class Natpool(FeatureTemplateValidator):
json_schema_extra={"vmanage_key": "prefix-length"},
)
range_start: str = Field(
default=None,
description="The starting IP address for the NAT pool range.",
json_schema_extra={"vmanage_key": "range-start"},
)
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 @@ -68,7 +68,7 @@ class SystemVsmart(FeatureTemplate):
description="Geographical longitude of the vSmart controller",
)
device_groups: List[str] = Field(
default=None,
default_factory=list,
json_schema_extra={"vmanage_key": "device-groups"},
description="Device group names for the vSmart controller",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ class VpnVsmartInterfaceModel(FeatureTemplate):
model_config = ConfigDict(arbitrary_types_allowed=True, populate_by_name=True)
_docs_description: str = "vSmart VPN Interface Feature Template configuration"

if_name: str = Field(
default=None, description="The name of the interface.", json_schema_extra={"vmanage_key": "if-name"}
)
if_name: str = Field(description="The name of the interface.", json_schema_extra={"vmanage_key": "if-name"})
interface_description: Optional[str] = Field(
default=None, description="A description for the interface.", json_schema_extra={"vmanage_key": "description"}
)
Expand Down
6 changes: 3 additions & 3 deletions catalystwan/endpoints/configuration/software_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ 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: str = Field(serialization_alias="fileName", validation_alias="fileName")
remote_server_id: str = Field(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 +158,7 @@ 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: str = Field(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: str = Field(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: OperationStatus = Field(serialization_alias="status", validation_alias="status")
order: Optional[int] = Field(default=None, serialization_alias="order", validation_alias="order")


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

def set_to_next_hop(
Expand Down
Loading

0 comments on commit d0fc202

Please sign in to comment.