Using custom tables and views
In this recipe, we’ll build on the learning from the previous recipe, regarding tables and views. PyEZ includes a built-in table for looking at BGP neighbors but with operational experience, it can be a bit lacking in utility. The deficiencies include:
- The table uses the
peer_id
attribute to identify the remote peer. When the peering session is not established, this is simply the value of the configured neighbor to whom TCP sessions will be directed and it’s generally useful. But when the session establishes, this field changes to show the router ID of the remote peer - a system-wide identifier, rather than an interface identifier - which is unlikely to be the same for EBGP peers in an internet context. - The view associated with the table omits some of the BGP I/O parameters, which can be useful in troubleshooting slow readers and writers and associated problems.
So, as we did in Chapter 5, Automating JUNOS with PyEZ, let’s try to re-invent the infamous Cisco-style...