-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample-protocols.php
184 lines (172 loc) · 6.01 KB
/
sample-protocols.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<?php
// notes:
//
// received routes: query route protocol pb_0109_as42
// advertised routes: route table t_0109_as42
$response = [
'api' => [
'version' => '1.0',
'result_from_cache' => true,
'cache_status' => [
'cached_at' => DateTime::createFromFormat( 'Y-m-d H:i:s', '2016-10-22 10:43:48' ),
'orig_ttl' => 300
],
],
'protocols' => [
[
'protocol' => 'pb_0109_as42',
'table' => 't_0109_as42',
'state' => 'up', // 'start'
'connection' => 'Established', // 'Connect'
'state_changed' => DateTime::createFromFormat( 'Y-m-d', '2016-09-30' ),
'description' => 'RIB for AS42 - Packet Clearing House DNS - VLAN Interface 109',
'preference' => 100,
'input_filter' =>'(unnamed)',
'output_filter' => 'ACCEPT',
'import_limit' => 1000,
'limit_action' => 'restart',
'routes' => [
'imported' => 35,
'exported' => 41127,
'preferred' => 2590,
],
'route_changes' => [
'import_updates' => [
'received' => 94,
'rejected' => 0,
'filtered' => 0,
'ignored' => 0,
'accepted' => 94,
],
'import_withdraws' => [
'received' => 59,
'rejected' => 0,
'ignored' => 0,
'accepted' => 94,
],
'export_updates' => [
'received' => 1089442,
'rejected' => 94,
'filtered' => 0,
'accepted' => 1089348,
],
'export_withdraws' => [
'received' => 216076,
'accepted' => 216017,
],
],
],
'bgp_state' => 'Established',
'neighbor_address' => '193.242.111.60',
'neighbor_as' => 42,
'neighbor_id' => '204.61.210.182',
'neighbor_capabilities' => [
'refresh'
],
'bgp_session' => [
'external',
'route-server'
],
'source_address' => '193.242.111.8',
'route_limit_at' => 35,
'hold_timer' => 180,
'keepalive' => 60
]
];
// pb_0137_as10310 BGP t_0137_as10310 start 2015-04-30 Connect Socket: No route to host
// Description: RIB for AS10310 - Yahoo! - VLAN Interface 137
// Preference: 100
// Input filter: (unnamed)
// Output filter: ACCEPT
// Import limit: 500
// Action: restart
// Routes: 0 imported, 0 exported, 0 preferred
// Route change stats: received rejected filtered ignored accepted
// Import updates: 0 0 0 0 0
// Import withdraws: 0 0 --- 0 0
// Export updates: 0 0 0 --- 0
// Export withdraws: 0 --- --- --- 0
// BGP state: Connect
// Neighbor address: 193.242.111.77
// Neighbor AS: 10310
// Last error: Socket: No route to host
echo json_encode( $response, JSON_PRETTY_PRINT ) . "\n\n";
//
// {
// "api": {
// "version": "1.0",
// "result_from_cache": true,
// "cache_status": {
// "cached_at": {
// "date": "2016-10-22 10:43:48.000000",
// "timezone_type": 3,
// "timezone": "UTC"
// },
// "orig_ttl": 300
// }
// },
// "protocols": {
// "0": {
// "protocol": "pb_0109_as42",
// "table": "t_0109_as42",
// "state": "up",
// "connection": "Established",
// "state_changed": {
// "date": "2016-09-30 10:43:46.000000",
// "timezone_type": 3,
// "timezone": "UTC"
// },
// "description": "RIB for AS42 - Packet Clearing House DNS - VLAN Interface 109",
// "preference": 100,
// "input_filter": "(unnamed)",
// "output_filter": "ACCEPT",
// "import_limit": 1000,
// "limit_action": "restart",
// "routes": {
// "imported": 35,
// "exported": 41127,
// "preferred": 2590
// },
// "route_changes": {
// "import_updates": {
// "received": 94,
// "rejected": 0,
// "filtered": 0,
// "ignored": 0,
// "accepted": 94
// },
// "import_withdraws": {
// "received": 59,
// "rejected": 0,
// "ignored": 0,
// "accepted": 94
// },
// "export_updates": {
// "received": 1089442,
// "rejected": 94,
// "filtered": 0,
// "accepted": 1089348
// },
// "export_withdraws": {
// "received": 216076,
// "accepted": 216017
// }
// }
// },
// "bgp_state": "Established",
// "neighbor_address": "193.242.111.60",
// "neighbor_as": 42,
// "neighbor_id": "204.61.210.182",
// "neighbor_capabilities": [
// "refresh"
// ],
// "bgp_session": [
// "external",
// "route-server"
// ],
// "source_address": "193.242.111.8",
// "route_limit_at": 35,
// "hold_timer": 180,
// "keepalive": 60
// }
// }