From 13e8aa20250da5e729e08088a90319a4eb059f14 Mon Sep 17 00:00:00 2001 From: nikhilkp93 <137326448+nikhilkp93@users.noreply.github.com> Date: Fri, 6 Sep 2024 05:32:43 -0700 Subject: [PATCH] creating new radius and tacacs data classes (#815) * updating radius and tacacs data classes for new changes * fix static * fix static * make vpn vpn id optional * sub class * match with parent class * match with parent class * match with parent class * snake case * description * src checks * src checks * src checks --- catalystwan/dataclasses.py | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/catalystwan/dataclasses.py b/catalystwan/dataclasses.py index 8d021625..a3e2239b 100644 --- a/catalystwan/dataclasses.py +++ b/catalystwan/dataclasses.py @@ -453,13 +453,22 @@ class RadiusServer(DataclassBase): address: str = field(metadata={FIELD_NAME: "address"}) auth_port: int = field(metadata={FIELD_NAME: "authPort"}) acct_port: int = field(metadata={FIELD_NAME: "acctPort"}) - vpn: int = field(metadata={FIELD_NAME: "vpn"}) - vpn_ip_subnet: str = field(metadata={FIELD_NAME: "vpnIpSubnet"}) + vpn: Optional[int] = field(metadata={FIELD_NAME: "vpn", "description": "required field < 20.16"}) + vpn_ip_subnet: Optional[str] = field(metadata={FIELD_NAME: "vpnIpSubnet", "description": "required field < 20.16"}) key: str = field(metadata={FIELD_NAME: "key"}) secret_key: str = field(metadata={FIELD_NAME: "secretKey"}) priority: int = field(metadata={FIELD_NAME: "priority"}) +@define(frozen=True) +class ExtendedRadiusServer(RadiusServer): + """ + Extended RADIUS server with additional fields. + """ + + source_vpn: Optional[int] = field(default=None, metadata={FIELD_NAME: "sourceVpn"}) + + @define(frozen=True) class TenantRadiusServer(DataclassBase): """ @@ -479,13 +488,22 @@ class TacacsServer(DataclassBase): address: str = field(metadata={FIELD_NAME: "address"}) auth_port: int = field(metadata={FIELD_NAME: "authPort"}) - vpn: int = field(metadata={FIELD_NAME: "vpn"}) - vpn_ip_subnet: str = field(metadata={FIELD_NAME: "vpnIpSubnet"}) + vpn: Optional[int] = field(metadata={FIELD_NAME: "vpn", "description": "required field < 20.16"}) + vpn_ip_subnet: Optional[str] = field(metadata={FIELD_NAME: "vpnIpSubnet", "description": "required field < 20.16"}) key: str = field(metadata={FIELD_NAME: "key"}) secret_key: str = field(metadata={FIELD_NAME: "secretKey"}) priority: int = field(metadata={FIELD_NAME: "priority"}) +@define(frozen=True) +class ExtendedTacacsServer(TacacsServer): + """ + Extended TACACS server with additional fields. + """ + + source_vpn: Optional[int] = field(default=None, metadata={FIELD_NAME: "sourceVpn"}) + + @define(frozen=True) class TenantTacacsServer(DataclassBase): """