context

package
v0.0.0-...-ef34b52 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const TypeAmf int = 0
View Source
const TypeGnb int = 1
View Source
const TypeIdAMFConn int = 1
View Source
const TypeIdDeregist int = 2
View Source
const TypeIdGNBConn int = 2
View Source
const TypeIdNotThere int = 0
View Source
const TypeIdRegist int = 0
View Source
const TypeIdRegular int = 1

Variables

This section is empty.

Functions

func AddRouting_Element

func AddRouting_Element(origin int64, ueID int64, destination int64, destType int, ue_State int, startTime int64, endTime int64)

adds if needed a metricsUE to the MetricsGNB and a trace to the metricsUE

func ForwardToAmf

func ForwardToAmf(message *ngapType.NGAPPDU, ue *LB_UE, startTime int64)

Used to forward registered UE's messages to an AMF

func ForwardToGnb

func ForwardToGnb(message *ngapType.NGAPPDU, ue *LB_UE, startTime int64)

Used to forward registered UE's messages to an GNB

func GenSCTPAddr

func GenSCTPAddr(ip string, port int) (lbAddr *sctp.SCTPAddr, err error)

Use IP and port to generate *sctp.SCTPAddr

func Print

func Print(gnbs *sync.Map)

general print function -> splits into GNBs and prints them individually

func PrintPerGNB

func PrintPerGNB(gnb *MetricsGNB)

print for one GNB output depending on metricsLevel in the config file

func SendByteToConn

func SendByteToConn(conn *sctp.SCTPConn, message []byte)

Writing a slice of bytes to a sctp.SCTPConn

Types

type LB_AMF

type LB_AMF struct {
	AmfID int64 // INTERNAL ID for this AMF

	AmfTypeIdent int // Identifies the type of AMF

	LB_Conn *LB_Conn // Stores all the connection related information

	RelativeCapacity     int64 // AMFs Relative Cap. -> extracted out of NGSetup
	NumberOfConnectedUEs int64 // Amount of UEs that are connected to this AMF

	Ues sync.Map // "List" of all UE that are processed by this AMF

	/* logger */
	Log *logrus.Entry
}

Type, that stores all relevant information of connected AMFs

func CreateAndAddAmfToLB

func CreateAndAddAmfToLB(amfType int) *LB_AMF

Creates and adds an Amf to the LB_Context

func (*LB_AMF) ContainsUE

func (amf *LB_AMF) ContainsUE(id int64) (cont bool)

takes UeID and returns true if UE exists in the AMFs list

func (*LB_AMF) FindUeByAMF_UE_ID

func (amf *LB_AMF) FindUeByAMF_UE_ID(id int64) (*LB_UE, bool)

Use a UEAMF-ID to find UE context, return *LbUe and true if found TODO

func (*LB_AMF) FindUeByRAN_UE_ID

func (amf *LB_AMF) FindUeByRAN_UE_ID(id int64) (*LB_UE, bool)

Use a UELB-ID to find UE context, return *LbUe and true if found

func (*LB_AMF) RemoveAmfContext

func (amf *LB_AMF) RemoveAmfContext()

Removes AMF-Context and closes the Connection

type LB_Conn

type LB_Conn struct {
	ID     int64 // internal AMF/GNB ID that is connected with Conn
	TypeID int   // type identifier of the connected AMF/GNB

	Conn   *sctp.SCTPConn // actual connection to AMF/GNB
	Closed bool           // determines whether the connection is closed

	GnbPointer *LB_GNB
	AmfPointer *LB_AMF
	/* logger */
	Log *logrus.Entry
}

universal type for all connections of the LB

type LB_Context

