|
| 1 | +Interaction with the Database |
| 2 | +============================= |
| 3 | + |
| 4 | +OpenBMP stores the parsed BMP messages in a database. The DB is updated realtime as messages are received. |
| 5 | + |
| 6 | +The design allows for admins, network engineers, scripts/programs, etc. to interact with the Database in a read-only fashion. A single database instance running with 8G of RAM and 4 vCPU's can handle several routers with several full Internet routing bgp peers. |
| 7 | + |
| 8 | +Primary Keys |
| 9 | +------------ |
| 10 | +OpenBMP is not just logging BMP/BGP messages, instead it is actively maintaining the information. Therefore, there is a need for OpenBMP to update existing objects, such as NLRI and timestamps. To facilitate this, each table includes a **hash_id** which is currently a MD5 hash of various columns. Each table hash_id is computed on column information instead of requiring multiple column primary keys or unique key constraints. |
| 11 | + |
| 12 | +To facilitate table linking, **hash_id's** of other tables are referenced. Each table defines the reference to other table hash_id's. |
| 13 | + |
| 14 | +Schema for Views |
| 15 | +---------------- |
| 16 | +Views are pre-defined queries in a nice table format, making it easier for integration. Views look just like tables. You can run normal select queries against them. |
| 17 | + |
| 18 | +### v_routes |
| 19 | +The routes table is similar to looking at the routing table on a router. The difference is that you can look at them across all routers, including pre-policy. |
| 20 | + |
| 21 | +Column | DataType | Description |
| 22 | +------ | -------- | ----------- |
| 23 | +RouterName | varchar | DNS/custom name or BMP initiate message (sysName) |
| 24 | +PeerName | varchar | Name or IP address of peer |
| 25 | +Prefix | varchar | Prefix |
| 26 | +PrefixLen | int | Prefix length in bits |
| 27 | +NH | varchar | Next-hop IP address in printed format |
| 28 | +Origin | varchar| BGP origin in string format |
| 29 | +Origin_AS | int | First AS PATh entry, origin of the prefix |
| 30 | +MED | int | BGP MED value |
| 31 | +LocalPref | int | BGP local preference |
| 32 | +AS_Path | varchar | AS Path in string format |
| 33 | +ASPath_Count | int | Count of ASN's in the path |
| 34 | +Communities | varchar | Standard Communities in string format |
| 35 | +ClusterList | varchar | Cluster list in string format |
| 36 | +Aggregator | varchar | Aggregator IP address in printed format |
| 37 | +PeerAddress | varchar | Peer IP address in printed format |
| 38 | +LastModified | timestamp | Timestamp of when last modified/udpated |
| 39 | + |
| 40 | + |
| 41 | +### v_routes_history |
| 42 | +Routes history is just like the routes table, but this will return prefixes with their history of path attributes. You can use this view to show the prefix history over time. For example, show a prefix as it converges or how it has moved from one transit to another in a given time period. |
| 43 | + |
| 44 | +Column | DataType | Description |
| 45 | +------ | -------- | ----------- |
| 46 | +RouterName | varchar | DNS/custom name or BMP initiate message (sysName) |
| 47 | +PeerName | varchar | Name or IP address of peer |
| 48 | +Prefix | varchar | Prefix |
| 49 | +PrefixLen | int | Prefix length in bits |
| 50 | +NH | varchar | Next-hop IP address in printed format |
| 51 | +Origin | varchar| BGP origin in string format |
| 52 | +Origin_AS | int | First AS PATh entry, origin of the prefix |
| 53 | +MED | int | BGP MED value |
| 54 | +LocalPref | int | BGP local preference |
| 55 | +AS_Path | varchar | AS Path in string format |
| 56 | +ASPath_Count | int | Count of ASN's in the path |
| 57 | +Communities | varchar | Standard Communities in string format |
| 58 | +ClusterList | varchar | Cluster list in string format |
| 59 | +Aggregator | varchar | Aggregator IP address in printed format |
| 60 | +PeerAddress | varchar | Peer IP address in printed format |
| 61 | +LastModified | timestamp | Timestamp of when last modified/udpated |
| 62 | + |
| 63 | +### v_peers |
| 64 | +View of BGP peers with session information and details of last down and up notifications. This is similar to looking at the bgp peer on the router. Like with routes, you can see a much larger list of peers by looking at all routers, not just one. |
| 65 | + |
| 66 | +For example, one could use this view to report on public peers in different peering locations. Another report could be to track peering stability. |
| 67 | + |
| 68 | +Column | DataType | Description |
| 69 | +------ | -------- | ----------- |
| 70 | +RouterName | varchar | DNS/custom name or BMP initiate message (sysName) |
| 71 | +LocalIP | varchar | IP Address of the BMP router local peering address |
| 72 | +LocalPort | int | Local port number of the BMP router local peering session |
| 73 | +LocalASN | int | Local ASN for peering sessions |
| 74 | +PeerName | varchar | Name or IP address of peer |
| 75 | +PeerAddress | varchar | Peer IP address in printed format |
| 76 | +PeerPort | int | Remote port number of the peer |
| 77 | +PeerASN | int | Peer ASN for session |
| 78 | +holdTime | int | BGP holdtime being used, if up |
| 79 | +isUp | boolean | True if peer is up, or false if peer is down |
| 80 | +isBMPConnected | boolean | True if the router BMP session is connected, false if not |
| 81 | +SentParams | varchar(variable) | String list of open params sent to peer |
| 82 | +RecvParams | varchar(variable) | String list of open params received from peer |
| 83 | +LastDownCode | int | BGP error code of the last down notification |
| 84 | +LastDownSubCode | int | BGP error subcode of the last down notification |
| 85 | +LastDownMessage | varchar | Meaning of last peer down notification |
| 86 | +LastDownTimestamp | timestamp | Timestamp of the last time peer down was sent |
| 87 | +LastUpTimestamp | timestamp | Timestamp of the last time peer up was sent |
| 88 | + |
| 89 | + |
| 90 | +Schema for Stored Procedures |
| 91 | +---------------------------- |
| 92 | +Currently there are no stored procedures. |
| 93 | + |
| 94 | +Schema for Data Tables |
| 95 | +---------------------- |
| 96 | + |
| 97 | +### Routers |
| 98 | +This table is a list of all BMP devices. Normally this table is populated based on connections made to the OpenBMP server. This table is used for provisioning allowed BMP devices OpenBMP will accept, as well as to indicate which BMP devices are in *passive* mode requiring *active* tcp connections to be made by OpenBMP. |
| 99 | + |
| 100 | +Column | DataType | Description |
| 101 | +------ | -------- | ----------- |
| 102 | +hash_id | char(32) | Hash ID for this table |
| 103 | +name | varchar(255) | DNS/custom name or if empty the BMP initiate message (sysName) |
| 104 | +descr | varchar(255) | Description of router/BMP device (if empty will be sysDescr learned) |
| 105 | +src_addr | varchar(40) | IPv4/IPv6 address of the BMP device |
| 106 | +asn | unsigned int 32bit | ASN of the BMP device |
| 107 | +isConnected | boolean | BMP connection state ; true is established |
| 108 | +isPassive | boolean | Indicates if OpenBMP is passive or active |
| 109 | +term_reason_code | int | BMP termination reason code for last termination (isConnected=false) |
| 110 | +term_reason_text | varchar(255) | Text description of the reason code meaning |
| 111 | +term_data | blob/text | Attribute value pairs provided in termination data |
| 112 | +initiate_data| blob/text | Attribute value paris provided in initiation message |
| 113 | +timestamp| timestamp | Last time the record was updated - seconds since EPOCH |
| 114 | + |
| 115 | + |
| 116 | +### bgp_peers |
| 117 | +BGP peers are added to this table as BMP devices send information. The **router_hash_id** provides a way to link which BMP device the peer belongs to. |
| 118 | + |
| 119 | +Column | DataType | Description |
| 120 | +------ | -------- | ----------- |
| 121 | +hash_id | char(32) | Hash ID of this table |
| 122 | +router_hash_id | char(32) | Hash ID of the routers table |
| 123 | +name | varchar(255) | BGP peer name |
| 124 | +peer_rd | varchar(32) | Route distinguisher ID in printed format |
| 125 | +peer_addr | varchar(40) | Peer IP address (IPv4/IPv6) in printed format |
| 126 | +peer_bgp_id | varchar(15) | Peer BGP ID in printed format |
| 127 | +peer_as | unsigned int 32bit | Peer ASN |
| 128 | +isL3VPN | boolean | Peer is VPNv4 if true and global if false |
| 129 | +isIPv4 | boolean | Peer IP type is IPv4 if true and IPv6 if false |
| 130 | +isPrePolicy | boolean | True if pre-policy (adj-rib-in) or false if post-policy (loc-rib) |
| 131 | +peer_state | int | Peer state is 0=down, 1=up, 2=receiving initial dump via bmp |
| 132 | +timestamp| timestamp | Last time the record was updated - seconds since EPOCH |
| 133 | + |
| 134 | + |
| 135 | +### path_attrs |
| 136 | +BGP path attributes table primarily holds the path attributes for NLRI entries. This includes MP_REACH. BGP-LS attributes will be stored in separate (*new*) tables. |
| 137 | + |
| 138 | +Column | DataType | Description |
| 139 | +------ | -------- | ----------- |
| 140 | +hash_id | char(32) | Hash ID of this table |
| 141 | +peer_hash_id | char (32) | Hash ID of the bgp_peers table |
| 142 | +origin | varchar(16) | BGP Origin in printed format |
| 143 | +as_path | varchar(variable) | AS_PATH in string format |
| 144 | +as_path_count | int | Count of AS's in the path, including in sets |
| 145 | +origin_as | unsigned int 32bit | Origin AS - first ASN in path |
| 146 | +nexthop_isIPv4 | boolean | Next-hop is IPv4 if true and IPv6 if false |
| 147 | +next_hop | varchar(40) | IP address of next-hop in printed format |
| 148 | +aggregator | varchar(40) | Aggregator IP in printed format |
| 149 | +originator_id| varchar(15) | Originator ID in printed format |
| 150 | +atomic_agg | boolean | True if atomic aggregate, false if not |
| 151 | +med | unsigned int 32bit | BGP med value |
| 152 | +local_pref | unsigned int 32bit | BGP local preference |
| 153 | +community_list | varchar(variable) | Standard community list in string format |
| 154 | +ext_community_list | varchar(variable) | Extended community list in string format |
| 155 | +cluster_list | varchar(variable) | Cluster list in string format |
| 156 | +timestamp| timestamp | Last time the record was updated - seconds since EPOCH |
| 157 | + |
| 158 | + |
| 159 | +### rib |
| 160 | +The rib table details the prefixes, both IPv4, IPv6, and VPNv4. Linking the path_attrs table is needed in order to determine the attributes of prefix. The **v_routes** view provides a simple view of routes with their attributes. |
| 161 | + |
| 162 | +Column | DataType | Description |
| 163 | +------ | -------- | ----------- |
| 164 | +hash_id | char(32) | Hash ID of this table |
| 165 | +path_attr_hash_id | char(32) | Hash ID of the path_attrs table |
| 166 | +peer_hash_id | char(32) | Hash ID of the bgp_peers table |
| 167 | +prefix | varchar(40) | Prefix in printed format |
| 168 | +prefix_len | int | Length of prefix in bits |
| 169 | +timestamp| timestamp | Last time the record was updated - seconds since EPOCH |
| 170 | + |
| 171 | + |
| 172 | +### peer_down_events |
| 173 | +Peer down events are logged whenever received in this table. |
| 174 | + |
| 175 | +Column | DataType | Description |
| 176 | +------ | -------- | ----------- |
| 177 | +peer_hash_id | char(32) | Hash ID of bgp_peers table |
| 178 | +bmp_reason | varchar(64) | Short text description of the BMP reason code |
| 179 | +bgp_error_code | int | BGP notification error code (see RFC4271 Section 4.5) |
| 180 | +bgp_error_subcode | int | BGP notification error subcode (see RFC4271 Section 4.5) |
| 181 | +error_text | varchar(255) | Text description of bgp error code and subcode meaning |
| 182 | +timestamp| timestamp | BMP recorded time - seconds since EPOCH |
| 183 | + |
| 184 | +### peer_up_events |
| 185 | +Peer up events are logged whenever bmp device is established with OpenBMP and when the peer transitions from down to up. |
| 186 | + |
| 187 | +> It is possible to link this table to the peer table to get a full picture of |
| 188 | +> the peering session. See **v_peers** view for peering session information. |
| 189 | +
|
| 190 | +Column | DataType | Description |
| 191 | +------ | -------- | ----------- |
| 192 | +peer_hash_id | char(32) | Hash ID of the bgp_peers table |
| 193 | +local_ip | varchar(40) | printed form of the Local BMP device peer IP address (IPv4 or IPv6) |
| 194 | +local_port | int | Local port number for the peer session |
| 195 | +remote_port | int | Remote port number for the peer session |
| 196 | +hold_time | int | BGP hold time for the peer session |
| 197 | +sent_open_params | varchar(variable) | String list of open params sent to peer |
| 198 | +recv_open_params | varchar(variable) | String list of open params received from peer |
| 199 | +timestamp| timestamp | BMP recorded time - seconds since EPOCH |
| 200 | + |
| 201 | +### stat_reports |
| 202 | + |
| 203 | +Status reports are metrics based on periods defined/configured on the BMP device. Each time the BMP device sends a report, an entry will be placed in this table. |
| 204 | + |
| 205 | +Column | DataType | Description |
| 206 | +------ | -------- | ----------- |
| 207 | +peer_hash_id | char(32) | Hash ID of bgp_peers table |
| 208 | +prefixes_rej | unsigned int 32bit | Number of prefixes rejected by inbound policy |
| 209 | +known_dup_prefixes | unsigned int 32bit | Number of (known) duplicate prefix advertisements |
| 210 | +known_dup_withdraws | unsigned int 32bit | Number of (known) duplicate withdraws |
| 211 | +invalid_cluster_list | unsigned int 32bit | Number of updates invalidated due to CLUSTER_LIST loop |
| 212 | +invalid_as_path_loop | unsigned int 32bit | Number of updates invalidated due to AS_PATH loop |
| 213 | +invalid_originator_id | unsigned int 32bit | Number of updates invalidated due to ORIGINATOR_ID |
| 214 | +invalid_as_confed_loop | unsigned int 32bit | Number of updates invalidated due to AS_CONFED loop |
| 215 | +routes_adj_rib_in | unsigned int 64bit | Number of routes in Adj-RIBs-In |
| 216 | +routes_loc_rib | unsigned int 64bit | Number of routes in Loc-RIB |
| 217 | +timestamp| timestamp | BMP recorded time - seconds since EPOCH |
| 218 | + |
| 219 | +> Other metrics can be added |
| 220 | +
|
| 221 | +### withdrawn_log |
| 222 | +Every time a prefix is withdrawn a log entry is created in this table. |
| 223 | + |
| 224 | +Column | DataType | Description |
| 225 | +------ | -------- | ----------- |
| 226 | +id | unsigned int 64bit | Incrementing number for log entry |
| 227 | +peer_hash_id | char (32) | Hash ID of the bgp_peers table |
| 228 | +prefix | varchar(40) | Prefix IP address in printed format |
| 229 | +prefix_len | int | Length of prefix in bits |
| 230 | +timestamp| timestamp | Last time the record was updated - seconds since EPOCH |
| 231 | + |
| 232 | + |
| 233 | +### path_attr_log |
| 234 | +Every time a prefix path attribute is changed, a log entry is added to this table. |
| 235 | + |
| 236 | +Column | DataType | Description |
| 237 | +------ | -------- | ----------- |
| 238 | +rib_hash_id | char(32) | Hash ID of the rib table |
| 239 | +path_attr_hash_id | char (32) | Hash ID of the path_attrs table for the current attrs, before update |
| 240 | +timestamp| timestamp | Last time the record was updated - seconds since EPOCH |
| 241 | + |
| 242 | + |
| 243 | + |
0 commit comments