net-mgmt/lldpd: restructure previous

This commit is contained in:
Franco Fichtner
2017-12-30 14:11:50 +01:00
parent 2fa8d2c6bd
commit 0db8382746
7 changed files with 63 additions and 61 deletions
+1
View File
@@ -38,6 +38,7 @@ dns/rfc2136 -- RFC-2136 Support
mail/postfix -- SMTP mail relay
mail/rspamd -- Protect your network from spam
net-mgmt/collectd -- Collect system and application performance metrics periodically
net-mgmt/lldpd -- LLDP allows you to know exactly on which port is a server
net-mgmt/snmp -- SNMP Server via bsnmpd
net-mgmt/telegraf -- Agent for collecting metrics and data
net-mgmt/zabbix-agent -- Enterprise-class open source distributed monitoring agent
+1
View File
@@ -3,5 +3,6 @@ PLUGIN_VERSION= 0.1
PLUGIN_COMMENT= LLDP allows you to know exactly on which port is a server
PLUGIN_DEPENDS= lldpd
PLUGIN_MAINTAINER= m.muenz@gmail.com
PLUGIN_DEVEL= yes
.include "../../Mk/plugins.mk"
@@ -36,5 +36,5 @@ use OPNsense\Base\ApiMutableModelControllerBase;
class GeneralController extends ApiMutableModelControllerBase
{
static protected $internalModelClass = '\OPNsense\Lldpd\General';
static protected $internalModelName = 'lldpd';
static protected $internalModelName = 'general';
}
@@ -32,21 +32,23 @@
namespace OPNsense\Lldpd\Api;
use OPNsense\Base\ApiMutableServiceControllerBase;
use OPNsense\Core\Backend;
class ServiceController extends ApiMutableServiceControllerBase
{
static protected $internalServiceClass = '\OPNsense\Lldpd\General';
static protected $internalServiceTemplate = 'OPNsense/Lldpd';
static protected $internalServiceEnabled = 'enabled';
static protected $internalServiceName = 'lldpd';
/**
* show lldpd neighbors
* @return array
*/
*/
public function neighborAction()
{
$backend = new Backend();
$response = $backend->configdRun("lldpd neighbor");
return array("response" => $response);
}
static protected $internalServiceClass = '\OPNsense\Lldpd\General';
static protected $internalServiceTemplate = 'OPNsense/Lldpd';
static protected $internalServiceEnabled = 'general.enabled';
static protected $internalServiceName = 'lldpd';
}
@@ -1,5 +1,5 @@
<menu>
<Services>
<Lldpd cssClass="fa fa-binoculars" url="/ui/lldpd/general/index" />
<LLDPd cssClass="fa fa-binoculars" url="/ui/lldpd/general/index" />
</Services>
</menu>
@@ -1,31 +1,30 @@
{#
# Copyright (C) 2014-2017 Deciso B.V.
# Copyright (C) 2017 Michael Muenz
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#}
OPNsense® is Copyright © 2014 2017 by Deciso B.V.
This file is Copyright © 2017 by Michael Muenz
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
#}
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
<li class="active"><a data-toggle="tab" href="#general">{{ lang._('General') }}</a></li>
<li><a data-toggle="tab" href="#neighbor">{{ lang._('Neighbors') }}</a></li>
@@ -45,29 +44,34 @@ POSSIBILITY OF SUCH DAMAGE.
</div>
<script type="text/javascript">
$( document ).ready(function() {
var data_get_map = {'frm_general_settings':"/api/lldpd/general/get"};
mapDataToFormUI(data_get_map).done(function(data){
formatTokenizersUI();
$('.selectpicker').selectpicker('refresh');
});
ajaxCall(url="/api/lldpd/service/status", sendData={}, callback=function(data,status) {
updateServiceStatusUI(data['status']);
});
ajaxCall(url="/api/lldpd/service/neighbor", sendData={}, callback=function(data,status) {
$("#listneighbor").text(data['response']);
});
// link save button to API set action
$("#saveAct").click(function(){
saveFormToEndpoint(url="/api/lldpd/general/set", formid='frm_general_settings',callback_ok=function(){
$("#saveAct_progress").addClass("fa fa-spinner fa-pulse");
ajaxCall(url="/api/lldpd/service/reconfigure", sendData={}, callback=function(data,status) {
ajaxCall(url="/api/lldpd/service/status", sendData={}, callback=function(data,status) {
updateServiceStatusUI(data['status']);
});
$("#saveAct_progress").removeClass("fa fa-spinner fa-pulse");
});
$( document ).ready(function () {
var data_get_map = {'frm_general_settings':"/api/lldpd/general/get"};
mapDataToFormUI(data_get_map).done(function(data){
formatTokenizersUI();
$('.selectpicker').selectpicker('refresh');
});
ajaxCall(url="/api/lldpd/service/status", sendData={}, callback=function(data,status) {
updateServiceStatusUI(data['status']);
});
ajaxCall(url="/api/lldpd/service/neighbor", sendData={}, callback=function(data,status) {
$("#listneighbor").text(data['response']);
});
// link save button to API set action
$("#saveAct").click(function () {
saveFormToEndpoint(url="/api/lldpd/general/set", formid='frm_general_settings',callback_ok=function () {
$("#saveAct_progress").addClass("fa fa-spinner fa-pulse");
ajaxCall(url="/api/lldpd/service/reconfigure", sendData={}, callback=function(data,status) {
ajaxCall(url="/api/lldpd/service/status", sendData={}, callback=function(data,status) {
updateServiceStatusUI(data['status']);
});
ajaxCall(url="/api/lldpd/service/neighbor", sendData={}, callback=function(data,status) {
$("#listneighbor").text(data['response']);
});
$("#saveAct_progress").removeClass("fa fa-spinner fa-pulse");
});
});
});
});
</script>
@@ -16,12 +16,6 @@ parameters:
type:script
message:restarting Lldpd
[reconfigure]
command:/usr/local/etc/rc.d/lldpd restart
parameters:
type:script
message:reconfigure Lldpd
[status]
command:/usr/local/etc/rc.d/lldpd status
parameters: