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 | "container/list" |
| 22 | "context" |
| 23 | "encoding/binary" |
| 24 | "encoding/hex" |
| 25 | "errors" |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 26 | "fmt" |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 27 | "strconv" |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 28 | "sync" |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 29 | |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 30 | //"time" |
| 31 | |
| 32 | "github.com/google/gopacket" |
| 33 | // TODO!!! Some references could be resolved auto, but some need specific context .... |
| 34 | gp "github.com/google/gopacket" |
| 35 | |
| 36 | "github.com/opencord/omci-lib-go" |
| 37 | me "github.com/opencord/omci-lib-go/generated" |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 38 | "github.com/opencord/voltha-lib-go/v4/pkg/adapters/adapterif" |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 39 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 40 | //"github.com/opencord/voltha-lib-go/v4/pkg/kafka" |
| 41 | "github.com/opencord/voltha-lib-go/v4/pkg/log" |
| 42 | ic "github.com/opencord/voltha-protos/v4/go/inter_container" |
| 43 | //"github.com/opencord/voltha-protos/v4/go/openflow_13" |
| 44 | //"github.com/opencord/voltha-protos/v4/go/voltha" |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 45 | ) |
| 46 | |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 47 | // ### OMCI related definitions - retrieved from Python adapter code/trace #### |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 48 | |
| 49 | //ConstDefaultOmciTimeout - Default OMCI Timeout |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 50 | const ConstDefaultOmciTimeout = 10 // ( 3 ?) Seconds |
| 51 | |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 52 | const galEthernetEID = uint16(1) |
| 53 | const maxGemPayloadSize = uint16(48) |
| 54 | const connectivityModeValue = uint8(5) |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 55 | |
| 56 | //const defaultTPID = uint16(0x8100) |
| 57 | //const broadComDefaultVID = uint16(4091) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 58 | const macBridgeServiceProfileEID = uint16(0x201) // TODO: most all these need better definition or tuning |
| 59 | const ieeeMapperServiceProfileEID = uint16(0x8001) |
| 60 | const macBridgePortAniEID = uint16(0x2102) |
| 61 | |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 62 | const unusedTcontAllocID = uint16(0xFFFF) //common unused AllocId for G.984 and G.987 systems |
| 63 | |
mpagenko | c8bba41 | 2021-01-15 15:38:44 +0000 | [diff] [blame] | 64 | const cOmciBaseMessageTrailerLen = 40 |
| 65 | |
| 66 | // tOmciReceiveError - enum type for detected problems/errors in the received OMCI message (format) |
| 67 | type tOmciReceiveError uint8 |
| 68 | |
| 69 | const ( |
| 70 | // cOmciMessageReceiveNoError - default start state |
| 71 | cOmciMessageReceiveNoError tOmciReceiveError = iota |
| 72 | // Error indication wrong trailer length within the message |
| 73 | cOmciMessageReceiveErrorTrailerLen |
| 74 | // Error indication missing trailer within the message |
| 75 | cOmciMessageReceiveErrorMissTrailer |
| 76 | ) |
| 77 | |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 78 | // ### OMCI related definitions - end |
| 79 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 80 | //callbackPairEntry to be used for OMCI send/receive correlation |
| 81 | type callbackPairEntry struct { |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 82 | cbRespChannel chan Message |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 83 | cbFunction func(context.Context, *omci.OMCI, *gp.Packet, chan Message) error |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 84 | } |
| 85 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 86 | //callbackPair to be used for ReceiveCallback init |
| 87 | type callbackPair struct { |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 88 | cbKey uint16 |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 89 | cbEntry callbackPairEntry |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | type omciTransferStructure struct { |
| 93 | txFrame []byte |
| 94 | timeout int |
| 95 | retry int |
| 96 | highPrio bool |
| 97 | } |
| 98 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 99 | //omciCC structure holds information needed for OMCI communication (to/from OLT Adapter) |
| 100 | type omciCC struct { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 101 | enabled bool |
| 102 | pOnuDeviceEntry *OnuDeviceEntry |
| 103 | deviceID string |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 104 | pBaseDeviceHandler *deviceHandler |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 105 | coreProxy adapterif.CoreProxy |
| 106 | adapterProxy adapterif.AdapterProxy |
| 107 | supportExtMsg bool |
mpagenko | c8bba41 | 2021-01-15 15:38:44 +0000 | [diff] [blame] | 108 | rxOmciFrameError tOmciReceiveError |
| 109 | |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 110 | txFrames, txOnuFrames uint32 |
| 111 | rxFrames, rxOnuFrames, rxOnuDiscards uint32 |
| 112 | |
| 113 | // OMCI params |
| 114 | mutexTid sync.Mutex |
| 115 | tid uint16 |
| 116 | mutexHpTid sync.Mutex |
| 117 | hpTid uint16 |
| 118 | uploadSequNo uint16 |
| 119 | uploadNoOfCmds uint16 |
| 120 | |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 121 | mutexTxQueue sync.Mutex |
| 122 | txQueue *list.List |
| 123 | mutexRxSchedMap sync.Mutex |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 124 | rxSchedulerMap map[uint16]callbackPairEntry |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 125 | pLastTxMeInstance *me.ManagedEntity |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 126 | } |
| 127 | |
Holger Hildebrandt | 0bd45f8 | 2021-01-11 13:29:37 +0000 | [diff] [blame] | 128 | var responsesWithMibDataSync = []omci.MessageType{ |
| 129 | omci.CreateResponseType, |
| 130 | omci.DeleteResponseType, |
| 131 | omci.SetResponseType, |
| 132 | omci.StartSoftwareDownloadResponseType, |
| 133 | omci.EndSoftwareDownloadResponseType, |
| 134 | omci.ActivateSoftwareResponseType, |
| 135 | omci.CommitSoftwareResponseType, |
| 136 | } |
| 137 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 138 | //newOmciCC constructor returns a new instance of a OmciCC |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 139 | //mib_db (as well as not inluded alarm_db not really used in this code? VERIFY!!) |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 140 | func newOmciCC(ctx context.Context, onuDeviceEntry *OnuDeviceEntry, |
| 141 | deviceID string, deviceHandler *deviceHandler, |
| 142 | coreProxy adapterif.CoreProxy, adapterProxy adapterif.AdapterProxy) *omciCC { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 143 | logger.Debugw(ctx, "init-omciCC", log.Fields{"device-id": deviceID}) |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 144 | var omciCC omciCC |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 145 | omciCC.enabled = false |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 146 | omciCC.pOnuDeviceEntry = onuDeviceEntry |
| 147 | omciCC.deviceID = deviceID |
| 148 | omciCC.pBaseDeviceHandler = deviceHandler |
| 149 | omciCC.coreProxy = coreProxy |
| 150 | omciCC.adapterProxy = adapterProxy |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 151 | omciCC.supportExtMsg = false |
mpagenko | c8bba41 | 2021-01-15 15:38:44 +0000 | [diff] [blame] | 152 | omciCC.rxOmciFrameError = cOmciMessageReceiveNoError |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 153 | omciCC.txFrames = 0 |
| 154 | omciCC.txOnuFrames = 0 |
| 155 | omciCC.rxFrames = 0 |
| 156 | omciCC.rxOnuFrames = 0 |
| 157 | omciCC.rxOnuDiscards = 0 |
| 158 | omciCC.tid = 0x1 |
| 159 | omciCC.hpTid = 0x8000 |
| 160 | omciCC.uploadSequNo = 0 |
| 161 | omciCC.uploadNoOfCmds = 0 |
| 162 | |
| 163 | omciCC.txQueue = list.New() |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 164 | omciCC.rxSchedulerMap = make(map[uint16]callbackPairEntry) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 165 | |
| 166 | return &omciCC |
| 167 | } |
| 168 | |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 169 | //stop stops/resets the omciCC |
| 170 | func (oo *omciCC) stop(ctx context.Context) error { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 171 | logger.Debugw(ctx, "omciCC-stopping", log.Fields{"device-id": oo.deviceID}) |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 172 | //reseting all internal data, which might also be helpful for discarding any lingering tx/rx requests |
| 173 | oo.mutexTxQueue.Lock() |
| 174 | oo.txQueue.Init() // clear the tx queue |
| 175 | oo.mutexTxQueue.Unlock() |
| 176 | oo.mutexRxSchedMap.Lock() |
| 177 | for k := range oo.rxSchedulerMap { |
| 178 | delete(oo.rxSchedulerMap, k) //clear the scheduler map |
| 179 | } |
| 180 | oo.mutexRxSchedMap.Unlock() |
| 181 | oo.mutexHpTid.Lock() |
| 182 | oo.hpTid = 0x8000 //reset the high prio transactionId |
| 183 | oo.mutexHpTid.Unlock() |
| 184 | oo.mutexTid.Lock() |
| 185 | oo.tid = 1 //reset the low prio transactionId |
| 186 | oo.mutexTid.Unlock() |
| 187 | //reset control values |
| 188 | oo.uploadSequNo = 0 |
| 189 | oo.uploadNoOfCmds = 0 |
mpagenko | c8bba41 | 2021-01-15 15:38:44 +0000 | [diff] [blame] | 190 | oo.rxOmciFrameError = cOmciMessageReceiveNoError |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 191 | //reset the stats counter - which might be topic of discussion ... |
| 192 | oo.txFrames = 0 |
| 193 | oo.txOnuFrames = 0 |
| 194 | oo.rxFrames = 0 |
| 195 | oo.rxOnuFrames = 0 |
| 196 | oo.rxOnuDiscards = 0 |
| 197 | |
| 198 | return nil |
| 199 | } |
| 200 | |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 201 | // Rx handler for omci messages |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 202 | func (oo *omciCC) receiveOnuMessage(ctx context.Context, omciMsg *omci.OMCI) error { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 203 | logger.Debugw(ctx, "rx-onu-autonomous-message", log.Fields{"omciMsgType": omciMsg.MessageType, |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 204 | "payload": hex.EncodeToString(omciMsg.Payload)}) |
| 205 | /* |
| 206 | msgType = rxFrame.fields["message_type"] //assumed OmciOperationsValue |
| 207 | rxOnuFrames++ |
| 208 | |
| 209 | switch msgType { |
| 210 | case AlarmNotification: |
| 211 | { |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 212 | logger.Info("Unhandled: received-onu-alarm-message") |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 213 | // python code was: |
| 214 | //if msg_type == EntityOperations.AlarmNotification.value: |
| 215 | // topic = OMCI_CC.event_bus_topic(self._device_id, RxEvent.Alarm_Notification) |
| 216 | // self.reactor.callLater(0, self.event_bus.publish, topic, msg) |
| 217 | // |
| 218 | return errors.New("RxAlarmNotification unimplemented") |
| 219 | } |
| 220 | case AttributeValueChange: |
| 221 | { |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 222 | logger.Info("Unhandled: received-attribute-value-change") |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 223 | // python code was: |
| 224 | //elif msg_type == EntityOperations.AttributeValueChange.value: |
| 225 | // topic = OMCI_CC.event_bus_topic(self._device_id, RxEvent.AVC_Notification) |
| 226 | // self.reactor.callLater(0, self.event_bus.publish, topic, msg) |
| 227 | // |
| 228 | return errors.New("RxAttributeValueChange unimplemented") |
| 229 | } |
| 230 | case TestResult: |
| 231 | { |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 232 | logger.Info("Unhandled: received-test-result") |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 233 | // python code was: |
| 234 | //elif msg_type == EntityOperations.TestResult.value: |
| 235 | // topic = OMCI_CC.event_bus_topic(self._device_id, RxEvent.Test_Result) |
| 236 | // self.reactor.callLater(0, self.event_bus.publish, topic, msg) |
| 237 | // |
| 238 | return errors.New("RxTestResult unimplemented") |
| 239 | } |
| 240 | default: |
| 241 | { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 242 | logger.Errorw(ctx,"rx-onu-unsupported-autonomous-message", log.Fields{"msgType": msgType}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 243 | rxOnuDiscards++ |
| 244 | return errors.New("RxOnuMsgType unimplemented") |
| 245 | } |
| 246 | } |
| 247 | */ |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 248 | return errors.New("receiveOnuMessage unimplemented") |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 249 | } |
| 250 | |
| 251 | // Rx handler for onu messages |
| 252 | // e.g. would call ReceiveOnuMessage() in case of TID=0 or Action=test ... |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 253 | func (oo *omciCC) receiveMessage(ctx context.Context, rxMsg []byte) error { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 254 | //logger.Debugw(ctx,"cc-receive-omci-message", log.Fields{"RxOmciMessage-x2s": hex.EncodeToString(rxMsg)}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 255 | if len(rxMsg) >= 44 { // then it should normally include the BaseFormat trailer Len |
| 256 | // NOTE: autocorrection only valid for OmciBaseFormat, which is not specifically verified here!!! |
mpagenko | c8bba41 | 2021-01-15 15:38:44 +0000 | [diff] [blame] | 257 | // (an extendedFormat message could be destroyed this way!) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 258 | trailerLenData := rxMsg[42:44] |
| 259 | trailerLen := binary.BigEndian.Uint16(trailerLenData) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 260 | //logger.Debugw(ctx,"omci-received-trailer-len", log.Fields{"Length": trailerLen}) |
mpagenko | c8bba41 | 2021-01-15 15:38:44 +0000 | [diff] [blame] | 261 | if trailerLen != cOmciBaseMessageTrailerLen { // invalid base Format entry -> autocorrect |
| 262 | binary.BigEndian.PutUint16(rxMsg[42:44], cOmciBaseMessageTrailerLen) |
| 263 | if oo.rxOmciFrameError != cOmciMessageReceiveErrorTrailerLen { |
| 264 | //do just one error log, expectation is: if seen once it should appear regularly - avoid to many log entries |
| 265 | logger.Errorw(ctx, "wrong omci-message trailer length: trailer len auto-corrected", |
| 266 | log.Fields{"trailer-length": trailerLen, "device-id": oo.deviceID}) |
| 267 | oo.rxOmciFrameError = cOmciMessageReceiveErrorTrailerLen |
| 268 | } |
| 269 | } |
| 270 | } else if len(rxMsg) >= cOmciBaseMessageTrailerLen { // workaround for Adtran OLT Sim, which currently does not send trailer bytes at all! |
| 271 | // NOTE: autocorrection only valid for OmciBaseFormat, which is not specifically verified here!!! |
| 272 | // (an extendedFormat message could be destroyed this way!) |
| 273 | // extend/overwrite with trailer |
| 274 | trailer := make([]byte, 8) |
| 275 | binary.BigEndian.PutUint16(trailer[2:], cOmciBaseMessageTrailerLen) //set the defined baseline length |
| 276 | rxMsg = append(rxMsg[:cOmciBaseMessageTrailerLen], trailer...) |
| 277 | if oo.rxOmciFrameError != cOmciMessageReceiveErrorMissTrailer { |
| 278 | //do just one error log, expectation is: if seen once it should appear regularly - avoid to many log entries |
| 279 | logger.Errorw(ctx, "omci-message to short to include trailer len: trailer auto-corrected (added)", |
| 280 | log.Fields{"message-length": len(rxMsg), "device-id": oo.deviceID}) |
| 281 | oo.rxOmciFrameError = cOmciMessageReceiveErrorMissTrailer |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 282 | } |
| 283 | } else { |
mpagenko | c8bba41 | 2021-01-15 15:38:44 +0000 | [diff] [blame] | 284 | logger.Errorw(ctx, "received omci-message too small for OmciBaseFormat - abort", |
| 285 | log.Fields{"Length": len(rxMsg), "device-id": oo.deviceID}) |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 286 | return fmt.Errorf("rxOmciMessage too small for BaseFormat %s", oo.deviceID) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 287 | } |
| 288 | |
| 289 | packet := gopacket.NewPacket(rxMsg, omci.LayerTypeOMCI, gopacket.NoCopy) |
| 290 | if packet == nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 291 | logger.Errorw(ctx, "omci-message could not be decoded", log.Fields{"device-id": oo.deviceID}) |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 292 | return fmt.Errorf("could not decode rxMsg as OMCI %s", oo.deviceID) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 293 | } |
| 294 | omciLayer := packet.Layer(omci.LayerTypeOMCI) |
| 295 | if omciLayer == nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 296 | logger.Errorw(ctx, "omci-message could not decode omci layer", log.Fields{"device-id": oo.deviceID}) |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 297 | return fmt.Errorf("could not decode omci layer %s", oo.deviceID) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 298 | } |
| 299 | omciMsg, ok := omciLayer.(*omci.OMCI) |
| 300 | if !ok { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 301 | logger.Errorw(ctx, "omci-message could not assign omci layer", log.Fields{"device-id": oo.deviceID}) |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 302 | return fmt.Errorf("could not assign omci layer %s", oo.deviceID) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 303 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 304 | logger.Debugw(ctx, "omci-message-decoded:", log.Fields{"omciMsgType": omciMsg.MessageType, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 305 | "transCorrId": strconv.FormatInt(int64(omciMsg.TransactionID), 16), "DeviceIdent": omciMsg.DeviceIdentifier}) |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 306 | if byte(omciMsg.MessageType)&me.AK == 0 { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 307 | // Not a response |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 308 | logger.Debug(ctx, "RxMsg is no Omci Response Message") |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 309 | if omciMsg.TransactionID == 0 { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 310 | return oo.receiveOnuMessage(ctx, omciMsg) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 311 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 312 | logger.Errorw(ctx, "Unexpected TransCorrId != 0 not accepted for autonomous messages", |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 313 | log.Fields{"msgType": omciMsg.MessageType, "payload": hex.EncodeToString(omciMsg.Payload), |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 314 | "device-id": oo.deviceID}) |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 315 | return fmt.Errorf("autonomous Omci Message with TranSCorrId != 0 not acccepted %s", oo.deviceID) |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 316 | |
| 317 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 318 | //logger.Debug(ctx,"RxMsg is a Omci Response Message: try to schedule it to the requester") |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 319 | oo.mutexRxSchedMap.Lock() |
| 320 | rxCallbackEntry, ok := oo.rxSchedulerMap[omciMsg.TransactionID] |
| 321 | if ok && rxCallbackEntry.cbFunction != nil { |
| 322 | //disadvantage of decoupling: error verification made difficult, but anyway the question is |
| 323 | // how to react on erroneous frame reception, maybe can simply be ignored |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 324 | go rxCallbackEntry.cbFunction(ctx, omciMsg, &packet, rxCallbackEntry.cbRespChannel) |
Holger Hildebrandt | 0bd45f8 | 2021-01-11 13:29:37 +0000 | [diff] [blame] | 325 | if isResponseWithMibDataSync(omciMsg.MessageType) { |
| 326 | oo.pOnuDeviceEntry.incrementMibDataSync(ctx) |
| 327 | } |
mpagenko | c8bba41 | 2021-01-15 15:38:44 +0000 | [diff] [blame] | 328 | |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 329 | // having posted the response the request is regarded as 'done' |
| 330 | delete(oo.rxSchedulerMap, omciMsg.TransactionID) |
| 331 | oo.mutexRxSchedMap.Unlock() |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 332 | } else { |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 333 | oo.mutexRxSchedMap.Unlock() |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 334 | logger.Errorw(ctx, "omci-message-response for not registered transCorrId", log.Fields{"device-id": oo.deviceID}) |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 335 | return fmt.Errorf("could not find registered response handler tor transCorrId %s", oo.deviceID) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 336 | } |
| 337 | |
| 338 | return nil |
| 339 | /* py code was: |
| 340 | Receive and OMCI message from the proxy channel to the OLT. |
| 341 | |
| 342 | Call this from your ONU Adapter on a new OMCI Rx on the proxy channel |
| 343 | :param msg: (str) OMCI binary message (used as input to Scapy packet decoder) |
| 344 | """ |
| 345 | if not self.enabled: |
| 346 | return |
| 347 | |
| 348 | try: |
| 349 | now = arrow.utcnow() |
| 350 | d = None |
| 351 | |
| 352 | # NOTE: Since we may need to do an independent ME map on a per-ONU basis |
| 353 | # save the current value of the entity_id_to_class_map, then |
| 354 | # replace it with our custom one before decode, and then finally |
| 355 | # restore it later. Tried other ways but really made the code messy. |
| 356 | saved_me_map = omci_entities.entity_id_to_class_map |
| 357 | omci_entities.entity_id_to_class_map = self._me_map |
| 358 | |
| 359 | try: |
| 360 | rx_frame = msg if isinstance(msg, OmciFrame) else OmciFrame(msg) |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 361 | self.logger.debug('recv-omci-msg', omci_msg=hexlify(msg)) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 362 | except KeyError as e: |
| 363 | # Unknown, Unsupported, or vendor-specific ME. Key is the unknown classID |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 364 | self.logger.debug('frame-decode-key-error', omci_msg=hexlify(msg), e=e) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 365 | rx_frame = self._decode_unknown_me(msg) |
| 366 | self._rx_unknown_me += 1 |
| 367 | |
| 368 | except Exception as e: |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 369 | self.logger.exception('frame-decode', omci_msg=hexlify(msg), e=e) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 370 | return |
| 371 | |
| 372 | finally: |
| 373 | omci_entities.entity_id_to_class_map = saved_me_map # Always restore it. |
| 374 | |
| 375 | rx_tid = rx_frame.fields['transaction_id'] |
| 376 | msg_type = rx_frame.fields['message_type'] |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 377 | self.logger.debug('Received message for rx_tid', rx_tid = rx_tid, msg_type = msg_type) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 378 | # Filter the Test Result frame and route through receive onu |
| 379 | # message method. |
| 380 | if rx_tid == 0 or msg_type == EntityOperations.TestResult.value: |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 381 | self.logger.debug('Receive ONU message', rx_tid=0) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 382 | return self._receive_onu_message(rx_frame) |
| 383 | |
| 384 | # Previously unreachable if this is the very first round-trip Rx or we |
| 385 | # have been running consecutive errors |
| 386 | if self._rx_frames == 0 or self._consecutive_errors != 0: |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 387 | self.logger.debug('Consecutive errors for rx', err = self._consecutive_errors) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 388 | self.reactor.callLater(0, self._publish_connectivity_event, True) |
| 389 | |
| 390 | self._rx_frames += 1 |
| 391 | self._consecutive_errors = 0 |
| 392 | |
| 393 | try: |
| 394 | high_priority = self._tid_is_high_priority(rx_tid) |
| 395 | index = self._get_priority_index(high_priority) |
| 396 | |
| 397 | # (timestamp, defer, frame, timeout, retry, delayedCall) |
| 398 | last_tx_tuple = self._tx_request[index] |
| 399 | |
| 400 | if last_tx_tuple is None or \ |
| 401 | last_tx_tuple[OMCI_CC.REQUEST_FRAME].fields.get('transaction_id') != rx_tid: |
| 402 | # Possible late Rx on a message that timed-out |
| 403 | if last_tx_tuple: |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 404 | self.logger.debug('Unknown message', rx_tid=rx_tid, |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 405 | tx_id=last_tx_tuple[OMCI_CC.REQUEST_FRAME].fields.get('transaction_id')) |
| 406 | self._rx_unknown_tid += 1 |
| 407 | self._rx_late += 1 |
| 408 | return |
| 409 | |
| 410 | ts, d, tx_frame, timeout, retry, dc = last_tx_tuple |
| 411 | if dc is not None and not dc.cancelled and not dc.called: |
| 412 | dc.cancel() |
| 413 | |
| 414 | _secs = self._update_rx_tx_stats(now, ts) |
| 415 | |
| 416 | # Late arrival already serviced by a timeout? |
| 417 | if d.called: |
| 418 | self._rx_late += 1 |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 419 | self.logger.debug('Serviced by timeout. Late arrival', rx_late = self._rx_late) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 420 | return |
| 421 | |
| 422 | except Exception as e: |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 423 | self.logger.exception('frame-match', msg=hexlify(msg), e=e) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 424 | if d is not None: |
| 425 | return d.errback(failure.Failure(e)) |
| 426 | return |
| 427 | |
| 428 | # Publish Rx event to listeners in a different task |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 429 | self.logger.debug('Publish rx event', rx_tid = rx_tid, |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 430 | tx_tid = tx_frame.fields['transaction_id']) |
| 431 | reactor.callLater(0, self._publish_rx_frame, tx_frame, rx_frame) |
| 432 | |
| 433 | # begin success callback chain (will cancel timeout and queue next Tx message) |
| 434 | self._rx_response[index] = rx_frame |
| 435 | d.callback(rx_frame) |
| 436 | |
| 437 | except Exception as e: |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 438 | self.logger.exception('rx-msg', e=e) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 439 | */ |
| 440 | } |
| 441 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 442 | /* |
| 443 | func (oo *omciCC) publishRxResponseFrame(ctx context.Context, txFrame []byte, rxFrame []byte) error { |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 444 | return errors.New("publishRxResponseFrame unimplemented") |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 445 | //def _publish_rx_frame(self, tx_frame, rx_frame): |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 446 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 447 | */ |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 448 | |
| 449 | //Queue the OMCI Frame for a transmit to the ONU via the proxy_channel |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 450 | func (oo *omciCC) send(ctx context.Context, txFrame []byte, timeout int, retry int, highPrio bool, |
| 451 | receiveCallbackPair callbackPair) error { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 452 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 453 | logger.Debugw(ctx, "register-response-callback:", log.Fields{"for TansCorrId": receiveCallbackPair.cbKey}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 454 | // it could be checked, if the callback keay is already registered - but simply overwrite may be acceptable ... |
| 455 | oo.mutexRxSchedMap.Lock() |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 456 | oo.rxSchedulerMap[receiveCallbackPair.cbKey] = receiveCallbackPair.cbEntry |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 457 | oo.mutexRxSchedMap.Unlock() |
| 458 | |
| 459 | //just use a simple list for starting - might need some more effort, especially for multi source write access |
| 460 | omciTxRequest := omciTransferStructure{ |
| 461 | txFrame, |
| 462 | timeout, |
| 463 | retry, |
| 464 | highPrio, |
| 465 | } |
| 466 | oo.mutexTxQueue.Lock() |
| 467 | oo.txQueue.PushBack(omciTxRequest) // enqueue |
| 468 | oo.mutexTxQueue.Unlock() |
| 469 | |
| 470 | // for first test just bypass and send directly: |
| 471 | go oo.sendNextRequest(ctx) |
| 472 | return nil |
| 473 | } |
| 474 | |
| 475 | //Pull next tx request and send it |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 476 | func (oo *omciCC) sendNextRequest(ctx context.Context) error { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 477 | // return errors.New("sendNextRequest unimplemented") |
| 478 | |
| 479 | // just try to get something transferred !! |
| 480 | // avoid accessing the txQueue from parallel send requests |
| 481 | // block parallel omci send requests at least until SendIAP is 'committed' |
| 482 | // that should be feasible for an onu instance as on OMCI anyway window size 1 is assumed |
| 483 | oo.mutexTxQueue.Lock() |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 484 | defer oo.mutexTxQueue.Unlock() |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 485 | for oo.txQueue.Len() > 0 { |
| 486 | queueElement := oo.txQueue.Front() // First element |
| 487 | omciTxRequest := queueElement.Value.(omciTransferStructure) |
| 488 | /* compare olt device handler code: |
| 489 | func (dh *DeviceHandler) omciIndication(omciInd *oop.OmciIndication) { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 490 | logger.Debugw(ctx,"omci indication", log.Fields{"intfID": omciInd.IntfId, "onuID": omciInd.OnuId}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 491 | var deviceType string |
| 492 | var deviceID string |
| 493 | var proxyDeviceID string |
| 494 | |
| 495 | onuKey := dh.formOnuKey(omciInd.IntfId, omciInd.OnuId) |
| 496 | |
| 497 | if onuInCache, ok := dh.onus.Load(onuKey); !ok { |
| 498 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 499 | logger.Debugw(ctx,"omci indication for a device not in cache.", log.Fields{"intfID": omciInd.IntfId, "onuID": omciInd.OnuId}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 500 | ponPort := IntfIDToPortNo(omciInd.GetIntfId(), voltha.Port_PON_OLT) |
| 501 | kwargs := make(map[string]interface{}) |
| 502 | kwargs["onu_id"] = omciInd.OnuId |
| 503 | kwargs["parent_port_no"] = ponPort |
| 504 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 505 | onuDevice, err := dh.coreProxy.GetChildDevice(log.WithSpanFromContext(context.TODO(), ctx), dh.device.Id, kwargs) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 506 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 507 | logger.Errorw(ctx,"onu not found", log.Fields{"intfID": omciInd.IntfId, "onuID": omciInd.OnuId, "error": err}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 508 | return |
| 509 | } |
| 510 | deviceType = onuDevice.Type |
| 511 | deviceID = onuDevice.Id |
| 512 | proxyDeviceID = onuDevice.ProxyAddress.DeviceId |
| 513 | //if not exist in cache, then add to cache. |
| 514 | dh.onus.Store(onuKey, NewOnuDevice(deviceID, deviceType, onuDevice.SerialNumber, omciInd.OnuId, omciInd.IntfId, proxyDeviceID)) |
| 515 | } else { |
| 516 | //found in cache |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 517 | logger.Debugw(ctx,"omci indication for a device in cache.", log.Fields{"intfID": omciInd.IntfId, "onuID": omciInd.OnuId}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 518 | deviceType = onuInCache.(*OnuDevice).deviceType |
| 519 | deviceID = onuInCache.(*OnuDevice).deviceID |
| 520 | proxyDeviceID = onuInCache.(*OnuDevice).proxyDeviceID |
| 521 | } |
| 522 | */ |
| 523 | /* and compare onu_adapter py code: |
| 524 | omci_msg = InterAdapterOmciMessage( |
| 525 | message=bytes(frame), |
| 526 | proxy_address=self._proxy_address, |
| 527 | connect_status=self._device.connect_status) |
| 528 | |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 529 | self.logger.debug('sent-omci-msg', tid=tx_tid, omci_msg=hexlify(bytes(frame))) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 530 | |
| 531 | yield self._adapter_proxy.send_inter_adapter_message( |
| 532 | msg=omci_msg, |
| 533 | type=InterAdapterMessageType.OMCI_REQUEST, |
| 534 | from_adapter=self._device.type, |
| 535 | to_adapter=self._proxy_address.device_type, |
| 536 | to_device_id=self._device_id, |
| 537 | proxy_device_id=self._proxy_address.device_id |
| 538 | ) |
| 539 | */ |
| 540 | device, err := oo.coreProxy.GetDevice(ctx, |
| 541 | oo.pBaseDeviceHandler.deviceID, oo.deviceID) //parent, child |
| 542 | if err != nil || device == nil { |
| 543 | /*TODO: needs to handle error scenarios */ |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 544 | logger.Errorw(ctx, "Failed to fetch device", log.Fields{"err": err, "ParentId": oo.pBaseDeviceHandler.deviceID, |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 545 | "ChildId": oo.deviceID}) |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 546 | return fmt.Errorf("failed to fetch device %s", oo.deviceID) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 547 | } |
| 548 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 549 | logger.Debugw(ctx, "omci-message-to-send:", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 550 | "TxOmciMessage": hex.EncodeToString(omciTxRequest.txFrame), |
| 551 | "device-id": oo.deviceID, |
| 552 | "toDeviceType": oo.pBaseDeviceHandler.ProxyAddressType, |
| 553 | "proxyDeviceID": oo.pBaseDeviceHandler.ProxyAddressID}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 554 | |
| 555 | omciMsg := &ic.InterAdapterOmciMessage{Message: omciTxRequest.txFrame} |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 556 | if sendErr := oo.adapterProxy.SendInterAdapterMessage(log.WithSpanFromContext(context.Background(), ctx), omciMsg, |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 557 | ic.InterAdapterMessageType_OMCI_REQUEST, |
Matteo Scandolo | efbec27 | 2020-11-17 10:33:09 -0800 | [diff] [blame] | 558 | //fromTopic,toType,toDevId, ProxyDevId |
| 559 | oo.pOnuDeviceEntry.baseDeviceHandler.pOpenOnuAc.config.Topic, oo.pBaseDeviceHandler.ProxyAddressType, |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 560 | oo.deviceID, oo.pBaseDeviceHandler.ProxyAddressID, ""); sendErr != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 561 | logger.Errorw(ctx, "send omci request error", log.Fields{"ChildId": oo.deviceID, "error": sendErr}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 562 | return sendErr |
| 563 | } |
| 564 | oo.txQueue.Remove(queueElement) // Dequeue |
| 565 | } |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 566 | return nil |
| 567 | } |
| 568 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 569 | func (oo *omciCC) getNextTid(highPriority bool) uint16 { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 570 | var next uint16 |
| 571 | if highPriority { |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 572 | oo.mutexHpTid.Lock() |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 573 | next = oo.hpTid |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 574 | oo.hpTid++ |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 575 | if oo.hpTid < 0x8000 { |
| 576 | oo.hpTid = 0x8000 |
| 577 | } |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 578 | oo.mutexHpTid.Unlock() |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 579 | } else { |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 580 | oo.mutexTid.Lock() |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 581 | next = oo.tid |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 582 | oo.tid++ |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 583 | if oo.tid >= 0x8000 { |
| 584 | oo.tid = 1 |
| 585 | } |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 586 | oo.mutexTid.Unlock() |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 587 | } |
| 588 | return next |
| 589 | } |
| 590 | |
| 591 | // ################################################################################### |
| 592 | // # utility methods provided to work on OMCI messages |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 593 | func serialize(ctx context.Context, msgType omci.MessageType, request gopacket.SerializableLayer, tid uint16) ([]byte, error) { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 594 | omciLayer := &omci.OMCI{ |
| 595 | TransactionID: tid, |
| 596 | MessageType: msgType, |
| 597 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 598 | return serializeOmciLayer(ctx, omciLayer, request) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 599 | } |
| 600 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 601 | func serializeOmciLayer(ctx context.Context, aOmciLayer *omci.OMCI, aRequest gopacket.SerializableLayer) ([]byte, error) { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 602 | var options gopacket.SerializeOptions |
| 603 | options.FixLengths = true |
| 604 | |
| 605 | buffer := gopacket.NewSerializeBuffer() |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 606 | err := gopacket.SerializeLayers(buffer, options, aOmciLayer, aRequest) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 607 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 608 | logger.Errorw(ctx, "Could not create goPacket Omci serial buffer", log.Fields{"Err": err}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 609 | return nil, err |
| 610 | } |
| 611 | return buffer.Bytes(), nil |
| 612 | } |
| 613 | |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 614 | /* |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 615 | func hexEncode(omciPkt []byte) ([]byte, error) { |
| 616 | dst := make([]byte, hex.EncodedLen(len(omciPkt))) |
| 617 | hex.Encode(dst, omciPkt) |
| 618 | return dst, nil |
| 619 | } |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 620 | */ |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 621 | |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 622 | //supply a response handler for omci response messages to be transferred to the requested FSM |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 623 | func (oo *omciCC) receiveOmciResponse(ctx context.Context, omciMsg *omci.OMCI, packet *gp.Packet, respChan chan Message) error { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 624 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 625 | logger.Debugw(ctx, "omci-message-response - transfer on omciRespChannel", log.Fields{"omciMsgType": omciMsg.MessageType, |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 626 | "transCorrId": strconv.FormatInt(int64(omciMsg.TransactionID), 16), "device-id": oo.deviceID}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 627 | |
| 628 | if oo.pOnuDeviceEntry == nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 629 | logger.Errorw(ctx, "Abort receiving OMCI response, DeviceEntryPointer is nil", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 630 | "device-id": oo.deviceID}) |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 631 | return fmt.Errorf("deviceEntryPointer is nil %s", oo.deviceID) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 632 | } |
| 633 | |
| 634 | // no further test on SeqNo is done here, assignment from rxScheduler is trusted |
| 635 | // MibSync responses are simply transferred via deviceEntry to MibSync, no specific analysis here |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 636 | omciRespMsg := Message{ |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 637 | Type: OMCI, |
| 638 | Data: OmciMessage{ |
| 639 | OmciMsg: omciMsg, |
| 640 | OmciPacket: packet, |
| 641 | }, |
| 642 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 643 | //logger.Debugw(ctx,"Message to be sent into channel:", log.Fields{"mibSyncMsg": mibSyncMsg}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 644 | respChan <- omciRespMsg |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 645 | |
| 646 | return nil |
| 647 | } |
| 648 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 649 | func (oo *omciCC) sendMibReset(ctx context.Context, timeout int, highPrio bool) error { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 650 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 651 | logger.Debugw(ctx, "send MibReset-msg to:", log.Fields{"device-id": oo.deviceID}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 652 | request := &omci.MibResetRequest{ |
| 653 | MeBasePacket: omci.MeBasePacket{ |
| 654 | EntityClass: me.OnuDataClassID, |
| 655 | }, |
| 656 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 657 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 658 | pkt, err := serialize(ctx, omci.MibResetRequestType, request, tid) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 659 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 660 | logger.Errorw(ctx, "Cannot serialize MibResetRequest", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 661 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 662 | return err |
| 663 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 664 | omciRxCallbackPair := callbackPair{ |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 665 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 666 | cbEntry: callbackPairEntry{(*oo.pOnuDeviceEntry).pMibUploadFsm.commChan, oo.receiveOmciResponse}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 667 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 668 | return oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 669 | } |
| 670 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 671 | func (oo *omciCC) sendReboot(ctx context.Context, timeout int, highPrio bool, responseChannel chan Message) error { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 672 | logger.Debugw(ctx, "send Reboot-msg to:", log.Fields{"device-id": oo.deviceID}) |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 673 | request := &omci.RebootRequest{ |
| 674 | MeBasePacket: omci.MeBasePacket{ |
| 675 | EntityClass: me.OnuGClassID, |
| 676 | }, |
| 677 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 678 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 679 | pkt, err := serialize(ctx, omci.RebootRequestType, request, tid) |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 680 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 681 | logger.Errorw(ctx, "Cannot serialize RebootRequest", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 682 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 683 | return err |
| 684 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 685 | omciRxCallbackPair := callbackPair{ |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 686 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 687 | cbEntry: callbackPairEntry{oo.pOnuDeviceEntry.omciRebootMessageReceivedChannel, oo.receiveOmciResponse}, |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 688 | } |
| 689 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 690 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 691 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 692 | logger.Errorw(ctx, "Cannot send RebootRequest", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 693 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 694 | return err |
| 695 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 696 | err = oo.pOnuDeviceEntry.waitForRebootResponse(ctx, responseChannel) |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 697 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 698 | logger.Errorw(ctx, "aborting ONU Reboot!", log.Fields{ |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 699 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 700 | return err |
| 701 | } |
| 702 | return nil |
| 703 | } |
| 704 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 705 | func (oo *omciCC) sendMibUpload(ctx context.Context, timeout int, highPrio bool) error { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 706 | logger.Debugw(ctx, "send MibUpload-msg to:", log.Fields{"device-id": oo.deviceID}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 707 | request := &omci.MibUploadRequest{ |
| 708 | MeBasePacket: omci.MeBasePacket{ |
| 709 | EntityClass: me.OnuDataClassID, |
| 710 | }, |
| 711 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 712 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 713 | pkt, err := serialize(ctx, omci.MibUploadRequestType, request, tid) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 714 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 715 | logger.Errorw(ctx, "Cannot serialize MibUploadRequest", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 716 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 717 | return err |
| 718 | } |
| 719 | oo.uploadSequNo = 0 |
| 720 | oo.uploadNoOfCmds = 0 |
| 721 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 722 | omciRxCallbackPair := callbackPair{ |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 723 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 724 | cbEntry: callbackPairEntry{(*oo.pOnuDeviceEntry).pMibUploadFsm.commChan, oo.receiveOmciResponse}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 725 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 726 | return oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 727 | } |
| 728 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 729 | func (oo *omciCC) sendMibUploadNext(ctx context.Context, timeout int, highPrio bool) error { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 730 | logger.Debugw(ctx, "send MibUploadNext-msg to:", log.Fields{"device-id": oo.deviceID, "uploadSequNo": oo.uploadSequNo}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 731 | request := &omci.MibUploadNextRequest{ |
| 732 | MeBasePacket: omci.MeBasePacket{ |
| 733 | EntityClass: me.OnuDataClassID, |
| 734 | }, |
| 735 | CommandSequenceNumber: oo.uploadSequNo, |
| 736 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 737 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 738 | pkt, err := serialize(ctx, omci.MibUploadNextRequestType, request, tid) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 739 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 740 | logger.Errorw(ctx, "Cannot serialize MibUploadNextRequest", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 741 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 742 | return err |
| 743 | } |
| 744 | oo.uploadSequNo++ |
| 745 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 746 | omciRxCallbackPair := callbackPair{ |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 747 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 748 | cbEntry: callbackPairEntry{(*oo.pOnuDeviceEntry).pMibUploadFsm.commChan, oo.receiveOmciResponse}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 749 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 750 | return oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 751 | } |
| 752 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 753 | func (oo *omciCC) sendCreateGalEthernetProfile(ctx context.Context, timeout int, highPrio bool) *me.ManagedEntity { |
| 754 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 755 | logger.Debugw(ctx, "send GalEnetProfile-Create-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 756 | "SequNo": strconv.FormatInt(int64(tid), 16)}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 757 | |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 758 | meParams := me.ParamData{ |
| 759 | EntityID: galEthernetEID, |
| 760 | Attributes: me.AttributeValueMap{"MaximumGemPayloadSize": maxGemPayloadSize}, |
| 761 | } |
| 762 | meInstance, omciErr := me.NewGalEthernetProfile(meParams) |
| 763 | if omciErr.GetError() == nil { |
| 764 | //all setByCreate parameters already set, no default option required ... |
| 765 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.CreateRequestType, omci.TransactionID(tid)) |
| 766 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 767 | logger.Errorw(ctx, "Cannot encode GalEnetProfileInstance for create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 768 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 769 | return nil |
| 770 | } |
| 771 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 772 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 773 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 774 | logger.Errorw(ctx, "Cannot serialize GalEnetProfile create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 775 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 776 | return nil |
| 777 | } |
| 778 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 779 | omciRxCallbackPair := callbackPair{ |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 780 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 781 | cbEntry: callbackPairEntry{(*oo.pOnuDeviceEntry).pMibDownloadFsm.commChan, oo.receiveOmciResponse}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 782 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 783 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 784 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 785 | logger.Errorw(ctx, "Cannot send GalEnetProfile create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 786 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 787 | return nil |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 788 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 789 | logger.Debug(ctx, "send GalEnetProfile-Create-msg done") |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 790 | return meInstance |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 791 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 792 | logger.Errorw(ctx, "Cannot generate GalEnetProfileInstance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 793 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 794 | return nil |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 795 | } |
| 796 | |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 797 | // might be needed to extend for parameter arguments, here just for setting the ConnectivityMode!! |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 798 | func (oo *omciCC) sendSetOnu2g(ctx context.Context, timeout int, highPrio bool) *me.ManagedEntity { |
| 799 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 800 | logger.Debugw(ctx, "send ONU2-G-Set-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 801 | "SequNo": strconv.FormatInt(int64(tid), 16)}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 802 | |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 803 | // ONU-G ME-ID is defined to be 0, but we could verify, if the ONU really supports the desired |
| 804 | // connectivity mode 5 (in ConnCap) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 805 | // By now we just use fix values to fire - this is anyway what the python adapter does |
| 806 | // read ONU-2G from DB ???? //TODO!!! |
| 807 | meParams := me.ParamData{ |
| 808 | EntityID: 0, |
| 809 | Attributes: me.AttributeValueMap{"CurrentConnectivityMode": connectivityModeValue}, |
| 810 | } |
| 811 | meInstance, omciErr := me.NewOnu2G(meParams) |
| 812 | if omciErr.GetError() == nil { |
| 813 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.SetRequestType, omci.TransactionID(tid)) |
| 814 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 815 | logger.Errorw(ctx, "Cannot encode ONU2-G instance for set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 816 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 817 | return nil |
| 818 | } |
| 819 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 820 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 821 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 822 | logger.Errorw(ctx, "Cannot serialize ONU2-G set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 823 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 824 | return nil |
| 825 | } |
| 826 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 827 | omciRxCallbackPair := callbackPair{ |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 828 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 829 | cbEntry: callbackPairEntry{(*oo.pOnuDeviceEntry).pMibDownloadFsm.commChan, oo.receiveOmciResponse}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 830 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 831 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 832 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 833 | logger.Errorw(ctx, "Cannot send ONU2-G set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 834 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 835 | return nil |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 836 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 837 | logger.Debug(ctx, "send ONU2-G-Set-msg done") |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 838 | return meInstance |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 839 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 840 | logger.Errorw(ctx, "Cannot generate ONU2-G", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 841 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 842 | return nil |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 843 | } |
| 844 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 845 | func (oo *omciCC) sendCreateMBServiceProfile(ctx context.Context, |
| 846 | aPUniPort *onuUniPort, timeout int, highPrio bool) *me.ManagedEntity { |
| 847 | tid := oo.getNextTid(highPrio) |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 848 | instID := macBridgeServiceProfileEID + uint16(aPUniPort.macBpNo) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 849 | logger.Debugw(ctx, "send MBSP-Create-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 850 | "SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(instID), 16)}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 851 | |
| 852 | meParams := me.ParamData{ |
| 853 | EntityID: instID, |
| 854 | Attributes: me.AttributeValueMap{ |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 855 | "Priority": 0x8000, |
| 856 | "MaxAge": 20 * 256, //20s |
| 857 | "HelloTime": 2 * 256, //2s |
| 858 | "ForwardDelay": 15 * 256, //15s |
| 859 | "DynamicFilteringAgeingTime": 0, |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 860 | }, |
| 861 | } |
| 862 | |
| 863 | meInstance, omciErr := me.NewMacBridgeServiceProfile(meParams) |
| 864 | if omciErr.GetError() == nil { |
| 865 | //obviously we have to set all 'untouched' parameters to default by some additional option parameter!! |
| 866 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.CreateRequestType, |
| 867 | omci.TransactionID(tid), omci.AddDefaults(true)) |
| 868 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 869 | logger.Errorw(ctx, "Cannot encode MBSP for create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 870 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 871 | return nil |
| 872 | } |
| 873 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 874 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 875 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 876 | logger.Errorw(ctx, "Cannot serialize MBSP create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 877 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 878 | return nil |
| 879 | } |
| 880 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 881 | omciRxCallbackPair := callbackPair{ |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 882 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 883 | cbEntry: callbackPairEntry{(*oo.pOnuDeviceEntry).pMibDownloadFsm.commChan, oo.receiveOmciResponse}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 884 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 885 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 886 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 887 | logger.Errorw(ctx, "Cannot send MBSP create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 888 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 889 | return nil |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 890 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 891 | logger.Debug(ctx, "send MBSP-Create-msg done") |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 892 | return meInstance |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 893 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 894 | logger.Errorw(ctx, "Cannot generate MBSP Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 895 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 896 | return nil |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 897 | } |
| 898 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 899 | func (oo *omciCC) sendCreateMBPConfigData(ctx context.Context, |
| 900 | aPUniPort *onuUniPort, timeout int, highPrio bool) *me.ManagedEntity { |
| 901 | tid := oo.getNextTid(highPrio) |
Himani Chawla | 26e555c | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 902 | instID := macBridgePortAniEID + aPUniPort.entityID |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 903 | logger.Debugw(ctx, "send MBPCD-Create-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 904 | "SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(instID), 16)}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 905 | |
| 906 | meParams := me.ParamData{ |
| 907 | EntityID: instID, |
| 908 | Attributes: me.AttributeValueMap{ |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 909 | "BridgeIdPointer": macBridgeServiceProfileEID + uint16(aPUniPort.macBpNo), |
| 910 | "PortNum": aPUniPort.macBpNo, |
| 911 | "TpType": uint8(aPUniPort.portType), |
Himani Chawla | 26e555c | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 912 | "TpPointer": aPUniPort.entityID, |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 913 | }, |
| 914 | } |
| 915 | meInstance, omciErr := me.NewMacBridgePortConfigurationData(meParams) |
| 916 | if omciErr.GetError() == nil { |
| 917 | //obviously we have to set all 'untouched' parameters to default by some additional option parameter!! |
| 918 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.CreateRequestType, |
| 919 | omci.TransactionID(tid), omci.AddDefaults(true)) |
| 920 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 921 | logger.Errorw(ctx, "Cannot encode MBPCD for create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 922 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 923 | return nil |
| 924 | } |
| 925 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 926 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 927 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 928 | logger.Errorw(ctx, "Cannot serialize MBPCD create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 929 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 930 | return nil |
| 931 | } |
| 932 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 933 | omciRxCallbackPair := callbackPair{ |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 934 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 935 | cbEntry: callbackPairEntry{(*oo.pOnuDeviceEntry).pMibDownloadFsm.commChan, oo.receiveOmciResponse}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 936 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 937 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 938 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 939 | logger.Errorw(ctx, "Cannot send MBPCD create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 940 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 941 | return nil |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 942 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 943 | logger.Debug(ctx, "send MBPCD-Create-msg done") |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 944 | return meInstance |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 945 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 946 | logger.Errorw(ctx, "Cannot generate MBPCD Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 947 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 948 | return nil |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 949 | } |
| 950 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 951 | func (oo *omciCC) sendCreateEVTOConfigData(ctx context.Context, |
| 952 | aPUniPort *onuUniPort, timeout int, highPrio bool) *me.ManagedEntity { |
| 953 | tid := oo.getNextTid(highPrio) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 954 | //same entityId is used as for MBSP (see there), but just arbitrary ... |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 955 | instID := macBridgeServiceProfileEID + uint16(aPUniPort.macBpNo) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 956 | logger.Debugw(ctx, "send EVTOCD-Create-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 957 | "SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(instID), 16)}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 958 | |
| 959 | // compare python adapter code WA VOL-1311: this is not done here! |
| 960 | // (setting TPID values for the create would probably anyway be ignored by the omci lib) |
| 961 | // but perhaps we have to be aware of possible problems at get(Next) Request handling for EVTOOCD tables later ... |
| 962 | assType := uint8(2) // default AssociationType is PPTPEthUni |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 963 | if aPUniPort.portType == uniVEIP { |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 964 | assType = uint8(10) // for VEIP |
| 965 | } |
| 966 | meParams := me.ParamData{ |
| 967 | EntityID: instID, |
| 968 | Attributes: me.AttributeValueMap{ |
| 969 | "AssociationType": assType, |
Himani Chawla | 26e555c | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 970 | "AssociatedMePointer": aPUniPort.entityID, |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 971 | }, |
| 972 | } |
| 973 | meInstance, omciErr := me.NewExtendedVlanTaggingOperationConfigurationData(meParams) |
| 974 | if omciErr.GetError() == nil { |
| 975 | //all setByCreate parameters already set, no default option required ... |
| 976 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.CreateRequestType, omci.TransactionID(tid)) |
| 977 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 978 | logger.Errorw(ctx, "Cannot encode EVTOCD for create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 979 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 980 | return nil |
| 981 | } |
| 982 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 983 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 984 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 985 | logger.Errorw(ctx, "Cannot serialize EVTOCD create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 986 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 987 | return nil |
| 988 | } |
| 989 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 990 | omciRxCallbackPair := callbackPair{ |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 991 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 992 | cbEntry: callbackPairEntry{(*oo.pOnuDeviceEntry).pMibDownloadFsm.commChan, oo.receiveOmciResponse}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 993 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 994 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 995 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 996 | logger.Errorw(ctx, "Cannot send EVTOCD create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 997 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 998 | return nil |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 999 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1000 | logger.Debug(ctx, "send EVTOCD-Create-msg done") |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1001 | return meInstance |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1002 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1003 | logger.Errorw(ctx, "Cannot generate EVTOCD Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1004 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1005 | return nil |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1006 | } |
| 1007 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1008 | func (oo *omciCC) sendSetOnuGLS(ctx context.Context, timeout int, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1009 | highPrio bool, requestedAttributes me.AttributeValueMap, rxChan chan Message) *me.ManagedEntity { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1010 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1011 | logger.Debugw(ctx, "send ONU-G-Set-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1012 | "SequNo": strconv.FormatInt(int64(tid), 16)}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1013 | |
| 1014 | // ONU-G ME-ID is defined to be 0, no need to perform a DB lookup |
| 1015 | meParams := me.ParamData{ |
| 1016 | EntityID: 0, |
| 1017 | Attributes: requestedAttributes, |
| 1018 | } |
| 1019 | meInstance, omciErr := me.NewOnuG(meParams) |
| 1020 | if omciErr.GetError() == nil { |
| 1021 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.SetRequestType, omci.TransactionID(tid)) |
| 1022 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1023 | logger.Errorw(ctx, "Cannot encode ONU-G instance for set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1024 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1025 | return nil |
| 1026 | } |
| 1027 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1028 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1029 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1030 | logger.Errorw(ctx, "Cannot serialize ONU-G set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1031 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1032 | return nil |
| 1033 | } |
| 1034 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1035 | omciRxCallbackPair := callbackPair{ |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1036 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1037 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1038 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1039 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1040 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1041 | logger.Errorw(ctx, "Cannot send ONU-G set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1042 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1043 | return nil |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1044 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1045 | logger.Debug(ctx, "send ONU-G-Set-msg done") |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1046 | return meInstance |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1047 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1048 | logger.Errorw(ctx, "Cannot generate ONU-G", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1049 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1050 | return nil |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1051 | } |
| 1052 | |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1053 | func (oo *omciCC) sendSetPptpEthUniLS(ctx context.Context, aInstNo uint16, timeout int, |
| 1054 | highPrio bool, requestedAttributes me.AttributeValueMap, rxChan chan Message) *me.ManagedEntity { |
| 1055 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1056 | logger.Debugw(ctx, "send PPTPEthUni-Set-msg:", log.Fields{"device-id": oo.deviceID, |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1057 | "SequNo": strconv.FormatInt(int64(tid), 16)}) |
| 1058 | |
| 1059 | // PPTPEthUni ME-ID is taken from Mib Upload stored OnuUniPort instance (argument) |
| 1060 | meParams := me.ParamData{ |
| 1061 | EntityID: aInstNo, |
| 1062 | Attributes: requestedAttributes, |
| 1063 | } |
| 1064 | meInstance, omciErr := me.NewPhysicalPathTerminationPointEthernetUni(meParams) |
| 1065 | if omciErr.GetError() == nil { |
| 1066 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.SetRequestType, omci.TransactionID(tid)) |
| 1067 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1068 | logger.Errorw(ctx, "Cannot encode PPTPEthUni instance for set", log.Fields{ |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1069 | "Err": err, "device-id": oo.deviceID}) |
| 1070 | return nil |
| 1071 | } |
| 1072 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1073 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1074 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1075 | logger.Errorw(ctx, "Cannot serialize PPTPEthUni-Set", log.Fields{ |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1076 | "Err": err, "device-id": oo.deviceID}) |
| 1077 | return nil |
| 1078 | } |
| 1079 | |
| 1080 | omciRxCallbackPair := callbackPair{ |
| 1081 | cbKey: tid, |
| 1082 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
| 1083 | } |
| 1084 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
| 1085 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1086 | logger.Errorw(ctx, "Cannot send PPTPEthUni-Set", log.Fields{ |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1087 | "Err": err, "device-id": oo.deviceID}) |
| 1088 | return nil |
| 1089 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1090 | logger.Debug(ctx, "send PPTPEthUni-Set-msg done") |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1091 | return meInstance |
| 1092 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1093 | logger.Errorw(ctx, "Cannot generate PPTPEthUni", log.Fields{ |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1094 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 1095 | return nil |
| 1096 | } |
| 1097 | |
| 1098 | /* UniG obsolete by now, left here in case it should be needed once again |
| 1099 | UniG AdminState anyway should be ignored by ONU acc. to G988 |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1100 | func (oo *omciCC) sendSetUniGLS(ctx context.Context, aInstNo uint16, timeout int, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1101 | highPrio bool, requestedAttributes me.AttributeValueMap, rxChan chan Message) *me.ManagedEntity { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1102 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1103 | logger.Debugw(ctx,"send UNI-G-Set-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1104 | "SequNo": strconv.FormatInt(int64(tid), 16)}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1105 | |
| 1106 | // UNI-G ME-ID is taken from Mib Upload stored OnuUniPort instance (argument) |
| 1107 | meParams := me.ParamData{ |
| 1108 | EntityID: aInstNo, |
| 1109 | Attributes: requestedAttributes, |
| 1110 | } |
| 1111 | meInstance, omciErr := me.NewUniG(meParams) |
| 1112 | if omciErr.GetError() == nil { |
| 1113 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.SetRequestType, omci.TransactionID(tid)) |
| 1114 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1115 | logger.Errorw(ctx,"Cannot encode UNI-G instance for set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1116 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1117 | return nil |
| 1118 | } |
| 1119 | |
| 1120 | pkt, err := serializeOmciLayer(omciLayer, msgLayer) |
| 1121 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1122 | logger.Errorw(ctx,"Cannot serialize UNI-G-Set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1123 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1124 | return nil |
| 1125 | } |
| 1126 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1127 | omciRxCallbackPair := callbackPair{ |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1128 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1129 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1130 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1131 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1132 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1133 | logger.Errorw(ctx,"Cannot send UNIG-G-Set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1134 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1135 | return nil |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1136 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1137 | logger.Debug(ctx,"send UNI-G-Set-msg done") |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1138 | return meInstance |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1139 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1140 | logger.Errorw(ctx,"Cannot generate UNI-G", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1141 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1142 | return nil |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1143 | } |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1144 | */ |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1145 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1146 | func (oo *omciCC) sendSetVeipLS(ctx context.Context, aInstNo uint16, timeout int, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1147 | highPrio bool, requestedAttributes me.AttributeValueMap, rxChan chan Message) *me.ManagedEntity { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1148 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1149 | logger.Debugw(ctx, "send VEIP-Set-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1150 | "SequNo": strconv.FormatInt(int64(tid), 16)}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1151 | |
| 1152 | // ONU-G ME-ID is defined to be 0, no need to perform a DB lookup |
| 1153 | meParams := me.ParamData{ |
| 1154 | EntityID: aInstNo, |
| 1155 | Attributes: requestedAttributes, |
| 1156 | } |
| 1157 | meInstance, omciErr := me.NewVirtualEthernetInterfacePoint(meParams) |
| 1158 | if omciErr.GetError() == nil { |
| 1159 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.SetRequestType, omci.TransactionID(tid)) |
| 1160 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1161 | logger.Errorw(ctx, "Cannot encode VEIP instance for set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1162 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1163 | return nil |
| 1164 | } |
| 1165 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1166 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1167 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1168 | logger.Errorw(ctx, "Cannot serialize VEIP-Set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1169 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1170 | return nil |
| 1171 | } |
| 1172 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1173 | omciRxCallbackPair := callbackPair{ |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1174 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1175 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1176 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1177 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1178 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1179 | logger.Errorw(ctx, "Cannot send VEIP-Set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1180 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1181 | return nil |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1182 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1183 | logger.Debug(ctx, "send VEIP-Set-msg done") |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1184 | return meInstance |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1185 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1186 | logger.Errorw(ctx, "Cannot generate VEIP", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1187 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1188 | return nil |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1189 | } |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1190 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1191 | func (oo *omciCC) sendGetMe(ctx context.Context, classID me.ClassID, entityID uint16, requestedAttributes me.AttributeValueMap, |
Girish Gowdra | e09a620 | 2021-01-12 18:10:59 -0800 | [diff] [blame] | 1192 | timeout int, highPrio bool, rxChan chan Message) *me.ManagedEntity { |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1193 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1194 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1195 | logger.Debugw(ctx, "send get-request-msg", log.Fields{"classID": classID, "device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1196 | "SequNo": strconv.FormatInt(int64(tid), 16)}) |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1197 | |
| 1198 | meParams := me.ParamData{ |
| 1199 | EntityID: entityID, |
| 1200 | Attributes: requestedAttributes, |
| 1201 | } |
| 1202 | meInstance, omciErr := me.LoadManagedEntityDefinition(classID, meParams) |
| 1203 | if omciErr.GetError() == nil { |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 1204 | meClassIDName := meInstance.GetName() |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1205 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.GetRequestType, omci.TransactionID(tid)) |
| 1206 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1207 | logger.Errorf(ctx, "Cannot encode instance for get-request", log.Fields{"meClassIDName": meClassIDName, "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1208 | return nil |
| 1209 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1210 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1211 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1212 | logger.Errorw(ctx, "Cannot serialize get-request", log.Fields{"meClassIDName": meClassIDName, "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1213 | return nil |
| 1214 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1215 | omciRxCallbackPair := callbackPair{ |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1216 | cbKey: tid, |
Girish Gowdra | e09a620 | 2021-01-12 18:10:59 -0800 | [diff] [blame] | 1217 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1218 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1219 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1220 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1221 | logger.Errorw(ctx, "Cannot send get-request-msg", log.Fields{"meClassIDName": meClassIDName, "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1222 | return nil |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1223 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1224 | logger.Debugw(ctx, "send get-request-msg done", log.Fields{"meClassIDName": meClassIDName, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1225 | return meInstance |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1226 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1227 | logger.Errorw(ctx, "Cannot generate meDefinition", log.Fields{"classID": classID, "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1228 | return nil |
| 1229 | } |
| 1230 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1231 | func (oo *omciCC) sendCreateDot1PMapper(ctx context.Context, timeout int, highPrio bool, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1232 | aInstID uint16, rxChan chan Message) *me.ManagedEntity { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1233 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1234 | logger.Debugw(ctx, "send .1pMapper-Create-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1235 | "SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 1236 | |
| 1237 | meParams := me.ParamData{ |
mpagenko | 8b5fdd2 | 2020-12-17 17:58:32 +0000 | [diff] [blame] | 1238 | EntityID: aInstID, |
| 1239 | Attributes: me.AttributeValueMap{ |
| 1240 | //workaround for unsuitable omci-lib default values, cmp VOL-3729 |
| 1241 | "TpPointer": 0xFFFF, |
| 1242 | "InterworkTpPointerForPBitPriority0": 0xFFFF, |
| 1243 | "InterworkTpPointerForPBitPriority1": 0xFFFF, |
| 1244 | "InterworkTpPointerForPBitPriority2": 0xFFFF, |
| 1245 | "InterworkTpPointerForPBitPriority3": 0xFFFF, |
| 1246 | "InterworkTpPointerForPBitPriority4": 0xFFFF, |
| 1247 | "InterworkTpPointerForPBitPriority5": 0xFFFF, |
| 1248 | "InterworkTpPointerForPBitPriority6": 0xFFFF, |
| 1249 | "InterworkTpPointerForPBitPriority7": 0xFFFF, |
| 1250 | }, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1251 | } |
| 1252 | meInstance, omciErr := me.NewIeee8021PMapperServiceProfile(meParams) |
| 1253 | if omciErr.GetError() == nil { |
| 1254 | //we have to set all 'untouched' parameters to default by some additional option parameter!! |
| 1255 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.CreateRequestType, |
| 1256 | omci.TransactionID(tid), omci.AddDefaults(true)) |
| 1257 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1258 | logger.Errorw(ctx, "Cannot encode .1pMapper for create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1259 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1260 | return nil |
| 1261 | } |
| 1262 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1263 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1264 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1265 | logger.Errorw(ctx, "Cannot serialize .1pMapper create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1266 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1267 | return nil |
| 1268 | } |
| 1269 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1270 | omciRxCallbackPair := callbackPair{ |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1271 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1272 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1273 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1274 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1275 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1276 | logger.Errorw(ctx, "Cannot send .1pMapper create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1277 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1278 | return nil |
| 1279 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1280 | logger.Debug(ctx, "send .1pMapper-create-msg done") |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1281 | return meInstance |
| 1282 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1283 | logger.Errorw(ctx, "Cannot generate .1pMapper", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1284 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1285 | return nil |
| 1286 | } |
| 1287 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1288 | func (oo *omciCC) sendCreateMBPConfigDataVar(ctx context.Context, timeout int, highPrio bool, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1289 | rxChan chan Message, params ...me.ParamData) *me.ManagedEntity { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1290 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1291 | logger.Debugw(ctx, "send MBPCD-Create-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1292 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1293 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1294 | |
| 1295 | meInstance, omciErr := me.NewMacBridgePortConfigurationData(params[0]) |
| 1296 | if omciErr.GetError() == nil { |
| 1297 | //obviously we have to set all 'untouched' parameters to default by some additional option parameter!! |
| 1298 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.CreateRequestType, |
| 1299 | omci.TransactionID(tid), omci.AddDefaults(true)) |
| 1300 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1301 | logger.Errorw(ctx, "Cannot encode MBPCD for create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1302 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1303 | return nil |
| 1304 | } |
| 1305 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1306 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1307 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1308 | logger.Errorw(ctx, "Cannot serialize MBPCD create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1309 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1310 | return nil |
| 1311 | } |
| 1312 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1313 | omciRxCallbackPair := callbackPair{ |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1314 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1315 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1316 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1317 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1318 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1319 | logger.Errorw(ctx, "Cannot send MBPCD create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1320 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1321 | return nil |
| 1322 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1323 | logger.Debug(ctx, "send MBPCD-Create-msg done") |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1324 | return meInstance |
| 1325 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1326 | logger.Errorw(ctx, "Cannot generate MBPCD Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1327 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1328 | return nil |
| 1329 | } |
| 1330 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1331 | func (oo *omciCC) sendCreateGemNCTPVar(ctx context.Context, timeout int, highPrio bool, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1332 | rxChan chan Message, params ...me.ParamData) *me.ManagedEntity { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1333 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1334 | logger.Debugw(ctx, "send GemNCTP-Create-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1335 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1336 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1337 | |
| 1338 | meInstance, omciErr := me.NewGemPortNetworkCtp(params[0]) |
| 1339 | if omciErr.GetError() == nil { |
| 1340 | //obviously we have to set all 'untouched' parameters to default by some additional option parameter!! |
| 1341 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.CreateRequestType, |
| 1342 | omci.TransactionID(tid), omci.AddDefaults(true)) |
| 1343 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1344 | logger.Errorw(ctx, "Cannot encode GemNCTP for create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1345 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1346 | return nil |
| 1347 | } |
| 1348 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1349 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1350 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1351 | logger.Errorw(ctx, "Cannot serialize GemNCTP create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1352 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1353 | return nil |
| 1354 | } |
| 1355 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1356 | omciRxCallbackPair := callbackPair{ |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1357 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1358 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1359 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1360 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1361 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1362 | logger.Errorw(ctx, "Cannot send GemNCTP create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1363 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1364 | return nil |
| 1365 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1366 | logger.Debug(ctx, "send GemNCTP-Create-msg done") |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1367 | return meInstance |
| 1368 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1369 | logger.Errorw(ctx, "Cannot generate GemNCTP Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1370 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1371 | return nil |
| 1372 | } |
| 1373 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1374 | func (oo *omciCC) sendCreateGemIWTPVar(ctx context.Context, timeout int, highPrio bool, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1375 | rxChan chan Message, params ...me.ParamData) *me.ManagedEntity { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1376 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1377 | logger.Debugw(ctx, "send GemIwTp-Create-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1378 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1379 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1380 | |
| 1381 | meInstance, omciErr := me.NewGemInterworkingTerminationPoint(params[0]) |
| 1382 | if omciErr.GetError() == nil { |
| 1383 | //all SetByCreate Parameters (assumed to be) set here, for optimisation no 'AddDefaults' |
| 1384 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.CreateRequestType, |
| 1385 | omci.TransactionID(tid)) |
| 1386 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1387 | logger.Errorw(ctx, "Cannot encode GemIwTp for create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1388 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1389 | return nil |
| 1390 | } |
| 1391 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1392 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1393 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1394 | logger.Errorw(ctx, "Cannot serialize GemIwTp create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1395 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1396 | return nil |
| 1397 | } |
| 1398 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1399 | omciRxCallbackPair := callbackPair{ |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1400 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1401 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1402 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1403 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1404 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1405 | logger.Errorw(ctx, "Cannot send GemIwTp create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1406 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1407 | return nil |
| 1408 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1409 | logger.Debug(ctx, "send GemIwTp-Create-msg done") |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1410 | return meInstance |
| 1411 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1412 | logger.Errorw(ctx, "Cannot generate GemIwTp Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1413 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1414 | return nil |
| 1415 | } |
| 1416 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1417 | func (oo *omciCC) sendSetTcontVar(ctx context.Context, timeout int, highPrio bool, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1418 | rxChan chan Message, params ...me.ParamData) *me.ManagedEntity { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1419 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1420 | logger.Debugw(ctx, "send TCont-Set-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1421 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1422 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1423 | |
| 1424 | meInstance, omciErr := me.NewTCont(params[0]) |
| 1425 | if omciErr.GetError() == nil { |
| 1426 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.SetRequestType, omci.TransactionID(tid)) |
| 1427 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1428 | logger.Errorw(ctx, "Cannot encode TCont for set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1429 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1430 | return nil |
| 1431 | } |
| 1432 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1433 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1434 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1435 | logger.Errorw(ctx, "Cannot serialize TCont set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1436 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1437 | return nil |
| 1438 | } |
| 1439 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1440 | omciRxCallbackPair := callbackPair{ |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1441 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1442 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1443 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1444 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1445 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1446 | logger.Errorw(ctx, "Cannot send TCont set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1447 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1448 | return nil |
| 1449 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1450 | logger.Debug(ctx, "send TCont-set msg done") |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1451 | return meInstance |
| 1452 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1453 | logger.Errorw(ctx, "Cannot generate TCont Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1454 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1455 | return nil |
| 1456 | } |
| 1457 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1458 | func (oo *omciCC) sendSetPrioQueueVar(ctx context.Context, timeout int, highPrio bool, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1459 | rxChan chan Message, params ...me.ParamData) *me.ManagedEntity { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1460 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1461 | logger.Debugw(ctx, "send PrioQueue-Set-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1462 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1463 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1464 | |
| 1465 | meInstance, omciErr := me.NewPriorityQueue(params[0]) |
| 1466 | if omciErr.GetError() == nil { |
| 1467 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.SetRequestType, omci.TransactionID(tid)) |
| 1468 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1469 | logger.Errorw(ctx, "Cannot encode PrioQueue for set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1470 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1471 | return nil |
| 1472 | } |
| 1473 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1474 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1475 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1476 | logger.Errorw(ctx, "Cannot serialize PrioQueue set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1477 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1478 | return nil |
| 1479 | } |
| 1480 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1481 | omciRxCallbackPair := callbackPair{ |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1482 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1483 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1484 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1485 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1486 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1487 | logger.Errorw(ctx, "Cannot send PrioQueue set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1488 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1489 | return nil |
| 1490 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1491 | logger.Debug(ctx, "send PrioQueue-set msg done") |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1492 | return meInstance |
| 1493 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1494 | logger.Errorw(ctx, "Cannot generate PrioQueue Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1495 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1496 | return nil |
| 1497 | } |
| 1498 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1499 | func (oo *omciCC) sendSetDot1PMapperVar(ctx context.Context, timeout int, highPrio bool, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1500 | rxChan chan Message, params ...me.ParamData) *me.ManagedEntity { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1501 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1502 | logger.Debugw(ctx, "send 1PMapper-Set-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1503 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1504 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1505 | |
| 1506 | meInstance, omciErr := me.NewIeee8021PMapperServiceProfile(params[0]) |
| 1507 | if omciErr.GetError() == nil { |
| 1508 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.SetRequestType, omci.TransactionID(tid)) |
| 1509 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1510 | logger.Errorw(ctx, "Cannot encode 1PMapper for set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1511 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1512 | return nil |
| 1513 | } |
| 1514 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1515 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1516 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1517 | logger.Errorw(ctx, "Cannot serialize 1PMapper set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1518 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1519 | return nil |
| 1520 | } |
| 1521 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1522 | omciRxCallbackPair := callbackPair{ |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1523 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1524 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1525 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1526 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1527 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1528 | logger.Errorw(ctx, "Cannot send 1PMapper set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1529 | "Err": err, "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1530 | return nil |
| 1531 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1532 | logger.Debug(ctx, "send 1PMapper-set msg done") |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1533 | return meInstance |
| 1534 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1535 | logger.Errorw(ctx, "Cannot generate 1PMapper Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1536 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1537 | return nil |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1538 | } |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1539 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1540 | func (oo *omciCC) sendCreateVtfdVar(ctx context.Context, timeout int, highPrio bool, |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1541 | rxChan chan Message, params ...me.ParamData) *me.ManagedEntity { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1542 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1543 | logger.Debugw(ctx, "send VTFD-Create-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1544 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1545 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1546 | |
| 1547 | meInstance, omciErr := me.NewVlanTaggingFilterData(params[0]) |
| 1548 | if omciErr.GetError() == nil { |
| 1549 | //all SetByCreate Parameters (assumed to be) set here, for optimisation no 'AddDefaults' |
| 1550 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.CreateRequestType, |
| 1551 | omci.TransactionID(tid)) |
| 1552 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1553 | logger.Errorw(ctx, "Cannot encode VTFD for create", log.Fields{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1554 | "Err": err, "device-id": oo.deviceID}) |
| 1555 | //TODO!!: refactoring improvement requested, here as an example for [VOL-3457]: |
| 1556 | // return (dual format) error code that can be used at caller for immediate error treatment |
| 1557 | // (relevant to all used sendXX() methods and their error conditions) |
| 1558 | return nil |
| 1559 | } |
| 1560 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1561 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1562 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1563 | logger.Errorw(ctx, "Cannot serialize VTFD create", log.Fields{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1564 | "Err": err, "device-id": oo.deviceID}) |
| 1565 | return nil |
| 1566 | } |
| 1567 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1568 | omciRxCallbackPair := callbackPair{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1569 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1570 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1571 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1572 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1573 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1574 | logger.Errorw(ctx, "Cannot send VTFD create", log.Fields{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1575 | "Err": err, "device-id": oo.deviceID}) |
| 1576 | return nil |
| 1577 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1578 | logger.Debug(ctx, "send VTFD-Create-msg done") |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1579 | return meInstance |
| 1580 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1581 | logger.Errorw(ctx, "Cannot generate VTFD Instance", log.Fields{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1582 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 1583 | return nil |
| 1584 | } |
| 1585 | |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 1586 | // nolint: unused |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 1587 | func (oo *omciCC) sendSetVtfdVar(ctx context.Context, timeout int, highPrio bool, |
| 1588 | rxChan chan Message, params ...me.ParamData) *me.ManagedEntity { |
| 1589 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1590 | logger.Debugw(ctx, "send VTFD-Set-msg:", log.Fields{"device-id": oo.deviceID, |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 1591 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1592 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1593 | |
| 1594 | meInstance, omciErr := me.NewVlanTaggingFilterData(params[0]) |
| 1595 | if omciErr.GetError() == nil { |
| 1596 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.SetRequestType, |
| 1597 | omci.TransactionID(tid)) |
| 1598 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1599 | logger.Errorw(ctx, "Cannot encode VTFD for set", log.Fields{ |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 1600 | "Err": err, "device-id": oo.deviceID}) |
| 1601 | //TODO!!: refactoring improvement requested, here as an example for [VOL-3457]: |
| 1602 | // return (dual format) error code that can be used at caller for immediate error treatment |
| 1603 | // (relevant to all used sendXX() methods and their error conditions) |
| 1604 | return nil |
| 1605 | } |
| 1606 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1607 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 1608 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1609 | logger.Errorw(ctx, "Cannot serialize VTFD set", log.Fields{ |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 1610 | "Err": err, "device-id": oo.deviceID}) |
| 1611 | return nil |
| 1612 | } |
| 1613 | |
| 1614 | omciRxCallbackPair := callbackPair{ |
| 1615 | cbKey: tid, |
| 1616 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
| 1617 | } |
| 1618 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
| 1619 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1620 | logger.Errorw(ctx, "Cannot send VTFD set", log.Fields{ |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 1621 | "Err": err, "device-id": oo.deviceID}) |
| 1622 | return nil |
| 1623 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1624 | logger.Debug(ctx, "send VTFD-Set-msg done") |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 1625 | return meInstance |
| 1626 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1627 | logger.Errorw(ctx, "Cannot generate VTFD Instance", log.Fields{ |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 1628 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 1629 | return nil |
| 1630 | } |
| 1631 | |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 1632 | func (oo *omciCC) sendCreateEvtocdVar(ctx context.Context, timeout int, highPrio bool, |
| 1633 | rxChan chan Message, params ...me.ParamData) *me.ManagedEntity { |
| 1634 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1635 | logger.Debugw(ctx, "send EVTOCD-Create-msg:", log.Fields{"device-id": oo.deviceID, |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 1636 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1637 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1638 | |
| 1639 | meInstance, omciErr := me.NewExtendedVlanTaggingOperationConfigurationData(params[0]) |
| 1640 | if omciErr.GetError() == nil { |
| 1641 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.CreateRequestType, omci.TransactionID(tid)) |
| 1642 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1643 | logger.Errorw(ctx, "Cannot encode EVTOCD for create", log.Fields{ |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 1644 | "Err": err, "device-id": oo.deviceID}) |
| 1645 | return nil |
| 1646 | } |
| 1647 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1648 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 1649 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1650 | logger.Errorw(ctx, "Cannot serialize EVTOCD create", log.Fields{ |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 1651 | "Err": err, "device-id": oo.deviceID}) |
| 1652 | return nil |
| 1653 | } |
| 1654 | |
| 1655 | omciRxCallbackPair := callbackPair{ |
| 1656 | cbKey: tid, |
| 1657 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
| 1658 | } |
| 1659 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
| 1660 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1661 | logger.Errorw(ctx, "Cannot send EVTOCD create", log.Fields{ |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 1662 | "Err": err, "device-id": oo.deviceID}) |
| 1663 | return nil |
| 1664 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1665 | logger.Debug(ctx, "send EVTOCD-set msg done") |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 1666 | return meInstance |
| 1667 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1668 | logger.Errorw(ctx, "Cannot generate EVTOCD Instance", log.Fields{ |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 1669 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 1670 | return nil |
| 1671 | } |
| 1672 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1673 | func (oo *omciCC) sendSetEvtocdVar(ctx context.Context, timeout int, highPrio bool, |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1674 | rxChan chan Message, params ...me.ParamData) *me.ManagedEntity { |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1675 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1676 | logger.Debugw(ctx, "send EVTOCD-Set-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1677 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1678 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1679 | |
| 1680 | meInstance, omciErr := me.NewExtendedVlanTaggingOperationConfigurationData(params[0]) |
| 1681 | if omciErr.GetError() == nil { |
| 1682 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.SetRequestType, omci.TransactionID(tid)) |
| 1683 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1684 | logger.Errorw(ctx, "Cannot encode EVTOCD for set", log.Fields{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1685 | "Err": err, "device-id": oo.deviceID}) |
| 1686 | return nil |
| 1687 | } |
| 1688 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1689 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1690 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1691 | logger.Errorw(ctx, "Cannot serialize EVTOCD set", log.Fields{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1692 | "Err": err, "device-id": oo.deviceID}) |
| 1693 | return nil |
| 1694 | } |
| 1695 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1696 | omciRxCallbackPair := callbackPair{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1697 | cbKey: tid, |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1698 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1699 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1700 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1701 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1702 | logger.Errorw(ctx, "Cannot send EVTOCD set", log.Fields{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1703 | "Err": err, "device-id": oo.deviceID}) |
| 1704 | return nil |
| 1705 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1706 | logger.Debug(ctx, "send EVTOCD-set msg done") |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1707 | return meInstance |
| 1708 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1709 | logger.Errorw(ctx, "Cannot generate EVTOCD Instance", log.Fields{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1710 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 1711 | return nil |
| 1712 | } |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 1713 | |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 1714 | func (oo *omciCC) sendDeleteEvtocd(ctx context.Context, timeout int, highPrio bool, |
| 1715 | rxChan chan Message, params ...me.ParamData) *me.ManagedEntity { |
| 1716 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1717 | logger.Debugw(ctx, "send EVTOCD-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 1718 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1719 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1720 | |
| 1721 | meInstance, omciErr := me.NewExtendedVlanTaggingOperationConfigurationData(params[0]) |
| 1722 | if omciErr.GetError() == nil { |
| 1723 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.DeleteRequestType, omci.TransactionID(tid)) |
| 1724 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1725 | logger.Errorw(ctx, "Cannot encode EVTOCD for delete", log.Fields{ |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 1726 | "Err": err, "device-id": oo.deviceID}) |
| 1727 | return nil |
| 1728 | } |
| 1729 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1730 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 1731 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1732 | logger.Errorw(ctx, "Cannot serialize EVTOCD delete", log.Fields{ |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 1733 | "Err": err, "device-id": oo.deviceID}) |
| 1734 | return nil |
| 1735 | } |
| 1736 | |
| 1737 | omciRxCallbackPair := callbackPair{ |
| 1738 | cbKey: tid, |
| 1739 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
| 1740 | } |
| 1741 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
| 1742 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1743 | logger.Errorw(ctx, "Cannot send EVTOCD delete", log.Fields{ |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 1744 | "Err": err, "device-id": oo.deviceID}) |
| 1745 | return nil |
| 1746 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1747 | logger.Debug(ctx, "send EVTOCD-delete msg done") |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 1748 | return meInstance |
| 1749 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1750 | logger.Errorw(ctx, "Cannot generate EVTOCD Instance", log.Fields{ |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 1751 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 1752 | return nil |
| 1753 | } |
| 1754 | |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 1755 | func (oo *omciCC) sendDeleteVtfd(ctx context.Context, timeout int, highPrio bool, |
| 1756 | rxChan chan Message, aInstID uint16) *me.ManagedEntity { |
| 1757 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1758 | logger.Debugw(ctx, "send VTFD-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 1759 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1760 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 1761 | |
| 1762 | meParams := me.ParamData{EntityID: aInstID} |
| 1763 | meInstance, omciErr := me.NewVlanTaggingFilterData(meParams) |
| 1764 | if omciErr.GetError() == nil { |
| 1765 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 1766 | omci.TransactionID(tid)) |
| 1767 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1768 | logger.Errorw(ctx, "Cannot encode VTFD for delete", log.Fields{ |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 1769 | "Err": err, "device-id": oo.deviceID}) |
| 1770 | //TODO!!: refactoring improvement requested, here as an example for [VOL-3457]: |
| 1771 | // return (dual format) error code that can be used at caller for immediate error treatment |
| 1772 | // (relevant to all used sendXX() methods and their error conditions) |
| 1773 | return nil |
| 1774 | } |
| 1775 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1776 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 1777 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1778 | logger.Errorw(ctx, "Cannot serialize VTFD delete", log.Fields{ |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 1779 | "Err": err, "device-id": oo.deviceID}) |
| 1780 | return nil |
| 1781 | } |
| 1782 | |
| 1783 | omciRxCallbackPair := callbackPair{ |
| 1784 | cbKey: tid, |
| 1785 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
| 1786 | } |
| 1787 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
| 1788 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1789 | logger.Errorw(ctx, "Cannot send VTFD delete", log.Fields{ |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 1790 | "Err": err, "device-id": oo.deviceID}) |
| 1791 | return nil |
| 1792 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1793 | logger.Debug(ctx, "send VTFD-Delete-msg done") |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 1794 | return meInstance |
| 1795 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1796 | logger.Errorw(ctx, "Cannot generate VTFD Instance for delete", log.Fields{ |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 1797 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 1798 | return nil |
| 1799 | } |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 1800 | |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1801 | func (oo *omciCC) sendDeleteGemIWTP(ctx context.Context, timeout int, highPrio bool, |
| 1802 | rxChan chan Message, aInstID uint16) *me.ManagedEntity { |
| 1803 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1804 | logger.Debugw(ctx, "send GemIwTp-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1805 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1806 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 1807 | |
| 1808 | meParams := me.ParamData{EntityID: aInstID} |
| 1809 | meInstance, omciErr := me.NewGemInterworkingTerminationPoint(meParams) |
| 1810 | if omciErr.GetError() == nil { |
| 1811 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 1812 | omci.TransactionID(tid)) |
| 1813 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1814 | logger.Errorw(ctx, "Cannot encode GemIwTp for delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1815 | "Err": err, "device-id": oo.deviceID}) |
| 1816 | //TODO!!: refactoring improvement requested, here as an example for [VOL-3457]: |
| 1817 | // return (dual format) error code that can be used at caller for immediate error treatment |
| 1818 | // (relevant to all used sendXX() methods and their error conditions) |
| 1819 | return nil |
| 1820 | } |
| 1821 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1822 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1823 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1824 | logger.Errorw(ctx, "Cannot serialize GemIwTp delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1825 | "Err": err, "device-id": oo.deviceID}) |
| 1826 | return nil |
| 1827 | } |
| 1828 | |
| 1829 | omciRxCallbackPair := callbackPair{ |
| 1830 | cbKey: tid, |
| 1831 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
| 1832 | } |
| 1833 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
| 1834 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1835 | logger.Errorw(ctx, "Cannot send GemIwTp delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1836 | "Err": err, "device-id": oo.deviceID}) |
| 1837 | return nil |
| 1838 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1839 | logger.Debug(ctx, "send GemIwTp-Delete-msg done") |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1840 | return meInstance |
| 1841 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1842 | logger.Errorw(ctx, "Cannot generate GemIwTp Instance for delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1843 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 1844 | return nil |
| 1845 | } |
| 1846 | |
| 1847 | func (oo *omciCC) sendDeleteGemNCTP(ctx context.Context, timeout int, highPrio bool, |
| 1848 | rxChan chan Message, aInstID uint16) *me.ManagedEntity { |
| 1849 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1850 | logger.Debugw(ctx, "send GemNCtp-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1851 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1852 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 1853 | |
| 1854 | meParams := me.ParamData{EntityID: aInstID} |
| 1855 | meInstance, omciErr := me.NewGemPortNetworkCtp(meParams) |
| 1856 | if omciErr.GetError() == nil { |
| 1857 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 1858 | omci.TransactionID(tid)) |
| 1859 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1860 | logger.Errorw(ctx, "Cannot encode GemNCtp for delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1861 | "Err": err, "device-id": oo.deviceID}) |
| 1862 | //TODO!!: refactoring improvement requested, here as an example for [VOL-3457]: |
| 1863 | // return (dual format) error code that can be used at caller for immediate error treatment |
| 1864 | // (relevant to all used sendXX() methods and their error conditions) |
| 1865 | return nil |
| 1866 | } |
| 1867 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1868 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1869 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1870 | logger.Errorw(ctx, "Cannot serialize GemNCtp delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1871 | "Err": err, "device-id": oo.deviceID}) |
| 1872 | return nil |
| 1873 | } |
| 1874 | |
| 1875 | omciRxCallbackPair := callbackPair{ |
| 1876 | cbKey: tid, |
| 1877 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
| 1878 | } |
| 1879 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
| 1880 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1881 | logger.Errorw(ctx, "Cannot send GemNCtp delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1882 | "Err": err, "device-id": oo.deviceID}) |
| 1883 | return nil |
| 1884 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1885 | logger.Debug(ctx, "send GemNCtp-Delete-msg done") |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1886 | return meInstance |
| 1887 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1888 | logger.Errorw(ctx, "Cannot generate GemNCtp Instance for delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1889 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 1890 | return nil |
| 1891 | } |
| 1892 | |
| 1893 | func (oo *omciCC) sendDeleteDot1PMapper(ctx context.Context, timeout int, highPrio bool, |
| 1894 | rxChan chan Message, aInstID uint16) *me.ManagedEntity { |
| 1895 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1896 | logger.Debugw(ctx, "send .1pMapper-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1897 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1898 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 1899 | |
| 1900 | meParams := me.ParamData{EntityID: aInstID} |
| 1901 | meInstance, omciErr := me.NewIeee8021PMapperServiceProfile(meParams) |
| 1902 | if omciErr.GetError() == nil { |
| 1903 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 1904 | omci.TransactionID(tid)) |
| 1905 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1906 | logger.Errorw(ctx, "Cannot encode .1pMapper for delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1907 | "Err": err, "device-id": oo.deviceID}) |
| 1908 | //TODO!!: refactoring improvement requested, here as an example for [VOL-3457]: |
| 1909 | // return (dual format) error code that can be used at caller for immediate error treatment |
| 1910 | // (relevant to all used sendXX() methods and their error conditions) |
| 1911 | return nil |
| 1912 | } |
| 1913 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1914 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1915 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1916 | logger.Errorw(ctx, "Cannot serialize .1pMapper delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1917 | "Err": err, "device-id": oo.deviceID}) |
| 1918 | return nil |
| 1919 | } |
| 1920 | |
| 1921 | omciRxCallbackPair := callbackPair{ |
| 1922 | cbKey: tid, |
| 1923 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
| 1924 | } |
| 1925 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
| 1926 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1927 | logger.Errorw(ctx, "Cannot send .1pMapper delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1928 | "Err": err, "device-id": oo.deviceID}) |
| 1929 | return nil |
| 1930 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1931 | logger.Debug(ctx, "send .1pMapper-Delete-msg done") |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1932 | return meInstance |
| 1933 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1934 | logger.Errorw(ctx, "Cannot generate .1pMapper Instance for delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1935 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 1936 | return nil |
| 1937 | } |
| 1938 | |
| 1939 | func (oo *omciCC) sendDeleteMBPConfigData(ctx context.Context, timeout int, highPrio bool, |
| 1940 | rxChan chan Message, aInstID uint16) *me.ManagedEntity { |
| 1941 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1942 | logger.Debugw(ctx, "send MBPCD-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1943 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1944 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 1945 | |
| 1946 | meParams := me.ParamData{EntityID: aInstID} |
| 1947 | meInstance, omciErr := me.NewMacBridgePortConfigurationData(meParams) |
| 1948 | if omciErr.GetError() == nil { |
| 1949 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 1950 | omci.TransactionID(tid)) |
| 1951 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1952 | logger.Errorw(ctx, "Cannot encode MBPCD for delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1953 | "Err": err, "device-id": oo.deviceID}) |
| 1954 | //TODO!!: refactoring improvement requested, here as an example for [VOL-3457]: |
| 1955 | // return (dual format) error code that can be used at caller for immediate error treatment |
| 1956 | // (relevant to all used sendXX() methods and their error conditions) |
| 1957 | return nil |
| 1958 | } |
| 1959 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1960 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1961 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1962 | logger.Errorw(ctx, "Cannot serialize MBPCD delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1963 | "Err": err, "device-id": oo.deviceID}) |
| 1964 | return nil |
| 1965 | } |
| 1966 | |
| 1967 | omciRxCallbackPair := callbackPair{ |
| 1968 | cbKey: tid, |
| 1969 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
| 1970 | } |
| 1971 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
| 1972 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1973 | logger.Errorw(ctx, "Cannot send MBPCD delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1974 | "Err": err, "device-id": oo.deviceID}) |
| 1975 | return nil |
| 1976 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1977 | logger.Debug(ctx, "send MBPCD-Delete-msg done") |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1978 | return meInstance |
| 1979 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1980 | logger.Errorw(ctx, "Cannot generate MBPCD Instance for delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 1981 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 1982 | return nil |
| 1983 | } |
| 1984 | |
mpagenko | fc4f56e | 2020-11-04 17:17:49 +0000 | [diff] [blame] | 1985 | // nolint: unused |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 1986 | func (oo *omciCC) sendCreateMulticastGemIWTPVar(ctx context.Context, timeout int, highPrio bool, |
| 1987 | rxChan chan Message, params ...me.ParamData) *me.ManagedEntity { |
| 1988 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1989 | logger.Debugw(ctx, "send MulticastGemIWTP-create-msg:", log.Fields{"device-id": oo.deviceID, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 1990 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1991 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1992 | |
| 1993 | meInstance, omciErr := me.NewMulticastGemInterworkingTerminationPoint(params[0]) |
| 1994 | if omciErr.GetError() == nil { |
| 1995 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.CreateRequestType, omci.TransactionID(tid), |
| 1996 | omci.AddDefaults(true)) |
| 1997 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1998 | logger.Errorw(ctx, "Cannot encode MulticastGEMIWTP for create", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 1999 | return nil |
| 2000 | } |
| 2001 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2002 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2003 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2004 | logger.Errorw(ctx, "Cannot serialize MulticastGEMIWTP create", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2005 | return nil |
| 2006 | } |
| 2007 | |
| 2008 | omciRxCallbackPair := callbackPair{cbKey: tid, |
| 2009 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
| 2010 | } |
| 2011 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
| 2012 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2013 | logger.Errorw(ctx, "Cannot send MulticastGEMIWTP create", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2014 | return nil |
| 2015 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2016 | logger.Debug(ctx, "send MulticastGEMIWTP-create-msg done") |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2017 | return meInstance |
| 2018 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2019 | logger.Errorw(ctx, "Cannot generate MulticastGEMIWTP Instance", log.Fields{"Err": omciErr.GetError(), |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2020 | "device-id": oo.deviceID}) |
| 2021 | return nil |
| 2022 | } |
| 2023 | |
mpagenko | fc4f56e | 2020-11-04 17:17:49 +0000 | [diff] [blame] | 2024 | // nolint: unused |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2025 | func (oo *omciCC) sendSetMulticastGemIWTPVar(ctx context.Context, timeout int, highPrio bool, |
| 2026 | rxChan chan Message, params ...me.ParamData) *me.ManagedEntity { |
| 2027 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2028 | logger.Debugw(ctx, "send MulticastGemIWTP-set-msg:", log.Fields{"device-id": oo.deviceID, |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2029 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2030 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2031 | |
| 2032 | meInstance, omciErr := me.NewMulticastGemInterworkingTerminationPoint(params[0]) |
| 2033 | if omciErr.GetError() == nil { |
| 2034 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.SetRequestType, omci.TransactionID(tid), |
| 2035 | omci.AddDefaults(true)) |
| 2036 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2037 | logger.Errorw(ctx, "Cannot encode MulticastGEMIWTP for set", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2038 | return nil |
| 2039 | } |
| 2040 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2041 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2042 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2043 | logger.Errorw(ctx, "Cannot serialize MulticastGEMIWTP create", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2044 | return nil |
| 2045 | } |
| 2046 | |
| 2047 | omciRxCallbackPair := callbackPair{cbKey: tid, |
| 2048 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
| 2049 | } |
| 2050 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
| 2051 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2052 | logger.Errorw(ctx, "Cannot send MulticastGEMIWTP set", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2053 | return nil |
| 2054 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2055 | logger.Debug(ctx, "send MulticastGEMIWTP-set-msg done") |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2056 | return meInstance |
| 2057 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2058 | logger.Errorw(ctx, "Cannot generate MulticastGEMIWTP Instance", log.Fields{"Err": omciErr.GetError(), |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2059 | "device-id": oo.deviceID}) |
| 2060 | return nil |
| 2061 | } |
| 2062 | |
| 2063 | // nolint: unused |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2064 | func (oo *omciCC) sendCreateMulticastOperationProfileVar(ctx context.Context, timeout int, highPrio bool, |
| 2065 | rxChan chan Message, params ...me.ParamData) *me.ManagedEntity { |
| 2066 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2067 | logger.Debugw(ctx, "send MulticastOperationProfile-create-msg:", log.Fields{"device-id": oo.deviceID, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2068 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2069 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2070 | |
| 2071 | meInstance, omciErr := me.NewMulticastOperationsProfile(params[0]) |
| 2072 | if omciErr.GetError() == nil { |
| 2073 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.CreateRequestType, omci.TransactionID(tid), |
| 2074 | omci.AddDefaults(true)) |
| 2075 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2076 | logger.Errorw(ctx, "Cannot encode MulticastOperationProfile for create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2077 | "device-id": oo.deviceID}) |
| 2078 | return nil |
| 2079 | } |
| 2080 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2081 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2082 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2083 | logger.Errorw(ctx, "Cannot serialize MulticastOperationProfile create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2084 | "device-id": oo.deviceID}) |
| 2085 | return nil |
| 2086 | } |
| 2087 | |
| 2088 | omciRxCallbackPair := callbackPair{cbKey: tid, |
| 2089 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
| 2090 | } |
| 2091 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
| 2092 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2093 | logger.Errorw(ctx, "Cannot send MulticastOperationProfile create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2094 | "device-id": oo.deviceID}) |
| 2095 | return nil |
| 2096 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2097 | logger.Debug(ctx, "send MulticastOperationProfile-create-msg done") |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2098 | return meInstance |
| 2099 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2100 | logger.Errorw(ctx, "Cannot generate MulticastOperationProfile Instance", log.Fields{"Err": omciErr.GetError(), |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2101 | "device-id": oo.deviceID}) |
| 2102 | return nil |
| 2103 | } |
| 2104 | |
mpagenko | fc4f56e | 2020-11-04 17:17:49 +0000 | [diff] [blame] | 2105 | // nolint: unused |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2106 | func (oo *omciCC) sendSetMulticastOperationProfileVar(ctx context.Context, timeout int, highPrio bool, |
| 2107 | rxChan chan Message, params ...me.ParamData) *me.ManagedEntity { |
| 2108 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2109 | logger.Debugw(ctx, "send MulticastOperationProfile-create-msg:", log.Fields{"device-id": oo.deviceID, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2110 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2111 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2112 | |
| 2113 | meInstance, omciErr := me.NewMulticastOperationsProfile(params[0]) |
| 2114 | if omciErr.GetError() == nil { |
| 2115 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.SetRequestType, omci.TransactionID(tid), |
| 2116 | omci.AddDefaults(true)) |
| 2117 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2118 | logger.Errorw(ctx, "Cannot encode MulticastOperationProfile for create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2119 | "device-id": oo.deviceID}) |
| 2120 | return nil |
| 2121 | } |
| 2122 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2123 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2124 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2125 | logger.Errorw(ctx, "Cannot serialize MulticastOperationProfile create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2126 | "device-id": oo.deviceID}) |
| 2127 | return nil |
| 2128 | } |
| 2129 | |
| 2130 | omciRxCallbackPair := callbackPair{cbKey: tid, |
| 2131 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
| 2132 | } |
| 2133 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
| 2134 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2135 | logger.Errorw(ctx, "Cannot send MulticastOperationProfile create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2136 | "device-id": oo.deviceID}) |
| 2137 | return nil |
| 2138 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2139 | logger.Debug(ctx, "send MulticastOperationProfile-create-msg done") |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2140 | return meInstance |
| 2141 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2142 | logger.Errorw(ctx, "Cannot generate MulticastOperationProfile Instance", log.Fields{"Err": omciErr.GetError(), |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2143 | "device-id": oo.deviceID}) |
| 2144 | return nil |
| 2145 | } |
| 2146 | |
mpagenko | fc4f56e | 2020-11-04 17:17:49 +0000 | [diff] [blame] | 2147 | // nolint: unused |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2148 | func (oo *omciCC) sendCreateMulticastSubConfigInfoVar(ctx context.Context, timeout int, highPrio bool, |
| 2149 | rxChan chan Message, params ...me.ParamData) *me.ManagedEntity { |
| 2150 | tid := oo.getNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2151 | logger.Debugw(ctx, "send MulticastSubConfigInfo-create-msg:", log.Fields{"device-id": oo.deviceID, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2152 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2153 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2154 | |
| 2155 | meInstance, omciErr := me.NewMulticastSubscriberConfigInfo(params[0]) |
| 2156 | if omciErr.GetError() == nil { |
| 2157 | omciLayer, msgLayer, err := omci.EncodeFrame(meInstance, omci.CreateRequestType, omci.TransactionID(tid), |
| 2158 | omci.AddDefaults(true)) |
| 2159 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2160 | logger.Errorw(ctx, "Cannot encode MulticastSubConfigInfo for create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2161 | "device-id": oo.deviceID}) |
| 2162 | return nil |
| 2163 | } |
| 2164 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2165 | pkt, err := serializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2166 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2167 | logger.Errorw(ctx, "Cannot serialize MulticastSubConfigInfo create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2168 | "device-id": oo.deviceID}) |
| 2169 | return nil |
| 2170 | } |
| 2171 | |
| 2172 | omciRxCallbackPair := callbackPair{cbKey: tid, |
| 2173 | cbEntry: callbackPairEntry{rxChan, oo.receiveOmciResponse}, |
| 2174 | } |
| 2175 | err = oo.send(ctx, pkt, timeout, 0, highPrio, omciRxCallbackPair) |
| 2176 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2177 | logger.Errorw(ctx, "Cannot send MulticastSubConfigInfo create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2178 | "device-id": oo.deviceID}) |
| 2179 | return nil |
| 2180 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2181 | logger.Debug(ctx, "send MulticastSubConfigInfo-create-msg done") |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2182 | return meInstance |
| 2183 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2184 | logger.Errorw(ctx, "Cannot generate MulticastSubConfigInfo Instance", log.Fields{"Err": omciErr.GetError(), |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2185 | "device-id": oo.deviceID}) |
| 2186 | return nil |
| 2187 | } |
Holger Hildebrandt | 0bd45f8 | 2021-01-11 13:29:37 +0000 | [diff] [blame] | 2188 | |
| 2189 | func isResponseWithMibDataSync(msgType omci.MessageType) bool { |
| 2190 | for _, v := range responsesWithMibDataSync { |
| 2191 | if v == msgType { |
| 2192 | return true |
| 2193 | } |
| 2194 | } |
| 2195 | return false |
| 2196 | } |