Add single ping command for all subsystems

This commit is contained in:
Anevo
2018-04-13 09:11:06 -04:00
committed by Dan Christian Bogos
parent ff757a29fa
commit 8f0ef9de9c
9 changed files with 50 additions and 446 deletions

View File

@@ -1,62 +0,0 @@
/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
This program 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 3 of the License, or
(at your option) any later version.
This program 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. If not, see <http://www.gnu.org/licenses/>
*/
package console
import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdAttributePing{
name: "attribute_ping",
rpcMethod: utils.AttributeSv1Ping,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdAttributePing struct {
name string
rpcMethod string
rpcParams *EmptyWrapper
*CommandExecuter
}
func (self *CmdAttributePing) Name() string {
return self.name
}
func (self *CmdAttributePing) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdAttributePing) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &EmptyWrapper{}
}
return self.rpcParams
}
func (self *CmdAttributePing) PostprocessRpcParams() error {
return nil
}
func (self *CmdAttributePing) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -1,62 +0,0 @@
/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
This program 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 3 of the License, or
(at your option) any later version.
This program 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. If not, see <http://www.gnu.org/licenses/>
*/
package console
import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdDispatcherPing{
name: "dispatcher_ping",
rpcMethod: utils.DispatcherSv1Ping,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdDispatcherPing struct {
name string
rpcMethod string
rpcParams *EmptyWrapper
*CommandExecuter
}
func (self *CmdDispatcherPing) Name() string {
return self.name
}
func (self *CmdDispatcherPing) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdDispatcherPing) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &EmptyWrapper{}
}
return self.rpcParams
}
func (self *CmdDispatcherPing) PostprocessRpcParams() error {
return nil
}
func (self *CmdDispatcherPing) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -1,62 +0,0 @@
/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
This program 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 3 of the License, or
(at your option) any later version.
This program 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. If not, see <http://www.gnu.org/licenses/>
*/
package console
import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdLoaderPing{
name: "loader_ping",
rpcMethod: utils.LoaderSv1Ping,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdLoaderPing struct {
name string
rpcMethod string
rpcParams *EmptyWrapper
*CommandExecuter
}
func (self *CmdLoaderPing) Name() string {
return self.name
}
func (self *CmdLoaderPing) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdLoaderPing) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &EmptyWrapper{}
}
return self.rpcParams
}
func (self *CmdLoaderPing) PostprocessRpcParams() error {
return nil
}
func (self *CmdLoaderPing) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -18,45 +18,70 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
import "github.com/cgrates/cgrates/utils"
import (
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdSupplierPing{
name: "supplier_ping",
rpcMethod: utils.SupplierSv1Ping,
c := &CmdApierPing{
name: "ping",
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdSupplierPing struct {
type CmdApierPing struct {
name string
rpcMethod string
rpcParams *EmptyWrapper
rpcParams *StringWrapper
*CommandExecuter
}
func (self *CmdSupplierPing) Name() string {
type ArgsPing struct {
MethodName string
}
func (self *CmdApierPing) Name() string {
return self.name
}
func (self *CmdSupplierPing) RpcMethod() string {
func (self *CmdApierPing) RpcMethod() string {
switch self.rpcParams.Item {
case "suppliers":
return utils.SupplierSv1Ping
case "attributes":
return utils.AttributeSv1Ping
case "resources":
return utils.ResourceSv1Ping
case "stats":
return utils.StatSv1Ping
case "thresholds":
return utils.ThresholdSv1Ping
case "sessions":
return utils.SessionSv1Ping
case "loader":
return utils.LoaderSv1Ping
case "dispatcher":
return utils.DispatcherSv1Ping
default:
}
return self.rpcMethod
}
func (self *CmdSupplierPing) RpcParams(reset bool) interface{} {
func (self *CmdApierPing) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &EmptyWrapper{}
self.rpcParams = &StringWrapper{}
}
return self.rpcParams
}
func (self *CmdSupplierPing) PostprocessRpcParams() error {
func (self *CmdApierPing) PostprocessRpcParams() error {
return nil
}
func (self *CmdSupplierPing) RpcResult() interface{} {
func (self *CmdApierPing) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -1,62 +0,0 @@
/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
This program 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 3 of the License, or
(at your option) any later version.
This program 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. If not, see <http://www.gnu.org/licenses/>
*/
package console
import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdResourcePing{
name: "resource_ping",
rpcMethod: utils.ResourceSv1Ping,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdResourcePing struct {
name string
rpcMethod string
rpcParams *EmptyWrapper
*CommandExecuter
}
func (self *CmdResourcePing) Name() string {
return self.name
}
func (self *CmdResourcePing) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdResourcePing) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &EmptyWrapper{}
}
return self.rpcParams
}
func (self *CmdResourcePing) PostprocessRpcParams() error {
return nil
}
func (self *CmdResourcePing) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -1,62 +0,0 @@
/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
This program 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 3 of the License, or
(at your option) any later version.
This program 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. If not, see <http://www.gnu.org/licenses/>
*/
package console
import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdSessionPing{
name: "session_ping",
rpcMethod: utils.SessionSv1Ping,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdSessionPing struct {
name string
rpcMethod string
rpcParams *EmptyWrapper
*CommandExecuter
}
func (self *CmdSessionPing) Name() string {
return self.name
}
func (self *CmdSessionPing) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdSessionPing) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &EmptyWrapper{}
}
return self.rpcParams
}
func (self *CmdSessionPing) PostprocessRpcParams() error {
return nil
}
func (self *CmdSessionPing) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -1,62 +0,0 @@
/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
This program 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 3 of the License, or
(at your option) any later version.
This program 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. If not, see <http://www.gnu.org/licenses/>
*/
package console
import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdStatsPing{
name: "stats_ping",
rpcMethod: utils.StatSv1Ping,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdStatsPing struct {
name string
rpcMethod string
rpcParams *EmptyWrapper
*CommandExecuter
}
func (self *CmdStatsPing) Name() string {
return self.name
}
func (self *CmdStatsPing) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdStatsPing) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &EmptyWrapper{}
}
return self.rpcParams
}
func (self *CmdStatsPing) PostprocessRpcParams() error {
return nil
}
func (self *CmdStatsPing) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -1,62 +0,0 @@
/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
This program 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 3 of the License, or
(at your option) any later version.
This program 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. If not, see <http://www.gnu.org/licenses/>
*/
package console
import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdThresholdPing{
name: "threshold_ping",
rpcMethod: utils.ThresholdSv1Ping,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdThresholdPing struct {
name string
rpcMethod string
rpcParams *EmptyWrapper
*CommandExecuter
}
func (self *CmdThresholdPing) Name() string {
return self.name
}
func (self *CmdThresholdPing) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdThresholdPing) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &EmptyWrapper{}
}
return self.rpcParams
}
func (self *CmdThresholdPing) PostprocessRpcParams() error {
return nil
}
func (self *CmdThresholdPing) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -596,6 +596,7 @@ const (
// MetaFilterIndexesAPIs
const (
ApierV1ComputeFilterIndexes = "ApierV1.ComputeFilterIndexes"
ApierV1Ping = "ApierV1.Ping"
)
const (
@@ -683,6 +684,18 @@ const (
CacheSv1Clear = "CacheSv1.Clear"
)
// Scheduler
const (
SchedulerPing = "Scheduler.Ping"
)
// Cdrc
const (
CdrcPing = "Cdrc.Ping"
)
//CSV file name
const (
TIMINGS_CSV = "Timings.csv"