Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 1 | /* |
| 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 | */ |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 16 | |
| 17 | //Package adaptercore provides the utility for olt devices, flows and statistics |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 18 | package adaptercore |
| 19 | |
| 20 | import ( |
| 21 | "context" |
| 22 | "errors" |
| 23 | "fmt" |
| 24 | "sync" |
| 25 | |
Scott Baker | 5129015 | 2019-10-24 14:23:20 -0700 | [diff] [blame] | 26 | "github.com/opencord/voltha-lib-go/v2/pkg/adapters/adapterif" |
| 27 | "github.com/opencord/voltha-lib-go/v2/pkg/kafka" |
| 28 | "github.com/opencord/voltha-lib-go/v2/pkg/log" |
Scott Baker | c6e54cb | 2019-11-04 09:31:25 -0800 | [diff] [blame] | 29 | ic "github.com/opencord/voltha-protos/v2/go/inter_container" |
| 30 | "github.com/opencord/voltha-protos/v2/go/openflow_13" |
| 31 | "github.com/opencord/voltha-protos/v2/go/voltha" |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 32 | ) |
| 33 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 34 | //OpenOLT structure holds the OLT information |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 35 | type OpenOLT struct { |
| 36 | deviceHandlers map[string]*DeviceHandler |
kdarapu | 381c690 | 2019-07-31 18:23:16 +0530 | [diff] [blame] | 37 | coreProxy adapterif.CoreProxy |
| 38 | adapterProxy adapterif.AdapterProxy |
| 39 | eventProxy adapterif.EventProxy |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 40 | kafkaICProxy *kafka.InterContainerProxy |
| 41 | numOnus int |
| 42 | KVStoreHost string |
| 43 | KVStorePort int |
| 44 | KVStoreType string |
| 45 | exitChannel chan int |
| 46 | lockDeviceHandlersMap sync.RWMutex |
| 47 | } |
| 48 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 49 | //NewOpenOLT returns a new instance of OpenOLT |
kdarapu | 381c690 | 2019-07-31 18:23:16 +0530 | [diff] [blame] | 50 | func NewOpenOLT(ctx context.Context, kafkaICProxy *kafka.InterContainerProxy, |
| 51 | coreProxy adapterif.CoreProxy, adapterProxy adapterif.AdapterProxy, |
| 52 | eventProxy adapterif.EventProxy, onuNumber int, kvStoreHost string, |
| 53 | kvStorePort int, KVStoreType string) *OpenOLT { |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 54 | var openOLT OpenOLT |
| 55 | openOLT.exitChannel = make(chan int, 1) |
| 56 | openOLT.deviceHandlers = make(map[string]*DeviceHandler) |
| 57 | openOLT.kafkaICProxy = kafkaICProxy |
| 58 | openOLT.numOnus = onuNumber |
| 59 | openOLT.coreProxy = coreProxy |
| 60 | openOLT.adapterProxy = adapterProxy |
Devmalya Paul | fb990a5 | 2019-07-09 10:01:49 -0400 | [diff] [blame] | 61 | openOLT.eventProxy = eventProxy |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 62 | openOLT.KVStoreHost = kvStoreHost |
| 63 | openOLT.KVStorePort = kvStorePort |
| 64 | openOLT.KVStoreType = KVStoreType |
| 65 | openOLT.lockDeviceHandlersMap = sync.RWMutex{} |
| 66 | return &openOLT |
| 67 | } |
| 68 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 69 | //Start starts (logs) the device manager |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 70 | func (oo *OpenOLT) Start(ctx context.Context) error { |
| 71 | log.Info("starting-device-manager") |
| 72 | log.Info("device-manager-started") |
| 73 | return nil |
| 74 | } |
| 75 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 76 | //Stop terminates the session |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 77 | func (oo *OpenOLT) Stop(ctx context.Context) error { |
| 78 | log.Info("stopping-device-manager") |
| 79 | oo.exitChannel <- 1 |
| 80 | log.Info("device-manager-stopped") |
| 81 | return nil |
| 82 | } |
| 83 | |
| 84 | func sendResponse(ctx context.Context, ch chan interface{}, result interface{}) { |
| 85 | if ctx.Err() == nil { |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 86 | // Returned response only of the ctx has not been canceled/timeout/etc |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 87 | // Channel is automatically closed when a context is Done |
| 88 | ch <- result |
| 89 | log.Debugw("sendResponse", log.Fields{"result": result}) |
| 90 | } else { |
| 91 | // Should the transaction be reverted back? |
| 92 | log.Debugw("sendResponse-context-error", log.Fields{"context-error": ctx.Err()}) |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | func (oo *OpenOLT) addDeviceHandlerToMap(agent *DeviceHandler) { |
| 97 | oo.lockDeviceHandlersMap.Lock() |
| 98 | defer oo.lockDeviceHandlersMap.Unlock() |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 99 | if _, exist := oo.deviceHandlers[agent.deviceID]; !exist { |
| 100 | oo.deviceHandlers[agent.deviceID] = agent |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 101 | } |
| 102 | } |
| 103 | |
| 104 | func (oo *OpenOLT) deleteDeviceHandlerToMap(agent *DeviceHandler) { |
| 105 | oo.lockDeviceHandlersMap.Lock() |
| 106 | defer oo.lockDeviceHandlersMap.Unlock() |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 107 | delete(oo.deviceHandlers, agent.deviceID) |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 108 | } |
| 109 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 110 | func (oo *OpenOLT) getDeviceHandler(deviceID string) *DeviceHandler { |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 111 | oo.lockDeviceHandlersMap.Lock() |
| 112 | defer oo.lockDeviceHandlersMap.Unlock() |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 113 | if agent, ok := oo.deviceHandlers[deviceID]; ok { |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 114 | return agent |
| 115 | } |
| 116 | return nil |
| 117 | } |
| 118 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 119 | //createDeviceTopic returns |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 120 | func (oo *OpenOLT) createDeviceTopic(device *voltha.Device) error { |
| 121 | log.Infow("create-device-topic", log.Fields{"deviceId": device.Id}) |
| 122 | deviceTopic := kafka.Topic{Name: oo.kafkaICProxy.DefaultTopic.Name + "_" + device.Id} |
| 123 | // TODO for the offset |
| 124 | if err := oo.kafkaICProxy.SubscribeWithDefaultRequestHandler(deviceTopic, 0); err != nil { |
| 125 | log.Infow("create-device-topic-failed", log.Fields{"deviceId": device.Id, "error": err}) |
| 126 | return err |
| 127 | } |
| 128 | return nil |
| 129 | } |
| 130 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 131 | // Adopt_device creates a new device handler if not present already and then adopts the device |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 132 | func (oo *OpenOLT) Adopt_device(device *voltha.Device) error { |
| 133 | if device == nil { |
| 134 | log.Warn("device-is-nil") |
| 135 | return errors.New("nil-device") |
| 136 | } |
| 137 | log.Infow("adopt-device", log.Fields{"deviceId": device.Id}) |
| 138 | var handler *DeviceHandler |
| 139 | if handler = oo.getDeviceHandler(device.Id); handler == nil { |
Devmalya Paul | fb990a5 | 2019-07-09 10:01:49 -0400 | [diff] [blame] | 140 | handler := NewDeviceHandler(oo.coreProxy, oo.adapterProxy, oo.eventProxy, device, oo) |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 141 | oo.addDeviceHandlerToMap(handler) |
| 142 | go handler.AdoptDevice(device) |
| 143 | // Launch the creation of the device topic |
| 144 | // go oo.createDeviceTopic(device) |
| 145 | } |
| 146 | return nil |
| 147 | } |
| 148 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 149 | //Get_ofp_device_info returns OFP information for the given device |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 150 | func (oo *OpenOLT) Get_ofp_device_info(device *voltha.Device) (*ic.SwitchCapability, error) { |
| 151 | log.Infow("Get_ofp_device_info", log.Fields{"deviceId": device.Id}) |
| 152 | if handler := oo.getDeviceHandler(device.Id); handler != nil { |
| 153 | return handler.GetOfpDeviceInfo(device) |
| 154 | } |
| 155 | log.Errorw("device-handler-not-set", log.Fields{"deviceId": device.Id}) |
| 156 | return nil, errors.New("device-handler-not-set") |
| 157 | } |
| 158 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 159 | //Get_ofp_port_info returns OFP port information for the given device |
| 160 | func (oo *OpenOLT) Get_ofp_port_info(device *voltha.Device, portNo int64) (*ic.PortCapability, error) { |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 161 | log.Infow("Get_ofp_port_info", log.Fields{"deviceId": device.Id}) |
| 162 | if handler := oo.getDeviceHandler(device.Id); handler != nil { |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 163 | return handler.GetOfpPortInfo(device, portNo) |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 164 | } |
| 165 | log.Errorw("device-handler-not-set", log.Fields{"deviceId": device.Id}) |
| 166 | return nil, errors.New("device-handler-not-set") |
| 167 | } |
| 168 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 169 | //Process_inter_adapter_message sends messages to a target device (between adapters) |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 170 | func (oo *OpenOLT) Process_inter_adapter_message(msg *ic.InterAdapterMessage) error { |
| 171 | log.Infow("Process_inter_adapter_message", log.Fields{"msgId": msg.Header.Id}) |
| 172 | targetDevice := msg.Header.ProxyDeviceId // Request? |
| 173 | if targetDevice == "" && msg.Header.ToDeviceId != "" { |
| 174 | // Typical response |
| 175 | targetDevice = msg.Header.ToDeviceId |
| 176 | } |
| 177 | if handler := oo.getDeviceHandler(targetDevice); handler != nil { |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 178 | return handler.ProcessInterAdapterMessage(msg) |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 179 | } |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 180 | return fmt.Errorf(fmt.Sprintf("handler-not-found-%s", targetDevice)) |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 181 | } |
| 182 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 183 | //Adapter_descriptor not implemented |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 184 | func (oo *OpenOLT) Adapter_descriptor() error { |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 185 | return errors.New("unImplemented") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 186 | } |
| 187 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 188 | //Device_types unimplemented |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 189 | func (oo *OpenOLT) Device_types() (*voltha.DeviceTypes, error) { |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 190 | return nil, errors.New("unImplemented") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 191 | } |
| 192 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 193 | //Health returns unimplemented |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 194 | func (oo *OpenOLT) Health() (*voltha.HealthStatus, error) { |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 195 | return nil, errors.New("unImplemented") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 196 | } |
| 197 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 198 | //Reconcile_device unimplemented |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 199 | func (oo *OpenOLT) Reconcile_device(device *voltha.Device) error { |
Abhilash Laxmeshwar | ab0bd52 | 2019-10-21 15:05:15 +0530 | [diff] [blame] | 200 | if device == nil { |
| 201 | log.Warn("device-is-nil") |
| 202 | return errors.New("nil-device") |
| 203 | } |
| 204 | log.Infow("reconcile-device", log.Fields{"deviceId": device.Id}) |
| 205 | var handler *DeviceHandler |
| 206 | if handler = oo.getDeviceHandler(device.Id); handler == nil { |
| 207 | handler := NewDeviceHandler(oo.coreProxy, oo.adapterProxy, oo.eventProxy, device, oo) |
| 208 | oo.addDeviceHandlerToMap(handler) |
| 209 | handler.transitionMap = NewTransitionMap(handler) |
| 210 | handler.transitionMap.Handle(DeviceInit) |
| 211 | } |
| 212 | return nil |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 213 | } |
| 214 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 215 | //Abandon_device unimplemented |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 216 | func (oo *OpenOLT) Abandon_device(device *voltha.Device) error { |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 217 | return errors.New("unImplemented") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 218 | } |
| 219 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 220 | //Disable_device disables the given device |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 221 | func (oo *OpenOLT) Disable_device(device *voltha.Device) error { |
Girish Gowdru | 5ba46c9 | 2019-04-25 05:00:05 -0400 | [diff] [blame] | 222 | log.Infow("disable-device", log.Fields{"deviceId": device.Id}) |
| 223 | if handler := oo.getDeviceHandler(device.Id); handler != nil { |
| 224 | return handler.DisableDevice(device) |
| 225 | } |
| 226 | log.Errorw("device-handler-not-set", log.Fields{"deviceId": device.Id}) |
| 227 | return errors.New("device-handler-not-found") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 228 | } |
| 229 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 230 | //Reenable_device enables the olt device after disable |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 231 | func (oo *OpenOLT) Reenable_device(device *voltha.Device) error { |
Girish Gowdru | 5ba46c9 | 2019-04-25 05:00:05 -0400 | [diff] [blame] | 232 | log.Infow("reenable-device", log.Fields{"deviceId": device.Id}) |
| 233 | if handler := oo.getDeviceHandler(device.Id); handler != nil { |
| 234 | return handler.ReenableDevice(device) |
| 235 | } |
| 236 | log.Errorw("device-handler-not-set", log.Fields{"deviceId": device.Id}) |
| 237 | return errors.New("device-handler-not-found") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 238 | } |
| 239 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 240 | //Reboot_device reboots the given device |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 241 | func (oo *OpenOLT) Reboot_device(device *voltha.Device) error { |
Girish Gowdru | 0fe5f7e | 2019-05-28 05:12:27 -0400 | [diff] [blame] | 242 | log.Infow("reboot-device", log.Fields{"deviceId": device.Id}) |
| 243 | if handler := oo.getDeviceHandler(device.Id); handler != nil { |
| 244 | return handler.RebootDevice(device) |
| 245 | } |
| 246 | log.Errorw("device-handler-not-set", log.Fields{"deviceId": device.Id}) |
| 247 | return errors.New("device-handler-not-found") |
| 248 | |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 249 | } |
| 250 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 251 | //Self_test_device unimplented |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 252 | func (oo *OpenOLT) Self_test_device(device *voltha.Device) error { |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 253 | return errors.New("unImplemented") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 254 | } |
| 255 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 256 | //Delete_device unimplemented |
manikkaraj k | 9eb6cac | 2019-05-09 12:32:03 -0400 | [diff] [blame] | 257 | func (oo *OpenOLT) Delete_device(device *voltha.Device) error { |
Devmalya Paul | 495b94a | 2019-08-27 19:42:00 -0400 | [diff] [blame] | 258 | log.Infow("delete-device", log.Fields{"deviceId": device.Id}) |
| 259 | if handler := oo.getDeviceHandler(device.Id); handler != nil { |
| 260 | if err := handler.DeleteDevice(device); err != nil { |
| 261 | log.Errorw("failed-to-handle-delete-device", log.Fields{"device-id": device.Id}) |
| 262 | } |
| 263 | oo.deleteDeviceHandlerToMap(handler) |
| 264 | return nil |
| 265 | } |
| 266 | log.Errorw("device-handler-not-set", log.Fields{"deviceId": device.Id}) |
| 267 | return errors.New("device-handler-not-found") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 268 | } |
| 269 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 270 | //Get_device_details unimplemented |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 271 | func (oo *OpenOLT) Get_device_details(device *voltha.Device) error { |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 272 | return errors.New("unImplemented") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 273 | } |
| 274 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 275 | //Update_flows_bulk returns |
Manikkaraj k | b1d5144 | 2019-07-23 10:41:02 -0400 | [diff] [blame] | 276 | func (oo *OpenOLT) Update_flows_bulk(device *voltha.Device, flows *voltha.Flows, groups *voltha.FlowGroups, flowMetadata *voltha.FlowMetadata) error { |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 277 | return errors.New("unImplemented") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 278 | } |
| 279 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 280 | //Update_flows_incrementally updates (add/remove) the flows on a given device |
Manikkaraj k | b1d5144 | 2019-07-23 10:41:02 -0400 | [diff] [blame] | 281 | func (oo *OpenOLT) Update_flows_incrementally(device *voltha.Device, flows *openflow_13.FlowChanges, groups *openflow_13.FlowGroupChanges, flowMetadata *voltha.FlowMetadata) error { |
| 282 | log.Debugw("Update_flows_incrementally", log.Fields{"deviceId": device.Id, "flows": flows, "flowMetadata": flowMetadata}) |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 283 | if handler := oo.getDeviceHandler(device.Id); handler != nil { |
Manikkaraj k | b1d5144 | 2019-07-23 10:41:02 -0400 | [diff] [blame] | 284 | return handler.UpdateFlowsIncrementally(device, flows, groups, flowMetadata) |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 285 | } |
| 286 | log.Errorw("Update_flows_incrementally failed-device-handler-not-set", log.Fields{"deviceId": device.Id}) |
| 287 | return errors.New("device-handler-not-set") |
| 288 | } |
| 289 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 290 | //Update_pm_config returns PmConfigs nil or error |
| 291 | func (oo *OpenOLT) Update_pm_config(device *voltha.Device, pmConfigs *voltha.PmConfigs) error { |
| 292 | return errors.New("unImplemented") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 293 | } |
| 294 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 295 | //Receive_packet_out sends packet out to the device |
| 296 | func (oo *OpenOLT) Receive_packet_out(deviceID string, egressPortNo int, packet *openflow_13.OfpPacketOut) error { |
| 297 | log.Debugw("Receive_packet_out", log.Fields{"deviceId": deviceID, "egress_port_no": egressPortNo, "pkt": packet}) |
| 298 | if handler := oo.getDeviceHandler(deviceID); handler != nil { |
| 299 | return handler.PacketOut(egressPortNo, packet) |
manikkaraj k | 9eb6cac | 2019-05-09 12:32:03 -0400 | [diff] [blame] | 300 | } |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 301 | log.Errorw("Receive_packet_out failed-device-handler-not-set", log.Fields{"deviceId": deviceID, "egressport": egressPortNo, "packet": packet}) |
manikkaraj k | 9eb6cac | 2019-05-09 12:32:03 -0400 | [diff] [blame] | 302 | return errors.New("device-handler-not-set") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 303 | } |
| 304 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 305 | //Suppress_alarm unimplemented |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 306 | func (oo *OpenOLT) Suppress_alarm(filter *voltha.AlarmFilter) error { |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 307 | return errors.New("unImplemented") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 308 | } |
| 309 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 310 | //Unsuppress_alarm unimplemented |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 311 | func (oo *OpenOLT) Unsuppress_alarm(filter *voltha.AlarmFilter) error { |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 312 | return errors.New("unImplemented") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 313 | } |
| 314 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 315 | //Download_image unimplemented |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 316 | func (oo *OpenOLT) Download_image(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) { |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 317 | return nil, errors.New("unImplemented") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 318 | } |
| 319 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 320 | //Get_image_download_status unimplemented |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 321 | func (oo *OpenOLT) Get_image_download_status(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) { |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 322 | return nil, errors.New("unImplemented") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 323 | } |
| 324 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 325 | //Cancel_image_download unimplemented |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 326 | func (oo *OpenOLT) Cancel_image_download(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) { |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 327 | return nil, errors.New("unImplemented") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 328 | } |
| 329 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 330 | //Activate_image_update unimplemented |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 331 | func (oo *OpenOLT) Activate_image_update(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) { |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 332 | return nil, errors.New("unImplemented") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 333 | } |
| 334 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 335 | //Revert_image_update unimplemented |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 336 | func (oo *OpenOLT) Revert_image_update(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) { |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 337 | return nil, errors.New("unImplemented") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 338 | } |