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" |
| 20 | |
| 21 | "voltha-go-controller/internal/pkg/holder" |
| 22 | |
| 23 | ofp "github.com/opencord/voltha-protos/v5/go/openflow_13" |
| 24 | ) |
| 25 | |
| 26 | // VPClientCfg structure |
| 27 | type VPClientCfg struct { |
| 28 | DeviceID string |
| 29 | SerialNum string |
| 30 | SouthBoundID string |
| 31 | VolthaClient *holder.VolthaServiceClientHolder |
| 32 | PacketOutChannel chan *ofp.PacketOut |
| 33 | } |
| 34 | |
| 35 | // DiscoveryType type |
| 36 | type DiscoveryType uint8 |
| 37 | |
| 38 | const ( |
| 39 | // DeviceDisc constant |
| 40 | DeviceDisc DiscoveryType = 0 |
| 41 | // DeviceReDisc constant |
| 42 | DeviceReDisc DiscoveryType = 1 |
| 43 | ) |
| 44 | |
| 45 | // IVPClient interface |
| 46 | type IVPClient interface { |
| 47 | ChangeEvent(*ofp.ChangeEvent) error |
| 48 | PacketIn(*ofp.PacketIn) |
| 49 | ConnectInd(cxt context.Context, DiscType DiscoveryType) |
| 50 | Stop() |
| 51 | } |
| 52 | |
| 53 | // VPAgent interface |
| 54 | type VPAgent interface { |
| 55 | receiveOltRebootNoti(ctx context.Context) |
| 56 | handleOltRebootNoti(ctx context.Context) |
| 57 | } |
| 58 | |
| 59 | // IVPClientAgent interface |
| 60 | type IVPClientAgent interface { |
| 61 | AddNewDevice(cfg *VPClientCfg) |
| 62 | DelDevice(id string) |
| 63 | IsRebootInProgressForDevice(device string) bool |
| 64 | // RebootInd(string, string, string) |
| 65 | IsBlockedDevice(string) bool |
| 66 | AddBlockedDevices(string) |
| 67 | DelBlockedDevices(string) |
| 68 | } |