common

package
Version: v1.12.10 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BP_FORMAT_MEF  = "mef"
	BP_FORMAT_IETF = "ietf"
)
View Source
const OltNniLos = "OLT_NNI_LOS"
View Source
const OltPonLos = "OLT_PON_LOS"

Variables

View Source
var (
	Config     *GlobalConfig
	Services   []ServiceYaml
	PonsConfig *PonPortsConfig
)

Functions

func GetIPAddr added in v0.0.9

func GetIPAddr(ifname string) (string, error)

GetIPAddr returns the IPv4 address of an interface. 0.0.0.0 is returned if the IP cannot be determined.

func InitializePublisher added in v0.0.18

func InitializePublisher(NewAsyncProducer func([]string, *sarama.Config) (sarama.AsyncProducer, error), oltID int) error

InitializePublisher initalizes kafka publisher

func KafkaPublisher added in v0.0.18

func KafkaPublisher(eventChannel chan Event)

KafkaPublisher receives messages on eventChannel and publish them to kafka

func LoadConfig added in v1.0.0

func LoadConfig()

Load the BBSim configuration. This is a combination of CLI parameters and YAML files We proceed in this order: - Read CLI parameters - Using those we read the yaml files (config and services) - we merge the configuration (CLI has priority over yaml files)

func OnuSnToString

func OnuSnToString(sn *openolt.SerialNumber) string

func SetLogLevel

func SetLogLevel(logger *log.Logger, level string, caller bool)

Types

type BBRCliOptions

type BBRCliOptions struct {
	*GlobalConfig
	BBSimIp      string
	BBSimPort    string
	BBSimApiPort string
	LogFile      string
}

func GetBBROpts

func GetBBROpts() BBRCliOptions

This is only used by BBR

type BBRConfig added in v0.0.8

type BBRConfig struct {
	Log       string `yaml:"log"`
	LogLevel  string `yaml:"log_level"`
	LogCaller bool   `yaml:"log_caller"`
}

type BBSimConfig added in v0.0.8

type BBSimConfig struct {
	ConfigFile                  string
	ServiceConfigFile           string
	PonsConfigFile              string
	DhcpRetry                   bool    `yaml:"dhcp_retry"`
	AuthRetry                   bool    `yaml:"auth_retry"`
	LogLevel                    string  `yaml:"log_level"`
	LogCaller                   bool    `yaml:"log_caller"`
	Delay                       int     `yaml:"delay"`
	CpuProfile                  *string `yaml:"cpu_profile"`
	OpenOltAddress              string  `yaml:"openolt_address"`
	ApiAddress                  string  `yaml:"api_address"`
	RestApiAddress              string  `yaml:"rest_api_address"`
	LegacyApiAddress            string  `yaml:"legacy_api_address"`
	LegacyRestApiAddress        string  `yaml:"legacy_rest_api_address"`
	SadisRestAddress            string  `yaml:"sadis_rest_address"`
	SadisServer                 bool    `yaml:"sadis_server"`
	KafkaAddress                string  `yaml:"kafka_address"`
	Events                      bool    `yaml:"enable_events"`
	ControlledActivation        string  `yaml:"controlled_activation"`
	EnablePerf                  bool    `yaml:"enable_perf"`
	KafkaEventTopic             string  `yaml:"kafka_event_topic"`
	DmiServerAddress            string  `yaml:"dmi_server_address"`
	BandwidthProfileFormat      string  `yaml:"bp_format"`
	InjectOmciUnknownMe         bool    `yaml:"inject_omci_unknown_me"`
	InjectOmciUnknownAttributes bool    `yaml:"inject_omci_unknown_attributes"`
	OmccVersion                 int     `yaml:"omcc_version"`
}

type Event added in v0.0.18

type Event struct {
	EventType string
	OnuSerial string
	OltID     int
	IntfID    int32
	OnuID     int32
	EpochTime int64
	Timestamp string
}

Event defines structure for bbsim events

type GlobalConfig added in v1.0.0

type GlobalConfig struct {
	BBSim BBSimConfig
	Olt   OltConfig
	BBR   BBRConfig
}

func GetDefaultOps added in v1.12.8

func GetDefaultOps() *GlobalConfig

type IdRange added in v1.11.0

type IdRange struct {
	StartId uint32 `yaml:"start"`
	EndId   uint32 `yaml:"end"`
}

type OltConfig added in v0.0.8

type OltConfig struct {
	Model              string `yaml:"model"`
	Vendor             string `yaml:"vendor"`
	HardwareVersion    string `yaml:"hardware_version"`
	FirmwareVersion    string `yaml:"firmware_version"`
	DeviceId           string `yaml:"device_id"`
	DeviceSerialNumber string `yaml:"device_serial_number"`
	PonPorts           uint32 `yaml:"pon_ports"`
	NniPorts           uint32 `yaml:"nni_ports"`
	NniSpeed           uint32 `yaml:"nni_speed"`
	OnusPonPort        uint32 `yaml:"onus_per_port"`
	ID                 int    `yaml:"id"`
	OltRebootDelay     int    `yaml:"reboot_delay"`
	PortStatsInterval  int    `yaml:"port_stats_interval"`
	OmciResponseRate   uint8  `yaml:"omci_response_rate"`
	UniPorts           uint32 `yaml:"uni_ports"`
	PotsPorts          uint32 `yaml:"pots_ports"`
	NniDhcpTrapVid     uint32 `yaml:"nni_dhcp_trap_vid"`
}

type PonPortsConfig added in v1.11.0

type PonPortsConfig struct {
	Number uint32           `yaml:"num_pon_ports"`
	Ranges []PonRangeConfig `yaml:"ranges"`
}

type PonRangeConfig added in v1.11.0

type PonRangeConfig struct {
	PonRange     IdRange `yaml:"pon_id_range"`
	Technology   string  `yaml:"tech"`
	OnuRange     IdRange `yaml:"onu_id_range"`
	AllocIdRange IdRange `yaml:"alloc_id_range"`
	GemportRange IdRange `yaml:"gemport_id_range"`
}

func GetPonConfigById added in v1.11.0

func GetPonConfigById(id uint32) (*PonRangeConfig, error)

type PonTechnology added in v1.11.0

type PonTechnology int
const (
	GPON PonTechnology = iota
	XGSPON
)

func PonTechnologyFromString added in v1.11.0

func PonTechnologyFromString(s string) (PonTechnology, error)

func (PonTechnology) String added in v1.11.0

func (t PonTechnology) String() string

type ServiceYaml added in v1.0.0

type ServiceYaml struct {
	Name                string
	CTag                int    `yaml:"c_tag"`
	STag                int    `yaml:"s_tag"`
	NeedsEapol          bool   `yaml:"needs_eapol"`
	NeedsDhcp           bool   `yaml:"needs_dhcp"`
	NeedsIgmp           bool   `yaml:"needs_igmp"`
	NeedsPPPoE          bool   `yaml:"needs_pppoe"`
	CTagAllocation      string `yaml:"c_tag_allocation"`
	STagAllocation      string `yaml:"s_tag_allocation"`
	TechnologyProfileID int    `yaml:"tp_id"`
	UniTagMatch         int    `yaml:"uni_tag_match"`
	ConfigureMacAddress bool   `yaml:"configure_mac_address"`
	EnableMacLearning   bool   `yaml:"enable_mac_learning"`
	UsPonCTagPriority   uint8  `yaml:"us_pon_c_tag_priority"`
	UsPonSTagPriority   uint8  `yaml:"us_pon_s_tag_priority"`
	DsPonCTagPriority   uint8  `yaml:"ds_pon_c_tag_priority"`
	DsPonSTagPriority   uint8  `yaml:"ds_pon_s_tag_priority"`
}

type TagAllocation added in v0.2.0

type TagAllocation int
const (
	TagAllocationShared TagAllocation
	TagAllocationUnique
)

func (TagAllocation) String added in v0.2.0

func (t TagAllocation) String() string

type YamlServiceConfig added in v1.0.0

type YamlServiceConfig struct {
	Workflow string
	Services []ServiceYaml `yaml:"services,flow"`
}

func (*YamlServiceConfig) String added in v1.0.0

func (cfg *YamlServiceConfig) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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