1 | <?php |
||
2 | |||
3 | use App\Models\IsisAdjacency; |
||
4 | |||
5 | if (! Auth::user()->hasGlobalRead()) { |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
6 | include 'includes/html/error-no-perm.inc.php'; |
||
7 | } else { |
||
8 | $link_array = [ |
||
9 | 'page' => 'routing', |
||
10 | 'protocol' => 'isis', |
||
11 | ]; |
||
12 | |||
13 | print_optionbar_start('', ''); |
||
14 | |||
15 | echo '<span style="font-weight: bold;">Adjacencies</span> » '; |
||
16 | |||
17 | if (! $vars['state']) { |
||
18 | $vars['state'] = 'all'; |
||
19 | } |
||
20 | |||
21 | if ($vars['state'] == 'all') { |
||
22 | $filter = ['up', 'down']; |
||
23 | echo "<span class='pagemenu-selected'>"; |
||
24 | } |
||
25 | |||
26 | echo generate_link('All', $vars, ['state' => 'all']); |
||
27 | if ($vars['state'] == 'all') { |
||
28 | echo '</span>'; |
||
29 | } |
||
30 | |||
31 | echo ' | '; |
||
32 | |||
33 | if ($vars['state'] == 'up') { |
||
34 | $filter = ['up']; |
||
35 | echo "<span class='pagemenu-selected'>"; |
||
36 | } |
||
37 | |||
38 | echo generate_link('Up', $vars, ['state' => 'up']); |
||
39 | if ($vars['state'] == 'up') { |
||
40 | $filter = ['up']; |
||
41 | echo '</span>'; |
||
42 | } |
||
43 | |||
44 | echo ' | '; |
||
45 | |||
46 | if ($vars['state'] == 'down') { |
||
47 | echo "<span class='pagemenu-selected'>"; |
||
48 | } |
||
49 | |||
50 | echo generate_link('Down', $vars, ['state' => 'down']); |
||
51 | if ($vars['state'] == 'down') { |
||
52 | $filter = ['down']; |
||
53 | echo '</span>'; |
||
54 | } |
||
55 | |||
56 | print_optionbar_end(); |
||
57 | |||
58 | echo ' |
||
59 | <div> |
||
60 | <div class="panel panel-default"> |
||
61 | <div class="panel-body"> |
||
62 | <table class="table table-condensed table-hover" style="border-collapse:collapse;"> |
||
63 | <thead> |
||
64 | <tr> |
||
65 | <th> </th> |
||
66 | <th>Local Device</th> |
||
67 | <th>Local Interface</th> |
||
68 | <th>Adjacent</th> |
||
69 | <th>System ID</th> |
||
70 | <th>Area</th> |
||
71 | <th>System Type</th> |
||
72 | <th>Admin</th> |
||
73 | <th>State</th> |
||
74 | <th>Last Uptime</th> |
||
75 | </tr> |
||
76 | </thead>'; |
||
77 | |||
78 | foreach (IsisAdjacency::whereIn('isisISAdjState', $filter)->with('port')->get() as $adj) { |
||
79 | $device = device_by_id_cache($adj->device_id); |
||
80 | if ($adj->isisISAdjState == 'up') { |
||
81 | $color = 'green'; |
||
82 | } else { |
||
83 | $color = 'red'; |
||
84 | } |
||
85 | |||
86 | $interface_name = $adj->port->ifName; |
||
87 | |||
88 | echo ' |
||
89 | <tbody> |
||
90 | <tr> |
||
91 | <td></td> |
||
92 | <td>' . generate_device_link($device, 0, ['tab' => 'routing', 'proto' => 'isis']) . '</td> |
||
93 | <td>' . \LibreNMS\Util\Url::portLink($adj->port) . '</td> |
||
94 | <td>' . $adj->isisISAdjIPAddrAddress . '</td> |
||
95 | <td>' . $adj->isisISAdjNeighSysID . '</td> |
||
96 | <td>' . $adj->isisISAdjAreaAddress . '</td> |
||
97 | <td>' . $adj->isisISAdjNeighSysType . '</td> |
||
98 | <td>' . $adj->isisCircAdminState . '</td> |
||
99 | <td><strong><span style="color: ' . $color . ';">' . $adj->isisISAdjState . '</span></strong></td> |
||
100 | <td>' . \LibreNMS\Util\Time::formatInterval($adj->isisISAdjLastUpTime) . '</td> |
||
101 | </tr> |
||
102 | </tbody>'; |
||
103 | } |
||
104 | echo '</table> |
||
105 | </div> |
||
106 | </div> |
||
107 | </div>'; |
||
108 | } |
||
109 |