From 2e626b9ec9ed8fac3cf7034897c7efb8734b0d7b Mon Sep 17 00:00:00 2001 From: Ali-aqrabawi Date: Wed, 29 May 2019 22:03:05 +0300 Subject: [PATCH] remove unrelated examples --- examples/arista_eos.py | 33 ------------------------- examples/aruba_aos_6.py | 36 --------------------------- examples/aruba_aos_8.py | 36 --------------------------- examples/cisco_asa.py | 34 ------------------------- examples/cisco_ios.py | 41 ------------------------------- examples/cisco_iosxr.py | 45 ---------------------------------- examples/cisco_nxos.py | 29 ---------------------- examples/fujitsu_switch.py | 31 ----------------------- examples/hp_comware.py | 36 --------------------------- examples/hp_comware_limited.py | 36 --------------------------- examples/juniper_junos.py | 44 --------------------------------- examples/mikrotik_routeros.py | 34 ------------------------- examples/terminal.py | 33 ------------------------- 13 files changed, 468 deletions(-) delete mode 100644 examples/arista_eos.py delete mode 100644 examples/aruba_aos_6.py delete mode 100644 examples/aruba_aos_8.py delete mode 100644 examples/cisco_asa.py delete mode 100644 examples/cisco_ios.py delete mode 100644 examples/cisco_iosxr.py delete mode 100644 examples/cisco_nxos.py delete mode 100644 examples/fujitsu_switch.py delete mode 100644 examples/hp_comware.py delete mode 100644 examples/hp_comware_limited.py delete mode 100644 examples/juniper_junos.py delete mode 100644 examples/mikrotik_routeros.py delete mode 100644 examples/terminal.py diff --git a/examples/arista_eos.py b/examples/arista_eos.py deleted file mode 100644 index e9913a4..0000000 --- a/examples/arista_eos.py +++ /dev/null @@ -1,33 +0,0 @@ -import asyncio -import logging - -import yaml - -import aionet - -config_path = 'config.yaml' - -logging.basicConfig(level=logging.INFO) -aionet.logger.setLevel(logging.DEBUG) - - -async def task(param): - async with aionet.create(**param) as arista: - # Testing sending simple command - out = await arista.send_command('show run', strip_command=True) - print(out) - # Testing sending configuration set - commands = ["vlan 1", "exit"] - out = await arista.send_config_set(commands) - print(out) - - -async def run(): - config = yaml.safe_load(open(config_path, 'r')) - devices = yaml.safe_load(open(config['device_list'], 'r')) - tasks = [task(dev) for dev in devices if dev['device_type'] == 'arista_eos'] - await asyncio.wait(tasks) - - -loop = asyncio.get_event_loop() -loop.run_until_complete(run()) diff --git a/examples/aruba_aos_6.py b/examples/aruba_aos_6.py deleted file mode 100644 index 747e8f4..0000000 --- a/examples/aruba_aos_6.py +++ /dev/null @@ -1,36 +0,0 @@ -import asyncio -import logging - -import yaml - -import aionet - -config_path = 'config.yaml' - -logging.basicConfig(level=logging.INFO) -aionet.logger.setLevel(logging.DEBUG) - - -async def task(param): - async with aionet.create(**param) as ios: - # Testing sending simple command - out = await ios.send_command("show ver") - print(out) - # Testing sending configuration set - commands = ["interface loopback", "exit"] - out = await ios.send_config_set(commands) - print(out) - # Testing sending simple command with long output - out = await ios.send_command("show run") - print(out) - - -async def run(): - config = yaml.safe_load(open(config_path, 'r')) - devices = yaml.safe_load(open(config['device_list'], 'r')) - tasks = [task(dev) for dev in devices if dev['device_type'] == 'aruba_aos_6'] - await asyncio.wait(tasks) - - -loop = asyncio.get_event_loop() -loop.run_until_complete(run()) diff --git a/examples/aruba_aos_8.py b/examples/aruba_aos_8.py deleted file mode 100644 index 0d9021b..0000000 --- a/examples/aruba_aos_8.py +++ /dev/null @@ -1,36 +0,0 @@ -import asyncio -import logging - -import yaml - -import aionet - -config_path = 'config.yaml' - -logging.basicConfig(level=logging.INFO) -aionet.logger.setLevel(logging.DEBUG) - - -async def task(param): - async with aionet.create(**param) as ios: - # Testing sending simple command - out = await ios.send_command("show ver") - print(out) - # Testing sending configuration set - commands = ["interface loopback", "exit"] - out = await ios.send_config_set(commands) - print(out) - # Testing sending simple command with long output - out = await ios.send_command("show run") - print(out) - - -async def run(): - config = yaml.safe_load(open(config_path, 'r')) - devices = yaml.safe_load(open(config['device_list'], 'r')) - tasks = [task(dev) for dev in devices if dev['device_type'] == 'aruba_aos_8'] - await asyncio.wait(tasks) - - -loop = asyncio.get_event_loop() -loop.run_until_complete(run()) diff --git a/examples/cisco_asa.py b/examples/cisco_asa.py deleted file mode 100644 index 82cc0aa..0000000 --- a/examples/cisco_asa.py +++ /dev/null @@ -1,34 +0,0 @@ -import asyncio -import logging - -import yaml - -import aionet - -config_path = 'config.yaml' - -logging.basicConfig(level=logging.INFO) -aionet.logger.setLevel(logging.DEBUG) - - -async def task(param): - async with aionet.create(**param) as asa: - # Testing sending simple command - out = await asa.send_command('show run') - print(out) - # Testing interactive dialog - out = await asa.send_command("copy r scp:", pattern=r'\[running-config\]\?', strip_command=False) - out += await asa.send_command("\n", pattern=r'\[\]\?', strip_command=False) - out += await asa.send_command("\n", strip_command=False) - print(out) - - -async def run(): - config = yaml.safe_load(open(config_path, 'r')) - devices = yaml.safe_load(open(config['device_list'], 'r')) - tasks = [task(dev) for dev in devices if dev['device_type'] == 'cisco_asa'] - await asyncio.wait(tasks) - - -loop = asyncio.get_event_loop() -loop.run_until_complete(run()) diff --git a/examples/cisco_ios.py b/examples/cisco_ios.py deleted file mode 100644 index bfd7920..0000000 --- a/examples/cisco_ios.py +++ /dev/null @@ -1,41 +0,0 @@ -import asyncio -import logging - -import yaml - -import aionet - -config_path = 'config.yaml' - -logging.basicConfig(level=logging.INFO) -aionet.logger.setLevel(logging.DEBUG) - - -async def task(param): - async with aionet.create(**param) as ios: - # Testing sending simple command - out = await ios.send_command("show ver") - print(out) - # Testing sending configuration set - commands = ["line console 0", "exit"] - out = await ios.send_config_set(commands) - print(out) - # Testing sending simple command with long output - out = await ios.send_command("show run") - print(out) - # Testing interactive dialog - out = await ios.send_command("conf", pattern=r'\[terminal\]\?', strip_command=False) - out += await ios.send_command("term", strip_command=False) - out += await ios.send_command("exit", strip_command=False, strip_prompt=False) - print(out) - - -async def run(): - config = yaml.safe_load(open(config_path, 'r')) - devices = yaml.safe_load(open(config['device_list'], 'r')) - tasks = [task(dev) for dev in devices if dev['device_type'] == 'cisco_ios'] - await asyncio.wait(tasks) - - -loop = asyncio.get_event_loop() -loop.run_until_complete(run()) diff --git a/examples/cisco_iosxr.py b/examples/cisco_iosxr.py deleted file mode 100644 index 45543dc..0000000 --- a/examples/cisco_iosxr.py +++ /dev/null @@ -1,45 +0,0 @@ -import asyncio -import logging - -import yaml - -import aionet - -config_path = 'config.yaml' - -logging.basicConfig(level=logging.INFO) -aionet.logger.setLevel(logging.DEBUG) - - -async def task(param): - async with aionet.create(**param) as iosxr: - # Testing sending simple command - out = await iosxr.send_command("show ver") - print(out) - # Testing sending simple command with long output - out = await iosxr.send_command("show run") - print(out) - # Testing sending configuration set - commands = ["interface loopback 0", "description TEST LOOPBACK"] - out = await iosxr.send_config_set(commands, with_commit=True) - print(out) - # Testing failed commit - commands = ["interface GigabitEthernet 0/0/0/0", "service-policy input 1"] - out = await iosxr.send_config_set(commands, with_commit=False) - print(out) - try: - commands = ["interface GigabitEthernet 0/0/0/0", "service-policy input 2"] - await iosxr.send_config_set(commands) - except aionet.AionetCommitError: - print("Commit Error") - - -async def run(): - config = yaml.safe_load(open(config_path, 'r')) - devices = yaml.safe_load(open(config['device_list'], 'r')) - tasks = [task(dev) for dev in devices if dev['device_type'] == 'cisco_ios_xr'] - await asyncio.gather(*tasks) - - -loop = asyncio.get_event_loop() -loop.run_until_complete(run()) diff --git a/examples/cisco_nxos.py b/examples/cisco_nxos.py deleted file mode 100644 index 038d398..0000000 --- a/examples/cisco_nxos.py +++ /dev/null @@ -1,29 +0,0 @@ -import asyncio -import logging - -import yaml - -import aionet - -config_path = 'config.yaml' - -logging.basicConfig(level=logging.INFO) -aionet.logger.setLevel(logging.DEBUG) - - -async def task(param): - async with aionet.create(**param) as nxos: - # Testing sending simple command - out = await nxos.send_command('show run', strip_command=True) - print(out) - - -async def run(): - config = yaml.safe_load(open(config_path, 'r')) - devices = yaml.safe_load(open(config['device_list'], 'r')) - tasks = [task(dev) for dev in devices if dev['device_type'] == 'cisco_nxos'] - await asyncio.wait(tasks) - - -loop = asyncio.get_event_loop() -loop.run_until_complete(run()) diff --git a/examples/fujitsu_switch.py b/examples/fujitsu_switch.py deleted file mode 100644 index 88a4b1e..0000000 --- a/examples/fujitsu_switch.py +++ /dev/null @@ -1,31 +0,0 @@ -import asyncio -import logging - -import yaml - -import aionet - -config_path = 'config.yaml' - -logging.basicConfig(level=logging.INFO) -aionet.logger.setLevel(logging.DEBUG) - -async def task(param): - async with aionet.create(**param) as fuj: - # Testing sending configuration set - out = await fuj.send_config_set(['vlan database', 'exit']) - print(out) - # Testing sending simple command - out = await fuj.send_command('show ver') - print(out) - - -async def run(): - config = yaml.safe_load(open(config_path, 'r')) - devices = yaml.safe_load(open(config['device_list'], 'r')) - tasks = [task(dev) for dev in devices if dev['device_type'] == 'fujitsu_switch'] - await asyncio.wait(tasks) - - -loop = asyncio.get_event_loop() -loop.run_until_complete(run()) diff --git a/examples/hp_comware.py b/examples/hp_comware.py deleted file mode 100644 index fefa384..0000000 --- a/examples/hp_comware.py +++ /dev/null @@ -1,36 +0,0 @@ -import asyncio -import logging - -import yaml - -import aionet - -config_path = 'config.yaml' - -logging.basicConfig(level=logging.INFO) -aionet.logger.setLevel(logging.DEBUG) - - -async def task(param): - async with aionet.create(**param) as hp: - # Testing sending simple command - out = await hp.send_command('display ver') - print(out) - # Testing sending configuration set - commands = ["Vlan 1", "quit"] - out = await hp.send_config_set(commands) - print(out) - # Testing sending simple command with long output - out = await hp.send_command('display cur') - print(out) - - -async def run(): - config = yaml.safe_load(open(config_path, 'r')) - devices = yaml.safe_load(open(config['device_list'], 'r')) - tasks = [task(dev) for dev in devices if dev['device_type'] == 'hp_comware'] - await asyncio.wait(tasks) - - -loop = asyncio.get_event_loop() -loop.run_until_complete(run()) diff --git a/examples/hp_comware_limited.py b/examples/hp_comware_limited.py deleted file mode 100644 index 80839f8..0000000 --- a/examples/hp_comware_limited.py +++ /dev/null @@ -1,36 +0,0 @@ -import asyncio -import logging - -import yaml - -import aionet - -config_path = 'config.yaml' - -logging.basicConfig(level=logging.INFO) -aionet.logger.setLevel(logging.DEBUG) - - -async def task(param): - async with aionet.create(**param) as hp: - # Testing sending simple command - out = await hp.send_command('display ver') - print(out) - # Testing sending configuration set - commands = ["Vlan 1", "quit"] - out = await hp.send_config_set(commands) - print(out) - # Testing sending simple command with long output - out = await hp.send_command('display cur') - print(out) - - -async def run(): - config = yaml.safe_load(open(config_path, 'r')) - devices = yaml.safe_load(open(config['device_list'], 'r')) - tasks = [task(dev) for dev in devices if dev['device_type'] == 'hp_comware_limited'] - await asyncio.wait(tasks) - - -loop = asyncio.get_event_loop() -loop.run_until_complete(run()) diff --git a/examples/juniper_junos.py b/examples/juniper_junos.py deleted file mode 100644 index 76a82b2..0000000 --- a/examples/juniper_junos.py +++ /dev/null @@ -1,44 +0,0 @@ -import asyncio -import logging - -import yaml - -import aionet - -config_path = 'config.yaml' - -logging.basicConfig(level=logging.INFO) -aionet.logger.setLevel(logging.DEBUG) - - -async def task(param): - async with aionet.create(**param) as junos: - # Testing sending simple command - out = await junos.send_command("show version") - print(out) - # Testing sending configuration set - commands = ["edit system", "edit login"] - out = await junos.send_config_set(commands, with_commit=True) - print(out) - # Testing sending simple command with long output - out = await junos.send_command("show config") - print(out) - # Testing interactive dialog - commands = ["set system login message 123", "delete system login message 123"] - out = await junos.send_config_set(commands, with_commit=False, exit_config_mode=False) - out += await junos.send_command("exit", pattern=r'Exit with uncommitted changes\?', strip_command=False) - out += await junos.send_command("no", strip_command=False) - out += await junos.send_command("rollback 0", strip_command=False) - out += await junos.send_command("exit configuration-mode", strip_command=False) - print(out) - - -async def run(): - config = yaml.safe_load(open(config_path, 'r')) - devices = yaml.safe_load(open(config['device_list'], 'r')) - tasks = [task(dev) for dev in devices if dev['device_type'] == 'juniper_junos'] - await asyncio.wait(tasks) - - -loop = asyncio.get_event_loop() -loop.run_until_complete(run()) diff --git a/examples/mikrotik_routeros.py b/examples/mikrotik_routeros.py deleted file mode 100644 index 74ce50f..0000000 --- a/examples/mikrotik_routeros.py +++ /dev/null @@ -1,34 +0,0 @@ -import asyncio -import logging - -import yaml - -import aionet - -config_path = 'config.yaml' - -logging.basicConfig(level=logging.INFO) -aionet.logger.setLevel(logging.DEBUG) - - -async def task(param): - async with aionet.create(**param) as routeros: - # Testing sending simple command - commands = ['/ip address', 'print', '/'] - for cmd in commands: - print(await routeros.send_command(cmd)) - - # Testing sending configuration set - out = await routeros.send_config_set(commands) - print(out) - - -async def run(): - config = yaml.safe_load(open(config_path, 'r')) - devices = yaml.safe_load(open(config['device_list'], 'r')) - tasks = [task(dev) for dev in devices if dev['device_type'] == 'mikrotik_routeros'] - await asyncio.wait(tasks) - - -loop = asyncio.get_event_loop() -loop.run_until_complete(run()) diff --git a/examples/terminal.py b/examples/terminal.py deleted file mode 100644 index 763c569..0000000 --- a/examples/terminal.py +++ /dev/null @@ -1,33 +0,0 @@ -import asyncio -import logging - -import yaml - -import aionet - -config_path = 'config.yaml' - -logging.basicConfig(level=logging.INFO) -aionet.logger.setLevel(logging.DEBUG) - - -async def task(param): - async with aionet.create(**param) as term: - # Testing sending simple command - out = await term.send_command('ls -al', strip_command=True) - print(out) - out = await term.send_command('pwd', strip_command=True) - print(out) - out = await term.send_command('echo test', strip_command=True) - print(out) - - -async def run(): - config = yaml.safe_load(open(config_path, 'r')) - devices = yaml.safe_load(open(config['device_list'], 'r')) - tasks = [task(dev) for dev in devices if dev['device_type'] == 'terminal'] - await asyncio.wait(tasks) - - -loop = asyncio.get_event_loop() -loop.run_until_complete(run())