Documentation ¶
Index ¶
- Variables
- func AcceptedBckgrndFlowRate(evtMgr *evtm.EventManager, context any, data any) any
- func AddIntrfcTrace(tm *TraceManager, vrt vrtime.Time, execID, objID int, op, CQ string)
- func AddNetTrace(tm *TraceManager, vrt vrtime.Time, nm *NetworkMsg, objID int, op string)
- func AddSchedulerTrace(tm *TraceManager, vrt vrtime.Time, ts *TaskScheduler, execID, objID int, ...)
- func BckgrndFlowRateChange(evtMgr *evtm.EventManager, cxt any, data any) any
- func BckgrndFlowRemoved(evtMgr *evtm.EventManager, cxt any, data any) any
- func BuildExperimentNet(dictFiles map[string]string, useYAML bool, idCounter int, ...) error
- func BuildFlow(flowID int, classID int, route *[]intrfcsToDev) float64
- func CableIntrfcFrames(intrfc1, intrfc2 *IntrfcFrame)
- func CarryIntrfcFrames(intrfc1, intrfc2 *IntrfcFrame)
- func CheckDirectories(dirs []string) (bool, error)
- func CheckFiles(names []string, checkExistence bool) (bool, error)
- func CheckOutputFiles(names []string) (bool, error)
- func CheckReadableFiles(names []string) (bool, error)
- func CompareAttrbs(attrbs1, attrbs2 []AttrbStruct) int
- func ConnectDevs(dev1, dev2 NetDevice, cable bool, faces string)
- func DefaultEndptName(etype string) string
- func DefaultIntrfcName(device string) string
- func DefaultRouterName() string
- func DefaultSwitchName(name string) string
- func DevCodeToStr(code DevCode) string
- func DevNetworks(dev NetDevice) string
- func EqAttrbs(attrbs1, attrbs2 []AttrbStruct) bool
- func EstMD1Latency(rho float64, msgLen int, bndwdth float64) float64
- func EstMM1Latency(bitRate, rho float64, msgLen int) float64
- func FindFrameSize(frameID int, rt *[]intrfcsToDev) int
- func GetExpParamDesc() ([]string, map[string][]string, map[string][]string)
- func GetExperimentNetDicts(dictFiles map[string]string) (*TopoCfg, *DevExecList, *ExpCfg, *ExpCfg)
- func InitBckgrndFlowList()
- func InitTopoDesc()
- func InitializeBckgrnd(evtMgr *evtm.EventManager)
- func InitializeBckgrndEndpt(evtMgr *evtm.EventManager, endptDev *endptDev)
- func LimitingBndwdth(srcDevName, dstDevName string) float64
- func LoadDevExec(devExecFile string) error
- func LoadStateParams(base, mdfy string) error
- func LoadTopo(topoFile string, idCounter int, traceMgr *TraceManager) error
- func NetScaleToStr(ntype NetworkScale) string
- func NullHandler(evtMgr *evtm.EventManager, context any, msg any) any
- func Pt2ptLatency(srcIntrfc, dstIntrfc *intrfcStruct) float64
- func ReportErrs(errs []error) error
- func SetTopoParameters(expCfg, expxCfg *ExpCfg)
- func SetTopoState(expCfg, expxCfg *ExpCfg)
- func ShowPath(src int, dest int, idToName map[int]string, thru map[int]int, ...) string
- func UpdateExpCfg(orgfile, updatefile string, useYAML bool, dict []byte)
- func ValidateAttribute(paramObj, attrbName string) bool
- func ValidateParameter(paramObj string, attributes []AttrbStruct, param string) error
- type ActiveRec
- type AttrbStruct
- type BckgrndFlow
- type BuildExpCfgFuncType
- type BuildTopoCfgFuncType
- type ClassQueue
- type ConnDesc
- type ConnLatency
- type ConnType
- type DFS
- type DevCode
- type DevDesc
- type DevDescDict
- type DevExecDesc
- type DevExecList
- type EndptDesc
- type EndptDescSlice
- type EndptFrame
- func CreateEUD(name, model string, cores int) *EndptFrame
- func CreateEndpt(name, etype string, model string, cores int) *EndptFrame
- func CreateHost(name, model string, cores int) *EndptFrame
- func CreateNode(name, model string, cores int) *EndptFrame
- func CreateSensor(name, model string) *EndptFrame
- func CreateSrvr(name, model string, cores int) *EndptFrame
- func (epf *EndptFrame) AddGroup(groupName string)
- func (epf *EndptFrame) AddIntrfc(iff *IntrfcFrame) error
- func (epf *EndptFrame) DevAddIntrfc(iff *IntrfcFrame) error
- func (epf *EndptFrame) DevID() string
- func (epf *EndptFrame) DevInterfaces() []*IntrfcFrame
- func (epf *EndptFrame) DevName() string
- func (epf *EndptFrame) DevType() string
- func (epf *EndptFrame) IsEUD() bool
- func (epf *EndptFrame) IsHost() bool
- func (epf *EndptFrame) IsSrvr() bool
- func (epf *EndptFrame) SetCores(cores int)
- func (epf *EndptFrame) SetEUD()
- func (epf *EndptFrame) SetHost()
- func (epf *EndptFrame) SetSrvr()
- func (epf *EndptFrame) Transform() EndptDesc
- type ExpCfg
- type ExpCfgDict
- type ExpParameter
- type FlowAction
- type IntrfcDesc
- type IntrfcFrame
- type IntrfcTrace
- type MrnesApp
- type NameType
- type NetDevice
- type NetMsgIDs
- type NetTrace
- type NetworkDesc
- type NetworkDescSlice
- type NetworkFrame
- func (nf *NetworkFrame) AddGroup(groupName string)
- func (nf *NetworkFrame) AddRouter(rtrf *RouterFrame) error
- func (nf *NetworkFrame) AddSwitch(swtch *SwitchFrame) error
- func (nf *NetworkFrame) FacedBy(dev NetDevice) bool
- func (nf *NetworkFrame) IncludeDev(dev NetDevice, mediaType string, chkIntrfc bool) error
- func (nf *NetworkFrame) Transform() NetworkDesc
- type NetworkMedia
- type NetworkMsg
- type NetworkMsgType
- type NetworkPortal
- func (np *NetworkPortal) Arrive(rtns RtnDescs, frames int) int
- func (np *NetworkPortal) ClearRmFlow(flowID int)
- func (np *NetworkPortal) ComputeFlowLatency(nm *NetworkMsg) float64
- func (np *NetworkPortal) Depart(evtMgr *evtm.EventManager, nm NetworkMsg)
- func (np *NetworkPortal) DiscoverFlowRate(flowID int, requestRate float64, route *[]intrfcsToDev) (float64, bool)
- func (np *NetworkPortal) EndptCPUModel(devName string) string
- func (np *NetworkPortal) EnterNetwork(evtMgr *evtm.EventManager, srcDev, dstDev string, msgLen int, ...) (int, float64, bool)
- func (np *NetworkPortal) EstablishFlowRate(evtMgr *evtm.EventManager, flowID int, classID int, requestRate float64, ...) (map[int]bool, bool)
- func (np *NetworkPortal) FlowEntry(evtMgr *evtm.EventManager, srcDev, dstDev string, msgLen int, ...) bool
- func (np *NetworkPortal) PlaceNetMsg(evtMgr *evtm.EventManager, nm *NetworkMsg, offset float64)
- func (np *NetworkPortal) ReportFlowChg(evtMgr *evtm.EventManager, flowID int, action FlowAction, latency float64)
- func (np *NetworkPortal) RmFlow(evtMgr *evtm.EventManager, rmflowID int, route *[]intrfcsToDev, ...)
- func (np *NetworkPortal) SendImmediate(evtMgr *evtm.EventManager, nm *NetworkMsg)
- func (np *NetworkPortal) SendNetMsg(evtMgr *evtm.EventManager, nm *NetworkMsg, offset float64)
- func (np *NetworkPortal) SetFlowRate(evtMgr *evtm.EventManager, flowID int, classID int, acceptRate float64, ...) map[int]float64
- func (np *NetworkPortal) SetQkNetSim(quick bool)
- type NetworkScale
- type RouterDesc
- type RouterFrame
- func (rf *RouterFrame) AddGroup(groupName string)
- func (rf *RouterFrame) AddIntrfc(intrfc *IntrfcFrame) error
- func (rf *RouterFrame) DevAddIntrfc(iff *IntrfcFrame) error
- func (rf *RouterFrame) DevID() string
- func (rf *RouterFrame) DevInterfaces() []*IntrfcFrame
- func (rf *RouterFrame) DevModel() string
- func (rf *RouterFrame) DevName() string
- func (rf *RouterFrame) DevType() string
- func (rf *RouterFrame) Transform() RouterDesc
- func (rf *RouterFrame) WirelessConnectTo(dev NetDevice, faces string) error
- type RprtRate
- type RtnDesc
- type RtnDescs
- type RtnMsgStruct
- type RtrDescSlice
- type SchedulerTrace
- type ShortIntrfc
- type SwitchDesc
- type SwitchDescSlice
- type SwitchFrame
- func (sf *SwitchFrame) AddGroup(groupName string)
- func (sf *SwitchFrame) AddIntrfc(iff *IntrfcFrame) error
- func (sf *SwitchFrame) DevAddIntrfc(iff *IntrfcFrame) error
- func (sf *SwitchFrame) DevID() string
- func (sf *SwitchFrame) DevInterfaces() []*IntrfcFrame
- func (sf *SwitchFrame) DevName() string
- func (sf *SwitchFrame) DevType() string
- func (sf *SwitchFrame) Transform() SwitchDesc
- type Task
- type TaskScheduler
- type TopoCfg
- type TopoCfgDict
- type TopoCfgFrame
- type TopoDev
- type TraceInst
- type TraceManager
- type TraceRecordType
Constants ¶
This section is empty.
Variables ¶
var BckgrndFlowList map[int]*BckgrndFlow
var EndptDevByID map[int]*endptDev
var EndptDevByName map[string]*endptDev
var ExpAttributes map[string][]string
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
var ExpParams map[string][]string
FrameSizeCache holds previously computed minimum frame size along the route for a flow whose ID is the index
var IntrfcByID map[int]*intrfcStruct
var IntrfcByName map[string]*intrfcStruct
var NetworkByID map[int]*networkStruct
var NetworkByName map[string]*networkStruct
var NumIDs int = 0
var QkNetSim bool = false
QkNetSim is set from the command line, when selected uses 'quick' form of network simulation
var RouterDevByID map[int]*routerDev
var RouterDevByName map[string]*routerDev
var SwitchDevByID map[int]*switchDev
var SwitchDevByName map[string]*switchDev
var TaskSchedulerByHostName map[string]*TaskScheduler = make(map[string]*TaskScheduler)
TaskSchedulerByHostName maps an identifier for the scheduler to the scheduler itself
var TopoDevByID map[int]TopoDev
var TopoDevByName map[string]TopoDev
Functions ¶
func AcceptedBckgrndFlowRate ¶ added in v0.0.15
func AcceptedBckgrndFlowRate(evtMgr *evtm.EventManager, context any, data any) any
func AddIntrfcTrace ¶ added in v0.0.15
func AddIntrfcTrace(tm *TraceManager, vrt vrtime.Time, execID, 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 BckgrndFlowRateChange ¶ added in v0.0.15
func BckgrndFlowRateChange(evtMgr *evtm.EventManager, cxt any, data any) any
func BckgrndFlowRemoved ¶ added in v0.0.15
func BckgrndFlowRemoved(evtMgr *evtm.EventManager, cxt any, data any) any
func BuildExperimentNet ¶
func BuildExperimentNet(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
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 ¶
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 ¶
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 ¶
CheckOutputFiles probles the file system to ensure that every argument filename can be written.
func CheckReadableFiles ¶
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 ¶
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 ¶
DefaultEndptName returns unique name for a endpt
func DefaultIntrfcName ¶
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 ¶
DefaultSwitchName returns a unique name for a switch
func DevCodeToStr ¶ added in v0.0.15
DevCodeToStr returns a string corresponding to an input devCode for it
func DevNetworks ¶
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(bitRate, rho float64, msgLen int) float64 {
func EstMM1Latency ¶ added in v0.0.15
func FindFrameSize ¶ added in v0.0.15
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 GetExpParamDesc ¶
GetExpParamDesc returns ExpParamObjs, ExpAttributes, and ExpParams after ensuring that they have been build
func GetExperimentNetDicts ¶
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 InitBckgrndFlowList ¶ added in v0.0.15
func InitBckgrndFlowList()
func InitTopoDesc ¶ added in v0.0.15
func InitTopoDesc()
func InitializeBckgrnd ¶ added in v0.0.15
func InitializeBckgrnd(evtMgr *evtm.EventManager)
func InitializeBckgrndEndpt ¶ added in v0.0.15
func InitializeBckgrndEndpt(evtMgr *evtm.EventManager, endptDev *endptDev)
func LimitingBndwdth ¶ added in v0.0.15
LimitingBndwdth gives the amount of available bandwidth along the path between source and destination devices that has not already been allocated for flows
func LoadDevExec ¶ added in v0.0.15
LoadDevExec reads in the device-oriented function timings, puts them in a global table devExecTimeTbl
func LoadStateParams ¶ added in v0.0.15
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 ¶
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 SetTopoParameters ¶ added in v0.0.15
func SetTopoParameters(expCfg, expxCfg *ExpCfg)
SetModelParameters 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, expxCfg *ExpCfg)
SetModelState creates the state structures for the devices before initializing from configuration files
func ShowPath ¶
func ShowPath(src int, dest int, idToName map[int]string, thru map[int]int, forwardDirection bool) string
ShowPath returns a string that lists the names of all the network devices on a path. The input arguments are the source and destination device ids, a dictionary holding string names as a function of device id, representation the path, and a flag indicating whether the path is from src to dst, or vice-versa
func UpdateExpCfg ¶
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 ¶
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 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 BckgrndFlow ¶ added in v0.0.15
type BckgrndFlow struct { ExecID int FlowID int ClassID int ConnectID int Elastic bool Src string Dst string RequestedRate float64 AcceptedRate float64 RtnDesc RtnDesc }
func CreateBckgrndFlow ¶ added in v0.0.15
func CreateBckgrndFlow(evtMgr *evtm.EventManager, srcDev string, dstDev string, requestRate float64, elastic bool, execID int, flowID int, classID int, context any, hdlr evtm.EventHandlerFunction) (*BckgrndFlow, bool)
func (*BckgrndFlow) RmBckgrndFlow ¶ added in v0.0.15
func (bgf *BckgrndFlow) RmBckgrndFlow(evtMgr *evtm.EventManager, context any, hdlr evtm.EventHandlerFunction)
type BuildExpCfgFuncType ¶
BuildExpCfgFuncType is a signature for a function that creates experiment cfgs
type BuildTopoCfgFuncType ¶
BuildTopoCfgFuncType is a signature for a function that creates topology cfgs
type ClassQueue ¶ added in v0.0.15
type ClassQueue struct {
// contains filtered or unexported fields
}
a ClassQueue holds multi-level priority queue structures for an interface
func (*ClassQueue) Str ¶ added in v0.0.15
func (CQ *ClassQueue) Str() string
Str represents the state of the ClassQueue queues as a string, for traces
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 DevCode ¶ added in v0.0.15
type DevCode int
DevCode is the base type for an enumerated type of network devices
func DevCodeFromStr ¶ added in v0.0.15
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
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"` ExecTime float64 `json:"exectime" yaml:"exectime"` }
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)
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 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"` Interfaces []IntrfcDesc `json:"interfaces" yaml:"interfaces"` }
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 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) 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) 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 ¶
CreateExpCfg is a constructor. Saves the offered Name and initializes the slice of ExpParameters.
func ReadExpCfg ¶
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 ¶
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, Endpt, 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 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 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
func (*IntrfcTrace) Serialize ¶ added in v0.0.15
func (it *IntrfcTrace) Serialize() string
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 }
type NameType ¶
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) 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 ClassID int 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 }
NetTraceRecord saves information about the visitation of a message to some point in the simulation. saved for post-run analysis
func (*NetTrace) TraceType ¶ added in v0.0.15
func (ntr *NetTrace) TraceType() TraceRecordType
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 { StepIdx int // position within the route from source to destination Route *[]intrfcsToDev // pointer to description of route Connection ConnDesc // {DiscreteConn, MajorFlowConn, MinorFlowConn} ExecID int FlowID int // flow id given by app at entry ClassID int // if > 0 means the message uses that reservation ConnectID int // connection identifier NetMsgType NetworkMsgType // enum type packet, PcktRate float64 // if ClassID>0, the class arrival rate. Otherwise from source Rate float64 // flow rate if FlowID >0 (meaning a flow) StartTime float64 // simuation time when the message entered the network PrArrvl float64 // probablity of arrival MsgLen int // length of the entire message, in Mbytes PcktIdx int // index of packet with msg NumPckts int // number of packets in the message this is part of Msg any // message being carried. }
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 RequestRate map[int]float64 // indexed by flowID to get requested arrival rate AcceptedRate map[int]float64 // indexed by flowID to get accepted arrival rate Class map[int]int // indexed by flowID to get priority class Elastic map[int]bool // indexed by flowID to record whether flow is elastic Connections map[int]int // indexed by connectID to get flowID 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 }
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
ComputeLatency 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, 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)
DiscoverFlowRates is called after the infrastructure for new flow with ID flowID is set up, to determine what its rate will be
func (*NetworkPortal) EndptCPUModel ¶
func (np *NetworkPortal) EndptCPUModel(devName string) string
EndptCPUModel 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, requestRate float64, msg any) (int, float64, bool)
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, classID 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, classID int, connectID int, requestRate float64, route *[]intrfcsToDev, msg any) bool
FlowEntry handles the entry of major flows to the network
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)
RemoveFlow 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, classID 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 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 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
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 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 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
CreateHub 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, pri, 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"` }
TopoCfg contains all of the networks, routers, and endpts, as they are listed in the json file.
func ReadTopoCfg ¶
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 ¶
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 DevType() DevCode // every device is one of the devCode types DevIntrfcs() []*intrfcStruct // we can get from devices a list of the interfaces they endpt, if any DevDelay(any) float64 // every device can be be queried for the delay it introduces for an operation 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) }
the topDev interface specifies the functionality different device types provide
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) 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 )