core

package
v0.0.0-...-9be9fd4 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

* Copyright 2017-present Open Networking Foundation

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at

* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-present Open Networking Foundation

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at

* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-present Open Networking Foundation

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at

* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-present Open Networking Foundation

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at

* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-present Open Networking Foundation

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at

* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-present Open Networking Foundation

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at

* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-present Open Networking Foundation

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at

* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-present Open Networking Foundation

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at

* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-present Open Networking Foundation

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at

* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2017-present Open Networking Foundation

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at

* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

View Source
const (
	UDP_DST  = 1
	UDP_SRC  = 2
	IPV4_DST = 4
	VLAN_PCP = 8
	VLAN_VID = 16
	IP_PROTO = 32
	ETH_TYPE = 64
	IN_PORT  = 128
)
View Source
const (
	BASE_PORT_NUMBER = 128
)

Variables

View Source
var PonSimDeviceStateEnum = []string{
	"DISCONNECTED_FROM_PON",
	"CONNECTED_TO_PON",
	"REGISTERED_WITH_OLT",
	"CONNECTED_IO_INTERFACE",
}

Execute state string equivalents

Functions

This section is empty.

Types

type Alarm

type Alarm struct {
	Severity    int    `json:"severity"`
	Type        int    `json:"type"`
	Category    int    `json:"category"`
	State       int    `json:"state"`
	TimeStamp   int    `json:"ts"`
	Description string `json:"description"`
}

type OnuRegistree

type OnuRegistree struct {
	Device *PonSimOnuDevice                      `json:onu_device`
	Conn   *grpc.ClientConn                      `json:grpc_conn`
	Client ponsim.PonSimCommonClient             `json:client`
	Stream ponsim.PonSimCommon_ProcessDataClient `json:stream`
}

type PonSimAlarm

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

PonSimAlarm is the structure responsible for the handling of alarms

func NewPonSimAlarm

func NewPonSimAlarm(dstInterface string, dstEndpoint string, function func(int, gopacket.Packet)) *PonSimAlarm

NewPonSimAlarm instantiates a new alarm handling structure

func (*PonSimAlarm) GenerateAlarm

func (a *PonSimAlarm) GenerateAlarm()

GenerateAlarm simulates RAISE and CLEAR alarm events with a random delay in between each state.

type PonSimApiType

type PonSimApiType uint8
const (
	PONSIM PonSimApiType = iota
	BAL
)

func (PonSimApiType) String

func (t PonSimApiType) String() string

type PonSimDevice

type PonSimDevice struct {
	Name        string               `json:name`
	Port        int32                `json:port`
	Address     string               `json:address`
	ExternalIf  string               `json:external_if`
	InternalIf  string               `json:internal_if`
	Promiscuous bool                 `json:promiscuous`
	SnapshotLen int32                `json:snapshot_len`
	AlarmsOn    bool                 `json:alarm_on`
	AlarmsFreq  int                  `json:alarm_freq`
	Counter     *PonSimMetricCounter `json:counter`
	// contains filtered or unexported fields
}
func (o *PonSimDevice) AddLink(
	port int,
	index int,
	function interface{},
) error

AddLink assigns a functional operation to a device endpoint

The functional operation is called whenever a packet has been processed and the endpoint has been identified as the outgoing interface

func (*PonSimDevice) Forward

func (o *PonSimDevice) Forward(
	ctx context.Context,
	port int,
	frame gopacket.Packet,
) error

Forward is responsible of processing incoming data, filtering it and redirecting to the intended destination

func (*PonSimDevice) GetAddress

func (o *PonSimDevice) GetAddress() string

GetAddress returns the IP/FQDN for the device

func (*PonSimDevice) GetPort

func (o *PonSimDevice) GetPort() int32

GetPort return the port assigned to the device

func (*PonSimDevice) InstallFlows

func (o *PonSimDevice) InstallFlows(
	ctx context.Context,
	flows []*openflow_13.OfpFlowStats,
) error

InstallFlows assigns flows to the device in order of priority

func (o *PonSimDevice) RemoveLink(
	port int,
	index int,
) error

RemoveLink will remove reference a functional operation for a given port and index

func (*PonSimDevice) SendOut

func (o *PonSimDevice) SendOut(
	egressPort int,
	egressFrame gopacket.Packet,
)

SendOut send a given frame out the given port

func (*PonSimDevice) Start

func (o *PonSimDevice) Start(ctx context.Context)

Start performs common setup operations for a ponsim device

func (*PonSimDevice) Stop

func (o *PonSimDevice) Stop(ctx context.Context)

