diff --git a/console/attributes_ping.go b/console/attributes_ping.go deleted file mode 100644 index ca4aba11f..000000000 --- a/console/attributes_ping.go +++ /dev/null @@ -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 -*/ - -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 -} diff --git a/console/dispatcher_ping.go b/console/dispatcher_ping.go deleted file mode 100755 index ff4ec9140..000000000 --- a/console/dispatcher_ping.go +++ /dev/null @@ -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 -*/ - -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 -} diff --git a/console/loader_ping.go b/console/loader_ping.go deleted file mode 100755 index 471c6a8b4..000000000 --- a/console/loader_ping.go +++ /dev/null @@ -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 -*/ - -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 -} diff --git a/console/suppliers_ping.go b/console/ping.go similarity index 53% rename from console/suppliers_ping.go rename to console/ping.go index 3c1ef847c..2fb45b0ab 100644 --- a/console/suppliers_ping.go +++ b/console/ping.go @@ -18,45 +18,70 @@ along with this program. If not, see 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 } diff --git a/console/resources_ping.go b/console/resources_ping.go deleted file mode 100644 index 144e745b6..000000000 --- a/console/resources_ping.go +++ /dev/null @@ -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 -*/ - -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 -} diff --git a/console/sessions_ping.go b/console/sessions_ping.go deleted file mode 100644 index 8aaad2855..000000000 --- a/console/sessions_ping.go +++ /dev/null @@ -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 -*/ - -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 -} diff --git a/console/stats_ping.go b/console/stats_ping.go deleted file mode 100644 index 4e73d8ca3..000000000 --- a/console/stats_ping.go +++ /dev/null @@ -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 -*/ - -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 -} diff --git a/console/thresholds_ping.go b/console/thresholds_ping.go deleted file mode 100644 index a42f10ff2..000000000 --- a/console/thresholds_ping.go +++ /dev/null @@ -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 -*/ - -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 -} diff --git a/utils/consts.go b/utils/consts.go index 8feeb08ba..42027ae3a 100755 --- a/utils/consts.go +++ b/utils/consts.go @@ -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"