blob: 2f5bac69fe6c0e1fdd571b0c329a5b6aab677bcd [file] [log] [blame]
Holger Hildebrandtfa074992020-03-27 15:42:06 +00001/*
2 * Copyright 2018-present Open Networking Foundation
3
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7
8 * http://www.apache.org/licenses/LICENSE-2.0
9
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Holger Hildebrandt0f9b88d2020-04-20 13:33:25 +000017//Package adaptercoreonu provides the utility for onu devices, flows and statistics
18package adaptercoreonu
Holger Hildebrandtfa074992020-03-27 15:42:06 +000019
20import (
21 gp "github.com/google/gopacket"
22 "github.com/opencord/omci-lib-go"
23)
24
Himani Chawla6d2ae152020-09-02 13:11:20 +053025// MessageType - Message Protocol Type
Holger Hildebrandtccd390c2020-05-29 13:49:04 +000026type MessageType uint8
Holger Hildebrandtfa074992020-03-27 15:42:06 +000027
28const (
Himani Chawla6d2ae152020-09-02 13:11:20 +053029 // TestMsg - Message type for non OMCI messages
Holger Hildebrandtccd390c2020-05-29 13:49:04 +000030 TestMsg MessageType = iota
Himani Chawla6d2ae152020-09-02 13:11:20 +053031 //OMCI - OMCI protocol type msg
Holger Hildebrandtccd390c2020-05-29 13:49:04 +000032 OMCI
Holger Hildebrandtfa074992020-03-27 15:42:06 +000033)
34
Himani Chawla6d2ae152020-09-02 13:11:20 +053035// String - Return the text representation of the message type based on integer
Holger Hildebrandtfa074992020-03-27 15:42:06 +000036func (m MessageType) String() string {
37 names := [...]string{
38 "TestMsg",
39 "OMCI",
40 }
41 return names[m]
42}
43
Himani Chawla6d2ae152020-09-02 13:11:20 +053044// Message - message type and data(OMCI)
Holger Hildebrandtfa074992020-03-27 15:42:06 +000045type Message struct {
46 Type MessageType
47 Data interface{}
48}
49
Himani Chawla6d2ae152020-09-02 13:11:20 +053050//TestMessageType - message data for various events
Holger Hildebrandtccd390c2020-05-29 13:49:04 +000051type TestMessageType uint8
52
Holger Hildebrandtfa074992020-03-27 15:42:06 +000053const (
Himani Chawla6d2ae152020-09-02 13:11:20 +053054 // LoadMibTemplateOk - message data for getting mib template successfully
Himani Chawla4d908332020-08-31 12:30:20 +053055 LoadMibTemplateOk TestMessageType = iota + 1
Himani Chawla6d2ae152020-09-02 13:11:20 +053056 // LoadMibTemplateFailed - message data for failure for getting mib template
Holger Hildebrandtccd390c2020-05-29 13:49:04 +000057 LoadMibTemplateFailed
Himani Chawla6d2ae152020-09-02 13:11:20 +053058 // TimeOutOccurred - message data for timeout
Holger Hildebrandtccd390c2020-05-29 13:49:04 +000059 TimeOutOccurred
Himani Chawla6d2ae152020-09-02 13:11:20 +053060 // AbortMessageProcessing - message data for aborting running message
Holger Hildebrandtccd390c2020-05-29 13:49:04 +000061 AbortMessageProcessing
Holger Hildebrandtfa074992020-03-27 15:42:06 +000062)
63
Himani Chawla6d2ae152020-09-02 13:11:20 +053064//TestMessage - Struct to hold the message data
Holger Hildebrandtfa074992020-03-27 15:42:06 +000065//TODO: place holder to have a second interface variant - to be replaced by real variant later on
66type TestMessage struct {
Holger Hildebrandtccd390c2020-05-29 13:49:04 +000067 TestMessageVal TestMessageType
Holger Hildebrandtfa074992020-03-27 15:42:06 +000068}
69
Himani Chawla6d2ae152020-09-02 13:11:20 +053070//OmciMessage - OMCI protocol messages for managing and monitoring ONUs
Holger Hildebrandtfa074992020-03-27 15:42:06 +000071type OmciMessage struct {
72 //OnuSN *openolt.SerialNumber
73 //OnuID uint32
74 OmciMsg *omci.OMCI
75 OmciPacket *gp.Packet
76}