Documentation ¶
Index ¶
- Constants
- Variables
- type CmdOutput
- type RecordByIMSI
- type RuleManager
- func (manager *RuleManager) AddBaseNameMappingToDB(basename string, ruleNames []string) error
- func (manager *RuleManager) AddDynamicPassAllToPCRF(imsi, ruleID, monitoringKey string) error
- func (manager *RuleManager) AddOmniPresentRulesToDB(keyId string, ruleNames, baseNames []string) error
- func (manager *RuleManager) AddRulesToPCRF(imsi string, ruleNames, baseNames []string) error
- func (manager *RuleManager) AddStaticPassAllToDB(ruleID string, monitoringKey string, ratingGroup uint32, trackingType string, ...) error
- func (manager *RuleManager) AddStaticPassAllToDBAndPCRFforIMSIs(IMSIs []string, ruleID string, monitoringKey string, ratingGroup uint32, ...) error
- func (manager *RuleManager) AddStaticRuleToDB(rule *lteProtos.PolicyRule) error
- func (manager *RuleManager) AddUsageMonitor(imsi, monitoringKey string, volume, bytesPerGrant uint64) error
- func (manager *RuleManager) GetInstalledRulesByIMSI() map[string][]string
- func (manager *RuleManager) RemoveInstalledRules() error
- func (manager *RuleManager) RemoveOmniPresentRulesFromDB(keyId string) error
- type TestRunner
- func (tr *TestRunner) AssertAllGxExpectationsMetNoError()
- func (tr *TestRunner) AssertAllGyExpectationsMetNoError()
- func (tr *TestRunner) AssertPolicyEnforcementRecordIsNil(imsi string)
- func (tr *TestRunner) Authenticate(imsi, calledStationID string) (*radius.Packet, error)
- func (tr *TestRunner) AuthenticateAndAssertFail(imsi string)
- func (tr *TestRunner) AuthenticateAndAssertSuccess(imsi string)
- func (tr *TestRunner) AuthenticateAndAssertSuccessWithRetries(imsi string, maxRetries int)
- func (tr *TestRunner) AuthenticateWithCalledIDAndAssertSuccess(imsi, calledStationID string)
- func (tr *TestRunner) CleanUp() error
- func (tr *TestRunner) ConfigUEs(numUEs int) ([]*cwfprotos.UEConfig, error)
- func (tr *TestRunner) ConfigUEsPerInstance(IMSIs []string, pcrfInstance, ocsInstance string) ([]*cwfprotos.UEConfig, error)
- func (tr *TestRunner) Disconnect(imsi, calledStationID string) (*radius.Packet, error)
- func (tr *TestRunner) DisconnectAndAssertSuccess(imsi string)
- func (tr *TestRunner) GenULTraffic(req *cwfprotos.GenTrafficRequest) (*cwfprotos.GenTrafficResponse, error)
- func (tr *TestRunner) GetPolicyUsage() (RecordByIMSI, error)
- func (tr *TestRunner) OverwriteMConfig(mconfigPath string, serviceName string) error
- func (tr *TestRunner) PauseService(serviceName string) error
- func (tr *TestRunner) RestartService(serviceName string) error
- func (tr *TestRunner) RunCommandInContainer(serviceName string, cmdList [][]string) ([]*CmdOutput, error)
- func (tr *TestRunner) ScanContainerLogs(serviceName string, line string) int
- func (tr *TestRunner) WaitForEnforcementStatsToSync()
- func (tr *TestRunner) WaitForPoliciesToSync()
- func (tr *TestRunner) WaitForReAuthToProcess()
Constants ¶
const ( Op = "\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11" Secret = "123456" MockHSSRemote = "HSS_REMOTE" MockPCRFRemote = "PCRF_REMOTE" MockOCSRemote = "OCS_REMOTE" MockPCRFRemote2 = "PCRF_REMOTE2" MockOCSRemote2 = "OCS_REMOTE2" PipelinedRemote = "pipelined.local" DirectorydRemote = "DIRECTORYD" RedisRemote = "REDIS" CwagIP = "192.168.70.101" TrafficCltIP = "192.168.128.2" IPDRControllerIP = "192.168.40.11" OCSPort = 9201 PCRFPort = 9202 OCSPort2 = 9205 PCRFPort2 = 9206 HSSPort = 9204 PipelinedPort = 8443 RedisPort = 6380 DirectorydPort = 8443 KiloBytes = 1024 MegaBytes = 1024 * KiloBytes Buffer = 100 * KiloBytes RevalidationTimeoutEvent = 17 ReAuthMaxUsageBytes = 5 * MegaBytes ReAuthMaxUsageTimeSec = 1000 // in second ReAuthValidityTime = 60 // in second GyMaxUsageBytes = 5 * MegaBytes GyMaxUsageTime = 1000 // in second GyValidityTime = 60 // in second )
todo make Op configurable, or export it in the UESimServer.
Variables ¶
var ( // PCRFinstances List of all possible PCRFs on the system (currently 2 are supported) PCRFinstances = []string{MockPCRFRemote, MockPCRFRemote2} // OCSinstances List of all possible OCSs on the system (currently 2 are supported) OCSinstances = []string{MockOCSRemote, MockOCSRemote2} )
Functions ¶
This section is empty.
Types ¶
type CmdOutput ¶
type CmdOutput struct {
// contains filtered or unexported fields
}
CmdOutput struct representing output of docker container command
type RecordByIMSI ¶
type RecordByIMSI map[string]map[string]*lteprotos.RuleRecord
imsi -> ruleID -> record
type RuleManager ¶
type RuleManager struct {
// contains filtered or unexported fields
}
RuleManager keeps track of rules and monitors for the integration test. It keeps track of all successfully installed static/dynamic rules along with usage monitors. The dynamic rules and usage monitors are added into the mock PCRF service. The static rules are usually streamed down into gateway policyDB from the cloud. Since this integration test does not cover the cloud component, we will directly insert the static policies into the redis database by using policyDBWrapper.
func NewRuleManager ¶
func NewRuleManager() (*RuleManager, error)
NewRuleManager initialized the struct
func NewRuleManagerPerInstance ¶
func NewRuleManagerPerInstance(pcrfInstance string) (*RuleManager, error)
NewRuleManagerPerInstance initialized the struct per PCRFinstance
func (*RuleManager) AddBaseNameMappingToDB ¶
func (manager *RuleManager) AddBaseNameMappingToDB(basename string, ruleNames []string) error
func (*RuleManager) AddDynamicPassAllToPCRF ¶
func (manager *RuleManager) AddDynamicPassAllToPCRF(imsi, ruleID, monitoringKey string) error
AddDynamicPassAllToPCRF adds a dynamic rule that passes all traffic into PCRF
func (*RuleManager) AddOmniPresentRulesToDB ¶
func (manager *RuleManager) AddOmniPresentRulesToDB(keyId string, ruleNames, baseNames []string) error
AddOmniPresentRulesToDB adds the network wide static rule to policyDB storage
func (*RuleManager) AddRulesToPCRF ¶
func (manager *RuleManager) AddRulesToPCRF(imsi string, ruleNames, baseNames []string) error
AddRulesToPCRF adds the dynamic rule into PCRF
func (*RuleManager) AddStaticPassAllToDB ¶
func (manager *RuleManager) AddStaticPassAllToDB(ruleID string, monitoringKey string, ratingGroup uint32, trackingType string, priority uint32) error
AddStaticPassAllToDB adds a static rule that passes all traffic to policyDB storage
func (*RuleManager) AddStaticPassAllToDBAndPCRFforIMSIs ¶
func (manager *RuleManager) AddStaticPassAllToDBAndPCRFforIMSIs(IMSIs []string, ruleID string, monitoringKey string, ratingGroup uint32, trackingType string, priority uint32) error
AddStaticPassAllToDBAndPCRF adds a static rule that passes all traffic to policyDB storage and to the PCRF instance
func (*RuleManager) AddStaticRuleToDB ¶
func (manager *RuleManager) AddStaticRuleToDB(rule *lteProtos.PolicyRule) error
AddStaticRuleToDB adds the static rule to policyDB storage
func (*RuleManager) AddUsageMonitor ¶
func (manager *RuleManager) AddUsageMonitor(imsi, monitoringKey string, volume, bytesPerGrant uint64) error
AddUsageMonitor constructs a usage monitor according to the parameters and inserts it into PCRF
func (*RuleManager) GetInstalledRulesByIMSI ¶
func (manager *RuleManager) GetInstalledRulesByIMSI() map[string][]string
GetInstalledRulesByIMSI returns all dynamic rule ids and static rules referenced by dynamic rules keyed by the IMSI they are attached to.
func (*RuleManager) RemoveInstalledRules ¶
func (manager *RuleManager) RemoveInstalledRules() error
RemoveInstalledRules removes previously installed rules from PCRF and policyDB
func (*RuleManager) RemoveOmniPresentRulesFromDB ¶
func (manager *RuleManager) RemoveOmniPresentRulesFromDB(keyId string) error
RemoveOmniPresentRulesFromDB adds the network wide static rule to policyDB storage
type TestRunner ¶
type TestRunner struct {
// contains filtered or unexported fields
}
TestRunner helps setting up all associated services
func NewTestRunner ¶
func NewTestRunner(t *testing.T) *TestRunner
NewTestRunner initializes a new TestRunner by making a UESim client and and setting the next IMSI.
func NewTestRunnerWithTwoPCRFandOCS ¶
func NewTestRunnerWithTwoPCRFandOCS(t *testing.T) *TestRunner
NewTestRunnerWithTwoPCRFandOCS does the same as NewTestRunner but it inclides 2 PCRF and 2 OCS Used in scenarios that run 2 PCRFs and 2 OCSs
func (*TestRunner) AssertAllGxExpectationsMetNoError ¶
func (tr *TestRunner) AssertAllGxExpectationsMetNoError()
Query assertion result from MockPCRF and assert all expectations were met. Only applicable when MockDriver is used.
func (*TestRunner) AssertAllGyExpectationsMetNoError ¶
func (tr *TestRunner) AssertAllGyExpectationsMetNoError()
Query assertion result from MockOCS and assert all expectations were met. Only applicable when MockDriver is used.
func (*TestRunner) AssertPolicyEnforcementRecordIsNil ¶
func (tr *TestRunner) AssertPolicyEnforcementRecordIsNil(imsi string)
Query policy usage records from pipelined, and assert that there is no entry for the IMSI. This means no policy flows are installed for the IMSI.
func (*TestRunner) Authenticate ¶
func (tr *TestRunner) Authenticate(imsi, calledStationID string) (*radius.Packet, error)
Authenticate simulates an authentication between the UE and the HSS with the specified IMSI and CalledStationID, and returns the resulting Radius packet.
func (*TestRunner) AuthenticateAndAssertFail ¶
func (tr *TestRunner) AuthenticateAndAssertFail(imsi string)
Trigger a UE Authentication with the IMSI. Assert that the authentication failed.
func (*TestRunner) AuthenticateAndAssertSuccess ¶
func (tr *TestRunner) AuthenticateAndAssertSuccess(imsi string)
Trigger a UE Authentication with the IMSI. Assert that the authentication succeeded.
func (*TestRunner) AuthenticateAndAssertSuccessWithRetries ¶
func (tr *TestRunner) AuthenticateAndAssertSuccessWithRetries(imsi string, maxRetries int)
AuthenticateAndAssertSuccessWithRetries triggers a UE Authentication with the IMSI. Assert that the authentication succeeded with retrials. Use this function only for those tests that deal with service restart Otherwise, use the client without retries. Retries shuldn't happen on a healthy system
func (*TestRunner) AuthenticateWithCalledIDAndAssertSuccess ¶
func (tr *TestRunner) AuthenticateWithCalledIDAndAssertSuccess(imsi, calledStationID string)
Trigger a UE Authentication with the IMSI and called station ID. Assert that the authentication succeeded.
func (*TestRunner) CleanUp ¶
func (tr *TestRunner) CleanUp() error
Remove subscribers, rules, flows, and monitors to clean up the state for consecutive test runs
func (*TestRunner) ConfigUEs ¶
func (tr *TestRunner) ConfigUEs(numUEs int) ([]*cwfprotos.UEConfig, error)
ConfigUEs creates and adds the specified number of UEs and Subscribers to the UE Simulator and the HSS.
func (*TestRunner) ConfigUEsPerInstance ¶
func (tr *TestRunner) ConfigUEsPerInstance(IMSIs []string, pcrfInstance, ocsInstance string) ([]*cwfprotos.UEConfig, error)
ConfigUEsPerInstance same as ConfigUEs but per specific PCRF and OCS instance
func (*TestRunner) Disconnect ¶
func (tr *TestRunner) Disconnect(imsi, calledStationID string) (*radius.Packet, error)
Authenticate simulates an authentication between the UE and the HSS with the specified IMSI and CalledStationID, and returns the resulting Radius packet.
func (*TestRunner) DisconnectAndAssertSuccess ¶
func (tr *TestRunner) DisconnectAndAssertSuccess(imsi string)
Trigger a UE Disconnect and assert it succeeds.
func (*TestRunner) GenULTraffic ¶
func (tr *TestRunner) GenULTraffic(req *cwfprotos.GenTrafficRequest) (*cwfprotos.GenTrafficResponse, error)
GenULTraffic simulates the UE sending traffic through the CWAG to the Internet by running an iperf3 client on the UE simulator and an iperf3 server on the Magma traffic server.
func (*TestRunner) GetPolicyUsage ¶
func (tr *TestRunner) GetPolicyUsage() (RecordByIMSI, error)
GetPolicyUsage is a wrapper around pipelined's GetPolicyUsage and returns the policy usage keyed by subscriber ID
func (*TestRunner) OverwriteMConfig ¶
func (tr *TestRunner) OverwriteMConfig(mconfigPath string, serviceName string) error
OverwriteMConfig adds ability to overwrite the mconfig file with a specified file
func (*TestRunner) PauseService ¶
func (tr *TestRunner) PauseService(serviceName string) error
StopService adds ability to stop a particular service managed by docker
func (*TestRunner) RestartService ¶
func (tr *TestRunner) RestartService(serviceName string) error
RestartService adds ability to restart a particular service managed by docker
func (*TestRunner) RunCommandInContainer ¶
func (tr *TestRunner) RunCommandInContainer(serviceName string, cmdList [][]string) ([]*CmdOutput, error)
RunCommandInContainer adds ability to run a specific command within a container
func (*TestRunner) ScanContainerLogs ¶
func (tr *TestRunner) ScanContainerLogs(serviceName string, line string) int
ScanContainerLogs provides ability to scan the container logs for a string
func (*TestRunner) WaitForEnforcementStatsToSync ¶
func (tr *TestRunner) WaitForEnforcementStatsToSync()
func (*TestRunner) WaitForPoliciesToSync ¶
func (tr *TestRunner) WaitForPoliciesToSync()
func (*TestRunner) WaitForReAuthToProcess ¶
func (tr *TestRunner) WaitForReAuthToProcess()