mock_pcrf

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2020 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAVP

func GetAVP(message *ccrMessage, AVPToFind string) (interface{}, error)

TODO: Remove this when not needed anymore (use findAVP from diam library) Searches on ccr message for an specific AVP message based on the avp tag on ccr type (ie "Session-Id") It returns on the first match it finds.

Types

type GxAnswer

type GxAnswer struct {
	*protos.GxCreditControlAnswer
}

type GxExpectation

type GxExpectation struct {
	*protos.GxCreditControlExpectation
}

Here we wrap the protobuf definitions to easily define instance methods

func (GxExpectation) DoesMatch

func (e GxExpectation) DoesMatch(message interface{}) error

func (GxExpectation) GetAnswer

func (e GxExpectation) GetAnswer() interface{}

type PCRFServer

type PCRFServer struct {
	// contains filtered or unexported fields
}

PCRFServer wraps an PCRF storing subscribers and their rules

func NewPCRFServer

func NewPCRFServer(clientConfig *diameter.DiameterClientConfig, serverConfig *diameter.DiameterServerConfig) *PCRFServer

NewPCRFServer initializes an PCRF with an empty rule map Input: *sm.Settings containing the diameter related parameters

*TestPCRFConfig containing the server address

Output: a new PCRFServer

func (*PCRFServer) AbortSession

AbortSession call for a subscriber Initiate a Abort session request and provide the response

func (*PCRFServer) AssertExpectations

func (srv *PCRFServer) AssertExpectations(_ context.Context, void *orcprotos.Void) (*protos.GxCreditControlResult, error)

func (*PCRFServer) ClearSubscribers

func (srv *PCRFServer) ClearSubscribers(_ context.Context, void *orcprotos.Void) (*orcprotos.Void, error)

Reset eliminates all the subscribers allocated for the system.

func (*PCRFServer) ConfigServer

func (srv *PCRFServer) ConfigServer(
	_ context.Context,
	_ *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 (*PCRFServer) CreateAccount

func (srv *PCRFServer) CreateAccount(
	_ context.Context,
	subscriberID *lteprotos.SubscriberID,
) (*orcprotos.Void, error)

NewSubscriber adds a subscriber to the PCRF to be tracked Input: string containing the subscriber IMSI (can be in any form)

func (*PCRFServer) GetLastAVPreceived

func (srv *PCRFServer) GetLastAVPreceived() (*diam.Message, error)

GetLastAVPreceived gets the last message in diam format received Message gets overwriten every time a new CCR is sent

func (*PCRFServer) GetRuleBaseNames

func (srv *PCRFServer) GetRuleBaseNames(imsi string) ([]string, error)

GetRuleBaseNames returns all the rule base names set for a subscriber Input: string IMSI for the subscriber Output: []string containing all applicable rule base names

error if subscriber could not be found

func (*PCRFServer) GetRuleDefinitions

func (srv *PCRFServer) GetRuleDefinitions(
	imsi string,
) ([]*protos.RuleDefinition, error)

GetRuleDefinitions returns all the dynamic rule definitions set for a subscriber Input: string IMSI for the subscriber Output: []*RuleDefinition containing all applicable rules

error if subscriber could not be found

func (*PCRFServer) GetRuleNames

func (srv *PCRFServer) GetRuleNames(imsi string) ([]string, error)

GetRuleNames returns all the rules set for a subscriber Input: string IMSI for the subscriber Output: []string containing all applicable rules

error if subscriber could not be found

func (*PCRFServer) ReAuth

ReAuth call for a subscriber Initiate a RAR requenst and handle a response

func (*PCRFServer) Reset

func (srv *PCRFServer) Reset(
	_ context.Context,
	_ *orcprotos.Void,
) (*orcprotos.Void, error)

Reset is an GRPC procedure which configure the server to the default status. It will be called from the gateway.

func (*PCRFServer) SetExpectations

func (srv *PCRFServer) SetExpectations(_ context.Context, req *protos.GxCreditControlExpectations) (*orcprotos.Void, error)

func (*PCRFServer) SetPCRFConfigs

func (srv *PCRFServer) SetPCRFConfigs(
	_ context.Context,
	configs *protos.PCRFConfigs,
) (*orcprotos.Void, error)

func (*PCRFServer) SetRules

func (srv *PCRFServer) SetRules(
	_ context.Context,
	accountRules *protos.AccountRules,
) (*orcprotos.Void, error)

SetRules sets or overrides the rules applicable to the subscriber Input: imsi string IMSI for the subscriber

ruleNames []string containing all rule names to apply
ruleBaseNames []string containing all rule base names to apply
ruleDefinitions []*RuleDefinition containing all dynamic rules to apply

Output: error if subscriber could not be found

func (*PCRFServer) SetUsageMonitors

func (srv *PCRFServer) SetUsageMonitors(
	_ context.Context,
	usageMonitorInfo *protos.UsageMonitorConfiguration,
) (*orcprotos.Void, error)

func (*PCRFServer) Start

func (srv *PCRFServer) 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 (*PCRFServer) StartListener

func (srv *PCRFServer) StartListener() (net.Listener, error)

StartListener starts a listener based on ServerConfig If ServerConfig did not have valid values, default values would be used

type ReAuthAnswer

type ReAuthAnswer struct {
	SessionID  string `avp:"Session-Id"`
	ResultCode uint32 `avp:"Result-Code"`
}

This is a temporary struct to handle unsupported AVP Charging-Rule-Report in go-diameter

type SubscriberSessionState

type SubscriberSessionState struct {
	SessionID  string
	Connection diam.Conn
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL