mrnes

package module
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 28 Imported by: 9

README

mrnes

Multi-resolution network emulation-simulation

Overview

The multi-resolution network emulator/simulator (mrnes) is a Go package for modeling communication networks. Its level of model abstraction is considerably higher than network simulators like ns3 or OpNet, for its intended use cases emphasize speed and scale of model evaluation more than quantitative predictive accuracy. An mrnes model has components that represent various kinds of entities found in a complex system: routers, bridges, routers, repeaters, hub, switches, hosts, servers, sensors. The configuration files read in at start-up identify the components being used, their interconnections, and performance characteristics (like bandwidth) they are assigned to have. A mrnes network simulates the transition of traffic between endpoints, and models the impact that contention for resources has on that traffic.

Network Connectivity

Before getting into the details of mrnes models and simulation it is helpful to understand elements of "The Big Picture" that mrnes has of networks, their devices, and how connectivity is expressed.

There are five kinds of network objects: network, endpoint, router, switch, and interface. Routers route and switches switch, but in the current version of mrnes there is functionally little difference between them. An endpoint is a device on which some kind of computation may occur. This definition can be broad, encompassing simple devices that merely sense their environment and report to data collectors, to powerful servers with multiple CPUs and the ability to concurrently run many applications.

Every interface is bound to one device, and 'faces' one network. It has performance characteristics such as bandwidth, and (optionally) buffer size. The interface has a 'media type', either "wired" or "wireless". In the case of a wired interface it may be declared to directly connect through a cable to some other wired interface (on a different device) that faces the same network. It may instead be declared to be 'connected' to a list of other interfaces that face the same network, without directly specifying cable connections. The intent here is to express that somehow the devices to which these interfaces are bound are reachable through the network, but the mechanics of the reachability aren't explicit, and during the simulation the latency communications between those interfaces are derived from declared characteristics of the network rather than from the single cable.

Any device may have multiple interfaces; when it does, typically each interface is bound to a different network; we say the interface is 'facing' the network. For descriptive purposes a network is categorized as having LAN, WAN, T3, T2, or T1 scale. These characterizations are not used by mrnes in any way, but as descriptions they can help explain the structure of a mrnes model. Networks connect to each other a router that has one interface facing one of the networks, and a different interface facing the other. All of a switch's interfaces face the same network, but like a router, and endpoint can stradle multiple networks.

A network is declared to have a 'media type', presently either "wired" or "wireless". A wireless network must have a router serving as a hub, with a wireless interface facing the network. The hub facilitates communication between endpoints with wireless interfaces that face the network. Every wireless interface maintains a list of other wireless interfaces facing the same network with which it can directly communicate. That list will always contain reference to the hub's wireless interface, there are no assumptions or requirements on what other interfaces may be referenced in any one of these. That is left to the user's model configuration.

As with cable-free wired communications, the latency (and packet drop) characteristics of a wireless communication between interfaces depends on the characteristics of the interfaces themselves, and those of the wireless network.

The figure below illustrates some of these points.

network

The network on the left is wireless. The three endpoints all have wireless interfaces connected to the hub's wireless interface. The hub has a cable connection to the router that spans the two networks. It has cabled interface facing the right-side network that connects to a switch. That switch has another cabled interface to one endpoint, and non-cabled wired interfaces connecting to two other endpoints.

Simulation

The mrnes package does not contain the definition of components that generate and receive network traffic, these must be supplied by code that imports the mrnes package (e.g., various components of the pces package). That code passes to an mrnes API method (mrnes.EnterNetwork) a description of a communication, specifying (among other things) the names of the source and destination devices identified. mrnes uses ordinary text to name endpoints and exports these names. While a model may be constructed to ascribe IP or MAC addresses to device interfaces, these are not assumed. Routing through the assembled system is performed using a shortest-path discovery algorithm. More sophisticated (and realistic) routing algorithms can in principle be incorporated, but this requires modification to the existing mrnes code base.

Computational endpoints in mrnes can be configured to have multiple cores. This means that the end-to-end time involved in meeting a computation request depends on the number of available cores at the instant of the request. The code making the request will have acquired the model of the CPU and will have looked up in a table the execution time of the task on that model, but it is left to mrnes logic to manage the assignment of computation workload to cores and to manage reporting back to calling code when the computation is completed, a time that may reflect some queueing.

mrnes is designed and verified to accurately capture simple workflows, using measured execution times for computation and communication activities. When those workflows specify pretty much all of the activity actually going on in a testbed setting, mrnes does a good job of making performance predictions that are aligned with measured performance. mrnes also provides mechanisms to cause the performance of those workflows to vary as a function of system loading factors. Models that use these loading factors should be viewed more as a way of scoping the possible impact of load factors on that performance more than an accurate quantitative prediction of the loading factors.

Consider the figure below, illustrating the presentation of a message to an mrnes representation of an endpoint. The representation comes from code and memory space outside of mrnes. The simulation discovers the route, creates a frame, and passes the frame through a sequence of interfaces and networks until it reaches the destination host, at which point the message carried by the frame is passed back out. The core activity of the network simulation is carried out by discrete event handlers that process the frame as it arrives at the ingress interface of a device, is processed by the device (i.e. switched or routed), is processed by the egress interface of the device, and then passes through network infrastructure to be presented at the ingress interface of the next device. We will describe the actions of the event handlers in more detail later. At this point the key things to remember are that the addressing scheme is left to the modeler, that the route is computed (or recovered) as a shortest path at the point the frame is presented to the source, that the time advancement logic assumes that the passage of a frame through a network between two interfaces is no faster than the slower of the two interfaces, and that this passage time reflects the impact that network congestion has on latency and bandwidth. mrnes leaves to the modeler decisions of what to do when traffic is lost due to contention, providing that user with a means of receiving notice of the network location and simulation time when such loss occurs.

mrnes-network

Background flows and background computation

A unique feature of mrnes is its support for concurrent simulation of network components at different levels of resolution. The point of the design is to enable a modeler to include the impact that computation and communication other than that of particular interest has on the workflows of interest, by including their use of network and computational resources, against which the foreground activity competes.

Foreground computation requests are presented to an mrnes endpoint, which queues them if needed to be served by a free CPU core. mrnes allows a model to specify a background rate and per-request computation demand at an endpoint, and have that flow occupy cores, under the covers so to speak. In the presence of background computation the requests for foreground computation are more likely to have to wait for a free core.

Background flows can be introduced to cause foreground frames to have to compete for bandwidth, and so slow down communication. mrnes defines an API for describing attributes of these background flows. In all cases the effect of background flows at an interface is to induce foreground frames to queue for transmission through the interface, using a delay model based on the aggregate background flows through it. The level of intensity of background computation and background flows can be dynamically changed in the course of a simulation run, by the model code that uses the mrnes package.

API

The API for mrnes input files is given in mrnes-API .

mrnes Internals

More detailed documentation of how mrnes operates is provided in pces-Internals.pdf

The PCES/MRNES System

The Patterned Computation Evaluation System (PCES) and Multi-resolution Network Emulator and Simulator (MRNES) are software frameworks one may use to model computations running on distributed system with the focus on estimating its performance and use of system resources.

The PCES/MRNES System is written in the Go language. We have written a number of GitHub repositories that support this system, described below.

Copyright 2025 Board of Trustees of the University of Illinois. See the license for details.

Documentation

Index

Constants

View Source
const (
	FlowSrcConst = iota
	FlowSrcRandom
)

Variables

View Source
var AccelSchedulersByHostName map[string]map[string]*TaskScheduler = make(map[string]map[string]*TaskScheduler)

AccelSchedulersByHostName maps an identifier for the map of schedulers to the map

View Source
var ClientStrm int
View Source
var DefaultBool = make(map[string]bool)
View Source
var DefaultFloat = make(map[string]float64)
View Source
var DefaultInt = make(map[string]int)

DefaultInt DefaultFloat DefaultBool DefaultStr are dictionaries that hold default values for various attributes, indexed by the attribute's name

View Source
var DefaultRouterOp = "route"

DefaultRouteOp and DefaultSwitchOp hold the names of the operations that are used to look up route or switch operation costs if no operation is specified

View Source
var DefaultStr = make(map[string]string)
View Source
var DefaultSwitchOp = "switch"
View Source
var EndptDevByID map[int]*endptDev
View Source
var EndptDevByName map[string]*endptDev
View Source
var ExpAttributes map[string][]string
View Source
var ExpParamObjs []string

ExpParamObjs , ExpAttributes , and ExpParams hold descriptions of the types of objects that are initialized by an exp file, for each the attributes of the object that can be tested for to determine whether the object is to receive the configuration parameter, and the parameter types defined for each object type

View Source
var ExpParams map[string][]string
View Source
var FeedActive bool
View Source
var FeedDescList []*FeedDesc

FeedDescList holds a list of descriptors of all the feeds

View Source
var FgLags int
View Source
var FlowByID map[int]*Flow
View Source
var FlowByName map[string]*Flow
View Source
var FlowList map[int]*Flow
View Source
var Foreground int
View Source
var FrameSizeCache map[int]int = make(map[int]int)

FrameSizeCache holds previously computed minimum frame size along the route for a flow whose ID is the index

View Source
var HashSeed string = ""
View Source
var InputDir string
View Source
var IntrfcByID map[int]*intrfcStruct
View Source
var IntrfcByName map[string]*intrfcStruct
View Source
var MD1DistCache []CDFDist = []CDFDist{}
View Source
var NetworkByID map[int]*networkStruct
View Source
var NetworkByName map[string]*networkStruct
View Source
var NetworkMsgID int = 1
View Source
var NumArrivals int
View Source
var NumIDs int = 0
View Source
var NumWaits int
View Source
var QkNetSim bool = false

QkNetSim is set from the command line, when selected uses 'quick' form of network simulation

View Source
var RouterDevByID map[int]*routerDev
View Source
var RouterDevByName map[string]*routerDev
View Source
var StrmLags int
View Source
var StrmSamples int
View Source
var SumWaits float64
View Source
var SwitchDevByID map[int]*switchDev
View Source
var SwitchDevByName map[string]*switchDev
View Source
var TaskSchedulerByHostName map[string]*TaskScheduler = make(map[string]*TaskScheduler)

TaskSchedulerByHostName maps an identifier for the scheduler to the scheduler itself

View Source
var TopoDevByID map[int]TopoDev
View Source
var TopoDevByName map[string]TopoDev

Functions

func AcceptedFlowRate added in v0.0.22

func AcceptedFlowRate(evtMgr *evtm.EventManager, context any, data any) any

func AddIntrfcTrace added in v0.0.15

func AddIntrfcTrace(tm *TraceManager, vrt vrtime.Time, execID, msgID, objID int, op, CQ string)

func AddNetTrace added in v0.0.15

