This file contains hidden or 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 | |
import pprint | |
from copy import copy | |
from itertools import tee, izip, dropwhile, imap, groupby, ifilterfalse | |
from operator import itemgetter | |
from netaddr import IPAddress, IPNetwork | |
from trigger.cmds import Commando | |
from trigger.netdevices import NetDevices | |
from collections import defaultdict, namedtuple | |
from graphviz import Digraph |
This file contains hidden or 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
if IPAddress(ip_addr_src) and IPAddress(ip_addr_dst): | |
def plot_path(dot): | |
def lookup_addr_routing_table(src_addr, dst_addr, routing_table): | |
root = None | |
seen = None | |
# Find the root node. | |
for route, advertisers in routing_table.items(): | |
if IPAddress(src_addr) in IPNetwork(route): | |
for advertiser in advertisers: |
This file contains hidden or 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-11-23 23:28:18+0000 [-] Log opened. | |
2016-11-23 23:28:18+0000 [-] LOADING FROM: /home/tom/trigger/netdevices.json | |
2016-11-23 23:28:18+0000 [-] LOADING DATA FROM: /home/tom/trigger/netdevices.json | |
2016-11-23 23:28:18+0000 [-] BUILDING LOADER: trigger.netdevices.loaders.filesystem.JSONLoader; WITH ARGS: [] | |
2016-11-23 23:28:18+0000 [-] TRYING LOADER: <trigger.netdevices.loaders.filesystem.JSONLoader object at 0x7f8340e9a510> | |
2016-11-23 23:28:18+0000 [-] LOADER: SUCCESS! | |
2016-11-23 23:28:18+0000 [-] LOADERS TRIED: [] | |
2016-11-23 23:28:18+0000 [-] Installing NetDevice._dict internally! | |
2016-11-23 23:28:18+0000 [-] NetDevices ACL associations: DISABLED | |
Connecting to p3.demo.localdomain. Use ^X to exit. |
This file contains hidden or 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
tom@ubuntu-xenial:~/lca17/examples/example01$ python simple.py | |
2016-11-23 23:17:11+0000 [-] Log opened. | |
2016-11-23 23:17:11+0000 [-] LOADING FROM: /home/tom/trigger/netdevices.json | |
2016-11-23 23:17:11+0000 [-] LOADING DATA FROM: /home/tom/trigger/netdevices.json | |
2016-11-23 23:17:11+0000 [-] BUILDING LOADER: trigger.netdevices.loaders.filesystem.JSONLoader; WITH ARGS: [] | |
2016-11-23 23:17:11+0000 [-] TRYING LOADER: <trigger.netdevices.loaders.filesystem.JSONLoader object at 0x7f80179db4d0> | |
2016-11-23 23:17:11+0000 [-] LOADER: SUCCESS! | |
2016-11-23 23:17:11+0000 [-] LOADERS TRIED: [] | |
2016-11-23 23:17:11+0000 [-] Installing NetDevice._dict internally! | |
2016-11-23 23:17:11+0000 [-] NetDevices ACL associations: DISABLED |
This file contains hidden or 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
tom@ubuntu-xenial:~/lca17/examples/example01$ python simple.py | |
2016-11-23 23:17:11+0000 [-] Log opened. | |
2016-11-23 23:17:11+0000 [-] LOADING FROM: /home/tom/trigger/netdevices.json | |
2016-11-23 23:17:11+0000 [-] LOADING DATA FROM: /home/tom/trigger/netdevices.json | |
2016-11-23 23:17:11+0000 [-] BUILDING LOADER: trigger.netdevices.loaders.filesystem.JSONLoader; WITH ARGS: [] | |
2016-11-23 23:17:11+0000 [-] TRYING LOADER: <trigger.netdevices.loaders.filesystem.JSONLoader object at 0x7f80179db4d0> | |
2016-11-23 23:17:11+0000 [-] LOADER: SUCCESS! | |
2016-11-23 23:17:11+0000 [-] LOADERS TRIED: [] | |
2016-11-23 23:17:11+0000 [-] Installing NetDevice._dict internally! | |
2016-11-23 23:17:11+0000 [-] NetDevices ACL associations: DISABLED |
This file contains hidden or 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
tom@ubuntu-xenial:~/lca17/examples/example01$ python simple.py | |
2016-11-23 23:17:11+0000 [-] Log opened. | |
2016-11-23 23:17:11+0000 [-] LOADING FROM: /home/tom/trigger/netdevices.json | |
2016-11-23 23:17:11+0000 [-] LOADING DATA FROM: /home/tom/trigger/netdevices.json | |
2016-11-23 23:17:11+0000 [-] BUILDING LOADER: trigger.netdevices.loaders.filesystem.JSONLoader; WITH ARGS: [] | |
2016-11-23 23:17:11+0000 [-] TRYING LOADER: <trigger.netdevices.loaders.filesystem.JSONLoader object at 0x7f80179db4d0> | |
2016-11-23 23:17:11+0000 [-] LOADER: SUCCESS! | |
2016-11-23 23:17:11+0000 [-] LOADERS TRIED: [] | |
2016-11-23 23:17:11+0000 [-] Installing NetDevice._dict internally! | |
2016-11-23 23:17:11+0000 [-] NetDevices ACL associations: DISABLED |
This file contains hidden or 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
#!/usr/bin/env python | |
import sys | |
from trigger.cmds import Commando | |
from trigger.acl import parse | |
from twisted.python import log | |
log.startLogging(sys.stdout, setStdout=False) | |
class ShowClock(Commando): |
This file contains hidden or 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 | |
import string | |
from trigger.netdevices import NetDevices | |
from twisted.internet import reactor | |
from twisted.python import log | |
log.startLogging(sys.stdout, setStdout=False) | |
nd = NetDevices() | |
devices = [nd.find("pe1.demo.localdomain"), nd.find("pe2.demo.localdomain")] |
This file contains hidden or 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
diff --git a/trigger/netdevices/__init__.py b/trigger/netdevices/__init__.py | |
index 6bb2e4b..2a656f1 100644 | |
--- a/trigger/netdevices/__init__.py | |
+++ b/trigger/netdevices/__init__.py | |
@@ -42,10 +42,8 @@ from twisted.internet import defer | |
from trigger.conf import settings | |
from trigger.utils import network, parse_node_port | |
from trigger.utils.url import parse_url | |
-from trigger.twister2 import generate_endpoint, TriggerEndpointClientFactory, IoslikeSendExpect | |
from trigger import changemgmt, exceptions, rancid |
This file contains hidden or 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
#!/usr/bin/env python | |
import sys | |
from time import sleep | |
from twisted.internet.defer import Deferred | |
from zope.interface import implements | |
from twisted.internet import reactor | |
from twisted.web.client import Agent | |
from twisted.web.http_headers import Headers | |
from twisted.internet.defer import succeed |