Documentation ¶
Index ¶
- Constants
- func GetAVP(message *ccrMessage, AVPToFind string) (interface{}, error)
- type CreditBucket
- type GyAnswer
- type GyExpectation
- type OCSConfig
- type OCSDiamServer
- func (srv *OCSDiamServer) AbortSession(_ context.Context, req *protos.AbortSessionRequest) (*protos.AbortSessionAnswer, error)
- func (srv *OCSDiamServer) AssertExpectations(_ context.Context, void *orcprotos.Void) (*protos.GyCreditControlResult, error)
- func (srv *OCSDiamServer) ClearSubscribers(_ context.Context, void *orcprotos.Void) (*orcprotos.Void, error)
- func (srv *OCSDiamServer) ConfigServer(_ context.Context, config *protos.ServerConfiguration) (*orcprotos.Void, error)
- func (srv *OCSDiamServer) CreateAccount(_ context.Context, subscriberID *lteprotos.SubscriberID) (*orcprotos.Void, error)
- func (srv *OCSDiamServer) GetCredits(_ context.Context, subscriberID *lteprotos.SubscriberID) (*protos.CreditInfos, error)
- func (srv *OCSDiamServer) GetLastAVPreceived() (*diam.Message, error)
- func (srv *OCSDiamServer) ReAuth(ctx context.Context, target *protos.ChargingReAuthTarget) (*protos.ChargingReAuthAnswer, error)
- func (srv *OCSDiamServer) Reset(_ context.Context, req *orcprotos.Void) (*orcprotos.Void, error)
- func (srv *OCSDiamServer) SetCredit(_ context.Context, creditInfo *protos.CreditInfo) (*orcprotos.Void, error)
- func (srv *OCSDiamServer) SetExpectations(_ context.Context, req *protos.GyCreditControlExpectations) (*orcprotos.Void, error)
- func (srv *OCSDiamServer) SetOCSSettings(_ context.Context, ocsConfig *protos.OCSConfig) (*orcprotos.Void, error)
- func (srv *OCSDiamServer) Start(lis net.Listener) error
- func (srv *OCSDiamServer) StartListener() (net.Listener, error)
- type SubscriberAccount
- type SubscriberSessionState
Constants ¶
const DiameterCreditLimitReached = 4012
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreditBucket ¶
type CreditBucket struct { Unit protos.CreditInfo_UnitType Volume *protos.Octets }
type GyAnswer ¶
type GyAnswer struct {
*protos.GyCreditControlAnswer
}
type GyExpectation ¶
type GyExpectation struct {
*protos.GyCreditControlExpectation
}
Here we wrap the protobuf definitions to easily define instance methods
func (GyExpectation) DoesMatch ¶
func (e GyExpectation) DoesMatch(message interface{}) error
func (GyExpectation) GetAnswer ¶
func (e GyExpectation) GetAnswer() interface{}
type OCSConfig ¶
type OCSConfig struct { MaxUsageOctets *protos.Octets MaxUsageTime uint32 ValidityTime uint32 ServerConfig *diameter.DiameterServerConfig GyInitMethod gy.InitMethod UseMockDriver bool RedirectAddress string FinalUnitAction protos.FinalUnitAction }
type OCSDiamServer ¶
type OCSDiamServer struct {
// contains filtered or unexported fields
}
OCSDiamServer wraps an OCS storing subscriber accounts and their credit
func NewOCSDiamServer ¶
func NewOCSDiamServer( diameterSettings *diameter.DiameterClientConfig, ocsConfig *OCSConfig, ) *OCSDiamServer
NewOCSDiamServer initializes an OCS with an empty account map Input: *sm.Settings containing the diameter related parameters
*TestOCSConfig containing the server address, and standard OCS settings like how many bytes to allocate to users
Output: a new OCSDiamServer
func (*OCSDiamServer) AbortSession ¶
func (srv *OCSDiamServer) AbortSession( _ context.Context, req *protos.AbortSessionRequest, ) (*protos.AbortSessionAnswer, error)
AbortSession call for a subscriber Initiate a Abort session request and provide the response
func (*OCSDiamServer) AssertExpectations ¶
func (srv *OCSDiamServer) AssertExpectations(_ context.Context, void *orcprotos.Void) (*protos.GyCreditControlResult, error)
func (*OCSDiamServer) ClearSubscribers ¶
func (srv *OCSDiamServer) ClearSubscribers(_ context.Context, void *orcprotos.Void) (*orcprotos.Void, error)
Reset eliminates all the accounts allocated for the system.
func (*OCSDiamServer) ConfigServer ¶
func (srv *OCSDiamServer) ConfigServer( _ context.Context, config *protos.ServerConfiguration, ) (*orcprotos.Void, error)
ConfigServer is an GRPC procedure which configure the server to respond to requests. It will be called from the gateway
func (*OCSDiamServer) CreateAccount ¶
func (srv *OCSDiamServer) CreateAccount( _ context.Context, subscriberID *lteprotos.SubscriberID, ) (*orcprotos.Void, error)
NewAccount adds a subscriber to the OCS to be tracked Input: string containing the subscriber IMSI (can be in any form)
func (*OCSDiamServer) GetCredits ¶
func (srv *OCSDiamServer) GetCredits( _ context.Context, subscriberID *lteprotos.SubscriberID, ) (*protos.CreditInfos, error)
GetCredits returns all the credits allocated for an account Input: string IMSI for the account Output: map[uint32]*CreditBucket a map of charging key to credit bucket
error if account could not be found
func (*OCSDiamServer) GetLastAVPreceived ¶
func (srv *OCSDiamServer) GetLastAVPreceived() (*diam.Message, error)
GetLastAVPreceived gets the last message in diam format received Message gets overwriten every time a new CCR is sent
func (*OCSDiamServer) ReAuth ¶
func (srv *OCSDiamServer) ReAuth( ctx context.Context, target *protos.ChargingReAuthTarget, ) (*protos.ChargingReAuthAnswer, error)
ReAuth initiates a reauth call for a subscriber and optional rating group. It waits for any answer from the OCS
func (*OCSDiamServer) Reset ¶
Reset is an GRPC procedure which resets the server to its default state. It will be called from the gateway.
func (*OCSDiamServer) SetCredit ¶
func (srv *OCSDiamServer) SetCredit( _ context.Context, creditInfo *protos.CreditInfo, ) (*orcprotos.Void, error)
SetCredit sets or overrides the prepaid credit allocated for an account Input: string IMSI for the account
uint32 charging key to add credit to uint64 volume (in any units) to set this bucket to UnitType dictating which unit the volume represents
Output: error if account could not be found
func (*OCSDiamServer) SetExpectations ¶
func (srv *OCSDiamServer) SetExpectations(_ context.Context, req *protos.GyCreditControlExpectations) (*orcprotos.Void, error)
func (*OCSDiamServer) SetOCSSettings ¶
func (srv *OCSDiamServer) SetOCSSettings( _ context.Context, ocsConfig *protos.OCSConfig, ) (*orcprotos.Void, error)
SetOCSSettings changes the standard OCS return values. All parameters are optional, and this only sets the non-nil ones. Input: *uint32 optional maximum bytes to return in a CCA
*uint32 optional maximum time to return in a CCA *uint32 optional credit validity time to return in a CCA
func (*OCSDiamServer) Start ¶
func (srv *OCSDiamServer) Start(lis net.Listener) error
Start begins the server and blocks, listening to the network Output: error if the server could not be started
func (*OCSDiamServer) StartListener ¶
func (srv *OCSDiamServer) StartListener() (net.Listener, error)
type SubscriberAccount ¶
type SubscriberAccount struct { ChargingCredit map[uint32]*CreditBucket // map of charging key to credit bucket CurrentState *SubscriberSessionState }