func AddNetTrace(tm *TraceManager, vrt vrtime.Time, nm *NetworkMsg, objID int, op string)

AddNetTrace creates a record of the trace using its calling arguments, and stores it

func AddSchedulerTrace added in v0.0.15

func AddSchedulerTrace(tm *TraceManager, vrt vrtime.Time, ts *TaskScheduler, execID, objID int, op string)

func BiDijkstra added in v0.1.6

func BiDijkstra(gF, gR Graph, s, t int) (best int64, meet int, parentF, parentB []int)

BiDijkstra computes data structures from which a least-cost path can be constructed based on shortest path exploration forward from the source and shortest path exploration backwards from the destination

func BuildExperimentNet

func BuildExperimentNet(evtMgr *evtm.EventManager, dictFiles map[string]string,
	useYAML bool, idCounter int, traceMgr *TraceManager) error

BuildExperimentNet bundles the functions of LoadTopo, LoadDevExec, and LoadStateParams

func BuildFlow added in v0.0.15

func BuildFlow(flowID int, route *[]intrfcsToDev) float64

BuildFlow establishes data structures in the interfaces and networks crossed by the given route, with a flow having the given flowID. No rate information is passed or set, other than initialization

func CableIntrfcFrames

func CableIntrfcFrames(intrfc1, intrfc2 *IntrfcFrame)

CableIntrfcFrames links two interfaces through their 'Cable' attributes

func CarryIntrfcFrames

func CarryIntrfcFrames(intrfc1, intrfc2 *IntrfcFrame)

CarryIntrfcFrames links two interfaces through their 'Cable' attributes

func CheckDirectories

func CheckDirectories(dirs []string) (bool, error)

CheckDirectories probes the file system for the existence of every directory listed in the list of files. Returns a boolean indicating whether all dirs are valid, and returns an aggregated error if any checks failed.

func CheckFiles

func CheckFiles(names []string, checkExistence bool) (bool, error)

CheckFiles probes the file system for permitted access to all the argument filenames, optionally checking also for the existence of those files for the purposes of reading them.

func CheckOutputFiles

func CheckOutputFiles(names []string) (bool, error)

CheckOutputFiles probles the file system to ensure that every argument filename can be written.

func CheckReadableFiles

func CheckReadableFiles(names []string) (bool, error)

CheckReadableFiles probles the file system to ensure that every one of the argument filenames exists and is readable

func CompareAttrbs

func CompareAttrbs(attrbs1, attrbs2 []AttrbStruct) int

CompareAttrbs returns -1 if the first argument is strictly more general than the second, returns 1 if the second argument is strictly more general than the first, and 0 otherwise

func ConnectDevs

func ConnectDevs(dev1, dev2 NetDevice, cable bool, faces string)

ConnectDevs establishes a 'cabled' or 'carry' connection (creating interfaces if needed) between devices dev1 and dev2 (recall that NetDevice is an interface satisified by Endpt, Router, Switch)

func DefaultEndptName

func DefaultEndptName(etype string) string

DefaultEndptName returns unique name for a endpt

func DefaultFlowName added in v0.0.22

func DefaultFlowName() string

DefaultFlowName returns a unique name for a flow

func DefaultIntrfcName

func DefaultIntrfcName(device string) string

DefaultIntrfcName generates a unique string to use as a name for an interface. That name includes the name of the device endpting the interface and a counter

func DefaultRouterName

func DefaultRouterName() string

DefaultRouterName returns a unique name for a router

func DefaultSwitchName

func DefaultSwitchName(name string) string

DefaultSwitchName returns a unique name for a switch

func DelayThruDevice added in v0.0.28

func DelayThruDevice(model, op string, msgLen int, includesBW bool) float64

func DevCodeToStr added in v0.0.15

func DevCodeToStr(code DevCode) string

DevCodeToStr returns a string corresponding to an input devCode for it

func DevNetworks

func DevNetworks(dev NetDevice) string

DevNetworks returns a comma-separated string of of the names of networks the argument NetDevice interfaces face

func EqAttrbs

func EqAttrbs(attrbs1, attrbs2 []AttrbStruct) bool

EqAttrbs determines whether the two attribute lists are exactly the same

func EstMD1Latency added in v0.0.15

func EstMD1Latency(rho float64, msgLen int, bndwdth float64) float64

EstMD1Latency estimates the delay through an M/D/1 queue

func EstMM1Latency added in v0.0.15

func EstMM1Latency(bitRate, rho float64, msgLen int) float64

func FindFrameSize added in v0.0.15

func FindFrameSize(frameID int, rt *[]intrfcsToDev) int

FindFrameSize traverses a route and returns the smallest MTU on any interface along the way. This defines the maximum frame size to be used on that route.

func FlowRateChange added in v0.0.22

func FlowRateChange(evtMgr *evtm.EventManager, cxt any, data any) any

func FlowRemoved added in v0.0.22

func FlowRemoved(evtMgr *evtm.EventManager, cxt any, data any) any

func GetExpParamDesc

func GetExpParamDesc() ([]string, map[string][]string, map[string][]string)

GetExpParamDesc returns ExpParamObjs, ExpAttributes, and ExpParams after ensuring that they have been build

func GetExperimentNetDicts

func GetExperimentNetDicts(dictFiles map[string]string) (*TopoCfg, *DevExecList, *ExpCfg, *ExpCfg)

GetExperimentNetDicts accepts a map that holds the names of the input files used for the network part of an experiment creates internal representations of the information they hold, and returns those structs.

func InitFlowList added in v0.0.22

func InitFlowList()

func InitTopoDesc added in v0.0.15

func InitTopoDesc()

func InitializeBckgrnd added in v0.0.15

func InitializeBckgrnd(evtMgr *evtm.EventManager)

InitializeBckgrnd initializes the background computation component of all the endpoints in the model

func InitializeBckgrndEndpt added in v0.0.15

func InitializeBckgrndEndpt(evtMgr *evtm.EventManager, endptDev *endptDev)

Initialize the data structures for the background computation component of the given endpoint

func LoadDevExec added in v0.0.15

func LoadDevExec(devExecFile string) error

LoadDevExec reads in the device-oriented function timings, puts them in a global table devExecTimeTbl

func LoadIPMap added in v0.1.0

func LoadIPMap(base string) error

LoadIPMap reads in the dictionary from the ipmap dictionary, creates an IPTables dictionary to map external IP addresses to those expressed in the simulation model

func LoadStateParams added in v0.0.15

func LoadStateParams(base string) error

LoadStateParams takes the file names of a 'base' file of performance parameters (e.g., defaults) and a 'modify' file of performance parameters to merge in (e.g. with higher specificity) and initializes the topology elements state structures with these.

func LoadTopo added in v0.0.15

func LoadTopo(topoFile string, idCounter int, traceMgr *TraceManager) error

LoadTopo reads in a topology configuration file and creates from it internal data structures representing the topology. idCounter starts the enumeration of unique topology object names, and traceMgr is needed to log the names and ids of all the topology objects into the trace dictionary

func NetScaleToStr added in v0.0.15

func NetScaleToStr(ntype NetworkScale) string

NetScaleToStr returns a string name that corresponds to an input networkScale

func NullHandler

func NullHandler(evtMgr *evtm.EventManager, context any, msg any) any

NullHandler exists to provide as a link for data fields that call for an event handler, but no event handler is actually needed

func Pt2ptLatency added in v0.0.15

func Pt2ptLatency(srcIntrfc, dstIntrfc *intrfcStruct) float64

Pt2ptLatency computes the latency on a point-to-point connection between interfaces. Called when neither interface is attached to a router

func ReportErrs

func ReportErrs(errs []error) error

ReportErrs transforms a list of errors and transforms the non-nil ones into a single error with comma-separated report of all the constituent errors, and returns it.

func ReportFlowEvt added in v0.0.22

func ReportFlowEvt(evtMgr *evtm.EventManager, context any, data any) any

func SetTopoParameters added in v0.0.15

func SetTopoParameters(expCfg *ExpCfg)

SetTopoParameters takes the list of parameter configurations expressed in ExpCfg form, turns its elements into configuration commands that may initialize multiple objects, includes globally applicable assignments and assign these in greatest-to-least application order

func SetTopoState added in v0.0.15

func SetTopoState(expCfg *ExpCfg)

SetTopoState creates the state structures for the devices before initializing from configuration files

func SimPause added in v0.1.0

func SimPause(evtMgr *evtm.EventManager, context any, data any) any

SimPause scheduled to stall simulation event processing until released

func StartFeeds added in v0.1.0

func StartFeeds(evtMgr *evtm.EventManager)

StartFeeds goes through the list of FeedDescs, and for each creates eithe a filePCAPReader or socketPCAPReader, depending on the source type. The constructor calls schedule the events involved in managing the input feeds

func StartFlows added in v0.0.22

func StartFlows(evtMgr *evtm.EventManager)

func StopFlows added in v0.0.22

func StopFlows()

func UpdateExpCfg

func UpdateExpCfg(orgfile, updatefile string, useYAML bool, dict []byte)

UpdateExpCfg copies the ExpCfg parameters in the file referenced by the 'updatefile' name into the file of ExpCfg parameters in the file referenced by the 'orgfile' name

func ValidateAttribute

func ValidateAttribute(paramObj, attrbName string) bool

ValidateAttribute checks that the attribute named is one that associates with the parameter object type named

func ValidateParameter

func ValidateParameter(paramObj string, attributes []AttrbStruct, param string) error

ValidateParameter returns an error if the paramObj, attributes, and param values don't make sense taken together within an ExpParameter.

Types

type ActiveRec added in v0.0.15

type ActiveRec struct {
	Number int
	Rate   float64
}

type AttrbStruct

type AttrbStruct struct {
	AttrbName, AttrbValue string
}

AttrbStruct holds the name of an attribute and a value for it

func CreateAttrbStruct

func CreateAttrbStruct(attrbName, attrbValue string) *AttrbStruct

CreateAttrbStruct is a constructor

type BuildExpCfgFuncType

type BuildExpCfgFuncType func(any) *ExpCfg

BuildExpCfgFuncType is a signature for a function that creates experiment cfgs

type BuildTopoCfgFuncType

type BuildTopoCfgFuncType func(any) *TopoCfg

BuildTopoCfgFuncType is a signature for a function that creates topology cfgs

type CDFDist added in v0.1.3

type CDFDist struct {
	CDF []float64
	// contains filtered or unexported fields
}

type CaptureHdr added in v0.1.0

type CaptureHdr struct {
	Time          int64  // microseconds since Unix started
	CaptureLength uint32 // number of bytes physically in data field
	Length        uint32 // length in bytes of packet represented
}

