Skip to content

Bare minimum template

Matthew Spangler edited this page Sep 17, 2021 · 1 revision

This template contains the bare minimum required to run a command, such as show running-config in this example.

# $language = "Python3"
# $interface = "1.0"

import os
import sys

global crt

script_dir = None
if 'crt' in globals():
    script_dir, script_name = os.path.split(crt.ScriptFullName)
if script_dir not in sys.path:
    sys.path.append(script_dir)
else:
    script_dir, script_name = os.path.split(os.path.realpath(__file__))

from crt_automation.sessions import CrtSession

def main():
    scrt = CrtSession(crt)
    scrt.active_session.start_cisco_session()
    sh_run_out = scrt.active_session.runner.get_command_output("show running-config")

main()

Clone this wiki locally