Stop performs common cleanup operations for a ponsim device

type PonSimDeviceState

type PonSimDeviceState uint8
const (
	DISCONNECTED_FROM_PON PonSimDeviceState = iota
	CONNECTED_TO_PON
	REGISTERED_WITH_OLT
	CONNECTED_IO_INTERFACE
)

func (PonSimDeviceState) String

func (s PonSimDeviceState) String() string

type PonSimDeviceType

type PonSimDeviceType uint8
const (
	OLT PonSimDeviceType = iota
	ONU
)

func (PonSimDeviceType) String

func (t PonSimDeviceType) String() string

type PonSimInterface

type PonSimInterface interface {
	Start(context.Context)

	Stop(context.Context)

	GetAddress() string

	GetPort() int32

	Forward(context.Context, int, gopacket.Packet) error

	SendOut(int, gopacket.Packet)
}

type PonSimMetricCounter

type PonSimMetricCounter struct {
	Name        string
	Device_Type string
	TxCounters  map[txMetricCounterType]*metricCounter
	RxCounters  map[rxMetricCounterType]*metricCounter
}

func NewPonSimMetricCounter

func NewPonSimMetricCounter(name string, device_type string) *PonSimMetricCounter

NewPonSimMetricCounter instantiates new metric counters for a PON device

func (*PonSimMetricCounter) CountRxFrame

func (mc *PonSimMetricCounter) CountRxFrame(port int, size int)

CountRxFrame increments the receive count for a specific packet size metric

func (*PonSimMetricCounter) CountTxFrame

func (mc *PonSimMetricCounter) CountTxFrame(port int, size int)

CountTxFrame increments the transmit count for a specific packet size metric

func (*PonSimMetricCounter) LogCounts

func (mc *PonSimMetricCounter) LogCounts()

LogCounts logs the current counts for all RX/TX packets

func (*PonSimMetricCounter) MakeProto

func (mc *PonSimMetricCounter) MakeProto() *voltha.PonSimMetrics

MakeProto collects all RX/TX metrics with which it constructs a GRPC proto metrics structure

type PonSimOltDevice

type PonSimOltDevice struct {
	PonSimDevice  `json:pon_device`
	VCoreEndpoint string                  `json:vcore_ep`
	MaxOnuCount   int                     `json:max_onu`
	Onus          map[int32]*OnuRegistree `json:onu_registrees`
	// contains filtered or unexported fields
}

PonSimOltDevice is the structure responsible for the handling of an OLT device

func NewPonSimOltDevice

func NewPonSimOltDevice(device PonSimDevice) *PonSimOltDevice

NewPonSimOltDevice instantiates a new OLT device structure

func (*PonSimOltDevice) AddOnu

func (o *PonSimOltDevice) AddOnu(onu *PonSimOnuDevice) (int32, error)

AddOnu registers an ONU device and sets up all required monitoring and connections

func (*PonSimOltDevice) ConnectToRemoteOnu

func (o *PonSimOltDevice) ConnectToRemoteOnu(onu *OnuRegistree) error

ConnectToRemoteOnu establishes communication to a remote ONU device

func (*PonSimOltDevice) GetOnu

func (o *PonSimOltDevice) GetOnu(index int32) *OnuRegistree

GetOnu return a specific registered ONU

func (*PonSimOltDevice) GetOnus

func (o *PonSimOltDevice) GetOnus() map[int32]*OnuRegistree

GetOnus returns the list of registered ONU devices

func (*PonSimOltDevice) GetOutgoing

func (o *PonSimOltDevice) GetOutgoing() chan []byte

func (*PonSimOltDevice) Listen

func (o *PonSimOltDevice) Listen(ctx context.Context, port int32)

Listen waits for incoming EGRESS data on the internal interface

func (*PonSimOltDevice) MonitorOnu

func (o *PonSimOltDevice) MonitorOnu(ctx context.Context, onuIndex int32)

MonitorOnu verifies the connection status of a specific ONU and cleans up as necessary

func (*PonSimOltDevice) RemoveOnu

func (o *PonSimOltDevice) RemoveOnu(ctx context.Context, onuIndex int32) error

RemoveOnu removes the reference to a registered ONU

func (*PonSimOltDevice) Start

func (o *PonSimOltDevice) Start(ctx context.Context)

Start performs setup operations for an OLT device

func (*PonSimOltDevice) Stop

func (o *PonSimOltDevice) Stop(ctx context.Context)

Stop performs cleanup operations for an OLT device

type PonSimOnuDevice