CaptureHdr holds key elements of a PCAP's metadata. A socket connection to the simulator holds an instances of CaptureHdr, concatenated with the data frame of the packet itself. The Time attribute is the Unix epoch, measured in microseconds. This implies that some processing is required by code that sends packets captured as PCAP to create a CaptureHdr, as the time expression in a PCAP format is different (seconds and microseconds). There are different formats for PCAP packets and so the simulator defines the standard that it needs and puts the responsibility on the user to understand what PCAP format they have.

func GetPCAPCaptureInfo added in v0.1.0

func GetPCAPCaptureInfo(bfr []byte, littleEndian bool) CaptureHdr

GetPCAPCaptureInfo accepts a byte slice that holds the variables of a CaptureHdr, create said header, and return it. The user needs to also specify whether the bytes are in little endian and big endian order

type ConnDesc added in v0.0.15

type ConnDesc struct {
	Type    ConnType
	Latency ConnLatency
	Action  FlowAction
}

ConnDesc holds characteristics of a connection...the type (discrete or flow), the latency (how delay in delivery is ascribed) and in the case of a flow, the action (start, end, rate change)

type ConnLatency added in v0.0.15

type ConnLatency int

ConnLatency describes one of three ways that latency is ascribed to a source-to-destination connection. 'Zero' ascribes none at all, is instantaneous, which is used in defining major flow's to reserve bandwidth. 'Place' means that at the time a message arrives to the network, a latency to its destination is looked up or computed without simulating packet transit across the network. 'Simulate' means the packet is simulated traversing the route, through every interface.

const (
	Zero ConnLatency = iota
	Place
	Simulate
)

type ConnType added in v0.0.15

type ConnType int

ConnType tags traffic as discrete or flow

const (
	FlowConn ConnType = iota
	DiscreteConn
)

type DFS added in v0.0.15

type DFS map[int]intrfcIDPair

type DevCode added in v0.0.15

type DevCode int

DevCode is the base type for an enumerated type of network devices

const (
	EndptCode DevCode = iota
	SwitchCode
	RouterCode
	UnknownCode
)

func DevCodeFromStr added in v0.0.15

func DevCodeFromStr(code string) DevCode

DevCodeFromStr returns the devCode corresponding to an string name for it

type DevDesc

type DevDesc struct {
	DevTypes     []string `json:"devtype" yaml:"devtype"`
	Manufacturer string   `json:"manufacturer" yaml:"manufacturer"`
	Model        string   `json:"model" yaml:"model"`
	Cores        int      `json:"cores" yaml:"cores"`
	Freq         float64  `json:"freq" yaml:"freq"`
	Cache        float64  `json:"cache" yaml:"cache"`
}

DevDesc provides a description of a computing (or switching or routing) device

func CreateDevDesc

func CreateDevDesc(devType, manufacturer, model string, cores int, freq, cache float64) *DevDesc

CreateDevDesc is a constructor

type DevDescDict

type DevDescDict struct {
	Name    string             `json:"name" yaml:"name"`
	DescMap map[string]DevDesc `json:"DescMap" yaml:"DescMap"`
}

DevDescDict defines a dictionary of DevDesc structs, indexed by device description string

func CreateDevDescDict

func CreateDevDescDict(name string) *DevDescDict

CreateDevDescDict is a constructor

func ReadDevDescDict

func ReadDevDescDict(filename string, useYAML bool, dict []byte) (*DevDescDict, error)

ReadDevDescDict deserializes a byte slice holding a representation of an DevDescDict struct. If the input argument of dict (those bytes) is empty, the file whose name is given is read to acquire them. A deserialized representation is returned, or an error if one is generated from a file read or the deserialization.

func (*DevDescDict) AddDevDesc

func (ddd *DevDescDict) AddDevDesc(dd *DevDesc)

AddDevDesc constructs a device identifier by concatenating the Manufacturer and Model attributes of the argument device as the index to the referring DevDescDict

func (*DevDescDict) RecoverDevDesc

func (ddd *DevDescDict) RecoverDevDesc(name string) DevDesc

func (*DevDescDict) WriteToFile

func (ddd *DevDescDict) WriteToFile(filename string) error

WriteToFile stores the DevDescDict struct to the file whose name is given. Serialization to json or to yaml is selected based on the extension of this name.

type DevExecDesc

type DevExecDesc struct {
	DevOp      string  `json:"devop" yaml:"devop"`
	Model      string  `json:"model" yaml:"model"`
	PcktLen    int     `json:"pcktlen" yaml:"pcktlen"`
	ExecTime   float64 `json:"exectime" yaml:"exectime"`
	Bndwdth    float64 `json:"bndwdth" yaml:"bndwdth"`
	DevFunc    string  `json:"devfunc" yaml:"devfunc"`
	DevFuncApp string  `json:"devfuncapp" yaml:"devfuncapp"`
}

A DevExecDesc struct holds a description of a device operation timing. ExecTime is the time (in seconds), it depends on attribute Model

type DevExecList

type DevExecList struct {
	// ListName is an identifier for this collection of timings
	ListName string `json:"listname" yaml:"listname"`

	// key is the device operation.  Each has a list
	// of descriptions of the timing of that operation, as a function of device model
	Times map[string][]DevExecDesc `json:"times" yaml:"times"`
}

A DevExecList holds a map (Times) whose key is the operation of a device, and whose value is a list of DevExecDescs associated with that operation.

func CreateDevExecList

func CreateDevExecList(listname string) *DevExecList

CreateDevExecList is an initialization constructor. Its output struct has methods for integrating data.

func ReadDevExecList

func ReadDevExecList(filename string, useYAML bool, dict []byte) (*DevExecList, error)

ReadDevExecList deserializes a byte slice holding a representation of an DevExecList struct. If the input argument of dict (those bytes) is empty, the file whose name is given is read to acquire them. A deserialized representation is returned, or an error if one is generated from a file read or the deserialization.

func (*DevExecList) AddTiming

func (del *DevExecList) AddTiming(devOp, model string, execTime float64, pcktlen int, bndwdth float64)

AddTiming takes the parameters of a DevExecDesc, creates one, and adds it to the FuncExecList

func (*DevExecList) WriteToFile

func (del *DevExecList) WriteToFile(filename string) error

WriteToFile stores the DevExecList struct to the file whose name is given. Serialization to json or to yaml is selected based on the extension of this name.

type DeviceIP added in v0.1.0

type DeviceIP struct {
	Device  string `json:"device" yaml:"device"`
	IntIP   string `json:"intIP"  yaml:"intIP"`
	ExtIP   string `json:"extIP"  yaml:"extIP"`
	Network string `json:"network" yaml:"network"`
}

DeviceIP describes the IP information for a device whose name is given

type DeviceIPSlice added in v0.1.0

type DeviceIPSlice []DeviceIP

DeviceIPSlice holds a list of DeviceIP structs

type Edge added in v0.1.6

type Edge struct {
	Active bool // allow for being disabled, in the future, currently always true
	// contains filtered or unexported fields
}

type EdgeIntrfcID added in v0.1.6

type EdgeIntrfcID int

type EdgeIntrfcs added in v0.1.6

type EdgeIntrfcs struct {
	EdgeID int
	// contains filtered or unexported fields
}

type EndptDesc

type EndptDesc struct {
	Name       string            `json:"name" yaml:"name"`
	Groups     []string          `json:"groups" yaml:"groups"`
	Model      string            `json:"model" yaml:"model"`
	Cores      int               `json:"cores" yaml:"cores"`
	Accel      map[string]string `json:"accel" yaml:"accel"`
	Interfaces []IntrfcDesc      `json:"interfaces" yaml:"interfaces"`
	Extern     string            `json:"extern" yaml:"extern"`
}

EndptDesc defines serializable representation of an endpoint .

type EndptDescSlice

type EndptDescSlice []EndptDesc

type EndptFrame

type EndptFrame struct {
	Name       string // unique string identifier
	Groups     []string
	Model      string
	Cores      int
	Accel      map[string]string
	Interfaces []*IntrfcFrame // list of interfaces that describe the networks the endpt connects to
}

EndptFrame defines pre-serialization representation of a Endpt

func CreateEUD

func CreateEUD(name, model string, cores int) *EndptFrame

CreateEUD is a constructor. It creates an endpoint frame with the EUD flag set to true

func CreateEndpt

func CreateEndpt(name, etype string, model string, cores int) *EndptFrame

CreateEndpt is a constructor. It saves (or creates) the endpt name, and saves the optional endpt type (which has use in run-time configuration)

func CreateHost

func CreateHost(name, model string, cores int) *EndptFrame

CreateHost is a constructor. It creates an endpoint frame that sets the Host flag

func CreateNode

func CreateNode(name, model string, cores int) *EndptFrame

CreateNode is a constructor. It creates an endpoint frame, does not mark with Host, Server, or EUD

func CreateSensor added in v0.0.15

func CreateSensor(name, model string) *EndptFrame

CreateSensor is a constructor.

func CreateSrvr

func CreateSrvr(name, model string, cores int) *EndptFrame

CreateSrvr is a constructor. It creates an endpoint frame and marks it as a server

func (*EndptFrame) AddAccel added in v0.0.16

func (epf *EndptFrame) AddAccel(name string, model string, cores int)

AddAccel includes the name of an accelerator PIC in the Endpoint, including a core count if greater than 1

func (*EndptFrame) AddGroup

func (epf *EndptFrame) AddGroup(groupName string)

AddGroup adds a group name to an endpoint frame's list of groups, if not already present

func (*EndptFrame) AddIntrfc

func (epf *EndptFrame) AddIntrfc(iff *IntrfcFrame) error

AddIntrfc includes a new interface frame for the endpt. An error is reported if this specific (by pointer value or by name) interface is already connected.

func (*EndptFrame) DevAddIntrfc

func (epf *EndptFrame) DevAddIntrfc(iff *IntrfcFrame) error

DevAddIntrfc includes an IntrfcFrame to a NetDevice's list of IntrfcFrames

func (*EndptFrame) DevID

func (epf *EndptFrame) DevID() string

DevID returns the NetDevice unique identifier

func (*EndptFrame) DevInterfaces

func (epf *EndptFrame) DevInterfaces() []*IntrfcFrame

DevInterfaces returns the NetDevice list of IntrfcFrames, if any

func (*EndptFrame) DevName

func (epf *EndptFrame) DevName() string

DevName returns the NetDevice name

func (*EndptFrame) DevType

func (epf *EndptFrame) DevType() string

DevType returns the NetDevice Type

func (*EndptFrame) IsEUD

func (epf *EndptFrame) IsEUD() bool

IsEUD indicates whether EUD is in the group list

func (*EndptFrame) IsHost added in v0.0.4

func (epf *EndptFrame) IsHost() bool

IsHost indicates whether Host is in the group list

func (*EndptFrame) IsSrvr

func (epf *EndptFrame) IsSrvr() bool

