Skip to content

Instantly share code, notes, and snippets.

View sk2's full-sized avatar

Simon Knight sk2

  • Adelaide, Australia
View GitHub Profile
@sk2
sk2 / gist:6daa4e147a6ce453c462
Created January 8, 2015 03:37
Collecting .virl topology and parsing node structure
url = "http://%s:19399/simengine/rest/export/%s?updated=1" % (
STD_SERVER, simulation_id)
topology = do_rest_call(auth_data, url)
print "Got topology for %s" % simulation_id
import xml.etree.ElementTree as ET
root = ET.fromstring(str(response))
ET.register_namespace("virl", "http://www.cisco.com/VIRL")
virl_ns = "{http://www.cisco.com/VIRL}"
#!/usr/bin/env python
def main():
import autonetkit
anm = autonetkit.initialize("multi_edge.json")
print anm['input'].nodes()
print anm['input'].edges()
autonetkit.update_http(anm)
@sk2
sk2 / gist:11392887
Created April 29, 2014 07:25
Pyparsing indentblock incomplete grammar
bgp2.txt:
router bgp 1
bgp router-id 192.168.0.1
network 10.0.0.0/16
neighbor 192.168.0.2 remote-as 1
neighbor 192.168.0.2 update-source 192.168.0.1
neighbor 192.168.0.2 next-hop-self
neighbor 192.168.0.3 remote-as 1
neighbor 192.168.0.3 update-source 192.168.0.1
@sk2
sk2 / gist:8485393
Created January 18, 2014 02:35
Using mininet-extreme with Quagga to execute Quagga commands. Using the util/m function of mininet allows rapid execution of diagnostic and data collection commands from a script.
ubuntu@netkit:~$ ./mininet-extreme/util/m c1 vtysh -c \"show run\"
Building configuration...
Current configuration:
!
!
password bgpuser
!
router bgp 300
bgp router-id 172.0.0.21
@sk2
sk2 / ank
Last active December 13, 2015 22:19
{
"metadata": {
"name": "ank"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@sk2
sk2 / gist:1263667
Created October 5, 2011 04:52
netx hg
sudo pip install hg+http://networkx.lanl.gov/hg/networkx