type LB_Context struct {
	Name string
	NfId string

	LbIP string // IPv4 adress of the LB

	LbToAmfPort int            // inital prot to connect to the first AMF
	LbToAmfAddr *sctp.SCTPAddr // SCTP adress generated for AMFs

	LbListenPort int            // port to listen for GNBs
	LbListenAddr *sctp.SCTPAddr // SCTP adress generated for GNBs

	Running bool // true while the LB is not beeing terminated

	NewAmf               bool     // indicates that a new AMF IP+Port have been added so that the LB can connect to it
	NewRegistAmfIpList   []string // Registration AMFs that have to be registred
	NewRegularAmfIpList  []string // Regular AMFs that have to be registred
	NewDeregistAmfIpList []string // Deregistration AMFs that have to be registred

	DifferentAmfTypes        int  // amount of different AMF types used
	ContinuesAmfRegistration bool // true for continues accepting AMFs for registration

	LB_GNBPool      sync.Map // GNBs connected to the LB
	RegistAMFPool   sync.Map // AMFs connected to LB
	RegularAMFPool  sync.Map // AMFs connected to LB
	DeregistAMFPool sync.Map // AMFs connected to LB

	Next_Regist_Amf   *LB_AMF // AMF that is used for the next UE entering registration
	Next_Regular_Amf  *LB_AMF // if 3 AMF types: AMF that is used for the next UE finishing registration
	Next_Deregist_Amf *LB_AMF // if > 2 AMF types: AMF that is used for the next UE starting deregistration

	IDGen *UniqueNumberGen

	RelativeCapacity int64 // To build setup response

	/* temp */
	PlmnSupportList []factory.PlmnSupportItem
	ServedGuamiList []models.Guami

	/* logger */
	Log *logrus.Entry

	/* metrics */
	MetricsLevel int
	MetricsGNBs  sync.Map
}

The LB's main context

func LB_Self

func LB_Self() *LB_Context

returns the current instance of the LB_Context

func NewLBContext

func NewLBContext() *LB_Context

Creates and returns a new *LBContext

func (*LB_Context) SelectNextDeregistAmf

func (context *LB_Context) SelectNextDeregistAmf() bool

TODO:

func (*LB_Context) SelectNextRegistAmf

func (context *LB_Context) SelectNextRegistAmf() bool

TODO:

func (*LB_Context) SelectNextRegularAmf

func (context *LB_Context) SelectNextRegularAmf() bool

TODO:

type LB_GNB

type LB_GNB struct {
	GnbID int64 // INTERNAL ID for this GNB

	LB_Conn *LB_Conn // stores all the connection related information
	Ues     sync.Map // "list" of all UE that are processed by this GNB

	/* logger */
	Log *logrus.Entry
}

Type, that stores all relevant information of connected GNBs

func CreateAndAddNewGnbToLB

func CreateAndAddNewGnbToLB(conn *sctp.SCTPConn) *LB_GNB

use sctp.SCTPConn to find RAN context, return *AmfRan and true if found

func (*LB_GNB) ContainsUE

func (gnb *LB_GNB) ContainsUE(id int64) (cont bool)

takes UeID and returns true if UE exists in the GNBs list

func (*LB_GNB) FindUeByRAN_UE_ID

func (gnb *LB_GNB) FindUeByRAN_UE_ID(id int64) (*LB_UE, bool)

Use a UE-ID to find UE context, return *LbUe and true if found

func (*LB_GNB) RemoveGnbContext

func (gnb *LB_GNB) RemoveGnbContext()

Removes GNB-Context and closes the Connection

type LB_UE