IsSrvr indicates whether Server is in the endpoint groups list

func (*EndptFrame) SetCores

func (epf *EndptFrame) SetCores(cores int)

SetCores records in the endpoint frame the number of cores the model assumes are available for concurrent processing

func (*EndptFrame) SetEUD

func (epf *EndptFrame) SetEUD()

SetEUD includes EUD into the group list

func (*EndptFrame) SetHost added in v0.0.4

func (epf *EndptFrame) SetHost()

SetHost includes Host into the group list

func (*EndptFrame) SetSrvr

func (epf *EndptFrame) SetSrvr()

SetSrvr adds Server to the endpoint groups list

func (*EndptFrame) Transform

func (epf *EndptFrame) Transform() EndptDesc

Transform returns a serializable EndptDesc, transformed from a EndptFrame.

type ExpCfg

type ExpCfg struct {
	// Name is an identifier for a group of [ExpParameters].  No particular interpretation of this string is
	// used, except as a referencing label when moving an ExpCfg into or out of a dictionary
	Name string `json:"expname" yaml:"expname"`

	// Parameters is a list of all the [ExpParameter] objects presented to the simulator for an experiment.
	Parameters []ExpParameter `json:"parameters" yaml:"parameters"`
}

ExpCfg structure holds all of the ExpParameters for a named experiment

func CreateExpCfg

func CreateExpCfg(name string) *ExpCfg

CreateExpCfg is a constructor. Saves the offered Name and initializes the slice of ExpParameters.

func ReadExpCfg

func ReadExpCfg(filename string, useYAML bool, dict []byte) (*ExpCfg, error)

ReadExpCfg deserializes a byte slice holding a representation of an ExpCfg struct. If the input argument of dict (those bytes) is empty, the file whose name is given is read to acquire them. A deserialized representation is returned, or an error if one is generated from a file read or the deserialization.

func (*ExpCfg) AddExpParameter

func (excfg *ExpCfg) AddExpParameter(exparam *ExpParameter)

AddExpParameter includes the argument ExpParameter to the the Parameter list of the referencing ExpCfg

func (*ExpCfg) AddParameter

func (excfg *ExpCfg) AddParameter(paramObj string, attributes []AttrbStruct, param, value string) error

AddParameter accepts the four values in an ExpParameter, creates one, and adds to the ExpCfg's list. Returns an error if the parameters are not validated.

func (*ExpCfg) WriteToFile

func (excfg *ExpCfg) WriteToFile(filename string) error

WriteToFile stores the ExpCfg struct to the file whose name is given. Serialization to json or to yaml is selected based on the extension of this name.

type ExpCfgDict

type ExpCfgDict struct {
	DictName string            `json:"dictname" yaml:"dictname"`
	Cfgs     map[string]ExpCfg `json:"cfgs" yaml:"cfgs"`
}

ExpCfgDict is a dictionary that holds ExpCfg objects in a map indexed by their Name.

func CreateExpCfgDict

func CreateExpCfgDict(name string) *ExpCfgDict

CreateExpCfgDict is a constructor. Saves a name for the dictionary, and initializes the slice of ExpCfg objects

func ReadExpCfgDict

func ReadExpCfgDict(filename string, useYAML bool, dict []byte) (*ExpCfgDict, error)

ReadExpCfgDict deserializes a byte slice holding a representation of an ExpCfgDict struct. If the input argument of dict (those bytes) is empty, the file whose name is given is read to acquire them. A deserialized representation is returned, or an error if one is generated from a file read or the deserialization.

func (*ExpCfgDict) AddExpCfg

func (ecd *ExpCfgDict) AddExpCfg(ec *ExpCfg, overwrite bool) error

AddExpCfg adds the offered ExpCfg to the dictionary, optionally returning an error if an ExpCfg with the same Name is already saved.

func (*ExpCfgDict) RecoverExpCfg

func (ecd *ExpCfgDict) RecoverExpCfg(name string) (*ExpCfg, bool)

RecoverExpCfg returns an ExpCfg from the dictionary, with name equal to the input parameter. It returns also a flag denoting whether the identified ExpCfg has an entry in the dictionary.

func (*ExpCfgDict) WriteToFile

func (ecd *ExpCfgDict) WriteToFile(filename string) error

WriteToFile stores the ExpCfgDict struct to the file whose name is given. Serialization to json or to yaml is selected based on the extension of this name.

type ExpParameter

type ExpParameter struct {
	// Type of thing being configured
	ParamObj string `json:"paramObj" yaml:"paramObj"`

	// attribute identifier for this parameter
	// Attribute string `json:"attribute" yaml:"attribute"`
	Attributes []AttrbStruct `json:"attributes" yaml:"attributes"`

	// ParameterType, e.g., "Bandwidth", "WiredLatency", "model"
	Param string `json:"param" yaml:"param"`

	// string-encoded value associated with type
	Value string `json:"value" yaml:"value"`
}

ExpParameter struct describes an input to experiment configuration at run-time. It specifies

  • ParamObj identifies the kind of thing being configured : Switch, Router, Endpoint, Interface, or Network
  • Attributes is a list of attributes, each of which are required for the parameter value to be applied.

func CreateExpParameter

func CreateExpParameter(paramObj string, attributes []AttrbStruct, param, value string) *ExpParameter

CreateExpParameter is a constructor. Completely fills in the struct with the ExpParameter attributes.

func (*ExpParameter) AddAttribute

func (epp *ExpParameter) AddAttribute(attrbName, attrbValue string) error

AddAttribute includes another attribute to those associated with the ExpParameter. An error is returned if the attribute name (other than 'group') already exists

func (*ExpParameter) Eq

func (epp *ExpParameter) Eq(ep2 *ExpParameter) bool

Eq returns a boolean flag indicating whether the two ExpParameters referenced in the call are the same

type FeedDesc added in v0.1.0

type FeedDesc struct {
	Active   bool    // whether the declared feed is actively being used
	Dilation float64 // a factor that increases ( > 1.0) or decreases ( < 1.0 )time epoches
	Name     string  // some identifier
	SrcType  string  // in {file, unix-socket, net-socket}
	SrcSpec  string  // depends on SrcType.  For file, is file path relative to inputDir.
	// For unix-socket, is absolute path of file used as socket.
	// net-socket, is port number (as string)
	Start             float64           // The virtual time ascribed to the first packet in the feed to arrive.
	Time              string            // Arrival time of the packet, in microseconds since Unix epoch
	FirstPcktUnixTime int64             // time since Unix epoch in micro-seconds
	SimRelease        chan bool         // used when feed is socket to block simulation advance until 'next' pckt arrival time is known
	FeedRelease       chan bool         // used (in principle) to stop the feed
	FileRdr           *filePCAPReader   // when the SrcType is file, a pointer to the corresponding filePCAPReader structure
	SocketRdr         *socketPCAPReader // when the SrcType is not file, a pointer to the corresponding socketPCAPReader structure
}

FeedDesc holds attributes that describe a PCAP packet feed

func CreateFeedDesc added in v0.1.0

func CreateFeedDesc(fps *FeedParams) *FeedDesc

CreateFeedDesc is a simple constructor making a FeedDesc based on an input FeedParams struct

func (*FeedDesc) CreateFilePCAPReader added in v0.1.0

func (fdp *FeedDesc) CreateFilePCAPReader(evtMgr *evtm.EventManager) *filePCAPReader

CreateFilePCAPReader is a constructor of a struct that holds system variables used to read packets, and keep track of the number of packets read from a file. It is a method for the FeedDesc struct that holds configuration information about the packet feed.

func (*FeedDesc) CreateSocketPCAPReader added in v0.1.0

func (fdp *FeedDesc) CreateSocketPCAPReader(evtMgr *evtm.EventManager, isUnix bool) *socketPCAPReader

CreateSocketPCAPReader is a constructor of a struct that holds system variables used to read packets, and keep track of the number of packets read from a socket. It is a method for the FeedDesc struct that holds configuration information about the packet feed.

type FeedParamSlice added in v0.1.0

type FeedParamSlice []FeedParams

FeedParamSlice holds a list of FeedParams structs

type FeedParams added in v0.1.0

type FeedParams struct {
	Active   int32   `json:"active" yaml:"active"`
	Dilation float64 `json:"dilation" yaml:"dilation"`
	Name     string  `json:"name" yaml:"name"`
	SrcSpec  string  `json:"srcspec" yaml:"srcspec"`
	SrcType  string  `json:"srctype" yaml:"srctype"`
	Start    float64 `json:"start" yaml:"start"`
	Time     string  `json:"time" yaml:"time"`
}

FeedParams holds characteristics of a feed, is read in from an input yaml file

type Flow added in v0.0.22

type Flow struct {
	ExecID        int
	FlowID        int
	ConnectID     int
	Number        int
	Name          string
	Mode          string
	FlowModel     string
	Elastic       bool
	Pckt          bool
	Src           string
	Dst           string
	FrameSize     int
	SrcID         int
	DstID         int
	Groups        []string
	RequestedRate float64
	AcceptedRate  float64
	RtnDesc       RtnDesc
	Suspended     bool
	Pushes        int
	StrmPckts     int
	Origin        string
}

func CreateFlow added in v0.0.22

func CreateFlow(name string, srcDev string, dstDev string,
	requestRate float64, frameSize int, mode string, execID int, groups []string) *Flow

func (*Flow) ChangeRate added in v0.0.22

func (bgf *Flow) ChangeRate(evtMgr *evtm.EventManager, requestRate float64) bool

func (*Flow) LogNetEvent added in v0.0.22

func (bgf *Flow) LogNetEvent(time vrtime.Time, msg *NetworkMsg, desc string)

func (*Flow) RmFlow added in v0.0.22

func (bgf *Flow) RmFlow(evtMgr *evtm.EventManager, context any, hdlr evtm.EventHandlerFunction)

func (*Flow) StartFlow added in v0.0.22

func (bgf *Flow) StartFlow(evtMgr *evtm.EventManager, rtns RtnDescs) bool

StartFlow is scheduled the beginning of the flow

type FlowAction added in v0.0.15

type FlowAction int

FlowAction describes the reason for the flow message, that it is starting, ending, or changing the request rate

const (
	None FlowAction = iota
	Srt
	Chg
	End
)

type FlowDesc added in v0.0.22

type FlowDesc struct {
	// Name is unique string identifier used to reference the flow
	Name      string   `json:"name" yaml:"name"`
	SrcDev    string   `json:"srcdev"  yaml:"srcdev"`
	DstDev    string   `json:"dstdev"  yaml:"dstdev"`
	Mode      string   `json:"mode"    yaml:"mode"`
	ReqRate   float64  `json:"reqrate" yaml:"reqrate"`
	FrameSize int      `json:"framesize" yaml:"framesize"`
	Groups    []string `json:"groups" yaml:"groups"`
}

