Esempio n. 1
0
    def _post_clear_config_sessions(
        self,
        response: ScrapliCfgResponse,
        scrapli_responses: Iterable[Response],
    ) -> ScrapliCfgResponse:
        """
        Handle post "clear_config_sessions" operations for parity between sync and async

        Args:
            response: response object to update
            scrapli_responses: list of scrapli response objects from fetching the version

        Returns:
            ScrapliCfgResponse: response object containing string of the version as the `result`
                attribute

        Raises:
            N/A

        """
        response.record_response(scrapli_responses=scrapli_responses)

        if response.failed:
            msg = "failed to clear device configuration session(s)"
            self.logger.critical(msg)
            response.result = msg
        else:
            response.result = "configuration session(s) cleared"

        return response
Esempio n. 2
0
 async def _get_config(cls, source):
     nonlocal get_config_called
     get_config_called = True
     response = ScrapliCfgResponse(host="localhost")
     response.result = "blah\nmatchthisline\nanotherblah"
     return response