summaryrefslogtreecommitdiff
path: root/bgpd/bgp_snmp_bgp4v2.h
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2022-11-13 21:57:22 +0200
committerDonatas Abraitis <donatas@opensourcerouting.org>2022-11-14 10:43:03 +0200
commitff18b7b078e1f195d923db1ad5c1c68f1eb453de (patch)
tree171bbe92936305f780e43904886b00d68533ccc9 /bgpd/bgp_snmp_bgp4v2.h
parente07ff2ce13abeeca977cd7412388e820467e8441 (diff)
bgpd: Implement SNMP BGP4V2-MIB (bgp4V2PeerEntry)
http://www.circitor.fr/Mibs/Mib/B/BGP4V2-MIB.mib Compared with Arista BGP4V2-MIB implementation, almost identical (despite that Arista has slightly some additional MIBs). Example: ``` iso.3.6.1.3.5.1.1.2.1.1.1.4.192.168.10.64 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.1.1.4.192.168.10.65 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.1.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.1.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.1.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.2.1.4.192.168.10.64 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.2.1.4.192.168.10.65 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.2.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.2.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.2.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.3.1.4.192.168.10.64 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.3.1.4.192.168.10.65 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.3.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Hex-STRING: 2A 02 47 80 01 23 00 00 00 00 00 00 00 00 00 01 iso.3.6.1.3.5.1.1.2.1.3.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.3.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.4.1.4.192.168.10.64 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.4.1.4.192.168.10.65 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.4.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.4.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.4.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.5.1.4.192.168.10.64 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.5.1.4.192.168.10.65 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.5.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Hex-STRING: 2A 02 47 80 01 23 00 00 00 00 00 00 00 00 00 02 iso.3.6.1.3.5.1.1.2.1.5.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.5.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.6.1.4.192.168.10.64 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.6.1.4.192.168.10.65 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.6.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Gauge32: 179 iso.3.6.1.3.5.1.1.2.1.6.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.6.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.7.1.4.192.168.10.64 = Gauge32: 65000 iso.3.6.1.3.5.1.1.2.1.7.1.4.192.168.10.65 = Gauge32: 65000 iso.3.6.1.3.5.1.1.2.1.7.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Gauge32: 65000 iso.3.6.1.3.5.1.1.2.1.7.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Gauge32: 65000 iso.3.6.1.3.5.1.1.2.1.7.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Gauge32: 65000 iso.3.6.1.3.5.1.1.2.1.8.1.4.192.168.10.64 = Hex-STRING: C0 00 02 FC iso.3.6.1.3.5.1.1.2.1.8.1.4.192.168.10.65 = Hex-STRING: C0 00 02 FC iso.3.6.1.3.5.1.1.2.1.8.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Hex-STRING: C0 00 02 FC iso.3.6.1.3.5.1.1.2.1.8.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Hex-STRING: C0 00 02 FC iso.3.6.1.3.5.1.1.2.1.8.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Hex-STRING: C0 00 02 FC iso.3.6.1.3.5.1.1.2.1.9.1.4.192.168.10.64 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.9.1.4.192.168.10.65 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.9.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Gauge32: 54814 iso.3.6.1.3.5.1.1.2.1.9.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.9.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.10.1.4.192.168.10.64 = Gauge32: 65002 iso.3.6.1.3.5.1.1.2.1.10.1.4.192.168.10.65 = Gauge32: 65002 iso.3.6.1.3.5.1.1.2.1.10.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Gauge32: 65002 iso.3.6.1.3.5.1.1.2.1.10.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Gauge32: 65001 iso.3.6.1.3.5.1.1.2.1.10.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Gauge32: 65001 iso.3.6.1.3.5.1.1.2.1.11.1.4.192.168.10.64 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.11.1.4.192.168.10.65 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.11.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = STRING: "dddd" iso.3.6.1.3.5.1.1.2.1.11.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.11.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.12.1.4.192.168.10.64 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.12.1.4.192.168.10.65 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.12.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.12.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.12.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.13.1.4.192.168.10.64 = INTEGER: 1 iso.3.6.1.3.5.1.1.2.1.13.1.4.192.168.10.65 = INTEGER: 3 iso.3.6.1.3.5.1.1.2.1.13.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = INTEGER: 1 iso.3.6.1.3.5.1.1.2.1.13.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = INTEGER: 3 iso.3.6.1.3.5.1.1.2.1.13.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = INTEGER: 1 iso.3.6.1.3.5.1.1.2.1.14.1.4.192.168.10.64 = Hex-STRING: 4F 4B 00 iso.3.6.1.3.5.1.1.2.1.14.1.4.192.168.10.65 = Hex-STRING: 4F 4B 32 00 iso.3.6.1.3.5.1.1.2.1.14.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Hex-STRING: 69 70 76 36 00 ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_snmp_bgp4v2.h')
-rw-r--r--bgpd/bgp_snmp_bgp4v2.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/bgpd/bgp_snmp_bgp4v2.h b/bgpd/bgp_snmp_bgp4v2.h
new file mode 100644
index 0000000000..6980db9f8d
--- /dev/null
+++ b/bgpd/bgp_snmp_bgp4v2.h
@@ -0,0 +1,97 @@
+/* BGP4V2-MIB SNMP support
+ *
+ * Using: http://www.circitor.fr/Mibs/Html/B/BGP4V2-MIB.php
+ *
+ * Copyright (C) 2022 Donatas Abraitis <donatas@opensourcerouting.org>
+ *
+ * This file is part of FRRouting (FRR).
+ *
+ * FRR is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2, or (at your option) any later version.
+ *
+ * FRR is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _FRR_BGP_SNMP_BGP4V2_H_
+#define _FRR_BGP_SNMP_BGP4V2_H_
+
+/* bgp4V2 */
+#define BGP4V2MIB 1, 3, 6, 1, 3, 5, 1
+
+/* bgp4V2PeerEntry:
+ * offset 1.3.6.1.3.5.1.1.2.1.x.(1|2).(4|16) = 13
+ */
+#define BGP4V2_PEER_ENTRY_OFFSET 13
+#define BGP4V2_PEER_INSTANCE 1
+#define BGP4V2_PEER_LOCAL_ADDR_TYPE 2
+#define BGP4V2_PEER_LOCAL_ADDR 3
+#define BGP4V2_PEER_REMOTE_ADDR_TYPE 4
+#define BGP4V2_PEER_REMOTE_ADDR 5
+#define BGP4V2_PEER_LOCAL_PORT 6
+#define BGP4V2_PEER_LOCAL_AS 7
+#define BGP4V2_PEER_LOCAL_IDENTIFIER 8
+#define BGP4V2_PEER_REMOTE_PORT 9
+#define BGP4V2_PEER_REMOTE_AS 10
+#define BGP4V2_PEER_REMOTE_IDENTIFIER 11
+#define BGP4V2_PEER_ADMIN_STATUS 12
+#define BGP4V2_PEER_STATE 13
+#define BGP4V2_PEER_DESCRIPTION 14
+
+/* bgp4V2PeerErrorsEntry */
+#define BGP4V2_PEER_LAST_ERROR_CODE_RECEIVED 1
+#define BGP4V2_PEER_LAST_ERROR_SUBCODE_RECEIVED 2
+#define BGP4V2_PEER_LAST_ERROR_RECEIVED_TIME 3
+#define BGP4V2_PEER_LAST_ERROR_RECEIVED_TEXT 4
+#define BGP4V2_PEER_LAST_ERROR_RECEIVED_DATA 5
+#define BGP4V2_PEER_LAST_ERROR_CODE_SENT 6
+#define BGP4V2_PEER_LAST_ERROR_SUBCODE_SENT 7
+#define BGP4V2_PEER_LAST_ERROR_SENT_TIME 8
+#define BGP4V2_PEER_LAST_ERROR_SENT_TEXT 9
+#define BGP4V2_PEER_LAST_ERROR_SENT_DATA 10
+
+/* bgp4V2PeerEventTimesEntry */
+#define BGP4V2_PEER_FSM_ESTABLISHED_TIME 1
+#define BGP4V2_PEER_PEER_IN_UPDATES_ELAPSED_TIME 2
+
+/* bgp4V2NlriEntry */
+#define BGP4V2_NLRI_INDEX 1
+#define BGP4V2_NLRI_AFI 2
+#define BGP4V2_NLRI_SAFI 3
+#define BGP4V2_NLRI_PREFIX_TYPE 4
+#define BGP4V2_NLRI_PREFIX 5
+#define BGP4V2_NLRI_PREFIX_LEN 6
+#define BGP4V2_NLRI_BEST 7
+#define BGP4V2_NLRI_CALC_LOCAL_PREF 8
+#define BGP4V2_NLRI_ORIGIN 9
+#define BGP4V2_NLRI_NEXT_HOP_ADDR_TYPE 10
+#define BGP4V2_NLRI_NEXT_HOP_ADDR 11
+#define BGP4V2_NLRI_LINK_LOCAL_NEXT_HOP_ADDR_TYPE 12
+#define BGP4V2_NLRI_LINK_LOCAL_NEXT_HOP_ADDR 13
+#define BGP4V2_NLRI_LOCAL_PREF_PRESENT 14
+#define BGP4V2_NLRI_LOCAL_PREF 15
+#define BGP4V2_NLRI_MED_PRESENT 16
+#define BGP4V2_NLRI_MED 17
+#define BGP4V2_NLRI_ATOMIC_AGGREGATE 18
+#define BGP4V2_NLRI_AGGREGATOR_PRESENT 19
+#define BGP4V2_NLRI_AGGREGATOR_AS 20
+#define BGP4V2_NLRI_AGGREGATOR_ADDR 21
+#define BGP4V2_NLRI_AS_PATH_CALC_LENGTH 22
+#define BGP4V2_NLRI_AS_PATH_STRING 23
+#define BGP4V2_NLRI_AS_PATH 24
+#define BGP4V2_NLRI_PATH_ATTR_UNKNOWN 25
+
+/* bgp4V2Notifications */
+#define BGP4V2_ESTABLISHED_NOTIFICATION 1
+#define BGP4V2_BACKWARD_TRANSITION_NOTIFICATION 2
+
+extern int bgp_snmp_bgp4v2_init(struct thread_master *tm);
+
+#endif /* _FRR_BGP_SNMP_BGP4V2_H_ */