FlowDesc describes parameters of a Router in the topology.

type FlowDescSlice added in v0.0.22

type FlowDescSlice []FlowDesc

type FlowFrame added in v0.0.22

type FlowFrame struct {
	Name      string   `json:"name" yaml:"name"`
	SrcDev    string   `json:"srcdev"  yaml:"srcdev"`
	DstDev    string   `json:"dstdev"  yaml:"dstdev"`
	Mode      string   `json:"mode"    yaml:"mode"`
	ReqRate   float64  `json:"reqrate" yaml:"reqrate"`
	FrameSize int      `json:"framesize" yaml:"framesize"`
	Groups    []string `json:"groups" yaml:"groups"`
}

FlowFrame describes parameters of a Router in the topology in pre-serialized form

func CreateFlowFrame added in v0.0.22

func CreateFlowFrame(name, srcDev, dstDev, mode string, reqRate float64, frameSize int) *FlowFrame

CreateFlowFrame is a constructor, stores (possibly creates default) name

func (*FlowFrame) AddGroup added in v0.0.22

func (ff *FlowFrame) AddGroup(groupName string)

AddGroup includes a group name to the router

func (*FlowFrame) DevAddIntrfc added in v0.0.22

func (ff *FlowFrame) DevAddIntrfc(iff *IntrfcFrame) error

DevAddIntrfc includes an IntrfcFrame to the NetDevice

func (*FlowFrame) DevID added in v0.0.22

func (ff *FlowFrame) DevID() string

DevID returns a unique identifier for the NetDevice

func (*FlowFrame) DevInterfaces added in v0.0.22

func (ff *FlowFrame) DevInterfaces() []*IntrfcFrame

DevInterfaces returns the slice of IntrfcFrame held by the NetDevice, if any

func (*FlowFrame) DevModel added in v0.0.22

func (ff *FlowFrame) DevModel() string

DevModel returns the NetDevice model code, if any

func (*FlowFrame) DevName added in v0.0.22

func (ff *FlowFrame) DevName() string

DevName returns the name of the NetDevice

func (*FlowFrame) DevType added in v0.0.22

func (ff *FlowFrame) DevType() string

DevType returns network objec type (e.g., "Switch", "Router", "Endpt", "Network") for the NetDevice

func (*FlowFrame) Transform added in v0.0.22

func (ff *FlowFrame) Transform() FlowDesc

Transform returns a serializable Flow, transformed from a FlowFrame.

type FlowSrcType added in v0.0.22

type FlowSrcType int

type FuncMethod added in v0.1.2

type FuncMethod func(TopoDev, string, *NetworkMsg, float64) float64

type Graph added in v0.1.6

type Graph [][]Edge

there will be two graphs, each a mapping from node id to list of nodes it reaches

type IPHdr added in v0.1.0

type IPHdr struct {
	SrcIP   string
	DstIP   string
	SrcPort int
	DstPort int
}

type IPMap added in v0.1.0

type IPMap struct {
	Devices  DeviceIPSlice    `json:"devices" yaml:"devices"`
	Networks NetworkCIDRSlice `json:"networks" yaml:"networks"`
	Feeds    FeedParamSlice   `json:"feeds" yaml:"feeds"`
}

IPMap is a structure holding lists of devices, networks, and feeds. Is intialized by reading in an input file ipmap.yaml (typically)

func CreateIPMap added in v0.1.0

func CreateIPMap() *IPMap

CreateIPMap is a constructor.

func ReadIPMap added in v0.1.0

func ReadIPMap(filename string, useYAML bool, dict []byte) (*IPMap, error)

ReadIPMap deserializes a byte slice holding a representation of an IPMap struct. If the input argument of dict (those bytes) is empty, the file whose name is given is read to acquire them. A deserialized representation is returned, or an error if one is generated from a file read or the deserialization.

func (*IPMap) AddDeviceIP added in v0.1.0

func (ipm *IPMap) AddDeviceIP(device, intIP, extIP, network string)

AddDeviceIP can be used if the ipmap table is being built by code rather than being read in from file

func (*IPMap) AddNetworkCIDR added in v0.1.0

func (ipm *IPMap) AddNetworkCIDR(network, intCIDR, extCIDR string)

AddNetworkCIDR can be used if the ipmap table is being built by code rather than being read in

func (*IPMap) WriteToFile added in v0.1.0

func (ipm *IPMap) WriteToFile(filename string) error

WriteToFile stores the IPMap struct to the file whose name is given. Serialization to json or to yaml is selected based on the extension of this name.

type IPTables added in v0.1.0

type IPTables struct {
	NameByIntIP      map[string]string // given an internal IP address, yield the name of the device whose interface holds it
	NameByExtIP      map[string]string // given an external IP address, yield the name of the device whose interface holds it
	NameByIntCIDR    map[string]string // given an internal CIDR code, yield the name of the network mapped to that code
	NameByExtCIDR    map[string]string // given an external CIDR code, yield the name of the network mapped to that code
	IntIPByExtIP     map[string]string // given an external IP address, yield the internal IP address it maps to
	ExtIPByIntIP     map[string]string // given an external IP address, yield the internal IP address it maps to
	IntCIDRByExtCIDR map[string]string // given an extern CIDR address, yield the internal CIDR address it maps to
}

IPTables holds dictionaries that connect references to IP and CIDR addresses from external space to simulation space, and to simulation objects

type IntrfcDesc

type IntrfcDesc struct {
	// name for interface, unique among interfaces on endpting device.
	Name string `json:"name" yaml:"name"`

	Groups []string `json:"groups" yaml:"groups"`

	// type of device that is home to this interface, i.e., "Endpt", "Switch", "Router"
	DevType string `json:"devtype" yaml:"devtype"`

	// whether media used by interface is 'wired' or 'wireless' .... could put other kinds here, e.g., short-wave, satellite
	MediaType string `json:"mediatype" yaml:"mediatype"`

	// name of endpt, switch, or router on which this interface is resident
	Device string `json:"device" yaml:"device"`

	// name of interface (on a different device) to which this interface is directly (and singularly) connected
	Cable string `json:"cable" yaml:"cable"`

	// name of interface (on a different device) to which this interface is directly (and singularly) carried if wired and not on Cable
	Carry []string `json:"carry" yaml:"carry"`

	// list of names of interface (on a different device) to which this interface is connected through wireless
	Wireless []string `json:"wireless" yaml:"wireless"`

	// name of the network the interface connects to. There is a tacit assumption then that interface reaches routers on the network
	Faces string `json:"faces" yaml:"faces"`
}

IntrfcDesc defines a serializable description of a network interface

type IntrfcFrame

type IntrfcFrame struct {
	// name for interface, unique among interfaces on endpting device.
	Name string

	Groups []string

	// type of device that is home to this interface, i.e., "Endpt", "Switch", "Router"
	DevType string

	// whether media used by interface is 'wired' or 'wireless' .... could put other kinds here, e.g., short-wave, satellite
	MediaType string

	// name of endpt, switch, or router on which this interface is resident
	Device string

	// pointer to interface (on a different device) to which this interface is directly (and singularly) connected.
	// this interface and the one pointed to need to have media type "wired"
	Cable *IntrfcFrame

	// pointer to interface (on a different device) to which this interface is directly if wired and not Cable.
	// this interface and the one pointed to need to have media type "wired", and have "Cable" be empty
	Carry []*IntrfcFrame

	// A wireless interface may connect to may devices, this slice points to those that can be reached
	Wireless []*IntrfcFrame

	// name of the network the interface connects to. We do not require that the media type of the interface be the same
	// as the media type of the network.
	Faces string
}

IntrfcFrame gives a pre-serializable description of an interface, used in model construction. 'Almost' the same as IntrfcDesc, with the exception of one pointer

func CreateIntrfc

func CreateIntrfc(device, name, devType, mediaType, faces string) *IntrfcFrame

CreateIntrfc is a constructor for IntrfcFrame that fills in most of the attributes except Cable. Arguments name the device holding the interface and its type, the type of communication fabric the interface uses, and the name of the network the interface connects to

func (*IntrfcFrame) AddGroup

func (ifcf *IntrfcFrame) AddGroup(groupName string)

func (*IntrfcFrame) Transform

func (ifcf *IntrfcFrame) Transform() IntrfcDesc

Transform converts an IntrfcFrame and returns an IntrfcDesc, for serialization.

type IntrfcTrace added in v0.0.15

type IntrfcTrace struct {
	Time   float64
	ObjID  int
	ExecID int
	MsgID  int
	Op     string
	CQ     string
}

func (*IntrfcTrace) Serialize added in v0.0.15

func (it *IntrfcTrace) Serialize() string

type Item added in v0.1.6

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

Prioirty queue stuff

type MrnesApp

type MrnesApp interface {

	// a globally unique name for the application
	GlobalName() string

	// an event handler to call to present a message to an app
	ArrivalFunc() evtm.EventHandlerFunction
}

MrnesApp is infrastructure for inter-func addressing (including x-compPattern addressing)

type NameType

type NameType struct {
	Name string
	Type string
}

NameType is a an entry in a dictionary created for a trace that maps object id numbers to a (name,type) pair

type NetDevice

type NetDevice interface {
	DevName() string                 // returns the .Name field of the struct
	DevID() string                   // returns a unique (string) identifier for the struct
	DevType() string                 // returns the type ("Switch","Router","Endpt","Network")
	DevInterfaces() []*IntrfcFrame   // list of interfaces attached to the NetDevice, if any
	DevAddIntrfc(*IntrfcFrame) error // function to add another interface to the netDevic3
}

The NetDevice interface lets us use common code when network objects (endpt, switch, router, network, flow) are involved in model construction.

type NetMsgIDs added in v0.0.15

type NetMsgIDs struct {
	ExecID    int // execution id, from application
	FlowID    int // flow id
	ConnectID int // connection id
}

NetMsgIDs holds four identifies that may be associated with a flow. ExecID comes from the application layer and may tie together numbers of communications that occur moving application layer messages between endpoints. FlowID refer to a flow identity, although the specific value given is created at the application layer (as are the flow themselves). ConnectID is created at the mrnes layer, describes a single source-to-destination message transfer

type NetTrace added in v0.0.15

type NetTrace struct {
	Time      float64 // time in float64
	Ticks     int64   // ticks variable of time
	Priority  int64   // priority field of time-stamp
	FlowID    int     // integer identifier identifying the chain of traces this is part of
	ExecID    int
	ConnectID int    // integer identifier of the network connection
	ObjID     int    // integer id for object being referenced
	Op        string // "start", "stop", "enter", "exit"
	PcktIdx   int    // packet index inside of a multi-packet message
	Packet    bool   // true if the event marks the passage of a packet (rather than flow)
	MsgType   string
	Rate      float64 // rate associated with the connection
}

