mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Updating Radius CoA integration test to make use of the *alter_sessions action
This commit is contained in:
@@ -97,18 +97,20 @@ func TestRadiusCoADisconnect(t *testing.T) {
|
||||
var reply string
|
||||
|
||||
// Set Action which will be called by Threshold when account gets debitted
|
||||
actRadCoaAcnt1001 := &utils.AttrSetActions{
|
||||
ActionsId: "ACT_RAD_COA_ACNT_1001",
|
||||
Actions: []*utils.TPAction{{
|
||||
Identifier: utils.MetaAlterSessions,
|
||||
ExtraParameters: "cgrates.org;*string:~*req.Account:1001;1;*radCoATemplate:mycoa;CustomFilter:custom_filter",
|
||||
}}}
|
||||
if err := raDiscRPC.Call(context.Background(), utils.APIerSv2SetActions,
|
||||
actRadCoaAcnt1001, &reply); err != nil {
|
||||
t.Error("Got error on APIerSv2.SetActions: ", err.Error())
|
||||
} else if reply != utils.OK {
|
||||
t.Errorf("Calling APIerSv2.SetActions received: %s", reply)
|
||||
}
|
||||
/*
|
||||
actRadCoaAcnt1001 := &utils.AttrSetActions{
|
||||
ActionsId: "ACT_RAD_COA_ACNT_1001",
|
||||
Actions: []*utils.TPAction{{
|
||||
Identifier: utils.MetaAlterSessions,
|
||||
ExtraParameters: "cgrates.org;*string:~*req.Account:1001;1;*radCoATemplate:mycoa;CustomFilter:custom_filter",
|
||||
}}}
|
||||
if err := raDiscRPC.Call(context.Background(), utils.APIerSv2SetActions,
|
||||
actRadCoaAcnt1001, &reply); err != nil {
|
||||
t.Error("Got error on APIerSv2.SetActions: ", err.Error())
|
||||
} else if reply != utils.OK {
|
||||
t.Errorf("Calling APIerSv2.SetActions received: %s", reply)
|
||||
}
|
||||
*/
|
||||
|
||||
// Set the Threshold profile which will call the action when account will be modified
|
||||
|
||||
@@ -267,21 +269,8 @@ func TestRadiusCoADisconnect(t *testing.T) {
|
||||
if replyPacket.Code != radigo.AccountingResponse {
|
||||
t.Errorf("unexpected reply received to AccountingRequest: %+v", replyPacket)
|
||||
}
|
||||
/*
|
||||
if err := raDiscRPC.Call(context.Background(), utils.SessionSv1AlterSessions,
|
||||
utils.SessionFilterWithEvent{
|
||||
SessionFilter: &utils.SessionFilter{
|
||||
APIOpts: map[string]any{
|
||||
utils.MetaRadCoATemplate: "mycoa",
|
||||
}},
|
||||
Event: map[string]any{
|
||||
"CustomFilter": "custom_filter",
|
||||
},
|
||||
}, &reply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
*/
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
time.Sleep(1 * time.Second) // Give time for the ThresholdS to execute the *alter_sessions API
|
||||
if err = raDiscRPC.Call(context.Background(), utils.SessionSv1ForceDisconnect,
|
||||
nil, &reply); err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
{"tag": "Acct-Session-Id", "path": "*radDAReq.Acct-Session-Id", "type": "*variable",
|
||||
"value": "~*oreq.Acct-Session-Id"},
|
||||
{"tag": "Filter-Id", "path": "*radDAReq.Filter-Id", "type": "*variable",
|
||||
"value": "mycustomvalue"},
|
||||
"value": "~*req.CustomFilter"},
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -11,3 +11,4 @@ DISABLE_AND_LOG,*log,,,,,,,,,,,,,false,false,10
|
||||
DISABLE_AND_LOG,*disable_account,,,,,,,,,,,,,false,false,10
|
||||
TOPUP_100SMS_DE_MOBILE,*topup,,,,*sms,,DST_DE_MOBILE,,,,,100,10,false,false,10
|
||||
#ACT_RAD_COA_ACNT_1001,*cgr_rpc,"{""Address"":""localhost:2012"",""Transport"":""*json"",""Method"":""SessionSv1.AlterSessions"",""Attempts"":1,""Async"":false,""Params"":{""Filters"":[""*string:~*req.Account:1001""],""Tenant"":""cgrates.org"",""APIOpts"":{""*radCoATemplate"":""mycoa""},""Event"":{""CustomFilter"":""custom_filter""}}}",,,,,,,,,,,,,,20
|
||||
ACT_RAD_COA_ACNT_1001,*alter_sessions,cgrates.org;*string:~*req.Account:1001;1;*radCoATemplate:mycoa;CustomFilter:mycustomvalue,,,,,,,,,,,,,,
|
||||
|
||||
|
Reference in New Issue
Block a user