Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
it is not responsibility of that api to grab data from additional end…
Browse files Browse the repository at this point in the history
…point
  • Loading branch information
nikhilkp93 committed Nov 6, 2024
1 parent b110a9e commit 069ad16
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions catalystwan/api/mtt_aaa_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ def __str__(self) -> str:
def aaa_exists(self) -> bool:
return True if self.session.get_data(self.url_path) else False

@property
def tenant_org_name(self):
"""
Get the tenant org name
:return:
"""
return self.endpoints.configuration_settings.get_organizations().first().org

@status_ok
def add_aaa(self, tenant_aaa: TenantAAA):
""" "
Expand All @@ -71,7 +63,7 @@ def get_aaa(self) -> TenantAAA:
:param aaa:
:return:
"""
logger.debug(f"AAA config {self.tenant_org_name}")
logger.debug("AAA config")
tenant_aaa = self.session.get_data(self.url_path)
# return tenant_aaa
return create_dataclass(TenantAAA, tenant_aaa)
Expand All @@ -83,8 +75,8 @@ def del_aaa(self):
:return:
"""
if not self.aaa_exists():
raise AAAConfigNotPresent(f"No AAA config present for Tenant {self.tenant_org_name}")
logger.debug(f"Delete AAA config on tenant {self.tenant_org_name}")
raise AAAConfigNotPresent("No AAA config present for Tenant")
logger.debug("Delete AAA config on tenant")
return self.session.delete(self.url_path)

@status_ok
Expand Down Expand Up @@ -124,7 +116,7 @@ def add_radius(self, radius_server: TenantRadiusServer):
:param radius_server:
:return:
"""
logger.debug(f"Add RADIUS config {self.tenant_org_name}")
logger.debug("Add RADIUS config")
data = asdict(radius_server) # type: ignore
return self.session.post(url=self.url_path, json=data)

Expand All @@ -135,7 +127,7 @@ def put_radius(self, radius_server: TenantRadiusServer):
:param radius_server:
:return:
"""
logger.debug(f"Update RADIUS config {self.tenant_org_name}")
logger.debug("Update RADIUS config")
data = asdict(radius_server) # type: ignore
return self.session.put(url=self.url_path, json=data)

Expand All @@ -146,15 +138,15 @@ def delete_radius(self):
:param radius_server:
:return: True|False
"""
logger.debug(f"Delete RADIUS config {self.tenant_org_name}")
logger.debug("Delete RADIUS config")
return self.session.delete(self.url_path)

def get_radius(self) -> TenantRadiusServer:
"""
Retrieve Radius server
:return: TenantRadiusServer
"""
logger.debug(f"RADIUS config {self.tenant_org_name}")
logger.debug("RADIUS config")
data = self.session.get_data(self.url_path)
return create_dataclass(TenantRadiusServer, data)

Expand Down Expand Up @@ -186,7 +178,7 @@ def add_tacacs(self, tacacs_server: TenantTacacsServer):
:param tacacs_server:
:return:
"""
logger.debug(f"TACACS config {self.tenant_org_name}")
logger.debug("TACACS config")
data = asdict(tacacs_server) # type: ignore
return self.session.post(url=self.url_path, json=data)

Expand All @@ -197,7 +189,7 @@ def put_tacacs(self, tacacs_server: TenantTacacsServer):
:param tacacs_server:
:return:
"""
logger.debug(f"Update TACACS config {self.tenant_org_name}")
logger.debug("Update TACACS config")
data = asdict(tacacs_server) # type: ignore
return self.session.put(url=self.url_path, json=data)

Expand All @@ -208,7 +200,7 @@ def delete_tacacs(self):
:param tacacs_server:
:return: True|False
"""
logger.debug(f"Delete TACACS config {self.tenant_org_name}")
logger.debug("Delete TACACS config")
return self.session.delete(self.url_path)

def get_tacacs(self) -> TenantTacacsServer:
Expand Down

0 comments on commit 069ad16

Please sign in to comment.