NetTrace saves information about the visitation of a message to some point in the simulation. saved for post-run analysis

func (*NetTrace) Serialize added in v0.0.15

func (ntr *NetTrace) Serialize() string

func (*NetTrace) TraceType added in v0.0.15

func (ntr *NetTrace) TraceType() TraceRecordType

type NetworkCIDR added in v0.1.0

type NetworkCIDR struct {
	Network string `json:"network" yaml:"network"`
	IntCIDR string `json:"intCIDR" yaml:"intCIDR"`
	ExtCIDR string `json:"extCIDR" yaml:"extCIDR"`
}

NetworkCIDR describes the CIDR inforation for a network whoe name is given

type NetworkCIDRSlice added in v0.1.0

type NetworkCIDRSlice []NetworkCIDR

NetworkCIDRSlice holds a list of NetworkCIDR structs

type NetworkDesc

type NetworkDesc struct {
	Name      string   `json:"name" yaml:"name"`
	Groups    []string `json:"groups" yaml:"groups"`
	NetScale  string   `json:"netscale" yaml:"netscale"`
	MediaType string   `json:"mediatype" yaml:"mediatype"`
	Endpts    []string `json:"endpts" yaml:"endpts"`
	Routers   []string `json:"routers" yaml:"routers"`
	Switches  []string `json:"switches" yaml:"switches"`
}

NetworkDesc is a serializable version of the Network information, where the pointers to routers, and switches are replaced by the string names of those entities

type NetworkDescSlice

type NetworkDescSlice []NetworkDesc

type NetworkFrame

type NetworkFrame struct {
	// Name is a unique name across all objects in the simulation. It is used universally to reference this network
	Name string

	Groups []string

	// NetScale describes role of network, e.g., LAN, WAN, T3, T2, T1.  Used as an attribute when doing experimental configuration
	NetScale string

	// for now the network is either "wired" or "wireless"
	MediaType string

	// any router with an interface that faces this network is in this list
	Routers []*RouterFrame

	// any endpt with an interface that faces this network is in this list
	Endpts []*EndptFrame

	// any endpt with an interface that faces this network is in this list
	Switches []*SwitchFrame
}

A NetworkFrame holds the attributes of a network during the model construction phase

func CreateNetwork

func CreateNetwork(name, NetScale string, MediaType string) *NetworkFrame

CreateNetwork is a constructor, with all the inherent attributes specified

func (*NetworkFrame) AddGroup

func (nf *NetworkFrame) AddGroup(groupName string)

AddGroup appends a group name to the network frame list of groups, checking first whether it is already present in the list

func (*NetworkFrame) AddRouter

func (nf *NetworkFrame) AddRouter(rtrf *RouterFrame) error

AddRouter includes the argument router into the network,

func (*NetworkFrame) AddSwitch

func (nf *NetworkFrame) AddSwitch(swtch *SwitchFrame) error

AddSwitch includes the argument router into the network, throws an error if already present

func (*NetworkFrame) FacedBy

func (nf *NetworkFrame) FacedBy(dev NetDevice) bool

FacedBy determines whether the device offered as an input argument has an interface whose 'Faces' component references this network

func (*NetworkFrame) IncludeDev

func (nf *NetworkFrame) IncludeDev(dev NetDevice, mediaType string, chkIntrfc bool) error

IncludeDev makes sure that the network device being offered

a) has an interface facing the network
b) is included in the network's list of those kind of devices

func (*NetworkFrame) Transform

func (nf *NetworkFrame) Transform() NetworkDesc

Transform converts a network frame into a network description. It copies string attributes, and converts pointers to routers, and switches to strings with the names of those entities

type NetworkMedia added in v0.0.15

type NetworkMedia int

NetworkMedia is the base type for an enumerated type of comm network media

const (
	Wired NetworkMedia = iota
	Wireless
	UnknownMedia
)

func NetMediaFromStr added in v0.0.15

func NetMediaFromStr(media string) NetworkMedia

NetMediaFromStr returns the networkMedia type corresponding to the input string name

type NetworkMsg added in v0.0.15

type NetworkMsg struct {
	MsgID      int             // ID created message is delivered to network
	MsrID      int             // measure identity ID from message delivered to network
	StepIdx    int             // position within the route from source to destination
	Route      *[]intrfcsToDev // pointer to description of route
	DstIP      string
	SrcIP      string
	DstPort    int
	SrcPort    int
	Connection ConnDesc // {DiscreteConn, MajorFlowConn, MinorFlowConn}
	ExecID     int
	FlowID     int               // flow id given by app at entry
	FeedID     int               // feed id given by app at entry
	ConnectID  int               // connection identifier
	NetMsgType NetworkMsgType    // enum type packet,
	PcktRate   float64           // rate rom source
	Rate       float64           // flow rate if FlowID >0 (meaning a flow)
	Syncd      []int             // IDs of flows with which this message has synchronized
	StartTime  float64           // simuation time when the message entered the network
	PrArrvl    float64           // probablity of arrival
	MsgLen     int               // length of the entire message, in bytes
	PcktIdx    int               // index of packet with msg
	NumPckts   int               // number of packets in the message this is part of
	MetaData   map[string]string // carrier of extra stuff
	Msg        any               // message being carried.

	StrmPckt bool
	// contains filtered or unexported fields
}

The NetworkMsg type creates a wrapper for a message between comp pattern funcs. One value (StepIdx) indexes into a list of route steps, so that by incrementing we can find 'the next' step in the route. One value is a pointer to this route list, and the final value is a pointe to an inter-func comp pattern message.

type NetworkMsgType added in v0.0.15

type NetworkMsgType int

NetworkMsgType give enumeration for message types that may be given to the network to carry. packet is a discrete packet, handled differently from flows. srtFlow tags a message that introduces a new flow, endFlow tags one that terminates it, and chgFlow tags a message that alters the flow rate on a given flow.

const (
	PacketType NetworkMsgType = iota
	FlowType
)

type NetworkPortal

type NetworkPortal struct {
	QkNetSim       bool
	ReturnTo       map[int]*rtnRecord // indexed by connectID
	LossRtn        map[int]*rtnRecord // indexed by connectID
	ReportRtnSrc   map[int]*rtnRecord // indexed by connectID
	ReportRtnDst   map[int]*rtnRecord // indexed by connectID
	IPHdr          map[int]IPHdr
	RequestRate    map[int]float64           // indexed by flowID to get requested arrival rate
	AcceptedRate   map[int]float64           // indexed by flowID to get accepted arrival rate
	Mode           map[int]string            // indexed by flowID to record mode of flow
	Elastic        map[int]bool              // indexed by flowID to record whether flow is elastic
	Pckt           map[int]bool              // indexed by flowID to record whether flow is packet
	InvConnection  map[int]int               // indexed by flowID to get connectID
	LatencyConsts  map[int]float64           // indexex by flowID to get latency constants on flow's route
	IPToName       *IPTables                 // description of assignment of IP addresses and CIDR blocks
	ExternEntry    evtm.EventHandlerFunction // function to call on receipt of a packet from the exterior
	CopyMetaData   func(*NetworkMsg)         // function to call to copy meta on network traffic re-entering application layer
	NumExecThreads int
}

NetworkPortal implements the pces interface used to pass traffic between the application layer and the network sim

var ActivePortal *NetworkPortal

ActivePortal remembers the most recent NetworkPortal created (there should be only one call to CreateNetworkPortal...)

func CreateNetworkPortal

func CreateNetworkPortal() *NetworkPortal

CreateNetworkPortal is a constructor, passed a flag indicating which of two network simulation modes to use, passes a flag indicating whether packets should be passed whole, and writes the NetworkPortal pointer into a global variable

func (*NetworkPortal) Arrive

func (np *NetworkPortal) Arrive(rtns RtnDescs, frames int) int

Arrive is called at the point an application message is received by the network and a new connectID is created (and returned) to track it. It saves information needed to re-integrate the application message into the application layer when the message arrives at its destination

func (*NetworkPortal) ClearRmFlow added in v0.0.15

func (np *NetworkPortal) ClearRmFlow(flowID int)

ClearRmFlow removes entries from maps indexed by flowID and associated connectID, to help clean up space

func (*NetworkPortal) ComputeFlowLatency added in v0.0.15

func (np *NetworkPortal) ComputeFlowLatency(nm *NetworkMsg) float64

ComputeFlowLatency approximates the latency from source to destination if compute now, with the state of the network frozen and no packets queued up

func (*NetworkPortal) Depart

func (np *NetworkPortal) Depart(evtMgr *evtm.EventManager, devName string, nm *NetworkMsg)

Depart is called to return an application message being carried through the network back to the application layer

func (*NetworkPortal) DiscoverFlowRate added in v0.0.15

func (np *NetworkPortal) DiscoverFlowRate(flowID int,
	requestRate float64, route *[]intrfcsToDev) (float64, bool)

DiscoverFlowRate is called after the infrastructure for new flow with ID flowID is set up, to determine what its rate will be

func (*NetworkPortal) EndptDevModel added in v0.0.16

func (np *NetworkPortal) EndptDevModel(devName string, accelName string) string

EndptDevModel helps NetworkPortal implement the pces NetworkPortal interface, returning the CPU model associated with a named endpt. Present because the application layer does not otherwise have visibility into the network topology

func (*NetworkPortal) EnterNetwork

func (np *NetworkPortal) EnterNetwork(evtMgr *evtm.EventManager, srcDev, dstDev string, msgLen int,
	connDesc *ConnDesc, IDs NetMsgIDs, rtns RtnDescs, ipHdr *IPHdr,
	requestRate float64, msrID int, strmPckt bool, strmPcktID int, msg any, meta map[string]string) (int, float64, bool)

EnterNetwork is called after the execution from the application layer It creates NetworkMsg structs to represent the start and end of the message, and schedules their arrival to the egress interface of the message source endpt

Two kinds of traffic may enter the network, Flow and Discrete Entries for a flow may establish a new one, modify an existing one, or delete existing ones. Messages that notify destinations of these actions may be delivered instantly, may be delivered using an estimate of the cross-network latency which depends on queueing network approximations, or may be pushed through the network as individual packets, simulated at each network device.

input connType is one of {Flow, Discrete}

flowAction is one of {Srt, End, Chg}
connLatency is one of {Zero, Place, Simulate}

We approximate the time required for a packet to pass through an interface or network is a transition constant plus the mean time in an M/D/1 queuing system. The arrivals are packets whose length is the frame size, the deterministic service time D is time required to serve a packet with a server whose bit service rate is the bandwidth available at the interface or network to serve (meaning the total capacity minus the bandwidth allocations to other flows at that interface or network), and the arrival rate is the accepted rate allocated to the flow.

