Package: routeviews
Route Views requires many tools to support its functionality.
This package is a place for those tools to live.Today, this package also acts as the primary 'python programming library' for Route Views.CLI ToolsAs of today, there are two types of tools provided by this package: monitoring, and automation.ℹ The  CLI tools have certain prefix based on tool type:rvm-is for Monitoring tools that are used only to learn about the running state of Route Views.routeviews-is for Automation tools that enable some automated workflow.rvm-latest-mrtCLI toolMonitoring tool that shows information about the latest Route Views MRT files (RIB, UPDATE) on a collector.Use the--helpflag to learn more about this tool's abilities.$ rvm-latest-mrt
Latest RIB:    /mnt/storage/bgpdata/2022.08/RIBS/rib.20220802.0800.bz2
Latest UPDATE: /mnt/storage/bgpdata/2022.08/UPDATES/update.20220802.0800.bz2rvm-bmp-statusCLI toolMonitoring tool that shows information about BMP connections on a collector.Use the--helpflag to learn more about this tool's abilities.$ sudo rvm-bmp-status
BMP Collector: bmp.routeviews.org
  Connection Uptime: 8 hours
  Data sent: 1.5 GB
  Bytes queued: 2 Bytes
  Bytes queued to Kernel: 3 Bytesrvm-bgp-statusCLI toolMonitoring tool that shows relevant information about BGP connections on a collector.Use the--helpflag to learn more about this tool's abilities.$ sudo  rvm-bgp-status
  ASN  Peer Address        State          Prefixes    Uptime     InQ    Uptime
-----  ------------------  -----------  ----------  --------  ------  --------
65129  128.223.51.78       ESTABLISHED           0         0  149732         1
 3582  128.223.253.9       ESTABLISHED      899115         0  149732         1
 3582  128.223.253.10      ESTABLISHED      899147         0  149732         1
 3582  2001:468:d01:fd::9  ESTABLISHED      162442         0  149732         1
 3582  2001:468:d01:fd::a  ESTABLISHED      162443         0  149732         1rvm-haproxy-statsCLI toolGet stats from HAProxy Stick Tables on a Route Views collector.ℹ HAProxy runs on our collectors to enable telnet access.$ rvm-haproxy-stats --min-conn-cnt 10 --sudo
Key                         Current Conn.    Total Conn.  Data In Rate    Date Out Rate
------------------------  ---------------  -------------  --------------  ---------------
175.30.79.245                           0             10  0 Bytes         901 Bytes
141.255.166.2                           0             12  69 Bytes        1.3 kB
179.43.187.243                          0             13  0 Bytes         1.5 kB
180.103.51.200                          0             14  0 Bytes         1.0 kB
31.220.3.140                            0             27  0 Bytes         907 Bytes
2001:468:d01:33::80df:78                0             27  457 Bytes       9.0 kBrouteviews-peer-requestCLI toolThis tool is for (consistently) updating theRoute Views ansible inventory (private repo)when folks submit new peer requests.This tool uses information provided by PeeringDB for the peering information.PrerequisitesRoute Views Ansible Inventory: You must have a local copy of the Route Views ansible inventory available, for this tool to update.If you will be running this command with any regularity, is useful to export theROUTEVIEWS_INVENTORYenvironment variable to point to your local copy of theRoute Views ansible inventory repository (private).# (Optional) Place in your ~/.bashrc
$ export ROUTEVIEWS_INVENTORY='<WORKING_TREE>/ansible/inventory'<WORKING_TREE>refers to wherever you've cloned the repository on your filesystem.Example: Show Options between Route Views and Autonomous System (AS)If an AS would like to know what peering sessions are possible according to this tool, we do have a--show-optionsflag that will enable this!
Provide only theasnargument along with theshow-optionsflag to try this out!ℹ Anyone can run this solution!
This solution only depends on the public PeeringDB API.$ routeviews-peer-request --asn 15169 --show-options

Potential BGP Peerings for networks:

- RouteViews (ASN: 6447), and 
- Google LLC (ASN: 15169).

