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

Commit

Permalink
fix docs for methods, add return value for login
Browse files Browse the repository at this point in the history
  • Loading branch information
sbasan committed Mar 4, 2024
1 parent 0e55605 commit 0f82472
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions catalystwan/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,26 @@ def state(self, state: ManagerSessionState) -> None:
self.state = ManagerSessionState.OPERATIVE
return

def restart_imminent(self):
"""
Notify session that restart is imminent.
def restart_imminent(self, restart_timeout_override: Optional[int] = None):
"""Notify session that restart is imminent.
ConnectionError and status code 503 will cause session to wait for connectivity and perform login again
Args:
restart_timeout_override (Optional[int], optional): override session property which controls restart timeout
"""
if restart_timeout_override is not None:
self.restart_timeout = restart_timeout_override
self.state = ManagerSessionState.RESTART_IMMINENT

def login(self) -> None:
"""Performs login to SDWAN Manager and fetches important server info to instance variables"""
def login(self) -> ManagerSession:
"""Performs login to SDWAN Manager and fetches important server info to instance variables
Raises:
SessionNotCreatedError: indicates session configuration is not consistent
Returns:
ManagerSession: (self)
"""

self.auth = vManageAuth(self.base_url, self.username, self.password, verify=False)
self.auth.logger = self.logger
Expand Down Expand Up @@ -248,7 +259,7 @@ def login(self) -> None:
f"Logged to vManage({self.platform_version}) as {self.username}. The session type is {self.session_type}"
)
self.cookies.set("JSESSIONID", self.auth.set_cookie.get("JSESSIONID"))
return
return self

def wait_server_ready(self, timeout: int, poll_period: int = 10) -> None:
"""Waits until server is ready for API requests with given timeout in seconds"""
Expand Down

0 comments on commit 0f82472

Please sign in to comment.