Description of possible input parameters

| Message | connType | flowAction | connLatency | flowID | --------------- | ------------- | ------------- | --------------------- | ----------------------- | | Discrete Packet | DiscreteConn | N/A | Zero, Place, Simulate | >0 => embedded | | Flow | FlowConn | Srt, Chg, End | Zero, Place, Simulate | flowID>0 |

func (*NetworkPortal) EstablishFlowRate added in v0.0.15

func (np *NetworkPortal) EstablishFlowRate(evtMgr *evtm.EventManager, flowID int,
	requestRate float64, route *[]intrfcsToDev, action FlowAction) (map[int]bool, bool)

EstablishFlowRate is given a major flow ID, request rate, and a route, and then first figures out what the accepted rate can be given the current state of all the major flows (by calling DiscoverFlowRate). It follows up by calling SetFlowRate to establish that rate through the route for the named flow. Because of congestion, it may be that setting the rate may force recalculation of the rates for other major flows, and so SetFlowRate returns a map of flows to be revisited, and upper bounds on what their accept rates might be. This leads to a recursive call to EstabishFlowRate

func (*NetworkPortal) FlowEntry added in v0.0.15

func (np *NetworkPortal) FlowEntry(evtMgr *evtm.EventManager, srcDev, dstDev string, msgLen int,
	connDesc *ConnDesc, flowID int, connectID int,
	requestRate float64, route *[]intrfcsToDev, msg any) bool

FlowEntry handles the entry of flows to the network

func (*NetworkPortal) NewExecID added in v0.1.0

func (np *NetworkPortal) NewExecID() int

func (*NetworkPortal) PlaceNetMsg added in v0.0.15

func (np *NetworkPortal) PlaceNetMsg(evtMgr *evtm.EventManager, nm *NetworkMsg, offset float64)

PlaceNetMsg schedules the receipt of the message some deterministic time in the future, without going through the details of the intervening network structure

func (*NetworkPortal) ReportFlowChg added in v0.0.15

func (np *NetworkPortal) ReportFlowChg(evtMgr *evtm.EventManager, flowID int,
	action FlowAction, latency float64)

ReportFlowChg visits the return record maps to see if the named flow asked to have changes reported, and if so does so as requested. The reports are schedule to occur 'latency' time in the future, when the effect of the triggered action is recognized at the triggering flow's receiving end.

func (*NetworkPortal) RmFlow added in v0.0.15

func (np *NetworkPortal) RmFlow(evtMgr *evtm.EventManager, rmflowID int,
	route *[]intrfcsToDev, latency float64)

RmFlow de-establishes data structures in the interfaces and networks crossed by the given route, with a flow having the given flowID

func (*NetworkPortal) SendImmediate added in v0.0.15

func (np *NetworkPortal) SendImmediate(evtMgr *evtm.EventManager, nm *NetworkMsg)

SendImmediate schedules the message with zero latency

func (*NetworkPortal) SendNetMsg added in v0.0.15

func (np *NetworkPortal) SendNetMsg(evtMgr *evtm.EventManager, nm *NetworkMsg, offset float64)

SendNetMsg moves a NetworkMsg, depending on the latency model. If 'Zero' the message goes to the destination instantly, with zero network latency modeled If 'Place' the message is placed at the destinatin after computing a delay timing through the network If 'Simulate' the message is placed at the egress port of the sending device and the message is simulated going through the network to its destination

func (*NetworkPortal) SetFlowRate added in v0.0.15

func (np *NetworkPortal) SetFlowRate(evtMgr *evtm.EventManager, flowID int, acceptRate float64,
	route *[]intrfcsToDev, action FlowAction) map[int]float64

SetFlowRate sets the accept rate for major flow flowID all along its path, and notes the identities of major flows which need attention because this change may impact them or other flows they interact with

func (*NetworkPortal) SetQkNetSim

func (np *NetworkPortal) SetQkNetSim(quick bool)

SetQkNetSim saves the argument as indicating whether latencies should be computed as 'Placed', meaning constant, given the state of the network at the time of computation

type NetworkScale added in v0.0.15

type NetworkScale int

NetworkScale is the base type for an enumerated type of network type descriptions

const (
	LAN NetworkScale = iota
	WAN
	T3
	T2
	T1
	External
	GeneralNet
)

func NetScaleFromStr added in v0.0.15

func NetScaleFromStr(netScale string) NetworkScale

NetScaleFromStr returns the networkScale corresponding to an string name for it

type OpMethod added in v0.0.26

type OpMethod func(TopoDev, string, *NetworkMsg) float64

type PriorityQueue added in v0.1.6

type PriorityQueue []Item

func (PriorityQueue) Len added in v0.1.6

func (pq PriorityQueue) Len() int

func (PriorityQueue) Less added in v0.1.6

func (pq PriorityQueue) Less(i, j int) bool

the tie-breaker on Less assures determinism in selection of min-cost route when there are multiple choices possible. The id2hash dictionary gives access to unique ids for the graph nodes that will not change in multiple runs with the same topology.

func (PriorityQueue) MinDist added in v0.1.6

func (pq PriorityQueue) MinDist() int64

func (*PriorityQueue) Pop added in v0.1.6

func (pq *PriorityQueue) Pop() any

func (*PriorityQueue) Push added in v0.1.6

func (pq *PriorityQueue) Push(x any)

func (PriorityQueue) Swap added in v0.1.6

func (pq PriorityQueue) Swap(i, j int)

type RouterDesc

type RouterDesc struct {
	// Name is unique string identifier used to reference the router
	Name string `json:"name" yaml:"name"`

	Groups []string `json:"groups" yaml:"groups"`

	// Model is an attribute like "Cisco 6400". Used primarily in run-time configuration
	Model string `json:"model" yaml:"model"`

	// list of names interfaces that describe the ports of the router
	Interfaces []IntrfcDesc `json:"interfaces" yaml:"interfaces"`
}

RouterDesc describes parameters of a Router in the topology.

type RouterFrame

type RouterFrame struct {
	Name       string // identical to RouterDesc attribute
	Groups     []string
	Model      string         // identifical to RouterDesc attribute
	Interfaces []*IntrfcFrame // list of interface frames that describe the ports of the router
}

RouterFrame describes parameters of a Router in the topology in pre-serialized form

func ConnectNetworks

func ConnectNetworks(net1, net2 *NetworkFrame, newRtr bool) (*RouterFrame, error)

ConnectNetworks creates router that enables traffic to pass between the two argument networks. 'newRtr' input variable governs whether a new router is absolutely created (allowing for multiple connections), or only if there is no existing connection

func CreateRouter

func CreateRouter(name, model string) *RouterFrame

CreateRouter is a constructor, stores (possibly creates default) name, initializes slice of interface frames

func (*RouterFrame) AddGroup

func (rf *RouterFrame) AddGroup(groupName string)

AddGroup includes a group name to the router

func (*RouterFrame) AddIntrfc

func (rf *RouterFrame) AddIntrfc(intrfc *IntrfcFrame) error

AddIntrfc includes interface frame in router frame

func (*RouterFrame) DevAddIntrfc

func (rf *RouterFrame) DevAddIntrfc(iff *IntrfcFrame) error

DevAddIntrfc includes an IntrfcFrame to the NetDevice

func (*RouterFrame) DevID

func (rf *RouterFrame) DevID() string

DevID returns a unique identifier for the NetDevice

func (*RouterFrame) DevInterfaces

func (rf *RouterFrame) DevInterfaces() []*IntrfcFrame

DevInterfaces returns the slice of IntrfcFrame held by the NetDevice, if any

func (*RouterFrame) DevModel

func (rf *RouterFrame) DevModel() string

DevModel returns the NetDevice model code, if any

func (*RouterFrame) DevName

func (rf *RouterFrame) DevName() string

DevName returns the name of the NetDevice

func (*RouterFrame) DevType

func (rf *RouterFrame) DevType() string

DevType returns network objec type (e.g., "Switch", "Router", "Endpt", "Network") for the NetDevice

func (*RouterFrame) Transform

func (rf *RouterFrame) Transform() RouterDesc

Transform returns a serializable RouterDesc, transformed from a RouterFrame.

func (*RouterFrame) WirelessConnectTo

func (rf *RouterFrame) WirelessConnectTo(dev NetDevice, faces string) error

WirelessConnectTo establishes a wireless connection (creating interfaces if needed) between a hub and a device

type RprtRate added in v0.0.15

type RprtRate struct {
	FlowID       int
	MbrID        int
	AcceptedRate float64
	Action       FlowAction
}

RprtRate is the structure of a message that is scheduled for delivery as part of a 'Report' made when a flow rate changes or a packet is lost

type RtnDesc added in v0.0.15

type RtnDesc struct {
	Cxt     any
	EvtHdlr evtm.EventHandlerFunction
}

RtnDesc holds the context and event handler for scheduling a return

type RtnDescs added in v0.0.15

type RtnDescs struct {
	Rtn  *RtnDesc
	Src  *RtnDesc
	Dst  *RtnDesc
	Loss *RtnDesc
}

RtnDescs hold four RtnDesc structures, for four different use scenarios. Bundling in a struct makes code that uses them all more readable at the function call interface

type RtnMsgStruct added in v0.0.5

type RtnMsgStruct struct {
	Latency float64 // span of time (secs) from srcDev to dstDev
	Rate    float64 // for a flow, its accept rate.  For a packet, the minimum non-flow bandwidth at a
	// network or interface it encountered
	PrLoss float64     // estimated probability of having been dropped somewhere in transit
	DevIDs []int       // list of ids of devices visited on transition of network
	NetMsg *NetworkMsg // network message that trigger the return
	Msg    any         // msg introduced at EnterNetwork
}

RtnMsgStruct formats the report passed from the network to the application calling it

type RtrDescSlice

type RtrDescSlice []RouterDesc

type SchedulerTrace added in v0.0.15

type SchedulerTrace struct {
	Time      float64
	ObjID     int
	ExecID    int
	Op        string
	Cores     int
	Inservice int
	Inbckgrnd int
	Waiting   int
}

func (*SchedulerTrace) Serialize added in v0.0.15

func (st *SchedulerTrace) Serialize() string

type ShortIntrfc added in v0.0.10

type ShortIntrfc struct {
	DevName     string
	Faces       string
	ToIngress   float64
	ThruIngress float64
	ToEgress    float64
	ThruEgress  float64
	FlowID      int
	NetMsgType  NetworkMsgType
	NetMsgID    int
	Rate        float64
	PrArrvl     float64
	Time        float64
}

ShortIntrfc stores information we serialize for storage in a trace

func (*ShortIntrfc) Serialize added in v0.0.10

func (sis *ShortIntrfc) Serialize() string

Serialize turns a ShortIntrfc into a string, in yaml format

