| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 1 | /* |
| Joey Armstrong | 11f5a57 | 2024-01-12 19:11:32 -0500 | [diff] [blame] | 2 | * Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 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 | */ |
| Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 16 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 17 | // Package core provides the utility for olt devices, flows and statistics |
| Scott Baker | dbd960e | 2020-02-28 08:57:51 -0800 | [diff] [blame] | 18 | package core |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 19 | |
| 20 | import ( |
| 21 | "context" |
| khenaidoo | efff76e | 2021-12-15 16:51:30 -0500 | [diff] [blame] | 22 | "fmt" |
| Akash Soni | f49299a | 2024-04-25 12:06:37 +0530 | [diff] [blame] | 23 | "sync" |
| 24 | "time" |
| 25 | |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 26 | "github.com/golang/protobuf/ptypes/empty" |
| 27 | conf "github.com/opencord/voltha-lib-go/v7/pkg/config" |
| 28 | "github.com/opencord/voltha-lib-go/v7/pkg/events/eventif" |
| 29 | vgrpc "github.com/opencord/voltha-lib-go/v7/pkg/grpc" |
| 30 | "github.com/opencord/voltha-lib-go/v7/pkg/log" |
| Scott Baker | dbd960e | 2020-02-28 08:57:51 -0800 | [diff] [blame] | 31 | "github.com/opencord/voltha-openolt-adapter/internal/pkg/config" |
| Thomas Lee S | 94109f1 | 2020-03-03 16:39:29 +0530 | [diff] [blame] | 32 | "github.com/opencord/voltha-openolt-adapter/internal/pkg/olterrors" |
| khenaidoo | efff76e | 2021-12-15 16:51:30 -0500 | [diff] [blame] | 33 | "github.com/opencord/voltha-protos/v5/go/adapter_service" |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 34 | "github.com/opencord/voltha-protos/v5/go/common" |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 35 | ca "github.com/opencord/voltha-protos/v5/go/core_adapter" |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 36 | "github.com/opencord/voltha-protos/v5/go/extension" |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 37 | "github.com/opencord/voltha-protos/v5/go/health" |
| 38 | ia "github.com/opencord/voltha-protos/v5/go/inter_adapter" |
| 39 | "github.com/opencord/voltha-protos/v5/go/omci" |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 40 | "github.com/opencord/voltha-protos/v5/go/voltha" |
| nikesh.krishnan | 4d64453 | 2023-12-16 00:21:07 +0530 | [diff] [blame] | 41 | "google.golang.org/grpc/codes" |
| 42 | "google.golang.org/grpc/status" |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 43 | ) |
| 44 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 45 | // OpenOLT structure holds the OLT information |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 46 | type OpenOLT struct { |
| Akash Kankanala | 041a212 | 2024-10-16 15:49:22 +0530 | [diff] [blame] | 47 | eventProxy eventif.EventProxy |
| Abhilash Laxmeshwar | d0f58cf | 2022-06-01 12:15:19 +0530 | [diff] [blame] | 48 | configManager *conf.ConfigManager |
| 49 | deviceHandlers map[string]*DeviceHandler |
| 50 | coreClient *vgrpc.Client |
| Abhilash Laxmeshwar | d0f58cf | 2022-06-01 12:15:19 +0530 | [diff] [blame] | 51 | config *config.AdapterFlags |
| Akash Kankanala | 041a212 | 2024-10-16 15:49:22 +0530 | [diff] [blame] | 52 | exitChannel chan struct{} |
| Abhilash Laxmeshwar | d0f58cf | 2022-06-01 12:15:19 +0530 | [diff] [blame] | 53 | KVStoreAddress string |
| 54 | KVStoreType string |
| Akash Kankanala | 041a212 | 2024-10-16 15:49:22 +0530 | [diff] [blame] | 55 | numOnus int |
| Abhilash Laxmeshwar | d0f58cf | 2022-06-01 12:15:19 +0530 | [diff] [blame] | 56 | HeartbeatCheckInterval time.Duration |
| 57 | HeartbeatFailReportInterval time.Duration |
| 58 | GrpcTimeoutInterval time.Duration |
| Akash Kankanala | 041a212 | 2024-10-16 15:49:22 +0530 | [diff] [blame] | 59 | rpcTimeout time.Duration |
| Abhilash Laxmeshwar | d0f58cf | 2022-06-01 12:15:19 +0530 | [diff] [blame] | 60 | lockDeviceHandlersMap sync.RWMutex |
| 61 | enableONUStats bool |
| 62 | enableGemStats bool |
| Abhilash Laxmeshwar | d0f58cf | 2022-06-01 12:15:19 +0530 | [diff] [blame] | 63 | CheckOnuDevExistenceAtOnuDiscovery bool |
| Sridhar Ravindra | ab785f2 | 2025-07-21 17:20:55 +0530 | [diff] [blame] | 64 | ForceOnuDiscIndProcessing bool |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 65 | } |
| 66 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 67 | // NewOpenOLT returns a new instance of OpenOLT |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 68 | func NewOpenOLT(ctx context.Context, |
| 69 | coreClient *vgrpc.Client, |
| Himani Chawla | cd40780 | 2020-12-10 12:08:59 +0530 | [diff] [blame] | 70 | eventProxy eventif.EventProxy, cfg *config.AdapterFlags, cm *conf.ConfigManager) *OpenOLT { |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 71 | var openOLT OpenOLT |
| khenaidoo | efff76e | 2021-12-15 16:51:30 -0500 | [diff] [blame] | 72 | openOLT.exitChannel = make(chan struct{}) |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 73 | openOLT.deviceHandlers = make(map[string]*DeviceHandler) |
| Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 74 | openOLT.config = cfg |
| 75 | openOLT.numOnus = cfg.OnuNumber |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 76 | openOLT.coreClient = coreClient |
| Devmalya Paul | fb990a5 | 2019-07-09 10:01:49 -0400 | [diff] [blame] | 77 | openOLT.eventProxy = eventProxy |
| Neha Sharma | 3f221ae | 2020-04-29 19:02:12 +0000 | [diff] [blame] | 78 | openOLT.KVStoreAddress = cfg.KVStoreAddress |
| Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 79 | openOLT.KVStoreType = cfg.KVStoreType |
| 80 | openOLT.HeartbeatCheckInterval = cfg.HeartbeatCheckInterval |
| 81 | openOLT.HeartbeatFailReportInterval = cfg.HeartbeatFailReportInterval |
| 82 | openOLT.GrpcTimeoutInterval = cfg.GrpcTimeoutInterval |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 83 | openOLT.lockDeviceHandlersMap = sync.RWMutex{} |
| Matteo Scandolo | dfa7a97 | 2020-11-06 13:03:40 -0800 | [diff] [blame] | 84 | openOLT.configManager = cm |
| Gamze Abaka | fcbd6e7 | 2020-12-17 13:25:16 +0000 | [diff] [blame] | 85 | openOLT.enableONUStats = cfg.EnableONUStats |
| 86 | openOLT.enableGemStats = cfg.EnableGEMStats |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 87 | openOLT.rpcTimeout = cfg.RPCTimeout |
| Abhilash Laxmeshwar | d0f58cf | 2022-06-01 12:15:19 +0530 | [diff] [blame] | 88 | openOLT.CheckOnuDevExistenceAtOnuDiscovery = cfg.CheckOnuDevExistenceAtOnuDiscovery |
| Sridhar Ravindra | ab785f2 | 2025-07-21 17:20:55 +0530 | [diff] [blame] | 89 | openOLT.ForceOnuDiscIndProcessing = cfg.ForceOnuDiscIndProcessing |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 90 | return &openOLT |
| 91 | } |
| 92 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 93 | // Start starts (logs) the device manager |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 94 | func (oo *OpenOLT) Start(ctx context.Context) error { |
| Neha Sharma | 96b7bf2 | 2020-06-15 10:37:32 +0000 | [diff] [blame] | 95 | logger.Info(ctx, "starting-device-manager") |
| 96 | logger.Info(ctx, "device-manager-started") |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 97 | return nil |
| 98 | } |
| 99 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 100 | // Stop terminates the session |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 101 | func (oo *OpenOLT) Stop(ctx context.Context) error { |
| Neha Sharma | 96b7bf2 | 2020-06-15 10:37:32 +0000 | [diff] [blame] | 102 | logger.Info(ctx, "stopping-device-manager") |
| khenaidoo | efff76e | 2021-12-15 16:51:30 -0500 | [diff] [blame] | 103 | close(oo.exitChannel) |
| 104 | // Stop the device handlers |
| 105 | oo.stopAllDeviceHandlers(ctx) |
| 106 | |
| 107 | // Stop the core grpc client connection |
| 108 | if oo.coreClient != nil { |
| 109 | oo.coreClient.Stop(ctx) |
| 110 | } |
| 111 | |
| Neha Sharma | 96b7bf2 | 2020-06-15 10:37:32 +0000 | [diff] [blame] | 112 | logger.Info(ctx, "device-manager-stopped") |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 113 | return nil |
| 114 | } |
| 115 | |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 116 | func (oo *OpenOLT) addDeviceHandlerToMap(agent *DeviceHandler) { |
| 117 | oo.lockDeviceHandlersMap.Lock() |
| 118 | defer oo.lockDeviceHandlersMap.Unlock() |
| Thomas Lee S | 985938d | 2020-05-04 11:40:41 +0530 | [diff] [blame] | 119 | if _, exist := oo.deviceHandlers[agent.device.Id]; !exist { |
| 120 | oo.deviceHandlers[agent.device.Id] = agent |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 121 | } |
| 122 | } |
| 123 | |
| 124 | func (oo *OpenOLT) deleteDeviceHandlerToMap(agent *DeviceHandler) { |
| 125 | oo.lockDeviceHandlersMap.Lock() |
| 126 | defer oo.lockDeviceHandlersMap.Unlock() |
| Thomas Lee S | 985938d | 2020-05-04 11:40:41 +0530 | [diff] [blame] | 127 | delete(oo.deviceHandlers, agent.device.Id) |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 128 | } |
| 129 | |
| Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 130 | func (oo *OpenOLT) getDeviceHandler(deviceID string) *DeviceHandler { |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 131 | oo.lockDeviceHandlersMap.Lock() |
| 132 | defer oo.lockDeviceHandlersMap.Unlock() |
| Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 133 | if agent, ok := oo.deviceHandlers[deviceID]; ok { |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 134 | return agent |
| 135 | } |
| 136 | return nil |
| 137 | } |
| 138 | |
| khenaidoo | efff76e | 2021-12-15 16:51:30 -0500 | [diff] [blame] | 139 | func (oo *OpenOLT) stopAllDeviceHandlers(ctx context.Context) { |
| 140 | oo.lockDeviceHandlersMap.Lock() |
| 141 | defer oo.lockDeviceHandlersMap.Unlock() |
| 142 | for _, handler := range oo.deviceHandlers { |
| 143 | handler.Stop(ctx) |
| 144 | } |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 145 | } |
| 146 | |
| 147 | // AdoptDevice creates a new device handler if not present already and then adopts the device |
| 148 | func (oo *OpenOLT) AdoptDevice(ctx context.Context, device *voltha.Device) (*empty.Empty, error) { |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 149 | if device == nil { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 150 | return nil, olterrors.NewErrInvalidValue(log.Fields{"device": nil}, nil).Log() |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 151 | } |
| divyadesai | 3af43e1 | 2020-08-18 07:10:54 +0000 | [diff] [blame] | 152 | logger.Infow(ctx, "adopt-device", log.Fields{"device-id": device.Id}) |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 153 | var handler *DeviceHandler |
| 154 | if handler = oo.getDeviceHandler(device.Id); handler == nil { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 155 | handler := NewDeviceHandler(oo.coreClient, oo.eventProxy, device, oo, oo.configManager, oo.config) |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 156 | oo.addDeviceHandlerToMap(handler) |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 157 | go handler.AdoptDevice(log.WithSpanFromContext(context.Background(), ctx), device) |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 158 | } |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 159 | return &empty.Empty{}, nil |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 160 | } |
| 161 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 162 | // GetOfpDeviceInfo returns OFP information for the given device |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 163 | func (oo *OpenOLT) GetOfpDeviceInfo(ctx context.Context, device *voltha.Device) (*ca.SwitchCapability, error) { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 164 | logger.Infow(ctx, "get_ofp_device_info", log.Fields{"device-id": device.Id}) |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 165 | if handler := oo.getDeviceHandler(device.Id); handler != nil { |
| 166 | return handler.GetOfpDeviceInfo(device) |
| 167 | } |
| Girish Kumar | f26e488 | 2020-03-05 06:49:10 +0000 | [diff] [blame] | 168 | return nil, olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil) |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 169 | } |
| 170 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 171 | // ReconcileDevice unimplemented |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 172 | func (oo *OpenOLT) ReconcileDevice(ctx context.Context, device *voltha.Device) (*empty.Empty, error) { |
| Abhilash Laxmeshwar | ab0bd52 | 2019-10-21 15:05:15 +0530 | [diff] [blame] | 173 | if device == nil { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 174 | return nil, olterrors.NewErrInvalidValue(log.Fields{"device": nil}, nil) |
| Abhilash Laxmeshwar | ab0bd52 | 2019-10-21 15:05:15 +0530 | [diff] [blame] | 175 | } |
| divyadesai | 3af43e1 | 2020-08-18 07:10:54 +0000 | [diff] [blame] | 176 | logger.Infow(ctx, "reconcile-device", log.Fields{"device-id": device.Id}) |
| Abhilash Laxmeshwar | ab0bd52 | 2019-10-21 15:05:15 +0530 | [diff] [blame] | 177 | var handler *DeviceHandler |
| 178 | if handler = oo.getDeviceHandler(device.Id); handler == nil { |
| Maninder | e49938d | 2021-03-19 00:23:24 +0530 | [diff] [blame] | 179 | //Setting state to RECONCILING |
| Nandita Biradar | 1b590f1 | 2024-09-27 10:56:28 +0530 | [diff] [blame] | 180 | // Fetch previous state |
| 181 | //here we are fetching the previous operation states of the device,so to check which operation state it was previously for proper transition and proper clean up of the resources. |
| 182 | PrevOperStatus := device.OperStatus |
| 183 | |
| 184 | // Log previous state |
| 185 | logger.Infow(ctx, "previous-device-state", log.Fields{ |
| 186 | "device-id": device.Id, |
| 187 | "previous-operStatus": PrevOperStatus, |
| 188 | "Device-connStatus": device.ConnectStatus, |
| 189 | }) |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 190 | cgClient, err := oo.coreClient.GetCoreServiceClient() |
| Maninder | e49938d | 2021-03-19 00:23:24 +0530 | [diff] [blame] | 191 | if err != nil { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 192 | return nil, err |
| Maninder | e49938d | 2021-03-19 00:23:24 +0530 | [diff] [blame] | 193 | } |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 194 | subCtx, cancel := context.WithTimeout(log.WithSpanFromContext(context.Background(), ctx), oo.rpcTimeout) |
| 195 | defer cancel() |
| Nandita Biradar | 1b590f1 | 2024-09-27 10:56:28 +0530 | [diff] [blame] | 196 | // Create DeviceStateFilter with new state |
| 197 | deviceStateFilter := &ca.DeviceStateFilter{ |
| 198 | DeviceId: device.Id, |
| 199 | OperStatus: voltha.OperStatus_RECONCILING, |
| 200 | ConnStatus: device.ConnectStatus, |
| 201 | } |
| 202 | |
| 203 | // Log the new state being set |
| 204 | logger.Infow(ctx, "setting-new-device-state", log.Fields{ |
| 205 | "device-id": deviceStateFilter.DeviceId, |
| 206 | "new-operStatus": deviceStateFilter.OperStatus, |
| 207 | "new-connStatus": deviceStateFilter.ConnStatus, |
| 208 | }) |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 209 | if _, err := cgClient.DeviceStateUpdate(subCtx, &ca.DeviceStateFilter{ |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 210 | DeviceId: device.Id, |
| 211 | OperStatus: voltha.OperStatus_RECONCILING, |
| Akash Soni | f49299a | 2024-04-25 12:06:37 +0530 | [diff] [blame] | 212 | ConnStatus: voltha.ConnectStatus_UNREACHABLE, |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 213 | }); err != nil { |
| 214 | return nil, olterrors.NewErrAdapter("device-update-failed", log.Fields{"device-id": device.Id}, err) |
| 215 | } |
| 216 | |
| Akash Soni | f49299a | 2024-04-25 12:06:37 +0530 | [diff] [blame] | 217 | // The OperState and connection state of the device is set to RECONCILING and UNREACHABLE in the previous section. This also needs to be set on the |
| Girish Gowdra | 0fb24a3 | 2021-10-27 15:15:27 -0700 | [diff] [blame] | 218 | // locally cached copy of the device struct. |
| 219 | device.OperStatus = voltha.OperStatus_RECONCILING |
| Akash Soni | f49299a | 2024-04-25 12:06:37 +0530 | [diff] [blame] | 220 | device.ConnectStatus = voltha.ConnectStatus_UNREACHABLE |
| Girish Gowdra | 0fb24a3 | 2021-10-27 15:15:27 -0700 | [diff] [blame] | 221 | handler := NewDeviceHandler(oo.coreClient, oo.eventProxy, device, oo, oo.configManager, oo.config) |
| 222 | handler.adapterPreviouslyConnected = true |
| Nandita Biradar | 1b590f1 | 2024-09-27 10:56:28 +0530 | [diff] [blame] | 223 | handler.prevOperStatus = PrevOperStatus |
| Girish Gowdra | 0fb24a3 | 2021-10-27 15:15:27 -0700 | [diff] [blame] | 224 | oo.addDeviceHandlerToMap(handler) |
| 225 | handler.transitionMap = NewTransitionMap(handler) |
| 226 | |
| Nandita Biradar | 1b590f1 | 2024-09-27 10:56:28 +0530 | [diff] [blame] | 227 | go handler.transitionMap.Handle(log.WithSpanFromContext(context.Background(), ctx), DeviceInit) |
| nikesh.krishnan | 4d64453 | 2023-12-16 00:21:07 +0530 | [diff] [blame] | 228 | } else { |
| 229 | logger.Warnf(ctx, "device-already-reconciled-or-active", log.Fields{"device-id": device.Id}) |
| 230 | return &empty.Empty{}, status.Errorf(codes.AlreadyExists, "handler exists: %s", device.Id) |
| Abhilash Laxmeshwar | ab0bd52 | 2019-10-21 15:05:15 +0530 | [diff] [blame] | 231 | } |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 232 | return &empty.Empty{}, nil |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 233 | } |
| 234 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 235 | // DisableDevice disables the given device |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 236 | func (oo *OpenOLT) DisableDevice(ctx context.Context, device *voltha.Device) (*empty.Empty, error) { |
| divyadesai | 3af43e1 | 2020-08-18 07:10:54 +0000 | [diff] [blame] | 237 | logger.Infow(ctx, "disable-device", log.Fields{"device-id": device.Id}) |
| Girish Gowdru | 5ba46c9 | 2019-04-25 05:00:05 -0400 | [diff] [blame] | 238 | if handler := oo.getDeviceHandler(device.Id); handler != nil { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 239 | if err := handler.DisableDevice(log.WithSpanFromContext(context.Background(), ctx), device); err != nil { |
| 240 | return nil, err |
| 241 | } |
| 242 | return &empty.Empty{}, nil |
| Girish Gowdru | 5ba46c9 | 2019-04-25 05:00:05 -0400 | [diff] [blame] | 243 | } |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 244 | return nil, olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil) |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 245 | } |
| 246 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 247 | // ReEnableDevice enables the olt device after disable |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 248 | func (oo *OpenOLT) ReEnableDevice(ctx context.Context, device *voltha.Device) (*empty.Empty, error) { |
| divyadesai | 3af43e1 | 2020-08-18 07:10:54 +0000 | [diff] [blame] | 249 | logger.Infow(ctx, "reenable-device", log.Fields{"device-id": device.Id}) |
| Girish Gowdru | 5ba46c9 | 2019-04-25 05:00:05 -0400 | [diff] [blame] | 250 | if handler := oo.getDeviceHandler(device.Id); handler != nil { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 251 | if err := handler.ReenableDevice(log.WithSpanFromContext(context.Background(), ctx), device); err != nil { |
| 252 | return nil, err |
| 253 | } |
| 254 | return &empty.Empty{}, nil |
| Girish Gowdru | 5ba46c9 | 2019-04-25 05:00:05 -0400 | [diff] [blame] | 255 | } |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 256 | return nil, olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil) |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 257 | } |
| 258 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 259 | // RebootDevice reboots the given device |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 260 | func (oo *OpenOLT) RebootDevice(ctx context.Context, device *voltha.Device) (*empty.Empty, error) { |
| divyadesai | 3af43e1 | 2020-08-18 07:10:54 +0000 | [diff] [blame] | 261 | logger.Infow(ctx, "reboot-device", log.Fields{"device-id": device.Id}) |
| Girish Gowdru | 0fe5f7e | 2019-05-28 05:12:27 -0400 | [diff] [blame] | 262 | if handler := oo.getDeviceHandler(device.Id); handler != nil { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 263 | if err := handler.RebootDevice(log.WithSpanFromContext(context.Background(), ctx), device); err != nil { |
| 264 | return nil, err |
| 265 | } |
| 266 | return &empty.Empty{}, nil |
| Girish Gowdru | 0fe5f7e | 2019-05-28 05:12:27 -0400 | [diff] [blame] | 267 | } |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 268 | return nil, olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil) |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 269 | } |
| 270 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 271 | // DeleteDevice deletes a device |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 272 | func (oo *OpenOLT) DeleteDevice(ctx context.Context, device *voltha.Device) (*empty.Empty, error) { |
| divyadesai | 3af43e1 | 2020-08-18 07:10:54 +0000 | [diff] [blame] | 273 | logger.Infow(ctx, "delete-device", log.Fields{"device-id": device.Id}) |
| Devmalya Paul | 495b94a | 2019-08-27 19:42:00 -0400 | [diff] [blame] | 274 | if handler := oo.getDeviceHandler(device.Id); handler != nil { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 275 | if err := handler.DeleteDevice(log.WithSpanFromContext(context.Background(), ctx), device); err != nil { |
| Gustavo Silva | 41af912 | 2022-10-11 11:05:13 -0300 | [diff] [blame] | 276 | return nil, err |
| Devmalya Paul | 495b94a | 2019-08-27 19:42:00 -0400 | [diff] [blame] | 277 | } |
| Akash Soni | 5c76e27 | 2024-01-15 04:09:24 +0530 | [diff] [blame] | 278 | // Initialize a ticker with a 2-second interval to periodically check the states |
| 279 | ticker := time.NewTicker(2 * time.Second) |
| 280 | defer ticker.Stop() |
| 281 | |
| 282 | // Set a maximum timeout duration of 30 seconds for the loop |
| 283 | timeout := time.After(30 * time.Second) |
| 284 | |
| 285 | for { |
| 286 | select { |
| 287 | case <-ticker.C: |
| 288 | // Check if all processes have stopped |
| 289 | if !handler.isHeartbeatCheckActive && !handler.isCollectorActive && !handler.isReadIndicationRoutineActive { |
| 290 | logger.Debugf(ctx, "delete-device-handler") |
| 291 | oo.deleteDeviceHandlerToMap(handler) |
| 292 | return &empty.Empty{}, nil |
| 293 | } |
| 294 | case <-timeout: |
| 295 | // Timeout exceeded |
| 296 | logger.Warnw(ctx, "delete-device-handler timeout exceeded", log.Fields{"device-id": device.Id}) |
| 297 | oo.deleteDeviceHandlerToMap(handler) // Clean up anyway |
| 298 | return &empty.Empty{}, nil |
| 299 | } |
| 300 | } |
| Devmalya Paul | 495b94a | 2019-08-27 19:42:00 -0400 | [diff] [blame] | 301 | } |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 302 | return nil, olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil) |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 303 | } |
| 304 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 305 | // UpdateFlowsIncrementally updates (add/remove) the flows on a given device |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 306 | func (oo *OpenOLT) UpdateFlowsIncrementally(ctx context.Context, incrFlows *ca.IncrementalFlows) (*empty.Empty, error) { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 307 | logger.Infow(ctx, "update_flows_incrementally", log.Fields{"device-id": incrFlows.Device.Id, "flows": incrFlows.Flows, "flowMetadata": incrFlows.FlowMetadata}) |
| 308 | if handler := oo.getDeviceHandler(incrFlows.Device.Id); handler != nil { |
| 309 | if err := handler.UpdateFlowsIncrementally(log.WithSpanFromContext(context.Background(), ctx), incrFlows.Device, incrFlows.Flows, incrFlows.Groups, incrFlows.FlowMetadata); err != nil { |
| 310 | return nil, err |
| 311 | } |
| 312 | return &empty.Empty{}, nil |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 313 | } |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 314 | return nil, olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": incrFlows.Device.Id}, nil) |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 315 | } |
| 316 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 317 | // UpdatePmConfig returns PmConfigs nil or error |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 318 | func (oo *OpenOLT) UpdatePmConfig(ctx context.Context, configs *ca.PmConfigsInfo) (*empty.Empty, error) { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 319 | logger.Debugw(ctx, "update_pm_config", log.Fields{"device-id": configs.DeviceId, "pm-configs": configs.PmConfigs}) |
| 320 | if handler := oo.getDeviceHandler(configs.DeviceId); handler != nil { |
| 321 | handler.UpdatePmConfig(log.WithSpanFromContext(context.Background(), ctx), configs.PmConfigs) |
| 322 | return &empty.Empty{}, nil |
| Rohan Agrawal | da5e0b2 | 2020-05-20 11:10:26 +0000 | [diff] [blame] | 323 | } |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 324 | return nil, olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": configs.DeviceId}, nil) |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 325 | } |
| 326 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 327 | // SendPacketOut sends packet out to the device |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 328 | func (oo *OpenOLT) SendPacketOut(ctx context.Context, packet *ca.PacketOut) (*empty.Empty, error) { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 329 | logger.Debugw(ctx, "send_packet_out", log.Fields{"device-id": packet.DeviceId, "egress_port_no": packet.EgressPortNo, "pkt": packet.Packet}) |
| 330 | if handler := oo.getDeviceHandler(packet.DeviceId); handler != nil { |
| 331 | if err := handler.PacketOut(log.WithSpanFromContext(context.Background(), ctx), packet.EgressPortNo, packet.Packet); err != nil { |
| 332 | return nil, err |
| 333 | } |
| 334 | return &empty.Empty{}, nil |
| manikkaraj k | 9eb6cac | 2019-05-09 12:32:03 -0400 | [diff] [blame] | 335 | } |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 336 | return nil, olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": packet.DeviceId}, nil) |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 337 | } |
| 338 | |
| balaji.nagarajan | 68f56e8 | 2025-07-04 15:16:01 +0530 | [diff] [blame] | 339 | // EnableOnuSerialNumber to Enable onu serial number |
| 340 | func (oo *OpenOLT) EnableOnuSerialNumber(ctx context.Context, device *voltha.OnuSerialNumberOnOLTPon) (*empty.Empty, error) { |
| 341 | logger.Infow(ctx, "enable_onu_serial_number", log.Fields{"olt_device_id": device.OltDeviceId, "onu_serial_number": device.SerialNumber}) |
| 342 | if err := oo.enableDisableOnuSerialNumber(log.WithSpanFromContext(context.Background(), ctx), device, true); err != nil { |
| 343 | return nil, err |
| 344 | } |
| 345 | return &empty.Empty{}, nil |
| 346 | } |
| 347 | |
| 348 | // DisableOnuSerialNumber to Disable onu serial number |
| 349 | func (oo *OpenOLT) DisableOnuSerialNumber(ctx context.Context, device *voltha.OnuSerialNumberOnOLTPon) (*empty.Empty, error) { |
| 350 | logger.Infow(ctx, "disable_onu_serial_number", log.Fields{"olt_device_id": device.OltDeviceId, "onu_serial_number": device.SerialNumber}) |
| 351 | if err := oo.enableDisableOnuSerialNumber(log.WithSpanFromContext(context.Background(), ctx), device, false); err != nil { |
| 352 | return nil, err |
| 353 | } |
| 354 | return &empty.Empty{}, nil |
| 355 | } |
| 356 | |
| 357 | // enableDisableOnuSerialNumber to Disable onu or Enable onu |
| 358 | func (oo *OpenOLT) enableDisableOnuSerialNumber(ctx context.Context, device *voltha.OnuSerialNumberOnOLTPon, enable bool) error { |
| 359 | if device.OltDeviceId == nil { |
| 360 | return olterrors.NewErrInvalidValue(log.Fields{ |
| 361 | "reason": "olt device id is required", |
| 362 | }, nil) |
| 363 | } |
| 364 | if device.SerialNumber == "" { |
| 365 | return olterrors.NewErrInvalidValue(log.Fields{ |
| 366 | "reason": "onu_serial_number cannot be empty", |
| 367 | }, nil) |
| 368 | } |
| 369 | if device.Port == nil { |
| 370 | return olterrors.NewErrInvalidValue(log.Fields{ |
| 371 | "reason": "pon port cannot be empty", |
| 372 | }, nil) |
| 373 | } |
| 374 | if handler := oo.getDeviceHandler(device.OltDeviceId.Id); handler != nil { |
| 375 | if enable { |
| 376 | if err := handler.EnableOnuSerialNumber(ctx, device); err != nil { |
| 377 | return olterrors.NewErrAdapter("error-occurred-during-enable-onu-serial-number", log.Fields{"device-id": device.OltDeviceId.Id, "sn": device.SerialNumber}, err) |
| 378 | } |
| 379 | } else { |
| 380 | if err := handler.DisableOnuSerialNumber(ctx, device); err != nil { |
| 381 | return olterrors.NewErrAdapter("error-occurred-during-disable-onu-serial-number", log.Fields{"device-id": device.OltDeviceId.Id, "sn": device.SerialNumber}, err) |
| 382 | } |
| 383 | } |
| 384 | return nil |
| 385 | } |
| 386 | return olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": device.OltDeviceId.Id}, nil) |
| 387 | } |
| 388 | |
| 389 | // EnableOnuDevice to Enable onu |
| 390 | func (oo *OpenOLT) EnableOnuDevice(ctx context.Context, device *voltha.Device) (*empty.Empty, error) { |
| 391 | logger.Infow(ctx, "enable_onu", log.Fields{"onu_device_id": device.Id, "onu_serial_number": device.SerialNumber}) |
| 392 | if err := oo.enableDisableOnuDevice(log.WithSpanFromContext(context.Background(), ctx), device, true); err != nil { |
| 393 | return nil, err |
| 394 | } |
| 395 | return &empty.Empty{}, nil |
| 396 | } |
| 397 | |
| 398 | // DisableOnuDevice to Disable onu |
| 399 | func (oo *OpenOLT) DisableOnuDevice(ctx context.Context, device *voltha.Device) (*empty.Empty, error) { |
| 400 | logger.Infow(ctx, "disable_onu", log.Fields{"onu_device_id": device.Id, "onu_serial_number": device.SerialNumber}) |
| 401 | if err := oo.enableDisableOnuDevice(log.WithSpanFromContext(context.Background(), ctx), device, false); err != nil { |
| 402 | return nil, err |
| 403 | } |
| 404 | return &empty.Empty{}, nil |
| 405 | } |
| 406 | |
| 407 | // enableDisableOnuDevice to Disable onu or Enable onu |
| 408 | func (oo *OpenOLT) enableDisableOnuDevice(ctx context.Context, device *voltha.Device, enable bool) error { |
| 409 | if device.ParentId == "" { |
| 410 | return olterrors.NewErrInvalidValue(log.Fields{ |
| 411 | "reason": "olt device id is required", |
| 412 | }, nil) |
| 413 | } |
| 414 | if device.SerialNumber == "" { |
| 415 | return olterrors.NewErrInvalidValue(log.Fields{ |
| 416 | "reason": "onu_serial_number cannot be empty", |
| 417 | }, nil) |
| 418 | } |
| 419 | if handler := oo.getDeviceHandler(device.ParentId); handler != nil { |
| 420 | if enable { |
| 421 | if err := handler.EnableOnu(ctx, device); err != nil { |
| 422 | return olterrors.NewErrAdapter("error-occurred-during-enable-onu", log.Fields{"device-id": device.ParentId, "sn": device.SerialNumber}, err) |
| 423 | } |
| 424 | } else { |
| 425 | if err := handler.DisableOnu(ctx, device); err != nil { |
| 426 | return olterrors.NewErrAdapter("error-occurred-during-disable-onu", log.Fields{"device-id": device.ParentId, "sn": device.SerialNumber}, err) |
| 427 | } |
| 428 | } |
| 429 | return nil |
| 430 | } |
| 431 | return olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": device.ParentId}, nil) |
| 432 | } |
| 433 | |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 434 | // EnablePort to Enable PON/NNI interface |
| 435 | func (oo *OpenOLT) EnablePort(ctx context.Context, port *voltha.Port) (*empty.Empty, error) { |
| 436 | logger.Infow(ctx, "enable_port", log.Fields{"device-id": port.DeviceId, "port": port}) |
| 437 | if err := oo.enableDisablePort(log.WithSpanFromContext(context.Background(), ctx), port.DeviceId, port, true); err != nil { |
| 438 | return nil, err |
| 439 | } |
| 440 | return &empty.Empty{}, nil |
| Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 441 | } |
| 442 | |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 443 | // DisablePort to Disable pon/nni interface |
| 444 | func (oo *OpenOLT) DisablePort(ctx context.Context, port *voltha.Port) (*empty.Empty, error) { |
| 445 | logger.Infow(ctx, "disable_port", log.Fields{"device-id": port.DeviceId, "port": port}) |
| 446 | if err := oo.enableDisablePort(log.WithSpanFromContext(context.Background(), ctx), port.DeviceId, port, false); err != nil { |
| 447 | return nil, err |
| 448 | } |
| 449 | return &empty.Empty{}, nil |
| kesavand | 39e0aa3 | 2020-01-28 20:58:50 -0500 | [diff] [blame] | 450 | } |
| 451 | |
| 452 | // enableDisablePort to Disable pon or Enable PON interface |
| Neha Sharma | 96b7bf2 | 2020-06-15 10:37:32 +0000 | [diff] [blame] | 453 | func (oo *OpenOLT) enableDisablePort(ctx context.Context, deviceID string, port *voltha.Port, enablePort bool) error { |
| divyadesai | 3af43e1 | 2020-08-18 07:10:54 +0000 | [diff] [blame] | 454 | logger.Infow(ctx, "enableDisablePort", log.Fields{"device-id": deviceID, "port": port}) |
| kesavand | 39e0aa3 | 2020-01-28 20:58:50 -0500 | [diff] [blame] | 455 | if port == nil { |
| Thomas Lee S | 94109f1 | 2020-03-03 16:39:29 +0530 | [diff] [blame] | 456 | return olterrors.NewErrInvalidValue(log.Fields{ |
| David K. Bainbridge | 794735f | 2020-02-11 21:01:37 -0800 | [diff] [blame] | 457 | "reason": "port cannot be nil", |
| 458 | "device-id": deviceID, |
| Girish Kumar | f26e488 | 2020-03-05 06:49:10 +0000 | [diff] [blame] | 459 | "port": nil}, nil) |
| kesavand | 39e0aa3 | 2020-01-28 20:58:50 -0500 | [diff] [blame] | 460 | } |
| 461 | if handler := oo.getDeviceHandler(deviceID); handler != nil { |
| divyadesai | 3af43e1 | 2020-08-18 07:10:54 +0000 | [diff] [blame] | 462 | logger.Debugw(ctx, "Enable_Disable_Port", log.Fields{"device-id": deviceID, "port": port}) |
| kesavand | 39e0aa3 | 2020-01-28 20:58:50 -0500 | [diff] [blame] | 463 | if enablePort { |
| Neha Sharma | 96b7bf2 | 2020-06-15 10:37:32 +0000 | [diff] [blame] | 464 | if err := handler.EnablePort(ctx, port); err != nil { |
| divyadesai | 3af43e1 | 2020-08-18 07:10:54 +0000 | [diff] [blame] | 465 | return olterrors.NewErrAdapter("error-occurred-during-enable-port", log.Fields{"device-id": deviceID, "port": port}, err) |
| kesavand | 39e0aa3 | 2020-01-28 20:58:50 -0500 | [diff] [blame] | 466 | } |
| 467 | } else { |
| Neha Sharma | 96b7bf2 | 2020-06-15 10:37:32 +0000 | [diff] [blame] | 468 | if err := handler.DisablePort(ctx, port); err != nil { |
| divyadesai | 3af43e1 | 2020-08-18 07:10:54 +0000 | [diff] [blame] | 469 | return olterrors.NewErrAdapter("error-occurred-during-disable-port", log.Fields{"device-id": deviceID, "port": port}, err) |
| kesavand | 39e0aa3 | 2020-01-28 20:58:50 -0500 | [diff] [blame] | 470 | } |
| 471 | } |
| 472 | } |
| 473 | return nil |
| 474 | } |
| Chaitrashree G S | 1a55b88 | 2020-02-04 17:35:35 -0500 | [diff] [blame] | 475 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 476 | // ChildDeviceLost deletes the ONU and its references from PONResources |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 477 | func (oo *OpenOLT) ChildDeviceLost(ctx context.Context, childDevice *voltha.Device) (*empty.Empty, error) { |
| Girish Gowdra | a087056 | 2021-03-11 14:30:14 -0800 | [diff] [blame] | 478 | logger.Infow(ctx, "Child-device-lost", log.Fields{"parent-device-id": childDevice.ParentId, "child-device-id": childDevice.Id}) |
| 479 | if handler := oo.getDeviceHandler(childDevice.ParentId); handler != nil { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 480 | if err := handler.ChildDeviceLost(log.WithSpanFromContext(context.Background(), ctx), childDevice.ParentPortNo, childDevice.ProxyAddress.OnuId, childDevice.SerialNumber); err != nil { |
| 481 | return nil, err |
| 482 | } |
| 483 | return &empty.Empty{}, nil |
| Chaitrashree G S | 1a55b88 | 2020-02-04 17:35:35 -0500 | [diff] [blame] | 484 | } |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 485 | return nil, olterrors.NewErrNotFound("device-handler", log.Fields{"parent-device-id": childDevice.ParentId}, nil).Log() |
| Chaitrashree G S | 1a55b88 | 2020-02-04 17:35:35 -0500 | [diff] [blame] | 486 | } |
| Scott Baker | 24f83e2 | 2020-03-30 16:14:28 -0700 | [diff] [blame] | 487 | |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 488 | // GetExtValue retrieves a value on a particular ONU |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 489 | func (oo *OpenOLT) GetExtValue(ctx context.Context, extInfo *ca.GetExtValueMessage) (*extension.ReturnValues, error) { |
| Dinesh Belwalkar | db587af | 2020-02-27 15:37:16 -0800 | [diff] [blame] | 490 | var err error |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 491 | resp := new(extension.ReturnValues) |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 492 | logger.Infow(ctx, "get_ext_value", log.Fields{"parent-device-id": extInfo.ParentDevice.Id, "onu-id": extInfo.ChildDevice.Id}) |
| 493 | if handler := oo.getDeviceHandler(extInfo.ParentDevice.Id); handler != nil { |
| 494 | if resp, err = handler.getExtValue(ctx, extInfo.ChildDevice, extInfo.ValueType); err != nil { |
| 495 | logger.Errorw(ctx, "error-occurred-during-get-ext-value", |
| 496 | log.Fields{"parent-device-id": extInfo.ParentDevice.Id, "onu-id": extInfo.ChildDevice.Id, "error": err}) |
| Dinesh Belwalkar | db587af | 2020-02-27 15:37:16 -0800 | [diff] [blame] | 497 | return nil, err |
| 498 | } |
| 499 | } |
| 500 | return resp, nil |
| 501 | } |
| kesavand | 6212621 | 2021-01-12 04:56:06 -0500 | [diff] [blame] | 502 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 503 | // GetSingleValue handles get uni status on ONU and ondemand metric on OLT |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 504 | func (oo *OpenOLT) GetSingleValue(ctx context.Context, request *extension.SingleGetValueRequest) (*extension.SingleGetValueResponse, error) { |
| 505 | logger.Infow(ctx, "single_get_value_request", log.Fields{"request": request}) |
| Akash Reddy Kankanala | c6b6ca1 | 2025-06-12 14:26:57 +0530 | [diff] [blame] | 506 | var handler *DeviceHandler |
| 507 | var onuDevice *voltha.Device |
| kesavand | 6212621 | 2021-01-12 04:56:06 -0500 | [diff] [blame] | 508 | |
| 509 | errResp := func(status extension.GetValueResponse_Status, |
| 510 | reason extension.GetValueResponse_ErrorReason) *extension.SingleGetValueResponse { |
| 511 | return &extension.SingleGetValueResponse{ |
| 512 | Response: &extension.GetValueResponse{ |
| 513 | Status: status, |
| 514 | ErrReason: reason, |
| 515 | }, |
| 516 | } |
| 517 | } |
| Akash Reddy Kankanala | c6b6ca1 | 2025-06-12 14:26:57 +0530 | [diff] [blame] | 518 | |
| 519 | switch request.GetRequest().GetRequest().(type) { |
| 520 | case *extension.GetValueRequest_OnuStatsFromOlt: |
| 521 | handler, onuDevice = oo.GetDeviceHandlerFromChild(ctx, request.TargetId) |
| 522 | default: |
| 523 | handler = oo.getDeviceHandler(request.TargetId) |
| 524 | } |
| 525 | |
| 526 | if handler != nil { |
| kesavand | 6212621 | 2021-01-12 04:56:06 -0500 | [diff] [blame] | 527 | switch reqType := request.GetRequest().GetRequest().(type) { |
| 528 | case *extension.GetValueRequest_OltPortInfo: |
| 529 | return handler.getOltPortCounters(ctx, reqType.OltPortInfo), nil |
| Himani Chawla | 2c8ae0f | 2021-05-18 23:27:00 +0530 | [diff] [blame] | 530 | case *extension.GetValueRequest_OnuPonInfo: |
| 531 | return handler.getOnuPonCounters(ctx, reqType.OnuPonInfo), nil |
| Gamze Abaka | 85e9a14 | 2021-05-26 13:41:39 +0000 | [diff] [blame] | 532 | case *extension.GetValueRequest_RxPower: |
| 533 | return handler.getRxPower(ctx, reqType.RxPower), nil |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 534 | case *extension.GetValueRequest_OltRxPower: |
| 535 | return handler.getPONRxPower(ctx, reqType.OltRxPower), nil |
| Akash Soni | 3bcf5e0 | 2024-12-03 08:01:48 +0530 | [diff] [blame] | 536 | case *extension.GetValueRequest_OffloadedAppsStats: |
| 537 | return handler.getOltOffloadStats(ctx, reqType.OffloadedAppsStats), nil |
| Akash Reddy Kankanala | c6b6ca1 | 2025-06-12 14:26:57 +0530 | [diff] [blame] | 538 | case *extension.GetValueRequest_OnuStatsFromOlt: |
| 539 | return handler.getOnuStatsFromOlt(ctx, reqType.OnuStatsFromOlt, onuDevice), nil |
| Akash Reddy Kankanala | d9ec482 | 2025-06-10 22:59:53 +0530 | [diff] [blame] | 540 | case *extension.GetValueRequest_OltPonStats: |
| 541 | return handler.getPonPortStats(ctx, reqType.OltPonStats), nil |
| 542 | case *extension.GetValueRequest_OltNniStats: |
| 543 | return handler.getNniPortStats(ctx, reqType.OltNniStats), nil |
| kesavand | 6212621 | 2021-01-12 04:56:06 -0500 | [diff] [blame] | 544 | default: |
| 545 | return errResp(extension.GetValueResponse_ERROR, extension.GetValueResponse_UNSUPPORTED), nil |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | logger.Infow(ctx, "Single_get_value_request failed ", log.Fields{"request": request}) |
| 550 | return errResp(extension.GetValueResponse_ERROR, extension.GetValueResponse_INVALID_DEVICE_ID), nil |
| 551 | } |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 552 | |
| Akash Soni | 3bcf5e0 | 2024-12-03 08:01:48 +0530 | [diff] [blame] | 553 | // SetSingleValue is implemented |
| 554 | func (oo *OpenOLT) SetSingleValue(ctx context.Context, request *extension.SingleSetValueRequest) (*extension.SingleSetValueResponse, error) { |
| 555 | logger.Infow(ctx, "single_set_value_request", log.Fields{"request": request}) |
| 556 | |
| 557 | errResp := func(status extension.SetValueResponse_Status, |
| 558 | reason extension.SetValueResponse_ErrorReason) *extension.SingleSetValueResponse { |
| 559 | return &extension.SingleSetValueResponse{ |
| 560 | Response: &extension.SetValueResponse{ |
| 561 | Status: status, |
| 562 | ErrReason: reason, |
| 563 | }, |
| 564 | } |
| 565 | } |
| 566 | if handler := oo.getDeviceHandler(request.TargetId); handler != nil { |
| 567 | switch reqType := request.GetRequest().GetRequest().(type) { |
| 568 | case *extension.SetValueRequest_AppOffloadConfig: |
| Akash Soni | 3c75ad7 | 2024-12-23 12:09:48 +0530 | [diff] [blame] | 569 | return handler.setOltOffload(ctx, reqType.AppOffloadConfig), nil |
| 570 | case *extension.SetValueRequest_AppOffloadOnuConfig: |
| 571 | return handler.setOnuOffload(ctx, reqType.AppOffloadOnuConfig), nil |
| Akash Soni | 3bcf5e0 | 2024-12-03 08:01:48 +0530 | [diff] [blame] | 572 | default: |
| 573 | return errResp(extension.SetValueResponse_ERROR, extension.SetValueResponse_UNSUPPORTED), nil |
| 574 | } |
| 575 | } |
| 576 | |
| 577 | logger.Infow(ctx, "Single_set_value_request failed ", log.Fields{"request": request}) |
| 578 | return errResp(extension.SetValueResponse_ERROR, extension.SetValueResponse_INVALID_DEVICE_ID), nil |
| 579 | } |
| 580 | |
| Akash Reddy Kankanala | c6b6ca1 | 2025-06-12 14:26:57 +0530 | [diff] [blame] | 581 | func (oo *OpenOLT) GetDeviceHandlerFromChild(ctx context.Context, deviceId string) (*DeviceHandler, *voltha.Device) { |
| 582 | oo.lockDeviceHandlersMap.Lock() |
| 583 | defer oo.lockDeviceHandlersMap.Unlock() |
| 584 | |
| 585 | for parentId, handler := range oo.deviceHandlers { |
| 586 | devices, _ := handler.getChildDevicesFromCore(ctx, parentId) |
| 587 | if devices != nil { |
| 588 | for _, onuDevice := range devices.Items { |
| 589 | if onuDevice.Id == deviceId { |
| 590 | return handler, onuDevice |
| 591 | } |
| 592 | } |
| 593 | } |
| 594 | } |
| 595 | return nil, nil |
| 596 | } |
| 597 | |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 598 | /* |
| 599 | * OLT Inter-adapter service |
| 600 | */ |
| 601 | |
| kesavand | b9f54fd | 2021-11-25 20:08:04 +0530 | [diff] [blame] | 602 | // ProxyOmciRequests proxies an onu sw download OMCI request from the child adapter |
| 603 | func (oo *OpenOLT) ProxyOmciRequests(ctx context.Context, request *ia.OmciMessages) (*empty.Empty, error) { |
| 604 | if handler := oo.getDeviceHandler(request.ParentDeviceId); handler != nil { |
| 605 | if err := handler.ProxyOmciRequests(ctx, request); err != nil { |
| Abhilash Laxmeshwar | 092e6ca | 2022-12-08 19:51:27 +0530 | [diff] [blame] | 606 | return nil, err |
| kesavand | b9f54fd | 2021-11-25 20:08:04 +0530 | [diff] [blame] | 607 | } |
| 608 | return &empty.Empty{}, nil |
| 609 | } |
| 610 | return nil, olterrors.NewErrNotFound("no-device-handler", log.Fields{"parent-device-id": request.ParentDeviceId, "child-device-id": request.ChildDeviceId}, nil).Log() |
| 611 | } |
| 612 | |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 613 | // ProxyOmciRequest proxies an OMCI request from the child adapter |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 614 | func (oo *OpenOLT) ProxyOmciRequest(ctx context.Context, request *ia.OmciMessage) (*empty.Empty, error) { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 615 | logger.Debugw(ctx, "proxy-omci-request", log.Fields{"request": request}) |
| 616 | |
| 617 | if handler := oo.getDeviceHandler(request.ParentDeviceId); handler != nil { |
| 618 | if err := handler.ProxyOmciMessage(ctx, request); err != nil { |
| Abhilash Laxmeshwar | 092e6ca | 2022-12-08 19:51:27 +0530 | [diff] [blame] | 619 | return nil, err |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 620 | } |
| 621 | return &empty.Empty{}, nil |
| 622 | } |
| 623 | return nil, olterrors.NewErrNotFound("no-device-handler", log.Fields{"parent-device-id": request.ParentDeviceId, "child-device-id": request.ChildDeviceId}, nil).Log() |
| 624 | } |
| 625 | |
| 626 | // GetTechProfileInstance returns an instance of a tech profile |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 627 | func (oo *OpenOLT) GetTechProfileInstance(ctx context.Context, request *ia.TechProfileInstanceRequestMessage) (*ia.TechProfileDownloadMessage, error) { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 628 | logger.Debugw(ctx, "getting-tech-profile-request", log.Fields{"request": request}) |
| 629 | |
| 630 | targetDeviceID := request.ParentDeviceId |
| 631 | if targetDeviceID == "" { |
| 632 | return nil, olterrors.NewErrNotFound("parent-id-empty", log.Fields{"parent-device-id": request.ParentDeviceId, "child-device-id": request.DeviceId}, nil).Log() |
| 633 | } |
| 634 | if handler := oo.getDeviceHandler(targetDeviceID); handler != nil { |
| 635 | return handler.GetTechProfileDownloadMessage(ctx, request) |
| 636 | } |
| 637 | return nil, olterrors.NewErrNotFound("no-device-handler", log.Fields{"parent-device-id": request.ParentDeviceId, "child-device-id": request.DeviceId}, nil).Log() |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 638 | } |
| 639 | |
| khenaidoo | efff76e | 2021-12-15 16:51:30 -0500 | [diff] [blame] | 640 | // GetHealthStatus is used by a OltAdapterService client to detect a connection |
| 641 | // lost with the gRPC server hosting the OltAdapterService service |
| 642 | func (oo *OpenOLT) GetHealthStatus(stream adapter_service.AdapterService_GetHealthStatusServer) error { |
| 643 | ctx := context.Background() |
| 644 | logger.Debugw(ctx, "receive-stream-connection", log.Fields{"stream": stream}) |
| 645 | |
| 646 | if stream == nil { |
| 647 | return fmt.Errorf("conn-is-nil %v", stream) |
| 648 | } |
| 649 | initialRequestTime := time.Now() |
| 650 | var remoteClient *common.Connection |
| 651 | var tempClient *common.Connection |
| 652 | var err error |
| 653 | loop: |
| 654 | for { |
| 655 | tempClient, err = stream.Recv() |
| 656 | if err != nil { |
| 657 | logger.Warnw(ctx, "received-stream-error", log.Fields{"remote-client": remoteClient, "error": err}) |
| 658 | break loop |
| 659 | } |
| 660 | // Send a response back |
| 661 | err = stream.Send(&health.HealthStatus{State: health.HealthStatus_HEALTHY}) |
| 662 | if err != nil { |
| 663 | logger.Warnw(ctx, "sending-stream-error", log.Fields{"remote-client": remoteClient, "error": err}) |
| 664 | break loop |
| 665 | } |
| 666 | |
| 667 | remoteClient = tempClient |
| 668 | logger.Debugw(ctx, "received-keep-alive", log.Fields{"remote-client": remoteClient}) |
| 669 | |
| 670 | select { |
| 671 | case <-stream.Context().Done(): |
| 672 | logger.Infow(ctx, "stream-keep-alive-context-done", log.Fields{"remote-client": remoteClient, "error": stream.Context().Err()}) |
| 673 | break loop |
| 674 | case <-oo.exitChannel: |
| 675 | logger.Warnw(ctx, "received-stop", log.Fields{"remote-client": remoteClient, "initial-conn-time": initialRequestTime}) |
| 676 | break loop |
| 677 | default: |
| 678 | } |
| 679 | } |
| 680 | logger.Errorw(ctx, "connection-down", log.Fields{"remote-client": remoteClient, "error": err, "initial-conn-time": initialRequestTime}) |
| 681 | return err |
| 682 | } |
| 683 | |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 684 | /* |
| 685 | * |
| 686 | * Unimplemented APIs |
| 687 | * |
| 688 | */ |
| 689 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 690 | // SimulateAlarm is unimplemented |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 691 | func (oo *OpenOLT) SimulateAlarm(context.Context, *ca.SimulateAlarmMessage) (*voltha.OperationResp, error) { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 692 | return nil, olterrors.ErrNotImplemented |
| 693 | } |
| 694 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 695 | // SetExtValue is unimplemented |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 696 | func (oo *OpenOLT) SetExtValue(context.Context, *ca.SetExtValueMessage) (*empty.Empty, error) { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 697 | return nil, olterrors.ErrNotImplemented |
| 698 | } |
| 699 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 700 | // StartOmciTest not implemented |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 701 | func (oo *OpenOLT) StartOmciTest(ctx context.Context, test *ca.OMCITest) (*omci.TestResponse, error) { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 702 | return nil, olterrors.ErrNotImplemented |
| 703 | } |
| 704 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 705 | // SuppressEvent unimplemented |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 706 | func (oo *OpenOLT) SuppressEvent(ctx context.Context, filter *voltha.EventFilter) (*empty.Empty, error) { |
| 707 | return nil, olterrors.ErrNotImplemented |
| 708 | } |
| 709 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 710 | // UnSuppressEvent unimplemented |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 711 | func (oo *OpenOLT) UnSuppressEvent(ctx context.Context, filter *voltha.EventFilter) (*empty.Empty, error) { |
| 712 | return nil, olterrors.ErrNotImplemented |
| 713 | } |
| 714 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 715 | // DownloadImage is unimplemented |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 716 | func (oo *OpenOLT) DownloadImage(ctx context.Context, imageInfo *ca.ImageDownloadMessage) (*voltha.ImageDownload, error) { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 717 | return nil, olterrors.ErrNotImplemented |
| 718 | } |
| 719 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 720 | // GetImageDownloadStatus is unimplemented |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 721 | func (oo *OpenOLT) GetImageDownloadStatus(ctx context.Context, imageInfo *ca.ImageDownloadMessage) (*voltha.ImageDownload, error) { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 722 | return nil, olterrors.ErrNotImplemented |
| 723 | } |
| 724 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 725 | // CancelImageDownload is unimplemented |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 726 | func (oo *OpenOLT) CancelImageDownload(ctx context.Context, imageInfo *ca.ImageDownloadMessage) (*voltha.ImageDownload, error) { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 727 | return nil, olterrors.ErrNotImplemented |
| 728 | } |
| 729 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 730 | // ActivateImageUpdate is unimplemented |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 731 | func (oo *OpenOLT) ActivateImageUpdate(ctx context.Context, imageInfo *ca.ImageDownloadMessage) (*voltha.ImageDownload, error) { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 732 | return nil, olterrors.ErrNotImplemented |
| 733 | } |
| 734 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 735 | // RevertImageUpdate is unimplemented |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 736 | func (oo *OpenOLT) RevertImageUpdate(ctx context.Context, imageInfo *ca.ImageDownloadMessage) (*voltha.ImageDownload, error) { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 737 | return nil, olterrors.ErrNotImplemented |
| 738 | } |
| 739 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 740 | // DownloadOnuImage unimplemented |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 741 | func (oo *OpenOLT) DownloadOnuImage(ctx context.Context, request *voltha.DeviceImageDownloadRequest) (*voltha.DeviceImageResponse, error) { |
| 742 | return nil, olterrors.ErrNotImplemented |
| 743 | } |
| 744 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 745 | // GetOnuImageStatus unimplemented |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 746 | func (oo *OpenOLT) GetOnuImageStatus(ctx context.Context, in *voltha.DeviceImageRequest) (*voltha.DeviceImageResponse, error) { |
| 747 | return nil, olterrors.ErrNotImplemented |
| 748 | } |
| 749 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 750 | // AbortOnuImageUpgrade unimplemented |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 751 | func (oo *OpenOLT) AbortOnuImageUpgrade(ctx context.Context, in *voltha.DeviceImageRequest) (*voltha.DeviceImageResponse, error) { |
| 752 | return nil, olterrors.ErrNotImplemented |
| 753 | } |
| 754 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 755 | // GetOnuImages unimplemented |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 756 | func (oo *OpenOLT) GetOnuImages(ctx context.Context, deviceID *common.ID) (*voltha.OnuImages, error) { |
| 757 | return nil, olterrors.ErrNotImplemented |
| 758 | } |
| 759 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 760 | // ActivateOnuImage unimplemented |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 761 | func (oo *OpenOLT) ActivateOnuImage(ctx context.Context, in *voltha.DeviceImageRequest) (*voltha.DeviceImageResponse, error) { |
| 762 | return nil, olterrors.ErrNotImplemented |
| 763 | } |
| 764 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 765 | // CommitOnuImage unimplemented |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 766 | func (oo *OpenOLT) CommitOnuImage(ctx context.Context, in *voltha.DeviceImageRequest) (*voltha.DeviceImageResponse, error) { |
| 767 | return nil, olterrors.ErrNotImplemented |
| 768 | } |
| 769 | |
| 770 | // UpdateFlowsBulk is unimplemented |
| khenaidoo | dc2116e | 2021-10-19 17:33:19 -0400 | [diff] [blame] | 771 | func (oo *OpenOLT) UpdateFlowsBulk(ctx context.Context, flows *ca.BulkFlows) (*empty.Empty, error) { |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 772 | return nil, olterrors.ErrNotImplemented |
| 773 | } |
| 774 | |
| praneeth nalmas | 55616d6 | 2023-02-06 09:19:18 +0530 | [diff] [blame] | 775 | // SelfTestDevice unimplemented |
| khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 776 | func (oo *OpenOLT) SelfTestDevice(ctx context.Context, device *voltha.Device) (*empty.Empty, error) { |
| 777 | return nil, olterrors.ErrNotImplemented |
| 778 | } |