Skip to content

Instantly share code, notes, and snippets.

Avatar

Shintaro Kojima codeout

View GitHub Profile
View vQFX - VLAN Aware Bundle
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;
View vEOS - VLAN Based
! 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 Jul 29, 2019
inet-henge group example
View inet-henge.js
{
"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 Feb 2, 2019
Batfish network visualization with inet-henge
View batfish.html
<!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 Sep 16, 2018
Decoded sFlow data with libwireshark
View sflow_decoded.json
{
"_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 Dec 19, 2017
Example of junoser-squash.rb
View 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 Nov 20, 2017
Count BGP updates with pybgpstream
View bgpupdate_count.py
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 Nov 20, 2017
Download MRT archive from Route Views Project to load into PostgreSQL
View route_views.rb
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 Sep 4, 2017
NETWAYS/sflow のバグたち
View netways_sflow_bugs.md

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

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

NETWAYS/sflow のバグたち

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

  • 1 sflow export 中には複数flow sample 格納される
  • 1 flow sample 中には複数flow record 格納される
View count_nlri.json
{
"202.249.2.169": [
{
"aspath": "2497 701 15169 4713",
"prefixes": 31325
},
{
"aspath": "2497 701 15169 9121",
"prefixes": 10387
},