Ejemplo n.º 1
0
 #  END SNIPPET: open_vty
 """Get a timeout of the VTY on NE"""
 #  START SNIPPET: get_vty_timeout
 logger.info("VTY Time Out - %s", vtyService.timeout)
 #  END SNIPPET: get_vty_timeout
 """Write a string to the VTY on NE"""
 #  START SNIPPET: write_vty_command
 TEST_CMD1 = "show onep status"
 cli_result = vtyService.write(TEST_CMD1)
 logger.info("Test Command : %s", TEST_CMD1)
 logger.info("CLI Result for Test Command : %s", cli_result)
 #  END SNIPPET: write_vty_command
 """Get the parser state and its attributes"""
 try:
     #  START SNIPPET: get_vty_parser_state
     parser_state = vtyService.get_parser_state()
     #  END SNIPPET: get_vty_parser_state
     """Show the parser state attributes"""
     tutorial.show_parser_state_attributes(parser_state)
 except OnepRemoteProcedureException as re:
     logger.error("Error in getting parser state : ", re)
 """Get the VTY State"""
 #  START SNIPPET: get_vty_state
 logger.info("State - %s", vtyService.state)
 #  END SNIPPET: get_vty_state
 """Set the max response length"""
 #  START SNIPPET: set_vty_max_response
 MAX_RESPONSE_LENGTH = 110
 vtyService.max_response = MAX_RESPONSE_LENGTH
 logger.info("MaxResponse - %s", vtyService.max_response)
 #  END SNIPPET: set_vty_max_response