Skip to content

Instantly share code, notes, and snippets.

@codeout
Created February 21, 2017 17:21
Show Gist options
  • Save codeout/53b254660b0c22a202316e21af332612 to your computer and use it in GitHub Desktop.
Save codeout/53b254660b0c22a202316e21af332612 to your computer and use it in GitHub Desktop.
var Gobgp = require('gobgp');
var gobgp = new Gobgp('localhost:50051');
gobgp.addPath({family: 'ipv4-flowspec'}, 'match source 10.0.0.1/32 then discard');
// At shell:
//
// $ gobgp global rib -a ipv4-flowspec
// Network Next Hop AS_PATH Age Attrs
// *> [source:10.0.0.1/32]fictitious 00:00:12 [{Origin: ?} {Extcomms: [discard]}]
gobgp.deletePath({family: 'ipv4-flowspec'}, 'match source 10.0.0.1/32 then discard');
// At shell:
//
// $ gobgp global rib -a ipv4-flowspec
// Network not in table
gobgp.addPath({family: 'ipv4-flowspec'}, 'match destination 10.0.3.11/32 source 10.1.0.0/30 protocol udp source-port 53 then accept origin igp');
// At shell:
//
// $ gobgp global rib -a ipv4-flowspec
// Network Next Hop AS_PATH Age Attrs
// *> [destination:10.0.3.11/32][source:10.1.0.0/30][protocol: =udp][source-port: =53]fictitious 00:00:01 [{Origin: i}]
gobgp.deletePath({family: 'ipv4-flowspec'}, 'match destination 10.0.3.11/32 source 10.1.0.0/30 protocol udp source-port 53 then accept origin igp');
// At shell:
//
// $ gobgp global rib -a ipv4-flowspec
// Network not in table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment