config

package
v0.0.0-...-4bc4564 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ConfigPath       string `yaml:"_"`
	DisableAutoStart bool   `yaml:"disableAutoStart"`
	AutoStartDelay   uint   `yaml:"autoStartDelay"`
	MaxCpus          uint   `yaml:"maxCpus"`
	PonCount         uint   `yaml:"ponCount"`
	MaxOnusPerPon    uint   `yaml:"maxOnuPerPon"`
	RestPort         int    `yaml:"restPort"`
	GrpcPortNumber   string `yaml:"grpcPort"`

	PonConfig PonConfig `yaml:"ponConfig"`
	OnuConfig OnuConfig `yaml:"onuConfig"`
}

Config provides for the MOCK ONU runtime settings

func NewConfig

func NewConfig() *Config

NewConfig returns a configuration structure with the command line arguments parsed

func (*Config) ConfigExists

func (c *Config) ConfigExists() bool

ConfigExists returns True if a configuration file exists and can be opened for read

func (*Config) ParseArgs

func (c *Config) ParseArgs()

ParseArgs will parse the command line arguments

func (*Config) ReadConfig

func (c *Config) ReadConfig(path string) error

ReadConfig reads in a configuration (YAML) file. If an error occurs during reading or value assignment an error is returned, otherwise on success, nil is returned

func (Config) String

func (c Config) String() string

Convert type to string

type OnuConfig

type OnuConfig struct {
	// "Enabled"    All at once (step function)
	// "Disabled"   Leave all disabled
	// "Sequential  Enable ONUs sequentially
	// "Random"	    Enable ONUs Random
	EnablePattern string  `yaml:"pattern"`
	Delay         float32 `yaml:"delay"` // Seconds between enables if sequential/random
	Count         uint    `yaml:"count"` // Number of ONUs per enable if sequential/random
}

OnuConfig defines how ONUs on a PON are initially enabled on startup Currently all PONs will start their ONUs up the same way in the initial release of this code.

To have ONU IDs assigned by an OLT, set the onuIDIncrement to zero and randomOnuID to false.

type OnuVendorInfo

type OnuVendorInfo struct {
	URL   string `yaml:"url"`
	Count string `yaml:"count"`
}

OnuVendorInfo provides the location of a vendor profile and a count (number of ONUs or percentage) that should be filled on a PON when applied. OnuVendorInfo with a numerical count is applied first and then percentages are applied to the remaining ONUs on an individual PON.

type PonConfig

type PonConfig struct {
	// "Enabled"    All at once (step function)
	// "Disabled"   Leave all disabled
	// "Sequential  Enable PONs sequentially
	// "Random"	    Enable PONs Random
	EnablePattern string  `yaml:"pattern"`
	Delay         float32 `yaml:"delay"`   // Seconds between enables if sequential/random
	Count         uint    `yaml:"count"`   // Number of pons per enable if sequential/random
	ReverseOrder  bool    `yaml:"reverse"` // If sequential, start at highest PON Id

	PonDefault  []OnuVendorInfo `yaml:"ponDefault"`
	PonSettings []PonVendorInfo `yaml:"ponSettings"`
}

PonConfig defines how PONs are initially enabled on startup

type PonVendorInfo

type PonVendorInfo struct {
	Port     uint            `yaml:"port"`
	OnuCount uint            `yaml:"onu_count"`
	OnuInfo  []OnuVendorInfo `yaml:"onu"`
}

PonVendorInfo provides a specific OnuVendorInfo setting for a specific PON.

func NewPonVendorInfo

func NewPonVendorInfo(port uint, defSettings []OnuVendorInfo) PonVendorInfo

Jump to

Keyboard shortcuts

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