model

package module
v0.0.0-...-8f6edbe Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 15 Imported by: 4

Documentation

Index

Constants

View Source
const (
	NodeTypeScenario     string = "SCENARIO"
	NodeTypeDeployment   string = "DEPLOYMENT"
	NodeTypeOperator     string = "OPERATOR"
	NodeTypeOperatorCell string = "OPERATOR-CELLULAR"
	NodeTypeZone         string = "ZONE"
	NodeTypePoa          string = "POA"
	NodeTypePoa4G        string = "POA-4G"
	NodeTypePoa5G        string = "POA-5G"
	NodeTypePoaWifi      string = "POA-WIFI"
	NodeTypeUE           string = "UE"
	NodeTypeFog          string = "FOG"
	NodeTypeEdge         string = "EDGE"
	NodeTypeCloud        string = "DC"
	NodeTypeUEApp        string = "UE-APP"
	NodeTypeEdgeApp      string = "EDGE-APP"
	NodeTypeCloudApp     string = "CLOUD-APP"
)
View Source
const (
	ScenarioAdd    string = "ADD"
	ScenarioRemove string = "REMOVE"
	ScenarioModify string = "MODIFY"
)
View Source
const (
	EventMobility       string = "EVENT-MOBILITY"
	EventNetChar        string = "EVENT-NET-CHAR"
	EventPoaInRange     string = "EVENT-POA-IN-RANGE"
	EventScenarioUpdate string = "EVENT-SCENARIO-UPDATE"
	EventAddNode        string = "EVENT-ADD-NODE"
	EventModifyNode     string = "EVENT-MODIFY-NODE"
	EventRemoveNode     string = "EVENT-REMOVE-NODE"
)
View Source
const (
	ConnectivityModelOpen string = "OPEN"
	ConnectivityModelPdu  string = "PDU"
)
View Source
const (
	ValidatorStatusValid   = "SCENARIO-VALID"
	ValidatorStatusUpdated = "SCENARIO-UPDATED"
	ValidatorStatusError   = "SCENARIO-ERROR"
)

Validator status types

View Source
const (
	REGEX_NAME               = `^(([a-z0-9][-a-z0-9.]*)?[a-z0-9])+$`
	REGEX_VARIABLE_NAME      = `^(([_a-z0-9A-Z][_-a-z0-9A-Z.]*)?[_a-z0-9A-Z])+$`
	REGEX_MAC_ADDRESS        = `^(([_a-f0-9A-F][_-a-f0-9A-Z]*)?[_a-f0-9A-F])+$`
	REGEX_WIRELESS_TYPE_LIST = `^((,\s*)?(d2d|wifi|5g|4g|other))+$`
	REGEX_PATH               = `[\^#%&$\*<>\?\{\|\} ]+`
	REGEX_DNN                = `^(([a-z0-9A-Z][-a-z0-9A-Z.]*)?[a-z0-9A-Z])+$`
	REGEX_ECSP               = `^(([a-z0-9A-Z][ a-z0-9A-Z]*)?[a-z0-9A-Z])+$`
)
View Source
const (
	LATENCY_MIN                  = 0
	LATENCY_MAX                  = 250000
	LATENCY_DISTRIBUTION_DEFAULT = "Normal"
	JITTER_MIN                   = 0
	JITTER_MAX                   = 250000
	PACKET_LOSS_MIN              = float64(0.0)
	PACKET_LOSS_MAX              = float64(100.0)
	THROUGHPUT_MIN               = 1
	THROUGHPUT_MAX               = 1000000
	THROUGHPUT_DEFAULT           = 1000
	VELOCITY_MIN                 = 0
	VELOCITY_MAX                 = 1000000
	RADIUS_MIN                   = 1
	RADIUS_MAX                   = 1000000
	D2D_RADIUS_MIN               = 1
	D2D_RADIUS_MAX               = 10000
	SERVICE_PORT_MIN             = 1
	SERVICE_PORT_MAX             = 65535
	SERVICE_NODE_PORT_MIN        = 30000
	SERVICE_NODE_PORT_MAX        = 32767
	GPU_COUNT_MIN                = 1
	GPU_COUNT_MAX                = 4
	MIN_CPU_COUNT_MIN            = 0.1
	MIN_CPU_COUNT_MAX            = 100.0
	MAX_CPU_COUNT_MIN            = 0.1
	MAX_CPU_COUNT_MAX            = 100.0
	MIN_MEMORY_MIN               = 1
	MIN_MEMORY_MAX               = 1000000
	MAX_MEMORY_MIN               = 1
	MAX_MEMORY_MAX               = 1000000
)
View Source
const Deployment = "Deployment"
View Source
const Disconnected = "DISCONNECTED"
View Source
const Domain = "Domain"
View Source
const NetLoc = "NetLoc"
View Source
const PhyLoc = "PhyLoc"
View Source
const Proc = "Proc"
View Source
const Zone = "Zone"

Variables

