Skip to content

Instantly share code, notes, and snippets.

View codeout's full-sized avatar

Shintaro Kojima codeout

View GitHub Profile
version 17.4R1.16;
system {
host-name vqfx1-re;
root-authentication {
encrypted-password "xxx"; ## SECRET-DATA
ssh-rsa "ssh-rsa xxx"; ## SECRET-DATA
}
login {
user koji {
uid 2001;
! Command: show running-config
! device: veos2 (vEOS, EOS-4.22.0F)
!
! boot system flash:/vEOS-lab.swi
!
transceiver qsfp default-mode 4x10G
!
service routing protocols model multi-agent
!
hostname veos2
@codeout
codeout / inet-henge.js
Created July 29, 2019 12:15
inet-henge group example
{
"nodes": [
{ "name": "POP01-bb01", "group": "bb", "icon": "./images/router.png" },
{ "name": "POP01-bb02", "group": "bb", "icon": "./images/router.png" },
{ "name": "POP01-ag01", "group": "ag", "icon": "./images/switch.png" },
{ "name": "POP01-ag02", "group": "ag", "icon": "./images/switch.png" },
{ "name": "POP02-bb01", "group": "bb", "meta": { "loopback": "10.0.0.1" } },
{ "name": "POP02-bb02", "group": "bb" },
{ "name": "POP02-ag01", "group": "ag" },
{ "name": "POP02-ag02", "group": "ag" },
@codeout
codeout / batfish.html
Last active February 2, 2019 17:14
Batfish network visualization with inet-henge
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.js"></script>
<script src="https://inet-henge.herokuapp.com/js/cola.min.js"></script>
<script src="https://inet-henge.herokuapp.com/js/inet-henge.js"></script>
<style>
.path-label {
font-size: 7px;
@codeout
codeout / sflow_decoded.json
Created September 16, 2018 17:50
Decoded sFlow data with libwireshark
{
"_index": "packets-2018-09-16",
"_type": "pcap_file",
"_score": null,
"_source": {
"layers": {
"frame_raw": ["080027f854e2080027a13a3b0800450000f800000000fe116792a9fe0002a9fe0064c88f18c700e4b6e50000000500000001a9fe000200000000000002fe0044de260000000100000001000000b8000004cb0000020000000001000004cc000000000000020000000000000000020000000100000078000000010000006a0000000400000066020586717403020586716403884700010140450000544a9500004001aec0c0a80002c0a800010800b31d400e004d5b1d85c70008389708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30313233343536370000000003e90000001000000000000000000000000000000000", 0, 262, 0, 1],
"frame": {
"frame.encap_type": "1",
"frame.number": "1",
@codeout
codeout / junoser-squash.rb
Last active December 19, 2017 07:07
Example of junoser-squash.rb
require 'junoser'
require 'parslet'
module Junoser
module Display
class DeleteTransformer < Parslet::Transform
rule(config: simple(:config)) do
"(#{config.to_s}"
end
@codeout
codeout / bgpupdate_count.py
Created November 20, 2017 13:43
Count BGP updates with pybgpstream
from __future__ import unicode_literals, print_function, absolute_import
from _pybgpstream import BGPStream, BGPRecord, BGPElem
import re
class BgpUpdate(object):
def __init__(self, collector=None, nexthop=None, aspath=None, start=None, stop=None):
self.collector = collector
self.nexthop = nexthop
self.aspath = aspath
@codeout
codeout / route_views.rb
Last active November 20, 2017 15:14
Download MRT archive from Route Views Project to load into PostgreSQL
require 'open-uri'
require 'pg'
require 'uri'
module RouteViews
DIR = 'mrt'
BASE_URL = 'http://archive.routeviews.org'
SERVERS = {
'oregon2' => '',
'oregon3' => 'route-views3',
@codeout
codeout / netways_sflow_bugs.md
Last active September 4, 2017 04:07
NETWAYS/sflow のバグたち

既存の NETWAYS/sflow パーサーに大きめと思われるバグがあり、ユーザーの手元ではデータが壊れていると思われます。

バグは取りつつ互換にするのが理想ではありますが、テストを書きつつトランスレーターを実装するのがまあまあ手間で迷っています。

NETWAYS/sflow のバグたち

バグ1: 複数flow sample が考慮されていない

  • 1 sflow export 中には複数flow sample 格納される
  • 1 flow sample 中には複数flow record 格納される
@codeout
codeout / count_nlri.json
Last active August 25, 2017 08:21
Top100: BGP Updates of NLRI (2017-08-25 03:20-03:39 UTC) http://archive.routeviews.org/route-views.wide/bgpdata/2017.08/UPDATES/
{
"202.249.2.169": [
{
"aspath": "2497 701 15169 4713",
"prefixes": 31325
},
{
"aspath": "2497 701 15169 9121",
"prefixes": 10387
},