type PonSimOnuDevice struct {
	PonSimDevice

	ParentAddress string
	ParentPort    int32
	AssignedPort  int32
	SerialNumber  string
	Conn          *grpc.ClientConn
	// contains filtered or unexported fields
}

PonSimOnuDevice is the structure responsible for the handling of an ONU device

func NewPonSimOnuDevice

func NewPonSimOnuDevice(device PonSimDevice) *PonSimOnuDevice

NewPonSimOnuDevice instantiates a new ONU device structure

func (*PonSimOnuDevice) Connect

func (o *PonSimOnuDevice) Connect(ctx context.Context)

Connect sets up communication and monitoring with remote OLT

func (*PonSimOnuDevice) ConnectToRemoteOlt

func (o *PonSimOnuDevice) ConnectToRemoteOlt()

ConnectToRemoteOlt establishes GRPC communication with the remote OLT

func (*PonSimOnuDevice) Disconnect

func (o *PonSimOnuDevice) Disconnect(ctx context.Context)

Disconnect tears down communication and monitoring with remote OLT

func (*PonSimOnuDevice) Listen

func (o *PonSimOnuDevice) Listen(ctx context.Context)

Listen waits for incoming INGRESS data on the external interface

func (*PonSimOnuDevice) MonitorConnection

func (o *PonSimOnuDevice) MonitorConnection(ctx context.Context)

MonitorConnection verifies the communication with the OLT

func (*PonSimOnuDevice) MonitorState

func (o *PonSimOnuDevice) MonitorState(ctx context.Context, wg *sync.WaitGroup)

MonitorState follows the progress of the OLT connection

func (*PonSimOnuDevice) Register

func (o *PonSimOnuDevice) Register(ctx context.Context) error

Register sends a registration request to the remote OLT

func (*PonSimOnuDevice) Start

func (o *PonSimOnuDevice) Start(ctx context.Context)

Start performs setup operations for an ONU device

func (*PonSimOnuDevice) Stop

func (o *PonSimOnuDevice) Stop(ctx context.Context)

Stop performs cleanup operations for an ONU device

type XPonSimDevice

type XPonSimDevice struct {
}

func (*XPonSimDevice) CreateGemport

func (d *XPonSimDevice) CreateGemport(ctx context.Context, config *voltha.InterfaceConfig)

func (*XPonSimDevice) CreateInterface

func (d *XPonSimDevice) CreateInterface(ctx context.Context, config *voltha.InterfaceConfig)

func (*XPonSimDevice) CreateMulticastDistributionSet

func (d *XPonSimDevice) CreateMulticastDistributionSet(ctx context.Context, config *voltha.InterfaceConfig)

func (*XPonSimDevice) CreateMulticastGemport

func (d *XPonSimDevice) CreateMulticastGemport(ctx context.Context, config *voltha.InterfaceConfig)

func (*XPonSimDevice) CreateTcont

func (*XPonSimDevice) RemoveGemport

func (d *XPonSimDevice) RemoveGemport(ctx context.Context, config *voltha.InterfaceConfig)

func (*XPonSimDevice) RemoveInterface

func (d *XPonSimDevice) RemoveInterface(ctx context.Context, config *voltha.InterfaceConfig)

func (*XPonSimDevice) RemoveMulticastDistributionSet

func (d *XPonSimDevice) RemoveMulticastDistributionSet(ctx context.Context, config *voltha.InterfaceConfig)

func (*XPonSimDevice) RemoveMulticastGemport

func (d *XPonSimDevice) RemoveMulticastGemport(ctx context.Context, config *voltha.InterfaceConfig)

func (*XPonSimDevice) RemoveTcont

func (*XPonSimDevice) Start

func (d *XPonSimDevice) Start(ctx context.Context)

func (*XPonSimDevice) Stop

func (d *XPonSimDevice) Stop(ctx context.Context)

func (*XPonSimDevice) UpdateGemport

func (d *XPonSimDevice) UpdateGemport(ctx context.Context, config *voltha.InterfaceConfig)

func (*XPonSimDevice) UpdateInterface

func (d *XPonSimDevice) UpdateInterface(ctx context.Context, config *voltha.InterfaceConfig)

func (*XPonSimDevice) UpdateMulticastDistributionSet

func (d *XPonSimDevice) UpdateMulticastDistributionSet(ctx context.Context, config *voltha.InterfaceConfig)

func (*XPonSimDevice) UpdateMulticastGemport

func (d *XPonSimDevice) UpdateMulticastGemport(ctx context.Context, config *voltha.InterfaceConfig)

func (*XPonSimDevice) UpdateTcont

Jump to

Keyboard shortcuts

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