View Source
var CONNECTIVITY_MODEL_ENUM = []string{"OPEN", "PDU"}
View Source
var DbAddress string = "meep-redis-master.default.svc.cluster.local:6379"
View Source
var EOP_MODE_ENUM = []string{"LOOP", "REVERSE"}
View Source
var GPU_TYPE_ENUM = []string{"NVIDIA"}
View Source
var LATENCY_DIST_ENUM = []string{"Normal", "Pareto", "Paretonormal", "Uniform"}

Enums

View Source
var PROTOCOL_ENUM = []string{"UDP", "TCP"}
View Source
var ValidatorVersion = semver.Version{Major: 1, Minor: 9, Patch: 2}

Current validator version

View Source
var Version130 = semver.Version{Major: 1, Minor: 3, Patch: 0}

Versions requiring scenario update

View Source
var Version140 = semver.Version{Major: 1, Minor: 4, Patch: 0}
View Source
var Version150 = semver.Version{Major: 1, Minor: 5, Patch: 0}
View Source
var Version151 = semver.Version{Major: 1, Minor: 5, Patch: 1}
View Source
var Version153 = semver.Version{Major: 1, Minor: 5, Patch: 3}
View Source
var Version168 = semver.Version{Major: 1, Minor: 6, Patch: 8}
View Source
var Version182 = semver.Version{Major: 1, Minor: 8, Patch: 2}

Functions

func IsDefaultNetLoc

func IsDefaultNetLoc(typ string) bool

func IsDefaultZone

func IsDefaultZone(typ string) bool

func IsDeployment

func IsDeployment(typ string) bool

func IsDomain

func IsDomain(typ string) bool

func IsNetLoc

func IsNetLoc(typ string) bool

func IsPhyLoc

func IsPhyLoc(typ string) bool

func IsProc

func IsProc(typ string) bool

func IsScenario

func IsScenario(typ string) bool

func IsUe

func IsUe(typ string) bool

func IsZone

func IsZone(typ string) bool

func JSONMarshallReplay

func JSONMarshallReplay(replay []byte) (rStr string, err error)

JSONMarshallReplay - Convert Replay to JSON string

func JSONMarshallReplayFileList

func JSONMarshallReplayFileList(replayFileNameList []string) (rlStr string, err error)

JSONMarshallReplayFileList - Convert ReplayFileList to JSON string

func JSONMarshallScenario

func JSONMarshallScenario(scenario []byte) (sStr string, err error)

JSONMarshallScenario - Convert ScenarioList to JSON string

func JSONMarshallScenarioList

func JSONMarshallScenarioList(scenarioList [][]byte) (slStr string, err error)

JSONMarshallScenarioList - Convert ScenarioList to JSON string

func ValidateScenario

func ValidateScenario(jsonScenario []byte, name string) (validJsonScenario []byte, status string, err error)

ValidateScenario - Verify if json scenario is valid & supported. Upgrade scenario if possible & necessary.

Types

type Model

type Model struct {
	Active bool
	// contains filtered or unexported fields
}

Model - Implements a Meep Model

func NewModel

func NewModel(cfg ModelCfg) (m *Model, err error)

NewModel - Create a model object

func (*Model) Activate

func (m *Model) Activate() (err error)

Activate - Make scenario the active scenario

func (*Model) AddScenarioNode

func (m *Model) AddScenarioNode(node *dataModel.ScenarioNode, userData interface{}) (err error)

AddScenarioNode - Add scenario node

func (*Model) Deactivate

func (m *Model) Deactivate() (err error)

Deactivate - Remove the active scenario

func (*Model) GetDeployment

func (m *Model) GetDeployment(filter *NodeFilter) *dataModel.Deployment

GetDeployment - Get deployment matching filter criteria

func (*Model) GetDomains

func (m *Model) GetDomains(filter *NodeFilter) dataModel.Domains

GetDomains - Get domains matching filter criteria

func (*Model) GetEdges

func (m *Model) GetEdges() (edgeMap map[string]string)

GetEdges - Get a map of node edges for the current scenario

func (*Model) GetNetworkGraph

func (m *Model) GetNetworkGraph() *dijkstra.Graph

GetNetworkGraph - Get the network graph

func (*Model) GetNetworkLocations

func (m *Model) GetNetworkLocations(filter *NodeFilter) dataModel.NetworkLocations

GetNetworkLocations - Get network locations matching filter criteria

func (*Model) GetNode

func (m *Model) GetNode(name string) (node interface{})

GetNode - Get a node by its name

		Returned value is of type interface{}
   Good practice: returned node should be type asserted with val,ok := node.(someType) to prevent panic

func (*Model) GetNodeById

func (m *Model) GetNodeById(id string) (node interface{})

GetNodeById - Get a node by its id

		Returned value is of type interface{}
   Returned node may be nil

func (*Model) GetNodeChild

func (m *Model) GetNodeChild(name string) (child interface{})

GetNodeChild - Get a child node by its child name

func (*Model) GetNodeContext

func (m *Model) GetNodeContext(name string) (ctx *NodeContext)

GetNodeContext - Get a node context

func (*Model) GetNodeId

func (m *Model) GetNodeId(name string) (id string)

GetNodeId - Get a node ID by its name

func (*Model) GetNodeNames

func (m *Model) GetNodeNames(typ ...string) []string