type LB_UE struct {
	UeStateIdent int // Identifies the state of the UE

	GNB_UE_ID int64 // ID given to the UE by GNB/RAN
	LB_UE_ID  int64 // ID given to the UE by LB
	AMF_UE_ID int64 // ID given to the UE by AMF

	GnbID      int64   // LB-internal ID of GNB that issued the UE
	GnbPointer *LB_GNB // ponter to the connected GNB

	AmfID      int64   // LB-internal ID of AMF that processes the UE
	AmfPointer *LB_AMF // ponter to the connected AMF

	UplinkFlag   bool // set true when Uplink-NAS-RegistrationComplete is done
	ResponseFlag bool // set true when InitialContextSetupResponse is done
	DeregFlag    bool // set true when Uplink-NAS-Deregistration-Accept is done

	/* nas decrypt */    // TODO
	RRCECause            string
	ULCount              security.Count //TODO amf_ue L728 | gmm HandleRegist HandleServiceRequest (only get())
	DLCount              security.Count // TODO set in CopyDataFromUeContextModel | .AddOne() in nas Encode()
	Kamf                 string
	Kgnb                 []uint8 // 32 byte
	Kn3iwf               []uint8 // 32 byte
	CipheringAlg         uint8
	IntegrityAlg         uint8
	KnasInt              [16]uint8 // 16 byte
	KnasEnc              [16]uint8 // 16 byte
	Supi                 string
	ABBA                 []uint8
	Kseaf                string
	UESecurityCapability nasType.UESecurityCapability // for security command
	// TODO set in NGAP HandlePathSwitchRequest
	MacFailed bool // set to true if the integrity check of current NAS message is failed

	/* logger */
	Log *logrus.Entry
}

Type, that stores all relevant information of UEs

func NewUE

func NewUE() *LB_UE

Creates, initializes and returns a new *LbUe

func (*LB_UE) AddUeToAmf

func (ue *LB_UE) AddUeToAmf(next *LB_AMF)

Sets UEs values and adds it to the Amfs UE-Map

func (*LB_UE) CopyDataFromUeContextModel

func (ue *LB_UE) CopyDataFromUeContextModel(ueContext models.UeContext)

TODO

func (*LB_UE) DerivateAlgKey

func (ue *LB_UE) DerivateAlgKey()

TODO Algorithm key Derivation function defined in TS 33.501 Annex A.9

func (*LB_UE) DerivateAnKey

func (ue *LB_UE) DerivateAnKey(anType models.AccessType)

TODO Access Network key Derivation function defined in TS 33.501 Annex A.9

func (*LB_UE) DerivateKamf

func (ue *LB_UE) DerivateKamf()

TODO Kamf Derivation function defined in TS 33.501 Annex A.7 gmm handler HandleAuthenticationResponse L1943 + 1978

func (*LB_UE) RegistrationComplete

func (ue *LB_UE) RegistrationComplete()

func (*LB_UE) RemoveUeEntirely

func (ue *LB_UE) RemoveUeEntirely()

Removes LbUe from AMF and RAN Context withing LB

func (*LB_UE) RemoveUeFromAMF

func (ue *LB_UE) RemoveUeFromAMF()

Removes LbUe from AMF Context withing LB

func (*LB_UE) RemoveUeFromGNB

func (ue *LB_UE) RemoveUeFromGNB()

Removes LbUe from RAN Context withing LB

func (*LB_UE) SelectSecurityAlg

func (ue *LB_UE) SelectSecurityAlg(intOrder, encOrder []uint8)

TODO

type MetricsGNB

type MetricsGNB struct {
	ID         int64
	MetricsUEs *sync.Map
}

one for each registred GNB

func NewMetricsGNB

func NewMetricsGNB(id int64) *MetricsGNB

returns a MetricsGNB initialized

type UniqueNumberGen

type UniqueNumberGen struct {
	ListEmpty bool
	Recycled  *list.List
	RegularID int64
}

Generator for UE-IDs

func NewUniqueNumberGen

func NewUniqueNumberGen(StartNumber int64) *UniqueNumberGen

Creates, initializes and returns a new *UeIdGen

func (*UniqueNumberGen) NextNumber

func (gen *UniqueNumberGen) NextNumber() int64

Selects the next available LB-internal ID for a UE

func (*UniqueNumberGen) RecycleNumber

func (gen *UniqueNumberGen) RecycleNumber(id int64)

not used at the moment Takes unused IDs and makes them available for reuse

Jump to

Keyboard shortcuts

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