peeringdb 2.0 matt griswold · new, clean, shiny python completely redesigned schema restful api...
TRANSCRIPT
![Page 2: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/2.jpg)
● Old, generated code, unmaintainable
● Schema issues○ 1 network per user, etc.
● MySQL the only "API"○ Insecure; doesn't scale
VERSION 1 ISSUES
![Page 3: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/3.jpg)
● No data validation
● Lots of typos
● Exposed contact information to potential spammers
VERSION 1 ISSUES
![Page 4: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/4.jpg)
● New, clean, shiny python
● Completely redesigned schema
● RESTful API
● All data is cleaned and validated
● Contact info has permissions○ Guest login won’t see contact details
VERSION 2
![Page 5: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/5.jpg)
● Everything is permissioned and editable○ Allows data centers and IXs to update their own info
● Documented APIs!
● New features planned after initial cut-over
● Beta version is live now at beta.peeringdb.com
VERSION 2
![Page 6: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/6.jpg)
● Each data type has an associated tag○ net○ org○ ix○ etc
API SPECS
docs.peeringdb.com/api_specs »
![Page 7: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/7.jpg)
● To list all networks:
● To view a specific network:
API SPECS
docs.peeringdb.com/api_specs »
curl -X GET https://<username>:<password>@beta.peeringdb.com/api/net
curl -X GET https://<username>:<password>@beta.peeringdb.com/api/net/20
![Page 8: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/8.jpg)
● All operations are supported○ read○ write○ create
● See docs for further details
API SPECS
docs.peeringdb.com/api_specs »
![Page 9: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/9.jpg)
● Very early in life cycle○ Expect more tests and features in the near future
● Python seems to be the go-to language for network people
● More languages and libraries will show up, PHP will probably be next
PYTHON LIBRARY
github.com/peeringdb/peeringdb-py »
![Page 10: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/10.jpg)
● Advantages○ Local (not dependent on servers being up, etc.)○ Custom indexes can be built○ Custom fields can be added○ Database engine can be chosen (MySQL, Postgres, SQLite
● To install:
PYTHON LIBRARY
github.com/peeringdb/peeringdb-py »
pip install peeringdb
![Page 11: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/11.jpg)
● To configure a local database:
PYTHON LIBRARY
github.com/peeringdb/peeringdb-py »
peeringdb configure
peeringdb sync
● To keep in sync after configuration:
![Page 12: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/12.jpg)
COMMAND LINE INTERFACE
● To output YAML:
PYTHON LIBRARY
github.com/peeringdb/peeringdb-py »
peeringdb get net20
peeringdb get -O json net20
● To output JSON:
![Page 13: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/13.jpg)
● To build custom applications with the PeeringDB client library:
PYTHON LIBRARY
github.com/peeringdb/peeringdb-py »
from peeringdb.client import PeeringDB pdb = PeeringDB()
![Page 14: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/14.jpg)
● Django module
● Easy to integrate in a common web framework
● Multiple database options
● Used by peeringdb-py to sync data
DJANGO-PEERINGDB
![Page 15: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/15.jpg)
● Use cases○ Very easy to generate peering router config
DJANGO-PEERINGDB
protocol bgp chix_{{tag}} {description "Peer: as{{peer.asn}} ({{peer.descr}})";neighbor {{peer.ip}} as {{peer.asn}};route limit {{peer.max_prefix}};
![Page 16: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/16.jpg)
● Customer signs up, gives ASN, backend system queries and auto populates IXP Manager data○ NOC info○ Max prefix
UNITED IX SIGNUP
![Page 17: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/17.jpg)
● Couchbase sync
● Netflix○ Redis sync○ github.com/netflix/peeringdb-py »
OTHER COMPANIES USING V2 INTERFACE
![Page 18: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/18.jpg)
https://github.com/grizz/pdb-examples
EXAMPLE SCRIPT
# search by ix and nameix = pdb.all('ix', name='chix', country='us')[0]pprint(ix)
![Page 19: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/19.jpg)
https://github.com/grizz/pdb-examples
EXAMPLE SCRIPT
# get lan on ixixlan = pdb.all('ixlan', ix_id=ix['id'])[0]pprint(ixlan)
![Page 20: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/20.jpg)
https://github.com/grizz/pdb-examples
EXAMPLE SCRIPT
# lookup network by ASNnet = pdb.all('net', asn=63311)[0]pprint(net)
![Page 21: PEERINGDB 2.0 MATT GRISWOLD · New, clean, shiny python Completely redesigned schema RESTful API All data is cleaned and validated Contact info has permissions Guest login won’t](https://reader036.vdocuments.us/reader036/viewer/2022081402/6057a3d7ca91cf1f5f788cb6/html5/thumbnails/21.jpg)
https://github.com/grizz/pdb-examples
EXAMPLE SCRIPT
# lookup peer info by network and ixlanpeerings = pdb.all('netixlan', ixlan_id=ixlan['id'], asn=63311)pprint(peerings)