Naveen Sampath | 04696f7 | 2022-06-13 15:19:14 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2022-present Open Networking Foundation |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | |
| 16 | package intf |
| 17 | |
| 18 | import ( |
| 19 | "context" |
Tinoj Joseph | 429b9d9 | 2022-11-16 18:51:05 +0530 | [diff] [blame] | 20 | "time" |
Naveen Sampath | 04696f7 | 2022-06-13 15:19:14 +0530 | [diff] [blame] | 21 | |
| 22 | "voltha-go-controller/internal/pkg/holder" |
| 23 | |
| 24 | ofp "github.com/opencord/voltha-protos/v5/go/openflow_13" |
| 25 | ) |
| 26 | |
| 27 | // VPClientCfg structure |
| 28 | type VPClientCfg struct { |
vinokuma | 926cb3e | 2023-03-29 11:41:06 +0530 | [diff] [blame^] | 29 | VolthaClient *holder.VolthaServiceClientHolder |
| 30 | PacketOutChannel chan *ofp.PacketOut |
| 31 | TimeStamp time.Time |
Naveen Sampath | 04696f7 | 2022-06-13 15:19:14 +0530 | [diff] [blame] | 32 | DeviceID string |
| 33 | SerialNum string |
| 34 | SouthBoundID string |
Tinoj Joseph | 429b9d9 | 2022-11-16 18:51:05 +0530 | [diff] [blame] | 35 | MfrDesc string |
| 36 | HwDesc string |
| 37 | SwDesc string |
Naveen Sampath | 04696f7 | 2022-06-13 15:19:14 +0530 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | // DiscoveryType type |
| 41 | type DiscoveryType uint8 |
| 42 | |
| 43 | const ( |
| 44 | // DeviceDisc constant |
| 45 | DeviceDisc DiscoveryType = 0 |
| 46 | // DeviceReDisc constant |
| 47 | DeviceReDisc DiscoveryType = 1 |
| 48 | ) |
| 49 | |
| 50 | // IVPClient interface |
| 51 | type IVPClient interface { |
| 52 | ChangeEvent(*ofp.ChangeEvent) error |
Tinoj Joseph | 07cc537 | 2022-07-18 22:53:51 +0530 | [diff] [blame] | 53 | PacketIn(context.Context, *ofp.PacketIn) |
Naveen Sampath | 04696f7 | 2022-06-13 15:19:14 +0530 | [diff] [blame] | 54 | ConnectInd(cxt context.Context, DiscType DiscoveryType) |
| 55 | Stop() |
| 56 | } |
| 57 | |
| 58 | // VPAgent interface |
| 59 | type VPAgent interface { |
| 60 | receiveOltRebootNoti(ctx context.Context) |
| 61 | handleOltRebootNoti(ctx context.Context) |
| 62 | } |
| 63 | |
| 64 | // IVPClientAgent interface |
| 65 | type IVPClientAgent interface { |
| 66 | AddNewDevice(cfg *VPClientCfg) |
Tinoj Joseph | 07cc537 | 2022-07-18 22:53:51 +0530 | [diff] [blame] | 67 | DelDevice(cntx context.Context, id string) |
Naveen Sampath | 04696f7 | 2022-06-13 15:19:14 +0530 | [diff] [blame] | 68 | IsRebootInProgressForDevice(device string) bool |
| 69 | // RebootInd(string, string, string) |
| 70 | IsBlockedDevice(string) bool |
| 71 | AddBlockedDevices(string) |
| 72 | DelBlockedDevices(string) |
| 73 | } |