├── .gitignore ├── README.md ├── __init__.py ├── bgp ├── __init__.py ├── client.log ├── client.py ├── decision_process.py ├── decision_process_simple.py ├── peer.py ├── rib.py ├── route_server.py └── server.py ├── exabgp ├── .project ├── .pydevproject ├── .settings │ └── org.eclipse.core.resources.prefs ├── CHANGELOG ├── COPYRIGHT ├── PEP8 ├── README.md ├── ROADMAP ├── debian │ ├── NEWS.Debian │ ├── README.Debian │ ├── changelog │ ├── compat │ ├── control │ ├── copyright │ ├── exabgp.1 │ ├── exabgp.conf │ ├── exabgp.default │ ├── exabgp.dirs │ ├── exabgp.examples │ ├── exabgp.install │ ├── exabgp.manpages │ ├── exabgp.postinst │ ├── exabgp.postrm │ ├── exabgp.preinst │ ├── exabgp.prerm │ ├── init.d │ ├── rules │ └── source │ │ ├── format │ │ └── lintian-overrides ├── dev │ ├── RFC │ │ ├── draft-ietf-grow-bmp-01.txt │ │ ├── draft-ietf-grow-bmp-07.txt │ │ ├── draft-ietf-idr-add-paths-07.txt │ │ ├── draft-ietf-idr-aigp-10.txt │ │ ├── draft-ietf-idr-bgp-enhanced-route-refresh-04.txt │ │ ├── draft-ietf-idr-bgp-multisession-06.txt │ │ ├── draft-ietf-idr-flow-spec-v6-03.txt │ │ ├── draft-ietf-idr-flowspec-redirect-ip-00.txt │ │ ├── draft-ietf-idr-ix-bgp-route-server-03.txt │ │ ├── draft-ietf-idr-operational-message-00.txt │ │ ├── draft-scudder-bmp-01.txt │ │ ├── rfc1997.txt │ │ ├── rfc2385.txt │ │ ├── rfc2545.txt │ │ ├── rfc3765.txt │ │ ├── rfc4271.txt │ │ ├── rfc4360.txt │ │ ├── rfc4724.txt │ │ ├── rfc4760.txt │ │ ├── rfc4893.txt │ │ ├── rfc5396.txt │ │ ├── rfc5492.txt │ │ ├── rfc5575.txt │ │ ├── rfc6286.txt │ │ └── rfc6608.txt │ ├── apitest │ │ ├── operational-print.py │ │ ├── operational-receive │ │ ├── operational-receive.conf │ │ ├── operational-send │ │ ├── operational-send.conf │ │ └── operational-send.py │ ├── bin │ │ ├── convert-hexdump-raw │ │ ├── exabgp-coverage │ │ ├── format-raw-bmp-hexdump │ │ ├── ibgp │ │ ├── ibgp-open-only │ │ ├── python-profile │ │ ├── python-stats │ │ ├── recorder-connect │ │ ├── recorder-listener │ │ ├── replay-connect │ │ ├── runtest │ │ ├── selfcheck │ │ └── unittest │ ├── configuration │ │ ├── first.exa │ │ └── first.json │ ├── profile │ │ ├── analyse │ │ └── pyprof2calltree.py │ ├── release │ │ ├── debian │ │ └── google │ ├── runtest │ │ ├── api-add-remove.conf │ │ ├── api-add-remove.run │ │ ├── api-add-remove.sequence │ │ ├── api-announcement.conf │ │ ├── api-announcement.run │ │ ├── api-announcement.sequence │ │ ├── api-fast.conf │ │ ├── api-fast.run │ │ ├── api-fast.sequence │ │ ├── api-flow.conf │ │ ├── api-flow.run │ │ ├── api-flow.sequence │ │ ├── api-multisession.conf │ │ ├── api-multisession.run │ │ ├── api-multisession.sequence │ │ ├── api-nexthop-self.conf │ │ ├── api-nexthop-self.run │ │ ├── api-nexthop-self.sequence │ │ ├── api-teardown.conf │ │ ├── api-teardown.run │ │ ├── api-teardown.sequence │ │ ├── api-vpnv4.conf │ │ ├── api-vpnv4.run │ │ ├── api-vpnv4.sequence │ │ ├── flow.conf │ │ ├── flow.sequence │ │ ├── generic-attribute.conf │ │ ├── generic-attribute.sequence │ │ ├── group.conf │ │ ├── group.sequence │ │ ├── ipv46routes4family.conf │ │ ├── ipv46routes4family.sequence │ │ ├── ipv46routes6family.conf │ │ ├── ipv46routes6family.sequence │ │ ├── parity.conf │ │ ├── parity.sequence │ │ ├── path-information.conf │ │ ├── path-information.sequence │ │ ├── skip.conf │ │ ├── watchdog.conf │ │ ├── watchdog.run │ │ └── watchdog.sequence │ ├── sbin │ │ └── ibgp-check │ ├── self │ │ ├── api │ │ │ ├── check-all-ok-text │ │ │ ├── first │ │ │ ├── first.template │ │ │ ├── second │ │ │ └── second.template │ │ ├── attribute │ │ │ ├── api-internet.py │ │ │ ├── receive │ │ │ ├── send │ │ │ └── send.template │ │ ├── big │ │ │ ├── api-internet.py │ │ │ ├── dump-all.py │ │ │ ├── dump-number.py │ │ │ ├── dump-to-screen.py │ │ │ ├── receive │ │ │ ├── receive.template │ │ │ ├── send │ │ │ └── send.template │ │ ├── load │ │ │ ├── api-internet.py │ │ │ ├── dump-all.py │ │ │ ├── dump-number.py │ │ │ ├── dump-to-screen.py │ │ │ ├── receive │ │ │ ├── receive.template │ │ │ ├── send │ │ │ └── send.template │ │ ├── refresh │ │ │ ├── first │ │ │ ├── first.template │ │ │ ├── re-ask.py │ │ │ ├── second │ │ │ └── second.template │ │ └── simple │ │ │ ├── first │ │ │ ├── first.template │ │ │ ├── second │ │ │ └── second.template │ ├── static │ │ ├── checker │ │ ├── flakes │ │ └── lint │ ├── unittest │ │ ├── configuration.py │ │ ├── decode-route.py │ │ ├── delta.py │ │ ├── flow.py │ │ ├── loader.py │ │ ├── open.py │ │ ├── protocol.py │ │ ├── structure.py │ │ ├── supervisor.py │ │ ├── table.py │ │ └── update.py │ └── unittest2 │ │ ├── configuration-validation.py │ │ ├── connection.py │ │ ├── json-parser.py │ │ └── run ├── etc │ ├── cisco │ │ └── ibgp4-helper.txt │ ├── exabgp │ │ ├── dual-neighbor.txt │ │ ├── ebgp4-asn32.txt │ │ ├── ebgp4-cisco.txt │ │ ├── ebgp4-collector.txt │ │ ├── ebgp4-family.txt │ │ ├── ebgp4-juniper-flow.txt │ │ ├── ebgp4-large.txt │ │ ├── ebgp4-multisession.txt │ │ ├── ebgp4-peer-update.txt │ │ ├── ebgp4-selfcheck │ │ ├── ebgp4-simple.txt │ │ ├── ebgp6-simple.txt │ │ ├── exabgp.env │ │ ├── ibgp4-add-path-receive │ │ ├── ibgp4-add-path-sendreceive │ │ ├── ibgp4-dynamic.txt │ │ ├── ibgp4-graceful.txt │ │ ├── ibgp4-group-updates.txt │ │ ├── ibgp4-group.txt │ │ ├── ibgp4-healthcheck.txt │ │ ├── ibgp4-holdtime.txt │ │ ├── ibgp4-label4.txt │ │ ├── ibgp4-md5.txt │ │ ├── ibgp4-multiple-process.txt │ │ ├── ibgp4-parse.txt │ │ ├── ibgp4-simple.txt │ │ ├── ibgp4-split.txt │ │ ├── ibgp4-tcpcontrol.txt │ │ ├── ibgp4-ttl.txt │ │ ├── ibgp4-watchdog-dynamic.txt │ │ ├── ibgp4-watchdog.txt │ │ ├── ibgp4-withdrawn.txt │ │ ├── ibgp6-simple.txt │ │ ├── processes │ │ │ ├── dynamic-1.pl │ │ │ ├── dynamic-1.sh │ │ │ ├── healthcheck.py │ │ │ ├── read-write.py │ │ │ ├── syslog-1.py │ │ │ ├── tcp-server │ │ │ ├── watchdog-1.pl │ │ │ └── watchdog-1.sh │ │ └── rs │ │ │ ├── exabgp-rs.conf │ │ │ ├── rs.log │ │ │ ├── rs.msg │ │ │ ├── rs.py │ │ │ └── util.py │ ├── quagga │ │ ├── ebgpd.conf.v4 │ │ ├── ebgpd.conf.v46 │ │ ├── ebgpd.conf.v6 │ │ ├── ibgpd.conf.v4.md5 │ │ ├── ibgpd.conf.v4.parse │ │ ├── ibgpd.conf.v4.parse.large │ │ └── ibgpd.conf.v46 │ └── systemd │ │ └── exabgp.service ├── lib │ ├── exabgp │ │ ├── __init__.py │ │ ├── application │ │ │ ├── bgp.py │ │ │ └── bmp.py │ │ ├── bgp │ │ │ ├── __init__.py │ │ │ ├── message │ │ │ │ ├── __init__.py │ │ │ │ ├── direction.py │ │ │ │ ├── keepalive.py │ │ │ │ ├── nop.py │ │ │ │ ├── notification.py │ │ │ │ ├── open │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── asn.py │ │ │ │ │ ├── capability │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── addpath.py │ │ │ │ │ │ ├── graceful.py │ │ │ │ │ │ ├── id.py │ │ │ │ │ │ ├── mp.py │ │ │ │ │ │ ├── ms.py │ │ │ │ │ │ ├── negotiated.py │ │ │ │ │ │ ├── operational.py │ │ │ │ │ │ └── refresh.py │ │ │ │ │ ├── holdtime.py │ │ │ │ │ ├── routerid.py │ │ │ │ │ └── version.py │ │ │ │ ├── operational.py │ │ │ │ ├── refresh.py │ │ │ │ ├── unknown.py │ │ │ │ └── update │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── attribute │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── aggregator.py │ │ │ │ │ ├── aigp.py │ │ │ │ │ ├── aspath.py │ │ │ │ │ ├── atomicaggregate.py │ │ │ │ │ ├── clusterlist.py │ │ │ │ │ ├── communities.py │ │ │ │ │ ├── flag.py │ │ │ │ │ ├── id.py │ │ │ │ │ ├── localpref.py │ │ │ │ │ ├── med.py │ │ │ │ │ ├── mprnlri.py │ │ │ │ │ ├── mpurnlri.py │ │ │ │ │ ├── nexthop.py │ │ │ │ │ ├── origin.py │ │ │ │ │ ├── originatorid.py │ │ │ │ │ └── unknown.py │ │ │ │ │ ├── attributes │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── factory.py │ │ │ │ │ ├── eor.py │ │ │ │ │ ├── factory.py │ │ │ │ │ └── nlri │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── bgp.py │ │ │ │ │ ├── eor.py │ │ │ │ │ ├── factory.py │ │ │ │ │ ├── flow.py │ │ │ │ │ └── prefix.py │ │ │ ├── neighbor.py │ │ │ └── timer.py │ │ ├── bmp │ │ │ ├── __init__.py │ │ │ ├── header.py │ │ │ ├── message.py │ │ │ ├── negotiated.py │ │ │ └── peer.py │ │ ├── compatibility │ │ │ ├── __init__.py │ │ │ ├── ipaddress.py │ │ │ └── ordereddict.py │ │ ├── configuration │ │ │ ├── __init__.py │ │ │ ├── environment.py │ │ │ ├── file.py │ │ │ ├── json.py │ │ │ ├── loader.py │ │ │ └── validation.py │ │ ├── data │ │ │ ├── __init__.py │ │ │ └── check.py │ │ ├── debug.py │ │ ├── logger.py │ │ ├── memory │ │ │ ├── __init__.py │ │ │ ├── gcdump.py │ │ │ ├── objgraph.py │ │ │ └── profiler.py │ │ ├── protocol │ │ │ ├── __init__.py │ │ │ ├── family.py │ │ │ └── ip │ │ │ │ ├── __init__.py │ │ │ │ ├── address.py │ │ │ │ ├── fragment.py │ │ │ │ ├── icmp.py │ │ │ │ ├── inet.py │ │ │ │ └── tcp │ │ │ │ ├── __init__.py │ │ │ │ └── flag.py │ │ ├── reactor │ │ │ ├── __init__.py │ │ │ ├── api │ │ │ │ ├── __init__.py │ │ │ │ ├── encoding.py │ │ │ │ └── processes.py │ │ │ ├── daemon.py │ │ │ ├── listener.py │ │ │ ├── network │ │ │ │ ├── __init__.py │ │ │ │ ├── connection.py │ │ │ │ ├── error.py │ │ │ │ ├── incoming.py │ │ │ │ ├── outgoing.py │ │ │ │ └── tcp.py │ │ │ ├── peer.py │ │ │ └── protocol.py │ │ ├── rib │ │ │ ├── __init__.py │ │ │ ├── change.py │ │ │ └── store.py │ │ ├── util │ │ │ ├── __init__.py │ │ │ ├── cache.py │ │ │ ├── coroutine.py │ │ │ ├── counter.py │ │ │ ├── enumeration.py │ │ │ ├── errstr.py │ │ │ ├── ip.py │ │ │ ├── od.py │ │ │ ├── trace.py │ │ │ └── usage.py │ │ └── version.py │ └── netlink │ │ ├── __init__.py │ │ ├── route.py │ │ └── test │ │ ├── get.py │ │ └── route.py ├── sbin │ ├── exabgp │ └── exabmp ├── service │ └── bgp-service-ip │ │ ├── log │ │ └── run │ │ └── run └── setup.py ├── examples ├── __init__.py ├── app_specific_peering │ ├── __init__.py │ ├── local.cfg │ ├── participant_A.py │ ├── participant_A_announcements.py │ ├── participant_B.py │ ├── participant_B_announcements.py │ └── participant_D.py ├── app_specific_peering_inboundTE │ ├── __init__.py │ ├── controller │ │ ├── __init__.py │ │ ├── participant_policies │ │ │ ├── __init__.py │ │ │ ├── participant_A.py │ │ │ ├── participant_B.py │ │ │ └── participant_C.py │ │ └── sdx_config │ │ │ ├── bgp.conf │ │ │ ├── sdx_global.cfg │ │ │ └── sdx_policies.cfg │ └── mininet │ │ ├── quaggacfgs │ │ ├── a1 │ │ │ ├── bgpd.conf │ │ │ ├── daemons │ │ │ ├── debian.conf │ │ │ ├── tt │ │ │ └── zebra.conf │ │ ├── b1 │ │ │ ├── bgpd.conf │ │ │ ├── daemons │ │ │ ├── debian.conf │ │ │ └── zebra.conf │ │ ├── c1 │ │ │ ├── bgpd.conf │ │ │ ├── daemons │ │ │ ├── debian.conf │ │ │ └── zebra.conf │ │ └── c2 │ │ │ ├── bgpd.conf │ │ │ ├── daemons │ │ │ ├── debian.conf │ │ │ └── zebra.conf │ │ └── sdx_mininext.py ├── gec20_demo │ ├── __init__.py │ ├── controller │ │ ├── __init__.py │ │ ├── participant_policies │ │ │ ├── __init__.py │ │ │ ├── participant_A.py │ │ │ ├── participant_B.py │ │ │ └── participant_C.py │ │ └── sdx_config │ │ │ ├── bgp.conf │ │ │ ├── sdx_global.cfg │ │ │ └── sdx_policies.cfg │ └── mininet │ │ ├── quaggacfgs │ │ ├── a1 │ │ │ ├── bgpd.conf │ │ │ ├── bgpd.conf~ │ │ │ ├── daemons │ │ │ ├── debian.conf │ │ │ ├── tt │ │ │ └── zebra.conf │ │ ├── b1 │ │ │ ├── bgpd.conf │ │ │ ├── bgpd.conf~ │ │ │ ├── daemons │ │ │ ├── debian.conf │ │ │ └── zebra.conf │ │ ├── c1 │ │ │ ├── bgpd.conf │ │ │ ├── bgpd.conf~ │ │ │ ├── daemons │ │ │ ├── debian.conf │ │ │ └── zebra.conf │ │ └── c2 │ │ │ ├── bgpd.conf │ │ │ ├── bgpd.conf~ │ │ │ ├── daemons │ │ │ ├── debian.conf │ │ │ └── zebra.conf │ │ └── sdx_mininext.py ├── inbound_traffic_engineering │ ├── __init__.py │ ├── local.cfg │ ├── participant_A.py │ ├── participant_B.py │ └── participant_C.py ├── inbound_traffic_engineering_VNH │ ├── __init__.py │ ├── local.cfg │ ├── participant_A.py │ ├── participant_B.py │ └── participant_C.py ├── inbound_traffic_engineering_ip_prefixes │ ├── __init__.py │ ├── local.cfg │ ├── participant_A.py │ ├── participant_B.py │ └── participant_C.py ├── sigcomm14_mininet │ ├── __init__.py │ ├── controller │ │ ├── __init__.py │ │ ├── participant_policies │ │ │ ├── __init__.py │ │ │ ├── participant_A.py │ │ │ ├── participant_B.py │ │ │ └── participant_C.py │ │ └── sdx_config │ │ │ ├── bgp.conf │ │ │ ├── sdx_global.cfg │ │ │ └── sdx_policies.cfg │ └── mininet │ │ ├── quaggacfgs │ │ ├── a1 │ │ │ ├── bgpd.conf │ │ │ ├── bgpd.conf~ │ │ │ ├── daemons │ │ │ ├── debian.conf │ │ │ ├── tt │ │ │ └── zebra.conf │ │ ├── b1 │ │ │ ├── bgpd.conf │ │ │ ├── bgpd.conf~ │ │ │ ├── daemons │ │ │ ├── debian.conf │ │ │ └── zebra.conf │ │ ├── c1 │ │ │ ├── bgpd.conf │ │ │ ├── bgpd.conf~ │ │ │ ├── daemons │ │ │ ├── debian.conf │ │ │ └── zebra.conf │ │ └── c2 │ │ │ ├── bgpd.conf │ │ │ ├── bgpd.conf~ │ │ │ ├── daemons │ │ │ ├── debian.conf │ │ │ └── zebra.conf │ │ └── sdx_mininext.py ├── simple │ ├── __init__.py │ ├── local.cfg │ ├── participant_A.py │ ├── participant_B.py │ └── participant_C.py ├── simple_ip_prefixes │ ├── __init__.py │ ├── local.cfg │ ├── participant_A.py │ ├── participant_B.py │ └── participant_C.py ├── traffic_offloading │ ├── __init__.py │ ├── local.cfg │ ├── participant_A.py │ ├── participant_B.py │ └── participant_C.py ├── traffic_offloading_ip_prefixes │ ├── __init__.py │ ├── local.cfg │ ├── participant_A.py │ ├── participant_B.py │ └── participant_C.py ├── vnhAssignment_example2 │ ├── __init__.py │ ├── local.cfg │ ├── participant_A.py │ ├── participant_A_announcements.py │ ├── participant_B.py │ ├── participant_B_announcements.py │ ├── participant_C.py │ └── participant_D.py └── wide_area_lb │ ├── __init__.py │ ├── local.cfg │ ├── participant_A.py │ ├── participant_A_announcements.py │ ├── participant_C.py │ └── participant_C_announcements.py ├── lib ├── __init__.py ├── bgp_interface.py ├── common.py ├── composition.py ├── core.py ├── corelib.py ├── language.py ├── policy_updates.py ├── pyreticlib.py ├── set_operations.py └── vnh_assignment.py ├── main.py ├── scripts ├── __init__.py ├── ovs-config.sh ├── sdx-setup.sh ├── sdx_mininet_simple.py ├── sdx_mininet_traffic_offloading.py ├── sigcomm14-clean.sh └── sigcomm14-demo.sh ├── stash ├── QuaggaInterface │ ├── __init__.py │ ├── bgp_update.py │ ├── json_coders.py │ ├── quagga_interface.py │ └── quagga_sender.py └── lib │ ├── __init__.py │ ├── common.py │ ├── core.py │ ├── language.py │ ├── setOperation.py │ └── vnhAssignment.py ├── tests ├── __init__.py ├── compile-time │ ├── experiment1.py │ └── sdx_global.cfg ├── parse-amsIX │ ├── getMember.py │ └── parse-amsix.py └── set-operations │ ├── test-setOperations-dummyPrefixes.py │ └── test-setOperations.py └── utils ├── __init__.py ├── arp.py └── inet.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.project 3 | *.pydevproject 4 | *.settings 5 | *.db 6 | *~ 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## SDX: A Software Defined IXP 2 | 3 | ### Using SDX 4 | 5 | ### Installation 6 | 7 | The current instructions for installing and running SDX are in an assignment for the Coursera SDN class. Please find those instructions [here](http://goo.gl/oIqVTA). 8 | 9 | We will migrate these instructions back to this page shortly. 10 | 11 | ### Dependencies 12 | 13 | * [Pyretic](https://github.com/frenetic-lang/pyretic) 14 | * Mininext 15 | * Quagga 16 | 17 | ### More Information 18 | 19 | You can read about the SDX in our [SIGCOMM 2014 paper](http://gtnoise.net/papers/2014/gupta-sigcomm2014.pdf). 20 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/__init__.py -------------------------------------------------------------------------------- /bgp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/bgp/__init__.py -------------------------------------------------------------------------------- /bgp/client.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/bgp/client.log -------------------------------------------------------------------------------- /exabgp/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | exabgp 4 | 5 | 6 | 7 | 8 | 9 | org.python.pydev.PyDevBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.python.pydev.pythonNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /exabgp/.pydevproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /${PROJECT_DIR_NAME} 5 | 6 | python 2.7 7 | Default 8 | 9 | -------------------------------------------------------------------------------- /exabgp/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//dev/unittest/configuration.py=utf-8 3 | encoding//dev/unittest/delta.py=utf-8 4 | encoding//dev/unittest/flow.py=utf-8 5 | encoding//dev/unittest/loader.py=utf-8 6 | encoding//dev/unittest/open.py=utf-8 7 | encoding//dev/unittest/supervisor.py=utf-8 8 | encoding//dev/unittest/table.py=utf-8 9 | encoding//lib/exabgp/application/bgp.py=utf-8 10 | encoding//lib/exabgp/application/bmp.py=utf-8 11 | encoding//lib/exabgp/bgp/message/update/nlri/bgp.py=utf-8 12 | encoding//lib/exabgp/bgp/message/update/nlri/flow.py=utf-8 13 | encoding//lib/exabgp/bgp/neighbor.py=utf-8 14 | encoding//lib/exabgp/configuration/file.py=utf-8 15 | encoding//lib/exabgp/logger.py=utf-8 16 | encoding//lib/exabgp/reactor/__init__.py=utf-8 17 | encoding//lib/exabgp/reactor/api/encoding.py=utf-8 18 | encoding//lib/exabgp/reactor/daemon.py=utf-8 19 | encoding//lib/exabgp/reactor/peer.py=utf-8 20 | encoding//lib/exabgp/rib/__init__.py=utf-8 21 | encoding//lib/exabgp/rib/change.py=utf-8 22 | encoding//lib/exabgp/rib/store.py=utf-8 23 | -------------------------------------------------------------------------------- /exabgp/debian/NEWS.Debian: -------------------------------------------------------------------------------- 1 | Starting with ExaBGP 3.0.0, the file /etc/exabgp/exabgp.env is used to store the environment variables to configure the ExaBGP daemon. 2 | The variables related to the daemon startup (EXABGP_RUN, DAEMON_OPTS and ETC) remain under /etc/default/exabgp. 3 | This package will autogenerate the exabgp.env file based on your previous configuration. 4 | If you let DPKG replace /etc/default/exabgp with the package version, the new file will be adapted to include your previous settings. 5 | -------------------------------------------------------------------------------- /exabgp/debian/README.Debian: -------------------------------------------------------------------------------- 1 | In all the examples stored under /usr/share/doc/exabgp/examples you will 2 | see how you can connect to different BGP speakers and use the features of ExaBGP. 3 | 4 | However, In case you would mind how to complete your setup on the network side, 5 | here is an IETF paper explaining RTBH and showing examples on different vendor platform. 6 | 7 | http://tools.ietf.org/html/draft-ietf-opsec-blackhole-urpf-00 8 | 9 | For more information please look at ExaBGP's FAQ or the related talks/slide page of its wiki. 10 | 11 | https://github.com/Exa-Networks/exabgp/wiki 12 | https://github.com/Exa-Networks/exabgp/wiki/FAQ 13 | -------------------------------------------------------------------------------- /exabgp/debian/changelog: -------------------------------------------------------------------------------- 1 | exabgp (3.2.18-0) unstable; urgency=low 2 | 3 | * latest ExaBGP release. 4 | 5 | -- Henry-Nicolas Tourneur Mon, 18 Nov 2013 14:30:00 +0000 6 | -------------------------------------------------------------------------------- /exabgp/debian/compat: -------------------------------------------------------------------------------- 1 | 8 2 | -------------------------------------------------------------------------------- /exabgp/debian/control: -------------------------------------------------------------------------------- 1 | Source: exabgp 2 | Maintainer: Henry-Nicolas Tourneur 3 | Section: net 4 | Priority: optional 5 | Build-Depends: debhelper (>= 8.9.11~), python (>= 2.6.6-7~) 6 | Standards-Version: 3.9.4 7 | X-Python-Version: >= 2.6 8 | Homepage: https://github.com/Exa-Networks/exabgp 9 | 10 | Package: exabgp 11 | Architecture: all 12 | Pre-Depends: debconf (>= 1.5.34) 13 | Depends: ${misc:Depends}, ${python:Depends}, adduser, ucf 14 | Description: BGP route injector 15 | This program is a BGP route injector. The route injector can connect 16 | using either IPv4 or IPv6 and announce both IPv4 and IPv6 routes. 17 | . 18 | Potential use are : 19 | + Injection of service IPs like AS112 announcement 20 | + Temporary route redirection: more specific routes with 21 | different next-hop 22 | + Injection of flow routes to handle DDOS 23 | -------------------------------------------------------------------------------- /exabgp/debian/copyright: -------------------------------------------------------------------------------- 1 | This work was packaged for Debian by Henry-Nicolas Tourneur on 2 | Thu, 21 Apr 2011 19:35:15 +0000 3 | 4 | It was downloaded from: https://github.com/Exa-Networks/exabgp/releases 5 | 6 | Upstream Authors: 7 | Thomas Mangin 8 | 9 | Copyright: 10 | Copyright (c) 2009-2013, Exa Networks Limited 11 | Copyright (c) 2009-2013, Thomas Mangin 12 | 13 | License: 14 | New BSD License 15 | 16 | The Debian packaging is: 17 | Copyright (C) 2011-2012 Henry-Nicolas Tourneur 18 | -------------------------------------------------------------------------------- /exabgp/debian/exabgp.conf: -------------------------------------------------------------------------------- 1 | # Created by Henry-Nicolas Tourneur(henry.nicolas@tourneur.be) 2 | # See /usr/share/doc/exabgp/examples for example config files. 3 | 4 | -------------------------------------------------------------------------------- /exabgp/debian/exabgp.default: -------------------------------------------------------------------------------- 1 | # Defaults for exabgp initscript 2 | # sourced by /etc/init.d/exabgp 3 | # installed at /etc/default/exabgp by the maintainer scripts 4 | 5 | # 6 | # This is a POSIX shell fragment 7 | # 8 | 9 | # Additional options that are passed to the Daemon. 10 | DAEMON_OPTS="/etc/exabgp/exabgp.conf" 11 | 12 | # Change this to yes when your configuration file is ready. 13 | # The configuration file is, by default, /etc/exabgp/config. 14 | # Use the examples stored under /usr/share/doc/exabgp/examples 15 | # to build your configuration file. 16 | EXABGPRUN="no" 17 | 18 | # This environement variable will tell the daemon in which folder 19 | # we store the configuration files. 20 | export ETC="/etc/exabgp/" 21 | 22 | -------------------------------------------------------------------------------- /exabgp/debian/exabgp.dirs: -------------------------------------------------------------------------------- 1 | lib 2 | -------------------------------------------------------------------------------- /exabgp/debian/exabgp.examples: -------------------------------------------------------------------------------- 1 | etc/exabgp/* 2 | -------------------------------------------------------------------------------- /exabgp/debian/exabgp.install: -------------------------------------------------------------------------------- 1 | etc/exabgp/processes/healthcheck.py etc/exabgp/processes 2 | debian/exabgp.conf etc/exabgp 3 | -------------------------------------------------------------------------------- /exabgp/debian/exabgp.manpages: -------------------------------------------------------------------------------- 1 | debian/exabgp.1 2 | -------------------------------------------------------------------------------- /exabgp/debian/exabgp.preinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | . /usr/share/debconf/confmodule 6 | 7 | if dpkg-maintscript-helper supports rm_conffile 2>/dev/null; then 8 | FILE_ONE="/etc/exabgp/processes/dynamic-1.sh" 9 | FILE_TWO="/etc/exabgp/processes/watchdog-1.sh" 10 | if ! egrep -q "$FILE_ONE" /etc/exabgp/exabgp.conf 2> /dev/null ; then dpkg-maintscript-helper rm_conffile "$FILE_ONE" -- "$@" ; fi 11 | if ! egrep -q "$FILE_TWO" /etc/exabgp/exabgp.conf 2> /dev/null ; then dpkg-maintscript-helper rm_conffile "$FILE_TWO" -- "$@" ; fi 12 | fi 13 | 14 | #DEBHELPER# 15 | 16 | exit 0 17 | -------------------------------------------------------------------------------- /exabgp/debian/exabgp.prerm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | case "$1" in 6 | upgrade) 7 | pyclean -p exabgp 8 | exit 0 9 | ;; 10 | esac 11 | 12 | #DEBHELPER# 13 | 14 | exit 0 15 | -------------------------------------------------------------------------------- /exabgp/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | %: 4 | dh $@ --with python2 5 | 6 | override_dh_auto_install: 7 | dh_auto_install -- --install-scripts=/usr/sbin 8 | rm -rf $(CURDIR)/debian/exabgp/usr/etc 9 | mv $(CURDIR)/debian/exabgp/usr/lib/systemd $(CURDIR)/debian/exabgp/lib 10 | -------------------------------------------------------------------------------- /exabgp/debian/source/format: -------------------------------------------------------------------------------- 1 | 1.0 2 | -------------------------------------------------------------------------------- /exabgp/debian/source/lintian-overrides: -------------------------------------------------------------------------------- 1 | exabgp source: empty-debian-diff 2 | -------------------------------------------------------------------------------- /exabgp/dev/apitest/operational-print.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import sys 5 | import time 6 | 7 | # When the parent dies we are seeing continual newlines, so we only access so many before stopping 8 | counter = 0 9 | 10 | while True: 11 | try: 12 | line = sys.stdin.readline().strip() 13 | if line == "": 14 | counter += 1 15 | if counter > 100: 16 | break 17 | continue 18 | 19 | counter = 0 20 | 21 | send = '\n%s %s %s\n' % ( '-'*10, line, '-'*10 ) 22 | print >> sys.stderr, send 23 | sys.stderr.flush() 24 | except KeyboardInterrupt: 25 | pass 26 | except IOError: 27 | # most likely a signal during readline 28 | pass 29 | -------------------------------------------------------------------------------- /exabgp/dev/apitest/operational-receive: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | env exabgp.tcp.bind="127.0.0.1" exabgp.tcp.port=1790 ../../sbin/exabgp operational-receive.conf $* 4 | 5 | -------------------------------------------------------------------------------- /exabgp/dev/apitest/operational-receive.conf: -------------------------------------------------------------------------------- 1 | neighbor 127.0.0.1 { 2 | router-id 4.3.2.1; 3 | local-address 127.0.0.1; 4 | local-as 1; 5 | peer-as 1; 6 | 7 | capability { 8 | operational; 9 | } 10 | process stdout { 11 | receive-operational; 12 | encoder json; 13 | run "./operational-print.py"; 14 | } 15 | flow { 16 | } 17 | static { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /exabgp/dev/apitest/operational-send: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | env exabgp.tcp.port=1790 ../../sbin/exabgp operational-send.conf $* 4 | -------------------------------------------------------------------------------- /exabgp/dev/apitest/operational-send.conf: -------------------------------------------------------------------------------- 1 | neighbor 127.0.0.1 { 2 | router-id 1.2.3.4; 3 | local-address 127.0.0.1; 4 | local-as 1; 5 | peer-as 1; 6 | 7 | capability { 8 | operational; 9 | } 10 | 11 | process operational-chatter { 12 | run ./operational-send.py; 13 | } 14 | 15 | operational { 16 | asm afi ipv4 safi unicast advisory 'Thank you for peering, noc email is noc@isp.com'; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /exabgp/dev/bin/convert-hexdump-raw: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | from struct import pack 5 | 6 | if len(sys.argv) > 2: 7 | destination = open(sys.argv[2],'w') 8 | else: 9 | destination = sys.stdout 10 | 11 | with open(sys.argv[1],'r') as record: 12 | connect = record.readline() 13 | for line in record.readlines(): 14 | split = line.rstrip().split() 15 | format = '!' +'H'*len(split) 16 | destination.write(pack(format,*[int(_,16) for _ in split])) 17 | 18 | destination.close() 19 | -------------------------------------------------------------------------------- /exabgp/dev/bin/exabgp-coverage: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | dirname=`dirname $0` 4 | 5 | case $dirname in 6 | /*) 7 | cd $dirname/.. > /dev/null 8 | path=`pwd` 9 | cd - > /dev/null 10 | ;; 11 | *) 12 | cd `pwd`/$dirname/.. > /dev/null 13 | path=`pwd` 14 | cd - > /dev/null 15 | ;; 16 | esac 17 | 18 | export PYTHONPATH=$path/lib 19 | 20 | env PYTHONPATH=./lib \ 21 | `which python` \ 22 | -m exabgp.debug \ 23 | `which coverage` \ 24 | run \ 25 | lib/exabgp/application/bgp.py \ 26 | -c $path/etc/exabgp \ 27 | $* 28 | 29 | -------------------------------------------------------------------------------- /exabgp/dev/bin/format-raw-bmp-hexdump: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | 5 | if len(sys.argv) < 3: 6 | print "usage : bmp-format raw-file pretty-file" 7 | sys.exit(1) 8 | 9 | memory = open(sys.argv[0]).read() 10 | # Yes this can use lots of memory 11 | parts = memory.split(chr(255)*16) 12 | # And that split - even more (but it is fast) 13 | 14 | with open(sys.argv[1],'w') as out: 15 | while parts: 16 | part = parts.pop(0) 17 | if len(part) > 44: 18 | data = ''.join('%02X' % ord(_) for _ in part[:-44]) 19 | data += '\n' 20 | data += ''.join('%02X' % ord(_) for _ in part[-44:]) 21 | else: 22 | data = ''.join('%02X' % ord(_) for _ in part) 23 | if parts: 24 | data += '\n' + 'F'*16 25 | out.write(data) 26 | 27 | -------------------------------------------------------------------------------- /exabgp/dev/bin/python-profile: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | python -m cProfile -o stat.prof $* 3 | -------------------------------------------------------------------------------- /exabgp/dev/bin/python-stats: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | python -m pstats stat.prof 3 | -------------------------------------------------------------------------------- /exabgp/dev/bin/replay-connect: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import sys 5 | import socket 6 | import errno 7 | from struct import pack,unpack 8 | import array 9 | 10 | try: 11 | sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 12 | server_address = (sys.argv[1], int(sys.argv[2])) 13 | print >> sys.stderr, 'connecting to %s port %s' % server_address 14 | sock.connect(server_address) 15 | except socket.error: 16 | print "failed to connect to server" 17 | sys.exit(1) 18 | 19 | with open(sys.argv[3],'r') as record: 20 | try: 21 | while True: 22 | data = record.read(10240) 23 | print "read", len(data) 24 | if not data: break 25 | sock.send(data) 26 | finally: 27 | sock.close() 28 | -------------------------------------------------------------------------------- /exabgp/dev/bin/selfcheck: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | dirname=`dirname $0` 4 | 5 | case $dirname in 6 | /*) 7 | cd $dirname/.. > /dev/null 8 | path=`pwd` 9 | cd - > /dev/null 10 | ;; 11 | *) 12 | cd `pwd`/$dirname/.. > /dev/null 13 | path=`pwd` 14 | cd - > /dev/null 15 | ;; 16 | esac 17 | 18 | export PYTHONPATH=$path/lib 19 | 20 | for conf in `ls $path/runtest/*conf` 21 | do 22 | printf " $conf" 23 | result=`env exabgp.tcp.bind='' exabgp.debug.selfcheck=true $path/../sbin/exabgp $conf 2>&1` 24 | retcode=$? 25 | problem=`echo $result | grep 'Problem with the configuration file'` 26 | 27 | if [ $retcode -eq 0 ] && [ "$problem" == "" ] 28 | then 29 | printf "\rok\n" 30 | else 31 | printf "\rfailed\n\n" 32 | echo "env exabgp.tcp.bind='' exabgp.debug.selfcheck=true exabgp.debug.configuration=1 $path/../sbin/exabgp $conf -p" 33 | printf "\n\n" 34 | fi 35 | done 36 | -------------------------------------------------------------------------------- /exabgp/dev/bin/unittest: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | dirname=`dirname $0` 4 | 5 | case $dirname in 6 | /*) 7 | cd $dirname/../.. > /dev/null 8 | path=`pwd` 9 | cd - > /dev/null 10 | ;; 11 | *) 12 | cd `pwd`/$dirname/../.. > /dev/null 13 | path=`pwd` 14 | cd - > /dev/null 15 | ;; 16 | esac 17 | 18 | export PYTHONPATH=$path/lib 19 | 20 | if [ "$INTERPRETER" != "" ] 21 | then 22 | INTERPRETER=`which $INTERPRETER` 23 | fi 24 | 25 | PYPY=`which pypy 2>/dev/null` 26 | PYTHON27=`which python2.7 2>/dev/null` 27 | PYTHON26=`which python2.6 2>/dev/null` 28 | PYTHON25=`which python2.5 2>/dev/null` 29 | PYTHON24=`which python2.4 2>/dev/null` 30 | PYTHON2=`which python2 2>/dev/null` 31 | PYTHON=`which python 2>/dev/null` 32 | 33 | if [ -f "$PYPY" ] 34 | then 35 | INTERPRETER=$PYPY 36 | elif [ -f "$PYTHON27" ] 37 | then 38 | INTERPRETER=$PYTHON27 39 | elif [ -f "$PYTHON26" ] 40 | then 41 | INTERPRETER=$PYTHON26 42 | elif [ -f "$PYTHON25" ] 43 | then 44 | INTERPRETER=$PYTHON25 45 | elif [ -f "$PYTHON24" ] 46 | then 47 | INTERPRETER=$PYTHON24 48 | elif [ -f "$PYTHON2" ] 49 | then 50 | INTERPRETER=$PYTHON2 51 | elif [ -f "$PYTHON" ] 52 | then 53 | INTERPRETER=$PYTHON 54 | else 55 | INTERPRETER=python 56 | fi 57 | 58 | exec $INTERPRETER -m exabgp.debug $* 59 | -------------------------------------------------------------------------------- /exabgp/dev/profile/analyse: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import pstats 5 | 6 | prg = sys.argv[0] 7 | 8 | try: 9 | name = sys.argv[1] 10 | except IndexError: 11 | print "%s [ []] " % prg 12 | print "%s -^" % (' '*len(prg)) 13 | sys.exit(1) 14 | 15 | try: 16 | number = int(sys.argv[2]) 17 | except ValueError: 18 | print "%s [ []] " % prg 19 | print "%s -^" % (' '*len(prg)) 20 | sys.exit(1) 21 | except IndexError: 22 | number = 0 23 | 24 | try: 25 | field = sys.argv[3] 26 | except IndexError: 27 | field = 'time' 28 | 29 | options = { 30 | 'calls' : 'call count', 31 | 'cumulative' : 'cumulative time', 32 | 'file' : 'file name', 33 | 'module' : 'file name', 34 | 'pcalls' : 'primitive call count', 35 | 'line' : 'line number', 36 | 'name' : 'function name', 37 | 'nfl' : 'name/file/line', 38 | 'stdname' : 'standard name', 39 | 'time' : 'internal time', 40 | } 41 | 42 | if field not in options: 43 | print 'invalid sorting field, valid enties are :\n%s' % '\n'.join(" %-10s : %s" % (k,v) for (k,v) in options.iteritems()) 44 | sys.exit(1) 45 | 46 | try: 47 | stats = pstats.Stats(name) 48 | except IOError: 49 | print "can not open the file %s" % name 50 | sys.exit(1) 51 | 52 | if number: 53 | print stats.strip_dirs().sort_stats(field).print_stats(number) 54 | else: 55 | print stats.print_stats() 56 | -------------------------------------------------------------------------------- /exabgp/dev/release/debian: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Small instruction set done by Henry-Nicolas Tourneur to automate testings. 4 | 5 | apt-get install build-essential dpkg-dev fakeroot lintian debhelper 6 | echo "Make sure you'r in the ExaBGP root folder" 7 | dpkg-buildpackage 8 | echo "To install your package, run dpkg -i exabgp_VERSION_all.deb" 9 | echo "You can check for packaging errors by running lintian on the .changes file." 10 | 11 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-add-remove.conf: -------------------------------------------------------------------------------- 1 | neighbor 127.0.0.1 { 2 | router-id 1.2.3.4; 3 | local-address 127.0.0.1; 4 | local-as 1; 5 | peer-as 1; 6 | graceful-restart; 7 | 8 | process announce-routes { 9 | run ./api-add-remove.run; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-add-remove.run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import time 5 | 6 | messages = [ 7 | 'announce route 1.1.0.0/24 next-hop 101.1.101.1', 8 | 'announce route 1.1.0.0/25 next-hop 101.1.101.1', 9 | 'withdraw route 1.1.0.0/24 next-hop 101.1.101.1', 10 | ] 11 | 12 | time.sleep(2) 13 | 14 | while messages: 15 | message = messages.pop(0) 16 | sys.stdout.write( message + '\n') 17 | sys.stdout.flush() 18 | time.sleep(1) 19 | 20 | while True: 21 | time.sleep(1) 22 | 23 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-add-remove.sequence: -------------------------------------------------------------------------------- 1 | 1:announce:1.1.0.0/24 2 | 1:announce:1.1.0.0/25 3 | 4 | 2:withdraw:1.1.0.0/24 5 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-announcement.conf: -------------------------------------------------------------------------------- 1 | neighbor 127.0.0.1 { 2 | router-id 1.2.3.4; 3 | local-address 127.0.0.1; 4 | local-as 1; 5 | peer-as 1; 6 | graceful-restart; 7 | 8 | process announce-routes { 9 | run ./api-announcement.run; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-announcement.run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import time 5 | 6 | messages = [ 7 | 'announce route 1.0.0.0/21 next-hop 101.1.101.1 med 200 community [2:1] split /23', 8 | 'neighbor 127.0.0.1 announce route 1.1.0.0/16 next-hop 101.1.101.1', 9 | 'neighbor 127.0.0.1 local-as 1 announce route 1.2.0.0/22 next-hop 101.1.101.1 split /24', 10 | 'neighbor 127.0.0.1 peer-as 1 announce route 1.3.0.0/24 next-hop 101.1.101.1 split /25', 11 | 'neighbor 127.0.0.1 local-ip 127.0.0.1 announce route 1.4.0.0/16 next-hop 101.1.101.1 med 200', 12 | 'neighbor 127.0.0.1 router-id 1.2.3.4 announce route 1.5.0.0/16 next-hop 101.1.101.1 community [2:1]', 13 | 'neighbor absentone local-as 1 peer-as 1 local-ip 127.0.0.1 router-id 1.2.3.4 announce route 9.9.9.9/21 next-hop 101.1.101.1 med 200 community [2:1]', 14 | 'neighbor 127.0.0.1 local-as 1 peer-as 1 local-ip 127.0.0.1 router-id 1.2.3.4 announce route 1.6.0.0/21 next-hop 101.1.101.1 med 200 community [2:1]', 15 | ] 16 | 17 | while messages: 18 | message = messages.pop(0) 19 | sys.stdout.write( message + '\n') 20 | sys.stdout.flush() 21 | time.sleep(0.1) 22 | 23 | while True: 24 | time.sleep(1) 25 | 26 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-announcement.sequence: -------------------------------------------------------------------------------- 1 | 1:announce:1.0.0.0/23 2 | 1:announce:1.0.2.0/23 3 | 1:announce:1.0.4.0/23 4 | 1:announce:1.0.6.0/23 5 | 6 | 1:announce:1.1.0.0/16 7 | 8 | 1:announce:1.2.0.0/24 9 | 1:announce:1.2.1.0/24 10 | 1:announce:1.2.2.0/24 11 | 1:announce:1.2.3.0/24 12 | 13 | 1:announce:1.3.0.0/25 14 | 1:announce:1.3.0.128/25 15 | 16 | 1:announce:1.4.0.0/16 17 | 18 | 1:announce:1.5.0.0/16 19 | 20 | 1:announce:1.6.0.0/21 21 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-fast.conf: -------------------------------------------------------------------------------- 1 | neighbor 127.0.0.1 { 2 | router-id 1.2.3.4; 3 | local-address 127.0.0.1; 4 | local-as 1; 5 | peer-as 1; 6 | graceful-restart; 7 | 8 | process announce-routes { 9 | run ./api-fast.run; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-fast.run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import time 5 | 6 | messages1 = [ 7 | 'announce route 1.1.0.0/24 next-hop 101.1.101.1 med 200', 8 | 'announce route 1.1.0.0/25 next-hop 101.1.101.1', 9 | 'withdraw route 1.1.0.0/24 next-hop 101.1.101.1', 10 | 'show routes' 11 | ] 12 | 13 | messages2 = [ 14 | 'announce route 2.2.0.0/25 next-hop 101.1.101.1', 15 | 'announce route 2.2.0.0/24 next-hop 101.1.101.1', 16 | 'withdraw route 2.2.0.0/25 next-hop 101.1.101.1', 17 | ] 18 | 19 | time.sleep(3) 20 | 21 | while messages1: 22 | message = messages1.pop(0) 23 | sys.stdout.write( message + '\n') 24 | sys.stdout.flush() 25 | 26 | time.sleep(2) 27 | 28 | while messages2: 29 | message = messages2.pop(0) 30 | sys.stdout.write( message + '\n') 31 | sys.stdout.flush() 32 | 33 | while True: 34 | sys.stdin.readline() 35 | 36 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-fast.sequence: -------------------------------------------------------------------------------- 1 | 1:announce:1.1.0.0/25 2 | 2:announce:2.2.0.0/24 3 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-flow.conf: -------------------------------------------------------------------------------- 1 | neighbor 127.0.0.1 { 2 | router-id 1.2.3.4; 3 | local-address 127.0.0.1; 4 | local-as 1; 5 | peer-as 1; 6 | 7 | family { 8 | ipv4 flow; 9 | } 10 | 11 | process announce-routes { 12 | run ./api-flow.run; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-flow.run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import time 5 | 6 | announce_flow_1 = '''\ 7 | announce flow route { 8 | match { 9 | source 10.0.0.2/32; 10 | destination 10.0.0.3/32; 11 | destination-port =3128; 12 | protocol tcp; 13 | } 14 | then { 15 | rate-limit 9600; 16 | } 17 | }'''.replace('\n','\\n') 18 | 19 | 20 | withdraw_flow_1 = '''\ 21 | withdraw flow route { 22 | match { 23 | source 10.0.0.2/32; 24 | destination 10.0.0.3/32; 25 | destination-port =3128; 26 | protocol tcp; 27 | } 28 | then { 29 | rate-limit 9600; 30 | } 31 | }'''.replace('\n','\\n') 32 | 33 | 34 | announce_flow_2 = '''\ 35 | announce flow route { 36 | match { 37 | source 10.0.0.1/32; 38 | destination 192.168.0.1/32; 39 | port =80 =8080; 40 | destination-port >8080&<8088 =3128; 41 | source-port >1024; 42 | protocol [ udp tcp ]; 43 | } 44 | then { 45 | rate-limit 9600; 46 | } 47 | }'''.replace('\n','\\n') 48 | 49 | 50 | messages = [ 51 | 'sleep', 52 | announce_flow_1, 53 | withdraw_flow_1, 54 | announce_flow_2, 55 | 'sleep', 56 | announce_flow_1, 57 | 'sleep', 58 | withdraw_flow_1, 59 | ] 60 | 61 | while messages: 62 | message = messages.pop(0) 63 | if message == 'sleep': 64 | time.sleep(3) 65 | else: 66 | sys.stdout.write( message + '\n') 67 | sys.stdout.flush() 68 | 69 | while True: 70 | time.sleep(1) 71 | 72 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-flow.sequence: -------------------------------------------------------------------------------- 1 | # flow destination 192.168.0.1/32 source 10.0.0.1/32 protocol =UDP =TCP port =80 =8080 destination-port >8080&<8088 =3128 source-port >1024 extended-community rate-limit 9600 2 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:005E:02:000000474001010040020040050400000064C010088006000046160000800E2B0001850000250120C0A8000102200A0000010301118106040150911F9005121F90541F98910C3806920400 3 | # eor 4 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:00000007900F0003000185 5 | 6 | # flow destination 10.0.0.3/32 source 10.0.0.2/32 protocol =TCP destination-port =3128 extended-community rate-limit 9600 7 | 2:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:004C:02:000000354001010040020040050400000064C010088006000046160000800E1900018500001301200A00000302200A00000203810605910C38 8 | 9 | # flow destination 10.0.0.3/32 source 10.0.0.2/32 protocol =TCP destination-port =3128 10 | 3:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0031:02:0000001A800F170001851301200A00000302200A00000203810605910C38 11 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-multisession.conf: -------------------------------------------------------------------------------- 1 | neighbor 127.0.0.1 { 2 | router-id 1.2.3.4; 3 | local-address 127.0.0.1; 4 | local-as 1; 5 | peer-as 1; 6 | multi-session; 7 | 8 | family { 9 | ipv4 unicast; 10 | } 11 | 12 | process announce-routes { 13 | run ./api-multisession.run; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-multisession.run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import time 5 | 6 | messages = [ 7 | 'announce route 1.0.0.0/24 next-hop 101.1.101.1 med 200 community [2:1]', 8 | 'neighbor 127.0.0.1 announce route 1.1.0.0/24 next-hop 101.1.101.1', 9 | 'neighbor 127.0.0.1 local-as 1 family-allowed inet4-unicast announce route 1.2.0.0/24 next-hop 101.1.101.1', 10 | 'neighbor 127.0.0.1 local-as 1 family-allowed in-open announce route 9.9.9.9/24 next-hop 101.1.101.1', 11 | 'neighbor 127.0.0.1 local-as 1 peer-as 1 local-ip 127.0.0.1 router-id 1.2.3.4 announce route 1.3.0.0/24 next-hop 101.1.101.1', 12 | ] 13 | 14 | while messages: 15 | message = messages.pop(0) 16 | sys.stdout.write( message + '\n') 17 | sys.stdout.flush() 18 | time.sleep(0.1) 19 | 20 | while True: 21 | time.sleep(1) 22 | 23 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-multisession.sequence: -------------------------------------------------------------------------------- 1 | 1:announce:1.0.0.0/24 2 | 1:announce:1.1.0.0/24 3 | 1:announce:1.2.0.0/24 4 | 1:announce:1.3.0.0/24 5 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-nexthop-self.conf: -------------------------------------------------------------------------------- 1 | neighbor 127.0.0.1 { 2 | router-id 1.2.3.4; 3 | local-address 127.0.0.1; 4 | local-as 1; 5 | peer-as 1; 6 | graceful-restart; 7 | 8 | family { 9 | ipv4 unicast; 10 | } 11 | 12 | process announce-routes { 13 | run ./api-nexthop-self.run; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-nexthop-self.run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import time 5 | 6 | messages = [ 7 | 'neighbor 127.0.0.1 announce route 1.1.0.0/16 next-hop self', 8 | 'announce route 2.2.0.0/16 next-hop self', 9 | ] 10 | 11 | while messages: 12 | message = messages.pop(0) 13 | sys.stdout.write( message + '\n') 14 | sys.stdout.flush() 15 | time.sleep(0.1) 16 | 17 | while True: 18 | time.sleep(1) 19 | 20 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-nexthop-self.sequence: -------------------------------------------------------------------------------- 1 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:00000007900F0003000101 2 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:002F:02:00000015400101004002004003047F00000140050400000064100101 3 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:002F:02:00000015400101004002004003047F00000140050400000064100202 4 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-teardown.conf: -------------------------------------------------------------------------------- 1 | neighbor 127.0.0.1 { 2 | router-id 1.2.3.4; 3 | local-address 127.0.0.1; 4 | local-as 1; 5 | peer-as 1; 6 | 7 | family { 8 | ipv4 unicast; 9 | } 10 | 11 | process announce-routes { 12 | run ./api-teardown.run; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-teardown.run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import time 5 | 6 | messages = [ 7 | ('announce route 1.1.0.0/16 next-hop 1.1.1.1',4.5), 8 | ('neighbor 127.0.0.1 teardown 4',1.5), 9 | ('announce route 2.2.0.0/16 next-hop 2.2.2.2',4.5), 10 | ('neighbor 127.0.0.1 teardown 4',1.5), 11 | ('announce route 3.3.0.0/16 next-hop 3.3.3.3',4.5), 12 | ] 13 | 14 | while messages: 15 | message,sleep = messages.pop(0) 16 | sys.stdout.write( message + '\n') 17 | sys.stdout.flush() 18 | time.sleep(sleep) 19 | 20 | while True: 21 | time.sleep(1) 22 | 23 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-teardown.sequence: -------------------------------------------------------------------------------- 1 | # the first route and inet4 unicast EOR 2 | A1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:002F:02:0000:0015:4001:0100:4002:0040:0304:0101:0101:4005:0400:0000:6410:0101 3 | A1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:0000:0007:900F:0003:0001:01 4 | # NOTIFY 5 | A2:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0015:03:0604:4164:6D69:6E69:7374:7261:7469:7665:2052:6573:6574 6 | 7 | # the first and second route and EOR 8 | B1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:002F:02:0000:0015:4001:0100:4002:0040:0304:0101:0101:4005:0400:0000:6410:0101 9 | B1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:002F:02:0000:0015:4001:0100:4002:0040:0304:0202:0202:4005:0400:0000:6410:0202 10 | B1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:0000:0007:900F:0003:0001:01 11 | # NOTIFY 12 | B2:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0029:03:0604:4164:6D69:6E69:7374:7261:7469:7665:2052:6573:6574 13 | 14 | # first and second and third route and EOR 15 | C1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:002F:02:0000:0015:4001:0100:4002:0040:0304:0101:0101:4005:0400:0000:6410:0101 16 | C1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:002F:02:0000:0015:4001:0100:4002:0040:0304:0202:0202:4005:0400:0000:6410:0202 17 | C1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:002F:02:0000:0015:4001:0100:4002:0040:0304:0303:0303:4005:0400:0000:6410:0303 18 | C1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:0000:0007:900F:0003:0001:01 19 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-vpnv4.conf: -------------------------------------------------------------------------------- 1 | neighbor 127.0.0.1 { 2 | router-id 1.2.3.4; 3 | local-address 127.0.0.1; 4 | local-as 1; 5 | peer-as 1; 6 | graceful-restart; 7 | 8 | process announce-routes { 9 | run ./api-vpnv4.run; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-vpnv4.run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import time 5 | 6 | messages = [ 7 | 'neighbor 127.0.0.1 announce route 1.4.0.0/16 rd 65000:1 next-hop 101.1.101.1 community 100:1 extended-community 0x0002FDE900000001 label 1000', 8 | 'neighbor 127.0.0.1 withdraw route 1.4.0.0/16 rd 65000:1 next-hop 101.1.101.1 community 100:1 extended-community 0x0002FDE900000001 label 1000', 9 | #'announce route 1.4.0.0/16 rd 65000:1 next-hop 101.1.101.1 community 100:1 extended-community 0x0002FDE900000001 label 1000', 10 | #'withdraw route 1.4.0.0/16 rd 65000:1 next-hop 101.1.101.1 community 100:1 extended-community 0x0002FDE900000001 label 1000', 11 | ] 12 | 13 | while messages: 14 | time.sleep(2) 15 | message = messages.pop(0) 16 | sys.stdout.write(message + '\n') 17 | sys.stdout.flush() 18 | 19 | while True: 20 | time.sleep(1) 21 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/api-vpnv4.sequence: -------------------------------------------------------------------------------- 1 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:00000007900F0003000101 2 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:00000007900F0003000102 3 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:00000007900F0003000104 4 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:00000007900F0003000180 5 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:00000007900F0003000185 6 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:00000007900F0003000186 7 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:00000007900F0003000201 8 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:00000007900F0003000280 9 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:00000007900F0003000285 10 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:00000007900F0003000286 11 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0059:02:000000424001010040020040050400000064C0080400640001C010080002FDE900000001800E1F0001800C0000000000000000650165010068003E810000FDE8000000010104 12 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:002B:02:00000014800F1100018068003E810000FDE8000000010104 13 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/generic-attribute.conf: -------------------------------------------------------------------------------- 1 | neighbor 127.0.0.1 { 2 | router-id 10.0.0.10; 3 | local-address 127.0.0.1; 4 | local-as 65533; 5 | peer-as 65533; 6 | 7 | family { 8 | ipv4 unicast; 9 | } 10 | 11 | static { 12 | # this will cause the following to be created (we detect this is a known attribute) 13 | # route 100.100.100.100 next-hop 192.168.1.100 med 100; 14 | route 100.100.100.100 next-hop 192.168.1.100 attribute [0x04 0x80 0x00000064]; 15 | 16 | # non transitive attribute, we will not even try to decode it 17 | route 101.101.101.101 next-hop 192.168.1.100 attribute [0x99 0x00 0x00000064]; 18 | 19 | # transitive attribute, we will decode it 20 | route 111.111.111.111 next-hop 192.168.1.100 attribute [0x99 0x40 0x00000064]; 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/generic-attribute.sequence: -------------------------------------------------------------------------------- 1 | 1:raw:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:0038:02:0000:001C:4001:0100:4002:0040:0304:C0A8:0164:8004:0400:0000:6440:0504:0000:0064:2064:6464:64 2 | 1:raw:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:0038:02:0000:001C:4001:0100:4002:0040:0304:C0A8:0164:4005:0400:0000:6400:9904:0000:0064:2065:6565:65 3 | 1:raw:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:0038:02:0000:001C:4001:0100:4002:0040:0304:C0A8:0164:4005:0400:0000:6440:9904:0000:0064:206F:6F6F:6F 4 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/group.conf: -------------------------------------------------------------------------------- 1 | #route 77.93.35.15/32 next-hop 10.0.0.2; 2 | 3 | group test { 4 | local-as 65533; 5 | peer-as 65533; 6 | hold-time 180; 7 | graceful-restart 1200; 8 | 9 | static { 10 | route 1.0.0.0/8 next-hop 1.1.1.1; 11 | route 2.0.0.0/8 next-hop 1.1.1.1; 12 | route 3.0.0.0/8 next-hop 1.1.1.1; 13 | route 4.0.0.0/8 next-hop 1.1.1.1; 14 | } 15 | 16 | neighbor 127.0.0.1 { 17 | description "router 2 with four routes"; 18 | router-id 127.0.0.0; 19 | local-address 127.0.0.1; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/group.sequence: -------------------------------------------------------------------------------- 1 | 1:announce:1.0.0.0/8 2 | 1:announce:2.0.0.0/8 3 | 1:announce:3.0.0.0/8 4 | 1:announce:4.0.0.0/8 5 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/ipv46routes4family.conf: -------------------------------------------------------------------------------- 1 | neighbor 127.0.0.1 { 2 | router-id 1.2.3.4; 3 | local-address 127.0.0.1; 4 | local-as 1; 5 | peer-as 1; 6 | 7 | family { 8 | ipv4 unicast; 9 | } 10 | 11 | static { 12 | route 193.0.2.1 next-hop 10.0.0.1 extended-community 72:0.0.0.1; 13 | route 2A02:B80:0:1::1/64 next-hop 2A02:B80:0:2::1 community [30740:0 30740:30740] local-preference 200; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/ipv46routes4family.sequence: -------------------------------------------------------------------------------- 1 | 1:raw:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:003C:02:0000:0020:4001:0100:4002:0040:0304:0A00:0001:4005:0400:0000:64C0:1008:0002:0048:0000:0001:20C1:0002:01 2 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/ipv46routes6family.conf: -------------------------------------------------------------------------------- 1 | neighbor 127.0.0.1 { 2 | router-id 1.2.3.4; 3 | local-address 127.0.0.1; 4 | local-as 1; 5 | peer-as 1; 6 | 7 | family { 8 | ipv6 unicast; 9 | } 10 | 11 | static { 12 | route 193.0.2.1 next-hop 10.0.0.1 extended-community 72:0.0.0.1; 13 | route 2A02:B80:0:1::1/128 next-hop 2A02:B80:0:2::1 community [30740:0 30740:30740] local-preference 200; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/ipv46routes6family.sequence: -------------------------------------------------------------------------------- 1 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF005902:0000004240010100400200400504000000C8C008087814000078147814800E26000201102A020B8000000002000000000000000100802A020B80000000010000000000000001 2 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/parity.conf: -------------------------------------------------------------------------------- 1 | neighbor 127.0.0.1 { 2 | router-id 1.2.3.4; 3 | local-address 127.0.0.1; 4 | local-as 1; 5 | peer-as 1; 6 | 7 | family { 8 | ipv6 unicast; 9 | } 10 | 11 | static { 12 | route 2001:4B50:20C0::/48 route-distinguisher 3215:583457597 as-path [ 25186 65000 64512 ] next-hop ::FFFF:81.52.17.146 originator-id 57.35.2.240 local-preference 100 community [ 65000:33 ] extended-community [ target:10283:4.249.92.120 ] label 926; 13 | route 2001:4B50:20C0::/48 { 14 | route-distinguisher 3215:583457597; 15 | as-path [ 25186 65000 64512 ]; 16 | next-hop ::FFFF:81.52.17.146; 17 | originator-id 57.35.2.240; 18 | local-preference 100; 19 | community [ 65000:33 ]; 20 | extended-community [ target:10283:4.249.92.120 ]; 21 | label 926; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/parity.sequence: -------------------------------------------------------------------------------- 1 | 1:raw:00000007900F0003000201 2 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/path-information.conf: -------------------------------------------------------------------------------- 1 | neighbor 127.0.0.1 { 2 | router-id 127.0.0.1; 3 | local-address 127.0.0.1; 4 | local-as 55219; 5 | peer-as 55219; 6 | 7 | family { 8 | ipv4 unicast; 9 | } 10 | 11 | capability { 12 | add-path send/receive; 13 | } 14 | 15 | static { 16 | route 10.0.0.10 next-hop 10.10.1.1 path-information 0.0.0.1; 17 | route 10.0.0.10 next-hop 10.10.1.2 path-information 0.0.0.2; 18 | route 10.1.0.10 next-hop 10.10.1.3 path-information 0.0.0.3; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/path-information.sequence: -------------------------------------------------------------------------------- 1 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0035:02:00000015400101004002004003040:A0A0101:40050400000064:00000001:200A00000A 2 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0035:02:00000015400101004002004003040:A0A0102:40050400000064:00000002:200A00000A 3 | 1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0035:02:00000015400101004002004003040:A0A0103:40050400000064:00000003:200A01000A 4 | 2:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:00000007900F0003000101 5 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/skip.conf: -------------------------------------------------------------------------------- 1 | neighbor 127.0.0.1 { 2 | local-as 65533; 3 | peer-as 65533; 4 | router-id 127.0.0.0; 5 | local-address 127.0.0.1; 6 | 7 | static { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/watchdog.conf: -------------------------------------------------------------------------------- 1 | neighbor 127.0.0.1 { 2 | router-id 10.0.0.10; 3 | local-address 127.0.0.1; 4 | local-as 65533; 5 | peer-as 65533; 6 | 7 | family { 8 | ipv4 unicast; 9 | } 10 | 11 | process service-watchdog { 12 | run ./watchdog.run; 13 | } 14 | 15 | static { 16 | route 66.66.66.66 next-hop 1.2.3.4; 17 | route 77.77.77.77 next-hop 1.2.3.4 watchdog dnsr withdraw; 18 | route 88.88.88.88 next-hop 1.2.3.4; 19 | route 100.100.100.100 next-hop 192.168.1.100; 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/watchdog.run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import time 5 | 6 | time.sleep(4.0) 7 | 8 | while True: 9 | print "announce watchdog dnsr" 10 | sys.stdout.flush() 11 | time.sleep(2.0) 12 | 13 | print "withdraw watchdog dnsr" 14 | sys.stdout.flush() 15 | time.sleep(2.0) 16 | -------------------------------------------------------------------------------- /exabgp/dev/runtest/watchdog.sequence: -------------------------------------------------------------------------------- 1 | 1:announce:66.66.66.66/32 2 | 1:announce:88.88.88.88/32 3 | 1:announce:100.100.100.100/32 4 | 2:announce:77.77.77.77/32 5 | 3:withdraw:77.77.77.77/32 6 | 4:announce:77.77.77.77/32 7 | 5:withdraw:77.77.77.77/32 8 | -------------------------------------------------------------------------------- /exabgp/dev/self/api/check-all-ok-text: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | 5 | match = { 6 | 0: ['neighbor 127.0.0.1 update start',] * 20, 7 | 1: ['neighbor 127.0.0.1 announced route %d%d.0.0.0/8 next-hop 1.1.1.1 origin igp as-path [ 1 2 3 4 ] med 100' % (number,number) for number in range(1,10)] + ['neighbor 127.0.0.1 announced route eor %d/%d (%s)' % (afi,safi,text) for (afi,safi,text) in [(1,1,'ipv4 unicast'),(1,2,'ipv4 multicast'),(1,4,'ipv4 nlri-mpls'),(1,128,'ipv4 mpls-vpn'),(1,133,'ipv4 flow-ipv4'),(2,1,'ipv6 unicast'),(2,128,'ipv6 mpls-vpn')]], 8 | 2: ['neighbor 127.0.0.1 update end',] * 20, 9 | 3: ['',] * 20, 10 | } 11 | 12 | count = 0 13 | 14 | while True: 15 | line = sys.stdin.readline().strip() 16 | #print >> sys.stderr, '[%s]' % line.replace('\n','\\n'), start, end 17 | 18 | options = match[count % 4] 19 | 20 | if line in options: 21 | sys.stderr.write('%-3d ok %s\n' % (count,line)) 22 | sys.stderr.flush() 23 | count += 1 24 | continue 25 | 26 | sys.stderr.write('%-3d failed %s\n' % (count,line)) 27 | sys.stderr.flush() 28 | count += 1 29 | -------------------------------------------------------------------------------- /exabgp/dev/self/api/first: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ip=`ifconfig | grep -A10 en0 | grep "inet " | head -1 | awk '{ print $2; }'` 4 | if [ "$ip" == "" ] 5 | then 6 | ip=`ifconfig | grep -A10 en1 | grep "inet " | head -1 | awk '{ print $2; }'` 7 | fi 8 | if [ "$ip" == "" ] 9 | then 10 | ip=`ifconfig | grep -A10 vnic0 | grep "inet " | head -1 | awk '{ print $2; }'` 11 | fi 12 | if [ "$ip" != "" ] 13 | then 14 | cat first.template | sed -e "s/IP/$ip/" > first.conf 15 | env exabgp.tcp.bind="127.0.0.1" exabgp.tcp.port=1790 ../../../sbin/exabgp first.conf 16 | else 17 | echo "get some IP somewhere on this machine please" 18 | fi 19 | -------------------------------------------------------------------------------- /exabgp/dev/self/api/first.template: -------------------------------------------------------------------------------- 1 | #route 77.93.35.15/32 next-hop 10.0.0.2; 2 | 3 | group test { 4 | local-as 65533; 5 | peer-as 65534; 6 | hold-time 180; 7 | graceful-restart 1200; 8 | 9 | static { 10 | route 11.0.0.0/8 next-hop 1.1.1.1 med 100 as-path [ 1 2 3 4 ]; 11 | route 22.0.0.0/8 next-hop 1.1.1.1 med 100 as-path [ 1 2 3 4 ]; 12 | route 33.0.0.0/8 next-hop 1.1.1.1 med 100 as-path [ 1 2 3 4 ]; 13 | route 44.0.0.0/8 next-hop 1.1.1.1 med 100 as-path [ 1 2 3 4 ]; 14 | route 55.0.0.0/8 next-hop 1.1.1.1 med 100 as-path [ 1 2 3 4 ]; 15 | route 66.0.0.0/8 next-hop 1.1.1.1 med 100 as-path [ 1 2 3 4 ]; 16 | route 77.0.0.0/8 next-hop 1.1.1.1 med 100 as-path [ 1 2 3 4 ]; 17 | route 88.0.0.0/8 next-hop 1.1.1.1 med 100 as-path [ 1 2 3 4 ]; 18 | route 99.0.0.0/8 next-hop 1.1.1.1 med 100 as-path [ 1 2 3 4 ]; 19 | } 20 | 21 | neighbor IP { 22 | description "router 2 with four routes"; 23 | router-id 127.0.0.0; 24 | local-address 127.0.0.1; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /exabgp/dev/self/api/second: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ip=`ifconfig | grep -A10 en0 | grep "inet " | head -1 | awk '{ print $2; }'` 4 | if [ "$ip" == "" ] 5 | then 6 | ip=`ifconfig | grep -A10 en1 | grep "inet " | head -1 | awk '{ print $2; }'` 7 | fi 8 | if [ "$ip" == "" ] 9 | then 10 | ip=`ifconfig | grep -A10 vnic0 | grep "inet " | head -1 | awk '{ print $2; }'` 11 | fi 12 | if [ "$ip" != "" ] 13 | then 14 | cat second.template | sed -e "s/IP/$ip/" > second.conf 15 | env exabgp.tcp.bind="$ip" exabgp.tcp.port=1790 ../../../sbin/exabgp second.conf 16 | else 17 | echo "get some IP somewhere on this machine please" 18 | fi 19 | -------------------------------------------------------------------------------- /exabgp/dev/self/api/second.template: -------------------------------------------------------------------------------- 1 | #route 77.93.35.15/32 next-hop 10.0.0.2; 2 | 3 | group test { 4 | local-as 65534; 5 | peer-as 65533; 6 | hold-time 180; 7 | graceful-restart 1200; 8 | 9 | process dump-all-text { 10 | receive-routes; 11 | neighbor-changes; 12 | run ./check-all-ok-text; 13 | } 14 | 15 | # process dump-all-json { 16 | # receive-routes; 17 | # run ./check-all-ok-json; 18 | # } 19 | 20 | neighbor 127.0.0.1 { 21 | description "router 2 with four routes"; 22 | router-id 128.0.0.0; 23 | local-address IP; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /exabgp/dev/self/attribute/api-internet.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import time 5 | 6 | def write (data): 7 | sys.stdout.write(data + '\n') 8 | sys.stdout.flush() 9 | 10 | def main (): 11 | msg = 'announce attribute next-hop 1.2.3.4 med 100 as-path [ 100 101 102 103 104 105 106 107 108 109 110 ] nlri %s' 12 | write(msg % ' '.join('%d.0.0.0/8' % ip for ip in range(0,224))) 13 | write(msg % ' '.join('10.%d.0.0/16' % ip for ip in range(0,256))) 14 | 15 | time.sleep(2) 16 | 17 | write('withdraw attribute next-hop 1.2.3.4 med 100 as-path [ 100 101 102 103 104 105 106 107 108 109 110 ] nlri 0.0.0.0/8 1.0.0.0/8') 18 | 19 | time.sleep(10000) 20 | 21 | if __name__ == '__main__': 22 | try: 23 | main() 24 | except KeyboardInterrupt: 25 | pass 26 | -------------------------------------------------------------------------------- /exabgp/dev/self/attribute/receive: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | env exabgp.tcp.port=1790 wires=1 ../../bin/ibgp 4 | -------------------------------------------------------------------------------- /exabgp/dev/self/attribute/send: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ip=`ifconfig | grep -A10 en0 | grep "inet " | head -1 | awk '{ print $2; }'` 4 | if [ "$ip" == "" ] 5 | then 6 | ip=`ifconfig | grep -A10 en1 | grep "inet " | head -1 | awk '{ print $2; }'` 7 | fi 8 | if [ "$ip" == "" ] 9 | then 10 | ip=`ifconfig | grep -A10 vnic0 | grep "inet " | head -1 | awk '{ print $2; }'` 11 | fi 12 | if [ "$ip" != "" ] 13 | then 14 | cat send.template | sed -e "s/IP/$ip/" > send.conf 15 | env exabgp.log.processes=false exabgp.log.reactor=false exabgp.tcp.bind="" exabgp.tcp.port=1790 ../../../sbin/exabgp send.conf $* 16 | else 17 | echo "get some IP somewhere on this machine please" 18 | fi 19 | -------------------------------------------------------------------------------- /exabgp/dev/self/attribute/send.template: -------------------------------------------------------------------------------- 1 | #route 77.93.35.15/32 next-hop 10.0.0.2; 2 | 3 | group test { 4 | local-as 65533; 5 | peer-as 65533; 6 | hold-time 180; 7 | graceful-restart 1200; 8 | 9 | process similate-the-intenet { 10 | run ./api-internet.py 500000 20; 11 | } 12 | 13 | neighbor 127.0.0.1 { 14 | description "router 2 with four routes"; 15 | router-id 128.0.0.0; 16 | group-updates; 17 | local-address IP; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /exabgp/dev/self/big/api-internet.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import time 5 | import random 6 | 7 | def write (data): 8 | sys.stdout.write(data + '\n') 9 | sys.stdout.flush() 10 | 11 | def main (): 12 | count = 0 13 | 14 | ip = {} 15 | nexthop="1.2.3.4" 16 | 17 | for ip1 in range(0,223): 18 | generated = '%d.0.0.0/8' % (ip1) 19 | ip[generated] = nexthop 20 | 21 | for ip1 in range(0,223): 22 | for ip2 in range(0,256): 23 | generated = '%d.%d.0.0/16' % (ip1,ip2) 24 | ip[generated] = nexthop 25 | 26 | # initial table dump 27 | for k,v in ip.iteritems(): 28 | count += 1 29 | write('announce route %s next-hop %s med 100 as-path [ 100 101 102 103 104 105 106 107 108 109 110 ]' % (k,v)) 30 | if count % 100 == 0: 31 | sys.stderr.write('initial : announced %d\n' % count) 32 | 33 | count &= 0xFFFFFFFe 34 | time.sleep(10000) 35 | 36 | if __name__ == '__main__': 37 | try: 38 | main() 39 | except KeyboardInterrupt: 40 | pass 41 | -------------------------------------------------------------------------------- /exabgp/dev/self/big/dump-all.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | 5 | count = 0 6 | 7 | while True: 8 | line = sys.stdin.readline() 9 | sys.stderr.write(line) 10 | sys.stderr.flush() 11 | -------------------------------------------------------------------------------- /exabgp/dev/self/big/dump-number.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | 5 | count = 0 6 | 7 | while True: 8 | line = sys.stdin.readline() 9 | if ' route' in line: 10 | count += 1 11 | if count % 100 == 0: 12 | sys.stderr.write('received %-10d\n' % count) 13 | sys.stderr.flush() 14 | -------------------------------------------------------------------------------- /exabgp/dev/self/big/dump-to-screen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | 5 | count = 0 6 | 7 | while True: 8 | line = sys.stdin.readline() 9 | if ' route' in line: 10 | count += 1 11 | if count % 100 == 0: 12 | sys.stderr.write('received %-10d\n' % count) 13 | sys.stderr.flush() 14 | -------------------------------------------------------------------------------- /exabgp/dev/self/big/receive: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ip=`ifconfig | grep -A10 en0 | grep "inet " | head -1 | awk '{ print $2; }'` 4 | if [ "$ip" == "" ] 5 | then 6 | ip=`ifconfig | grep -A10 en1 | grep "inet " | head -1 | awk '{ print $2; }'` 7 | fi 8 | if [ "$ip" == "" ] 9 | then 10 | ip=`ifconfig | grep -A10 vnic0 | grep "inet " | head -1 | awk '{ print $2; }'` 11 | fi 12 | if [ "$ip" != "" ] 13 | then 14 | cat receive.template | sed -e "s/IP/$ip/" > receive.conf 15 | env exabgp.log.processes=false exabgp.log.reactor=false exabgp.tcp.bind="127.0.0.1" exabgp.tcp.port=1790 ../../../sbin/exabgp receive.conf $* 16 | else 17 | echo "get some IP somewhere on this machine please" 18 | fi 19 | -------------------------------------------------------------------------------- /exabgp/dev/self/big/receive.template: -------------------------------------------------------------------------------- 1 | #route 77.93.35.15/32 next-hop 10.0.0.2; 2 | 3 | group test { 4 | local-as 65533; 5 | peer-as 65533; 6 | hold-time 180; 7 | graceful-restart 1200; 8 | 9 | process similate-the-intenet { 10 | receive-routes; 11 | run ./dump-to-screen.py 100 20; 12 | } 13 | 14 | neighbor IP { 15 | description "router 2 with four routes"; 16 | router-id 127.0.0.0; 17 | local-address 127.0.0.1; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /exabgp/dev/self/big/send: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ip=`ifconfig | grep -A10 en0 | grep "inet " | head -1 | awk '{ print $2; }'` 4 | if [ "$ip" == "" ] 5 | then 6 | ip=`ifconfig | grep -A10 en1 | grep "inet " | head -1 | awk '{ print $2; }'` 7 | fi 8 | if [ "$ip" == "" ] 9 | then 10 | ip=`ifconfig | grep -A10 vnic0 | grep "inet " | head -1 | awk '{ print $2; }'` 11 | fi 12 | if [ "$ip" != "" ] 13 | then 14 | cat send.template | sed -e "s/IP/$ip/" > send.conf 15 | env exabgp.log.processes=false exabgp.log.reactor=false exabgp.tcp.bind="$ip" exabgp.tcp.port=1790 ../../../sbin/exabgp send.conf $* 16 | else 17 | echo "get some IP somewhere on this machine please" 18 | fi 19 | -------------------------------------------------------------------------------- /exabgp/dev/self/big/send.template: -------------------------------------------------------------------------------- 1 | #route 77.93.35.15/32 next-hop 10.0.0.2; 2 | 3 | group test { 4 | local-as 65533; 5 | peer-as 65533; 6 | hold-time 180; 7 | graceful-restart 1200; 8 | 9 | process similate-the-intenet { 10 | run ./api-internet.py 500000 20; 11 | } 12 | 13 | neighbor 127.0.0.1 { 14 | description "router 2 with four routes"; 15 | router-id 128.0.0.0; 16 | group-updates; 17 | local-address IP; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /exabgp/dev/self/load/dump-all.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | 5 | count = 0 6 | 7 | while True: 8 | line = sys.stdin.readline() 9 | sys.stderr.write(line) 10 | sys.stderr.flush() 11 | -------------------------------------------------------------------------------- /exabgp/dev/self/load/dump-number.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | 5 | count = 0 6 | 7 | while True: 8 | line = sys.stdin.readline() 9 | if ' route' in line: 10 | count += 1 11 | if count % 100 == 0: 12 | sys.stderr.write('received %-10d\n' % count) 13 | sys.stderr.flush() 14 | -------------------------------------------------------------------------------- /exabgp/dev/self/load/dump-to-screen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | 5 | count = 0 6 | 7 | while True: 8 | line = sys.stdin.readline() 9 | if ' route' in line: 10 | count += 1 11 | if count % 100 == 0: 12 | sys.stderr.write('received %-10d\n' % count) 13 | sys.stderr.flush() 14 | -------------------------------------------------------------------------------- /exabgp/dev/self/load/receive: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ip=`ifconfig | grep -A10 en0 | grep "inet " | head -1 | awk '{ print $2; }'` 4 | if [ "$ip" == "" ] 5 | then 6 | ip=`ifconfig | grep -A10 en1 | grep "inet " | head -1 | awk '{ print $2; }'` 7 | fi 8 | if [ "$ip" == "" ] 9 | then 10 | ip=`ifconfig | grep -A10 vnic0 | grep "inet " | head -1 | awk '{ print $2; }'` 11 | fi 12 | if [ "$ip" != "" ] 13 | then 14 | cat receive.template | sed -e "s/IP/$ip/" > receive.conf 15 | env exabgp.log.processes=false exabgp.log.reactor=false exabgp.tcp.bind="127.0.0.1" exabgp.tcp.port=1790 ../../../sbin/exabgp receive.conf $* 16 | else 17 | echo "get some IP somewhere on this machine please" 18 | fi 19 | -------------------------------------------------------------------------------- /exabgp/dev/self/load/receive.template: -------------------------------------------------------------------------------- 1 | #route 77.93.35.15/32 next-hop 10.0.0.2; 2 | 3 | group test { 4 | local-as 65533; 5 | peer-as 65533; 6 | hold-time 180; 7 | graceful-restart 1200; 8 | 9 | process similate-the-intenet { 10 | receive-routes; 11 | run ./dump-to-screen.py 100 20; 12 | } 13 | 14 | neighbor IP { 15 | description "router 2 with four routes"; 16 | router-id 127.0.0.0; 17 | local-address 127.0.0.1; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /exabgp/dev/self/load/send: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ip=`ifconfig | grep -A10 en0 | grep "inet " | head -1 | awk '{ print $2; }'` 4 | if [ "$ip" == "" ] 5 | then 6 | ip=`ifconfig | grep -A10 en1 | grep "inet " | head -1 | awk '{ print $2; }'` 7 | fi 8 | if [ "$ip" == "" ] 9 | then 10 | ip=`ifconfig | grep -A10 vnic0 | grep "inet " | head -1 | awk '{ print $2; }'` 11 | fi 12 | if [ "$ip" != "" ] 13 | then 14 | cat send.template | sed -e "s/IP/$ip/" > send.conf 15 | env exabgp.log.processes=false exabgp.log.reactor=false exabgp.tcp.bind="$ip" exabgp.tcp.port=1790 ../../../sbin/exabgp send.conf $* 16 | else 17 | echo "get some IP somewhere on this machine please" 18 | fi 19 | -------------------------------------------------------------------------------- /exabgp/dev/self/load/send.template: -------------------------------------------------------------------------------- 1 | #route 77.93.35.15/32 next-hop 10.0.0.2; 2 | 3 | group test { 4 | local-as 65533; 5 | peer-as 65533; 6 | hold-time 180; 7 | graceful-restart 1200; 8 | 9 | process similate-the-intenet { 10 | run ./api-internet.py 500000 20; 11 | } 12 | 13 | neighbor 127.0.0.1 { 14 | description "router 2 with four routes"; 15 | router-id 128.0.0.0; 16 | group-updates; 17 | local-address IP; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /exabgp/dev/self/refresh/first: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ip=`ifconfig | grep -A10 en0 | grep "inet " | head -1 | awk '{ print $2; }'` 4 | if [ "$ip" == "" ] 5 | then 6 | ip=`ifconfig | grep -A10 en1 | grep "inet " | head -1 | awk '{ print $2; }'` 7 | fi 8 | if [ "$ip" == "" ] 9 | then 10 | ip=`ifconfig | grep -A10 vnic0 | grep "inet " | head -1 | awk '{ print $2; }'` 11 | fi 12 | if [ "$ip" != "" ] 13 | then 14 | cat first.template | sed -e "s/IP/$ip/" > first.conf 15 | env exabgp.log.processes=false exabgp.log.reactor=false exabgp.tcp.bind="127.0.0.1" exabgp.tcp.port=1790 ../../../sbin/exabgp first.conf $* 16 | else 17 | echo "get some IP somewhere on this machine please" 18 | fi 19 | -------------------------------------------------------------------------------- /exabgp/dev/self/refresh/first.template: -------------------------------------------------------------------------------- 1 | #route 77.93.35.15/32 next-hop 10.0.0.2; 2 | 3 | group test { 4 | local-as 65533; 5 | peer-as 65533; 6 | hold-time 180; 7 | 8 | capability { 9 | route-refresh; 10 | graceful-restart 1200; 11 | } 12 | 13 | family { 14 | ipv4 unicast; 15 | } 16 | 17 | process similate-the-intenet { 18 | receive-routes; 19 | run ./re-ask.py; 20 | } 21 | 22 | neighbor IP { 23 | description "router 2 with four routes"; 24 | router-id 127.0.0.0; 25 | local-address 127.0.0.1; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /exabgp/dev/self/refresh/re-ask.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import signal 5 | 6 | class TimeError (Exception): pass 7 | 8 | def handler(signum, frame): 9 | raise TimeError() 10 | 11 | count = 0 12 | 13 | while True: 14 | try: 15 | signal.signal(signal.SIGALRM, handler) 16 | signal.alarm(4) 17 | 18 | line = sys.stdin.readline() 19 | sys.stderr.write('received %s\n' % line.strip()) 20 | sys.stderr.flush() 21 | except TimeError: 22 | print 'announce route-refresh ipv4 unicast' 23 | sys.stdout.flush() 24 | print >> sys.stderr, 'announce route-refresh ipv4 unicast' 25 | sys.stderr.flush() 26 | -------------------------------------------------------------------------------- /exabgp/dev/self/refresh/second: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ip=`ifconfig | grep -A10 en0 | grep "inet " | head -1 | awk '{ print $2; }'` 4 | if [ "$ip" == "" ] 5 | then 6 | ip=`ifconfig | grep -A10 en1 | grep "inet " | head -1 | awk '{ print $2; }'` 7 | fi 8 | if [ "$ip" == "" ] 9 | then 10 | ip=`ifconfig | grep -A10 vnic0 | grep "inet " | head -1 | awk '{ print $2; }'` 11 | fi 12 | if [ "$ip" != "" ] 13 | then 14 | cat second.template | sed -e "s/IP/$ip/" > second.conf 15 | env exabgp.log.processes=false exabgp.log.reactor=false exabgp.tcp.bind="$ip" exabgp.tcp.port=1790 ../../../sbin/exabgp second.conf -d 16 | else 17 | echo "get some IP somewhere on this machine please" 18 | fi 19 | -------------------------------------------------------------------------------- /exabgp/dev/self/refresh/second.template: -------------------------------------------------------------------------------- 1 | #route 77.93.35.15/32 next-hop 10.0.0.2; 2 | 3 | group test { 4 | local-as 65533; 5 | peer-as 65533; 6 | hold-time 180; 7 | 8 | capability { 9 | route-refresh; 10 | graceful-restart 1200; 11 | } 12 | 13 | family { 14 | ipv4 unicast; 15 | } 16 | 17 | static { 18 | route 1.0.0.0/24 next-hop 9.9.9.9 split /25; 19 | } 20 | 21 | neighbor 127.0.0.1 { 22 | description "router 2 with four routes"; 23 | router-id 128.0.0.0; 24 | local-address IP; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /exabgp/dev/self/simple/first: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ip=`ifconfig | grep -A10 en0 | grep "inet " | head -1 | awk '{ print $2; }'` 4 | if [ "$ip" == "" ] 5 | then 6 | ip=`ifconfig | grep -A10 en1 | grep "inet " | head -1 | awk '{ print $2; }'` 7 | fi 8 | if [ "$ip" == "" ] 9 | then 10 | ip=`ifconfig | grep -A10 vnic0 | grep "inet " | head -1 | awk '{ print $2; }'` 11 | fi 12 | if [ "$ip" != "" ] 13 | then 14 | cat first.template | sed -e "s/IP/$ip/" > first.conf 15 | env exabgp.tcp.bind="127.0.0.1" exabgp.tcp.port=1790 ../../../sbin/exabgp first.conf $* 16 | else 17 | echo "get some IP somewhere on this machine please" 18 | fi 19 | -------------------------------------------------------------------------------- /exabgp/dev/self/simple/first.template: -------------------------------------------------------------------------------- 1 | #route 77.93.35.15/32 next-hop 10.0.0.2; 2 | 3 | group test { 4 | local-as 65533; 5 | peer-as 65534; 6 | hold-time 180; 7 | graceful-restart 1200; 8 | 9 | family { 10 | ipv4 unicast; 11 | } 12 | 13 | static { 14 | route 11.0.0.0/8 next-hop 1.1.1.1 med 100 as-path [ 1 2 3 4 ]; 15 | route 22.0.0.0/8 next-hop 1.1.1.1 med 100 as-path [ 1 2 3 4 ]; 16 | route 33.0.0.0/8 next-hop 1.1.1.1 med 100 as-path [ 1 2 3 4 ]; 17 | route 44.0.0.0/8 next-hop 1.1.1.1 med 100 as-path [ 1 2 3 4 ]; 18 | route 55.0.0.0/8 next-hop 1.1.1.1 med 100 as-path [ 1 2 3 4 ]; 19 | route 66.0.0.0/8 next-hop 1.1.1.1 med 150 as-path [ 1 2 3 4 ]; 20 | route 77.0.0.0/8 next-hop 1.1.1.2 med 150 as-path [ 1 2 3 4 ]; 21 | route 88.0.0.0/8 next-hop 1.1.1.2 med 150 as-path [ 1 2 3 4 ]; 22 | route 99.0.0.0/8 next-hop 1.1.1.2 med 150 as-path [ 1 2 3 4 ]; 23 | } 24 | 25 | neighbor IP { 26 | description "router"; 27 | router-id 127.0.0.0; 28 | local-address 127.0.0.1; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /exabgp/dev/self/simple/second: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ip=`ifconfig | grep -A10 en0 | grep "inet " | head -1 | awk '{ print $2; }'` 4 | if [ "$ip" == "" ] 5 | then 6 | ip=`ifconfig | grep -A10 en1 | grep "inet " | head -1 | awk '{ print $2; }'` 7 | fi 8 | if [ "$ip" == "" ] 9 | then 10 | ip=`ifconfig | grep -A10 vnic0 | grep "inet " | head -1 | awk '{ print $2; }'` 11 | fi 12 | if [ "$ip" != "" ] 13 | then 14 | cat second.template | sed -e "s/IP/$ip/" > second.conf 15 | env exabgp.tcp.bind="$ip" exabgp.tcp.port=1790 ../../../sbin/exabgp second.conf $* 16 | else 17 | echo "get some IP somewhere on this machine please" 18 | fi 19 | -------------------------------------------------------------------------------- /exabgp/dev/self/simple/second.template: -------------------------------------------------------------------------------- 1 | #route 77.93.35.15/32 next-hop 10.0.0.2; 2 | 3 | group test { 4 | local-as 65534; 5 | peer-as 65533; 6 | hold-time 180; 7 | graceful-restart 1200; 8 | 9 | family { 10 | ipv4 unicast; 11 | } 12 | 13 | capability{ 14 | aigp enable; 15 | } 16 | 17 | static { 18 | route 11.0.0.0/8 next-hop 1.1.1.1 aigp 100 as-path [ 1 2 3 4 ]; 19 | route 22.0.0.0/8 next-hop 1.1.1.1 aigp 100 as-path [ 1 2 3 4 ]; 20 | route 33.0.0.0/8 next-hop 1.1.1.1 aigp 100 as-path [ 1 2 3 4 ]; 21 | route 44.0.0.0/8 next-hop 1.1.1.1 aigp 100 as-path [ 1 2 3 4 ]; 22 | route 55.0.0.0/8 next-hop 1.1.1.1 aigp 100 as-path [ 1 2 3 4 ]; 23 | route 66.0.0.0/8 next-hop 1.1.1.1 aigp 150 as-path [ 1 2 3 4 ]; 24 | route 77.0.0.0/8 next-hop 1.1.1.2 aigp 150 as-path [ 1 2 3 4 ]; 25 | route 88.0.0.0/8 next-hop 1.1.1.2 aigp 150 as-path [ 1 2 3 4 ]; 26 | route 99.0.0.0/8 next-hop 1.1.1.2 aigp 150 as-path [ 1 2 3 4 ]; 27 | } 28 | 29 | neighbor 127.0.0.1 { 30 | description "router 2"; 31 | router-id 128.0.0.0; 32 | local-address IP; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /exabgp/dev/static/checker: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | env \ 3 | PYTHONPATH=$PYTHONPATH:lib \ 4 | python2.6 \ 5 | /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pychecker/checker.py \ 6 | $1 7 | -------------------------------------------------------------------------------- /exabgp/dev/static/flakes: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | env \ 3 | PYTHONPATH=$PYTHONPATH:lib \ 4 | python2.6 \ 5 | /opt/local/bin/pyflakes-2.6 \ 6 | $1 7 | -------------------------------------------------------------------------------- /exabgp/dev/static/lint: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | env \ 3 | PYTHONPATH=$PYTHONPATH:lib \ 4 | python2.6 \ 5 | /opt/local/bin/pylint-2.6 \ 6 | --variable-rgx="[a-z_][a-z0-9_]{0,30}$" \ 7 | --disable-msg=W0312 \ 8 | --disable-msg=C0324 \ 9 | --disable-msg=C0111 \ 10 | --disable-msg=C0321 \ 11 | --disable-msg=C0103 \ 12 | --max-line-length=200 \ 13 | $1 14 | 15 | # W0312 : Found indentation with tabs instead of spaces 16 | # C0324 : Comma not followed by a space 17 | # C0111 : Missing docstring 18 | # C0321 : More than one statement on a single line 19 | # C0103 : the regex for class and functions 20 | -------------------------------------------------------------------------------- /exabgp/dev/unittest/loader.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | """ 4 | table.py 5 | 6 | Created by Thomas Mangin on 2009-08-25. 7 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 8 | """ 9 | 10 | import os 11 | import glob 12 | import unittest 13 | 14 | from exabgp.configuration.environment import environment 15 | env = environment.setup('') 16 | 17 | from exabgp.configuration.loader import read 18 | #from exabgp.configuration.loader import InvalidFormat 19 | 20 | class TestLoader (unittest.TestCase): 21 | 22 | def setUp(self): 23 | self.folder = os.path.abspath(os.path.join(os.path.abspath(__file__),'..','..','configuration')) 24 | 25 | def test_loader (self): 26 | for exaname in glob.glob('%s/*.exa' % self.folder): 27 | jsonname = '%s.json' % exaname[:-4] 28 | exa = read(exaname) 29 | jsn = read(jsonname) 30 | if not exa or not jsn: 31 | self.fail('parsing of %s or %s did not return a valid dictionary' % (exaname,jsonname)) 32 | 33 | # import json 34 | # print json.dumps(exa, sort_keys=True,indent=3,separators=(',', ': ')) 35 | # print 36 | 37 | if exa != jsn: 38 | self.fail('parsing of %s and/or %s did not return the expect result' % (exaname,jsonname)) 39 | 40 | if __name__ == '__main__': 41 | unittest.main() 42 | -------------------------------------------------------------------------------- /exabgp/dev/unittest/supervisor.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | """ 4 | peer.py 5 | 6 | Created by Thomas Mangin on 2009-08-30. 7 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 8 | """ 9 | 10 | import unittest 11 | 12 | from exabgp.configuration.environment import environment 13 | env = environment.setup('') 14 | 15 | from exabgp.configuration.file import Configuration 16 | from exabgp.reactor import Reactor 17 | 18 | class TestPeer (unittest.TestCase): 19 | text_configuration = """\ 20 | neighbor 192.0.2.181 { 21 | description "a quagga test peer"; 22 | router-id 192.0.2.92; 23 | local-address 192.0.2.92; 24 | local-as 65000; 25 | peer-as 65000; 26 | 27 | static { 28 | route 10.0.5.0/24 next-hop 192.0.2.92 local-preference 10 community [ 0x87654321 ]; 29 | } 30 | } 31 | """ 32 | 33 | def setUp(self): 34 | self.configuration = Configuration(self.text_configuration,True) 35 | self.assertEqual(self.configuration.reload(),True,"could not read the configuration, run the configuration unittest") 36 | 37 | def test_connection (self): 38 | reactor = Reactor(self.configuration) 39 | reactor.run() 40 | #self.failIf() 41 | 42 | if __name__ == '__main__': 43 | unittest.main() 44 | -------------------------------------------------------------------------------- /exabgp/dev/unittest2/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | dirname=`dirname $0` 4 | 5 | case $dirname in 6 | /*) 7 | cd $dirname/../.. > /dev/null 8 | path=`pwd` 9 | cd - > /dev/null 10 | ;; 11 | *) 12 | cd `pwd`/$dirname/../.. > /dev/null 13 | path=`pwd` 14 | cd - > /dev/null 15 | ;; 16 | esac 17 | 18 | echo $path 19 | 20 | export PYTHONPATH=$path/lib 21 | 22 | if [ "$INTERPRETER" != "" ] 23 | then 24 | INTERPRETER=`which $INTERPRETER` 25 | fi 26 | 27 | PYPY=`which pypy-disabled 2>/dev/null` 28 | PYTHON27=`which python2.7 2>/dev/null` 29 | PYTHON26=`which python2.6 2>/dev/null` 30 | PYTHON25=`which python2.5 2>/dev/null` 31 | PYTHON24=`which python2.4 2>/dev/null` 32 | PYTHON2=`which python2 2>/dev/null` 33 | PYTHON=`which python 2>/dev/null` 34 | 35 | if [ -f "$PYPY" ] 36 | then 37 | INTERPRETER=$PYPY 38 | elif [ -f "$PYTHON27" ] 39 | then 40 | INTERPRETER=$PYTHON27 41 | elif [ -f "$PYTHON26" ] 42 | then 43 | INTERPRETER=$PYTHON26 44 | elif [ -f "$PYTHON25" ] 45 | then 46 | INTERPRETER=$PYTHON25 47 | elif [ -f "$PYTHON24" ] 48 | then 49 | INTERPRETER=$PYTHON24 50 | elif [ -f "$PYTHON2" ] 51 | then 52 | INTERPRETER=$PYTHON2 53 | elif [ -f "$PYTHON" ] 54 | then 55 | INTERPRETER=$PYTHON 56 | else 57 | INTERPRETER=python 58 | fi 59 | 60 | exec $INTERPRETER $* 61 | -------------------------------------------------------------------------------- /exabgp/etc/cisco/ibgp4-helper.txt: -------------------------------------------------------------------------------- 1 | ! 2 | interface Loopback1 3 | description BGP 4 | ip address 192.168.127.128 255.255.255.255 5 | ! 6 | bgp 65533 7 | no synchronization 8 | bgp router-id 172.16.0.1 9 | neighbor service-ip peer-group 10 | neighbor service-ip remote-as 65533 11 | neighbor service-ip description Service IPs 12 | neighbor service-ip ebgp-multihop 5 13 | neighbor service-ip update-source loopback1 14 | neighbor service-ip default-originate 15 | neighbor service-ip route-map bgp-service-ip in 16 | neighbor service-ip route-map deny-any out 17 | neighbor 192.168.127.1 peer-group service-ip 18 | no auto-summary 19 | ! 20 | ip prefix-list service-ip seq 10 permit 192.0.2.1/32 21 | ip prefix-list service-ip seq 99999 deny 0.0.0.0/0 le 32 22 | ! 23 | ip access-list standard match-any 24 | permit any 25 | ! 26 | route-map bgp-service-ip permit 10 27 | match ip address prefix-list service-ip 28 | set community no-export additive 29 | ! 30 | route-map deny-any deny 10 31 | match ip address match-any 32 | ! 33 | 34 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/dual-neighbor.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "a quagga test peer"; 3 | router-id 192.0.2.92; 4 | local-address 192.0.2.92; 5 | local-as 65533; 6 | peer-as 65533; 7 | 8 | static { 9 | route 10.0.5.0/24 next-hop 192.0.2.92 local-preference 10 community [ 0x87654321 ]; 10 | } 11 | } 12 | neighbor 10.0.0.4 { 13 | description "a quagga test peer"; 14 | router-id 10.0.0.2; 15 | local-address 10.0.0.2; 16 | local-as 65500; 17 | peer-as 65533; 18 | 19 | static { 20 | route 10.0.1.0/24 { 21 | next-hop 10.0.255.254; 22 | } 23 | route 10.0.2.0/24 { 24 | next-hop 10.0.255.254; 25 | community 30740:30740; 26 | } 27 | route 10.0.3.0/24 { 28 | next-hop 10.0.255.254; 29 | community [ 30740:30740 30740:0 ]; 30 | } 31 | route 10.0.4.0/24 { 32 | next-hop 10.0.255.254; 33 | local-preference 200; 34 | } 35 | route 10.0.5.0/24 next-hop 10.0.255.254 local-preference 200; 36 | route 10.0.6.0/24 next-hop 10.0.255.254 community 30740:30740; 37 | route 10.0.7.0/24 next-hop 10.0.255.254 local-preference 200 community 30740:30740; 38 | route 10.0.8.0/24 next-hop 10.0.255.254 community 30740:30740 local-preference 200; 39 | route 10.0.7.0/24 next-hop 10.0.255.254 local-preference 200 community [30740:0 30740:30740]; 40 | route 10.0.8.0/24 next-hop 10.0.255.254 community [30740:0 30740:30740] local-preference 200; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ebgp4-asn32.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "will pass received routes to the program"; 3 | router-id 10.0.0.2; 4 | local-address 10.0.0.2; 5 | local-as 654321; 6 | peer-as 123456; 7 | hold-time 180; 8 | 9 | process parsed-route-backend { 10 | receive-routes; 11 | run etc/exabgp/processes/syslog-1.py; 12 | } 13 | 14 | static { 15 | route 10.0.0.0/24 next-hop 192.0.2.1 extended-community 0x4002FDE800000001; 16 | route 10.0.1.0/24 next-hop 192.0.2.1 extended-community 0x410301020304162E; 17 | route 10.0.2.0/24 next-hop 192.0.2.1 extended-community [ target:1234:4.3.2.1 target:1.2.3.4:4321 ]; 18 | route 10.0.3.0/24 next-hop 192.0.2.1 extended-community [ origin:2345:6.7.8.9 origin:2.3.4.5:6789 ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ebgp4-cisco.txt: -------------------------------------------------------------------------------- 1 | neighbor 192.0.2.181 { 2 | description "a cisco test peer"; 3 | router-id 192.0.2.92; 4 | local-address 192.0.2.92; 5 | local-as 65533; 6 | peer-as 65533; 7 | 8 | static { 9 | route 10.0.5.0/24 next-hop 192.0.2.92 local-preference 10 community [ 0x87654321 ]; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ebgp4-collector.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "will pass received routes to the program"; 3 | router-id 10.0.0.2; 4 | local-address 10.0.0.2; 5 | local-as 654321; 6 | peer-as 123456; 7 | hold-time 180; 8 | 9 | process parsed-route-backend { 10 | receive-routes; 11 | run contrib/daniel.piekacz/collector.py 10.0.0.3 collector collector collector; 12 | } 13 | 14 | static { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ebgp4-family.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "will pass received routes to the program"; 3 | router-id 10.0.0.2; 4 | local-address 10.0.0.2; 5 | local-as 654321; 6 | peer-as 123456; 7 | hold-time 180; 8 | 9 | family { 10 | # ipv4 unicast; 11 | # ipv4 multicast; 12 | # ipv4 nlri-mpls; 13 | # ipv4 mpls-vpn; 14 | # ipv6 unicast; 15 | # ipv4 flow-vpn 16 | # ... or 17 | # ipv4 flow; 18 | all; 19 | #minimal; 20 | } 21 | 22 | process parsed-route-backend { 23 | receive-routes; 24 | run etc/exabgp/processes/syslog-1.py; 25 | } 26 | 27 | static { 28 | route 10.0.0.0/24 next-hop 192.0.2.1 extended-community 0x4002FDE800000001; 29 | route 10.0.1.0/24 next-hop 192.0.2.1 extended-community 0x410301020304162E; 30 | route 10.0.2.0/24 next-hop 192.0.2.1 extended-community [ target:1234:4.3.2.1 target:1.2.3.4:4321 ]; 31 | route 10.0.3.0/24 next-hop 192.0.2.1 extended-community [ origin:2345:6.7.8.9 origin:2.3.4.5:6789 ]; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ebgp4-juniper-flow.txt: -------------------------------------------------------------------------------- 1 | neighbor 82.219.4.254 { 2 | description "m7i-4 router"; 3 | router-id 10.0.0.1; 4 | local-address 10.0.0.1; 5 | local-as 65500; 6 | peer-as 65533; 7 | graceful-restart 5; 8 | 9 | flow { 10 | route optional-name-of-the-route { 11 | match { 12 | source 10.0.0.1/32; 13 | destination 192.168.0.1/32; 14 | port =80 =8080; 15 | destination-port >8080&<8088 =3128; 16 | source-port >1024; 17 | # protocol tcp; 18 | protocol [ tcp udp ]; 19 | packet-length >200&<300 >400&<500; 20 | # fragment not-a-fragment; 21 | fragment [ first-fragment last-fragment ]; 22 | icmp-type [ unreachable echo-request echo-reply ]; 23 | icmp-code [ host-unreachable network-unreachable ]; 24 | tcp-flags [ urgent rst ]; 25 | dscp [ 10 20 ]; 26 | 27 | } 28 | then { 29 | # rate-limit 9600; 30 | # discard; 31 | redirect 65500:12345; 32 | # redirect 1.2.3.4:5678; 33 | community [30740:0 30740:30740]; 34 | } 35 | } 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ebgp4-multisession.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "will pass received routes to the program"; 3 | router-id 10.0.0.2; 4 | local-address 10.0.0.2; 5 | local-as 654321; 6 | peer-as 123456; 7 | hold-time 180; 8 | multi-session; 9 | 10 | process parsed-route-backend { 11 | receive-routes; 12 | run etc/exabgp/processes/syslog-1.py; 13 | } 14 | 15 | static { 16 | route 10.0.0.0/24 next-hop 192.0.2.1; 17 | route 10.0.1.0/24 next-hop 192.0.2.1; 18 | route 10.0.2.0/24 next-hop 192.0.2.1; 19 | route 10.0.3.0/24 next-hop 192.0.2.1; 20 | 21 | route 2A02:B80:0:1::1/64 next-hop 2A02:B80:0:2::1 community [30740:0 30740:30740] local-preference 200; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ebgp4-peer-update.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "will pass neighbor status change to the program"; 3 | router-id 10.0.0.2; 4 | local-address 10.0.0.2; 5 | local-as 654321; 6 | peer-as 123456; 7 | hold-time 180; 8 | 9 | # Use the forking watchdog system to run a tcp-server 10 | process tcp-control { 11 | receive-routes; 12 | run etc/exabgp/processes/tcp-server; 13 | } 14 | 15 | # telnet 127.0.0.1 9999 to control the damon 16 | # the commands are : 17 | # * help :D 18 | # static { 19 | # route 10.0.5.0/24 next-hop 10.0.255.254; 20 | # } 21 | } 22 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ebgp4-simple.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "a quagga test peer"; 3 | router-id 10.0.0.2; 4 | local-address 10.0.0.2; 5 | local-as 65500; 6 | peer-as 65533; 7 | hold-time 180; 8 | 9 | static { 10 | route 10.0.1.0/24 { 11 | next-hop 10.0.255.254; 12 | } 13 | route 10.0.2.0/24 { 14 | next-hop 10.0.255.254; 15 | community 30740:30740; 16 | } 17 | route 10.0.3.0/24 { 18 | next-hop 10.0.255.254; 19 | community [ 30740:30740 30740:0 ]; 20 | } 21 | route 10.0.4.0/24 { 22 | next-hop 10.0.255.254; 23 | local-preference 200; 24 | } 25 | route 10.0.5.0/24 next-hop 10.0.255.254 local-preference 200; 26 | route 10.0.6.0/24 next-hop 10.0.255.254 community 30740:30740; 27 | route 10.0.7.0/24 next-hop 10.0.255.254 local-preference 200 community 30740:30740; 28 | route 10.0.8.0/24 next-hop 10.0.255.254 community 30740:30740 local-preference 200; 29 | route 10.0.7.0/24 next-hop 10.0.255.254 local-preference 200 community [30740:0 30740:30740]; 30 | route 10.0.8.0/24 next-hop 10.0.255.254 community [30740:0 30740:30740] local-preference 200; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ebgp6-simple.txt: -------------------------------------------------------------------------------- 1 | neighbor 2a02:b80::2 { 2 | description "a quagga test peer over ipv6"; 3 | router-id 10.0.0.2; 4 | local-address 2a02:b80::1; 5 | local-as 65500; 6 | peer-as 65533; 7 | 8 | static { 9 | route 1.2.3.4/32 next-hop 5.6.7.8; 10 | route 2A02:B80:0:1::1/64 next-hop 2A02:B80:0:2::1 community [30740:0 30740:30740] local-preference 200; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/exabgp.env: -------------------------------------------------------------------------------- 1 | 2 | [exabgp.api] 3 | encoder = text 4 | 5 | [exabgp.bgp] 6 | openwait = 60 7 | 8 | [exabgp.cache] 9 | attributes = true 10 | nexthops = true 11 | 12 | [exabgp.daemon] 13 | daemonize = false 14 | pid = '' 15 | user = 'nobody' 16 | 17 | [exabgp.log] 18 | all = false 19 | configuration = true 20 | daemon = true 21 | destination = 'stdout' 22 | enable = true 23 | level = INFO 24 | message = false 25 | network = true 26 | packets = false 27 | parser = false 28 | processes = true 29 | reactor = true 30 | rib = false 31 | routes = false 32 | short = false 33 | timers = false 34 | 35 | [exabgp.pdb] 36 | enable = false 37 | 38 | [exabgp.profile] 39 | enable = false 40 | file = '' 41 | 42 | [exabgp.reactor] 43 | speed = 1.0 44 | 45 | [exabgp.tcp] 46 | acl = false 47 | bind = '' 48 | delay = 0 49 | once = false 50 | port = 179 51 | timeout = 1 52 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-add-path-receive: -------------------------------------------------------------------------------- 1 | neighbor 82.219.119.133 { 2 | description "addpath route reception"; 3 | router-id 82.219.212.34; 4 | local-address 82.219.212.34; 5 | local-as 30636; 6 | peer-as 30636; 7 | hold-time 180; 8 | add-path receive; 9 | 10 | process parsed-route-backend { 11 | neighbor-changes; 12 | receive-routes; 13 | run etc/exabgp/processes/syslog-1.py; 14 | } 15 | 16 | static { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-add-path-sendreceive: -------------------------------------------------------------------------------- 1 | neighbor 82.219.119.133 { 2 | description "addpath route sending"; 3 | router-id 82.219.212.34; 4 | local-address 82.219.212.34; 5 | local-as 30636; 6 | peer-as 30636; 7 | hold-time 180; 8 | add-path send/receive; 9 | 10 | process parsed-route-backend { 11 | neighbor-changes; 12 | receive-routes; 13 | run etc/exabgp/processes/syslog-1.py; 14 | } 15 | 16 | static { 17 | route 82.219.0.0/16 { 18 | # 17 34 51 68 -> 0x11 0x22 0x33 0x44 19 | path-information 17.34.51.68; 20 | next-hop 127.0.0.1; 21 | origin igp; 22 | local-preference 1; 23 | med 2000; 24 | community [ no-export ]; 25 | as-path [ 30740 30740 30740 30740 30740 30740 (30740)]; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-dynamic.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "will announce a route until told otherwise"; 3 | router-id 198.111.227.39; 4 | local-address 10.0.0.2; 5 | local-as 65533; 6 | peer-as 65533; 7 | 8 | # add and remove a route every 10 second 9 | process service-dynamic { 10 | run etc/exabgp/processes/dynamic-1.sh; 11 | } 12 | 13 | # no static routes to make sure nothing is wrong when we are fully dynamic 14 | } 15 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-graceful.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "a quagga test peer"; 3 | router-id 10.0.0.2; 4 | local-address 10.0.0.2; 5 | local-as 65533; 6 | peer-as 65533; 7 | hold-time 180; 8 | #graceful-restart; 9 | graceful-restart 1200; 10 | 11 | static { 12 | route 10.0.1.0/24 { 13 | next-hop 10.0.255.254; 14 | } 15 | route 10.0.2.0/24 { 16 | next-hop 10.0.255.254; 17 | community 30740:30740; 18 | } 19 | route 10.0.3.0/24 { 20 | next-hop 10.0.255.254; 21 | community [ 30740:30740 30740:0 ]; 22 | } 23 | route 10.0.4.0/24 { 24 | next-hop 10.0.255.254; 25 | local-preference 200; 26 | } 27 | route 10.0.5.0/24 next-hop 10.0.255.254 local-preference 200; 28 | route 10.0.6.0/24 next-hop 10.0.255.254 community 30740:30740; 29 | route 10.0.7.0/24 next-hop 10.0.255.254 local-preference 200 community 30740:30740; 30 | route 10.0.8.0/24 next-hop 10.0.255.254 community 30740:30740 local-preference 200; 31 | route 10.0.7.0/24 next-hop 10.0.255.254 local-preference 200 community [30740:0 30740:30740]; 32 | route 10.0.8.0/24 next-hop 10.0.255.254 community [30740:0 30740:30740] local-preference 200; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-group-updates.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "a quagga test peer"; 3 | router-id 10.0.0.2; 4 | local-address 10.0.0.2; 5 | local-as 65533; 6 | peer-as 65533; 7 | hold-time 180; 8 | group-updates; 9 | 10 | static { 11 | route 10.0.5.0/24 next-hop 10.0.255.254 local-preference 200 split /32; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-group.txt: -------------------------------------------------------------------------------- 1 | #route 77.93.35.15/32 next-hop 10.0.0.2; 2 | 3 | group test { 4 | local-as 65533; 5 | peer-as 65533; 6 | hold-time 180; 7 | graceful-restart 1200; 8 | 9 | static { 10 | route 1.0.0.0/8 next-hop 1.1.1.1; 11 | route 2.0.0.0/8 next-hop 1.1.1.1; 12 | } 13 | 14 | neighbor 10.0.0.3 { 15 | description "router 1 with two routes"; 16 | router-id 198.111.227.39; 17 | local-address 10.0.0.2; 18 | } 19 | 20 | static { 21 | route 3.0.0.0/8 next-hop 1.1.1.1; 22 | route 4.0.0.0/8 next-hop 1.1.1.1; 23 | } 24 | 25 | neighbor 127.0.0.1 { 26 | description "router 2 with four routes"; 27 | router-id 127.0.0.0; 28 | local-address 10.0.0.2; 29 | } 30 | 31 | neighbor 127.0.0.2 { 32 | description "router 3 with five routes"; 33 | router-id 127.0.0.0; 34 | local-address 10.0.0.2; 35 | static { 36 | route 5.0.0.0/8 next-hop 1.1.1.1; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-healthcheck.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "will announce a route to a service"; 3 | router-id 198.111.227.39; 4 | local-address 10.0.0.2; 5 | local-as 65533; 6 | peer-as 65533; 7 | 8 | # Check if the service is available to announce a route to 9 | # it. Since the purpose is high availability, it is expected 10 | # that another host is present with a similar 11 | # configuration. IP address for the service is expected to be 12 | # configured on the loopback interface. You can run the 13 | # healthcheck process manually to check if it works as 14 | # expected (-h flag will give you available options) 15 | process service-nginx { 16 | run etc/exabgp/processes/healthcheck.py -s --name nginx --cmd "curl --fail --verbose --max-time 2 http://localhost" --start-ip 0; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-holdtime.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "announce a route with an low holdtime"; 3 | router-id 198.111.227.39; 4 | local-address 10.0.0.2; 5 | local-as 65533; 6 | peer-as 65533; 7 | hold-time 30; 8 | 9 | static { 10 | route 172.10.0.0/16 next-hop 192.0.2.1 med 200 community [174:666]; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-label4.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.10 { 2 | description "parsing received label"; 3 | router-id 82.219.212.34; 4 | local-address 82.219.212.34; 5 | local-as 30740; 6 | peer-as 30740; 7 | hold-time 180; 8 | 9 | process parsed-route-backend { 10 | neighbor-changes; 11 | receive-routes; 12 | run etc/exabgp/processes/syslog-1.py; 13 | } 14 | 15 | static { 16 | route 82.219.0.0/24 { 17 | label [ 12345 5678 ]; 18 | # 17 34 51 68 -> 0x11 0x22 0x33 0x44 19 | next-hop 127.0.0.1; 20 | origin igp; 21 | as-path [ 30740 30740 30740 30740 30740 30740 30740 ]; 22 | local-preference 1; 23 | med 2000; 24 | community [ no-export ]; 25 | originator-id 82.219.212.34; 26 | cluster-list [ 82.219.212.34 10.10.10.10 ]; 27 | } 28 | route 82.219.0.0/16 { 29 | label [ 12345 5678 ]; 30 | # 17 34 51 68 -> 0x11 0x22 0x33 0x44 31 | path-information 17.34.51.68; 32 | next-hop 127.0.0.1; 33 | origin igp; 34 | as-path [ 30740 30740 30740 30740 30740 30740 30740 ]; 35 | local-preference 1; 36 | med 2000; 37 | community [ no-export ]; 38 | originator-id 82.219.212.34; 39 | cluster-list [ 82.219.212.34 10.10.10.10 ]; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-md5.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "will announce a route protected by a MD5"; 3 | router-id 198.111.227.39; 4 | local-address 10.0.0.2; 5 | local-as 65533; 6 | peer-as 65533; 7 | hold-time 180; 8 | md5 abc123; 9 | # md5 "my md5 of the day"; 10 | # md5 'another md5 valid syntax'; 11 | # md5 oh ! parenthesis are optional; 12 | # md5 "oh ! parenthesis are optional"; 13 | # can not recall what happens with the start and end spaces/tabs .. check it. 14 | 15 | static { 16 | route 172.10.0.0/16 next-hop 192.0.2.1 med 200 community [174:666]; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-multiple-process.txt: -------------------------------------------------------------------------------- 1 | group test { 2 | process parsed-route-backend { 3 | run etc/exabgp/processes/syslog-1.py; 4 | encoder json; 5 | } 6 | 7 | 8 | neighbor 10.0.0.3 { 9 | description "will pass received routes to the program"; 10 | router-id 10.0.0.2; 11 | local-address 10.0.0.2; 12 | local-as 65533; 13 | peer-as 65533; 14 | hold-time 180; 15 | 16 | process { 17 | neighbor-changes; 18 | send-packets; 19 | receive-packets; 20 | receive-routes; 21 | } 22 | 23 | static { 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-parse.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "will pass received routes to the program"; 3 | router-id 10.0.0.2; 4 | local-address 10.0.0.2; 5 | local-as 65533; 6 | peer-as 65533; 7 | hold-time 180; 8 | 9 | process parsed-route-backend { 10 | receive-routes; 11 | run etc/exabgp/processes/syslog-1.py; 12 | } 13 | 14 | static { 15 | route 172.10.0.0/16 next-hop 192.0.2.1; 16 | route 192.168.0.0/16 next-hop 192.0.2.1; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-simple.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "a quagga test peer"; 3 | router-id 10.0.0.2; 4 | local-address 10.0.0.2; 5 | local-as 65533; 6 | peer-as 65533; 7 | hold-time 180; 8 | 9 | static { 10 | route 10.0.1.0/24 { 11 | next-hop 10.0.255.254; 12 | } 13 | route 10.0.2.0/24 { 14 | next-hop 10.0.255.254; 15 | community 30740:30740; 16 | } 17 | route 10.0.3.0/24 { 18 | next-hop 10.0.255.254; 19 | community [ 30740:30740 30740:0 ]; 20 | } 21 | route 10.0.4.0/24 { 22 | next-hop 10.0.255.254; 23 | local-preference 200; 24 | } 25 | route 10.0.5.0/24 next-hop 10.0.255.254 local-preference 200; 26 | route 10.0.6.0/24 next-hop 10.0.255.254 community 30740:30740; 27 | route 10.0.7.0/24 next-hop 10.0.255.254 local-preference 200 community 30740:30740; 28 | route 10.0.8.0/24 next-hop 10.0.255.254 community 30740:30740 local-preference 200; 29 | route 10.0.7.0/24 next-hop 10.0.255.254 local-preference 200 community [30740:0 30740:30740]; 30 | route 10.0.8.0/24 next-hop 10.0.255.254 community [30740:0 30740:30740] local-preference 200; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-split.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "will announce 256 /24"; 3 | router-id 198.111.227.39; 4 | local-address 10.0.0.2; 5 | local-as 65533; 6 | peer-as 65533; 7 | hold-time 180; 8 | graceful-restart 1200; 9 | 10 | static { 11 | route 172.10.0.0/16 next-hop 192.0.2.1 med 200 community [174:666] split /24; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-tcpcontrol.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "will announce a route until told otherwise"; 3 | router-id 198.111.227.39; 4 | local-address 10.0.0.2; 5 | local-as 65533; 6 | peer-as 65533; 7 | 8 | # Use the forking watchdog system to run a tcp-server 9 | process tcp-control { 10 | run etc/exabgp/processes/tcp-server; 11 | } 12 | 13 | # telnet 127.0.0.1 9999 to control the damon 14 | # the commands are : 15 | # * version 16 | # * shutdown 17 | # * watchdog control (see watchdog process script) 18 | # * route annoucement/withdrawal (see script too) 19 | 20 | } 21 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-ttl.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "will announce 256 /24"; 3 | router-id 198.111.227.39; 4 | local-address 10.0.0.2; 5 | local-as 65533; 6 | peer-as 65533; 7 | hold-time 180; 8 | #ttl-security; 9 | ttl-security 255; 10 | 11 | static { 12 | route 172.10.0.0/16 next-hop 192.0.2.1 med 200 community [174:666]; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-watchdog-dynamic.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "will announce a route until told otherwise"; 3 | router-id 198.111.227.39; 4 | local-address 10.0.0.2; 5 | local-as 65533; 6 | peer-as 65533; 7 | 8 | # control route(s) announcement every second, return down or up on it stdout to reflect route announcement change 9 | # flap the route with the watchdog name "watchdog-one" 10 | # flap the route, do not provide name so it changes service-1 11 | process service-1 { 12 | run etc/exabgp/processes/watchdog-1.sh; 13 | } 14 | 15 | # add and remove a route every 10 second 16 | process service-2 { 17 | run etc/exabgp/processes/dynamic-1.sh; 18 | } 19 | 20 | static { 21 | route 172.10.0.0/16 next-hop 192.0.2.1 med 200 community [174:666] watchdog watchdog-one; 22 | route 192.168.0.0/16 next-hop 192.0.2.1 med 200 community [174:666] watchdog service-1; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-watchdog.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "will announce a route until told otherwise"; 3 | router-id 198.111.227.39; 4 | local-address 10.0.0.2; 5 | local-as 65533; 6 | peer-as 65533; 7 | 8 | family { 9 | ipv4 unicast; 10 | } 11 | 12 | # control route(s) announcement every second, return down or up on it stdout to reflect route announcement change 13 | # flap the route with the watchdog name "watchdog-one" 14 | # flap the route, do not provide name so it changes service-watchdog 15 | process service-watchdog { 16 | run etc/exabgp/processes/watchdog-1.sh; 17 | } 18 | 19 | static { 20 | route 172.10.0.0/16 next-hop 192.0.2.1 med 200 community [174:666] watchdog watchdog-one; 21 | route 192.168.0.0/16 next-hop 192.0.2.1 med 200 community [174:666] watchdog service-watchdog; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp4-withdrawn.txt: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.3 { 2 | description "will announce a route until told otherwise"; 3 | router-id 198.111.227.39; 4 | local-address 10.0.0.2; 5 | local-as 65533; 6 | peer-as 65533; 7 | 8 | # control route(s) announcement every second, return down or up on it stdout to reflect route announcement change 9 | # flap the route with the watchdog name "watchdog-one" 10 | # flap the route, do not provide name so it changes service-watchdog 11 | process service-watchdog { 12 | run etc/exabgp/processes/watchdog-1.sh; 13 | } 14 | 15 | static { 16 | route 192.168.0.0/16 next-hop 192.0.2.1 med 200 community [174:666] withdraw watchdog service-watchdog; 17 | route 172.10.0.0/16 next-hop 192.0.2.1 med 200 community [174:666] watchdog watchdog-one withdraw; 18 | route 10.0.0.0/16 { 19 | next-hop 192.0.2.1; 20 | med 200; 21 | community [174:666]; 22 | watchdog watchdog-one; 23 | withdraw; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/ibgp6-simple.txt: -------------------------------------------------------------------------------- 1 | neighbor 2a02:b80::2 { 2 | description "a quagga test peer over ipv6"; 3 | router-id 10.0.0.2; 4 | local-address 2a02:b80::1; 5 | local-as 65533; 6 | peer-as 65533; 7 | 8 | static { 9 | route 1.2.3.4/32 next-hop 5.6.7.8; 10 | route 2A02:B80:0:1::1/64 next-hop 2A02:B80:0:2::1 community [30740:0 30740:30740] local-preference 200; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/processes/dynamic-1.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | # Ignore Control C 7 | # allow exabgp to send us a SIGTERM when it is time 8 | $SIG{'INT'} = sub {}; 9 | 10 | # make STDOUT unbuffered 11 | select STDOUT; $| = 1; 12 | 13 | while (1) { 14 | # commands are case sensitive 15 | print "announce flow route {\\\\n match {\\\\n source 10.0.0.1/32;\\\\n destination 1.2.3.4/32;\\\\n }\\\\n then {\\\\n discard;\\\\n }\\\\n }\\\\n"; 16 | sleep 10; 17 | print "announce route 192.0.2.1 next-hop 10.0.0.1"; 18 | sleep 10; 19 | print "withdraw route 192.0.2.1 next-hop 10.0.0.1"; 20 | sleep 10; 21 | print "withdraw flow route {\\\\n match {\\\\n source 10.0.0.1/32;\\\\n destination 1.2.3.4/32;\\\\n }\\\\n then {\\\\n discard;\\\\n }\\\\n }\\\\n"; 22 | sleep 10; 23 | } 24 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/processes/dynamic-1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # ignore Control C 4 | # if the user ^C exabgp we will get that signal too, ignore it and let exabgp send us a SIGTERM 5 | trap '' SIGINT 6 | 7 | # command and watchdog name are case sensitive 8 | 9 | while `true`; 10 | do 11 | echo "announce flow route {\\\\n match {\\\\n source 10.0.0.1/32;\\\\n destination 1.2.3.4/32;\\\\n }\\\\n then {\\\\n discard;\\\\n }\\\\n }\\\\n" 12 | sleep 10 13 | echo "announce route 192.0.2.1 next-hop 10.0.0.1" 14 | sleep 10 15 | echo "withdraw route 192.0.2.1 next-hop 10.0.0.1" 16 | sleep 10 17 | echo "withdraw flow route {\\\\n match {\\\\n source 10.0.0.1/32;\\\\n destination 1.2.3.4/32;\\\\n }\\\\n then {\\\\n discard;\\\\n }\\\\n }\\\\n" 18 | sleep 10 19 | done 20 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/processes/syslog-1.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import sys 5 | import time 6 | import syslog 7 | 8 | def _prefixed (level,message): 9 | now = time.strftime('%a, %d %b %Y %H:%M:%S',time.localtime()) 10 | return "%s %-8s %-6d %s" % (now,level,os.getpid(),message) 11 | 12 | syslog.openlog("ExaBGP") 13 | 14 | # When the parent dies we are seeing continual newlines, so we only access so many before stopping 15 | counter = 0 16 | 17 | while True: 18 | try: 19 | line = sys.stdin.readline().strip() 20 | if line == "": 21 | counter += 1 22 | if counter > 100: 23 | break 24 | continue 25 | 26 | counter = 0 27 | 28 | syslog.syslog(syslog.LOG_ALERT, _prefixed('INFO',line)) 29 | except KeyboardInterrupt: 30 | pass 31 | except IOError: 32 | # most likely a signal during readline 33 | pass 34 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/processes/watchdog-1.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | # Ignore Control C 7 | $SIG{'INT'} = sub {}; 8 | 9 | # make STDOUT unbuffered 10 | select STDOUT; $| = 1; 11 | 12 | while (1) { 13 | 14 | # Give exabgp time to establish the session :) 15 | sleep 10; 16 | 17 | # without a name, exabgp will use the name of the service as the name of the watchdog 18 | print "withdraw watchdog\n"; 19 | sleep 5; 20 | 21 | # specify a watchdog name (which may be the same or different each time) 22 | print "withdraw watchdog watchdog-one\n"; 23 | sleep 5; 24 | 25 | print "announce watchdog\n"; 26 | sleep 5; 27 | 28 | print "announce watchdog watchdog-one\n"; 29 | sleep 5; 30 | 31 | # In our example, there are no routes that are tied to these watchdogs, but we may after a future config reload 32 | print "announce watchdog watchdog-two\n"; 33 | print "withdraw watchdog watchdog-two\n"; 34 | } 35 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/processes/watchdog-1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # ignore Control C 4 | # if the user ^C exabgp we will get that signal too, ignore it and let exabgp send us a SIGTERM 5 | trap '' SIGINT 6 | 7 | # command and watchdog name are case sensitive 8 | 9 | while `true`; 10 | do 11 | 12 | # Let give exabgp the time to setup the BGP session :) 13 | # But we do not have too, exabgp will record the changes and update the routes once up otherwise 14 | 15 | sleep 10 16 | 17 | # without name exabgp will use the name of the service as watchdog name 18 | echo "withdraw watchdog" 19 | sleep 5 20 | 21 | # specify a watchdog name (which may be the same or different each time) 22 | echo "withdraw watchdog watchdog-one" 23 | sleep 5 24 | 25 | echo "announce watchdog" 26 | sleep 5 27 | 28 | echo "announce watchdog watchdog-one" 29 | sleep 5 30 | 31 | # we have no route with that watchdog but it does not matter, we could have after a configuration reload 32 | 33 | echo "announce watchdog watchdog-two" 34 | echo "withdraw watchdog watchdog-two" 35 | 36 | done 37 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/rs/rs.msg: -------------------------------------------------------------------------------- 1 | { "exabgp": "2.0", "time": 1387421714, "neighbor": { "ip": "172.0.0.1", "update": { "attribute": { "origin": "igp", "as-path": [ [ 100 ], [ ] ], "med": 0, "atomic-aggregate": false }, "announce": { "ipv4 unicast": { "100.0.0.0/16": { "next-hop": "172.0.0.1" }, "110.0.0.0/16": { "next-hop": "172.0.0.1" } } } } } } 2 | { "exabgp": "2.0", "time": 1387421714, "neighbor": { "ip": "172.0.0.22", "update": { "attribute": { "origin": "igp", "as-path": [ [ 300 ], [ ] ], "med": 0, "atomic-aggregate": false }, "announce": { "ipv4 unicast": { "140.0.0.0/16": { "next-hop": "172.0.0.22" }, "150.0.0.0/16": { "next-hop": "172.0.0.22" } } } } } } 3 | { "exabgp": "2.0", "time": 1387421714, "neighbor": { "ip": "172.0.0.11", "update": { "attribute": { "origin": "igp", "as-path": [ [ 200 ], [ ] ], "med": 0, "atomic-aggregate": false }, "announce": { "ipv4 unicast": { "120.0.0.0/16": { "next-hop": "172.0.0.11" }, "130.0.0.0/16": { "next-hop": "172.0.0.11" } } } } } } 4 | { "exabgp": "2.0", "time": 1387421714, "neighbor": { "ip": "172.0.0.21", "update": { "attribute": { "origin": "igp", "as-path": [ [ 300 ], [ ] ], "med": 0, "atomic-aggregate": false }, "announce": { "ipv4 unicast": { "140.0.0.0/16": { "next-hop": "172.0.0.21" }, "150.0.0.0/16": { "next-hop": "172.0.0.21" } } } } } } 5 | { "exabgp": "2.0", "time": 1387421720, "notification": "shutdown" } 6 | -------------------------------------------------------------------------------- /exabgp/etc/exabgp/rs/util.py: -------------------------------------------------------------------------------- 1 | # Author: 2 | # Muhammad Shahbaz (muhammad.shahbaz@gatech.edu) 3 | 4 | import sys 5 | import os 6 | import getopt 7 | 8 | '''Function for parsing arguments''' 9 | def getArgs(): 10 | logfile = ''; 11 | 12 | try: 13 | opts, args = getopt.getopt(sys.argv[1:],"h",["help", "logfile="]) 14 | except getopt.GetoptError: 15 | print 'rs.py [--logfile ]' 16 | sys.exit(2) 17 | for opt, arg in opts: 18 | if opt in ('-h', '--help'): 19 | print 'rs.py [--logfile ]' 20 | sys.exit() 21 | elif opt == '--logfile': 22 | logfile = arg 23 | 24 | if(logfile==''): 25 | print 'rs.py [--logfile ]' 26 | sys.exit() 27 | 28 | return logfile 29 | 30 | '''Write output to stdout''' 31 | def write (data): 32 | sys.stdout.write(data + '\n') 33 | sys.stdout.flush() -------------------------------------------------------------------------------- /exabgp/etc/quagga/ebgpd.conf.v4: -------------------------------------------------------------------------------- 1 | log file /var/log/quagga/bgpd informational 2 | password none 3 | enable password none 4 | ! 5 | router bgp 65533 6 | network 1.2.3.4/32 7 | neighbor 192.168.127.1 remote-as 65500 8 | ! 9 | line vty 10 | ! 11 | 12 | -------------------------------------------------------------------------------- /exabgp/etc/quagga/ebgpd.conf.v46: -------------------------------------------------------------------------------- 1 | /bin/bash: 2010/10/22: No such file or directory 2 | ssword none 3 | enable password none 4 | log file /var/log/quagga/bgpd informational 5 | ! 6 | router bgp 65533 7 | network 1.2.3.4/32 8 | neighbor 192.168.127.1 remote-as 65500 9 | neighbor 192.168.127.130 remote-as 65500 10 | ! 11 | address-family ipv6 12 | network 1234:5678::/32 13 | neighbor 192.168.127.1 activate 14 | exit-address-family 15 | ! 16 | line vty 17 | ! 18 | 19 | -------------------------------------------------------------------------------- /exabgp/etc/quagga/ebgpd.conf.v6: -------------------------------------------------------------------------------- 1 | log file /var/log/quagga/bgpd informational 2 | password none 3 | enable password none 4 | ! 5 | router bgp 65533 6 | network 1.2.3.4/32 7 | neighbor 2a02:b80::1 remote-as 65500 8 | ! 9 | address-family ipv6 10 | network 1234:5678::/32 11 | neighbor 2a02:b80::1 activate 12 | exit-address-family 13 | ! 14 | line vty 15 | ! 16 | 17 | -------------------------------------------------------------------------------- /exabgp/etc/quagga/ibgpd.conf.v4.md5: -------------------------------------------------------------------------------- 1 | log file /var/log/quagga/bgpd informational 2 | password none 3 | enable password none 4 | ! 5 | router bgp 65533 6 | network 1.2.3.4/32 7 | neighbor 192.168.127.1 remote-as 65533 8 | neighbor 192.168.127.130 password abc123 9 | ! 10 | line vty 11 | ! 12 | 13 | -------------------------------------------------------------------------------- /exabgp/etc/quagga/ibgpd.conf.v4.parse: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2010/10/22 12:37:26 4 | ! 5 | password none 6 | enable password none 7 | log file /var/log/quagga/bgpd informational 8 | ! 9 | router bgp 65533 10 | network 1.2.3.4/32 route-map SetAttr 11 | network 5.6.7.0/24 route-map SetAttr 12 | network 8.9.0.0/16 route-map SetAttr 13 | neighbor 192.168.127.1 remote-as 65533 14 | neighbor 192.168.127.130 remote-as 65533 15 | ! neighbor 192.168.127.130 password abc123 16 | ! 17 | address-family ipv6 18 | network 1234:5678::/32 19 | neighbor 192.168.127.1 activate 20 | exit-address-family 21 | ! 22 | route-map SetAttr permit 10 23 | set community 65000:1 additive 24 | set aggregator as 65002 9.8.7.6 25 | set as-path prepend 64 128 256 26 | set atomic-aggregate 27 | set metric 20 28 | set originator-id 9.8.7.6 29 | set extcommunity rt 65000:1 30 | set extcommunity soo 1.2.3.4:5678 31 | ! 32 | line vty 33 | ! 34 | -------------------------------------------------------------------------------- /exabgp/etc/quagga/ibgpd.conf.v46: -------------------------------------------------------------------------------- 1 | password none 2 | enable password none 3 | log file /var/log/quagga/bgpd informational 4 | ! 5 | router bgp 65533 6 | network 1.2.3.4/32 7 | neighbor 192.168.127.1 remote-as 65533 8 | neighbor 192.168.127.130 remote-as 65533 9 | ! 10 | address-family ipv6 11 | network 1234:5678::/32 12 | neighbor 192.168.127.1 activate 13 | exit-address-family 14 | ! 15 | line vty 16 | ! 17 | 18 | -------------------------------------------------------------------------------- /exabgp/etc/systemd/exabgp.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ExaBGP 3 | After=network.target 4 | 5 | [Service] 6 | Environment=exabgp.daemon.daemonize=false 7 | Environment=exabgp.log.destination=stdout 8 | ExecStart=/usr/sbin/exabgp /etc/exabgp/exabgp.conf 9 | 10 | [Install] 11 | WantedBy=multi-user.target 12 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/__init__.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | __init__.py 4 | 5 | Created by Thomas Mangin on 2010-01-15. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/exabgp/lib/exabgp/bgp/__init__.py -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/direction.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | direction.py 4 | 5 | Created by Thomas Mangin on 2013-08-07. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from exabgp.util.enumeration import Enumeration 10 | 11 | OUT = Enumeration ('announce','withdraw') 12 | IN = Enumeration ('announced','withdrawn') 13 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/keepalive.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | keepalive.py 4 | 5 | Created by Thomas Mangin on 2009-11-05. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from exabgp.bgp.message import Message 10 | 11 | # =================================================================== KeepAlive 12 | 13 | class KeepAlive (Message): 14 | TYPE = chr(Message.Type.KEEPALIVE) 15 | 16 | def message (self): 17 | return self._message('') 18 | 19 | def __str__ (self): 20 | return "KEEPALIVE" 21 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/nop.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | nop.py 4 | 5 | Created by Thomas Mangin on 2009-11-06. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from exabgp.bgp.message import Message 10 | 11 | class NOP (Message): 12 | TYPE = chr(Message.Type.NOP) 13 | 14 | def message (self): 15 | return self._message(self.data) 16 | 17 | def __str__ (self): 18 | return "NOP" 19 | 20 | def NOPFactory (self): 21 | return NOP() 22 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/open/asn.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | asn.py 4 | 5 | Created by Thomas Mangin on 2010-01-15. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | 10 | from struct import pack 11 | 12 | # =================================================================== ASN 13 | 14 | class ASN (long): 15 | def asn4 (self): 16 | return self > pow(2,16) 17 | 18 | def pack (self,asn4=None): 19 | if asn4 is None: 20 | asn4 = self.asn4() 21 | if asn4: 22 | return pack('!L',self) 23 | return pack('!H',self) 24 | 25 | def __len__ (self): 26 | if self.asn4(): 27 | return 4 28 | return 2 29 | 30 | def extract (self): 31 | return [pack('!L',self)] 32 | 33 | def trans (self): 34 | if self.asn4(): 35 | return AS_TRANS.pack() 36 | return self.pack() 37 | 38 | AS_TRANS = ASN(23456) 39 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/open/capability/addpath.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | addpath.py 4 | 5 | Created by Thomas Mangin on 2012-07-17. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from struct import pack 10 | 11 | # =================================================================== AddPath 12 | 13 | class AddPath (dict): 14 | string = { 15 | 0 : 'disabled', 16 | 1 : 'receive', 17 | 2 : 'send', 18 | 3 : 'send/receive', 19 | } 20 | 21 | def __init__ (self,families=[],send_receive=0): 22 | for afi,safi in families: 23 | self.add_path(afi,safi,send_receive) 24 | 25 | def add_path (self,afi,safi,send_receive): 26 | self[(afi,safi)] = send_receive 27 | 28 | def __str__ (self): 29 | return 'AddPath(' + ','.join(["%s %s %s" % (self.string[self[aafi]],xafi,xsafi) for (aafi,xafi,xsafi) in [((afi,safi),str(afi),str(safi)) for (afi,safi) in self]]) + ')' 30 | 31 | def extract (self): 32 | rs = [] 33 | for v in self: 34 | if self[v]: 35 | rs.append(v[0].pack() +v[1].pack() + pack('!B',self[v])) 36 | return rs 37 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/open/capability/mp.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | mp.py 4 | 5 | Created by Thomas Mangin on 2012-07-17. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from struct import pack 10 | 11 | # =================================================================== MultiProtocol 12 | 13 | class MultiProtocol (list): 14 | def __str__ (self): 15 | return 'Multiprotocol(' + ','.join(["%s %s" % (str(afi),str(safi)) for (afi,safi) in self]) + ')' 16 | 17 | def extract (self): 18 | rs = [] 19 | for v in self: 20 | rs.append(pack('!H',v[0]) + pack('!H',v[1])) 21 | return rs 22 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/open/capability/ms.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | ms.py 4 | 5 | Created by Thomas Mangin on 2012-07-17. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | # =================================================================== MultiSession 10 | 11 | class MultiSession (list): 12 | def __str__ (self): 13 | return 'Multisession %s' % ' '.join([str(capa) for capa in self]) 14 | 15 | def extract (self): 16 | rs = [chr(0),] 17 | for v in self: 18 | rs.append(chr(v)) 19 | return rs 20 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/open/capability/operational.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | operational.py 4 | 5 | Created by Thomas Mangin on 2013-09-01. 6 | Copyright (c) 2013-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | # =================================================================== Operational 10 | 11 | class Operational (list): 12 | def __str__ (self): 13 | return 'Operational' 14 | 15 | def extract (self): 16 | return [''] 17 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/open/capability/refresh.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | refresh.py 4 | 5 | Created by Thomas Mangin on 2012-07-17. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | # =================================================================== RouteRefresh 10 | 11 | class RouteRefresh (object): 12 | def __str__ (self): 13 | return 'Route Refresh' 14 | 15 | def extract (self): 16 | return [''] 17 | 18 | class EnhancedRouteRefresh (object): 19 | def __str__ (self): 20 | return 'Enhanced Route Refresh' 21 | 22 | def extract (self): 23 | return [''] 24 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/open/holdtime.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | holdtime.py 4 | 5 | Created by Thomas Mangin on 2012-07-17. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from struct import pack 10 | 11 | # =================================================================== HoldTime 12 | 13 | class HoldTime (int): 14 | def pack (self): 15 | return pack('!H',self) 16 | 17 | def keepalive (self): 18 | return int(self/3) 19 | 20 | def __len__ (self): 21 | return 2 22 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/open/routerid.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | routerid.py 4 | 5 | Created by Thomas Mangin on 2012-07-17. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from exabgp.protocol.ip.inet import Inet,inet 10 | from exabgp.protocol.family import AFI 11 | 12 | # =================================================================== RouterID 13 | 14 | class RouterID (Inet): 15 | def __init__ (self,ipv4): 16 | Inet.__init__(self,*inet(ipv4)) 17 | if self.afi != AFI.ipv4: 18 | raise ValueError('RouterID must be an IPv4 address') 19 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/open/version.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | version.py 4 | 5 | Created by Thomas Mangin on 2012-07-17. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | # =================================================================== Version 10 | 11 | class Version (int): 12 | def pack (self): 13 | return chr(self) 14 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/unknown.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | unknown.py 4 | 5 | Created by Thomas Mangin on 2013-07-20. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from exabgp.bgp.message import Message 10 | 11 | class UnknownMessage (Message): 12 | # Make sure we have a value, which is not defined in any RFC ! 13 | 14 | def __init__ (self,code,data=''): 15 | self.TYPE = code 16 | self.data = data 17 | 18 | def message (self): 19 | return self._message(self.data) 20 | 21 | def __str__ (self): 22 | return "UNKNOWN" 23 | 24 | def UnknownMessageFactory (data): 25 | return UnknownMessage(0xFF,data) 26 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/update/attribute/__init__.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | attribute/__init__.py 4 | 5 | Created by Thomas Mangin on 2009-11-05. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from struct import pack 10 | 11 | from exabgp.bgp.message.update.attribute.flag import Flag 12 | 13 | # =================================================================== Attribute 14 | 15 | class Attribute (object): 16 | # we need to define ID and FLAG inside of the subclasses 17 | # otherwise we can not dynamically create different UnknownAttribute 18 | # ID = 0x00 19 | # FLAG = 0x00 20 | 21 | def _attribute (self,value): 22 | flag = self.FLAG 23 | if flag & Flag.OPTIONAL and not value: 24 | return '' 25 | length = len(value) 26 | if length > 0xFF: 27 | flag |= Flag.EXTENDED_LENGTH 28 | if flag & Flag.EXTENDED_LENGTH: 29 | len_value = pack('!H',length) 30 | else: 31 | len_value = chr(length) 32 | return "%s%s%s%s" % (chr(flag),chr(self.ID),len_value,value) 33 | 34 | def __eq__ (self,other): 35 | return self.ID == other.ID 36 | 37 | def __ne__ (self,other): 38 | return self.ID != other.ID 39 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/update/attribute/atomicaggregate.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | atomicaggregate.py 4 | 5 | Created by Thomas Mangin on 2012-07-14. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from exabgp.bgp.message.update.attribute.id import AttributeID 10 | from exabgp.bgp.message.update.attribute import Flag,Attribute 11 | 12 | # =================================================================== AtomicAggregate (6) 13 | 14 | class AtomicAggregate (Attribute): 15 | ID = AttributeID.ATOMIC_AGGREGATE 16 | FLAG = Flag.TRANSITIVE 17 | MULTIPLE = False 18 | 19 | def pack (self,asn4=None): 20 | return self._attribute('') 21 | 22 | def __len__ (self): 23 | return 0 24 | 25 | def __str__ (self): 26 | return '' 27 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/update/attribute/flag.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | flag.py 4 | 5 | Created by Thomas Mangin on 2009-11-05. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | # =================================================================== Flag 10 | 11 | class Flag (int): 12 | EXTENDED_LENGTH = 0x10 # . 16 13 | PARTIAL = 0x20 # . 32 14 | TRANSITIVE = 0x40 # . 64 15 | OPTIONAL = 0x80 # . 128 16 | 17 | def __str__ (self): 18 | r = [] 19 | v = int(self) 20 | if v & 0x10: 21 | r.append("EXTENDED_LENGTH") 22 | v -= 0x10 23 | if v & 0x20: 24 | r.append("PARTIAL") 25 | v -= 0x20 26 | if v & 0x40: 27 | r.append("TRANSITIVE") 28 | v -= 0x40 29 | if v & 0x80: 30 | r.append("OPTIONAL") 31 | v -= 0x80 32 | if v: 33 | r.append("UNKNOWN %s" % hex(v)) 34 | return " ".join(r) 35 | 36 | def matches (self,value): 37 | return self | 0x10 == value | 0x10 38 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/update/attribute/localpref.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | attributes.py 4 | 5 | Created by Thomas Mangin on 2009-11-05. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from struct import unpack 10 | 11 | from exabgp.bgp.message.update.attribute.id import AttributeID 12 | from exabgp.bgp.message.update.attribute import Flag,Attribute 13 | 14 | # =================================================================== Local Preference (5) 15 | 16 | class LocalPreference (Attribute): 17 | ID = AttributeID.LOCAL_PREF 18 | FLAG = Flag.TRANSITIVE 19 | MULTIPLE = False 20 | 21 | def __init__ (self,localpref): 22 | self.localpref = self._attribute(localpref) 23 | self._str = str(unpack('!L',localpref)[0]) 24 | 25 | def pack (self,asn4=None): 26 | return self.localpref 27 | 28 | def __len__ (self): 29 | return 4 30 | 31 | def __str__ (self): 32 | return self._str 33 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/update/attribute/med.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | med.py 4 | 5 | Created by Thomas Mangin on 2009-11-05. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from struct import unpack 10 | 11 | from exabgp.bgp.message.update.attribute.id import AttributeID 12 | from exabgp.bgp.message.update.attribute import Flag,Attribute 13 | 14 | # =================================================================== MED (4) 15 | 16 | class MED (Attribute): 17 | ID = AttributeID.MED 18 | FLAG = Flag.OPTIONAL 19 | MULTIPLE = False 20 | 21 | def __init__ (self,med): 22 | self.med = self._attribute(med) 23 | self._str = str(unpack('!L',med)[0]) 24 | 25 | def pack (self,asn4=None): 26 | return self.med 27 | 28 | def __len__ (self): 29 | return 4 30 | 31 | def __str__ (self): 32 | return self._str 33 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/update/attribute/mpurnlri.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | mprnlri.py 4 | 5 | Created by Thomas Mangin on 2009-11-05. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from exabgp.bgp.message.update.attribute.id import AttributeID 10 | from exabgp.bgp.message.update.attribute import Flag,Attribute 11 | 12 | # =================================================================== MP NLRI (14) 13 | 14 | class MPURNLRI (Attribute): 15 | FLAG = Flag.OPTIONAL 16 | ID = AttributeID.MP_UNREACH_NLRI 17 | MULTIPLE = True 18 | 19 | def __init__ (self,nlris): 20 | self.nlris = nlris 21 | 22 | def packed_attributes (self,addpath): 23 | if not self.nlris: 24 | return 25 | 26 | mpurnlri = {} 27 | for nlri in self.nlris: 28 | mpurnlri.setdefault((nlri.afi.pack(),nlri.safi.pack()),[]).append(nlri.pack(addpath)) 29 | 30 | for (pafi,psafi),nlris in mpurnlri.iteritems(): 31 | yield self._attribute(pafi + psafi + ''.join(nlris)) 32 | 33 | def pack (self,addpath): 34 | return ''.join(self.packed_attributes(addpath)) 35 | 36 | def __len__ (self): 37 | return len(self.pack()) 38 | 39 | def __str__ (self): 40 | return "MP_UNREACH_NLRI %d NLRI(s)" % len(self.nlris) 41 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/update/attribute/origin.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | attributes.py 4 | 5 | Created by Thomas Mangin on 2009-11-05. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from exabgp.bgp.message.update.attribute.id import AttributeID 10 | from exabgp.bgp.message.update.attribute import Flag,Attribute 11 | 12 | # =================================================================== Origin (1) 13 | 14 | class Origin (Attribute): 15 | ID = AttributeID.ORIGIN 16 | FLAG = Flag.TRANSITIVE 17 | MULTIPLE = False 18 | 19 | IGP = 0x00 20 | EGP = 0x01 21 | INCOMPLETE = 0x02 22 | 23 | def __init__ (self,origin): 24 | self.origin = origin 25 | 26 | def pack (self,asn4=None): 27 | return self._attribute(chr(self.origin)) 28 | 29 | def __len__ (self): 30 | return len(self.pack()) 31 | 32 | def __str__ (self): 33 | if self.origin == 0x00: return 'igp' 34 | if self.origin == 0x01: return 'egp' 35 | if self.origin == 0x02: return 'incomplete' 36 | return 'invalid' 37 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/update/attribute/originatorid.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | originatorid.py 4 | 5 | Created by Thomas Mangin on 2012-07-07. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from exabgp.protocol.ip.inet import Inet 10 | from exabgp.bgp.message.update.attribute.id import AttributeID 11 | from exabgp.bgp.message.update.attribute import Flag,Attribute 12 | 13 | # =================================================================== OriginatorID (3) 14 | 15 | class OriginatorID (Attribute,Inet): 16 | ID = AttributeID.ORIGINATOR_ID 17 | FLAG = Flag.OPTIONAL 18 | MULTIPLE = False 19 | 20 | # Take an IP as value 21 | def __init__ (self,afi,safi,packed): 22 | Inet.__init__(self,afi,safi,packed) 23 | # This override Inet.pack too. 24 | self.packed = self._attribute(Inet.pack(self)) 25 | 26 | def pack (self,asn4=None): 27 | return Inet.pack(self) 28 | 29 | def __str__ (self): 30 | return Inet.__str__(self) 31 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/update/attribute/unknown.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | unknown.py 4 | 5 | Created by Thomas Mangin on 2009-11-05. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from exabgp.bgp.message.update.attribute import Attribute 10 | 11 | # =================================================================== MED (4) 12 | 13 | class UnknownAttribute (Attribute): 14 | MULTIPLE = False 15 | 16 | def __init__ (self,code,flag,data): 17 | self.ID = code 18 | self.FLAG = flag 19 | self.data = data 20 | self.index = '' 21 | 22 | def pack (self,asn4=None): 23 | return self._attribute(self.data) 24 | 25 | def __len__ (self): 26 | return len(self.data) 27 | 28 | def __str__ (self): 29 | return '0x' + ''.join('%02x' % ord(_) for _ in self.data) 30 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/update/attributes/factory.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | factory.py 4 | 5 | Created by Thomas Mangin on 2010-01-16. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from exabgp.bgp.message.update.attributes import Attributes 10 | from exabgp.bgp.message.update.attribute.id import AttributeID as AID 11 | from exabgp.bgp.message.notification import Notify 12 | 13 | def AttributesFactory (nlriFactory,negotiated,data): 14 | try: 15 | # caching and checking the last attribute parsed as nice implementation group them :-) 16 | if Attributes.cached and Attributes.cached.cacheable and data.startswith(Attributes.cached.prefix): 17 | attributes = Attributes.cached 18 | data = data[len(attributes.prefix):] 19 | else: 20 | attributes = Attributes() 21 | Attributes.cached = attributes 22 | 23 | # XXX: hackish for now 24 | attributes.mp_announce = [] 25 | attributes.mp_withdraw = [] 26 | 27 | attributes.negotiated = negotiated 28 | attributes.nlriFactory = nlriFactory 29 | attributes.factory(data) 30 | if AID.AS_PATH in attributes and AID.AS4_PATH in attributes: 31 | attributes.merge_attributes() 32 | return attributes 33 | except IndexError: 34 | raise Notify(3,2,data) 35 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/update/eor.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | eor.py 4 | 5 | Created by Thomas Mangin on 2010-01-16. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | from struct import unpack 9 | 10 | from exabgp.bgp.message import Message 11 | from exabgp.bgp.message.direction import IN,OUT 12 | from exabgp.bgp.message.update.nlri.eor import NLRIEOR 13 | from exabgp.bgp.message.update.attributes import Attributes 14 | 15 | # =================================================================== End-Of-RIB 16 | # not technically a different message type but easier to treat as one 17 | 18 | def _short (data): 19 | return unpack('!H',data[:2])[0] 20 | 21 | class EOR (Message): 22 | TYPE = chr(0x02) # it is an update 23 | PREFIX = '\x00\x00\x00\x07\x90\x0f\x00\x03' 24 | 25 | def __init__ (self,afi,safi,action=OUT.announce): 26 | self.nlris = [NLRIEOR(afi,safi,action),] 27 | self.attributes = Attributes() 28 | 29 | def message (self): 30 | return self._message( 31 | self.PREFIX + self.nlris[0].pack() 32 | ) 33 | 34 | def __str__ (self): 35 | return 'EOR' 36 | 37 | def EORFactory (data): 38 | afi = _short(data[-3:-1]) 39 | safi = ord(data[-1]) 40 | return EOR(afi,safi,IN.announced) 41 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/update/nlri/__init__.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | nlri/__init__.py 4 | 5 | Created by Thomas Mangin on 2013-08-07. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/update/nlri/eor.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | """ 4 | eor.py 5 | 6 | Created by Thomas Mangin on 2012-07-20. 7 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 8 | """ 9 | 10 | from exabgp.protocol.ip.address import Address 11 | 12 | class NLRIEOR (Address): 13 | nexthop = None 14 | 15 | def __init__ (self,afi,safi,action): 16 | Address.__init__(self,afi,safi) 17 | self.action = action 18 | 19 | def nlri (self): 20 | return 'eor %d/%d' % (self.afi,self.safi) 21 | 22 | def pack (self): 23 | return self.afi.pack() + self.safi.pack() 24 | 25 | def __str__ (self): 26 | return self.extensive() 27 | 28 | def extensive (self): 29 | return 'eor %d/%d (%s %s)' % (self.afi,self.safi,self.afi,self.safi) 30 | 31 | def json (self): 32 | return '"eor": { "afi" : %s, "safi" : %s }' % (self.afi,self.safi) 33 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bgp/message/update/nlri/prefix.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | prefix.py 4 | 5 | Created by Thomas Mangin on 2013-08-07. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | import math 10 | from exabgp.protocol.ip.inet import Inet 11 | 12 | mask_to_bytes = {} 13 | for netmask in range(0,129): 14 | mask_to_bytes[netmask] = int(math.ceil(float(netmask)/8)) 15 | 16 | 17 | class Prefix (Inet): 18 | # have a .raw for the ip 19 | # have a .mask for the mask 20 | # have a .bgp with the bgp wire format of the prefix 21 | 22 | def __init__(self,afi,safi,packed,mask): 23 | self.mask = mask 24 | Inet.__init__(self,afi,safi,packed) 25 | 26 | def __str__ (self): 27 | return self.prefix() 28 | 29 | def prefix (self): 30 | return "%s/%s" % (self.ip,self.mask) 31 | 32 | def pack (self): 33 | return chr(self.mask) + self.packed[:mask_to_bytes[self.mask]] 34 | 35 | def packed_ip(self): 36 | return self.packed[:mask_to_bytes[self.mask]] 37 | 38 | def __len__ (self): 39 | return mask_to_bytes[self.mask] + 1 40 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bmp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/exabgp/lib/exabgp/bmp/__init__.py -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bmp/header.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | message.py 4 | 5 | Created by Thomas Mangin on 2013-02-26. 6 | Copyright (c) 2009-2012 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from struct import unpack 10 | from exabgp.bmp.peer import Peer 11 | from exabgp.bmp.message import Message 12 | 13 | class Header (object): 14 | def __init__ (self,data): 15 | self.version = ord(data[0]) 16 | self.message = Message(ord(data[1])) 17 | self.peer = Peer(data) 18 | 19 | self.time_sec = unpack('!L',data[36:40])[0] 20 | self.time_micro_sec = unpack('!L',data[40:44])[0] 21 | 22 | def validate (self): 23 | if self.version != 1: return False 24 | if not self.message.validate(): return False 25 | if not self.peer.validate(): return False 26 | return True 27 | 28 | def json (self): 29 | return "{}" 30 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bmp/message.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | message.py 4 | 5 | Created by Thomas Mangin on 2013-02-26. 6 | Copyright (c) 2009-2012 Exa Networks. All rights reserved. 7 | """ 8 | 9 | class Message (int): 10 | ROUTE_MONITORING = 0 11 | STATISTICS_REPORT = 1 12 | PEER_DOWN_NOTIFICATION = 2 13 | 14 | _str = { 15 | 0 : 'route monitoring', 16 | 1 : 'statistics report', 17 | 2 : 'peer down notification', 18 | } 19 | 20 | def __str__ (self): 21 | return self._str.get(self,'unknow %d' % self) 22 | 23 | def validate (self): 24 | return self in (0,1,2) 25 | 26 | stat = { 27 | 0: "prefixes rejected by inbound policy", 28 | 1: "(known) duplicate prefix advertisements", 29 | 2: "(known) duplicate withdraws", 30 | 3: "updates invalidated due to CLUSTER_LIST loop", 31 | 4: "updates invalidated due to AS_PATH loop", 32 | } 33 | 34 | peer = { 35 | 1: "Local system closed session, notification sent", 36 | 2: "Local system closed session, no notification", 37 | 3: "Remote system closed session, notification sent", 38 | 4: "Remote system closed session, no notification", 39 | } 40 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bmp/negotiated.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | message.py 4 | 5 | Created by Thomas Mangin on 2013-02-26. 6 | Copyright (c) 2009-2012 Exa Networks. All rights reserved. 7 | """ 8 | 9 | class FakeAddPath (object): 10 | def send (self,afi,safi): 11 | return False 12 | 13 | def receive (self,afi,safi): 14 | return False 15 | 16 | class FakeNegotiated (object): 17 | def __init__ (self,header,asn4): 18 | self.asn4 = asn4 19 | self.addpath = FakeAddPath() 20 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/bmp/peer.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | peer.py 4 | 5 | Created by Thomas Mangin on 2013-02-26. 6 | Copyright (c) 2009-2012 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from struct import unpack 10 | from socket import inet_ntop, AF_INET, AF_INET6 11 | 12 | class PeerType (int): 13 | _str = { 14 | 0 : 'global', 15 | 1 : 'L3 VPN', 16 | } 17 | 18 | def __str__ (self): 19 | return self._str.get(self,'unknow %d' % self) 20 | 21 | class PeerFlag (int): 22 | _v4v6 = 0b10000000 23 | 24 | def ipv4 (self): 25 | return not self & self._v4v6 26 | 27 | def ipv6 (self): 28 | return bool(self & self._v4v6) 29 | 30 | class Peer (object): 31 | def __init__ (self,data): 32 | self.type = PeerType(ord(data[2])) 33 | self.flag = PeerFlag(ord(data[3])) 34 | self.distinguisher = unpack('!L',data[4:8])[0] 35 | self.asn = unpack('!L',data[28:32])[0] 36 | self.id = inet_ntop(AF_INET, data[32:36]) 37 | 38 | if self.flag.ipv4(): self.peer_address = inet_ntop(AF_INET, data[24:28]) 39 | if self.flag.ipv6(): self.peer_address = inet_ntop(AF_INET6, data[12:28]) 40 | 41 | def validate (self): 42 | return self.type in (0,1) 43 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/compatibility/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/exabgp/lib/exabgp/compatibility/__init__.py -------------------------------------------------------------------------------- /exabgp/lib/exabgp/compatibility/ordereddict.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | ''' 3 | ordereddict.py 4 | 5 | Created by Thomas Mangin on 2013-03-18. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | ''' 8 | 9 | # This is only an hack until we drop support for python version < 2.7 10 | 11 | class OrderedDict (dict): 12 | def __init__(self, args): 13 | dict.__init__(self, args) 14 | self._order = [_ for _,__ in args] 15 | 16 | def __setitem__(self, key, value): 17 | dict.__setitem__(self, key, value) 18 | if key in self._order: 19 | self._order.remove(key) 20 | self._order.append(key) 21 | 22 | def __delitem__(self, key): 23 | dict.__delitem__(self, key) 24 | self._order.remove(key) 25 | 26 | def keys (self): 27 | return self._order 28 | 29 | def __iter__ (self): 30 | return self.__next__() 31 | 32 | def __next__ (self): 33 | for k in self._order: 34 | yield k 35 | 36 | if __name__ == '__main__': 37 | d = OrderedDict(((10,'ten'),(8,'eight'),(6,'six'),(4,'four'),(2,'two'),(0,'boom'))) 38 | for k in d: 39 | print k 40 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/configuration/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/exabgp/lib/exabgp/configuration/__init__.py -------------------------------------------------------------------------------- /exabgp/lib/exabgp/data/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/exabgp/lib/exabgp/data/__init__.py -------------------------------------------------------------------------------- /exabgp/lib/exabgp/memory/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/exabgp/lib/exabgp/memory/__init__.py -------------------------------------------------------------------------------- /exabgp/lib/exabgp/memory/gcdump.py: -------------------------------------------------------------------------------- 1 | # http://teethgrinder.co.uk/perm.php?a=Python-memory-leak-detector 2 | import gc 3 | import inspect 4 | 5 | def dump(): 6 | # force collection 7 | print "\nCollecting GARBAGE:" 8 | gc.collect() 9 | # prove they have been collected 10 | print "\nCollecting GARBAGE:" 11 | gc.collect() 12 | 13 | print "\nGARBAGE OBJECTS:" 14 | for x in gc.garbage: 15 | s = str(x) 16 | if len(s) > 80: s = "%s..." % s[:80] 17 | 18 | print "::", s 19 | print " type:", type(x) 20 | print " referrers:", len(gc.get_referrers(x)) 21 | try: 22 | print " is class:", inspect.isclass(type(x)) 23 | print " module:", inspect.getmodule(x) 24 | 25 | lines, line_num = inspect.getsourcelines(type(x)) 26 | print " line num:", line_num 27 | for l in lines: 28 | print " line:", l.rstrip("\n") 29 | except: 30 | pass 31 | 32 | print 33 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/protocol/ip/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/exabgp/lib/exabgp/protocol/ip/__init__.py -------------------------------------------------------------------------------- /exabgp/lib/exabgp/protocol/ip/address.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | address.py 4 | 5 | Created by Thomas Mangin on 2012-07-16. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from exabgp.protocol.family import AFI,SAFI 10 | 11 | ## =================================================================== Address 12 | 13 | class Address (object): 14 | def __init__ (self,afi,safi): 15 | self.afi = AFI(afi) 16 | self.safi = SAFI(safi) 17 | 18 | def family (self): 19 | return (self.afi,self.safi) 20 | 21 | def address (self): 22 | return "%s %s" % (str(self.afi),str(self.safi)) 23 | 24 | def __str__ (self): 25 | return self.address() 26 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/protocol/ip/fragment.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | fragment.py 4 | 5 | Created by Thomas Mangin on 2010-02-04. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | # =================================================================== Fragment 10 | 11 | class Fragment (int): 12 | # reserved = 0xF0 13 | DONT = 0x08 14 | IS = 0x40 15 | FIRST = 0x20 16 | LAST = 0x10 17 | 18 | def __str__ (self): 19 | if self == 0x00: return 'not-a-fragment' 20 | if self == self.DONT: return 'dont-fragment' 21 | if self == self.IS: return 'is-fragment' 22 | if self == self.FIRST: return 'first-fragment' 23 | if self == self.LAST: return 'last-fragment' 24 | return 'unknown fragment value %d' % int(self) 25 | 26 | def NamedFragment (name): 27 | fragment = name.lower() 28 | if fragment == 'not-a-fragment': return Fragment(0x00) 29 | if fragment == 'dont-fragment': return Fragment(Fragment.DONT) 30 | if fragment == 'is-fragment': return Fragment(Fragment.IS) 31 | if fragment == 'first-fragment': return Fragment(Fragment.FIRST) 32 | if fragment == 'last-fragment': return Fragment(Fragment.LAST) 33 | raise ValueError('invalid fragment name %s' % fragment) 34 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/protocol/ip/tcp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/exabgp/lib/exabgp/protocol/ip/tcp/__init__.py -------------------------------------------------------------------------------- /exabgp/lib/exabgp/protocol/ip/tcp/flag.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | tcpflags.py 4 | 5 | Created by Thomas Mangin on 2010-02-04. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | # http://www.iana.org/assignments/tcp-header-flags 10 | class TCPFlag (int): 11 | FIN = 0x1 12 | SYN = 0x2 13 | RST = 0x4 14 | PUSH = 0x8 15 | ACK = 0x10 16 | URGENT = 0x20 17 | 18 | def __str__ (self): 19 | if self == self.FIN: return 'fin' 20 | if self == self.SYN: return 'syn' 21 | if self == self.RST: return 'rst' 22 | if self == self.PUSH: return 'push' 23 | if self == self.ACK: return 'ack' 24 | if self == self.URGENT: return 'urgent' 25 | return 'invalid tcp flag %d' % int(self) 26 | 27 | def NamedTCPFlag (name): 28 | flag = name.lower() 29 | if flag == 'fin': return TCPFlag(TCPFlag.FIN) 30 | if flag == 'syn': return TCPFlag(TCPFlag.SYN) 31 | if flag == 'rst': return TCPFlag(TCPFlag.RST) 32 | if flag == 'push': return TCPFlag(TCPFlag.PUSH) 33 | if flag == 'ack': return TCPFlag(TCPFlag.ACK) 34 | if flag == 'urgent': return TCPFlag(TCPFlag.URGENT) 35 | raise ValueError('invalid flag name %s' % flag) 36 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/reactor/api/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/exabgp/lib/exabgp/reactor/api/__init__.py -------------------------------------------------------------------------------- /exabgp/lib/exabgp/reactor/network/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/exabgp/lib/exabgp/reactor/network/__init__.py -------------------------------------------------------------------------------- /exabgp/lib/exabgp/reactor/network/incoming.py: -------------------------------------------------------------------------------- 1 | from exabgp.util.errstr import errstr 2 | 3 | from .connection import Connection 4 | from .tcp import nagle,async 5 | from .error import NetworkError,NotConnected 6 | 7 | from exabgp.bgp.message.notification import Notify 8 | 9 | class Incoming (Connection): 10 | direction = 'incoming' 11 | 12 | def __init__ (self,afi,peer,local,io): 13 | Connection.__init__(self,afi,peer,local) 14 | 15 | self.logger.wire("Connection from %s" % self.peer) 16 | 17 | try: 18 | self.io = io 19 | async(self.io,peer) 20 | nagle(self.io,peer) 21 | except NetworkError,e: 22 | self.close() 23 | raise NotConnected(errstr(e)) 24 | 25 | def notification (self,code,subcode,message): 26 | try: 27 | notification = Notify(code,subcode,message).message() 28 | for boolean in self.writer(notification): 29 | yield False 30 | self.logger.message(self.me('>> NOTIFICATION (%d,%d,"%s")' % (notification.code,notification.subcode,notification.data)),'error') 31 | yield True 32 | except NetworkError: 33 | pass # This is only be used when closing session due to unconfigured peers - so issues do not matter 34 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/reactor/network/outgoing.py: -------------------------------------------------------------------------------- 1 | from .connection import Connection 2 | from .tcp import create,bind,connect,MD5,nagle,TTL,async,ready 3 | from .error import NetworkError 4 | 5 | class Outgoing (Connection): 6 | direction = 'outgoing' 7 | 8 | def __init__ (self,afi,peer,local,port=179,md5='',ttl=None): 9 | Connection.__init__(self,afi,peer,local) 10 | 11 | self.logger.wire("Attempting connection to %s" % self.peer) 12 | 13 | self.peer = peer 14 | self.ttl = ttl 15 | self.afi = afi 16 | self.md5 = md5 17 | self.port = port 18 | 19 | try: 20 | self.io = create(afi) 21 | MD5(self.io,peer,port,afi,md5) 22 | bind(self.io,local,afi) 23 | async(self.io,peer) 24 | connect(self.io,peer,port,afi,md5) 25 | self.init = True 26 | except NetworkError: 27 | self.init = False 28 | self.close() 29 | 30 | def establish (self): 31 | if not self.init: 32 | yield False 33 | return 34 | 35 | try: 36 | generator = ready(self.io) 37 | while True: 38 | connected = generator.next() 39 | if not connected: 40 | yield False 41 | continue 42 | yield True 43 | return 44 | except StopIteration: 45 | # self.io MUST NOT be closed here, it is closed by the caller 46 | yield False 47 | return 48 | 49 | nagle(self.io,self.peer) 50 | TTL(self.io,self.peer,self.ttl) 51 | yield True 52 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/rib/__init__.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | rib/__init__.py 4 | 5 | Created by Thomas Mangin on 2010-01-15. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from exabgp.rib.store import Store 10 | 11 | class RIB: 12 | 13 | # when we perform a configuration reload using SIGUSR, we must not use the RIB 14 | # without the cache, all the updates previously sent via the API are lost 15 | 16 | _cache = {} 17 | 18 | def __init__ (self,name,adjribout,families): 19 | if name in self._cache: 20 | self.incoming = self._cache[name].incoming 21 | self.outgoing = self._cache[name].outgoing 22 | if adjribout: 23 | self.outgoing.resend(None,False) 24 | else: 25 | self.outgoing.clear() 26 | else: 27 | self.incoming = Store(families) 28 | self.outgoing = Store(families) 29 | self._cache[name] = self 30 | 31 | self.outgoing.cache = adjribout 32 | 33 | def reset (self): 34 | self.incoming.reset() 35 | self.outgoing.reset() 36 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/rib/change.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | change.py 4 | 5 | Created by Thomas Mangin on 2009-11-05. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | class Change (object): 10 | def __init__ (self,nlri,attributes): 11 | self.nlri = nlri 12 | self.attributes = attributes 13 | 14 | def index (self): 15 | return self.nlri.index() 16 | 17 | def __eq__ (self,other): 18 | return self.nlri == other.nlri and self.attributes == other.attributes 19 | 20 | def __ne__ (self,other): 21 | return self.nlri != other.nlri or self.attributes != other.attributes 22 | 23 | def extensive (self): 24 | # If you change this you must change as well extensive in Update 25 | return "%s%s" % (str(self.nlri),str(self.attributes)) 26 | 27 | def __str__ (self): 28 | return self.extensive() 29 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/util/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/exabgp/lib/exabgp/util/__init__.py -------------------------------------------------------------------------------- /exabgp/lib/exabgp/util/coroutine.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | coroutine.py 4 | 5 | Created by Thomas Mangin on 2013-07-01. 6 | Copyright (c) 2009-2012 Exa Networks. All rights reserved. 7 | """ 8 | 9 | from functools import wraps 10 | 11 | def each(function): 12 | @wraps(function) 13 | def start(*args, **kwargs): 14 | generator = function(*args, **kwargs) 15 | return lambda: generator.next() 16 | return start 17 | 18 | def join (function): 19 | @wraps(function) 20 | def start (*args, **kwargs): 21 | return ''.join(function(*args, **kwargs)) 22 | return start 23 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/util/counter.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | counter.py 4 | 5 | Created by Thomas Mangin on 2013-07-11. 6 | Copyright (c) 2013-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | import time 10 | 11 | # reporting the number of routes we saw 12 | class Counter (object): 13 | def __init__ (self,logger,me,interval=3): 14 | self.logger = logger 15 | 16 | self.me = me 17 | self.interval = interval 18 | self.last_update = time.time() 19 | self.count = 0 20 | self.last_count = 0 21 | 22 | def display (self): 23 | left = int(self.last_update + self.interval - time.time()) 24 | if left <=0: 25 | self.last_update = time.time() 26 | if self.count > self.last_count: 27 | self.last_count = self.count 28 | self.logger.reactor(self.me('processed %d routes' % self.count)) 29 | 30 | def increment (self,count): 31 | self.count += count 32 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/util/enumeration.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | ''' 3 | Enumeration.py 4 | 5 | Created by Thomas Mangin on 2013-03-18. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | ''' 8 | 9 | # int are immutable once created: can not set ._str in __init__ 10 | class _integer (int): 11 | def __str__ (self): 12 | return self._str 13 | 14 | class Enumeration (object): 15 | def __init__(self, *names): 16 | for number, name in enumerate(names): 17 | # doing the .parent thing here instead 18 | number = _integer(pow(2,number)) 19 | number._str = name 20 | setattr(self, name, number) 21 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/util/errstr.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | errstr.py 4 | 5 | Created by Thomas Mangin on 2011-03-29. 6 | Copyright (c) 2009-2012 Exa Networks. All rights reserved. 7 | """ 8 | 9 | import errno 10 | 11 | def errstr (e): 12 | return '[errno %s], %s' % (errno.errorcode[e.args[0]],str(e)) 13 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/util/ip.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | od.py 4 | 5 | Created by Thomas Mangin on 2009-09-12. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | import socket 10 | 11 | def isipv4(address): 12 | try: 13 | socket.inet_pton(socket.AF_INET, address) 14 | return True 15 | except socket.error: 16 | return False 17 | 18 | def isipv6(address): 19 | try: 20 | socket.inet_pton(socket.AF_INET6, address) 21 | return True 22 | except socket.error: 23 | return False 24 | 25 | def isip(address): 26 | return isipv4(address) or isipv6(address) 27 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/util/od.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | od.py 4 | 5 | Created by Thomas Mangin on 2009-09-06. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | def od (value): 10 | def spaced (value): 11 | even = None 12 | for v in value: 13 | if even is False: 14 | yield ' ' 15 | yield '%02X' % ord(v) 16 | even = not even 17 | return ''.join(spaced(value)) 18 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/util/trace.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | trace.py 4 | 5 | Created by Thomas Mangin on 2009-09-06. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | import StringIO 10 | import traceback 11 | 12 | def trace (): 13 | buff = StringIO.StringIO() 14 | traceback.print_exc(file=buff) 15 | r = buff.getvalue() 16 | buff.close() 17 | return r 18 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/util/usage.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | usage.py 4 | 5 | Created by Thomas Mangin on 2009-09-06. 6 | Copyright (c) 2009-2013 Exa Networks. All rights reserved. 7 | """ 8 | 9 | import sys 10 | import resource 11 | 12 | if sys.platform == 'darwin': 13 | # darwin returns bytes 14 | divisor = 1024.0*1024.0 15 | else: 16 | # other OS (AFAIK) return a number of pages 17 | divisor = 1024.0*1024.0/resource.getpagesize() 18 | 19 | def usage (label='usage'): 20 | usage=resource.getrusage(resource.RUSAGE_SELF) 21 | return '%s: usertime=%s systime=%s mem=%s mb' % (label,usage.ru_utime,usage.ru_stime,(usage.ru_maxrss/divisor)) 22 | -------------------------------------------------------------------------------- /exabgp/lib/exabgp/version.py: -------------------------------------------------------------------------------- 1 | version="3.2.18" 2 | 3 | # Do not change the first line as it is parsed by scripts 4 | 5 | if __name__ == '__main__': 6 | import sys 7 | sys.stdout.write(version) 8 | -------------------------------------------------------------------------------- /exabgp/lib/netlink/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/exabgp/lib/netlink/__init__.py -------------------------------------------------------------------------------- /exabgp/service/bgp-service-ip/log/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec multilog s2500000 n20 ./main 3 | -------------------------------------------------------------------------------- /exabgp/service/bgp-service-ip/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec nice --4 env PYTHONPATH=/opt/exabgp/lib setuidgid nobody `which python` /opt/exabgp/lib/exabgp/application/bgp.py /opt/exabgp/etc/exabgp/service-ip.txt 2>&1 3 | -------------------------------------------------------------------------------- /examples/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/__init__.py -------------------------------------------------------------------------------- /examples/app_specific_peering/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/app_specific_peering/__init__.py -------------------------------------------------------------------------------- /examples/app_specific_peering/local.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "A": { 3 | }, 4 | 5 | "B": { 6 | }, 7 | 8 | "D": { 9 | } 10 | } -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/app_specific_peering_inboundTE/__init__.py -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/controller/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/app_specific_peering_inboundTE/controller/__init__.py -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/controller/participant_policies/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/app_specific_peering_inboundTE/controller/participant_policies/__init__.py -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/controller/sdx_config/sdx_global.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "A": { 3 | "Ports": [ 4 | { 5 | "Id": 1, 6 | "MAC": "08:00:27:89:3b:9f", 7 | "IP": "172.0.0.1" 8 | } 9 | ], 10 | "Peers": ["B","C"] 11 | }, 12 | 13 | "B": { 14 | "Ports": [ 15 | { 16 | "Id": 2, 17 | "MAC": "08:00:27:92:18:1f", 18 | "IP": "172.0.0.11" 19 | } 20 | ], 21 | "Peers": ["A","C"] 22 | }, 23 | 24 | "C": { 25 | "Ports": [ 26 | { 27 | "Id": 3, 28 | "MAC": "08:00:27:54:56:ea", 29 | "IP": "172.0.0.21" 30 | }, 31 | { 32 | "Id": 4, 33 | "MAC": "08:00:27:bd:f8:b2", 34 | "IP": "172.0.0.22" 35 | } 36 | ], 37 | "Peers": ["A","B"] 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/controller/sdx_config/sdx_policies.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "A": ["pyretic.sdx.examples.app_specific_peering_inboundTE.controller.participant_policies.participant_A"], 3 | "B": ["pyretic.sdx.examples.app_specific_peering_inboundTE.controller.participant_policies.participant_B"], 4 | "C": ["pyretic.sdx.examples.app_specific_peering_inboundTE.controller.participant_policies.participant_C"] 5 | } 6 | -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/mininet/quaggacfgs/a1/bgpd.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-A 6 | password bgpd 7 | log stdout 8 | ! 9 | router bgp 100 10 | bgp router-id 172.0.0.1 11 | neighbor 172.0.255.254 remote-as 65000 12 | network 100.0.0.0/24 13 | network 110.0.0.0/24 14 | redistribute static 15 | ! 16 | line vty 17 | ! 18 | 19 | -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/mininet/quaggacfgs/a1/daemons: -------------------------------------------------------------------------------- 1 | # This file tells the quagga package which daemons to start. 2 | # 3 | # Entries are in the format: =(yes|no|priority) 4 | # 0, "no" = disabled 5 | # 1, "yes" = highest priority 6 | # 2 .. 10 = lower priorities 7 | # Read /usr/share/doc/quagga/README.Debian for details. 8 | # 9 | # Sample configurations for these daemons can be found in 10 | # /usr/share/doc/quagga/examples/. 11 | # 12 | # ATTENTION: 13 | # 14 | # When activation a daemon at the first time, a config file, even if it is 15 | # empty, has to be present *and* be owned by the user and group "quagga", else 16 | # the daemon will not be started by /etc/init.d/quagga. The permissions should 17 | # be u=rw,g=r,o=. 18 | # When using "vtysh" such a config file is also needed. It should be owned by 19 | # group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. 20 | # 21 | zebra=yes 22 | bgpd=yes 23 | ospfd=no 24 | ospf6d=no 25 | ripd=no 26 | ripngd=no 27 | isisd=no 28 | -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/mininet/quaggacfgs/a1/debian.conf: -------------------------------------------------------------------------------- 1 | # 2 | # If this option is set the /etc/init.d/quagga script automatically loads 3 | # the config via "vtysh -b" when the servers are started. 4 | # Check /etc/pam.d/quagga if you intend to use "vtysh"! 5 | # 6 | vtysh_enable=yes 7 | zebra_options=" --daemon -A 127.0.0.1" 8 | bgpd_options=" --daemon -A 127.0.0.1" 9 | ospfd_options=" --daemon -A 127.0.0.1" 10 | ospf6d_options="--daemon -A ::1" 11 | ripd_options=" --daemon -A 127.0.0.1" 12 | ripngd_options="--daemon -A ::1" 13 | isisd_options=" --daemon -A 127.0.0.1" 14 | -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/mininet/quaggacfgs/a1/tt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/app_specific_peering_inboundTE/mininet/quaggacfgs/a1/tt -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/mininet/quaggacfgs/a1/zebra.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-A 6 | password zebra 7 | enable password zebra 8 | ! 9 | !interface eth0 10 | ! ipv6 nd suppress-ra 11 | ! 12 | !interface eth1 13 | ! ipv6 nd suppress-ra 14 | ! 15 | interface a1-eth0 16 | ipv6 nd suppress-ra 17 | ip forwarding 18 | ! 19 | !interface eth3 20 | ! ipv6 nd suppress-ra 21 | ! 22 | !interface lo 23 | ! 24 | line vty 25 | ! 26 | -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/mininet/quaggacfgs/b1/bgpd.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-B 6 | password bgpd 7 | log stdout 8 | ! 9 | router bgp 200 10 | bgp router-id 172.0.0.11 11 | neighbor 172.0.255.254 remote-as 65000 12 | network 140.0.0.0/24 13 | network 150.0.0.0/24 14 | redistribute static 15 | ! 16 | line vty 17 | ! 18 | 19 | -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/mininet/quaggacfgs/b1/daemons: -------------------------------------------------------------------------------- 1 | # This file tells the quagga package which daemons to start. 2 | # 3 | # Entries are in the format: =(yes|no|priority) 4 | # 0, "no" = disabled 5 | # 1, "yes" = highest priority 6 | # 2 .. 10 = lower priorities 7 | # Read /usr/share/doc/quagga/README.Debian for details. 8 | # 9 | # Sample configurations for these daemons can be found in 10 | # /usr/share/doc/quagga/examples/. 11 | # 12 | # ATTENTION: 13 | # 14 | # When activation a daemon at the first time, a config file, even if it is 15 | # empty, has to be present *and* be owned by the user and group "quagga", else 16 | # the daemon will not be started by /etc/init.d/quagga. The permissions should 17 | # be u=rw,g=r,o=. 18 | # When using "vtysh" such a config file is also needed. It should be owned by 19 | # group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. 20 | # 21 | zebra=yes 22 | bgpd=yes 23 | ospfd=no 24 | ospf6d=no 25 | ripd=no 26 | ripngd=no 27 | isisd=no 28 | -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/mininet/quaggacfgs/b1/debian.conf: -------------------------------------------------------------------------------- 1 | # 2 | # If this option is set the /etc/init.d/quagga script automatically loads 3 | # the config via "vtysh -b" when the servers are started. 4 | # Check /etc/pam.d/quagga if you intend to use "vtysh"! 5 | # 6 | vtysh_enable=yes 7 | zebra_options=" --daemon -A 127.0.0.1" 8 | bgpd_options=" --daemon -A 127.0.0.1" 9 | ospfd_options=" --daemon -A 127.0.0.1" 10 | ospf6d_options="--daemon -A ::1" 11 | ripd_options=" --daemon -A 127.0.0.1" 12 | ripngd_options="--daemon -A ::1" 13 | isisd_options=" --daemon -A 127.0.0.1" 14 | -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/mininet/quaggacfgs/b1/zebra.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-B 6 | password zebra 7 | enable password zebra 8 | ! 9 | !interface eth0 10 | ! ipv6 nd suppress-ra 11 | ! 12 | !interface eth1 13 | ! ipv6 nd suppress-ra 14 | ! 15 | interface b1-eth0 16 | ipv6 nd suppress-ra 17 | ip forwarding 18 | ! 19 | !interface eth3 20 | ! ipv6 nd suppress-ra 21 | ! 22 | !interface lo 23 | ! 24 | line vty 25 | ! 26 | 27 | -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/mininet/quaggacfgs/c1/bgpd.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-C1 6 | password bgpd 7 | log stdout 8 | ! 9 | router bgp 300 10 | bgp router-id 172.0.0.21 11 | network 140.0.0.0/24 12 | network 150.0.0.0/24 13 | redistribute static 14 | neighbor 172.0.255.254 remote-as 65000 15 | ! 16 | line vty 17 | ! 18 | 19 | -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/mininet/quaggacfgs/c1/daemons: -------------------------------------------------------------------------------- 1 | # This file tells the quagga package which daemons to start. 2 | # 3 | # Entries are in the format: =(yes|no|priority) 4 | # 0, "no" = disabled 5 | # 1, "yes" = highest priority 6 | # 2 .. 10 = lower priorities 7 | # Read /usr/share/doc/quagga/README.Debian for details. 8 | # 9 | # Sample configurations for these daemons can be found in 10 | # /usr/share/doc/quagga/examples/. 11 | # 12 | # ATTENTION: 13 | # 14 | # When activation a daemon at the first time, a config file, even if it is 15 | # empty, has to be present *and* be owned by the user and group "quagga", else 16 | # the daemon will not be started by /etc/init.d/quagga. The permissions should 17 | # be u=rw,g=r,o=. 18 | # When using "vtysh" such a config file is also needed. It should be owned by 19 | # group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. 20 | # 21 | zebra=yes 22 | bgpd=yes 23 | ospfd=no 24 | ospf6d=no 25 | ripd=no 26 | ripngd=no 27 | isisd=no 28 | -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/mininet/quaggacfgs/c1/debian.conf: -------------------------------------------------------------------------------- 1 | # 2 | # If this option is set the /etc/init.d/quagga script automatically loads 3 | # the config via "vtysh -b" when the servers are started. 4 | # Check /etc/pam.d/quagga if you intend to use "vtysh"! 5 | # 6 | vtysh_enable=yes 7 | zebra_options=" --daemon -A 127.0.0.1" 8 | bgpd_options=" --daemon -A 127.0.0.1" 9 | ospfd_options=" --daemon -A 127.0.0.1" 10 | ospf6d_options="--daemon -A ::1" 11 | ripd_options=" --daemon -A 127.0.0.1" 12 | ripngd_options="--daemon -A ::1" 13 | isisd_options=" --daemon -A 127.0.0.1" 14 | -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/mininet/quaggacfgs/c1/zebra.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-C 6 | password zebra 7 | enable password zebra 8 | ! 9 | !interface eth0 10 | ! ipv6 nd suppress-ra 11 | ! 12 | !interface eth1 13 | ! ipv6 nd suppress-ra 14 | ! 15 | interface c1-eth0 16 | ipv6 nd suppress-ra 17 | ip forwarding 18 | ! 19 | !interface eth3 20 | ! ipv6 nd suppress-ra 21 | ! 22 | !interface lo 23 | ! 24 | line vty 25 | ! 26 | -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/mininet/quaggacfgs/c2/bgpd.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-C2 6 | password bgpd 7 | log stdout 8 | ! 9 | router bgp 300 10 | bgp router-id 172.0.0.22 11 | network 140.0.0.0/24 12 | network 150.0.0.0/24 13 | redistribute static 14 | neighbor 172.0.255.254 remote-as 65000 15 | ! 16 | line vty 17 | ! 18 | -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/mininet/quaggacfgs/c2/daemons: -------------------------------------------------------------------------------- 1 | # This file tells the quagga package which daemons to start. 2 | # 3 | # Entries are in the format: =(yes|no|priority) 4 | # 0, "no" = disabled 5 | # 1, "yes" = highest priority 6 | # 2 .. 10 = lower priorities 7 | # Read /usr/share/doc/quagga/README.Debian for details. 8 | # 9 | # Sample configurations for these daemons can be found in 10 | # /usr/share/doc/quagga/examples/. 11 | # 12 | # ATTENTION: 13 | # 14 | # When activation a daemon at the first time, a config file, even if it is 15 | # empty, has to be present *and* be owned by the user and group "quagga", else 16 | # the daemon will not be started by /etc/init.d/quagga. The permissions should 17 | # be u=rw,g=r,o=. 18 | # When using "vtysh" such a config file is also needed. It should be owned by 19 | # group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. 20 | # 21 | zebra=yes 22 | bgpd=yes 23 | ospfd=no 24 | ospf6d=no 25 | ripd=no 26 | ripngd=no 27 | isisd=no 28 | -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/mininet/quaggacfgs/c2/debian.conf: -------------------------------------------------------------------------------- 1 | # 2 | # If this option is set the /etc/init.d/quagga script automatically loads 3 | # the config via "vtysh -b" when the servers are started. 4 | # Check /etc/pam.d/quagga if you intend to use "vtysh"! 5 | # 6 | vtysh_enable=yes 7 | zebra_options=" --daemon -A 127.0.0.1" 8 | bgpd_options=" --daemon -A 127.0.0.1" 9 | ospfd_options=" --daemon -A 127.0.0.1" 10 | ospf6d_options="--daemon -A ::1" 11 | ripd_options=" --daemon -A 127.0.0.1" 12 | ripngd_options="--daemon -A ::1" 13 | isisd_options=" --daemon -A 127.0.0.1" 14 | -------------------------------------------------------------------------------- /examples/app_specific_peering_inboundTE/mininet/quaggacfgs/c2/zebra.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-C2 6 | password zebra 7 | enable password zebra 8 | ! 9 | !interface eth0 10 | ! ipv6 nd suppress-ra 11 | ! 12 | !interface eth1 13 | ! ipv6 nd suppress-ra 14 | ! 15 | interface c2-eth0 16 | ipv6 nd suppress-ra 17 | ip forwarding 18 | ! 19 | !interface eth3 20 | ! ipv6 nd suppress-ra 21 | ! 22 | !interface lo 23 | ! 24 | line vty 25 | ! 26 | -------------------------------------------------------------------------------- /examples/gec20_demo/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/gec20_demo/__init__.py -------------------------------------------------------------------------------- /examples/gec20_demo/controller/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/gec20_demo/controller/__init__.py -------------------------------------------------------------------------------- /examples/gec20_demo/controller/participant_policies/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/gec20_demo/controller/participant_policies/__init__.py -------------------------------------------------------------------------------- /examples/gec20_demo/controller/sdx_config/sdx_global.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "A": { 3 | "Ports": [ 4 | { 5 | "Id": 1, 6 | "MAC": "08:00:27:89:3b:9f", 7 | "IP": "172.0.0.1" 8 | } 9 | ], 10 | "Peers": ["B","C"] 11 | }, 12 | 13 | "B": { 14 | "Ports": [ 15 | { 16 | "Id": 2, 17 | "MAC": "08:00:27:92:18:1f", 18 | "IP": "172.0.0.11" 19 | } 20 | ], 21 | "Peers": ["A","C"] 22 | }, 23 | 24 | "C": { 25 | "Ports": [ 26 | { 27 | "Id": 3, 28 | "MAC": "08:00:27:54:56:ea", 29 | "IP": "172.0.0.21" 30 | }, 31 | { 32 | "Id": 4, 33 | "MAC": "08:00:27:bd:f8:b2", 34 | "IP": "172.0.0.22" 35 | } 36 | ], 37 | "Peers": ["A","B"] 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /examples/gec20_demo/controller/sdx_config/sdx_policies.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "A": ["pyretic.sdx.examples.gec20_demo.controller.participant_policies.participant_A"], 3 | "B": ["pyretic.sdx.examples.gec20_demo.controller.participant_policies.participant_B"], 4 | "C": ["pyretic.sdx.examples.gec20_demo.controller.participant_policies.participant_C"] 5 | } 6 | -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/a1/bgpd.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-A 6 | password bgpd 7 | log stdout 8 | ! 9 | router bgp 100 10 | bgp router-id 172.0.0.1 11 | neighbor 172.0.255.254 remote-as 65000 12 | network 100.0.0.0/24 13 | network 110.0.0.0/24 14 | redistribute static 15 | ! 16 | line vty 17 | ! 18 | 19 | -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/a1/bgpd.conf~: -------------------------------------------------------------------------------- 1 | password sdxpass 2 | router bgp 100 3 | bgp router-id 172.0.0.1 4 | neighbor 172.0.255.254 remote-as 65000 5 | neighbor 172.0.255.254 description Route-Server 6 | neighbor 172.0.255.254 update-source 172.0.0.1 -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/a1/daemons: -------------------------------------------------------------------------------- 1 | # This file tells the quagga package which daemons to start. 2 | # 3 | # Entries are in the format: =(yes|no|priority) 4 | # 0, "no" = disabled 5 | # 1, "yes" = highest priority 6 | # 2 .. 10 = lower priorities 7 | # Read /usr/share/doc/quagga/README.Debian for details. 8 | # 9 | # Sample configurations for these daemons can be found in 10 | # /usr/share/doc/quagga/examples/. 11 | # 12 | # ATTENTION: 13 | # 14 | # When activation a daemon at the first time, a config file, even if it is 15 | # empty, has to be present *and* be owned by the user and group "quagga", else 16 | # the daemon will not be started by /etc/init.d/quagga. The permissions should 17 | # be u=rw,g=r,o=. 18 | # When using "vtysh" such a config file is also needed. It should be owned by 19 | # group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. 20 | # 21 | zebra=yes 22 | bgpd=yes 23 | ospfd=no 24 | ospf6d=no 25 | ripd=no 26 | ripngd=no 27 | isisd=no 28 | -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/a1/debian.conf: -------------------------------------------------------------------------------- 1 | # 2 | # If this option is set the /etc/init.d/quagga script automatically loads 3 | # the config via "vtysh -b" when the servers are started. 4 | # Check /etc/pam.d/quagga if you intend to use "vtysh"! 5 | # 6 | vtysh_enable=yes 7 | zebra_options=" --daemon -A 127.0.0.1" 8 | bgpd_options=" --daemon -A 127.0.0.1" 9 | ospfd_options=" --daemon -A 127.0.0.1" 10 | ospf6d_options="--daemon -A ::1" 11 | ripd_options=" --daemon -A 127.0.0.1" 12 | ripngd_options="--daemon -A ::1" 13 | isisd_options=" --daemon -A 127.0.0.1" 14 | -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/a1/tt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/gec20_demo/mininet/quaggacfgs/a1/tt -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/a1/zebra.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-A 6 | password zebra 7 | enable password zebra 8 | ! 9 | !interface eth0 10 | ! ipv6 nd suppress-ra 11 | ! 12 | !interface eth1 13 | ! ipv6 nd suppress-ra 14 | ! 15 | interface a1-eth0 16 | ipv6 nd suppress-ra 17 | ip forwarding 18 | ! 19 | !interface eth3 20 | ! ipv6 nd suppress-ra 21 | ! 22 | !interface lo 23 | ! 24 | line vty 25 | ! 26 | -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/b1/bgpd.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-B 6 | password bgpd 7 | log stdout 8 | ! 9 | router bgp 200 10 | bgp router-id 172.0.0.11 11 | neighbor 172.0.255.254 remote-as 65000 12 | network 140.0.0.0/24 13 | network 150.0.0.0/24 14 | redistribute static 15 | ! 16 | line vty 17 | ! 18 | 19 | -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/b1/bgpd.conf~: -------------------------------------------------------------------------------- 1 | password sdxpass 2 | router bgp 200 3 | bgp router-id 172.0.0.11 4 | neighbor 172.0.255.254 remote-as 65000 5 | neighbor 172.0.255.254 description Route-Server 6 | neighbor 172.0.255.254 update-source 172.0.0.1 -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/b1/daemons: -------------------------------------------------------------------------------- 1 | # This file tells the quagga package which daemons to start. 2 | # 3 | # Entries are in the format: =(yes|no|priority) 4 | # 0, "no" = disabled 5 | # 1, "yes" = highest priority 6 | # 2 .. 10 = lower priorities 7 | # Read /usr/share/doc/quagga/README.Debian for details. 8 | # 9 | # Sample configurations for these daemons can be found in 10 | # /usr/share/doc/quagga/examples/. 11 | # 12 | # ATTENTION: 13 | # 14 | # When activation a daemon at the first time, a config file, even if it is 15 | # empty, has to be present *and* be owned by the user and group "quagga", else 16 | # the daemon will not be started by /etc/init.d/quagga. The permissions should 17 | # be u=rw,g=r,o=. 18 | # When using "vtysh" such a config file is also needed. It should be owned by 19 | # group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. 20 | # 21 | zebra=yes 22 | bgpd=yes 23 | ospfd=no 24 | ospf6d=no 25 | ripd=no 26 | ripngd=no 27 | isisd=no 28 | -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/b1/debian.conf: -------------------------------------------------------------------------------- 1 | # 2 | # If this option is set the /etc/init.d/quagga script automatically loads 3 | # the config via "vtysh -b" when the servers are started. 4 | # Check /etc/pam.d/quagga if you intend to use "vtysh"! 5 | # 6 | vtysh_enable=yes 7 | zebra_options=" --daemon -A 127.0.0.1" 8 | bgpd_options=" --daemon -A 127.0.0.1" 9 | ospfd_options=" --daemon -A 127.0.0.1" 10 | ospf6d_options="--daemon -A ::1" 11 | ripd_options=" --daemon -A 127.0.0.1" 12 | ripngd_options="--daemon -A ::1" 13 | isisd_options=" --daemon -A 127.0.0.1" 14 | -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/b1/zebra.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-B 6 | password zebra 7 | enable password zebra 8 | ! 9 | !interface eth0 10 | ! ipv6 nd suppress-ra 11 | ! 12 | !interface eth1 13 | ! ipv6 nd suppress-ra 14 | ! 15 | interface b1-eth0 16 | ipv6 nd suppress-ra 17 | ip forwarding 18 | ! 19 | !interface eth3 20 | ! ipv6 nd suppress-ra 21 | ! 22 | !interface lo 23 | ! 24 | line vty 25 | ! 26 | 27 | -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/c1/bgpd.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-C1 6 | password bgpd 7 | log stdout 8 | ! 9 | router bgp 300 10 | bgp router-id 172.0.0.21 11 | network 140.0.0.0/24 12 | network 150.0.0.0/24 13 | redistribute static 14 | neighbor 172.0.255.254 remote-as 65000 15 | ! 16 | line vty 17 | ! 18 | 19 | -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/c1/bgpd.conf~: -------------------------------------------------------------------------------- 1 | password sdxpass 2 | router bgp 100 3 | bgp router-id 172.0.0.1 4 | neighbor 172.0.255.254 remote-as 65000 5 | neighbor 172.0.255.254 description Route-Server 6 | neighbor 172.0.255.254 update-source 172.0.0.1 -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/c1/daemons: -------------------------------------------------------------------------------- 1 | # This file tells the quagga package which daemons to start. 2 | # 3 | # Entries are in the format: =(yes|no|priority) 4 | # 0, "no" = disabled 5 | # 1, "yes" = highest priority 6 | # 2 .. 10 = lower priorities 7 | # Read /usr/share/doc/quagga/README.Debian for details. 8 | # 9 | # Sample configurations for these daemons can be found in 10 | # /usr/share/doc/quagga/examples/. 11 | # 12 | # ATTENTION: 13 | # 14 | # When activation a daemon at the first time, a config file, even if it is 15 | # empty, has to be present *and* be owned by the user and group "quagga", else 16 | # the daemon will not be started by /etc/init.d/quagga. The permissions should 17 | # be u=rw,g=r,o=. 18 | # When using "vtysh" such a config file is also needed. It should be owned by 19 | # group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. 20 | # 21 | zebra=yes 22 | bgpd=yes 23 | ospfd=no 24 | ospf6d=no 25 | ripd=no 26 | ripngd=no 27 | isisd=no 28 | -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/c1/debian.conf: -------------------------------------------------------------------------------- 1 | # 2 | # If this option is set the /etc/init.d/quagga script automatically loads 3 | # the config via "vtysh -b" when the servers are started. 4 | # Check /etc/pam.d/quagga if you intend to use "vtysh"! 5 | # 6 | vtysh_enable=yes 7 | zebra_options=" --daemon -A 127.0.0.1" 8 | bgpd_options=" --daemon -A 127.0.0.1" 9 | ospfd_options=" --daemon -A 127.0.0.1" 10 | ospf6d_options="--daemon -A ::1" 11 | ripd_options=" --daemon -A 127.0.0.1" 12 | ripngd_options="--daemon -A ::1" 13 | isisd_options=" --daemon -A 127.0.0.1" 14 | -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/c1/zebra.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-C 6 | password zebra 7 | enable password zebra 8 | ! 9 | !interface eth0 10 | ! ipv6 nd suppress-ra 11 | ! 12 | !interface eth1 13 | ! ipv6 nd suppress-ra 14 | ! 15 | interface c1-eth0 16 | ipv6 nd suppress-ra 17 | ip forwarding 18 | ! 19 | !interface eth3 20 | ! ipv6 nd suppress-ra 21 | ! 22 | !interface lo 23 | ! 24 | line vty 25 | ! 26 | -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/c2/bgpd.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-C2 6 | password bgpd 7 | log stdout 8 | ! 9 | router bgp 300 10 | bgp router-id 172.0.0.22 11 | network 140.0.0.0/24 12 | network 150.0.0.0/24 13 | redistribute static 14 | neighbor 172.0.255.254 remote-as 65000 15 | ! 16 | line vty 17 | ! 18 | -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/c2/bgpd.conf~: -------------------------------------------------------------------------------- 1 | password sdxpass 2 | router bgp 300 3 | bgp router-id 172.0.0.22 4 | neighbor 172.0.255.254 remote-as 65000 5 | neighbor 172.0.255.254 description Route-Server 6 | neighbor 172.0.255.254 update-source 172.0.0.1 -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/c2/daemons: -------------------------------------------------------------------------------- 1 | # This file tells the quagga package which daemons to start. 2 | # 3 | # Entries are in the format: =(yes|no|priority) 4 | # 0, "no" = disabled 5 | # 1, "yes" = highest priority 6 | # 2 .. 10 = lower priorities 7 | # Read /usr/share/doc/quagga/README.Debian for details. 8 | # 9 | # Sample configurations for these daemons can be found in 10 | # /usr/share/doc/quagga/examples/. 11 | # 12 | # ATTENTION: 13 | # 14 | # When activation a daemon at the first time, a config file, even if it is 15 | # empty, has to be present *and* be owned by the user and group "quagga", else 16 | # the daemon will not be started by /etc/init.d/quagga. The permissions should 17 | # be u=rw,g=r,o=. 18 | # When using "vtysh" such a config file is also needed. It should be owned by 19 | # group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. 20 | # 21 | zebra=yes 22 | bgpd=yes 23 | ospfd=no 24 | ospf6d=no 25 | ripd=no 26 | ripngd=no 27 | isisd=no 28 | -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/c2/debian.conf: -------------------------------------------------------------------------------- 1 | # 2 | # If this option is set the /etc/init.d/quagga script automatically loads 3 | # the config via "vtysh -b" when the servers are started. 4 | # Check /etc/pam.d/quagga if you intend to use "vtysh"! 5 | # 6 | vtysh_enable=yes 7 | zebra_options=" --daemon -A 127.0.0.1" 8 | bgpd_options=" --daemon -A 127.0.0.1" 9 | ospfd_options=" --daemon -A 127.0.0.1" 10 | ospf6d_options="--daemon -A ::1" 11 | ripd_options=" --daemon -A 127.0.0.1" 12 | ripngd_options="--daemon -A ::1" 13 | isisd_options=" --daemon -A 127.0.0.1" 14 | -------------------------------------------------------------------------------- /examples/gec20_demo/mininet/quaggacfgs/c2/zebra.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-C2 6 | password zebra 7 | enable password zebra 8 | ! 9 | !interface eth0 10 | ! ipv6 nd suppress-ra 11 | ! 12 | !interface eth1 13 | ! ipv6 nd suppress-ra 14 | ! 15 | interface c2-eth0 16 | ipv6 nd suppress-ra 17 | ip forwarding 18 | ! 19 | !interface eth3 20 | ! ipv6 nd suppress-ra 21 | ! 22 | !interface lo 23 | ! 24 | line vty 25 | ! 26 | -------------------------------------------------------------------------------- /examples/inbound_traffic_engineering/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/inbound_traffic_engineering/__init__.py -------------------------------------------------------------------------------- /examples/inbound_traffic_engineering/local.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "A": { 3 | "IP": [ 4 | "100.0.0.1" 5 | ] 6 | }, 7 | 8 | "B": { 9 | "IP": [ 10 | "120.0.0.1" 11 | ] 12 | }, 13 | 14 | "C": { 15 | "IP": [ 16 | "140.0.0.1", 17 | "150.0.0.1" 18 | ] 19 | } 20 | } -------------------------------------------------------------------------------- /examples/inbound_traffic_engineering_VNH/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/inbound_traffic_engineering_VNH/__init__.py -------------------------------------------------------------------------------- /examples/inbound_traffic_engineering_VNH/local.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "A": { 3 | "IPP": [ 4 | "100.0.0.0/16" 5 | ], 6 | "Policy1":[ 7 | ] 8 | }, 9 | 10 | "B": { 11 | "IPP": [ 12 | "120.0.0.0/16" 13 | ], 14 | "Policy1":[ 15 | ] 16 | }, 17 | 18 | "C": { 19 | "IPP": [ 20 | "140.0.0.0/16", 21 | "150.0.0.0/16" 22 | ], 23 | "Policy1": [ 24 | "140.0.0.0/16", 25 | "150.0.0.0/16" 26 | ] 27 | } 28 | } -------------------------------------------------------------------------------- /examples/inbound_traffic_engineering_ip_prefixes/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/inbound_traffic_engineering_ip_prefixes/__init__.py -------------------------------------------------------------------------------- /examples/inbound_traffic_engineering_ip_prefixes/local.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "A": { 3 | "IPP": [ 4 | "100.0.0.0/16" 5 | ] 6 | }, 7 | 8 | "B": { 9 | "IPP": [ 10 | "120.0.0.0/16" 11 | ] 12 | }, 13 | 14 | "C": { 15 | "IPP": [ 16 | "140.0.0.0/16", 17 | "150.0.0.0/16" 18 | ] 19 | } 20 | } -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/sigcomm14_mininet/__init__.py -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/controller/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/sigcomm14_mininet/controller/__init__.py -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/controller/participant_policies/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/sigcomm14_mininet/controller/participant_policies/__init__.py -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/controller/sdx_config/sdx_global.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "A": { 3 | "Ports": [ 4 | { 5 | "Id": 1, 6 | "MAC": "08:00:27:89:3b:9f", 7 | "IP": "172.0.0.1" 8 | } 9 | ], 10 | "Peers": ["B","C"] 11 | }, 12 | 13 | "B": { 14 | "Ports": [ 15 | { 16 | "Id": 2, 17 | "MAC": "08:00:27:92:18:1f", 18 | "IP": "172.0.0.11" 19 | } 20 | ], 21 | "Peers": ["A","C"] 22 | }, 23 | 24 | "C": { 25 | "Ports": [ 26 | { 27 | "Id": 3, 28 | "MAC": "08:00:27:54:56:ea", 29 | "IP": "172.0.0.21" 30 | }, 31 | { 32 | "Id": 4, 33 | "MAC": "08:00:27:bd:f8:b2", 34 | "IP": "172.0.0.22" 35 | } 36 | ], 37 | "Peers": ["A","B"] 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/controller/sdx_config/sdx_policies.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "A": ["pyretic.sdx.examples.sigcomm14_mininet.controller.participant_policies.participant_A"], 3 | "B": ["pyretic.sdx.examples.sigcomm14_mininet.controller.participant_policies.participant_B"], 4 | "C": ["pyretic.sdx.examples.sigcomm14_mininet.controller.participant_policies.participant_C"] 5 | } 6 | -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/a1/bgpd.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-A 6 | password bgpd 7 | log stdout 8 | ! 9 | router bgp 100 10 | bgp router-id 172.0.0.1 11 | neighbor 172.0.255.254 remote-as 65000 12 | network 100.0.0.0/24 13 | network 110.0.0.0/24 14 | redistribute static 15 | ! 16 | line vty 17 | ! 18 | 19 | -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/a1/bgpd.conf~: -------------------------------------------------------------------------------- 1 | password sdxpass 2 | router bgp 100 3 | bgp router-id 172.0.0.1 4 | neighbor 172.0.255.254 remote-as 65000 5 | neighbor 172.0.255.254 description Route-Server 6 | neighbor 172.0.255.254 update-source 172.0.0.1 -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/a1/daemons: -------------------------------------------------------------------------------- 1 | # This file tells the quagga package which daemons to start. 2 | # 3 | # Entries are in the format: =(yes|no|priority) 4 | # 0, "no" = disabled 5 | # 1, "yes" = highest priority 6 | # 2 .. 10 = lower priorities 7 | # Read /usr/share/doc/quagga/README.Debian for details. 8 | # 9 | # Sample configurations for these daemons can be found in 10 | # /usr/share/doc/quagga/examples/. 11 | # 12 | # ATTENTION: 13 | # 14 | # When activation a daemon at the first time, a config file, even if it is 15 | # empty, has to be present *and* be owned by the user and group "quagga", else 16 | # the daemon will not be started by /etc/init.d/quagga. The permissions should 17 | # be u=rw,g=r,o=. 18 | # When using "vtysh" such a config file is also needed. It should be owned by 19 | # group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. 20 | # 21 | zebra=yes 22 | bgpd=yes 23 | ospfd=no 24 | ospf6d=no 25 | ripd=no 26 | ripngd=no 27 | isisd=no 28 | -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/a1/debian.conf: -------------------------------------------------------------------------------- 1 | # 2 | # If this option is set the /etc/init.d/quagga script automatically loads 3 | # the config via "vtysh -b" when the servers are started. 4 | # Check /etc/pam.d/quagga if you intend to use "vtysh"! 5 | # 6 | vtysh_enable=yes 7 | zebra_options=" --daemon -A 127.0.0.1" 8 | bgpd_options=" --daemon -A 127.0.0.1" 9 | ospfd_options=" --daemon -A 127.0.0.1" 10 | ospf6d_options="--daemon -A ::1" 11 | ripd_options=" --daemon -A 127.0.0.1" 12 | ripngd_options="--daemon -A ::1" 13 | isisd_options=" --daemon -A 127.0.0.1" 14 | -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/a1/tt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/sigcomm14_mininet/mininet/quaggacfgs/a1/tt -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/a1/zebra.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-A 6 | password zebra 7 | enable password zebra 8 | ! 9 | !interface eth0 10 | ! ipv6 nd suppress-ra 11 | ! 12 | !interface eth1 13 | ! ipv6 nd suppress-ra 14 | ! 15 | interface a1-eth0 16 | ipv6 nd suppress-ra 17 | ip forwarding 18 | ! 19 | !interface eth3 20 | ! ipv6 nd suppress-ra 21 | ! 22 | !interface lo 23 | ! 24 | line vty 25 | ! 26 | -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/b1/bgpd.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-B 6 | password bgpd 7 | log stdout 8 | ! 9 | router bgp 200 10 | bgp router-id 172.0.0.11 11 | neighbor 172.0.255.254 remote-as 65000 12 | network 140.0.0.0/24 13 | network 150.0.0.0/24 14 | redistribute static 15 | ! 16 | line vty 17 | ! 18 | 19 | -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/b1/bgpd.conf~: -------------------------------------------------------------------------------- 1 | password sdxpass 2 | router bgp 200 3 | bgp router-id 172.0.0.11 4 | neighbor 172.0.255.254 remote-as 65000 5 | neighbor 172.0.255.254 description Route-Server 6 | neighbor 172.0.255.254 update-source 172.0.0.1 -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/b1/daemons: -------------------------------------------------------------------------------- 1 | # This file tells the quagga package which daemons to start. 2 | # 3 | # Entries are in the format: =(yes|no|priority) 4 | # 0, "no" = disabled 5 | # 1, "yes" = highest priority 6 | # 2 .. 10 = lower priorities 7 | # Read /usr/share/doc/quagga/README.Debian for details. 8 | # 9 | # Sample configurations for these daemons can be found in 10 | # /usr/share/doc/quagga/examples/. 11 | # 12 | # ATTENTION: 13 | # 14 | # When activation a daemon at the first time, a config file, even if it is 15 | # empty, has to be present *and* be owned by the user and group "quagga", else 16 | # the daemon will not be started by /etc/init.d/quagga. The permissions should 17 | # be u=rw,g=r,o=. 18 | # When using "vtysh" such a config file is also needed. It should be owned by 19 | # group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. 20 | # 21 | zebra=yes 22 | bgpd=yes 23 | ospfd=no 24 | ospf6d=no 25 | ripd=no 26 | ripngd=no 27 | isisd=no 28 | -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/b1/debian.conf: -------------------------------------------------------------------------------- 1 | # 2 | # If this option is set the /etc/init.d/quagga script automatically loads 3 | # the config via "vtysh -b" when the servers are started. 4 | # Check /etc/pam.d/quagga if you intend to use "vtysh"! 5 | # 6 | vtysh_enable=yes 7 | zebra_options=" --daemon -A 127.0.0.1" 8 | bgpd_options=" --daemon -A 127.0.0.1" 9 | ospfd_options=" --daemon -A 127.0.0.1" 10 | ospf6d_options="--daemon -A ::1" 11 | ripd_options=" --daemon -A 127.0.0.1" 12 | ripngd_options="--daemon -A ::1" 13 | isisd_options=" --daemon -A 127.0.0.1" 14 | -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/b1/zebra.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-B 6 | password zebra 7 | enable password zebra 8 | ! 9 | !interface eth0 10 | ! ipv6 nd suppress-ra 11 | ! 12 | !interface eth1 13 | ! ipv6 nd suppress-ra 14 | ! 15 | interface b1-eth0 16 | ipv6 nd suppress-ra 17 | ip forwarding 18 | ! 19 | !interface eth3 20 | ! ipv6 nd suppress-ra 21 | ! 22 | !interface lo 23 | ! 24 | line vty 25 | ! 26 | 27 | -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/c1/bgpd.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-C1 6 | password bgpd 7 | log stdout 8 | ! 9 | router bgp 300 10 | bgp router-id 172.0.0.21 11 | network 140.0.0.0/24 12 | network 150.0.0.0/24 13 | redistribute static 14 | neighbor 172.0.255.254 remote-as 65000 15 | ! 16 | line vty 17 | ! 18 | 19 | -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/c1/bgpd.conf~: -------------------------------------------------------------------------------- 1 | password sdxpass 2 | router bgp 100 3 | bgp router-id 172.0.0.1 4 | neighbor 172.0.255.254 remote-as 65000 5 | neighbor 172.0.255.254 description Route-Server 6 | neighbor 172.0.255.254 update-source 172.0.0.1 -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/c1/daemons: -------------------------------------------------------------------------------- 1 | # This file tells the quagga package which daemons to start. 2 | # 3 | # Entries are in the format: =(yes|no|priority) 4 | # 0, "no" = disabled 5 | # 1, "yes" = highest priority 6 | # 2 .. 10 = lower priorities 7 | # Read /usr/share/doc/quagga/README.Debian for details. 8 | # 9 | # Sample configurations for these daemons can be found in 10 | # /usr/share/doc/quagga/examples/. 11 | # 12 | # ATTENTION: 13 | # 14 | # When activation a daemon at the first time, a config file, even if it is 15 | # empty, has to be present *and* be owned by the user and group "quagga", else 16 | # the daemon will not be started by /etc/init.d/quagga. The permissions should 17 | # be u=rw,g=r,o=. 18 | # When using "vtysh" such a config file is also needed. It should be owned by 19 | # group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. 20 | # 21 | zebra=yes 22 | bgpd=yes 23 | ospfd=no 24 | ospf6d=no 25 | ripd=no 26 | ripngd=no 27 | isisd=no 28 | -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/c1/debian.conf: -------------------------------------------------------------------------------- 1 | # 2 | # If this option is set the /etc/init.d/quagga script automatically loads 3 | # the config via "vtysh -b" when the servers are started. 4 | # Check /etc/pam.d/quagga if you intend to use "vtysh"! 5 | # 6 | vtysh_enable=yes 7 | zebra_options=" --daemon -A 127.0.0.1" 8 | bgpd_options=" --daemon -A 127.0.0.1" 9 | ospfd_options=" --daemon -A 127.0.0.1" 10 | ospf6d_options="--daemon -A ::1" 11 | ripd_options=" --daemon -A 127.0.0.1" 12 | ripngd_options="--daemon -A ::1" 13 | isisd_options=" --daemon -A 127.0.0.1" 14 | -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/c1/zebra.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-C 6 | password zebra 7 | enable password zebra 8 | ! 9 | !interface eth0 10 | ! ipv6 nd suppress-ra 11 | ! 12 | !interface eth1 13 | ! ipv6 nd suppress-ra 14 | ! 15 | interface c1-eth0 16 | ipv6 nd suppress-ra 17 | ip forwarding 18 | ! 19 | !interface eth3 20 | ! ipv6 nd suppress-ra 21 | ! 22 | !interface lo 23 | ! 24 | line vty 25 | ! 26 | -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/c2/bgpd.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-C2 6 | password bgpd 7 | log stdout 8 | ! 9 | router bgp 300 10 | bgp router-id 172.0.0.22 11 | network 140.0.0.0/24 12 | network 150.0.0.0/24 13 | redistribute static 14 | neighbor 172.0.255.254 remote-as 65000 15 | ! 16 | line vty 17 | ! 18 | -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/c2/bgpd.conf~: -------------------------------------------------------------------------------- 1 | password sdxpass 2 | router bgp 300 3 | bgp router-id 172.0.0.22 4 | neighbor 172.0.255.254 remote-as 65000 5 | neighbor 172.0.255.254 description Route-Server 6 | neighbor 172.0.255.254 update-source 172.0.0.1 -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/c2/daemons: -------------------------------------------------------------------------------- 1 | # This file tells the quagga package which daemons to start. 2 | # 3 | # Entries are in the format: =(yes|no|priority) 4 | # 0, "no" = disabled 5 | # 1, "yes" = highest priority 6 | # 2 .. 10 = lower priorities 7 | # Read /usr/share/doc/quagga/README.Debian for details. 8 | # 9 | # Sample configurations for these daemons can be found in 10 | # /usr/share/doc/quagga/examples/. 11 | # 12 | # ATTENTION: 13 | # 14 | # When activation a daemon at the first time, a config file, even if it is 15 | # empty, has to be present *and* be owned by the user and group "quagga", else 16 | # the daemon will not be started by /etc/init.d/quagga. The permissions should 17 | # be u=rw,g=r,o=. 18 | # When using "vtysh" such a config file is also needed. It should be owned by 19 | # group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. 20 | # 21 | zebra=yes 22 | bgpd=yes 23 | ospfd=no 24 | ospf6d=no 25 | ripd=no 26 | ripngd=no 27 | isisd=no 28 | -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/c2/debian.conf: -------------------------------------------------------------------------------- 1 | # 2 | # If this option is set the /etc/init.d/quagga script automatically loads 3 | # the config via "vtysh -b" when the servers are started. 4 | # Check /etc/pam.d/quagga if you intend to use "vtysh"! 5 | # 6 | vtysh_enable=yes 7 | zebra_options=" --daemon -A 127.0.0.1" 8 | bgpd_options=" --daemon -A 127.0.0.1" 9 | ospfd_options=" --daemon -A 127.0.0.1" 10 | ospf6d_options="--daemon -A ::1" 11 | ripd_options=" --daemon -A 127.0.0.1" 12 | ripngd_options="--daemon -A ::1" 13 | isisd_options=" --daemon -A 127.0.0.1" 14 | -------------------------------------------------------------------------------- /examples/sigcomm14_mininet/mininet/quaggacfgs/c2/zebra.conf: -------------------------------------------------------------------------------- 1 | ! 2 | ! Zebra configuration saved from vty 3 | ! 2013/10/02 20:47:51 4 | ! 5 | hostname Virtual-AS-C2 6 | password zebra 7 | enable password zebra 8 | ! 9 | !interface eth0 10 | ! ipv6 nd suppress-ra 11 | ! 12 | !interface eth1 13 | ! ipv6 nd suppress-ra 14 | ! 15 | interface c2-eth0 16 | ipv6 nd suppress-ra 17 | ip forwarding 18 | ! 19 | !interface eth3 20 | ! ipv6 nd suppress-ra 21 | ! 22 | !interface lo 23 | ! 24 | line vty 25 | ! 26 | -------------------------------------------------------------------------------- /examples/simple/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/simple/__init__.py -------------------------------------------------------------------------------- /examples/simple/local.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "A": { 3 | "IP": [ 4 | "100.0.0.1" 5 | ] 6 | }, 7 | 8 | "B": { 9 | "IP": [ 10 | "120.0.0.1" 11 | ] 12 | }, 13 | 14 | "C": { 15 | "IP": [ 16 | "140.0.0.1" 17 | ] 18 | } 19 | } -------------------------------------------------------------------------------- /examples/simple_ip_prefixes/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/simple_ip_prefixes/__init__.py -------------------------------------------------------------------------------- /examples/simple_ip_prefixes/local.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "A": { 3 | "IPP": [ 4 | "100.0.0.0/16", 5 | "110.0.0.0/16" 6 | ] 7 | }, 8 | 9 | "B": { 10 | "IPP": [ 11 | "120.0.0.0/16", 12 | "130.0.0.0/16" 13 | ] 14 | }, 15 | 16 | "C": { 17 | "IPP": [ 18 | "140.0.0.0/16", 19 | "150.0.0.0/16" 20 | ] 21 | } 22 | } -------------------------------------------------------------------------------- /examples/traffic_offloading/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/traffic_offloading/__init__.py -------------------------------------------------------------------------------- /examples/traffic_offloading/local.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "A": { 3 | "IP": [ 4 | "100.0.0.1" 5 | ] 6 | }, 7 | 8 | "B": { 9 | "IP": [ 10 | "120.0.0.1" 11 | ] 12 | }, 13 | 14 | "C": { 15 | "IP": [ 16 | "140.0.0.1" 17 | ] 18 | } 19 | } -------------------------------------------------------------------------------- /examples/traffic_offloading_ip_prefixes/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/traffic_offloading_ip_prefixes/__init__.py -------------------------------------------------------------------------------- /examples/traffic_offloading_ip_prefixes/local.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "A": { 3 | "IPP": [ 4 | "100.0.0.0/16", 5 | "110.0.0.0/16" 6 | ] 7 | }, 8 | 9 | "B": { 10 | "IPP": [ 11 | "120.0.0.0/16", 12 | "130.0.0.0/16" 13 | ] 14 | }, 15 | 16 | "C": { 17 | "IPP": [ 18 | "140.0.0.0/16", 19 | "150.0.0.0/16" 20 | ] 21 | } 22 | } -------------------------------------------------------------------------------- /examples/vnhAssignment_example2/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/vnhAssignment_example2/__init__.py -------------------------------------------------------------------------------- /examples/vnhAssignment_example2/local.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "A": { 3 | "IPP": [ 4 | "100.0.0.0/16" 5 | ], 6 | "Policy1":[ 7 | ] 8 | }, 9 | 10 | "B": { 11 | "IPP": [ 12 | "120.0.0.0/16" 13 | ], 14 | "Policy1":[ 15 | ] 16 | }, 17 | 18 | "C": { 19 | "IPP": [ 20 | "140.0.0.0/16", 21 | "150.0.0.0/16" 22 | ], 23 | "Policy1": [ 24 | "140.0.0.0/16", 25 | "150.0.0.0/16" 26 | ] 27 | } 28 | } -------------------------------------------------------------------------------- /examples/wide_area_lb/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/examples/wide_area_lb/__init__.py -------------------------------------------------------------------------------- /examples/wide_area_lb/local.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "A": { 3 | }, 4 | 5 | "C": { 6 | } 7 | } -------------------------------------------------------------------------------- /lib/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/lib/__init__.py -------------------------------------------------------------------------------- /lib/corelib.py: -------------------------------------------------------------------------------- 1 | ############################################# 2 | # Core SDX Library # 3 | # author: Arpit Gupta (glex.qsd@gmail.com) # 4 | ############################################# 5 | 6 | 7 | """Core SDX Library""" 8 | 9 | from ipaddr import IPv4Network 10 | from netaddr import * 11 | import json 12 | import os 13 | -------------------------------------------------------------------------------- /lib/language.py: -------------------------------------------------------------------------------- 1 | from pyretic.core import util 2 | from pyretic.core.network import * 3 | from pyretic.core.util import frozendict, singleton 4 | from pyretic.core.language import * 5 | 6 | 7 | class match_prefixes_set(DerivedPolicy, Filter): 8 | 9 | """ SDX utilities. Maintain a set of IP prefixes. 10 | Only useful in the first stages of the SDX compilation.""" 11 | 12 | def __init__(self, pfxes): 13 | 14 | if isinstance(pfxes, set): 15 | self.pfxes = pfxes 16 | else: 17 | self.pfxes = set(pfxes) 18 | super(match_prefixes_set, self).__init__(passthrough) 19 | 20 | def __repr__(self): 21 | return "match_prefix_set:\n%s" % util.repr_plus([self.pfxes]) 22 | -------------------------------------------------------------------------------- /lib/pyreticlib.py: -------------------------------------------------------------------------------- 1 | ############################################# 2 | # Core Pyretic Library # 3 | # author: Arpit Gupta (glex.qsd@gmail.com) # 4 | ############################################# 5 | 6 | 7 | """Pyretic Library""" 8 | 9 | # This module is designed for pyretic specific imports. 10 | 11 | from pyretic.lib.corelib import * 12 | from pyretic.lib.std import * 13 | from pyretic.core import util 14 | from pyretic.core.util import frozendict, singleton 15 | from pyretic.modules.mac_learner import * -------------------------------------------------------------------------------- /scripts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/scripts/__init__.py -------------------------------------------------------------------------------- /scripts/sigcomm14-clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ###################################### 3 | # SDX: Software Defined Exchange 4 | # Author: Arpit Gupta 5 | ###################################### 6 | 7 | sudo pkill -f exabgp 8 | sudo pkill -f pyretic.py 9 | sudo pkill -f pox.py 10 | sudo pkill -f sdx-setup.sh 11 | sudo mn -c 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /scripts/sigcomm14-demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ###################################### 3 | # SDX: Software Defined Exchange 4 | # Author: Arpit Gupta 5 | ###################################### 6 | 7 | $HOME/pyretic/pyretic/sdx/scripts/sdx-setup.sh init gec20_demo 8 | $HOME/pyretic/pyretic/sdx/scripts/sdx-setup.sh clearrib 9 | $HOME/pyretic/pyretic/sdx/scripts/sdx-setup.sh pyretic > $HOME/pyretic/pyretic/sdx/scripts/log/pyretic.log 2> $HOME/pyretic/pyretic/sdx/scripts/log/pyretic_err.log & 10 | $HOME/pyretic/pyretic/sdx/scripts/sdx-setup.sh exabgp > $HOME/pyretic/pyretic/sdx/scripts/log/exabgp.log 2> $HOME/pyretic/pyretic/sdx/scripts/log/exabgp_err.log & 11 | $HOME/pyretic/pyretic/sdx/scripts/sdx-setup.sh demo gec20_demo 12 | -------------------------------------------------------------------------------- /stash/QuaggaInterface/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/stash/QuaggaInterface/__init__.py -------------------------------------------------------------------------------- /stash/lib/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/stash/lib/__init__.py -------------------------------------------------------------------------------- /stash/lib/language.py: -------------------------------------------------------------------------------- 1 | from pyretic.core import util 2 | from pyretic.core.network import * 3 | from pyretic.core.util import frozendict, singleton 4 | from pyretic.core.language import * 5 | 6 | class match_prefixes_set(DerivedPolicy, Filter): 7 | """ SDX utilities. Maintain a set of IP prefixes. 8 | Only useful in the first stages of the SDX compilation.""" 9 | def __init__(self, pfxes): 10 | 11 | if isinstance(pfxes, set): 12 | self.pfxes = pfxes 13 | else: 14 | self.pfxes = set(pfxes) 15 | super(match_prefixes_set, self).__init__(passthrough) 16 | 17 | def __repr__(self): 18 | return "match_prefix_set:\n%s" % util.repr_plus([self.pfxes]) -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdn-ixp/sdx-pyretic/cdec3557e3f1759d0213de4f10a7e3abeee244c8/tests/__init__.py -------------------------------------------------------------------------------- /tests/parse-amsIX/parse-amsix.py: -------------------------------------------------------------------------------- 1 | ############################################# 2 | # Parse AMS-IX data # 3 | # author: Arpit Gupta (glex.qsd@gmail.com) # 4 | ############################################# 5 | 6 | import os,sys 7 | import json 8 | dfile='../data/ams-ix/pfxv4_nh_aspath.amsix.txt' 9 | 10 | class rc_rib(): 11 | def __init__(self,prefixes={}): 12 | self.prefixes=prefixes 13 | 14 | def initialize_rib(rib,dfile): 15 | i=0 16 | for line in open(dfile,'r').readlines(): 17 | tmp=line.split('|') 18 | pfx,nh,aspath=(tmp[0],tmp[1],tmp[2].split('\n')[0].split(' ')) 19 | if pfx not in rib: 20 | rib[pfx]={} 21 | rib[pfx][nh]=aspath 22 | 23 | #print pfx,nh,aspath 24 | if i%1000==0: 25 | print i 26 | #break 27 | i+=1 28 | 29 | def main(): 30 | init=False 31 | if init==True: 32 | rib={} 33 | initialize_rib(rib,dfile) 34 | #print rib 35 | with open('amsix-rib.dat', 'w') as outfile: 36 | json.dump(rib,outfile,ensure_ascii=True,encoding="ascii") 37 | rib = json.load(open('amsix-rib.dat', 'r')) 38 | print len(rib) 39 | 40 | if __name__ == '__main__': 41 | main() -------------------------------------------------------------------------------- /utils/__init__.py: -------------------------------------------------------------------------------- 1 | from pyretic.lib.corelib import * 2 | from pyretic.lib.std import * 3 | 4 | ''' Get IP to MAC list ''' 5 | 6 | 7 | def get_ip_mac_list(ip_list, mac_list): 8 | 9 | # TODO: why we have this extra value in the header, i.e., VNH, that needs 10 | # to ignored. 11 | 12 | ip_mac_list = {} 13 | 14 | for key in ip_list: 15 | 16 | if (key == 'VNH'): # Ignoring VNH key (not sure why) 17 | continue 18 | 19 | ip_mac_list[IPAddr(ip_list[key])] = EthAddr(mac_list[key]) 20 | 21 | return ip_mac_list 22 | 23 | ''' Get participant to ports list ''' 24 | 25 | 26 | def get_participants_ports_list(participants): 27 | participants_list = {} 28 | 29 | for participant_name in participants: 30 | participants_list[participant_name] = [] 31 | 32 | for port in participants[participant_name].phys_ports: 33 | participants_list[participant_name].append(str(port.ip)) 34 | 35 | return participants_list 36 | -------------------------------------------------------------------------------- /utils/inet.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Author: 3 | # Muhammad Shahbaz (muhammad.shahbaz@gatech.edu) 4 | 5 | from pyretic.lib.corelib import * 6 | from pyretic.lib.std import * 7 | 8 | ''' BGP filter policy ''' 9 | BGP_PORT = 179 10 | BGP = match(srcport=BGP_PORT) | match(dstport=BGP_PORT) 11 | --------------------------------------------------------------------------------