GetNodeNames - Get the list of nodes of a certain type; "" or "ANY" returns all

func (*Model) GetNodeParent

func (m *Model) GetNodeParent(name string) (parent interface{})

GetNodeParent - Get a parent node by its child name

func (*Model) GetNodeType

func (m *Model) GetNodeType(name string) (typ string)

GetNodeType - Get a node by its name

func (*Model) GetPhysicalLocations

func (m *Model) GetPhysicalLocations(filter *NodeFilter) dataModel.PhysicalLocations

GetPhysicalLocations - Get physical locations matching filter criteria

func (*Model) GetProcesses

func (m *Model) GetProcesses(filter *NodeFilter) dataModel.Processes

GetProcesses - Get processes matching filter criteria

func (*Model) GetScenario

func (m *Model) GetScenario() (j []byte, err error)

GetScenario - Get Scenario JSON string

func (*Model) GetScenarioMinimized

func (m *Model) GetScenarioMinimized() (j []byte, err error)

GetScenarioMinimized - Get Minimized Scenario JSON string

func (*Model) GetScenarioName

func (m *Model) GetScenarioName() string

GetScenarioName - Get the scenario name

func (*Model) GetServiceMaps

func (m *Model) GetServiceMaps() *[]dataModel.NodeServiceMaps

GetServiceMaps - Extracts the model service maps

func (*Model) GetZones

func (m *Model) GetZones(filter *NodeFilter) dataModel.Zones

GetZones - Get zones matching filter criteria

func (*Model) ModifyScenarioNode

func (m *Model) ModifyScenarioNode(node *dataModel.ScenarioNode, userData interface{}) (err error)

ModifyScenarioNode - Modify scenario node

func (*Model) MoveNode

func (m *Model) MoveNode(nodeName string, destName string, userData interface{}) (oldLocName string, newLocName string, err error)

MoveNode - Move a specific UE in the scenario

func (*Model) RemoveScenarioNode

func (m *Model) RemoveScenarioNode(node *dataModel.ScenarioNode, userData interface{}) (err error)

RemoveScenarioNode - Remove scenario node

func (*Model) SetScenario

func (m *Model) SetScenario(j []byte) (err error)

SetScenario - Initialize model from JSON string

func (*Model) UpdateNetChar

func (m *Model) UpdateNetChar(nc *dataModel.EventNetworkCharacteristicsUpdate, userData interface{}) (err error)

UpdateNetChar - Update network characteristics for a node

func (*Model) UpdatePoasInRange

func (m *Model) UpdatePoasInRange(ueName string, poasInRange []string, userData interface{}) (err error)

UpdatePoasInRange - Update UE POA list

func (*Model) UpdateScenario

func (m *Model) UpdateScenario()

type ModelCfg

type ModelCfg struct {
	Name      string
	Namespace string
	Module    string
	DbAddr    string
	UpdateCb  func(eventType string, userData interface{})
}

ModelCfg - Model Configuration

type NetworkGraph

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

NodeContext

func NewNetworkGraph

func NewNetworkGraph() (ng *NetworkGraph)

NewNodeContext - allocate an empty NodeGraph

func (*NetworkGraph) AddNode

func (ng *NetworkGraph) AddNode(node string, parent string, zeroDist bool)

type Node

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

Node - model node

func NewNode

func NewNode(id string, name string, nodeType string, object interface{}, child interface{}, parent interface{}, context interface{}) (n *Node)

NewNode - allocate a Node

type NodeContext

type NodeContext struct {
	Parents  map[string]string
	Children map[string]map[string]string
}

NodeContext

func NewNodeContext

func NewNodeContext(deployment, domain, zone, netLoc, phyLoc string) (ctx *NodeContext)

NewNodeContext - allocate a new NodeContext

func (*NodeContext) AddChild

func (ctx *NodeContext) AddChild(name string, typ string)

AddChild - add a child node to context

type NodeFilter

type NodeFilter struct {
	DomainName           string
	DomainType           string
	ZoneName             string
	NetworkLocationName  string
	NetworkLocationType  string
	PhysicalLocationName string
	PhysicalLocationType string
	ProcessName          string
	ProcessType          string
	ExcludeChildren      bool
	Minimize             bool
}

type NodeMap

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

NodeMap - Model node map

func NewNodeMap

func NewNodeMap() (nm *NodeMap)

NewNodeMap - allocate a blank NodeMap

func (*NodeMap) AddNode

func (nm *NodeMap) AddNode(n *Node)

AddNode - Add a node to the NodeMap

func (*NodeMap) FindAllByType

func (nm *NodeMap) FindAllByType(nodeType string) map[string]*Node

FindAllByType - find a list of nodes using a type

func (*NodeMap) FindById

func (nm *NodeMap) FindById(id string) (n *Node)

FindById - find a node using its name

func (*NodeMap) FindByName

func (nm *NodeMap) FindByName(name string) (n *Node)

FindByName - find a node using its name

func (*NodeMap) FindByType

func (nm *NodeMap) FindByType(name string, nodeType string) (n *Node)

FindByType - find a node using its type - NOT SURE WE NEED THIS

Jump to

Keyboard shortcuts

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