Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2020-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 Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 17 | //Package adaptercoreonu provides the utility for onu devices, flows and statistics |
| 18 | package adaptercoreonu |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 19 | |
| 20 | import ( |
| 21 | "context" |
| 22 | "errors" |
| 23 | "fmt" |
Matteo Scandolo | f1f39a7 | 2020-11-24 12:08:11 -0800 | [diff] [blame] | 24 | conf "github.com/opencord/voltha-lib-go/v3/pkg/config" |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 25 | "sync" |
| 26 | "time" |
| 27 | |
Holger Hildebrandt | 6c1fb0a | 2020-11-25 15:41:01 +0000 | [diff] [blame] | 28 | "github.com/golang/protobuf/ptypes" |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 29 | "github.com/opencord/voltha-lib-go/v3/pkg/adapters/adapterif" |
mpagenko | af80163 | 2020-07-03 10:00:42 +0000 | [diff] [blame] | 30 | "github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore" |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 31 | "github.com/opencord/voltha-lib-go/v3/pkg/kafka" |
| 32 | "github.com/opencord/voltha-lib-go/v3/pkg/log" |
| 33 | ic "github.com/opencord/voltha-protos/v3/go/inter_container" |
| 34 | "github.com/opencord/voltha-protos/v3/go/openflow_13" |
Holger Hildebrandt | 6c1fb0a | 2020-11-25 15:41:01 +0000 | [diff] [blame] | 35 | oop "github.com/opencord/voltha-protos/v3/go/openolt" |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 36 | "github.com/opencord/voltha-protos/v3/go/voltha" |
| 37 | |
Matteo Scandolo | 761f751 | 2020-11-23 15:52:40 -0800 | [diff] [blame] | 38 | "github.com/opencord/voltha-openonu-adapter-go/internal/pkg/config" |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 39 | ) |
| 40 | |
| 41 | //OpenONUAC structure holds the ONU core information |
| 42 | type OpenONUAC struct { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 43 | deviceHandlers map[string]*deviceHandler |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 44 | deviceHandlersCreateChan map[string]chan bool //channels for deviceHandler create events |
Holger Hildebrandt | 61b24d0 | 2020-11-16 13:36:40 +0000 | [diff] [blame] | 45 | lockDeviceHandlersMap sync.RWMutex |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 46 | coreProxy adapterif.CoreProxy |
| 47 | adapterProxy adapterif.AdapterProxy |
| 48 | eventProxy adapterif.EventProxy |
| 49 | kafkaICProxy kafka.InterContainerProxy |
mpagenko | af80163 | 2020-07-03 10:00:42 +0000 | [diff] [blame] | 50 | kvClient kvstore.Client |
Matteo Scandolo | f1f39a7 | 2020-11-24 12:08:11 -0800 | [diff] [blame] | 51 | cm *conf.ConfigManager |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 52 | config *config.AdapterFlags |
| 53 | numOnus int |
| 54 | KVStoreHost string |
| 55 | KVStorePort int |
| 56 | KVStoreType string |
mpagenko | af80163 | 2020-07-03 10:00:42 +0000 | [diff] [blame] | 57 | KVStoreTimeout time.Duration |
Holger Hildebrandt | 61b24d0 | 2020-11-16 13:36:40 +0000 | [diff] [blame] | 58 | mibTemplatesGenerated map[string]bool |
| 59 | lockMibTemplateGenerated sync.RWMutex |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 60 | exitChannel chan int |
| 61 | HeartbeatCheckInterval time.Duration |
| 62 | HeartbeatFailReportInterval time.Duration |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 63 | AcceptIncrementalEvto bool |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 64 | //GrpcTimeoutInterval time.Duration |
Himani Chawla | d96df18 | 2020-09-28 11:12:02 +0530 | [diff] [blame] | 65 | pSupportedFsms *OmciDeviceFsms |
| 66 | maxTimeoutInterAdapterComm time.Duration |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | //NewOpenONUAC returns a new instance of OpenONU_AC |
| 70 | func NewOpenONUAC(ctx context.Context, kafkaICProxy kafka.InterContainerProxy, |
| 71 | coreProxy adapterif.CoreProxy, adapterProxy adapterif.AdapterProxy, |
Matteo Scandolo | f1f39a7 | 2020-11-24 12:08:11 -0800 | [diff] [blame] | 72 | eventProxy adapterif.EventProxy, kvClient kvstore.Client, cfg *config.AdapterFlags, cm *conf.ConfigManager) *OpenONUAC { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 73 | var openOnuAc OpenONUAC |
| 74 | openOnuAc.exitChannel = make(chan int, 1) |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 75 | openOnuAc.deviceHandlers = make(map[string]*deviceHandler) |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 76 | openOnuAc.deviceHandlersCreateChan = make(map[string]chan bool) |
Holger Hildebrandt | 61b24d0 | 2020-11-16 13:36:40 +0000 | [diff] [blame] | 77 | openOnuAc.lockDeviceHandlersMap = sync.RWMutex{} |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 78 | openOnuAc.kafkaICProxy = kafkaICProxy |
| 79 | openOnuAc.config = cfg |
Matteo Scandolo | f1f39a7 | 2020-11-24 12:08:11 -0800 | [diff] [blame] | 80 | openOnuAc.cm = cm |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 81 | openOnuAc.numOnus = cfg.OnuNumber |
| 82 | openOnuAc.coreProxy = coreProxy |
| 83 | openOnuAc.adapterProxy = adapterProxy |
| 84 | openOnuAc.eventProxy = eventProxy |
mpagenko | af80163 | 2020-07-03 10:00:42 +0000 | [diff] [blame] | 85 | openOnuAc.kvClient = kvClient |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 86 | openOnuAc.KVStoreHost = cfg.KVStoreHost |
| 87 | openOnuAc.KVStorePort = cfg.KVStorePort |
| 88 | openOnuAc.KVStoreType = cfg.KVStoreType |
mpagenko | af80163 | 2020-07-03 10:00:42 +0000 | [diff] [blame] | 89 | openOnuAc.KVStoreTimeout = cfg.KVStoreTimeout |
Holger Hildebrandt | 61b24d0 | 2020-11-16 13:36:40 +0000 | [diff] [blame] | 90 | openOnuAc.mibTemplatesGenerated = make(map[string]bool) |
| 91 | openOnuAc.lockMibTemplateGenerated = sync.RWMutex{} |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 92 | openOnuAc.HeartbeatCheckInterval = cfg.HeartbeatCheckInterval |
| 93 | openOnuAc.HeartbeatFailReportInterval = cfg.HeartbeatFailReportInterval |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 94 | openOnuAc.AcceptIncrementalEvto = cfg.AccIncrEvto |
Himani Chawla | d96df18 | 2020-09-28 11:12:02 +0530 | [diff] [blame] | 95 | openOnuAc.maxTimeoutInterAdapterComm = cfg.MaxTimeoutInterAdapterComm |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 96 | //openOnuAc.GrpcTimeoutInterval = cfg.GrpcTimeoutInterval |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 97 | |
| 98 | openOnuAc.pSupportedFsms = &OmciDeviceFsms{ |
| 99 | "mib-synchronizer": { |
| 100 | //mibSyncFsm, // Implements the MIB synchronization state machine |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 101 | mibDbVolatileDictImpl, // Implements volatile ME MIB database |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 102 | //true, // Advertise events on OpenOMCI event bus |
| 103 | cMibAuditDelayImpl, // Time to wait between MIB audits. 0 to disable audits. |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 104 | // map[string]func() error{ |
| 105 | // "mib-upload": onuDeviceEntry.MibUploadTask, |
| 106 | // "mib-template": onuDeviceEntry.MibTemplateTask, |
| 107 | // "get-mds": onuDeviceEntry.GetMdsTask, |
| 108 | // "mib-audit": onuDeviceEntry.GetMdsTask, |
| 109 | // "mib-resync": onuDeviceEntry.MibResyncTask, |
| 110 | // "mib-reconcile": onuDeviceEntry.MibReconcileTask, |
| 111 | // }, |
| 112 | }, |
| 113 | } |
| 114 | |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 115 | return &openOnuAc |
| 116 | } |
| 117 | |
| 118 | //Start starts (logs) the adapter |
| 119 | func (oo *OpenONUAC) Start(ctx context.Context) error { |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 120 | logger.Info("starting-openonu-adapter") |
| 121 | logger.Info("openonu-adapter-started") |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 122 | return nil |
| 123 | } |
| 124 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 125 | /* |
| 126 | //stop terminates the session |
| 127 | func (oo *OpenONUAC) stop(ctx context.Context) error { |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 128 | logger.Info("stopping-device-manager") |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 129 | oo.exitChannel <- 1 |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 130 | logger.Info("device-manager-stopped") |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 131 | return nil |
| 132 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 133 | */ |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 134 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 135 | func (oo *OpenONUAC) addDeviceHandlerToMap(ctx context.Context, agent *deviceHandler) { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 136 | oo.lockDeviceHandlersMap.Lock() |
| 137 | defer oo.lockDeviceHandlersMap.Unlock() |
| 138 | if _, exist := oo.deviceHandlers[agent.deviceID]; !exist { |
| 139 | oo.deviceHandlers[agent.deviceID] = agent |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 140 | oo.deviceHandlers[agent.deviceID].start(ctx) |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 141 | if _, exist := oo.deviceHandlersCreateChan[agent.deviceID]; exist { |
| 142 | logger.Debugw("deviceHandler created - trigger processing of pending ONU_IND_REQUEST", log.Fields{"device-id": agent.deviceID}) |
| 143 | oo.deviceHandlersCreateChan[agent.deviceID] <- true |
| 144 | } |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 145 | } |
| 146 | } |
| 147 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 148 | func (oo *OpenONUAC) deleteDeviceHandlerToMap(agent *deviceHandler) { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 149 | oo.lockDeviceHandlersMap.Lock() |
| 150 | defer oo.lockDeviceHandlersMap.Unlock() |
| 151 | delete(oo.deviceHandlers, agent.deviceID) |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 152 | delete(oo.deviceHandlersCreateChan, agent.deviceID) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 153 | } |
| 154 | |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 155 | //getDeviceHandler gets the ONU deviceHandler and may wait until it is created |
| 156 | func (oo *OpenONUAC) getDeviceHandler(deviceID string, aWait bool) *deviceHandler { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 157 | oo.lockDeviceHandlersMap.Lock() |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 158 | agent, ok := oo.deviceHandlers[deviceID] |
| 159 | if aWait && !ok { |
Holger Hildebrandt | 6c1fb0a | 2020-11-25 15:41:01 +0000 | [diff] [blame] | 160 | logger.Infow("Race condition: deviceHandler not present - wait for creation or timeout", |
| 161 | log.Fields{"device-id": deviceID}) |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 162 | if _, exist := oo.deviceHandlersCreateChan[deviceID]; !exist { |
| 163 | oo.deviceHandlersCreateChan[deviceID] = make(chan bool, 1) |
| 164 | } |
Girish Gowdra | 7407a4d | 2020-11-12 12:44:53 -0800 | [diff] [blame] | 165 | deviceCreateChan := oo.deviceHandlersCreateChan[deviceID] |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 166 | //keep the read sema short to allow for subsequent write |
| 167 | oo.lockDeviceHandlersMap.Unlock() |
| 168 | // based on concurrent processing the deviceHandler creation may not yet be finished at his point |
| 169 | // so it might be needed to wait here for that event with some timeout |
| 170 | select { |
| 171 | case <-time.After(1 * time.Second): //timer may be discussed ... |
| 172 | logger.Warnw("No valid deviceHandler created after max WaitTime", log.Fields{"device-id": deviceID}) |
| 173 | return nil |
Girish Gowdra | 7407a4d | 2020-11-12 12:44:53 -0800 | [diff] [blame] | 174 | case <-deviceCreateChan: |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 175 | logger.Debugw("deviceHandler is ready now - continue", log.Fields{"device-id": deviceID}) |
Girish Gowdra | 7407a4d | 2020-11-12 12:44:53 -0800 | [diff] [blame] | 176 | oo.lockDeviceHandlersMap.RLock() |
| 177 | defer oo.lockDeviceHandlersMap.RUnlock() |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 178 | return oo.deviceHandlers[deviceID] |
| 179 | } |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 180 | } |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 181 | oo.lockDeviceHandlersMap.Unlock() |
| 182 | return agent |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 183 | } |
| 184 | |
Holger Hildebrandt | 6c1fb0a | 2020-11-25 15:41:01 +0000 | [diff] [blame] | 185 | func (oo *OpenONUAC) processInterAdapterONUIndReqMessage(msg *ic.InterAdapterMessage) error { |
| 186 | msgBody := msg.GetBody() |
| 187 | onuIndication := &oop.OnuIndication{} |
| 188 | if err := ptypes.UnmarshalAny(msgBody, onuIndication); err != nil { |
| 189 | logger.Warnw("onu-ind-request-cannot-unmarshal-msg-body", log.Fields{"error": err}) |
| 190 | return err |
| 191 | } |
| 192 | //ToDeviceId should address a DeviceHandler instance |
| 193 | targetDevice := msg.Header.ToDeviceId |
| 194 | |
| 195 | onuOperstate := onuIndication.GetOperState() |
| 196 | waitForDhInstPresent := false |
| 197 | if onuOperstate == "up" { |
| 198 | //Race condition (relevant in BBSIM-environment only): Due to unsynchronized processing of olt-adapter and rw_core, |
| 199 | //ONU_IND_REQUEST msg by olt-adapter could arrive a little bit earlier than rw_core was able to announce the corresponding |
| 200 | //ONU by RPC of Adopt_device(). Therefore it could be necessary to wait with processing of ONU_IND_REQUEST until call of |
| 201 | //Adopt_device() arrived and DeviceHandler instance was created |
| 202 | waitForDhInstPresent = true |
| 203 | } |
| 204 | if handler := oo.getDeviceHandler(targetDevice, waitForDhInstPresent); handler != nil { |
| 205 | logger.Infow("onu-ind-request", log.Fields{"device-id": targetDevice, |
| 206 | "OnuId": onuIndication.GetOnuId(), |
| 207 | "AdminState": onuIndication.GetAdminState(), "OperState": onuOperstate, |
| 208 | "SNR": onuIndication.GetSerialNumber()}) |
| 209 | |
| 210 | if onuOperstate == "up" { |
| 211 | return handler.createInterface(onuIndication) |
| 212 | } else if (onuOperstate == "down") || (onuOperstate == "unreachable") { |
| 213 | return handler.updateInterface(onuIndication) |
| 214 | } else { |
| 215 | logger.Errorw("unknown-onu-ind-request operState", log.Fields{"OnuId": onuIndication.GetOnuId()}) |
| 216 | return fmt.Errorf("invalidOperState: %s, %s", onuOperstate, targetDevice) |
| 217 | } |
| 218 | } |
| 219 | logger.Warnw("no handler found for received onu-ind-request", log.Fields{ |
| 220 | "msgToDeviceId": targetDevice}) |
| 221 | return fmt.Errorf(fmt.Sprintf("handler-not-found-%s", targetDevice)) |
| 222 | } |
| 223 | |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 224 | // Adapter interface required methods ############## begin ######### |
| 225 | // ################################################################# |
| 226 | |
| 227 | // for original content compare: (needs according deviceHandler methods) |
| 228 | // /voltha-openolt-adapter/adaptercore/openolt.go |
| 229 | |
| 230 | // Adopt_device creates a new device handler if not present already and then adopts the device |
| 231 | func (oo *OpenONUAC) Adopt_device(device *voltha.Device) error { |
| 232 | if device == nil { |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 233 | logger.Warn("voltha-device-is-nil") |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 234 | return errors.New("nil-device") |
| 235 | } |
| 236 | ctx := context.Background() |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 237 | logger.Infow("adopt-device", log.Fields{"device-id": device.Id}) |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 238 | var handler *deviceHandler |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 239 | if handler = oo.getDeviceHandler(device.Id, false); handler == nil { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 240 | handler := newDeviceHandler(oo.coreProxy, oo.adapterProxy, oo.eventProxy, device, oo) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 241 | oo.addDeviceHandlerToMap(ctx, handler) |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 242 | go handler.adoptOrReconcileDevice(ctx, device) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 243 | // Launch the creation of the device topic |
| 244 | // go oo.createDeviceTopic(device) |
| 245 | } |
| 246 | return nil |
| 247 | } |
| 248 | |
| 249 | //Get_ofp_device_info returns OFP information for the given device |
| 250 | func (oo *OpenONUAC) Get_ofp_device_info(device *voltha.Device) (*ic.SwitchCapability, error) { |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 251 | logger.Errorw("device-handler-not-set", log.Fields{"device-id": device.Id}) |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 252 | return nil, fmt.Errorf("device-handler-not-set %s", device.Id) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 253 | } |
| 254 | |
| 255 | //Get_ofp_port_info returns OFP port information for the given device |
mpagenko | af80163 | 2020-07-03 10:00:42 +0000 | [diff] [blame] | 256 | //200630: method removed as per [VOL-3202]: OF port info is now to be delivered within UniPort create |
| 257 | // cmp changes in onu_uni_port.go::CreateVolthaPort() |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 258 | |
| 259 | //Process_inter_adapter_message sends messages to a target device (between adapters) |
| 260 | func (oo *OpenONUAC) Process_inter_adapter_message(msg *ic.InterAdapterMessage) error { |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 261 | logger.Debugw("Process_inter_adapter_message", log.Fields{"msgId": msg.Header.Id, |
Holger Hildebrandt | 80129db | 2020-11-23 10:49:32 +0000 | [diff] [blame] | 262 | "msgProxyDeviceId": msg.Header.ProxyDeviceId, "msgToDeviceId": msg.Header.ToDeviceId, "Type": msg.Header.Type}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 263 | |
Holger Hildebrandt | 6c1fb0a | 2020-11-25 15:41:01 +0000 | [diff] [blame] | 264 | if msg.Header.Type == ic.InterAdapterMessageType_ONU_IND_REQUEST { |
| 265 | // we have to handle ONU_IND_REQUEST already here - see comments in processInterAdapterONUIndReqMessage() |
| 266 | return oo.processInterAdapterONUIndReqMessage(msg) |
| 267 | } |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 268 | //ToDeviceId should address a DeviceHandler instance |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 269 | targetDevice := msg.Header.ToDeviceId |
Holger Hildebrandt | 6c1fb0a | 2020-11-25 15:41:01 +0000 | [diff] [blame] | 270 | if handler := oo.getDeviceHandler(targetDevice, false); handler != nil { |
mpagenko | 1cc3cb4 | 2020-07-27 15:24:38 +0000 | [diff] [blame] | 271 | /* 200724: modification towards synchronous implementation - possible errors within processing shall be |
| 272 | * in the accordingly delayed response, some timing effect might result in Techprofile processing for multiple UNI's |
| 273 | */ |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 274 | return handler.processInterAdapterMessage(msg) |
mpagenko | 1cc3cb4 | 2020-07-27 15:24:38 +0000 | [diff] [blame] | 275 | /* so far the processing has been in background with according commented error treatment restrictions: |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 276 | go handler.ProcessInterAdapterMessage(msg) |
| 277 | // error treatment might be more sophisticated |
| 278 | // by now let's just accept the message on 'communication layer' |
| 279 | // message content problems have to be evaluated then in the handler |
| 280 | // and are by now not reported to the calling party (to force what reaction there?) |
| 281 | return nil |
mpagenko | 1cc3cb4 | 2020-07-27 15:24:38 +0000 | [diff] [blame] | 282 | */ |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 283 | } |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 284 | logger.Warnw("no handler found for received Inter-Proxy-message", log.Fields{ |
| 285 | "msgToDeviceId": targetDevice}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 286 | return fmt.Errorf(fmt.Sprintf("handler-not-found-%s", targetDevice)) |
| 287 | } |
| 288 | |
| 289 | //Adapter_descriptor not implemented |
| 290 | func (oo *OpenONUAC) Adapter_descriptor() error { |
| 291 | return errors.New("unImplemented") |
| 292 | } |
| 293 | |
| 294 | //Device_types unimplemented |
| 295 | func (oo *OpenONUAC) Device_types() (*voltha.DeviceTypes, error) { |
| 296 | return nil, errors.New("unImplemented") |
| 297 | } |
| 298 | |
| 299 | //Health returns unimplemented |
| 300 | func (oo *OpenONUAC) Health() (*voltha.HealthStatus, error) { |
| 301 | return nil, errors.New("unImplemented") |
| 302 | } |
| 303 | |
Holger Hildebrandt | 9ca8b13 | 2020-08-07 14:45:03 +0000 | [diff] [blame] | 304 | //Reconcile_device is called once when the adapter needs to re-create device - usually on core restart |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 305 | func (oo *OpenONUAC) Reconcile_device(device *voltha.Device) error { |
Holger Hildebrandt | f41a160 | 2020-08-19 09:52:50 +0000 | [diff] [blame] | 306 | if device == nil { |
Holger Hildebrandt | 80129db | 2020-11-23 10:49:32 +0000 | [diff] [blame] | 307 | logger.Warn("reconcile-device-voltha-device-is-nil") |
Holger Hildebrandt | f41a160 | 2020-08-19 09:52:50 +0000 | [diff] [blame] | 308 | return errors.New("nil-device") |
| 309 | } |
| 310 | ctx := context.Background() |
Holger Hildebrandt | 80129db | 2020-11-23 10:49:32 +0000 | [diff] [blame] | 311 | logger.Infow("reconcile-device", log.Fields{"device-id": device.Id}) |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 312 | var handler *deviceHandler |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 313 | if handler = oo.getDeviceHandler(device.Id, false); handler == nil { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 314 | handler := newDeviceHandler(oo.coreProxy, oo.adapterProxy, oo.eventProxy, device, oo) |
Holger Hildebrandt | f41a160 | 2020-08-19 09:52:50 +0000 | [diff] [blame] | 315 | oo.addDeviceHandlerToMap(ctx, handler) |
| 316 | handler.device = device |
| 317 | handler.reconciling = true |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 318 | go handler.adoptOrReconcileDevice(ctx, handler.device) |
Holger Hildebrandt | f41a160 | 2020-08-19 09:52:50 +0000 | [diff] [blame] | 319 | // reconcilement will be continued after onu-device entry is added |
Holger Hildebrandt | 9ca8b13 | 2020-08-07 14:45:03 +0000 | [diff] [blame] | 320 | } else { |
Holger Hildebrandt | f41a160 | 2020-08-19 09:52:50 +0000 | [diff] [blame] | 321 | return fmt.Errorf(fmt.Sprintf("device-already-reconciled-or-active-%s", device.Id)) |
Holger Hildebrandt | 9ca8b13 | 2020-08-07 14:45:03 +0000 | [diff] [blame] | 322 | } |
| 323 | return nil |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 324 | } |
| 325 | |
| 326 | //Abandon_device unimplemented |
| 327 | func (oo *OpenONUAC) Abandon_device(device *voltha.Device) error { |
| 328 | return errors.New("unImplemented") |
| 329 | } |
| 330 | |
| 331 | //Disable_device disables the given device |
| 332 | func (oo *OpenONUAC) Disable_device(device *voltha.Device) error { |
Holger Hildebrandt | 80129db | 2020-11-23 10:49:32 +0000 | [diff] [blame] | 333 | logger.Infow("disable-device", log.Fields{"device-id": device.Id}) |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 334 | if handler := oo.getDeviceHandler(device.Id, false); handler != nil { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 335 | go handler.disableDevice(device) |
ozgecanetsia | fce57b1 | 2020-05-25 14:39:35 +0300 | [diff] [blame] | 336 | return nil |
| 337 | } |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 338 | logger.Warnw("no handler found for device-disable", log.Fields{"device-id": device.Id}) |
ozgecanetsia | fce57b1 | 2020-05-25 14:39:35 +0300 | [diff] [blame] | 339 | return fmt.Errorf(fmt.Sprintf("handler-not-found-%s", device.Id)) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 340 | } |
| 341 | |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 342 | //Reenable_device enables the onu device after disable |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 343 | func (oo *OpenONUAC) Reenable_device(device *voltha.Device) error { |
Holger Hildebrandt | 80129db | 2020-11-23 10:49:32 +0000 | [diff] [blame] | 344 | logger.Infow("reenable-device", log.Fields{"device-id": device.Id}) |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 345 | if handler := oo.getDeviceHandler(device.Id, false); handler != nil { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 346 | go handler.reEnableDevice(device) |
ozgecanetsia | fce57b1 | 2020-05-25 14:39:35 +0300 | [diff] [blame] | 347 | return nil |
| 348 | } |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 349 | logger.Warnw("no handler found for device-reenable", log.Fields{"device-id": device.Id}) |
ozgecanetsia | fce57b1 | 2020-05-25 14:39:35 +0300 | [diff] [blame] | 350 | return fmt.Errorf(fmt.Sprintf("handler-not-found-%s", device.Id)) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 351 | } |
| 352 | |
| 353 | //Reboot_device reboots the given device |
| 354 | func (oo *OpenONUAC) Reboot_device(device *voltha.Device) error { |
Holger Hildebrandt | 80129db | 2020-11-23 10:49:32 +0000 | [diff] [blame] | 355 | logger.Infow("reboot-device", log.Fields{"device-id": device.Id}) |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 356 | if handler := oo.getDeviceHandler(device.Id, false); handler != nil { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 357 | go handler.rebootDevice(device) |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 358 | return nil |
| 359 | } |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 360 | logger.Warnw("no handler found for device-reboot", log.Fields{"device-id": device.Id}) |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 361 | return fmt.Errorf(fmt.Sprintf("handler-not-found-#{device.Id}")) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 362 | } |
| 363 | |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 364 | //Self_test_device unimplemented |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 365 | func (oo *OpenONUAC) Self_test_device(device *voltha.Device) error { |
| 366 | return errors.New("unImplemented") |
| 367 | } |
| 368 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 369 | // Delete_device deletes the given device |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 370 | func (oo *OpenONUAC) Delete_device(device *voltha.Device) error { |
Holger Hildebrandt | 80129db | 2020-11-23 10:49:32 +0000 | [diff] [blame] | 371 | logger.Infow("delete-device", log.Fields{"device-id": device.Id, "SerialNumber": device.SerialNumber}) |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 372 | if handler := oo.getDeviceHandler(device.Id, false); handler != nil { |
mpagenko | 2418ab0 | 2020-11-12 12:58:06 +0000 | [diff] [blame] | 373 | err := handler.deleteDevicePersistencyData() |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 374 | //don't leave any garbage - even in error case |
| 375 | oo.deleteDeviceHandlerToMap(handler) |
mpagenko | 2418ab0 | 2020-11-12 12:58:06 +0000 | [diff] [blame] | 376 | return err |
Holger Hildebrandt | 9ca8b13 | 2020-08-07 14:45:03 +0000 | [diff] [blame] | 377 | } |
mpagenko | 2418ab0 | 2020-11-12 12:58:06 +0000 | [diff] [blame] | 378 | logger.Warnw("no handler found for device-deletion", log.Fields{"device-id": device.Id}) |
| 379 | return fmt.Errorf(fmt.Sprintf("handler-not-found-%s", device.Id)) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 380 | } |
| 381 | |
| 382 | //Get_device_details unimplemented |
| 383 | func (oo *OpenONUAC) Get_device_details(device *voltha.Device) error { |
| 384 | return errors.New("unImplemented") |
| 385 | } |
| 386 | |
| 387 | //Update_flows_bulk returns |
| 388 | func (oo *OpenONUAC) Update_flows_bulk(device *voltha.Device, flows *voltha.Flows, groups *voltha.FlowGroups, flowMetadata *voltha.FlowMetadata) error { |
| 389 | return errors.New("unImplemented") |
| 390 | } |
| 391 | |
| 392 | //Update_flows_incrementally updates (add/remove) the flows on a given device |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 393 | func (oo *OpenONUAC) Update_flows_incrementally(device *voltha.Device, |
| 394 | flows *openflow_13.FlowChanges, groups *openflow_13.FlowGroupChanges, flowMetadata *voltha.FlowMetadata) error { |
mpagenko | fc4f56e | 2020-11-04 17:17:49 +0000 | [diff] [blame] | 395 | |
Holger Hildebrandt | 80129db | 2020-11-23 10:49:32 +0000 | [diff] [blame] | 396 | logger.Infow("update-flows-incrementally", log.Fields{"device-id": device.Id}) |
mpagenko | fc4f56e | 2020-11-04 17:17:49 +0000 | [diff] [blame] | 397 | //flow config is relayed to handler even if the device might be in some 'inactive' state |
| 398 | // let the handler or related FSM's decide, what to do with the modified flow state info |
| 399 | // at least the flow-remove must be done in respect to internal data, while OMCI activity might not be needed here |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 400 | |
| 401 | // For now, there is no support for group changes (as in the actual Py-adapter code) |
mpagenko | fc4f56e | 2020-11-04 17:17:49 +0000 | [diff] [blame] | 402 | // but processing is continued for flowUpdate possibly also set in the request |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 403 | if groups.ToAdd != nil && groups.ToAdd.Items != nil { |
mpagenko | fc4f56e | 2020-11-04 17:17:49 +0000 | [diff] [blame] | 404 | logger.Warnw("Update-flow-incr: group add not supported (ignored)", log.Fields{"device-id": device.Id}) |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 405 | } |
| 406 | if groups.ToRemove != nil && groups.ToRemove.Items != nil { |
mpagenko | fc4f56e | 2020-11-04 17:17:49 +0000 | [diff] [blame] | 407 | logger.Warnw("Update-flow-incr: group remove not supported (ignored)", log.Fields{"device-id": device.Id}) |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 408 | } |
| 409 | if groups.ToUpdate != nil && groups.ToUpdate.Items != nil { |
mpagenko | fc4f56e | 2020-11-04 17:17:49 +0000 | [diff] [blame] | 410 | logger.Warnw("Update-flow-incr: group update not supported (ignored)", log.Fields{"device-id": device.Id}) |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 411 | } |
| 412 | |
Holger Hildebrandt | f07b44a | 2020-11-10 13:07:54 +0000 | [diff] [blame] | 413 | if handler := oo.getDeviceHandler(device.Id, false); handler != nil { |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 414 | err := handler.FlowUpdateIncremental(flows, groups, flowMetadata) |
| 415 | return err |
| 416 | } |
mpagenko | fc4f56e | 2020-11-04 17:17:49 +0000 | [diff] [blame] | 417 | logger.Warnw("no handler found for incremental flow update", log.Fields{"device-id": device.Id}) |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 418 | return fmt.Errorf(fmt.Sprintf("handler-not-found-%s", device.Id)) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 419 | } |
| 420 | |
| 421 | //Update_pm_config returns PmConfigs nil or error |
| 422 | func (oo *OpenONUAC) Update_pm_config(device *voltha.Device, pmConfigs *voltha.PmConfigs) error { |
| 423 | return errors.New("unImplemented") |
| 424 | } |
| 425 | |
| 426 | //Receive_packet_out sends packet out to the device |
| 427 | func (oo *OpenONUAC) Receive_packet_out(deviceID string, egressPortNo int, packet *openflow_13.OfpPacketOut) error { |
| 428 | return errors.New("unImplemented") |
| 429 | } |
| 430 | |
| 431 | //Suppress_event unimplemented |
| 432 | func (oo *OpenONUAC) Suppress_event(filter *voltha.EventFilter) error { |
| 433 | return errors.New("unImplemented") |
| 434 | } |
| 435 | |
| 436 | //Unsuppress_event unimplemented |
| 437 | func (oo *OpenONUAC) Unsuppress_event(filter *voltha.EventFilter) error { |
| 438 | return errors.New("unImplemented") |
| 439 | } |
| 440 | |
| 441 | //Download_image unimplemented |
| 442 | func (oo *OpenONUAC) Download_image(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) { |
| 443 | return nil, errors.New("unImplemented") |
| 444 | } |
| 445 | |
| 446 | //Get_image_download_status unimplemented |
| 447 | func (oo *OpenONUAC) Get_image_download_status(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) { |
| 448 | return nil, errors.New("unImplemented") |
| 449 | } |
| 450 | |
| 451 | //Cancel_image_download unimplemented |
| 452 | func (oo *OpenONUAC) Cancel_image_download(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) { |
| 453 | return nil, errors.New("unImplemented") |
| 454 | } |
| 455 | |
| 456 | //Activate_image_update unimplemented |
| 457 | func (oo *OpenONUAC) Activate_image_update(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) { |
| 458 | return nil, errors.New("unImplemented") |
| 459 | } |
| 460 | |
| 461 | //Revert_image_update unimplemented |
| 462 | func (oo *OpenONUAC) Revert_image_update(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) { |
| 463 | return nil, errors.New("unImplemented") |
| 464 | } |
| 465 | |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 466 | // Enable_port to Enable PON/NNI interface - seems not to be used/required according to python code |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 467 | func (oo *OpenONUAC) Enable_port(deviceID string, port *voltha.Port) error { |
| 468 | return errors.New("unImplemented") |
| 469 | } |
| 470 | |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 471 | // Disable_port to Disable pon/nni interface - seems not to be used/required according to python code |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 472 | func (oo *OpenONUAC) Disable_port(deviceID string, port *voltha.Port) error { |
| 473 | return errors.New("unImplemented") |
| 474 | } |
| 475 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 476 | //Child_device_lost - unimplemented |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 477 | //needed for if update >= 3.1.x |
Matteo Scandolo | 2e6f1e3 | 2020-04-15 11:28:45 -0700 | [diff] [blame] | 478 | func (oo *OpenONUAC) Child_device_lost(deviceID string, pPortNo uint32, onuID uint32) error { |
| 479 | return errors.New("unImplemented") |
| 480 | } |
| 481 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 482 | // Start_omci_test unimplemented |
Matteo Scandolo | 2e6f1e3 | 2020-04-15 11:28:45 -0700 | [diff] [blame] | 483 | func (oo *OpenONUAC) Start_omci_test(device *voltha.Device, request *voltha.OmciTestRequest) (*voltha.TestResponse, error) { |
| 484 | return nil, errors.New("unImplemented") |
| 485 | } |
| 486 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 487 | // Get_ext_value - unimplemented |
Matteo Scandolo | d132c0e | 2020-04-24 17:06:25 -0700 | [diff] [blame] | 488 | func (oo *OpenONUAC) Get_ext_value(deviceID string, device *voltha.Device, valueparam voltha.ValueType_Type) (*voltha.ReturnValues, error) { |
| 489 | return nil, errors.New("unImplemented") |
| 490 | } |
| 491 | |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 492 | // Adapter interface required methods ################ end ######### |
| 493 | // ################################################################# |