Exchange                                        RV Collector              Router
----------------------------------------------  ------------------------  ------------------------
Equinix Chicago                                 208.115.136.187           208.115.136.21
Equinix Chicago                                 2001:504:0:4::6447:1      2001:504:0:4:0:1:5169:1
Equinix Palo Alto                               198.32.176.5              198.32.176.31
Equinix Palo Alto                               2001:504:d::5             2001:504:d::1f
LINX LON1: Main                                 195.66.225.222            195.66.224.125
LINX LON1: Main                                 2001:7f8:4::192f:1        2001:7f8:4::3b41:1
Digital Realty Atlanta                          198.32.132.3              198.32.132.41
Digital Realty Atlanta                          2001:478:132::3           2001:478:132::41
DE-CIX Frankfurt: DE-CIX Frankfurt Peering LAN  80.81.193.49              80.81.192.108
DE-CIX Frankfurt: DE-CIX Frankfurt Peering LAN  2001:7f8::192f:0:1        2001:7f8::3b41:0:1
DE-CIX Frankfurt: DE-CIX Frankfurt Peering LAN  80.81.193.49              80.81.193.108
DE-CIX Frankfurt: DE-CIX Frankfurt Peering LAN  2001:7f8::192f:0:1        2001:7f8::3b41:0:2
DIX-IE                                          202.249.2.166             202.249.2.189
... trimmed for brevity...Example: Peer with an Autonomous System (AS) atALLIXesIf an AS is wanting to connect wherever possible, provide only theasnargument and the tool will determine all the possibleiparguments from PeeringDB.$ routeviews-peer-request \
    --inventory <WORKING_TREE>/ansible/inventory \
    --asn 15169

### Changes

+++ <WORKING_TREE>/ansible/inventory/host_vars/route-views.perth.routeviews.org
+ peer_as: 15169
+ peer_address: 218.100.52.3
+ description: 'IX Australia (Sydney NSW): NSW-IX'
+ afi_safis:
+   - ipv4_unicast
+ peer_as: 15169
+ peer_address: 2001:7fa:11:4:0:3b41:0:1
+ description: 'IX Australia (Sydney NSW): NSW-IX'
+ afi_safis:
+   - ipv6_unicast
+ peer_as: 15169
+ peer_address: 218.100.53.29
+ description: 'IX Australia (Sydney NSW): NSW-IX'
+ afi_safis:
+   - ipv4_unicast
+ peer_as: 15169
+ peer_address: 2001:7fa:11:4:0:3b41:0:2
+ description: 'IX Australia (Sydney NSW): NSW-IX'
+ afi_safis:
+   - ipv6_unicast
+ peer_as: 15169
+ peer_address: 218.100.78.154
+ description: 'IX Australia (Melbourne VIC): VIC-IX'
+ afi_safis:
+   - ipv4_unicast
+ peer_as: 15169
+ peer_address: 2001:7fa:11:1:0:3b41:0:2
+ description: 'IX Australia (Melbourne VIC): VIC-IX'
+ afi_safis:
+   - ipv6_unicast
+ peer_as: 15169
+ peer_address: 218.100.78.153
+ description: 'IX Australia (Melbourne VIC): VIC-IX'
+ afi_safis:
+   - ipv4_unicast
+ peer_as: 15169
+ peer_address: 2001:7fa:11:1:0:3b41:0:1
+ description: 'IX Australia (Melbourne VIC): VIC-IX'
+ afi_safis:
+   - ipv6_unicast

+++ <WORKING_TREE>/ansible/inventory/host_vars/route-views.amsix.routeviews.org
+ peer_as: 15169
+ peer_address: 80.249.208.247
+ description: AMS-IX
+ afi_safis:
+   - ipv4_unicast
+ peer_as: 15169
+ peer_address: 2001:7f8:1::a501:5169:1
+ description: AMS-IX
+ afi_safis:
... trimmed for brevity...Example: Peer with an Autonomous System (AS) using IP AddressesThis tool supports arguments forasn, as well asip.
Theipargument can be used multiple times to peer with multiple IP Addresses at once.⚠ Only supports peering with one AS at a time.ℹ Use the--helpflag to learn more about how to use these arguments.As discussed in theprerequisites, there is also theinventoryargument required that points to the "inventory/" directory.ℹ Tip: Provide anasnand omit theipargument entirely -- the tool will attempt to peer with ALL compatible IP Addresses for the providedasn!$ routeviews-peer-request \
    --inventory <WORKING_TREE>/ansible/inventory \
    --asn 15169 \
    --ip 202.249.2.189 \
    --ip 2001:200:0:fe00::3b41:0 \
    --ip 80.249.208.247 \
    --ip 2001:7f8:1::a501:5169:1

