This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
devices: | |
- { "1.1.1.1": "cisco" } | |
- { "2.2.2.2": "cisco" } | |
- { "10.10.10.10": "cisco" } | |
- { "20.20.20.20": "cisco" } | |
- { "100.100.100.100": "cisco" } | |
- { "200.200.200.200": "cisco" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from trigger.cmds import StructuredOutput | |
from twisted.python import log | |
class ShowSNMP(StructuredOutput): | |
"""Execute 'show clock' on a list of Cisco devices.""" | |
vendors = ['cisco'] | |
commands = ['show snmp community'] | |
if __name__ == '__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ trigger git:(textfsm) ✗ py.test tests/test_textfsm.py | |
=============================================================================== test session starts =============================================================================== | |
platform darwin -- Python 2.7.9, pytest-2.8.7, py-1.4.31, pluggy-0.3.1 | |
rootdir: /Users/tom/Code/python/trigger, inifile: | |
========================================================================== no tests ran in 0.00 seconds =========================================================================== | |
ERROR: file not found: tests/test_textfsm.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2016-02-18 21:01:43+0800 [-] Log opened. | |
2016-02-18 21:01:43+0800 [-] LOADING FROM: /Users/tom/Code/python/trigger/netdevices.json | |
2016-02-18 21:01:43+0800 [-] LOADING DATA FROM: /Users/tom/Code/python/trigger/netdevices.json | |
2016-02-18 21:01:43+0800 [-] BUILDING LOADER: trigger.netdevices.loaders.filesystem.JSONLoader; WITH ARGS: [] | |
2016-02-18 21:01:43+0800 [-] TRYING LOADER: <trigger.netdevices.loaders.filesystem.JSONLoader object at 0x1029f4910> | |
2016-02-18 21:01:43+0800 [-] LOADER: SUCCESS! | |
2016-02-18 21:01:43+0800 [-] LOADERS TRIED: [] | |
2016-02-18 21:01:43+0800 [-] NetDevices ACL associations: DISABLED | |
2016-02-18 21:01:43+0800 [-] Adding r1.demo.local | |
2016-02-18 21:01:43+0800 [-] connections: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2016-02-18 21:23:16+0800 [-] Log opened. | |
2016-02-18 21:23:16+0800 [-] LOADING FROM: /Users/tom/Code/python/trigger/netdevices.json | |
2016-02-18 21:23:16+0800 [-] LOADING DATA FROM: /Users/tom/Code/python/trigger/netdevices.json | |
2016-02-18 21:23:16+0800 [-] BUILDING LOADER: trigger.netdevices.loaders.filesystem.JSONLoader; WITH ARGS: [] | |
2016-02-18 21:23:16+0800 [-] TRYING LOADER: <trigger.netdevices.loaders.filesystem.JSONLoader object at 0x100fe5910> | |
2016-02-18 21:23:16+0800 [-] LOADER: SUCCESS! | |
2016-02-18 21:23:16+0800 [-] LOADERS TRIED: [] | |
2016-02-18 21:23:16+0800 [-] NetDevices ACL associations: DISABLED | |
2016-02-18 21:23:16+0800 [-] Adding r1.demo.local | |
2016-02-18 21:23:16+0800 [-] connections: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2016-02-19 19:32:37+0800 [-] Log opened. | |
2016-02-19 19:32:37+0800 [-] LOADING FROM: /Users/tom/Code/python/trigger/netdevices.json | |
2016-02-19 19:32:37+0800 [-] LOADING DATA FROM: /Users/tom/Code/python/trigger/netdevices.json | |
2016-02-19 19:32:37+0800 [-] BUILDING LOADER: trigger.netdevices.loaders.filesystem.JSONLoader; WITH ARGS: [] | |
2016-02-19 19:32:37+0800 [-] TRYING LOADER: <trigger.netdevices.loaders.filesystem.JSONLoader object at 0x109796910> | |
2016-02-19 19:32:37+0800 [-] LOADER: SUCCESS! | |
2016-02-19 19:32:37+0800 [-] LOADERS TRIED: [] | |
2016-02-19 19:32:37+0800 [-] NetDevices ACL associations: DISABLED | |
2016-02-19 19:32:37+0800 [-] Adding r1.demo.local | |
2016-02-19 19:32:37+0800 [-] connections: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2016-02-19 19:51:49+0800 [-] Log opened. | |
2016-02-19 19:51:49+0800 [-] LOADING FROM: /Users/tom/Code/python/trigger/netdevices.json | |
2016-02-19 19:51:49+0800 [-] LOADING DATA FROM: /Users/tom/Code/python/trigger/netdevices.json | |
2016-02-19 19:51:49+0800 [-] BUILDING LOADER: trigger.netdevices.loaders.filesystem.JSONLoader; WITH ARGS: [] | |
2016-02-19 19:51:49+0800 [-] TRYING LOADER: <trigger.netdevices.loaders.filesystem.JSONLoader object at 0x10fab3910> | |
2016-02-19 19:51:49+0800 [-] LOADER: SUCCESS! | |
2016-02-19 19:51:49+0800 [-] LOADERS TRIED: [] | |
2016-02-19 19:51:49+0800 [-] NetDevices ACL associations: DISABLED | |
2016-02-19 19:51:49+0800 [-] Adding r1.demo.local | |
2016-02-19 19:51:49+0800 [-] connections: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.. _v1.5.7: | |
1.5.7 (2016-02-18) | |
================== | |
Enhancements | |
------------ | |
+ Added TextFSM parser to process unstructured CLI output. | |
+ Added a new prompt pattern to ``settings.CONTINUE_PROMPTS``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import urllib.request | |
import requests | |
import time | |
import random | |
DELAY = False | |
WEBSITES = [ | |
"http://python.org/", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@3f913c158285:/etc/trigger# /etc/trigger/bin/gnng r1.demo.local | |
/etc/trigger/trigger/changemgmt/bounce.py:44: RuntimeWarning: Bounce mappings could not be found in /etc/trigger/bounce.py. using default! | |
warnings.warn(msg, RuntimeWarning) | |
/etc/trigger/trigger/acl/autoacl.py:47: RuntimeWarning: Function autoacl() could not be found in /etc/trigger/autoacl.py, using default! | |
warnings.warn(msg, RuntimeWarning) | |
DEVICE: r1.demo.local | |
Interface | Addresses | Subnets | ACLs IN | ACLs OUT | Description | |
------------------------------------------------------------------------------- | |
GigabitEthernet1 | 10.20.1.10 | 10.20.1.0/24 | TEST-ME | | |
OlderNewer