type SwitchDesc

type SwitchDesc struct {
	Name       string       `json:"name" yaml:"name"`
	Groups     []string     `json:"groups" yaml:"groups"`
	Model      string       `json:"model" yaml:"model"`
	Interfaces []IntrfcDesc `json:"interfaces" yaml:"interfaces"`
}

SwitchDesc holds a serializable representation of a switch.

type SwitchDescSlice

type SwitchDescSlice []SwitchDesc

type SwitchFrame

type SwitchFrame struct {
	Name       string // unique string identifier used to reference the router
	Groups     []string
	Model      string         // device model identifier
	Interfaces []*IntrfcFrame // interface frames that describe the ports of the router
}

SwitchFrame holds a pre-serialization representation of a Switch

func CreateBridge added in v0.0.15

func CreateBridge(name, model string) *SwitchFrame

CreateBridge constructs a switch frame tagged as being a hub

func CreateHub added in v0.0.15

func CreateHub(name, model string) *SwitchFrame

CreateHub constructs a switch frame tagged as being a hub

func CreateRepeater added in v0.0.15

func CreateRepeater(name, model string) *SwitchFrame

CreateRepeater constructs a switch frame tagged as being a repeater

func CreateSwitch

func CreateSwitch(name, model string) *SwitchFrame

CreateSwitch constructs a switch frame. Saves (and possibly creates) the switch name,

func (*SwitchFrame) AddGroup

func (sf *SwitchFrame) AddGroup(groupName string)

AddGroup adds a group to a switch's list of groups, if not already present in that list

func (*SwitchFrame) AddIntrfc

func (sf *SwitchFrame) AddIntrfc(iff *IntrfcFrame) error

AddIntrfc includes a new interface frame for the switch. Error is returned if the interface (or one with the same name) is already attached to the SwitchFrame

func (*SwitchFrame) DevAddIntrfc

func (sf *SwitchFrame) DevAddIntrfc(iff *IntrfcFrame) error

DevAddIntrfc adds an IntrfcFrame to the NetDevice

func (*SwitchFrame) DevID

func (sf *SwitchFrame) DevID() string

DevID returns unique identifier for NetDevice

func (*SwitchFrame) DevInterfaces

func (sf *SwitchFrame) DevInterfaces() []*IntrfcFrame

DevInterfaces returns list of IntrfcFrames attached to the NetDevice, if any

func (*SwitchFrame) DevName

func (sf *SwitchFrame) DevName() string

DevName returns name for the NetDevice

func (*SwitchFrame) DevType

func (sf *SwitchFrame) DevType() string

DevType returns the type of the NetDevice (e.g. "Switch","Router","Endpt","Network")

func (*SwitchFrame) Transform

func (sf *SwitchFrame) Transform() SwitchDesc

Transform returns a serializable SwitchDesc, transformed from a SwitchFrame.

type Task

type Task struct {
	OpType string // what operation is being performed

	Msg any // information package being carried
	// contains filtered or unexported fields
}

Task describes the service requirements of an operation on a msg

type TaskScheduler

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

TaskScheduler holds data structures supporting the multi-core scheduling

func CreateTaskScheduler

func CreateTaskScheduler(cores int) *TaskScheduler

CreateTaskScheduler is a constructor

func (*TaskScheduler) Schedule

func (ts *TaskScheduler) Schedule(evtMgr *evtm.EventManager, op string, req float64, pri int, timeslice float64,
	context any, msg any, execID, objID int, complete evtm.EventHandlerFunction) bool

Schedule puts a piece of work either in queue to be done, or in service. Parameters are - op : a code for the type of work being done - req : the service requirements for this task, on this computer - ts : timeslice, the amount of service the task gets before yielding - msg : the message being processed - complete : an event handler to be called when the task has completed The return is true if the 'task is finished' event was scheduled.

type TopoCfg

type TopoCfg struct {
	Name     string           `json:"name" yaml:"name"`
	Networks NetworkDescSlice `json:"networks" yaml:"networks"`
	Routers  RtrDescSlice     `json:"routers" yaml:"routers"`
	Endpts   EndptDescSlice   `json:"endpts" yaml:"endpts"`
	Switches SwitchDescSlice  `json:"switches" yaml:"switches"`
	Flows    FlowDescSlice    `json:"flows" yaml:"flows"`
}

TopoCfg contains all of the networks, routers, and endpts, as they are listed in the json file.

func ReadTopoCfg

func ReadTopoCfg(topoFileName string, useYAML bool, dict []byte) (*TopoCfg, error)

ReadTopoCfg deserializes a slice of bytes into a TopoCfg. If the input arg of bytes is empty, the file whose name is given as an argument is read. Error returned if any part of the process generates the error.

func (*TopoCfg) WriteToFile

func (dict *TopoCfg) WriteToFile(filename string) error

WriteToFile serializes the TopoCfg and writes to the file whose name is given as an input argument. Extension of the file name selects whether serialization is to json or to yaml format.

type TopoCfgDict

type TopoCfgDict struct {
	DictName string             `json:"dictname" yaml:"dictname"`
	Cfgs     map[string]TopoCfg `json:"cfgs" yaml:"cfgs"`
}

A TopoCfgDict holds instances of TopoCfg structures, in a map whose key is a name for the topology. Used to store pre-built instances of networks

func CreateTopoCfgDict

func CreateTopoCfgDict(name string) *TopoCfgDict

CreateTopoCfgDict is a constructor. Saves the dictionary name, initializes the TopoCfg map.

func ReadTopoCfgDict

func ReadTopoCfgDict(topoCfgDictFileName string, useYAML bool, dict []byte) (*TopoCfgDict, error)

ReadTopoCfgDict deserializes a slice of bytes into a TopoCfgDict. If the input arg of bytes is empty, the file whose name is given as an argument is read. Error returned if any part of the process generates the error.

func (*TopoCfgDict) AddTopoCfg

func (tcd *TopoCfgDict) AddTopoCfg(tc *TopoCfg, overwrite bool) error

AddTopoCfg includes a TopoCfg into the dictionary, optionally returning an error if an TopoCfg with the same name has already been included

func (*TopoCfgDict) RecoverTopoCfg

func (tcd *TopoCfgDict) RecoverTopoCfg(name string) (*TopoCfg, bool)

RecoverTopoCfg returns a copy (if one exists) of the TopoCfg with name equal to the input argument name. Returns a boolean indicating whether the entry was actually found

func (*TopoCfgDict) WriteToFile

func (tcd *TopoCfgDict) WriteToFile(filename string) error

WriteToFile serializes the TopoCfgDict and writes to the file whose name is given as an input argument. Extension of the file name selects whether serialization is to json or to yaml format.

type TopoCfgFrame

type TopoCfgFrame struct {
	Name     string
	Endpts   []*EndptFrame
	Networks []*NetworkFrame
	Routers  []*RouterFrame
	Switches []*SwitchFrame
}

The TopoCfgFrame struc gives the highest level structure of the topology, is ultimately the encompassing dictionary in the serialization

func CreateTopoCfgFrame

func CreateTopoCfgFrame(name string) TopoCfgFrame

CreateTopoCfgFrame is a constructor.

func (*TopoCfgFrame) AddNetwork

func (tf *TopoCfgFrame) AddNetwork(net *NetworkFrame)

AddNetwork adds a Network to the topology configuration (if it is not already present)

func (*TopoCfgFrame) Consolidate

func (tf *TopoCfgFrame) Consolidate() error

Consolidate gathers endpts, switches, and routers from the networks added to the TopoCfgFrame, and make sure that all the devices referred to in the different components are exposed at the TopoCfgFrame level

func (*TopoCfgFrame) Transform

func (tf *TopoCfgFrame) Transform() TopoCfg

Transform transforms the slices of pointers to network objects into slices of instances of those objects, for serialization

type TopoDev added in v0.0.15

type TopoDev interface {
	DevName() string             // every device has a unique name
	DevID() int                  // every device has a unique integer id
	DevHashID() uint32           // every device has a unique stable id
	DevType() DevCode            // every device is one of the devCode types
	DevModel() string            // model (or CPU) of device
	DevIntrfcs() []*intrfcStruct // we can get from devices a list of the interfaces they endpt, if any
	DevDelay(*NetworkMsg, float64, TransitType) float64
	DevState() any                // every device as a structure of state that can be accessed
	DevRng() *rngstream.RngStream // every device has its own RNG stream
	DevAddActive(*NetworkMsg)     // add the connectID argument to the device's list of active connections
	DevRmActive(int)              // remove the connectID argument to the device's list of active connections
	DevForward() DFS              // index by FlowID, yields map of ingress intrfc ID to egress intrfc ID
	LogNetEvent(vrtime.Time, *NetworkMsg, string)
}

TopoDev interface specifies the functionality different device types provide

type TraceInst added in v0.0.15

type TraceInst struct {
	TraceTime string
	TraceType string
	TraceStr  string
}

type TraceManager

type TraceManager struct {
	// experiment uses trace
	InUse bool `json:"inuse" yaml:"inuse"`

	// name of experiment
	ExpName string `json:"expname" yaml:"expname"`

	// text name associated with each objID
	NameByID map[int]NameType `json:"namebyid" yaml:"namebyid"`

	// all trace records for this experiment
	Traces map[int][]TraceInst `json:"traces" yaml:"traces"`
}

TraceManager implements the pces TraceManager interface. It is use to gather information about a simulation model and an execution of that model

func CreateTraceManager

func CreateTraceManager(ExpName string, active bool) *TraceManager

CreateTraceManager is a constructor. It saves the name of the experiment and a flag indicating whether the trace manager is active. By testing this flag we can inhibit the activity of gathering a trace when we don't want it, while embedding calls to its methods everywhere we need them when it is

func (*TraceManager) Active

func (tm *TraceManager) Active() bool

Active tells the caller whether the Trace Manager is actively being used

func (*TraceManager) AddName

func (tm *TraceManager) AddName(id int, name string, objDesc string)

AddName is used to add an element to the id -> (name,type) dictionary for the trace file

func (*TraceManager) AddTrace

func (tm *TraceManager) AddTrace(vrt vrtime.Time, execID int, trace TraceInst)

AddTrace creates a record of the trace using its calling arguments, and stores it

func (*TraceManager) WriteToFile

func (tm *TraceManager) WriteToFile(filename string, globalOrder bool) bool

WriteToFile stores the Traces struct to the file whose name is given. Serialization to json or to yaml is selected based on the extension of this name.

type TraceRecordType added in v0.0.15

type TraceRecordType int
const (
	NetworkType TraceRecordType = iota
	CmpPtnType
)

type TransitType added in v0.1.4

type TransitType int
const (
	CrossTransit TransitType = iota
	InteriorTransit
	All
)

Jump to

Keyboard shortcuts

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