### Changes

+++ <WORKING_TREE>/ansible/inventory/host_vars/route-views.amsix.routeviews.org
+ peer_as: 15169
+ peer_address: 80.249.208.247
+ description: AMS-IX
+ afi_safis:
+   - ipv4_unicast
+ peer_as: 15169
+ peer_address: 2001:7f8:1::a501:5169:1
+ description: AMS-IX
+ afi_safis:
+   - ipv6_unicast

+++ <WORKING_TREE>/ansible/inventory/host_vars/route-views.wide.routeviews.org
+ peer_as: 15169
+ peer_address: 202.249.2.189
+ description: DIX-IE
+ afi_safis:
+   - ipv4_unicast
+ peer_as: 15169
+ peer_address: 2001:200:0:fe00::3b41:0
+ description: DIX-IE
+ afi_safis:
+   - ipv6_unicastExample: Multihop Peering - Peer with a Remote Autonomous System (AS)If an AS is wanting to connect but we are not at the same exchange, we can provide a Multihop BGP session.
The--multihop-indexoption is used to select which collector to use.$ routeviews-peer-request \
    --inventory <WORKING_TREE>/ansible/inventory \
    --ip 1.2.3.4 \
    --ip 1.2.3.5 \
    --asn 15169 \
    --multihop-index 5  # I.e. route-views5.routeviews.org

### Changes

+++ <WORKING_TREE>/ansible/inventory/host_vars/route-views5.routeviews.org
+ peer_address: 1.2.3.5
+ peer_as: 15169
+ description: Google LLC
+ afi_safis:
+   - ipv4_unicast
+ options:
+   - ebgp-multihop 255routeviews-email-peersCLI toolThis tool will get a list of email addresses for any networks that are actively peered with a particular Route Views Collector.
This tool is for gathering email address information about Route Views Collector's peers around the world, leveragingPeeringDBandRDAP.Future Plan: Use SMTP server to automate actually sendingmanytypes of 'standard Route Views Operations emails' (use Jinja2 Templates for the email templates).PrerequisitesSSH Access: This script uses NetMiko, and assumes that the current user can SSH into the collector using SSH keys (recommend using anssh-agent).ExampleRun therouteviews-email-peerscommand against a specific Route Views collector, e.g. "route-views4.routeviews.org".Today, this command will to produce a semicolon-separated list of email addresses for each (established) peering session on that collector.$ routeviews-email-peers --collector route-views4.routeviews.org
WARNING:routeviews.scripts.get_peers_email:PeeringDB is missing ASN: 56665
2022-12-09 18:18:29 WARNING   PeeringDB is missing ASN: 61138 [.../routeviews/scripts/get_peers_email.py:92]
... trimmed for brevity...
WARNING:routeviews.scripts.get_peers_email:PeeringDB is missing ASN: 61138
2022-12-09 18:18:29 WARNING   PeeringDB is missing ASN: 204028 [.../routeviews/scripts/get_peers_email.py:92]
WARNING:routeviews.scripts.get_peers_email:PeeringDB is missing ASN: 204028
support@arelion.com; noc@level3carrier.com; inoc@vtc.vn; peering@uvm.edu;YAML Python APIWe have a custom YAML module for handling (Ansible) YAML config files.
In particular, this module will handle whitespace matching the standard way used throughout the Route Views Infrastructure repo.
Further, this module ensures that the order data dumped is the same as ingested.Today, this functionality comes thanks to theruamel.yaml package (PyPI)!ExampleThis example loads a file by filename, then saves that file back.In this case, this will essentially create a copy the "vars.yml" file.ℹ Tip: The "vars2.yml" copy, or any file dumped usingrouteviews.yaml, will follow the Route Views YAML styling convention.import routeviews.yaml

