Skip to content

Commit

Permalink
[NF] unused optics table
Browse files Browse the repository at this point in the history
  • Loading branch information
barryo committed Jan 27, 2015
1 parent 2218f4d commit 4b7e1c0
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 33 deletions.
16 changes: 16 additions & 0 deletions application/controllers/SwitchPortController.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,22 @@ public function listMauAction()
$this->_display( 'list-mau.phtml' );
}

public function unusedOpticsAction()
{
$this->view->data = $this->getD2EM()->createQueryBuilder()
->select( 'sp' )
->from( '\\Entities\\SwitchPort', 'sp' )
->leftJoin( 'sp.Switcher', 's' )
->orderBy( 's.name', 'ASC' )
->where( 's.mauSupported = 1 AND sp.ifOperStatus != 1 AND sp.mauType != :mauType AND sp.type != :type' )
->setParameter( 'mauType', '(empty)' )
->setParameter( 'type', \Entities\SwitchPort::TYPE_MANAGEMENT )
->getQuery()
->getResult();

$this->_display( 'unused-optics.phtml' );
}


public function opStatusAction()
{
Expand Down
69 changes: 36 additions & 33 deletions application/views/menu.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="row-fluid">
<div class="span2">
<div class="well sidebar-nav">

<ul class="nav nav-list">

<form class="form-search" method="get" action="{genUrl controller="search" action="do"}">
Expand All @@ -11,7 +11,7 @@
</form>

<li class="nav-header">IXP Customer Actions</li>

<li {if $controller eq 'customer' and ( $action eq 'list' or $action eq 'add' or $action eq 'edit' or $action eq 'dashboard' )}class="active"{/if}>
<a href="{genUrl controller='customer' action='list'}">Customers</a>
</li>
Expand All @@ -29,7 +29,7 @@
{else}
<a href="{genUrl controller='virtual-interface' action='list'}">Interfaces</a>
{/if}

</li>
<li {if $controller eq 'user' and $action neq 'last'}class="active"{/if}>
<a href="{genUrl controller='user' action='list'}">Users</a>
Expand All @@ -54,7 +54,7 @@
{if not isset( $options['frontend']['disabled']['meeting'] ) or not $options['frontend']['disabled']['meeting'] }
<li {if $controller eq 'meeting' and $controller neq 'meeting-item' and $action neq 'read'}class="active"{/if}>
<a href="{genUrl controller='meeting' action='list'}">Meetings</a>

{if $controller eq 'meeting' or $controller eq 'meeting-item' or ( $controller eq 'static' and $action eq 'meetings-instructions' )}
<ul class="nav nav-list">
<li {if $controller eq 'meeting-item'}class="active"{/if}>
Expand All @@ -70,8 +70,8 @@
{/if}
</li>
{/if}


<li class="nav-header">IXP Admin Actions</li>
{if $multiIXP }
<li {if $controller eq 'ixp'}class="active"{/if}>
Expand All @@ -82,31 +82,34 @@
<li {if $controller eq 'infrastructure'}class="active"{/if}>
<a href="{genUrl controller='infrastructure' action='list'}">Infrastructures</a>
</li>

<li {if $controller eq 'location'}class="active"{/if}>
<a href="{genUrl controller='location' action='list'}">Locations</a>
</li>

<li {if $controller eq 'cabinet'}class="active"{/if}>
<a href="{genUrl controller='cabinet' action='list'}">Cabinets</a>
</li>

<li {if $controller eq 'switch' and $action neq 'add-ports'}class="active"{/if}>
<a href="{genUrl controller='switch' action='list'}">Switches</a>

{if $controller eq 'switch' or $controller eq 'switch-port'}
<ul class="nav nav-list">
<li {if $controller eq 'switch-port'}class="active"{/if}>
<li {if $controller eq 'switch-port' and $action neq 'unused-optics'}class="active"{/if}>
<a href="{genUrl controller='switch-port' action='list'}">Switch Ports</a>
</li>
<li {if $controller eq 'switch-port' and $action eq 'unused-optics'}class="active"{/if}>
<a href="{genUrl controller='switch-port' action='unused-optics'}">Unused Optics</a>
</li>
</ul>
{/if}

</li>

<li>
<a href="{genUrl controller='ipv6-address' action='list'}">IP Addressing</a>

{if $controller eq 'ipv4-address' or $controller eq 'ipv6-address'}
<ul class="nav nav-list">
<li {if $controller eq 'ipv4-address' and $action neq 'add-addresses'}class="active"{/if}>
Expand All @@ -117,51 +120,51 @@
</li>
</ul>
{/if}

</li>

{if not isset( $options['frontend']['disabled']['mac-address'] ) or not $options['frontend']['disabled']['mac-address'] }
<li {if $controller eq 'mac-address'}class="active"{/if}>
<a href="{genUrl controller='mac-address' action='list'}">MAC Addresses</a>
</li>
{/if}

<li {if $controller eq 'vendor'}class="active"{/if}>
<a href="{genUrl controller='vendor' action='list'}">Vendors</a>
</li>

{if not isset( $options['frontend']['disabled']['console-server-connection'] ) or not $options['frontend']['disabled']['console-server-connection'] }
<li {if $controller eq 'console-server-connection'}class="active"{/if}>
<a href="{genUrl controller='console-server-connection' action='list'}">Console Server Connections</a>
</li>
{/if}

<li {if $controller eq 'vlan' and $action neq 'private'}class="active"{/if}>
<a href="{genUrl controller='vlan' action='list'}">VLANs</a>

{if $controller eq 'vlan'}
<ul class="nav nav-list">
<li {if $controller eq 'vlan' and $action eq 'private'}class="active"{/if}>
<a href="{genUrl controller='vlan' action='private'}">Private VLANs</a>
</li>
</ul>
{/if}

</li>

<li {if $controller eq 'irrdb-config'}class="active"{/if}>
<a href="{genUrl controller='irrdb-config' action='list'}">IRRDB Configuration</a>
</li>

{if not isset( $options['frontend']['disabled']['rs-prefixes'] ) or not $options['frontend']['disabled']['rs-prefixes'] }
<li {if $controller eq 'rs-prefixes'}class="active"{/if}>
<a href="{genUrl controller='rs-prefixes' action='index'}">Route Server Prefixes</a>
</li>
{/if}


<li class="nav-header">IXP Statistics</li>

<li {if $controller eq 'statistics' and $action eq 'members'}class="active"{/if}>
<a href="{genUrl controller='statistics' action='members'}">Member Statistics - Graphs</a>
</li>
Expand All @@ -171,14 +174,14 @@
<li {if $controller eq 'statistics' and $action eq 'league-table'}class="active"{/if}>
<a href="{genUrl controller='statistics' action='league-table'}">League Table</a>
</li>

{* 95th Percentiles {genUrl controller="customer" action="ninety-fifth"} *}
{* Last Logins {genUrl controller="user" action="last"} *}





<li class="nav-header">IXP Utilities</li>

<li {if $controller eq 'utils' and $action eq 'phpinfo'}class="active"{/if}>
<a href="{genUrl controller='utils' action='phpinfo'}">PHP Info</a>
</li>
Expand All @@ -188,10 +191,10 @@
<li {if $controller eq 'user' and $action eq 'last'}class="active"{/if}>
<a href="{genUrl controller='user' action='last'}">Last Logins</a>
</li>


</ul>

</div><!--/.well -->

<div id="searchHelpModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="searchHelpModalLabel" aria-hidden="true">
Expand All @@ -201,7 +204,7 @@
</div>
<div class="modal-body">
<p>
The search box allows for an efficient database search via a number of parameters:
The search box allows for an efficient database search via a number of parameters:
</p>
<div class="row-fluid">
<div class="span6">
Expand Down
102 changes: 102 additions & 0 deletions application/views/switch-port/unused-optics.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{tmplinclude file="header.phtml"}

<ul class="breadcrumb">
<li>
<a href="{genUrl}">Home</a> <span class="divider">/</span>
</li>
<li>
<a href="{genUrl controller=$controller action="list"}">Switches</a> <span class="divider">/</span>
</li>
<li class="active">
Unused Optics
</li>
</ul>

<div>

{OSS_Message}

<div class="alert alert-info">
A list of ports from <strong>switches that support the IANA MAU MIB</strong> where the operational status
is down, the port is populated with an optic / SFP and the port type is not management.
Data valid at time of last SNMP poll.
</div>


{if count( $data )}
<table id='frontend-list-table' class="table hide">

<thead>
<tr>
<th>ifIndex</th>
<th>Switch</th>
<th>Port</th>
<th>Type</th>
<th>MAU Type</th>
<th>MAU State</th>
<th>Jack Type</th>
</tr>
</thead>

<tbody>
{foreach $data as $idx => $sp}
<tr>
<td>{$sp->getSwitcher()->getId()}</td>
<td>{$sp->getSwitcher()->getName()}</td>
<td>{$sp->getIfName()}</td>
<td>{SWITCHPORT::$TYPES[ $sp->getType() ]}</td>
<td>{$sp->getMauType()}</td>
<td>{$sp->getMauState()}</td>
<td>{$sp->getMauJacktype()}</td>
</tr>
{/foreach}
</tbody>

</table>
{else}
<p>
There are no entries.
{if ( !isset( $feParams->addWhenEmpty ) || $feParams->addWhenEmpty ) && ( !isset( $feParams->readonly ) || !$feParams->readonly )} Do you want to <a href="{genUrl controller=$controller action='add'}">add one...</a>{/if}
</p>
{/if} {* end if count( $data ) *}

</div>


<script type="text/javascript">


var oDataTable;

$(document).ready(function() {

oDataTable = $( '#frontend-list-table' ).dataTable({
'iDisplayLength': {if isset( $options.defaults.table.entries )}{$options.defaults.table.entries}{else}50{/if},
"aLengthMenu": [ [ 10, 25, 50, 100, 500, -1 ], [ 10, 25, 50, 100, 500, "All" ] ],
"sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"sPaginationType": "bootstrap",
"bAutoWidth": false,
'aaSorting': [[ 1, 'asc' ]],
'aoColumns': [
{ bVisible: false },
{ iDataSort: 0 },
null,
null,
null,
null,
null
]
});

$( '#frontend-list-table' ).show();

});






</script>

{tmplinclude file="footer.phtml"}

0 comments on commit 4b7e1c0

Please sign in to comment.