Esempio n. 1
0
def main():
    """Example demonstrating basic logging with scrapli"""
    conn = IOSXEDriver(**MY_DEVICE)
    conn.open()
    print(conn.get_prompt())
    print(conn.send_command("show run | i hostname").result)
Esempio n. 2
0
args = {
    "host": device["host"],
    "port": device["port"],
    "ssh_config_file": True,
    "auth_strict_key": False,
    "keepalive_interval": device["keepalive_interval"],
    "transport": device["transport"],
    "keepalive": device["keepalive"],
}

conn = IOSXEDriver(**args)
conn.open()

print("***** Get Prompt:")
print(conn.get_prompt())

print("***** Show run | i hostname:")
result = conn.send_commands("show run | i hostname")
print(result, result[0].result)

print("***** Clear logging buffer:")
interact = [("clear logg", "Clear logging buffer [confirm]"), ("", "3560CX#")]
result = conn.send_interactive(interact)
print(result, result[0].result)

print("***** Disable Paging:")
result = conn.send_commands("term length 0")
print(result, result[0].result)

print("***** Show run:")
Esempio n. 3
0
from pathlib import Path

from device_info import iosxe_device

from scrapli.driver.core import IOSXEDriver

logging.basicConfig(
    filename=f"{Path(__file__).resolve().parents[0]}/iosxe_driver.log", level=logging.DEBUG
)
logger = logging.getLogger("scrapli")

conn = IOSXEDriver(**iosxe_device)
conn.open()

print("***** Get Prompt:")
prompt = conn.get_prompt()
print(prompt)

print("***** Show run | i hostname:")
result = conn.send_command("show run | i hostname")
print(result, result.result)

print("***** Clear logging buffer:")
interact = [("clear logg", "Clear logging buffer [confirm]"), ("", prompt)]
result = conn.send_interactive(interact)
print(result, result.result)

print("***** Show run:")
result = conn.send_command("show run")
print(result, result.result)