my_variables = routeviews.yaml.load('vars.yml')

# ... make updates to `my_variables`...

routeviews.yaml.dump(my_variables, 'vars2.yml')Additional APIsBesides the CLI tools discussed above, this package contains many internal packages/modules that might be useful.⚠ NOTICE: Major version zero (0.y.z) is for initial development. Anything MAY change at any time. This public API SHOULD NOT be considered stable.There is therouteviews.peeringdbpackage that has some great methods for interfacing with the PeeringDB API.There is therouteviews.yamlmodule that can load and save YAML config files (without rearranging them).Depends on theruamel.yamlpackageThere is therouteviews.ansiblepackage, that can load, modify, and save the Route Views Ansible Inventory.There is therouteviews.bgpsummerymodule, that defines aBGPSummaryclass as well as functions for retrieving aBGPSummaryfrom any collector.There is the (start of a)routeviews.apimodule/package, for interfacing with the Route Views API/DB (undocumented).Release NotesThis project followsSemantic Versioning.Notice: Major version "Zero" (0.y.z) is for initial development. Today, anything MAY change with each minor release.0.3.6Refactorrvm-bgp-statusto make InfluxDB Tags more useful.stateis now a Tag rather than a Field.Why? We would like to "GROUP BY" state in our InfluxDB queries!0.3.5Upgradervm-bgp-statusto add "VTY Latency" to thebgp_statusInfluxDB measurement.vty_latency_secfield has been added when runningrvm-bgp-status --influxdbNice to get an idea of FRRouting's performance over time!Refactorrvm-bgp-statusto make InfluxDB Tags more useful.stateis now a Tag rather than a Field.Why? We would like to "GROUP BY" state in our InfluxDB queries!Remove redundant "collector" tag from InfluxDB measurements.InfluxDB automatically tags data with the "host" tag. So, the "collector" tag was redundant.0.3.4Fixrvm-latest-mrtto always get theLATESTMRT files.For some reason, sorting MRT archives by 'latest change timestamp (ctime)' seems to be non-deterministic! As a result, this tool was prioritizing MRT files from as old as 2019 for some collectors!Solution: Sort alphabetically instead of using ctime.
Route Views' MRT Archives use a consistent "YYYY-MM-DD" naming scheme which works perfectly when sorted alphabetically!0.3.3Fixrouteviews-peer-requeststo use consistent vertical whitespace.0.3.2Upgraderouteviews-peer-requeststo print the, "effected Collector's(es) IP Addresses" after updating the Ansible inventory.For Maintainers to copy or reference when completing peer requests.0.3.1Fixrouteviews-peer-requeststo ignore 'non-operational' Routers/Collectors.Some Route Views collectors are non operational today.0.3.0⚠ NOTE:Renamedrouteviews-build-peerCLI Tool torouteviews-peer-request.
(Updated throughout this project's documentation)Upgraderouteviews-peer-requestswith full feature set! 🎉Add--show-optionsflag that can be used by ANYONE to check their potential peerings (at Internet Exchanges) with Route Views.Add--multihop-indexargument, to create BGP multihop peering config on Route Views' Multihop Collectors.rvm-haproxy-statswill fallback toncifsocatunavailable.0.2.6Fixrvm-haproxy-statsCLI tool.InfluxDB line protocol was broken.Fixed a typo in the code that printed the InfluxDB line protocol.0.2.5Addrvm-haproxy-statsCLI tool.Get stats from HAProxy Stick Tables on a Route Views collector.0.2.4Add--zippedflag torvm-latest-mrt.Only report files that have the ".bz2" file extension.Why?Ubuntu seems to continually update the MRT update file.
This had made the 'age_sec' metric in InfluxDB pretty much useless.0.2.3Updatervm-latest-mrtInfluxDB line protocol to be simpler.Updates and RIBs are separate concerns, so send up separate measurements instead of combining them into one line.0.2.2Create a 'GitHub Release' after delivering package to PyPI.org0.2.1Add many InfluxDB tags torvm-latest-mrt, and remove 2 fields (that were turned to tags).Using tags enables more useful and efficient querying in Grafana!0.2.0Add a set ofrvm(Route Views Monitor) CLI tools.ℹ Tip:Thervmtools listed below can run on any FRR-based Route Views collector.rvm-latest-mrt: Get metrics about the latest MRT Dump files on a Route Views collector.rvm-bgp-status: Get info about BGP Peerings on a Route Views collector.rvm-bmp-status: Get info about BMP sessions on a Route Views collector.Add--sudoflag to CLI tools where appropriate.CLI tools that depend onvtyshwill only use raise privileges when runningvtysh.Extract 'InfluxDB Line Protocol' logic intorouteviews.influxmodule.Generate InfluxDB Line Protocol -- useful when using CLI tools asTelegraf Exec Input Plugins.Extract 'TextFSM Template Parsing' logic into therouteviews.parse.template_parsefunction.See additionaldiscussion of TextFSM in our Design Docs0.1.3Fix Bug:routeviews-peer-requestCLI tool rearranges the 'Route Views Peer Config' in the Ansible Inventory.Now we track the 'order' of attributes whenever loading anyrouteviews.ansible.NeighborConfigclass from a YAML file.
That 'order' is then used when subsequently dumping the data, thus ensuring that nothing is rearranged unnecessarily!0.1.2Bug:routeviews-peer-requestCLI tool rearranges the 'Route Views Peer Config' in the Ansible Inventory.Fix PeeringDB Authentication!See therelevant GitHub Issuewhere we discovered the following details about PeeringDB API Basic Authentication:Do NOT base64 encodeUsername/Password Must be space-separated (e.g., must not be colon ":" separated)Username when using API tokens is "Api-Key"Ensure "www" is in all API requests!Enable using PeeringDB API Key instead of username/password.Exposed via--peeringdb-keyargument inrouteviews-peer-requestCLI tool (or as env var:PEERINGDB_KEY).Add the filepath to the exception message whenrouteviews.yamlencounters aParseError.This enables fixing syntax issues very quickly."Unable to parse<filepath>" is the added message, seen below:... omitted traceback for brevity...
routeviews.yaml.ParseError: while parsing a block mapping
    in "<unicode string>", line 1, column 1:
        short_name: decix
        ^ (line: 1)
expected <block end>, but found '-'
    in "<unicode string>", line 109, column 1:
        - peer_as: 8888
        ^ (line: 109)
Unable to parse <working-tree>/ansible/inventory/host_vars/route-views.decix.routeviews.orgEnsure that PyVCR cassettes do not contain HTTP Basic Authentication secrets.Rotated the (randomly generated) Base64 encoded password that was previously exposed via HTTP Basic Authentication Headers.0.1.1Fix Bug: Package failed to declare some critical dependencies.0.1.0Bug: Package failed to declare some critical dependencies.
Was missinguologgingandraumel.yamldependencies deceleration in "setup.py".The first release of the routeviews package contains some core CLI tools, as well as some functions/classes that might be useful to routeviews maintainers.CLI ToolsProvide new CLI tools! 🎉routeviews-peer-requestCLI tool: automation of updating"Route Views Ansible inventory", toward 'adding BGP peers to XYZ collectors'.routeviews-email-peersCLI tool: get list of email addresses actively peered with a Route Views Collector.LibrariesThere is therouteviews.peeringdbpackage that has some great methods for interfacing with the PeeringDB API.There is therouteviews.yamlmodule that can load and save YAML config files (without rearranging them).Depends on theruamel.yamlpackageThere is therouteviews.ansiblepackage, that can load, modify, and save the Route Views Ansible Inventory.There is therouteviews.bgpsummerymodule, that defines aBGPSummaryclass as well as functions for retrieving aBGPSummaryfrom any collector.There is the (start of a)routeviews.apimodule/package, for interfacing with the Route Views API/DB (undocumented).