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 | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 17 | //Package common provides global definitions |
| 18 | package common |
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" |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 25 | "fmt" |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 26 | "strconv" |
Holger Hildebrandt | 93d183f | 2022-04-22 15:50:26 +0000 | [diff] [blame] | 27 | "strings" |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 28 | "sync" |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 29 | "time" //by now for testing |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 30 | |
| 31 | "github.com/google/gopacket" |
| 32 | // TODO!!! Some references could be resolved auto, but some need specific context .... |
| 33 | gp "github.com/google/gopacket" |
| 34 | |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 35 | "github.com/opencord/omci-lib-go/v2" |
| 36 | me "github.com/opencord/omci-lib-go/v2/generated" |
| 37 | oframe "github.com/opencord/omci-lib-go/v2/meframe" |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 38 | |
khenaidoo | 7d3c558 | 2021-08-11 18:09:44 -0400 | [diff] [blame] | 39 | vgrpc "github.com/opencord/voltha-lib-go/v7/pkg/grpc" |
| 40 | |
khenaidoo | 7d3c558 | 2021-08-11 18:09:44 -0400 | [diff] [blame] | 41 | "github.com/opencord/voltha-lib-go/v7/pkg/log" |
khenaidoo | 42dcdfd | 2021-10-19 17:34:12 -0400 | [diff] [blame] | 42 | "github.com/opencord/voltha-protos/v5/go/common" |
Holger Hildebrandt | 66af5ce | 2022-09-07 13:38:02 +0000 | [diff] [blame] | 43 | "github.com/opencord/voltha-protos/v5/go/extension" |
khenaidoo | 42dcdfd | 2021-10-19 17:34:12 -0400 | [diff] [blame] | 44 | ia "github.com/opencord/voltha-protos/v5/go/inter_adapter" |
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 | |
Holger Hildebrandt | 9b64e0b | 2022-04-21 08:02:00 +0000 | [diff] [blame] | 49 | const maxGemPayloadSize = uint16(2048) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 50 | const connectivityModeValue = uint8(5) |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 51 | |
| 52 | //const defaultTPID = uint16(0x8100) |
| 53 | //const broadComDefaultVID = uint16(4091) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 54 | |
| 55 | // UnusedTcontAllocID - TODO: add comment |
| 56 | const UnusedTcontAllocID = uint16(0xFFFF) //common unused AllocId for G.984 and G.987 systems |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 57 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 58 | const cOmciDeviceIdentifierPos = 3 |
mpagenko | c8bba41 | 2021-01-15 15:38:44 +0000 | [diff] [blame] | 59 | const cOmciBaseMessageTrailerLen = 40 |
| 60 | |
| 61 | // tOmciReceiveError - enum type for detected problems/errors in the received OMCI message (format) |
| 62 | type tOmciReceiveError uint8 |
| 63 | |
| 64 | const ( |
| 65 | // cOmciMessageReceiveNoError - default start state |
| 66 | cOmciMessageReceiveNoError tOmciReceiveError = iota |
| 67 | // Error indication wrong trailer length within the message |
| 68 | cOmciMessageReceiveErrorTrailerLen |
| 69 | // Error indication missing trailer within the message |
| 70 | cOmciMessageReceiveErrorMissTrailer |
| 71 | ) |
| 72 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 73 | // CDefaultRetries - TODO: add comment |
| 74 | const CDefaultRetries = 2 |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 75 | |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 76 | // ### OMCI related definitions - end |
| 77 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 78 | //CallbackPairEntry to be used for OMCI send/receive correlation |
| 79 | type CallbackPairEntry struct { |
| 80 | CbRespChannel chan Message |
| 81 | CbFunction func(context.Context, *omci.OMCI, *gp.Packet, chan Message) error |
| 82 | FramePrint bool //true for printing |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 83 | } |
| 84 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 85 | //CallbackPair to be used for ReceiveCallback init |
| 86 | type CallbackPair struct { |
| 87 | CbKey uint16 |
| 88 | CbEntry CallbackPairEntry |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 89 | } |
| 90 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 91 | // OmciTransferStructure - TODO: add comment |
| 92 | type OmciTransferStructure struct { |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 93 | txFrame []byte |
| 94 | timeout int |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 95 | retries int |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 96 | highPrio bool |
| 97 | withFramePrint bool |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 98 | cbPair CallbackPair |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 99 | chSuccess chan bool |
kesavand | 011d516 | 2021-11-25 19:21:06 +0530 | [diff] [blame] | 100 | OnuSwWindow *ia.OmciMessages |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 101 | } |
| 102 | |
Holger Hildebrandt | 66af5ce | 2022-09-07 13:38:02 +0000 | [diff] [blame] | 103 | type txRxCounters struct { |
| 104 | txArFrames uint32 |
| 105 | txNoArFrames uint32 |
| 106 | rxAkFrames uint32 |
| 107 | rxNoAkFrames uint32 |
| 108 | } |
| 109 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 110 | //OmciCC structure holds information needed for OMCI communication (to/from OLT Adapter) |
| 111 | type OmciCC struct { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 112 | enabled bool |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 113 | pBaseDeviceHandler IdeviceHandler |
| 114 | pOnuDeviceEntry IonuDeviceEntry |
| 115 | pOnuAlarmManager IonuAlarmManager |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 116 | deviceID string |
khenaidoo | 7d3c558 | 2021-08-11 18:09:44 -0400 | [diff] [blame] | 117 | coreClient *vgrpc.Client |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 118 | supportExtMsg bool |
mpagenko | c8bba41 | 2021-01-15 15:38:44 +0000 | [diff] [blame] | 119 | rxOmciFrameError tOmciReceiveError |
| 120 | |
Holger Hildebrandt | 66af5ce | 2022-09-07 13:38:02 +0000 | [diff] [blame] | 121 | mutexCounters sync.RWMutex |
| 122 | countersBase txRxCounters |
| 123 | countersExt txRxCounters |
| 124 | txRetries uint32 |
| 125 | txTimeouts uint32 |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 126 | |
| 127 | // OMCI params |
| 128 | mutexTid sync.Mutex |
| 129 | tid uint16 |
| 130 | mutexHpTid sync.Mutex |
| 131 | hpTid uint16 |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 132 | UploadSequNo uint16 |
| 133 | UploadNoOfCmds uint16 |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 134 | |
Holger Hildebrandt | 556d56c | 2022-12-07 09:23:49 +0000 | [diff] [blame] | 135 | mutexSendQueuedRequests sync.Mutex |
| 136 | mutexLowPrioTxQueue sync.Mutex |
| 137 | lowPrioTxQueue *list.List |
| 138 | mutexHighPrioTxQueue sync.Mutex |
| 139 | highPrioTxQueue *list.List |
| 140 | mutexRxSchedMap sync.Mutex |
| 141 | rxSchedulerMap map[uint16]CallbackPairEntry |
| 142 | mutexMonReq sync.RWMutex |
| 143 | monitoredRequests map[uint16]OmciTransferStructure |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 144 | } |
| 145 | |
Holger Hildebrandt | 0bd45f8 | 2021-01-11 13:29:37 +0000 | [diff] [blame] | 146 | var responsesWithMibDataSync = []omci.MessageType{ |
| 147 | omci.CreateResponseType, |
| 148 | omci.DeleteResponseType, |
| 149 | omci.SetResponseType, |
| 150 | omci.StartSoftwareDownloadResponseType, |
| 151 | omci.EndSoftwareDownloadResponseType, |
| 152 | omci.ActivateSoftwareResponseType, |
| 153 | omci.CommitSoftwareResponseType, |
| 154 | } |
| 155 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 156 | //NewOmciCC constructor returns a new instance of a OmciCC |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 157 | //mib_db (as well as not inluded alarm_db not really used in this code? VERIFY!!) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 158 | func NewOmciCC(ctx context.Context, deviceID string, deviceHandler IdeviceHandler, |
| 159 | onuDeviceEntry IonuDeviceEntry, onuAlarmManager IonuAlarmManager, |
| 160 | coreClient *vgrpc.Client) *OmciCC { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 161 | logger.Debugw(ctx, "init-omciCC", log.Fields{"device-id": deviceID}) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 162 | var omciCC OmciCC |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 163 | omciCC.enabled = false |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 164 | omciCC.pBaseDeviceHandler = deviceHandler |
| 165 | omciCC.pOnuAlarmManager = onuAlarmManager |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 166 | omciCC.pOnuDeviceEntry = onuDeviceEntry |
| 167 | omciCC.deviceID = deviceID |
khenaidoo | 7d3c558 | 2021-08-11 18:09:44 -0400 | [diff] [blame] | 168 | omciCC.coreClient = coreClient |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 169 | omciCC.supportExtMsg = false |
mpagenko | c8bba41 | 2021-01-15 15:38:44 +0000 | [diff] [blame] | 170 | omciCC.rxOmciFrameError = cOmciMessageReceiveNoError |
Holger Hildebrandt | 66af5ce | 2022-09-07 13:38:02 +0000 | [diff] [blame] | 171 | omciCC.countersBase = txRxCounters{0, 0, 0, 0} |
| 172 | omciCC.countersExt = txRxCounters{0, 0, 0, 0} |
| 173 | omciCC.txRetries = 0 |
| 174 | omciCC.txTimeouts = 0 |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 175 | omciCC.tid = 0x1 |
| 176 | omciCC.hpTid = 0x8000 |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 177 | omciCC.UploadSequNo = 0 |
| 178 | omciCC.UploadNoOfCmds = 0 |
Holger Hildebrandt | 3455551 | 2021-10-01 16:26:59 +0000 | [diff] [blame] | 179 | omciCC.lowPrioTxQueue = list.New() |
| 180 | omciCC.highPrioTxQueue = list.New() |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 181 | omciCC.rxSchedulerMap = make(map[uint16]CallbackPairEntry) |
| 182 | omciCC.monitoredRequests = make(map[uint16]OmciTransferStructure) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 183 | return &omciCC |
| 184 | } |
| 185 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 186 | //Stop stops/resets the omciCC |
| 187 | func (oo *OmciCC) Stop(ctx context.Context) error { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 188 | logger.Debugw(ctx, "omciCC-stopping", log.Fields{"device-id": oo.deviceID}) |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 189 | //reseting all internal data, which might also be helpful for discarding any lingering tx/rx requests |
mpagenko | 8cd1bf7 | 2021-06-22 10:11:19 +0000 | [diff] [blame] | 190 | oo.CancelRequestMonitoring(ctx) |
Holger Hildebrandt | 3455551 | 2021-10-01 16:26:59 +0000 | [diff] [blame] | 191 | // clear the tx queues |
| 192 | oo.mutexHighPrioTxQueue.Lock() |
| 193 | oo.highPrioTxQueue.Init() |
| 194 | oo.mutexHighPrioTxQueue.Unlock() |
| 195 | oo.mutexLowPrioTxQueue.Lock() |
| 196 | oo.lowPrioTxQueue.Init() |
| 197 | oo.mutexLowPrioTxQueue.Unlock() |
| 198 | //clear the scheduler map |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 199 | oo.mutexRxSchedMap.Lock() |
| 200 | for k := range oo.rxSchedulerMap { |
Holger Hildebrandt | 3455551 | 2021-10-01 16:26:59 +0000 | [diff] [blame] | 201 | delete(oo.rxSchedulerMap, k) |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 202 | } |
| 203 | oo.mutexRxSchedMap.Unlock() |
Holger Hildebrandt | 3455551 | 2021-10-01 16:26:59 +0000 | [diff] [blame] | 204 | //reset the high prio transactionId |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 205 | oo.mutexHpTid.Lock() |
Holger Hildebrandt | 3455551 | 2021-10-01 16:26:59 +0000 | [diff] [blame] | 206 | oo.hpTid = 0x8000 |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 207 | oo.mutexHpTid.Unlock() |
Holger Hildebrandt | 3455551 | 2021-10-01 16:26:59 +0000 | [diff] [blame] | 208 | //reset the low prio transactionId |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 209 | oo.mutexTid.Lock() |
Holger Hildebrandt | 3455551 | 2021-10-01 16:26:59 +0000 | [diff] [blame] | 210 | oo.tid = 1 |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 211 | oo.mutexTid.Unlock() |
| 212 | //reset control values |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 213 | oo.UploadSequNo = 0 |
| 214 | oo.UploadNoOfCmds = 0 |
mpagenko | c8bba41 | 2021-01-15 15:38:44 +0000 | [diff] [blame] | 215 | oo.rxOmciFrameError = cOmciMessageReceiveNoError |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 216 | |
Holger Hildebrandt | 66af5ce | 2022-09-07 13:38:02 +0000 | [diff] [blame] | 217 | //reset the stats counter |
| 218 | oo.mutexCounters.Lock() |
| 219 | oo.countersBase = txRxCounters{0, 0, 0, 0} |
| 220 | oo.countersExt = txRxCounters{0, 0, 0, 0} |
| 221 | oo.txRetries = 0 |
| 222 | oo.txTimeouts = 0 |
| 223 | oo.mutexCounters.Unlock() |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 224 | return nil |
| 225 | } |
| 226 | |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 227 | // Rx handler for omci messages |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 228 | func (oo *OmciCC) receiveOnuMessage(ctx context.Context, omciMsg *omci.OMCI, packet *gp.Packet) error { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 229 | logger.Debugw(ctx, "rx-onu-autonomous-message", log.Fields{"omciMsgType": omciMsg.MessageType, |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 230 | "payload": hex.EncodeToString(omciMsg.Payload)}) |
Himani Chawla | ac1f5ad | 2021-02-04 21:21:54 +0530 | [diff] [blame] | 231 | switch omciMsg.MessageType { |
| 232 | case omci.AlarmNotificationType: |
| 233 | data := OmciMessage{ |
| 234 | OmciMsg: omciMsg, |
| 235 | OmciPacket: packet, |
| 236 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 237 | go oo.pOnuAlarmManager.HandleOmciAlarmNotificationMessage(ctx, data) |
Himani Chawla | ac1f5ad | 2021-02-04 21:21:54 +0530 | [diff] [blame] | 238 | return nil |
| 239 | default: |
| 240 | return fmt.Errorf("receiveOnuMessageType %s unimplemented", omciMsg.MessageType.String()) |
| 241 | } |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 242 | /* |
| 243 | msgType = rxFrame.fields["message_type"] //assumed OmciOperationsValue |
| 244 | rxOnuFrames++ |
| 245 | |
| 246 | switch msgType { |
| 247 | case AlarmNotification: |
| 248 | { |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 249 | logger.Info("Unhandled: received-onu-alarm-message") |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 250 | // python code was: |
| 251 | //if msg_type == EntityOperations.AlarmNotification.value: |
| 252 | // topic = OMCI_CC.event_bus_topic(self._device_id, RxEvent.Alarm_Notification) |
| 253 | // self.reactor.callLater(0, self.event_bus.publish, topic, msg) |
| 254 | // |
| 255 | return errors.New("RxAlarmNotification unimplemented") |
| 256 | } |
| 257 | case AttributeValueChange: |
| 258 | { |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 259 | logger.Info("Unhandled: received-attribute-value-change") |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 260 | // python code was: |
| 261 | //elif msg_type == EntityOperations.AttributeValueChange.value: |
| 262 | // topic = OMCI_CC.event_bus_topic(self._device_id, RxEvent.AVC_Notification) |
| 263 | // self.reactor.callLater(0, self.event_bus.publish, topic, msg) |
| 264 | // |
| 265 | return errors.New("RxAttributeValueChange unimplemented") |
| 266 | } |
| 267 | case TestResult: |
| 268 | { |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 269 | logger.Info("Unhandled: received-test-result") |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 270 | // python code was: |
| 271 | //elif msg_type == EntityOperations.TestResult.value: |
| 272 | // topic = OMCI_CC.event_bus_topic(self._device_id, RxEvent.Test_Result) |
| 273 | // self.reactor.callLater(0, self.event_bus.publish, topic, msg) |
| 274 | // |
| 275 | return errors.New("RxTestResult unimplemented") |
| 276 | } |
| 277 | default: |
| 278 | { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 279 | logger.Errorw(ctx,"rx-onu-unsupported-autonomous-message", log.Fields{"msgType": msgType}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 280 | rxOnuDiscards++ |
| 281 | return errors.New("RxOnuMsgType unimplemented") |
| 282 | } |
| 283 | } |
| 284 | */ |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 285 | } |
| 286 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 287 | func (oo *OmciCC) printRxMessage(ctx context.Context, rxMsg []byte) { |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 288 | //assuming omci message content is hex coded! |
| 289 | // with restricted output of 16bytes would be ...rxMsg[:16] |
| 290 | logger.Debugw(ctx, "omci-message-received:", log.Fields{ |
| 291 | "RxOmciMessage": hex.EncodeToString(rxMsg), |
| 292 | "device-id": oo.deviceID}) |
| 293 | } |
| 294 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 295 | // ReceiveMessage - Rx handler for onu messages |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 296 | // e.g. would call ReceiveOnuMessage() in case of TID=0 or Action=test ... |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 297 | // nolint: gocyclo |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 298 | func (oo *OmciCC) ReceiveMessage(ctx context.Context, rxMsg []byte) error { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 299 | //logger.Debugw(ctx,"cc-receive-omci-message", log.Fields{"RxOmciMessage-x2s": hex.EncodeToString(rxMsg)}) |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 300 | |
| 301 | if len(rxMsg) < 10 { |
| 302 | logger.Errorw(ctx, "rxOmciMessage has wrong length in general - abort", |
| 303 | log.Fields{"Length": len(rxMsg), "device-id": oo.deviceID}) |
| 304 | if len(rxMsg) > 0 { |
| 305 | oo.printRxMessage(ctx, rxMsg) |
mpagenko | c8bba41 | 2021-01-15 15:38:44 +0000 | [diff] [blame] | 306 | } |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 307 | return fmt.Errorf("rxOmciMessage has wrong length in general - abort %s", oo.deviceID) |
| 308 | } |
| 309 | if rxMsg[cOmciDeviceIdentifierPos] == byte(omci.BaselineIdent) { |
| 310 | if len(rxMsg) >= 44 { // then it should normally include the BaseFormat trailer Len |
| 311 | // NOTE: autocorrection only valid for OmciBaseFormat, which is not specifically verified here!!! |
| 312 | // (an extendedFormat message could be destroyed this way!) |
| 313 | trailerLenData := rxMsg[42:44] |
| 314 | trailerLen := binary.BigEndian.Uint16(trailerLenData) |
| 315 | //logger.Debugw(ctx,"omci-received-trailer-len", log.Fields{"Length": trailerLen}) |
| 316 | if trailerLen != cOmciBaseMessageTrailerLen { // invalid base Format entry -> autocorrect |
| 317 | binary.BigEndian.PutUint16(rxMsg[42:44], cOmciBaseMessageTrailerLen) |
| 318 | if oo.rxOmciFrameError != cOmciMessageReceiveErrorTrailerLen { |
| 319 | //do just one error log, expectation is: if seen once it should appear regularly - avoid to many log entries |
| 320 | logger.Errorw(ctx, "wrong omci-message trailer length: trailer len auto-corrected", |
| 321 | log.Fields{"trailer-length": trailerLen, "device-id": oo.deviceID}) |
| 322 | oo.rxOmciFrameError = cOmciMessageReceiveErrorTrailerLen |
| 323 | } |
| 324 | } |
| 325 | } else if len(rxMsg) >= cOmciBaseMessageTrailerLen { // workaround for Adtran OLT Sim, which currently does not send trailer bytes at all! |
| 326 | // NOTE: autocorrection only valid for OmciBaseFormat, which is not specifically verified here!!! |
| 327 | // (an extendedFormat message could be destroyed this way!) |
| 328 | // extend/overwrite with trailer |
| 329 | trailer := make([]byte, 8) |
| 330 | binary.BigEndian.PutUint16(trailer[2:], cOmciBaseMessageTrailerLen) //set the defined baseline length |
| 331 | rxMsg = append(rxMsg[:cOmciBaseMessageTrailerLen], trailer...) |
| 332 | if oo.rxOmciFrameError != cOmciMessageReceiveErrorMissTrailer { |
| 333 | //do just one error log, expectation is: if seen once it should appear regularly - avoid to many log entries |
| 334 | logger.Errorw(ctx, "omci-message to short to include trailer len: trailer auto-corrected (added)", |
| 335 | log.Fields{"message-length": len(rxMsg), "device-id": oo.deviceID}) |
| 336 | oo.rxOmciFrameError = cOmciMessageReceiveErrorMissTrailer |
| 337 | } |
| 338 | } else { |
| 339 | logger.Errorw(ctx, "received omci-message too small for OmciBaseFormat - abort", |
| 340 | log.Fields{"Length": len(rxMsg), "device-id": oo.deviceID}) |
| 341 | oo.printRxMessage(ctx, rxMsg) |
| 342 | return fmt.Errorf("rxOmciMessage too small for BaseFormat %s", oo.deviceID) |
| 343 | } |
| 344 | } else if rxMsg[cOmciDeviceIdentifierPos] == byte(omci.ExtendedIdent) { |
| 345 | if len(rxMsg) > 1980 { |
| 346 | logger.Errorw(ctx, "rxOmciMessage has wrong length for OmciExtendedFormat - abort", |
| 347 | log.Fields{"Length": len(rxMsg), "device-id": oo.deviceID}) |
| 348 | oo.printRxMessage(ctx, rxMsg) |
| 349 | return fmt.Errorf("rxOmciMessage has wrong length for OmciExtendedFormat %s", oo.deviceID) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 350 | } |
| 351 | } else { |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 352 | logger.Errorw(ctx, "rxOmciMessage has wrong Device Identifier - abort", |
mpagenko | c8bba41 | 2021-01-15 15:38:44 +0000 | [diff] [blame] | 353 | log.Fields{"Length": len(rxMsg), "device-id": oo.deviceID}) |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 354 | oo.printRxMessage(ctx, rxMsg) |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 355 | return fmt.Errorf("rxOmciMessage has wrong Device Identifier %s", oo.deviceID) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 356 | } |
Holger Hildebrandt | 36747fd | 2022-03-14 09:47:17 +0000 | [diff] [blame] | 357 | decodeOptions := gopacket.DecodeOptions{ |
| 358 | Lazy: true, |
| 359 | NoCopy: true, |
| 360 | } |
| 361 | packet := gopacket.NewPacket(rxMsg, omci.LayerTypeOMCI, decodeOptions) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 362 | if packet == nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 363 | logger.Errorw(ctx, "omci-message could not be decoded", log.Fields{"device-id": oo.deviceID}) |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 364 | oo.printRxMessage(ctx, rxMsg) |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 365 | return fmt.Errorf("could not decode rxMsg as OMCI %s", oo.deviceID) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 366 | } |
| 367 | omciLayer := packet.Layer(omci.LayerTypeOMCI) |
| 368 | if omciLayer == nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 369 | logger.Errorw(ctx, "omci-message could not decode omci layer", log.Fields{"device-id": oo.deviceID}) |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 370 | oo.printRxMessage(ctx, rxMsg) |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 371 | return fmt.Errorf("could not decode omci layer %s", oo.deviceID) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 372 | } |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 373 | // insert some check on detected OMCI decoding issues and log them |
| 374 | // e.g. should indicate problems when detecting some unknown attribute mask content (independent from message type) |
| 375 | // even though allowed from omci-lib due to set relaxed decoding |
| 376 | // application may dig into further details if wanted/needed on their own [but info is not transferred from here so far] |
| 377 | // (compare mib_sync.go unknownAttrLayer) |
| 378 | errLayer := packet.Layer(gopacket.LayerTypeDecodeFailure) |
| 379 | if failure, decodeOk := errLayer.(*gopacket.DecodeFailure); decodeOk { |
| 380 | errMsg := failure.Error() |
| 381 | logger.Warnw(ctx, "Detected decode issue on received OMCI frame", log.Fields{ |
| 382 | "device-id": oo.deviceID, "issue": errMsg}) |
| 383 | } |
| 384 | //anyway try continue OMCI decoding further on message type layer |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 385 | omciMsg, ok := omciLayer.(*omci.OMCI) |
| 386 | if !ok { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 387 | logger.Errorw(ctx, "omci-message could not assign omci layer", log.Fields{"device-id": oo.deviceID}) |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 388 | oo.printRxMessage(ctx, rxMsg) |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 389 | return fmt.Errorf("could not assign omci layer %s", oo.deviceID) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 390 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 391 | logger.Debugw(ctx, "omci-message-decoded:", log.Fields{"omciMsgType": omciMsg.MessageType, |
Holger Hildebrandt | 36747fd | 2022-03-14 09:47:17 +0000 | [diff] [blame] | 392 | "transCorrId": strconv.FormatInt(int64(omciMsg.TransactionID), 16), |
| 393 | "DeviceIdent": omciMsg.DeviceIdentifier, "device-id": oo.deviceID}) |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 394 | |
Girish Gowdra | 6afb56a | 2021-04-27 17:47:57 -0700 | [diff] [blame] | 395 | // TestResult is asynchronous indication that carries the same TID as the TestResponse. |
| 396 | // We expect to find the TID in the oo.rxSchedulerMap |
| 397 | if byte(omciMsg.MessageType)&me.AK == 0 && omciMsg.MessageType != omci.TestResultType { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 398 | // Not a response |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 399 | oo.printRxMessage(ctx, rxMsg) |
Holger Hildebrandt | 36747fd | 2022-03-14 09:47:17 +0000 | [diff] [blame] | 400 | logger.Debugw(ctx, "RxMsg is no Omci Response Message", log.Fields{"device-id": oo.deviceID}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 401 | if omciMsg.TransactionID == 0 { |
Holger Hildebrandt | 66af5ce | 2022-09-07 13:38:02 +0000 | [diff] [blame] | 402 | if rxMsg[cOmciDeviceIdentifierPos] == byte(omci.BaselineIdent) { |
| 403 | oo.incrementBaseRxNoAkFrames() |
| 404 | } else { |
| 405 | oo.incrementExtRxNoAkFrames() |
| 406 | } |
Himani Chawla | ac1f5ad | 2021-02-04 21:21:54 +0530 | [diff] [blame] | 407 | return oo.receiveOnuMessage(ctx, omciMsg, &packet) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 408 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 409 | logger.Errorw(ctx, "Unexpected TransCorrId != 0 not accepted for autonomous messages", |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 410 | log.Fields{"msgType": omciMsg.MessageType, "payload": hex.EncodeToString(omciMsg.Payload), |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 411 | "device-id": oo.deviceID}) |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 412 | 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] | 413 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 414 | //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] | 415 | oo.mutexRxSchedMap.Lock() |
| 416 | rxCallbackEntry, ok := oo.rxSchedulerMap[omciMsg.TransactionID] |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 417 | if ok && rxCallbackEntry.CbFunction != nil { |
Holger Hildebrandt | 68854a8 | 2022-09-05 07:00:21 +0000 | [diff] [blame] | 418 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 419 | if rxCallbackEntry.FramePrint { |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 420 | oo.printRxMessage(ctx, rxMsg) |
| 421 | } |
Holger Hildebrandt | 66af5ce | 2022-09-07 13:38:02 +0000 | [diff] [blame] | 422 | if rxMsg[cOmciDeviceIdentifierPos] == byte(omci.BaselineIdent) { |
| 423 | oo.incrementBaseRxAkFrames() |
| 424 | } else { |
| 425 | oo.incrementExtRxAkFrames() |
| 426 | } |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 427 | //disadvantage of decoupling: error verification made difficult, but anyway the question is |
| 428 | // how to react on erroneous frame reception, maybe can simply be ignored |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 429 | go rxCallbackEntry.CbFunction(ctx, omciMsg, &packet, rxCallbackEntry.CbRespChannel) |
Holger Hildebrandt | 36747fd | 2022-03-14 09:47:17 +0000 | [diff] [blame] | 430 | isSuccessfulResponse, err := oo.isSuccessfulResponseWithMibDataSync(ctx, omciMsg, &packet) |
| 431 | if err != nil { |
| 432 | // qualified error logging already done in function above |
| 433 | if !rxCallbackEntry.FramePrint { |
| 434 | oo.printRxMessage(ctx, rxMsg) |
| 435 | } |
| 436 | return fmt.Errorf("could not decode further layers %s", oo.deviceID) |
| 437 | } |
| 438 | if isSuccessfulResponse { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 439 | oo.pOnuDeviceEntry.IncrementMibDataSync(ctx) |
Holger Hildebrandt | 36747fd | 2022-03-14 09:47:17 +0000 | [diff] [blame] | 440 | } else { |
| 441 | logger.Debugw(ctx, "mibDataSync counter not to be updated for this message type", |
| 442 | log.Fields{"omciMsg.MessageType": omciMsg.MessageType, "device-id": oo.deviceID}) |
Holger Hildebrandt | 0bd45f8 | 2021-01-11 13:29:37 +0000 | [diff] [blame] | 443 | } |
mpagenko | c8bba41 | 2021-01-15 15:38:44 +0000 | [diff] [blame] | 444 | |
Girish Gowdra | 6afb56a | 2021-04-27 17:47:57 -0700 | [diff] [blame] | 445 | // If omciMsg.MessageType is omci.TestResponseType, we still expect the TestResult OMCI message, |
| 446 | // so do not clean up the TransactionID in that case. |
| 447 | if omciMsg.MessageType != omci.TestResponseType { |
| 448 | // having posted the response the request is regarded as 'done' |
| 449 | delete(oo.rxSchedulerMap, omciMsg.TransactionID) |
| 450 | } |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 451 | oo.mutexRxSchedMap.Unlock() |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 452 | return nil |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 453 | } |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 454 | oo.mutexRxSchedMap.Unlock() |
| 455 | logger.Errorw(ctx, "omci-message-response for not registered transCorrId", log.Fields{"device-id": oo.deviceID}) |
| 456 | oo.printRxMessage(ctx, rxMsg) |
| 457 | 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] | 458 | |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 459 | /* py code was: |
| 460 | Receive and OMCI message from the proxy channel to the OLT. |
| 461 | |
| 462 | Call this from your ONU Adapter on a new OMCI Rx on the proxy channel |
| 463 | :param msg: (str) OMCI binary message (used as input to Scapy packet decoder) |
| 464 | """ |
| 465 | if not self.enabled: |
| 466 | return |
| 467 | |
| 468 | try: |
| 469 | now = arrow.utcnow() |
| 470 | d = None |
| 471 | |
| 472 | # NOTE: Since we may need to do an independent ME map on a per-ONU basis |
| 473 | # save the current value of the entity_id_to_class_map, then |
| 474 | # replace it with our custom one before decode, and then finally |
| 475 | # restore it later. Tried other ways but really made the code messy. |
| 476 | saved_me_map = omci_entities.entity_id_to_class_map |
| 477 | omci_entities.entity_id_to_class_map = self._me_map |
| 478 | |
| 479 | try: |
| 480 | rx_frame = msg if isinstance(msg, OmciFrame) else OmciFrame(msg) |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 481 | self.logger.debug('recv-omci-msg', omci_msg=hexlify(msg)) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 482 | except KeyError as e: |
| 483 | # Unknown, Unsupported, or vendor-specific ME. Key is the unknown classID |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 484 | 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] | 485 | rx_frame = self._decode_unknown_me(msg) |
| 486 | self._rx_unknown_me += 1 |
| 487 | |
| 488 | except Exception as e: |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 489 | self.logger.exception('frame-decode', omci_msg=hexlify(msg), e=e) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 490 | return |
| 491 | |
| 492 | finally: |
| 493 | omci_entities.entity_id_to_class_map = saved_me_map # Always restore it. |
| 494 | |
| 495 | rx_tid = rx_frame.fields['transaction_id'] |
| 496 | msg_type = rx_frame.fields['message_type'] |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 497 | 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] | 498 | # Filter the Test Result frame and route through receive onu |
| 499 | # message method. |
| 500 | if rx_tid == 0 or msg_type == EntityOperations.TestResult.value: |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 501 | self.logger.debug('Receive ONU message', rx_tid=0) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 502 | return self._receive_onu_message(rx_frame) |
| 503 | |
| 504 | # Previously unreachable if this is the very first round-trip Rx or we |
| 505 | # have been running consecutive errors |
| 506 | if self._rx_frames == 0 or self._consecutive_errors != 0: |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 507 | self.logger.debug('Consecutive errors for rx', err = self._consecutive_errors) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 508 | self.reactor.callLater(0, self._publish_connectivity_event, True) |
| 509 | |
| 510 | self._rx_frames += 1 |
| 511 | self._consecutive_errors = 0 |
| 512 | |
| 513 | try: |
| 514 | high_priority = self._tid_is_high_priority(rx_tid) |
| 515 | index = self._get_priority_index(high_priority) |
| 516 | |
| 517 | # (timestamp, defer, frame, timeout, retry, delayedCall) |
| 518 | last_tx_tuple = self._tx_request[index] |
| 519 | |
| 520 | if last_tx_tuple is None or \ |
| 521 | last_tx_tuple[OMCI_CC.REQUEST_FRAME].fields.get('transaction_id') != rx_tid: |
| 522 | # Possible late Rx on a message that timed-out |
| 523 | if last_tx_tuple: |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 524 | self.logger.debug('Unknown message', rx_tid=rx_tid, |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 525 | tx_id=last_tx_tuple[OMCI_CC.REQUEST_FRAME].fields.get('transaction_id')) |
| 526 | self._rx_unknown_tid += 1 |
| 527 | self._rx_late += 1 |
| 528 | return |
| 529 | |
| 530 | ts, d, tx_frame, timeout, retry, dc = last_tx_tuple |
| 531 | if dc is not None and not dc.cancelled and not dc.called: |
| 532 | dc.cancel() |
| 533 | |
| 534 | _secs = self._update_rx_tx_stats(now, ts) |
| 535 | |
| 536 | # Late arrival already serviced by a timeout? |
| 537 | if d.called: |
| 538 | self._rx_late += 1 |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 539 | 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] | 540 | return |
| 541 | |
| 542 | except Exception as e: |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 543 | self.logger.exception('frame-match', msg=hexlify(msg), e=e) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 544 | if d is not None: |
| 545 | return d.errback(failure.Failure(e)) |
| 546 | return |
| 547 | |
| 548 | # Publish Rx event to listeners in a different task |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 549 | self.logger.debug('Publish rx event', rx_tid = rx_tid, |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 550 | tx_tid = tx_frame.fields['transaction_id']) |
| 551 | reactor.callLater(0, self._publish_rx_frame, tx_frame, rx_frame) |
| 552 | |
| 553 | # begin success callback chain (will cancel timeout and queue next Tx message) |
| 554 | self._rx_response[index] = rx_frame |
| 555 | d.callback(rx_frame) |
| 556 | |
| 557 | except Exception as e: |
Holger Hildebrandt | 0f9b88d | 2020-04-20 13:33:25 +0000 | [diff] [blame] | 558 | self.logger.exception('rx-msg', e=e) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 559 | */ |
| 560 | } |
| 561 | |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 562 | /* |
| 563 | func (oo *omciCC) publishRxResponseFrame(ctx context.Context, txFrame []byte, rxFrame []byte) error { |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 564 | return errors.New("publishRxResponseFrame unimplemented") |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 565 | //def _publish_rx_frame(self, tx_frame, rx_frame): |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 566 | } |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 567 | */ |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 568 | |
Girish Gowdra | 6afb56a | 2021-04-27 17:47:57 -0700 | [diff] [blame] | 569 | // ReleaseTid releases OMCI transaction identifier from rxSchedulerMap |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 570 | func (oo *OmciCC) ReleaseTid(ctx context.Context, tid uint16) { |
Girish Gowdra | 6afb56a | 2021-04-27 17:47:57 -0700 | [diff] [blame] | 571 | logger.Debugw(ctx, "releasing tid from rxSchedulerMap", log.Fields{"tid": tid}) |
| 572 | delete(oo.rxSchedulerMap, tid) |
| 573 | } |
| 574 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 575 | // Send - Queue the OMCI Frame for a transmit to the ONU via the proxy_channel |
| 576 | func (oo *OmciCC) Send(ctx context.Context, txFrame []byte, timeout int, retry int, highPrio bool, |
| 577 | receiveCallbackPair CallbackPair) error { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 578 | |
mpagenko | c26d4c0 | 2021-05-06 14:27:57 +0000 | [diff] [blame] | 579 | if timeout != 0 { |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 580 | logger.Debugw(ctx, "register-response-callback:", log.Fields{"for TransCorrId": receiveCallbackPair.CbKey}) |
mpagenko | c26d4c0 | 2021-05-06 14:27:57 +0000 | [diff] [blame] | 581 | oo.mutexRxSchedMap.Lock() |
| 582 | // it could be checked, if the callback key is already registered - but simply overwrite may be acceptable ... |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 583 | oo.rxSchedulerMap[receiveCallbackPair.CbKey] = receiveCallbackPair.CbEntry |
mpagenko | c26d4c0 | 2021-05-06 14:27:57 +0000 | [diff] [blame] | 584 | oo.mutexRxSchedMap.Unlock() |
| 585 | } //else timeout 0 indicates that no response is expected - fire and forget |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 586 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 587 | printFrame := receiveCallbackPair.CbEntry.FramePrint //printFrame true means debug print of frame is requested |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 588 | //just use a simple list for starting - might need some more effort, especially for multi source write access |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 589 | omciTxRequest := OmciTransferStructure{ |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 590 | txFrame, |
| 591 | timeout, |
| 592 | retry, |
| 593 | highPrio, |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 594 | printFrame, |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 595 | receiveCallbackPair, |
| 596 | nil, |
kesavand | 011d516 | 2021-11-25 19:21:06 +0530 | [diff] [blame] | 597 | nil, |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 598 | } |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 599 | oo.mutexMonReq.Lock() |
| 600 | defer oo.mutexMonReq.Unlock() |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 601 | if _, exist := oo.monitoredRequests[receiveCallbackPair.CbKey]; !exist { |
mpagenko | 7455fd4 | 2021-06-10 16:25:55 +0000 | [diff] [blame] | 602 | // do not call processRequestMonitoring in background here to ensure correct sequencing |
| 603 | // of requested messages into txQueue (especially for non-response-supervised messages) |
| 604 | oo.processRequestMonitoring(ctx, omciTxRequest) |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 605 | return nil |
| 606 | } |
| 607 | logger.Errorw(ctx, "A message with this tid is processed already!", |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 608 | log.Fields{"tid": receiveCallbackPair.CbKey, "device-id": oo.deviceID}) |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 609 | return fmt.Errorf("message with tid is processed already %s", oo.deviceID) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 610 | } |
| 611 | |
Holger Hildebrandt | 3455551 | 2021-10-01 16:26:59 +0000 | [diff] [blame] | 612 | func (oo *OmciCC) sendQueuedRequests(ctx context.Context) { |
| 613 | // Avoid accessing the txQueues from parallel send routines to block |
| 614 | // parallel omci send requests at least until SendIAP is 'committed'. |
| 615 | // To guarantee window size 1 for one ONU it would be necessary to wait |
| 616 | // for the corresponding response too (t.b.d.). |
| 617 | oo.mutexSendQueuedRequests.Lock() |
| 618 | defer oo.mutexSendQueuedRequests.Unlock() |
| 619 | if err := oo.sendQueuedHighPrioRequests(ctx); err != nil { |
| 620 | logger.Errorw(ctx, "Error during sending high prio requests!", |
| 621 | log.Fields{"err": err, "device-id": oo.deviceID}) |
| 622 | return |
| 623 | } |
| 624 | if err := oo.sendQueuedLowPrioRequests(ctx); err != nil { |
| 625 | logger.Errorw(ctx, "Error during sending low prio requests!", |
| 626 | log.Fields{"err": err, "device-id": oo.deviceID}) |
| 627 | return |
| 628 | } |
| 629 | } |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 630 | |
Holger Hildebrandt | 3455551 | 2021-10-01 16:26:59 +0000 | [diff] [blame] | 631 | func (oo *OmciCC) sendQueuedHighPrioRequests(ctx context.Context) error { |
| 632 | oo.mutexHighPrioTxQueue.Lock() |
| 633 | defer oo.mutexHighPrioTxQueue.Unlock() |
| 634 | for oo.highPrioTxQueue.Len() > 0 { |
| 635 | queueElement := oo.highPrioTxQueue.Front() // First element |
| 636 | if err := oo.sendOMCIRequest(ctx, queueElement.Value.(OmciTransferStructure)); err != nil { |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 637 | // Element will be removed from the queue regardless of the send success, to prevent |
| 638 | // an accumulation of send requests for the same message in the event of an error. |
| 639 | // In this case, resend attempts for the message are ensured by our retry |
| 640 | // mechanism after omci-timeout. |
| 641 | oo.highPrioTxQueue.Remove(queueElement) // Dequeue |
Holger Hildebrandt | 3455551 | 2021-10-01 16:26:59 +0000 | [diff] [blame] | 642 | return err |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 643 | } |
Holger Hildebrandt | 3455551 | 2021-10-01 16:26:59 +0000 | [diff] [blame] | 644 | oo.highPrioTxQueue.Remove(queueElement) // Dequeue |
| 645 | } |
| 646 | return nil |
| 647 | } |
| 648 | |
| 649 | func (oo *OmciCC) sendQueuedLowPrioRequests(ctx context.Context) error { |
| 650 | oo.mutexLowPrioTxQueue.Lock() |
| 651 | for oo.lowPrioTxQueue.Len() > 0 { |
| 652 | queueElement := oo.lowPrioTxQueue.Front() // First element |
kesavand | 011d516 | 2021-11-25 19:21:06 +0530 | [diff] [blame] | 653 | // check if the element is for onu sw section |
| 654 | aOmciTxReq := queueElement.Value.(OmciTransferStructure) |
| 655 | if aOmciTxReq.OnuSwWindow != nil { |
| 656 | if err := oo.sendOnuSwSectionsOfWindow(ctx, aOmciTxReq); err != nil { |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 657 | // Element will be removed from the queue regardless of the send success, to prevent |
| 658 | // an accumulation of send requests for the same message in the event of an error. |
| 659 | // In this case, resend attempts for the message are ensured by our retry |
| 660 | // mechanism after omci-timeout. |
| 661 | oo.lowPrioTxQueue.Remove(queueElement) // Dequeue |
kesavand | 011d516 | 2021-11-25 19:21:06 +0530 | [diff] [blame] | 662 | oo.mutexLowPrioTxQueue.Unlock() |
| 663 | return err |
| 664 | } |
| 665 | } else { |
| 666 | err := oo.sendOMCIRequest(ctx, queueElement.Value.(OmciTransferStructure)) |
| 667 | if err != nil { |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 668 | // Element will be removed from the queue regardless of the send success, to prevent |
| 669 | // an accumulation of send requests for the same message in the event of an error. |
| 670 | // In this case, resend attempts for the message are ensured by our retry |
| 671 | // mechanism after omci-timeout. |
| 672 | oo.lowPrioTxQueue.Remove(queueElement) // Dequeue |
kesavand | 011d516 | 2021-11-25 19:21:06 +0530 | [diff] [blame] | 673 | oo.mutexLowPrioTxQueue.Unlock() |
| 674 | return err |
| 675 | } |
amit.ghosh | 58b704b | 2021-06-18 03:45:52 +0200 | [diff] [blame] | 676 | } |
Holger Hildebrandt | 3455551 | 2021-10-01 16:26:59 +0000 | [diff] [blame] | 677 | oo.lowPrioTxQueue.Remove(queueElement) // Dequeue |
| 678 | // Interrupt the sending of low priority requests to process any high priority requests |
| 679 | // that may have arrived in the meantime |
| 680 | oo.mutexLowPrioTxQueue.Unlock() |
| 681 | if err := oo.sendQueuedHighPrioRequests(ctx); err != nil { |
| 682 | return err |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 683 | } |
Holger Hildebrandt | 3455551 | 2021-10-01 16:26:59 +0000 | [diff] [blame] | 684 | oo.mutexLowPrioTxQueue.Lock() |
| 685 | } |
| 686 | |
| 687 | oo.mutexLowPrioTxQueue.Unlock() |
| 688 | return nil |
| 689 | } |
| 690 | |
| 691 | func (oo *OmciCC) sendOMCIRequest(ctx context.Context, omciTxRequest OmciTransferStructure) error { |
| 692 | if omciTxRequest.withFramePrint { |
| 693 | logger.Debugw(ctx, "omci-message-to-send:", log.Fields{ |
| 694 | "TxOmciMessage": hex.EncodeToString(omciTxRequest.txFrame), |
| 695 | "device-id": oo.deviceID, |
| 696 | "toDeviceType": oo.pBaseDeviceHandler.GetProxyAddressType(), |
| 697 | "proxyDeviceID": oo.pBaseDeviceHandler.GetProxyAddressID(), |
| 698 | "proxyAddress": oo.pBaseDeviceHandler.GetProxyAddress()}) |
| 699 | } |
khenaidoo | 42dcdfd | 2021-10-19 17:34:12 -0400 | [diff] [blame] | 700 | omciMsg := &ia.OmciMessage{ |
Holger Hildebrandt | 3455551 | 2021-10-01 16:26:59 +0000 | [diff] [blame] | 701 | ParentDeviceId: oo.pBaseDeviceHandler.GetProxyAddressID(), |
| 702 | ChildDeviceId: oo.deviceID, |
| 703 | Message: omciTxRequest.txFrame, |
| 704 | ProxyAddress: oo.pBaseDeviceHandler.GetProxyAddress(), |
| 705 | ConnectStatus: common.ConnectStatus_REACHABLE, // If we are sending OMCI messages means we are connected, else we should not be here |
| 706 | } |
| 707 | sendErr := oo.pBaseDeviceHandler.SendOMCIRequest(ctx, oo.pBaseDeviceHandler.GetProxyAddress().AdapterEndpoint, omciMsg) |
| 708 | if sendErr != nil { |
Holger Hildebrandt | abfef03 | 2022-02-25 12:40:20 +0000 | [diff] [blame] | 709 | logger.Errorw(ctx, "send omci request error", log.Fields{"device-id": oo.deviceID, "ChildId": oo.deviceID, "error": sendErr}) |
Holger Hildebrandt | 3455551 | 2021-10-01 16:26:59 +0000 | [diff] [blame] | 710 | return sendErr |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 711 | } |
Holger Hildebrandt | 66af5ce | 2022-09-07 13:38:02 +0000 | [diff] [blame] | 712 | if omciTxRequest.txFrame[cOmciDeviceIdentifierPos] == byte(omci.BaselineIdent) { |
| 713 | oo.incrementBaseTxArFrames() |
| 714 | } else { |
| 715 | oo.incrementExtTxArFrames() |
| 716 | } |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 717 | return nil |
| 718 | } |
| 719 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 720 | // GetNextTid - TODO: add comment |
| 721 | func (oo *OmciCC) GetNextTid(highPriority bool) uint16 { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 722 | var next uint16 |
| 723 | if highPriority { |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 724 | oo.mutexHpTid.Lock() |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 725 | next = oo.hpTid |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 726 | oo.hpTid++ |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 727 | if oo.hpTid < 0x8000 { |
| 728 | oo.hpTid = 0x8000 |
| 729 | } |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 730 | oo.mutexHpTid.Unlock() |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 731 | } else { |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 732 | oo.mutexTid.Lock() |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 733 | next = oo.tid |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 734 | oo.tid++ |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 735 | if oo.tid >= 0x8000 { |
| 736 | oo.tid = 1 |
| 737 | } |
mpagenko | 900ee4b | 2020-10-12 11:56:34 +0000 | [diff] [blame] | 738 | oo.mutexTid.Unlock() |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 739 | } |
| 740 | return next |
| 741 | } |
| 742 | |
kesavand | 011d516 | 2021-11-25 19:21:06 +0530 | [diff] [blame] | 743 | //GetOnuSwSecNextTid get the next low prio tid for the onu sw sections |
| 744 | //onu sw sections uses only low priority tids |
| 745 | //The mutexTid lock should be taken prior to using this function |
| 746 | func (oo *OmciCC) GetOnuSwSecNextTid() uint16 { |
| 747 | next := oo.tid |
| 748 | oo.tid++ |
| 749 | if oo.tid >= 0x8000 { |
| 750 | oo.tid = 1 |
| 751 | } |
| 752 | return next |
| 753 | } |
| 754 | |
| 755 | //GetOnuSwSecLastTid gets the last allocated tid |
| 756 | //The mutexTid lock should be taken prior to using this function |
| 757 | func (oo *OmciCC) GetOnuSwSecLastTid() uint16 { |
| 758 | next := oo.tid |
| 759 | lastAllocatedTid := next - 1 |
| 760 | return lastAllocatedTid |
| 761 | } |
| 762 | |
| 763 | //LockMutexTID locks mutexTid |
| 764 | func (oo *OmciCC) LockMutexTID() { |
| 765 | oo.mutexTid.Lock() |
| 766 | } |
| 767 | |
| 768 | //UnLockMutexTID unlocks mutexTid |
| 769 | func (oo *OmciCC) UnLockMutexTID() { |
| 770 | oo.mutexTid.Unlock() |
| 771 | } |
| 772 | |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 773 | // ################################################################################### |
| 774 | // # utility methods provided to work on OMCI messages |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 775 | |
| 776 | // Serialize - TODO: add comment |
| 777 | 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] | 778 | omciLayer := &omci.OMCI{ |
| 779 | TransactionID: tid, |
| 780 | MessageType: msgType, |
| 781 | } |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 782 | return SerializeOmciLayer(ctx, omciLayer, request) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 783 | } |
| 784 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 785 | // SerializeOmciLayer - TODO: add comment |
| 786 | 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] | 787 | var options gopacket.SerializeOptions |
| 788 | options.FixLengths = true |
| 789 | |
| 790 | buffer := gopacket.NewSerializeBuffer() |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 791 | err := gopacket.SerializeLayers(buffer, options, aOmciLayer, aRequest) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 792 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 793 | 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] | 794 | return nil, err |
| 795 | } |
| 796 | return buffer.Bytes(), nil |
| 797 | } |
| 798 | |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 799 | /* |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 800 | func hexEncode(omciPkt []byte) ([]byte, error) { |
| 801 | dst := make([]byte, hex.EncodedLen(len(omciPkt))) |
| 802 | hex.Encode(dst, omciPkt) |
| 803 | return dst, nil |
| 804 | } |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 805 | */ |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 806 | |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 807 | //supply a response handler for omci response messages to be transferred to the requested FSM |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 808 | 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] | 809 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 810 | 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] | 811 | "transCorrId": strconv.FormatInt(int64(omciMsg.TransactionID), 16), "device-id": oo.deviceID}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 812 | |
| 813 | if oo.pOnuDeviceEntry == nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 814 | logger.Errorw(ctx, "Abort receiving OMCI response, DeviceEntryPointer is nil", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 815 | "device-id": oo.deviceID}) |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 816 | return fmt.Errorf("deviceEntryPointer is nil %s", oo.deviceID) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 817 | } |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 818 | oo.mutexMonReq.RLock() |
| 819 | if _, exist := oo.monitoredRequests[omciMsg.TransactionID]; exist { |
mpagenko | 8cd1bf7 | 2021-06-22 10:11:19 +0000 | [diff] [blame] | 820 | //implement non-blocking channel send to avoid blocking on mutexMonReq later |
| 821 | select { |
| 822 | case oo.monitoredRequests[omciMsg.TransactionID].chSuccess <- true: |
| 823 | default: |
| 824 | logger.Debugw(ctx, "response not send on omciRespChannel (no receiver)", log.Fields{ |
| 825 | "transCorrId": strconv.FormatInt(int64(omciMsg.TransactionID), 16), "device-id": oo.deviceID}) |
| 826 | } |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 827 | } else { |
| 828 | logger.Infow(ctx, "reqMon: map entry does not exist!", |
| 829 | log.Fields{"tid": omciMsg.TransactionID, "device-id": oo.deviceID}) |
| 830 | } |
| 831 | oo.mutexMonReq.RUnlock() |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 832 | |
| 833 | // no further test on SeqNo is done here, assignment from rxScheduler is trusted |
| 834 | // 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] | 835 | omciRespMsg := Message{ |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 836 | Type: OMCI, |
| 837 | Data: OmciMessage{ |
| 838 | OmciMsg: omciMsg, |
| 839 | OmciPacket: packet, |
| 840 | }, |
| 841 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 842 | //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] | 843 | respChan <- omciRespMsg |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 844 | |
| 845 | return nil |
| 846 | } |
| 847 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 848 | // SendMibReset sends MibResetRequest |
| 849 | func (oo *OmciCC) SendMibReset(ctx context.Context, timeout int, highPrio bool) error { |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 850 | |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 851 | 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] | 852 | request := &omci.MibResetRequest{ |
| 853 | MeBasePacket: omci.MeBasePacket{ |
| 854 | EntityClass: me.OnuDataClassID, |
| 855 | }, |
| 856 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 857 | tid := oo.GetNextTid(highPrio) |
| 858 | pkt, err := Serialize(ctx, omci.MibResetRequestType, request, tid) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 859 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 860 | logger.Errorw(ctx, "Cannot serialize MibResetRequest", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 861 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 862 | return err |
| 863 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 864 | omciRxCallbackPair := CallbackPair{ |
| 865 | CbKey: tid, |
| 866 | CbEntry: CallbackPairEntry{oo.pOnuDeviceEntry.GetMibUploadFsmCommChan(), oo.receiveOmciResponse, true}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 867 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 868 | return oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 869 | } |
| 870 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 871 | // SendReboot sends RebootRequest |
| 872 | func (oo *OmciCC) SendReboot(ctx context.Context, timeout int, highPrio bool, responseChannel chan Message) error { |
| 873 | logger.Debugw(ctx, "send reboot-msg to:", log.Fields{"device-id": oo.deviceID}) |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 874 | request := &omci.RebootRequest{ |
| 875 | MeBasePacket: omci.MeBasePacket{ |
| 876 | EntityClass: me.OnuGClassID, |
| 877 | }, |
| 878 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 879 | tid := oo.GetNextTid(highPrio) |
| 880 | pkt, err := Serialize(ctx, omci.RebootRequestType, request, tid) |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 881 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 882 | logger.Errorw(ctx, "Cannot serialize RebootRequest", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 883 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 884 | return err |
| 885 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 886 | omciRxCallbackPair := CallbackPair{ |
| 887 | CbKey: tid, |
| 888 | CbEntry: CallbackPairEntry{oo.pOnuDeviceEntry.GetOmciRebootMsgRevChan(), oo.receiveOmciResponse, true}, |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 889 | } |
| 890 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 891 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 892 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 893 | logger.Errorw(ctx, "Cannot send RebootRequest", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 894 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 895 | return err |
| 896 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 897 | err = oo.pOnuDeviceEntry.WaitForRebootResponse(ctx, responseChannel) |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 898 | if err != nil { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 899 | logger.Errorw(ctx, "aborting ONU reboot!", log.Fields{ |
Andrea Campanella | 6515c58 | 2020-10-05 11:25:00 +0200 | [diff] [blame] | 900 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | e11479f | 2020-07-06 09:44:47 +0300 | [diff] [blame] | 901 | return err |
| 902 | } |
| 903 | return nil |
| 904 | } |
| 905 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 906 | // SendMibUpload sends MibUploadRequest |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 907 | func (oo *OmciCC) SendMibUpload(ctx context.Context, timeout int, highPrio bool, isExtOmciSupported bool) error { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 908 | logger.Debugw(ctx, "send MibUpload-msg to:", log.Fields{"device-id": oo.deviceID}) |
Holger Hildebrandt | 0edf5b0 | 2022-05-04 14:19:43 +0000 | [diff] [blame] | 909 | |
| 910 | tid := oo.GetNextTid(highPrio) |
Holger Hildebrandt | 0edf5b0 | 2022-05-04 14:19:43 +0000 | [diff] [blame] | 911 | |
| 912 | omciLayer := &omci.OMCI{ |
| 913 | TransactionID: tid, |
| 914 | MessageType: omci.MibUploadRequestType, |
| 915 | } |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 916 | if isExtOmciSupported { |
Holger Hildebrandt | 0edf5b0 | 2022-05-04 14:19:43 +0000 | [diff] [blame] | 917 | omciLayer.DeviceIdentifier = omci.ExtendedIdent |
| 918 | } |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 919 | request := &omci.MibUploadRequest{ |
| 920 | MeBasePacket: omci.MeBasePacket{ |
| 921 | EntityClass: me.OnuDataClassID, |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 922 | Extended: isExtOmciSupported, |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 923 | }, |
| 924 | } |
Holger Hildebrandt | 0edf5b0 | 2022-05-04 14:19:43 +0000 | [diff] [blame] | 925 | var options gopacket.SerializeOptions |
| 926 | options.FixLengths = true |
| 927 | |
| 928 | buffer := gopacket.NewSerializeBuffer() |
| 929 | err := gopacket.SerializeLayers(buffer, options, omciLayer, request) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 930 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 931 | logger.Errorw(ctx, "Cannot serialize MibUploadRequest", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 932 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 933 | return err |
| 934 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 935 | oo.UploadSequNo = 0 |
| 936 | oo.UploadNoOfCmds = 0 |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 937 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 938 | omciRxCallbackPair := CallbackPair{ |
| 939 | CbKey: tid, |
| 940 | CbEntry: CallbackPairEntry{oo.pOnuDeviceEntry.GetMibUploadFsmCommChan(), oo.receiveOmciResponse, true}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 941 | } |
Holger Hildebrandt | 0edf5b0 | 2022-05-04 14:19:43 +0000 | [diff] [blame] | 942 | return oo.Send(ctx, buffer.Bytes(), timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 943 | } |
| 944 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 945 | // SendMibUploadNext sends MibUploadNextRequest |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 946 | func (oo *OmciCC) SendMibUploadNext(ctx context.Context, timeout int, highPrio bool, isExtOmciSupported bool) error { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 947 | logger.Debugw(ctx, "send MibUploadNext-msg to:", log.Fields{"device-id": oo.deviceID, "UploadSequNo": oo.UploadSequNo}) |
Holger Hildebrandt | 0edf5b0 | 2022-05-04 14:19:43 +0000 | [diff] [blame] | 948 | |
| 949 | tid := oo.GetNextTid(highPrio) |
Holger Hildebrandt | 0edf5b0 | 2022-05-04 14:19:43 +0000 | [diff] [blame] | 950 | |
| 951 | omciLayer := &omci.OMCI{ |
| 952 | TransactionID: tid, |
| 953 | MessageType: omci.MibUploadNextRequestType, |
| 954 | } |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 955 | if isExtOmciSupported { |
Holger Hildebrandt | 0edf5b0 | 2022-05-04 14:19:43 +0000 | [diff] [blame] | 956 | omciLayer.DeviceIdentifier = omci.ExtendedIdent |
| 957 | } |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 958 | request := &omci.MibUploadNextRequest{ |
| 959 | MeBasePacket: omci.MeBasePacket{ |
| 960 | EntityClass: me.OnuDataClassID, |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 961 | Extended: isExtOmciSupported, |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 962 | }, |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 963 | CommandSequenceNumber: oo.UploadSequNo, |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 964 | } |
Holger Hildebrandt | 0edf5b0 | 2022-05-04 14:19:43 +0000 | [diff] [blame] | 965 | var options gopacket.SerializeOptions |
| 966 | options.FixLengths = true |
| 967 | |
| 968 | buffer := gopacket.NewSerializeBuffer() |
| 969 | err := gopacket.SerializeLayers(buffer, options, omciLayer, request) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 970 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 971 | logger.Errorw(ctx, "Cannot serialize MibUploadNextRequest", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 972 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 973 | return err |
| 974 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 975 | oo.UploadSequNo++ |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 976 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 977 | omciRxCallbackPair := CallbackPair{ |
| 978 | CbKey: tid, |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 979 | //frame printing for MibUpload frames disabled now per default to avoid log file abort situations (size/speed?) |
| 980 | // if wanted, rx frame printing should be specifically done within the MibUpload FSM or controlled via extra parameter |
| 981 | // compare also software upgrade download section handling |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 982 | CbEntry: CallbackPairEntry{oo.pOnuDeviceEntry.GetMibUploadFsmCommChan(), oo.receiveOmciResponse, true}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 983 | } |
Holger Hildebrandt | 0edf5b0 | 2022-05-04 14:19:43 +0000 | [diff] [blame] | 984 | return oo.Send(ctx, buffer.Bytes(), timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 985 | } |
| 986 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 987 | // SendGetAllAlarm gets all alarm ME instances |
Holger Hildebrandt | 3b29a8a | 2022-07-11 05:55:13 +0000 | [diff] [blame] | 988 | func (oo *OmciCC) SendGetAllAlarm(ctx context.Context, alarmRetreivalMode uint8, timeout int, highPrio bool, isExtendedOmci bool) error { |
Himani Chawla | d3dac42 | 2021-03-13 02:31:31 +0530 | [diff] [blame] | 989 | logger.Debugw(ctx, "send GetAllAlarms-msg to:", log.Fields{"device-id": oo.deviceID}) |
Holger Hildebrandt | 3b29a8a | 2022-07-11 05:55:13 +0000 | [diff] [blame] | 990 | |
| 991 | tid := oo.GetNextTid(highPrio) |
| 992 | omciLayer := &omci.OMCI{ |
| 993 | TransactionID: tid, |
| 994 | MessageType: omci.GetAllAlarmsRequestType, |
| 995 | // DeviceIdentifier: omci.BaselineIdent, // Optional, defaults to Baseline |
| 996 | } |
| 997 | if isExtendedOmci { |
| 998 | omciLayer.DeviceIdentifier = omci.ExtendedIdent |
| 999 | } |
Himani Chawla | d3dac42 | 2021-03-13 02:31:31 +0530 | [diff] [blame] | 1000 | request := &omci.GetAllAlarmsRequest{ |
| 1001 | MeBasePacket: omci.MeBasePacket{ |
| 1002 | EntityClass: me.OnuDataClassID, |
Holger Hildebrandt | 3b29a8a | 2022-07-11 05:55:13 +0000 | [diff] [blame] | 1003 | Extended: isExtendedOmci, |
Himani Chawla | d3dac42 | 2021-03-13 02:31:31 +0530 | [diff] [blame] | 1004 | }, |
| 1005 | AlarmRetrievalMode: byte(alarmRetreivalMode), |
| 1006 | } |
Holger Hildebrandt | 3b29a8a | 2022-07-11 05:55:13 +0000 | [diff] [blame] | 1007 | var options gopacket.SerializeOptions |
| 1008 | options.FixLengths = true |
| 1009 | buffer := gopacket.NewSerializeBuffer() |
| 1010 | err := gopacket.SerializeLayers(buffer, options, omciLayer, request) |
Himani Chawla | d3dac42 | 2021-03-13 02:31:31 +0530 | [diff] [blame] | 1011 | if err != nil { |
Holger Hildebrandt | 3b29a8a | 2022-07-11 05:55:13 +0000 | [diff] [blame] | 1012 | logger.Errorw(ctx, "Cannot serialize GetAllAlarmsRequest", log.Fields{"Err": err, |
| 1013 | "device-id": oo.deviceID}) |
Himani Chawla | d3dac42 | 2021-03-13 02:31:31 +0530 | [diff] [blame] | 1014 | return err |
| 1015 | } |
Holger Hildebrandt | 3b29a8a | 2022-07-11 05:55:13 +0000 | [diff] [blame] | 1016 | outgoingPacket := buffer.Bytes() |
| 1017 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1018 | oo.pOnuAlarmManager.ResetAlarmUploadCounters() |
Himani Chawla | d3dac42 | 2021-03-13 02:31:31 +0530 | [diff] [blame] | 1019 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1020 | omciRxCallbackPair := CallbackPair{ |
| 1021 | CbKey: tid, |
| 1022 | CbEntry: CallbackPairEntry{oo.pOnuAlarmManager.GetAlarmMgrEventChannel(), oo.receiveOmciResponse, true}, |
Himani Chawla | d3dac42 | 2021-03-13 02:31:31 +0530 | [diff] [blame] | 1023 | } |
Holger Hildebrandt | 3b29a8a | 2022-07-11 05:55:13 +0000 | [diff] [blame] | 1024 | err = oo.Send(ctx, outgoingPacket, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 1025 | if err != nil { |
| 1026 | logger.Errorw(ctx, "Cannot send GetAllAlarmsRequest", log.Fields{"Err": err, |
| 1027 | "device-id": oo.deviceID}) |
| 1028 | return err |
| 1029 | } |
| 1030 | logger.Debug(ctx, "send GetAllAlarmsRequest done") |
| 1031 | return nil |
Himani Chawla | d3dac42 | 2021-03-13 02:31:31 +0530 | [diff] [blame] | 1032 | } |
| 1033 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1034 | // SendGetAllAlarmNext gets next alarm ME instance |
Holger Hildebrandt | 3b29a8a | 2022-07-11 05:55:13 +0000 | [diff] [blame] | 1035 | func (oo *OmciCC) SendGetAllAlarmNext(ctx context.Context, timeout int, highPrio bool, isExtendedOmci bool) error { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1036 | alarmUploadSeqNo := oo.pOnuAlarmManager.GetAlarmUploadSeqNo() |
| 1037 | logger.Debugw(ctx, "send SendGetAllAlarmNext-msg to:", log.Fields{"device-id": oo.deviceID, |
Himani Chawla | d3dac42 | 2021-03-13 02:31:31 +0530 | [diff] [blame] | 1038 | "alarmUploadSeqNo": alarmUploadSeqNo}) |
Holger Hildebrandt | 3b29a8a | 2022-07-11 05:55:13 +0000 | [diff] [blame] | 1039 | |
| 1040 | tid := oo.GetNextTid(highPrio) |
| 1041 | omciLayer := &omci.OMCI{ |
| 1042 | TransactionID: tid, |
| 1043 | MessageType: omci.GetAllAlarmsNextRequestType, |
| 1044 | // DeviceIdentifier: omci.BaselineIdent, // Optional, defaults to Baseline |
| 1045 | } |
| 1046 | if isExtendedOmci { |
| 1047 | omciLayer.DeviceIdentifier = omci.ExtendedIdent |
| 1048 | } |
Himani Chawla | d3dac42 | 2021-03-13 02:31:31 +0530 | [diff] [blame] | 1049 | request := &omci.GetAllAlarmsNextRequest{ |
| 1050 | MeBasePacket: omci.MeBasePacket{ |
| 1051 | EntityClass: me.OnuDataClassID, |
Holger Hildebrandt | 3b29a8a | 2022-07-11 05:55:13 +0000 | [diff] [blame] | 1052 | Extended: isExtendedOmci, |
Himani Chawla | d3dac42 | 2021-03-13 02:31:31 +0530 | [diff] [blame] | 1053 | }, |
| 1054 | CommandSequenceNumber: alarmUploadSeqNo, |
| 1055 | } |
Holger Hildebrandt | 3b29a8a | 2022-07-11 05:55:13 +0000 | [diff] [blame] | 1056 | var options gopacket.SerializeOptions |
| 1057 | options.FixLengths = true |
| 1058 | buffer := gopacket.NewSerializeBuffer() |
| 1059 | err := gopacket.SerializeLayers(buffer, options, omciLayer, request) |
Himani Chawla | d3dac42 | 2021-03-13 02:31:31 +0530 | [diff] [blame] | 1060 | if err != nil { |
Holger Hildebrandt | 3b29a8a | 2022-07-11 05:55:13 +0000 | [diff] [blame] | 1061 | logger.Errorw(ctx, "Cannot serialize GetAllAlarmsNextRequest", log.Fields{"Err": err, |
| 1062 | "device-id": oo.deviceID}) |
Himani Chawla | d3dac42 | 2021-03-13 02:31:31 +0530 | [diff] [blame] | 1063 | return err |
| 1064 | } |
Holger Hildebrandt | 3b29a8a | 2022-07-11 05:55:13 +0000 | [diff] [blame] | 1065 | outgoingPacket := buffer.Bytes() |
| 1066 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1067 | oo.pOnuAlarmManager.IncrementAlarmUploadSeqNo() |
Himani Chawla | d3dac42 | 2021-03-13 02:31:31 +0530 | [diff] [blame] | 1068 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1069 | omciRxCallbackPair := CallbackPair{ |
| 1070 | CbKey: tid, |
| 1071 | CbEntry: CallbackPairEntry{oo.pOnuAlarmManager.GetAlarmMgrEventChannel(), oo.receiveOmciResponse, true}, |
Himani Chawla | d3dac42 | 2021-03-13 02:31:31 +0530 | [diff] [blame] | 1072 | } |
Holger Hildebrandt | 3b29a8a | 2022-07-11 05:55:13 +0000 | [diff] [blame] | 1073 | err = oo.Send(ctx, outgoingPacket, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 1074 | if err != nil { |
| 1075 | logger.Errorw(ctx, "Cannot send GetAllAlarmsNextRequest", log.Fields{"Err": err, |
| 1076 | "device-id": oo.deviceID}) |
| 1077 | return err |
| 1078 | } |
| 1079 | logger.Debug(ctx, "send GetAllAlarmsNextRequest done") |
| 1080 | return nil |
Himani Chawla | d3dac42 | 2021-03-13 02:31:31 +0530 | [diff] [blame] | 1081 | } |
| 1082 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1083 | // SendCreateGalEthernetProfile creates GalEthernetProfile ME instance |
| 1084 | func (oo *OmciCC) SendCreateGalEthernetProfile(ctx context.Context, timeout int, highPrio bool) (*me.ManagedEntity, error) { |
| 1085 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1086 | logger.Debugw(ctx, "send GalEnetProfile-Create-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1087 | "SequNo": strconv.FormatInt(int64(tid), 16)}) |
Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 1088 | |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1089 | meParams := me.ParamData{ |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1090 | EntityID: GalEthernetEID, |
Holger Hildebrandt | 3ac49bd | 2022-02-07 17:46:43 +0000 | [diff] [blame] | 1091 | Attributes: me.AttributeValueMap{me.GalEthernetProfile_MaximumGemPayloadSize: maxGemPayloadSize}, |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1092 | } |
| 1093 | meInstance, omciErr := me.NewGalEthernetProfile(meParams) |
| 1094 | if omciErr.GetError() == nil { |
| 1095 | //all setByCreate parameters already set, no default option required ... |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1096 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid)) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1097 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1098 | logger.Errorw(ctx, "Cannot encode GalEnetProfileInstance for create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1099 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1100 | return nil, err |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1101 | } |
| 1102 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1103 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1104 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1105 | logger.Errorw(ctx, "Cannot serialize GalEnetProfile create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1106 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1107 | return nil, err |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1108 | } |
| 1109 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1110 | omciRxCallbackPair := CallbackPair{ |
| 1111 | CbKey: tid, |
| 1112 | CbEntry: CallbackPairEntry{oo.pOnuDeviceEntry.GetMibDownloadFsmCommChan(), oo.receiveOmciResponse, true}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1113 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1114 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1115 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1116 | logger.Errorw(ctx, "Cannot send GalEnetProfile create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1117 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1118 | return nil, err |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1119 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1120 | logger.Debug(ctx, "send GalEnetProfile-Create-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1121 | return meInstance, nil |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1122 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1123 | logger.Errorw(ctx, "Cannot generate GalEnetProfileInstance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1124 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1125 | return nil, omciErr.GetError() |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1126 | } |
| 1127 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1128 | // SendSetOnu2g sets Onu2G ME instance |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1129 | // might be needed to extend for parameter arguments, here just for setting the ConnectivityMode!! |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1130 | func (oo *OmciCC) SendSetOnu2g(ctx context.Context, timeout int, highPrio bool) (*me.ManagedEntity, error) { |
| 1131 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1132 | 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] | 1133 | "SequNo": strconv.FormatInt(int64(tid), 16)}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1134 | |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1135 | // ONU-G ME-ID is defined to be 0, but we could verify, if the ONU really supports the desired |
| 1136 | // connectivity mode 5 (in ConnCap) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1137 | // By now we just use fix values to fire - this is anyway what the python adapter does |
| 1138 | // read ONU-2G from DB ???? //TODO!!! |
| 1139 | meParams := me.ParamData{ |
| 1140 | EntityID: 0, |
Holger Hildebrandt | 3ac49bd | 2022-02-07 17:46:43 +0000 | [diff] [blame] | 1141 | Attributes: me.AttributeValueMap{me.Onu2G_CurrentConnectivityMode: connectivityModeValue}, |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1142 | } |
| 1143 | meInstance, omciErr := me.NewOnu2G(meParams) |
| 1144 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1145 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid)) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1146 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1147 | logger.Errorw(ctx, "Cannot encode ONU2-G instance for set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1148 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1149 | return nil, err |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1150 | } |
| 1151 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1152 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1153 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1154 | logger.Errorw(ctx, "Cannot serialize ONU2-G set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1155 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1156 | return nil, err |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1157 | } |
| 1158 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1159 | omciRxCallbackPair := CallbackPair{ |
| 1160 | CbKey: tid, |
| 1161 | CbEntry: CallbackPairEntry{oo.pOnuDeviceEntry.GetMibDownloadFsmCommChan(), oo.receiveOmciResponse, true}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1162 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1163 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1164 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1165 | logger.Errorw(ctx, "Cannot send ONU2-G set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1166 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1167 | return nil, err |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1168 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1169 | logger.Debug(ctx, "send ONU2-G-Set-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1170 | return meInstance, nil |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1171 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1172 | logger.Errorw(ctx, "Cannot generate ONU2-G", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1173 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1174 | return nil, omciErr.GetError() |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1175 | } |
| 1176 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1177 | // SendCreateMBServiceProfile creates MacBridgeServiceProfile ME instance |
| 1178 | func (oo *OmciCC) SendCreateMBServiceProfile(ctx context.Context, |
| 1179 | aPUniPort *OnuUniPort, timeout int, highPrio bool) (*me.ManagedEntity, error) { |
| 1180 | tid := oo.GetNextTid(highPrio) |
| 1181 | instID := MacBridgeServiceProfileEID + uint16(aPUniPort.MacBpNo) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1182 | logger.Debugw(ctx, "send MBSP-Create-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1183 | "SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(instID), 16)}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1184 | |
| 1185 | meParams := me.ParamData{ |
| 1186 | EntityID: instID, |
| 1187 | Attributes: me.AttributeValueMap{ |
Holger Hildebrandt | 3ac49bd | 2022-02-07 17:46:43 +0000 | [diff] [blame] | 1188 | me.MacBridgeServiceProfile_Priority: 0x8000, |
| 1189 | me.MacBridgeServiceProfile_MaxAge: 20 * 256, //20s |
| 1190 | me.MacBridgeServiceProfile_HelloTime: 2 * 256, //2s |
| 1191 | me.MacBridgeServiceProfile_ForwardDelay: 15 * 256, //15s |
| 1192 | me.MacBridgeServiceProfile_DynamicFilteringAgeingTime: 0, |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1193 | }, |
| 1194 | } |
| 1195 | |
| 1196 | meInstance, omciErr := me.NewMacBridgeServiceProfile(meParams) |
| 1197 | if omciErr.GetError() == nil { |
| 1198 | //obviously we have to set all 'untouched' parameters to default by some additional option parameter!! |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1199 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, |
| 1200 | oframe.TransactionID(tid), oframe.AddDefaults(true)) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1201 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1202 | logger.Errorw(ctx, "Cannot encode MBSP for create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1203 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1204 | return nil, err |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1205 | } |
| 1206 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1207 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1208 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1209 | logger.Errorw(ctx, "Cannot serialize MBSP create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1210 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1211 | return nil, err |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1212 | } |
| 1213 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1214 | omciRxCallbackPair := CallbackPair{ |
| 1215 | CbKey: tid, |
| 1216 | CbEntry: CallbackPairEntry{oo.pOnuDeviceEntry.GetMibDownloadFsmCommChan(), oo.receiveOmciResponse, true}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1217 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1218 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1219 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1220 | logger.Errorw(ctx, "Cannot send MBSP create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1221 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1222 | return nil, err |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1223 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1224 | logger.Debug(ctx, "send MBSP-Create-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1225 | return meInstance, nil |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1226 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1227 | logger.Errorw(ctx, "Cannot generate MBSP Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1228 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1229 | return nil, omciErr.GetError() |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1230 | } |
| 1231 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1232 | // SendCreateMBPConfigDataUniSide creates MacBridgePortConfigurationData ME instance |
| 1233 | func (oo *OmciCC) SendCreateMBPConfigDataUniSide(ctx context.Context, |
| 1234 | aPUniPort *OnuUniPort, timeout int, highPrio bool) (*me.ManagedEntity, error) { |
| 1235 | tid := oo.GetNextTid(highPrio) |
| 1236 | instID, idErr := GenerateUNISideMBPCDEID(uint16(aPUniPort.MacBpNo)) |
Mahir Gunyel | 6781f96 | 2021-05-16 23:30:08 -0700 | [diff] [blame] | 1237 | if idErr != nil { |
| 1238 | logger.Errorw(ctx, "Cannot generate MBPCD entity id", log.Fields{ |
| 1239 | "Err": idErr, "device-id": oo.deviceID}) |
| 1240 | return nil, idErr |
| 1241 | } |
| 1242 | logger.Debugw(ctx, "send MBPCD-Create-msg for uni side:", log.Fields{"device-id": oo.deviceID, |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1243 | "SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(instID), 16), "macBpNo": aPUniPort.MacBpNo}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1244 | |
| 1245 | meParams := me.ParamData{ |
| 1246 | EntityID: instID, |
| 1247 | Attributes: me.AttributeValueMap{ |
Holger Hildebrandt | 3ac49bd | 2022-02-07 17:46:43 +0000 | [diff] [blame] | 1248 | me.MacBridgePortConfigurationData_BridgeIdPointer: MacBridgeServiceProfileEID + uint16(aPUniPort.MacBpNo), |
| 1249 | me.MacBridgePortConfigurationData_PortNum: aPUniPort.MacBpNo, |
| 1250 | me.MacBridgePortConfigurationData_TpType: uint8(aPUniPort.PortType), |
| 1251 | me.MacBridgePortConfigurationData_TpPointer: aPUniPort.EntityID, |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1252 | }, |
| 1253 | } |
| 1254 | meInstance, omciErr := me.NewMacBridgePortConfigurationData(meParams) |
| 1255 | if omciErr.GetError() == nil { |
| 1256 | //obviously we have to set all 'untouched' parameters to default by some additional option parameter!! |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1257 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, |
| 1258 | oframe.TransactionID(tid), oframe.AddDefaults(true)) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1259 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1260 | logger.Errorw(ctx, "Cannot encode MBPCD for create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1261 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1262 | return nil, err |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1263 | } |
| 1264 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1265 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1266 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1267 | logger.Errorw(ctx, "Cannot serialize MBPCD create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1268 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1269 | return nil, err |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1270 | } |
| 1271 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1272 | omciRxCallbackPair := CallbackPair{ |
| 1273 | CbKey: tid, |
| 1274 | CbEntry: CallbackPairEntry{oo.pOnuDeviceEntry.GetMibDownloadFsmCommChan(), oo.receiveOmciResponse, true}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1275 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1276 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1277 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1278 | logger.Errorw(ctx, "Cannot send MBPCD create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1279 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1280 | return nil, err |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1281 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1282 | logger.Debug(ctx, "send MBPCD-Create-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1283 | return meInstance, nil |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1284 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1285 | logger.Errorw(ctx, "Cannot generate MBPCD Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1286 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1287 | return nil, omciErr.GetError() |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1288 | } |
| 1289 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1290 | // SendCreateEVTOConfigData creates ExtendedVlanTaggingOperationConfigurationData ME instance |
| 1291 | func (oo *OmciCC) SendCreateEVTOConfigData(ctx context.Context, |
| 1292 | aPUniPort *OnuUniPort, timeout int, highPrio bool) (*me.ManagedEntity, error) { |
| 1293 | tid := oo.GetNextTid(highPrio) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1294 | //same entityId is used as for MBSP (see there), but just arbitrary ... |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1295 | instID := MacBridgeServiceProfileEID + uint16(aPUniPort.MacBpNo) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1296 | logger.Debugw(ctx, "send EVTOCD-Create-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1297 | "SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(instID), 16)}) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1298 | |
| 1299 | // compare python adapter code WA VOL-1311: this is not done here! |
| 1300 | // (setting TPID values for the create would probably anyway be ignored by the omci lib) |
| 1301 | // but perhaps we have to be aware of possible problems at get(Next) Request handling for EVTOOCD tables later ... |
| 1302 | assType := uint8(2) // default AssociationType is PPTPEthUni |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1303 | if aPUniPort.PortType == UniVEIP { |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1304 | assType = uint8(10) // for VEIP |
| 1305 | } |
| 1306 | meParams := me.ParamData{ |
| 1307 | EntityID: instID, |
| 1308 | Attributes: me.AttributeValueMap{ |
Holger Hildebrandt | 3ac49bd | 2022-02-07 17:46:43 +0000 | [diff] [blame] | 1309 | me.ExtendedVlanTaggingOperationConfigurationData_AssociationType: assType, |
| 1310 | me.ExtendedVlanTaggingOperationConfigurationData_AssociatedMePointer: aPUniPort.EntityID, |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1311 | //EnhancedMode not yet supported, used with default options |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1312 | }, |
| 1313 | } |
| 1314 | meInstance, omciErr := me.NewExtendedVlanTaggingOperationConfigurationData(meParams) |
| 1315 | if omciErr.GetError() == nil { |
| 1316 | //all setByCreate parameters already set, no default option required ... |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1317 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, |
| 1318 | oframe.TransactionID(tid), oframe.AddDefaults(true)) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1319 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1320 | logger.Errorw(ctx, "Cannot encode EVTOCD for create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1321 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1322 | return nil, err |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1323 | } |
| 1324 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1325 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1326 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1327 | logger.Errorw(ctx, "Cannot serialize EVTOCD create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1328 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1329 | return nil, err |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1330 | } |
| 1331 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1332 | omciRxCallbackPair := CallbackPair{ |
| 1333 | CbKey: tid, |
| 1334 | CbEntry: CallbackPairEntry{oo.pOnuDeviceEntry.GetMibDownloadFsmCommChan(), oo.receiveOmciResponse, true}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1335 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1336 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1337 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1338 | logger.Errorw(ctx, "Cannot send EVTOCD create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1339 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1340 | return nil, err |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1341 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1342 | logger.Debug(ctx, "send EVTOCD-Create-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1343 | return meInstance, nil |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1344 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1345 | logger.Errorw(ctx, "Cannot generate EVTOCD Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1346 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1347 | return nil, omciErr.GetError() |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1348 | } |
| 1349 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1350 | // SendSetOnuGLS sets OnuG ME instance |
| 1351 | func (oo *OmciCC) SendSetOnuGLS(ctx context.Context, timeout int, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1352 | highPrio bool, requestedAttributes me.AttributeValueMap, rxChan chan Message) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1353 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1354 | 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] | 1355 | "SequNo": strconv.FormatInt(int64(tid), 16)}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1356 | |
| 1357 | // ONU-G ME-ID is defined to be 0, no need to perform a DB lookup |
| 1358 | meParams := me.ParamData{ |
| 1359 | EntityID: 0, |
| 1360 | Attributes: requestedAttributes, |
| 1361 | } |
| 1362 | meInstance, omciErr := me.NewOnuG(meParams) |
| 1363 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1364 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid)) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1365 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1366 | logger.Errorw(ctx, "Cannot encode ONU-G instance for set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1367 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1368 | return nil, err |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1369 | } |
| 1370 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1371 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1372 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1373 | logger.Errorw(ctx, "Cannot serialize ONU-G set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1374 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1375 | return nil, err |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1376 | } |
| 1377 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1378 | omciRxCallbackPair := CallbackPair{ |
| 1379 | CbKey: tid, |
| 1380 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1381 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1382 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1383 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1384 | logger.Errorw(ctx, "Cannot send ONU-G set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1385 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1386 | return nil, err |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1387 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1388 | logger.Debug(ctx, "send ONU-G-Set-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1389 | return meInstance, nil |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1390 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1391 | logger.Errorw(ctx, "Cannot generate ONU-G", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1392 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1393 | return nil, omciErr.GetError() |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1394 | } |
| 1395 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1396 | // SendSetPptpEthUniLS sets PhysicalPathTerminationPointEthernetUni ME instance |
| 1397 | func (oo *OmciCC) SendSetPptpEthUniLS(ctx context.Context, aInstNo uint16, timeout int, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1398 | highPrio bool, requestedAttributes me.AttributeValueMap, rxChan chan Message) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1399 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1400 | 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] | 1401 | "SequNo": strconv.FormatInt(int64(tid), 16)}) |
| 1402 | |
| 1403 | // PPTPEthUni ME-ID is taken from Mib Upload stored OnuUniPort instance (argument) |
| 1404 | meParams := me.ParamData{ |
| 1405 | EntityID: aInstNo, |
| 1406 | Attributes: requestedAttributes, |
| 1407 | } |
| 1408 | meInstance, omciErr := me.NewPhysicalPathTerminationPointEthernetUni(meParams) |
| 1409 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1410 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid)) |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1411 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1412 | logger.Errorw(ctx, "Cannot encode PPTPEthUni instance for set", log.Fields{ |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1413 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1414 | return nil, err |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1415 | } |
| 1416 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1417 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1418 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1419 | logger.Errorw(ctx, "Cannot serialize PPTPEthUni-Set", log.Fields{ |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1420 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1421 | return nil, err |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1422 | } |
| 1423 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1424 | omciRxCallbackPair := CallbackPair{ |
| 1425 | CbKey: tid, |
| 1426 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1427 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1428 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1429 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1430 | logger.Errorw(ctx, "Cannot send PPTPEthUni-Set", log.Fields{ |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1431 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1432 | return nil, err |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1433 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1434 | logger.Debug(ctx, "send PPTPEthUni-Set-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1435 | return meInstance, nil |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1436 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1437 | logger.Errorw(ctx, "Cannot generate PPTPEthUni", log.Fields{ |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1438 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1439 | return nil, omciErr.GetError() |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1440 | } |
| 1441 | |
| 1442 | /* UniG obsolete by now, left here in case it should be needed once again |
| 1443 | UniG AdminState anyway should be ignored by ONU acc. to G988 |
Himani Chawla | 6d2ae15 | 2020-09-02 13:11:20 +0530 | [diff] [blame] | 1444 | func (oo *omciCC) sendSetUniGLS(ctx context.Context, aInstNo uint16, timeout int, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1445 | highPrio bool, requestedAttributes me.AttributeValueMap, rxChan chan Message) *me.ManagedEntity { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1446 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1447 | 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] | 1448 | "SequNo": strconv.FormatInt(int64(tid), 16)}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1449 | |
| 1450 | // UNI-G ME-ID is taken from Mib Upload stored OnuUniPort instance (argument) |
| 1451 | meParams := me.ParamData{ |
| 1452 | EntityID: aInstNo, |
| 1453 | Attributes: requestedAttributes, |
| 1454 | } |
| 1455 | meInstance, omciErr := me.NewUniG(meParams) |
| 1456 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1457 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid)) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1458 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1459 | logger.Errorw(ctx,"Cannot encode UNI-G instance for set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1460 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1461 | return nil |
| 1462 | } |
| 1463 | |
| 1464 | pkt, err := serializeOmciLayer(omciLayer, msgLayer) |
| 1465 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1466 | logger.Errorw(ctx,"Cannot serialize UNI-G-Set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1467 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1468 | return nil |
| 1469 | } |
| 1470 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1471 | omciRxCallbackPair := CallbackPair{ |
| 1472 | CbKey: tid, |
| 1473 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1474 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1475 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1476 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1477 | logger.Errorw(ctx,"Cannot send UNIG-G-Set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1478 | "Err": err, "device-id": oo.deviceID}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1479 | return nil |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1480 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1481 | logger.Debug(ctx,"send UNI-G-Set-msg done") |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1482 | return meInstance |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1483 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1484 | logger.Errorw(ctx,"Cannot generate UNI-G", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1485 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1486 | return nil |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1487 | } |
Holger Hildebrandt | 2fb7089 | 2020-10-28 11:53:18 +0000 | [diff] [blame] | 1488 | */ |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1489 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1490 | // SendSetVeipLS sets VirtualEthernetInterfacePoint ME instance |
| 1491 | func (oo *OmciCC) SendSetVeipLS(ctx context.Context, aInstNo uint16, timeout int, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1492 | highPrio bool, requestedAttributes me.AttributeValueMap, rxChan chan Message) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1493 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1494 | logger.Debugw(ctx, "send VEIP-Set-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1495 | "SequNo": strconv.FormatInt(int64(tid), 16)}) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1496 | |
| 1497 | // ONU-G ME-ID is defined to be 0, no need to perform a DB lookup |
| 1498 | meParams := me.ParamData{ |
| 1499 | EntityID: aInstNo, |
| 1500 | Attributes: requestedAttributes, |
| 1501 | } |
| 1502 | meInstance, omciErr := me.NewVirtualEthernetInterfacePoint(meParams) |
| 1503 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1504 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid)) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1505 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1506 | logger.Errorw(ctx, "Cannot encode VEIP instance for set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1507 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1508 | return nil, err |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1509 | } |
| 1510 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1511 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1512 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1513 | logger.Errorw(ctx, "Cannot serialize VEIP-Set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1514 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1515 | return nil, err |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1516 | } |
| 1517 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1518 | omciRxCallbackPair := CallbackPair{ |
| 1519 | CbKey: tid, |
| 1520 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1521 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1522 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1523 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1524 | logger.Errorw(ctx, "Cannot send VEIP-Set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1525 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1526 | return nil, err |
Holger Hildebrandt | ccd390c | 2020-05-29 13:49:04 +0000 | [diff] [blame] | 1527 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1528 | logger.Debug(ctx, "send VEIP-Set-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1529 | return meInstance, nil |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1530 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1531 | logger.Errorw(ctx, "Cannot generate VEIP", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1532 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1533 | return nil, omciErr.GetError() |
Holger Hildebrandt | dd23cc2 | 2020-05-19 13:32:18 +0000 | [diff] [blame] | 1534 | } |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1535 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1536 | // SendGetMe gets ME instance |
| 1537 | func (oo *OmciCC) SendGetMe(ctx context.Context, classID me.ClassID, entityID uint16, requestedAttributes me.AttributeValueMap, |
Holger Hildebrandt | d930cb2 | 2022-06-17 09:24:50 +0000 | [diff] [blame] | 1538 | timeout int, highPrio bool, rxChan chan Message, isExtendedOmci bool) (*me.ManagedEntity, error) { |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1539 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1540 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1541 | 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] | 1542 | "SequNo": strconv.FormatInt(int64(tid), 16)}) |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1543 | |
| 1544 | meParams := me.ParamData{ |
| 1545 | EntityID: entityID, |
| 1546 | Attributes: requestedAttributes, |
| 1547 | } |
Holger Hildebrandt | d930cb2 | 2022-06-17 09:24:50 +0000 | [diff] [blame] | 1548 | var messageSet omci.DeviceIdent = omci.BaselineIdent |
| 1549 | if isExtendedOmci { |
| 1550 | messageSet = omci.ExtendedIdent |
| 1551 | } |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1552 | meInstance, omciErr := me.LoadManagedEntityDefinition(classID, meParams) |
| 1553 | if omciErr.GetError() == nil { |
Himani Chawla | 4d90833 | 2020-08-31 12:30:20 +0530 | [diff] [blame] | 1554 | meClassIDName := meInstance.GetName() |
Holger Hildebrandt | d930cb2 | 2022-06-17 09:24:50 +0000 | [diff] [blame] | 1555 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.GetRequestType, oframe.TransactionID(tid), oframe.FrameFormat(messageSet)) |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1556 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1557 | logger.Errorf(ctx, "Cannot encode instance for get-request", log.Fields{"meClassIDName": meClassIDName, "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1558 | return nil, err |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1559 | } |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1560 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1561 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1562 | logger.Errorw(ctx, "Cannot serialize get-request", log.Fields{"meClassIDName": meClassIDName, "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1563 | return nil, err |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1564 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1565 | omciRxCallbackPair := CallbackPair{ |
| 1566 | CbKey: tid, |
| 1567 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1568 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1569 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1570 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1571 | logger.Errorw(ctx, "Cannot send get-request-msg", log.Fields{"meClassIDName": meClassIDName, "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1572 | return nil, err |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1573 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1574 | logger.Debugw(ctx, "send get-request-msg done", log.Fields{"meClassIDName": meClassIDName, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1575 | return meInstance, nil |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1576 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1577 | logger.Errorw(ctx, "Cannot generate meDefinition", log.Fields{"classID": classID, "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1578 | return nil, omciErr.GetError() |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1579 | } |
| 1580 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1581 | // SendGetMeWithAttributeMask gets ME instance with attribute mask |
| 1582 | func (oo *OmciCC) SendGetMeWithAttributeMask(ctx context.Context, classID me.ClassID, entityID uint16, requestedAttributesMask uint16, |
Himani Chawla | 43f95ff | 2021-06-03 00:24:12 +0530 | [diff] [blame] | 1583 | timeout int, highPrio bool, rxChan chan Message) error { |
| 1584 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1585 | tid := oo.GetNextTid(highPrio) |
Himani Chawla | 43f95ff | 2021-06-03 00:24:12 +0530 | [diff] [blame] | 1586 | logger.Debugw(ctx, "send get-request-msg", log.Fields{"classID": classID, "device-id": oo.deviceID, |
| 1587 | "SequNo": strconv.FormatInt(int64(tid), 16)}) |
| 1588 | |
| 1589 | request := &omci.GetRequest{ |
| 1590 | MeBasePacket: omci.MeBasePacket{ |
| 1591 | EntityInstance: entityID, |
| 1592 | EntityClass: classID, |
| 1593 | }, |
| 1594 | AttributeMask: requestedAttributesMask, |
| 1595 | } |
| 1596 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1597 | pkt, err := Serialize(ctx, omci.GetRequestType, request, tid) |
Himani Chawla | 43f95ff | 2021-06-03 00:24:12 +0530 | [diff] [blame] | 1598 | if err != nil { |
| 1599 | logger.Errorw(ctx, "Cannot serialize get-request", log.Fields{"meClassIDName": classID, "Err": err, "device-id": oo.deviceID}) |
| 1600 | return err |
| 1601 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1602 | omciRxCallbackPair := CallbackPair{ |
| 1603 | CbKey: tid, |
| 1604 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
Himani Chawla | 43f95ff | 2021-06-03 00:24:12 +0530 | [diff] [blame] | 1605 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1606 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Himani Chawla | 43f95ff | 2021-06-03 00:24:12 +0530 | [diff] [blame] | 1607 | if err != nil { |
| 1608 | logger.Errorw(ctx, "Cannot send get-request-msg", log.Fields{"meClassIDName": classID, "Err": err, "device-id": oo.deviceID}) |
| 1609 | return err |
| 1610 | } |
| 1611 | logger.Debugw(ctx, "send get-request-msg done", log.Fields{"meClassIDName": classID, "device-id": oo.deviceID}) |
| 1612 | return nil |
| 1613 | } |
| 1614 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1615 | // SendCreateDot1PMapper creates Ieee8021PMapperServiceProfile ME instance |
| 1616 | func (oo *OmciCC) SendCreateDot1PMapper(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1617 | aInstID uint16, rxChan chan Message) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1618 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1619 | logger.Debugw(ctx, "send .1pMapper-Create-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1620 | "SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 1621 | |
| 1622 | meParams := me.ParamData{ |
mpagenko | 8b5fdd2 | 2020-12-17 17:58:32 +0000 | [diff] [blame] | 1623 | EntityID: aInstID, |
| 1624 | Attributes: me.AttributeValueMap{ |
| 1625 | //workaround for unsuitable omci-lib default values, cmp VOL-3729 |
Holger Hildebrandt | 3ac49bd | 2022-02-07 17:46:43 +0000 | [diff] [blame] | 1626 | me.Ieee8021PMapperServiceProfile_TpPointer: 0xFFFF, |
| 1627 | me.Ieee8021PMapperServiceProfile_InterworkTpPointerForPBitPriority0: 0xFFFF, |
| 1628 | me.Ieee8021PMapperServiceProfile_InterworkTpPointerForPBitPriority1: 0xFFFF, |
| 1629 | me.Ieee8021PMapperServiceProfile_InterworkTpPointerForPBitPriority2: 0xFFFF, |
| 1630 | me.Ieee8021PMapperServiceProfile_InterworkTpPointerForPBitPriority3: 0xFFFF, |
| 1631 | me.Ieee8021PMapperServiceProfile_InterworkTpPointerForPBitPriority4: 0xFFFF, |
| 1632 | me.Ieee8021PMapperServiceProfile_InterworkTpPointerForPBitPriority5: 0xFFFF, |
| 1633 | me.Ieee8021PMapperServiceProfile_InterworkTpPointerForPBitPriority6: 0xFFFF, |
| 1634 | me.Ieee8021PMapperServiceProfile_InterworkTpPointerForPBitPriority7: 0xFFFF, |
mpagenko | 8b5fdd2 | 2020-12-17 17:58:32 +0000 | [diff] [blame] | 1635 | }, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1636 | } |
| 1637 | meInstance, omciErr := me.NewIeee8021PMapperServiceProfile(meParams) |
| 1638 | if omciErr.GetError() == nil { |
| 1639 | //we have to set all 'untouched' parameters to default by some additional option parameter!! |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1640 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, |
| 1641 | oframe.TransactionID(tid), oframe.AddDefaults(true)) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1642 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1643 | logger.Errorw(ctx, "Cannot encode .1pMapper for create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1644 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1645 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1646 | } |
| 1647 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1648 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1649 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1650 | logger.Errorw(ctx, "Cannot serialize .1pMapper create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1651 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1652 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1653 | } |
| 1654 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1655 | omciRxCallbackPair := CallbackPair{ |
| 1656 | CbKey: tid, |
| 1657 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1658 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1659 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1660 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1661 | logger.Errorw(ctx, "Cannot send .1pMapper create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1662 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1663 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1664 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1665 | logger.Debug(ctx, "send .1pMapper-create-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1666 | return meInstance, nil |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1667 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1668 | logger.Errorw(ctx, "Cannot generate .1pMapper", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1669 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1670 | return nil, omciErr.GetError() |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1671 | } |
| 1672 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1673 | // SendCreateMBPConfigDataVar creates MacBridgePortConfigurationData ME instance |
| 1674 | func (oo *OmciCC) SendCreateMBPConfigDataVar(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1675 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1676 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1677 | logger.Debugw(ctx, "send MBPCD-Create-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1678 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1679 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1680 | |
| 1681 | meInstance, omciErr := me.NewMacBridgePortConfigurationData(params[0]) |
| 1682 | if omciErr.GetError() == nil { |
| 1683 | //obviously we have to set all 'untouched' parameters to default by some additional option parameter!! |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1684 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, |
| 1685 | oframe.TransactionID(tid), oframe.AddDefaults(true)) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1686 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1687 | logger.Errorw(ctx, "Cannot encode MBPCD for create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1688 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1689 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1690 | } |
| 1691 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1692 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1693 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1694 | logger.Errorw(ctx, "Cannot serialize MBPCD create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1695 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1696 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1697 | } |
| 1698 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1699 | omciRxCallbackPair := CallbackPair{ |
| 1700 | CbKey: tid, |
| 1701 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1702 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1703 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1704 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1705 | logger.Errorw(ctx, "Cannot send MBPCD create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1706 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1707 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1708 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1709 | logger.Debug(ctx, "send MBPCD-Create-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1710 | return meInstance, nil |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1711 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1712 | logger.Errorw(ctx, "Cannot generate MBPCD Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1713 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1714 | return nil, omciErr.GetError() |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1715 | } |
| 1716 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1717 | // SendCreateGemNCTPVar creates GemPortNetworkCtp ME instance |
| 1718 | func (oo *OmciCC) SendCreateGemNCTPVar(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1719 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1720 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1721 | logger.Debugw(ctx, "send GemNCTP-Create-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1722 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1723 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1724 | |
| 1725 | meInstance, omciErr := me.NewGemPortNetworkCtp(params[0]) |
| 1726 | if omciErr.GetError() == nil { |
| 1727 | //obviously we have to set all 'untouched' parameters to default by some additional option parameter!! |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1728 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, |
| 1729 | oframe.TransactionID(tid), oframe.AddDefaults(true)) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1730 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1731 | logger.Errorw(ctx, "Cannot encode GemNCTP for create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1732 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1733 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1734 | } |
| 1735 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1736 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1737 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1738 | logger.Errorw(ctx, "Cannot serialize GemNCTP create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1739 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1740 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1741 | } |
| 1742 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1743 | omciRxCallbackPair := CallbackPair{ |
| 1744 | CbKey: tid, |
| 1745 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1746 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1747 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1748 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1749 | logger.Errorw(ctx, "Cannot send GemNCTP create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1750 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1751 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1752 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1753 | logger.Debug(ctx, "send GemNCTP-Create-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1754 | return meInstance, nil |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1755 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1756 | logger.Errorw(ctx, "Cannot generate GemNCTP Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1757 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1758 | return nil, omciErr.GetError() |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1759 | } |
| 1760 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1761 | // SendSetGemNCTPVar sets GemPortNetworkCtp ME instance |
| 1762 | func (oo *OmciCC) SendSetGemNCTPVar(ctx context.Context, timeout int, highPrio bool, rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 1763 | tid := oo.GetNextTid(highPrio) |
ozgecanetsia | 82b91a6 | 2021-05-21 18:54:49 +0300 | [diff] [blame] | 1764 | logger.Debugw(ctx, "send GemNCTP-Set-msg:", log.Fields{"device-id": oo.deviceID, |
| 1765 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1766 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1767 | |
| 1768 | meInstance, omciErr := me.NewGemPortNetworkCtp(params[0]) |
| 1769 | if omciErr.GetError() == nil { |
| 1770 | //obviously we have to set all 'untouched' parameters to default by some additional option parameter!! |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1771 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, |
| 1772 | oframe.TransactionID(tid), oframe.AddDefaults(true)) |
ozgecanetsia | 82b91a6 | 2021-05-21 18:54:49 +0300 | [diff] [blame] | 1773 | if err != nil { |
| 1774 | logger.Errorw(ctx, "Cannot encode GemNCTP for set", log.Fields{ |
| 1775 | "Err": err, "device-id": oo.deviceID}) |
| 1776 | return nil, err |
| 1777 | } |
| 1778 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1779 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 82b91a6 | 2021-05-21 18:54:49 +0300 | [diff] [blame] | 1780 | if err != nil { |
| 1781 | logger.Errorw(ctx, "Cannot serialize GemNCTP set", log.Fields{ |
| 1782 | "Err": err, "device-id": oo.deviceID}) |
| 1783 | return nil, err |
| 1784 | } |
| 1785 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1786 | omciRxCallbackPair := CallbackPair{ |
| 1787 | CbKey: tid, |
| 1788 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
ozgecanetsia | 82b91a6 | 2021-05-21 18:54:49 +0300 | [diff] [blame] | 1789 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1790 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
ozgecanetsia | 82b91a6 | 2021-05-21 18:54:49 +0300 | [diff] [blame] | 1791 | if err != nil { |
| 1792 | logger.Errorw(ctx, "Cannot send GemNCTP set", log.Fields{ |
| 1793 | "Err": err, "device-id": oo.deviceID}) |
| 1794 | return nil, err |
| 1795 | } |
| 1796 | logger.Debug(ctx, "send GemNCTP-Set-msg done", log.Fields{"device-id": oo.deviceID}) |
| 1797 | return meInstance, nil |
| 1798 | } |
| 1799 | logger.Errorw(ctx, "Cannot generate GemNCTP Instance", log.Fields{ |
| 1800 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 1801 | return nil, omciErr.GetError() |
| 1802 | } |
| 1803 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1804 | // SendCreateGemIWTPVar creates GemInterworkingTerminationPoint ME instance |
| 1805 | func (oo *OmciCC) SendCreateGemIWTPVar(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1806 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1807 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1808 | logger.Debugw(ctx, "send GemIwTp-Create-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1809 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1810 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1811 | |
| 1812 | meInstance, omciErr := me.NewGemInterworkingTerminationPoint(params[0]) |
| 1813 | if omciErr.GetError() == nil { |
| 1814 | //all SetByCreate Parameters (assumed to be) set here, for optimisation no 'AddDefaults' |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1815 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, |
| 1816 | oframe.TransactionID(tid)) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1817 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1818 | logger.Errorw(ctx, "Cannot encode GemIwTp for create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1819 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1820 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1821 | } |
| 1822 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1823 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1824 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1825 | logger.Errorw(ctx, "Cannot serialize GemIwTp create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1826 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1827 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1828 | } |
| 1829 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1830 | omciRxCallbackPair := CallbackPair{ |
| 1831 | CbKey: tid, |
| 1832 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1833 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1834 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1835 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1836 | logger.Errorw(ctx, "Cannot send GemIwTp create", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1837 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1838 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1839 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1840 | logger.Debug(ctx, "send GemIwTp-Create-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1841 | return meInstance, nil |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1842 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1843 | logger.Errorw(ctx, "Cannot generate GemIwTp Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1844 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1845 | return nil, omciErr.GetError() |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1846 | } |
| 1847 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1848 | // SendSetTcontVar sets TCont ME instance |
| 1849 | func (oo *OmciCC) SendSetTcontVar(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1850 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1851 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1852 | logger.Debugw(ctx, "send TCont-Set-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1853 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1854 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1855 | |
| 1856 | meInstance, omciErr := me.NewTCont(params[0]) |
| 1857 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1858 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid)) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1859 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1860 | logger.Errorw(ctx, "Cannot encode TCont for set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1861 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1862 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1863 | } |
| 1864 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1865 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1866 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1867 | logger.Errorw(ctx, "Cannot serialize TCont set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1868 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1869 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1870 | } |
| 1871 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1872 | omciRxCallbackPair := CallbackPair{ |
| 1873 | CbKey: tid, |
| 1874 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1875 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1876 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1877 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1878 | logger.Errorw(ctx, "Cannot send TCont set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1879 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1880 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1881 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1882 | logger.Debug(ctx, "send TCont-set msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1883 | return meInstance, nil |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1884 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1885 | logger.Errorw(ctx, "Cannot generate TCont Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1886 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1887 | return nil, omciErr.GetError() |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1888 | } |
| 1889 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1890 | // SendSetPrioQueueVar sets PriorityQueue ME instance |
| 1891 | func (oo *OmciCC) SendSetPrioQueueVar(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1892 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1893 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1894 | logger.Debugw(ctx, "send PrioQueue-Set-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1895 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1896 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1897 | |
| 1898 | meInstance, omciErr := me.NewPriorityQueue(params[0]) |
| 1899 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1900 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid)) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1901 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1902 | logger.Errorw(ctx, "Cannot encode PrioQueue for set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1903 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1904 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1905 | } |
| 1906 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1907 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1908 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1909 | logger.Errorw(ctx, "Cannot serialize PrioQueue set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1910 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1911 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1912 | } |
| 1913 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1914 | omciRxCallbackPair := CallbackPair{ |
| 1915 | CbKey: tid, |
| 1916 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1917 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1918 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1919 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1920 | logger.Errorw(ctx, "Cannot send PrioQueue set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1921 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1922 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1923 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1924 | logger.Debug(ctx, "send PrioQueue-set msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1925 | return meInstance, nil |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1926 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1927 | logger.Errorw(ctx, "Cannot generate PrioQueue Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1928 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1929 | return nil, omciErr.GetError() |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1930 | } |
| 1931 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1932 | // SendSetDot1PMapperVar sets Ieee8021PMapperServiceProfile ME instance |
| 1933 | func (oo *OmciCC) SendSetDot1PMapperVar(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1934 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1935 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1936 | logger.Debugw(ctx, "send 1PMapper-Set-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1937 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1938 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1939 | |
| 1940 | meInstance, omciErr := me.NewIeee8021PMapperServiceProfile(params[0]) |
| 1941 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1942 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid)) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1943 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1944 | logger.Errorw(ctx, "Cannot encode 1PMapper for set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1945 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1946 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1947 | } |
| 1948 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1949 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1950 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1951 | logger.Errorw(ctx, "Cannot serialize 1PMapper set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1952 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1953 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1954 | } |
| 1955 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1956 | omciRxCallbackPair := CallbackPair{ |
| 1957 | CbKey: tid, |
| 1958 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1959 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1960 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1961 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1962 | logger.Errorw(ctx, "Cannot send 1PMapper set", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1963 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1964 | return nil, err |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1965 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1966 | logger.Debug(ctx, "send 1PMapper-set msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1967 | return meInstance, nil |
mpagenko | 3dbcdd2 | 2020-07-22 07:38:45 +0000 | [diff] [blame] | 1968 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1969 | logger.Errorw(ctx, "Cannot generate 1PMapper Instance", log.Fields{ |
divyadesai | 4d29955 | 2020-08-18 07:13:49 +0000 | [diff] [blame] | 1970 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1971 | return nil, omciErr.GetError() |
Holger Hildebrandt | c54939a | 2020-06-17 08:14:27 +0000 | [diff] [blame] | 1972 | } |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1973 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1974 | // SendCreateVtfdVar creates VlanTaggingFilterData ME instance |
| 1975 | func (oo *OmciCC) SendCreateVtfdVar(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1976 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1977 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1978 | logger.Debugw(ctx, "send VTFD-Create-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1979 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 1980 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 1981 | |
| 1982 | meInstance, omciErr := me.NewVlanTaggingFilterData(params[0]) |
| 1983 | if omciErr.GetError() == nil { |
| 1984 | //all SetByCreate Parameters (assumed to be) set here, for optimisation no 'AddDefaults' |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 1985 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, |
| 1986 | oframe.TransactionID(tid)) |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1987 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1988 | logger.Errorw(ctx, "Cannot encode VTFD for create", log.Fields{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1989 | "Err": err, "device-id": oo.deviceID}) |
| 1990 | //TODO!!: refactoring improvement requested, here as an example for [VOL-3457]: |
| 1991 | // return (dual format) error code that can be used at caller for immediate error treatment |
| 1992 | // (relevant to all used sendXX() methods and their error conditions) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 1993 | return nil, err |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1994 | } |
| 1995 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 1996 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1997 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 1998 | logger.Errorw(ctx, "Cannot serialize VTFD create", log.Fields{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 1999 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2000 | return nil, err |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2001 | } |
| 2002 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2003 | omciRxCallbackPair := CallbackPair{ |
| 2004 | CbKey: tid, |
| 2005 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2006 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2007 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2008 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2009 | logger.Errorw(ctx, "Cannot send VTFD create", log.Fields{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2010 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2011 | return nil, err |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2012 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2013 | logger.Debug(ctx, "send VTFD-Create-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2014 | return meInstance, nil |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2015 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2016 | logger.Errorw(ctx, "Cannot generate VTFD Instance", log.Fields{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2017 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2018 | return nil, omciErr.GetError() |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2019 | } |
| 2020 | |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2021 | // nolint: unused |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2022 | func (oo *OmciCC) sendSetVtfdVar(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2023 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2024 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2025 | 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] | 2026 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2027 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2028 | |
| 2029 | meInstance, omciErr := me.NewVlanTaggingFilterData(params[0]) |
| 2030 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2031 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, |
| 2032 | oframe.TransactionID(tid)) |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 2033 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2034 | logger.Errorw(ctx, "Cannot encode VTFD for set", log.Fields{ |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 2035 | "Err": err, "device-id": oo.deviceID}) |
| 2036 | //TODO!!: refactoring improvement requested, here as an example for [VOL-3457]: |
| 2037 | // return (dual format) error code that can be used at caller for immediate error treatment |
| 2038 | // (relevant to all used sendXX() methods and their error conditions) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2039 | return nil, err |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 2040 | } |
| 2041 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2042 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 2043 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2044 | logger.Errorw(ctx, "Cannot serialize VTFD set", log.Fields{ |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 2045 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2046 | return nil, err |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 2047 | } |
| 2048 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2049 | omciRxCallbackPair := CallbackPair{ |
| 2050 | CbKey: tid, |
| 2051 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 2052 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2053 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 2054 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2055 | logger.Errorw(ctx, "Cannot send VTFD set", log.Fields{ |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 2056 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2057 | return nil, err |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 2058 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2059 | logger.Debug(ctx, "send VTFD-Set-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2060 | return meInstance, nil |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 2061 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2062 | logger.Errorw(ctx, "Cannot generate VTFD Instance", log.Fields{ |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 2063 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2064 | return nil, omciErr.GetError() |
Holger Hildebrandt | 394c552 | 2020-09-11 11:23:01 +0000 | [diff] [blame] | 2065 | } |
| 2066 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2067 | // SendCreateEvtocdVar creates ExtendedVlanTaggingOperationConfigurationData ME instance |
| 2068 | func (oo *OmciCC) SendCreateEvtocdVar(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2069 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2070 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2071 | logger.Debugw(ctx, "send EVTOCD-Create-msg:", log.Fields{"device-id": oo.deviceID, |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2072 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2073 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2074 | |
| 2075 | meInstance, omciErr := me.NewExtendedVlanTaggingOperationConfigurationData(params[0]) |
| 2076 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2077 | //EnhancedMode not yet supported, used with default options |
| 2078 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, |
| 2079 | oframe.TransactionID(tid), oframe.AddDefaults(true)) |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2080 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2081 | logger.Errorw(ctx, "Cannot encode EVTOCD for create", log.Fields{ |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2082 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2083 | return nil, err |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2084 | } |
| 2085 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2086 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2087 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2088 | logger.Errorw(ctx, "Cannot serialize EVTOCD create", log.Fields{ |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2089 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2090 | return nil, err |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2091 | } |
| 2092 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2093 | omciRxCallbackPair := CallbackPair{ |
| 2094 | CbKey: tid, |
| 2095 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2096 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2097 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2098 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2099 | logger.Errorw(ctx, "Cannot send EVTOCD create", log.Fields{ |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2100 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2101 | return nil, err |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2102 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2103 | logger.Debug(ctx, "send EVTOCD-set msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2104 | return meInstance, nil |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2105 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2106 | logger.Errorw(ctx, "Cannot generate EVTOCD Instance", log.Fields{ |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2107 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2108 | return nil, omciErr.GetError() |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2109 | } |
| 2110 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2111 | // SendSetEvtocdVar sets ExtendedVlanTaggingOperationConfigurationData ME instance |
| 2112 | func (oo *OmciCC) SendSetEvtocdVar(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2113 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2114 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2115 | logger.Debugw(ctx, "send EVTOCD-Set-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2116 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2117 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2118 | |
| 2119 | meInstance, omciErr := me.NewExtendedVlanTaggingOperationConfigurationData(params[0]) |
| 2120 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2121 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid)) |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2122 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2123 | logger.Errorw(ctx, "Cannot encode EVTOCD for set", log.Fields{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2124 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2125 | return nil, err |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2126 | } |
| 2127 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2128 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2129 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2130 | logger.Errorw(ctx, "Cannot serialize EVTOCD set", log.Fields{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2131 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2132 | return nil, err |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2133 | } |
| 2134 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2135 | omciRxCallbackPair := CallbackPair{ |
| 2136 | CbKey: tid, |
| 2137 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2138 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2139 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2140 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2141 | logger.Errorw(ctx, "Cannot send EVTOCD set", log.Fields{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2142 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2143 | return nil, err |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2144 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2145 | logger.Debug(ctx, "send EVTOCD-set msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2146 | return meInstance, nil |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2147 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2148 | logger.Errorw(ctx, "Cannot generate EVTOCD Instance", log.Fields{ |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2149 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2150 | return nil, omciErr.GetError() |
mpagenko | dff5dda | 2020-08-28 11:52:01 +0000 | [diff] [blame] | 2151 | } |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 2152 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2153 | // SendDeleteEvtocd deletes ExtendedVlanTaggingOperationConfigurationData ME instance |
| 2154 | func (oo *OmciCC) SendDeleteEvtocd(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2155 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2156 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2157 | logger.Debugw(ctx, "send EVTOCD-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2158 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2159 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2160 | |
| 2161 | meInstance, omciErr := me.NewExtendedVlanTaggingOperationConfigurationData(params[0]) |
| 2162 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2163 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType, oframe.TransactionID(tid)) |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2164 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2165 | logger.Errorw(ctx, "Cannot encode EVTOCD for delete", log.Fields{ |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2166 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2167 | return nil, err |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2168 | } |
| 2169 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2170 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2171 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2172 | logger.Errorw(ctx, "Cannot serialize EVTOCD delete", log.Fields{ |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2173 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2174 | return nil, err |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2175 | } |
| 2176 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2177 | omciRxCallbackPair := CallbackPair{ |
| 2178 | CbKey: tid, |
| 2179 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2180 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2181 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2182 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2183 | logger.Errorw(ctx, "Cannot send EVTOCD delete", log.Fields{ |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2184 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2185 | return nil, err |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2186 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2187 | logger.Debug(ctx, "send EVTOCD-delete msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2188 | return meInstance, nil |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2189 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2190 | logger.Errorw(ctx, "Cannot generate EVTOCD Instance", log.Fields{ |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2191 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2192 | return nil, omciErr.GetError() |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2193 | } |
| 2194 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2195 | // SendDeleteVtfd deletes VlanTaggingFilterData ME instance |
| 2196 | func (oo *OmciCC) SendDeleteVtfd(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2197 | rxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2198 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2199 | logger.Debugw(ctx, "send VTFD-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 2200 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2201 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 2202 | |
| 2203 | meParams := me.ParamData{EntityID: aInstID} |
| 2204 | meInstance, omciErr := me.NewVlanTaggingFilterData(meParams) |
| 2205 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2206 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 2207 | oframe.TransactionID(tid)) |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 2208 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2209 | logger.Errorw(ctx, "Cannot encode VTFD for delete", log.Fields{ |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 2210 | "Err": err, "device-id": oo.deviceID}) |
| 2211 | //TODO!!: refactoring improvement requested, here as an example for [VOL-3457]: |
| 2212 | // return (dual format) error code that can be used at caller for immediate error treatment |
| 2213 | // (relevant to all used sendXX() methods and their error conditions) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2214 | return nil, err |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 2215 | } |
| 2216 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2217 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 2218 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2219 | logger.Errorw(ctx, "Cannot serialize VTFD delete", log.Fields{ |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 2220 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2221 | return nil, err |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 2222 | } |
| 2223 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2224 | omciRxCallbackPair := CallbackPair{ |
| 2225 | CbKey: tid, |
| 2226 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 2227 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2228 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 2229 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2230 | logger.Errorw(ctx, "Cannot send VTFD delete", log.Fields{ |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 2231 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2232 | return nil, err |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 2233 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2234 | logger.Debug(ctx, "send VTFD-Delete-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2235 | return meInstance, nil |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 2236 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2237 | logger.Errorw(ctx, "Cannot generate VTFD Instance for delete", log.Fields{ |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 2238 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2239 | return nil, omciErr.GetError() |
mpagenko | 01e726e | 2020-10-23 09:45:29 +0000 | [diff] [blame] | 2240 | } |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2241 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2242 | // SendCreateTDVar creates TrafficDescriptor ME instance |
| 2243 | func (oo *OmciCC) SendCreateTDVar(ctx context.Context, timeout int, highPrio bool, rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 2244 | tid := oo.GetNextTid(highPrio) |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2245 | logger.Debugw(ctx, "send TD-Create-msg:", log.Fields{"device-id": oo.deviceID, |
| 2246 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2247 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2248 | meInstance, omciErr := me.NewTrafficDescriptor(params[0]) |
| 2249 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2250 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid)) |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2251 | if err != nil { |
| 2252 | logger.Errorw(ctx, "Cannot encode TD for create", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2253 | return nil, err |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2254 | } |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2255 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2256 | if err != nil { |
| 2257 | logger.Errorw(ctx, "Cannot serialize TD create", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2258 | return nil, err |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2259 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2260 | omciRxCallbackPair := CallbackPair{ |
| 2261 | CbKey: tid, |
| 2262 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2263 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2264 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2265 | if err != nil { |
| 2266 | logger.Errorw(ctx, "Cannot send TD create", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2267 | return nil, err |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2268 | } |
| 2269 | logger.Debug(ctx, "send TD-Create-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2270 | return meInstance, nil |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2271 | } |
| 2272 | logger.Errorw(ctx, "Cannot generate TD Instance", log.Fields{"Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2273 | return nil, omciErr.GetError() |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2274 | } |
| 2275 | |
| 2276 | // nolint: unused |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2277 | func (oo *OmciCC) sendSetTDVar(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2278 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2279 | tid := oo.GetNextTid(highPrio) |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2280 | logger.Debugw(ctx, "send TD-Set-msg:", log.Fields{"device-id": oo.deviceID, |
| 2281 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2282 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2283 | |
| 2284 | meInstance, omciErr := me.NewTrafficDescriptor(params[0]) |
| 2285 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2286 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid)) |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2287 | if err != nil { |
| 2288 | logger.Errorw(ctx, "Cannot encode TD for set", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2289 | return nil, err |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2290 | } |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2291 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2292 | if err != nil { |
| 2293 | logger.Errorw(ctx, "Cannot serialize TD set", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2294 | return nil, err |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2295 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2296 | omciRxCallbackPair := CallbackPair{ |
| 2297 | CbKey: tid, |
| 2298 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2299 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2300 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2301 | if err != nil { |
| 2302 | logger.Errorw(ctx, "Cannot send TD set", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2303 | return nil, err |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2304 | } |
| 2305 | logger.Debug(ctx, "send TD-Set-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2306 | return meInstance, nil |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2307 | } |
| 2308 | logger.Errorw(ctx, "Cannot generate TD Instance", log.Fields{"Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2309 | return nil, omciErr.GetError() |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2310 | |
| 2311 | } |
| 2312 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2313 | // SendDeleteTD - TODO: add comment |
| 2314 | func (oo *OmciCC) SendDeleteTD(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2315 | rxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2316 | tid := oo.GetNextTid(highPrio) |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2317 | logger.Debugw(ctx, "send TD-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
| 2318 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2319 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 2320 | |
| 2321 | meParams := me.ParamData{EntityID: aInstID} |
| 2322 | meInstance, omciErr := me.NewTrafficDescriptor(meParams) |
| 2323 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2324 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType, oframe.TransactionID(tid)) |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2325 | if err != nil { |
| 2326 | logger.Errorw(ctx, "Cannot encode TD for delete", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2327 | return nil, err |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2328 | } |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2329 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2330 | if err != nil { |
| 2331 | logger.Errorw(ctx, "Cannot serialize TD delete", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2332 | return nil, err |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2333 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2334 | omciRxCallbackPair := CallbackPair{ |
| 2335 | CbKey: tid, |
| 2336 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2337 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2338 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2339 | if err != nil { |
| 2340 | logger.Errorw(ctx, "Cannot send TD delete", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2341 | return nil, err |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2342 | } |
| 2343 | logger.Debug(ctx, "send TD-Delete-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2344 | return meInstance, nil |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2345 | } |
| 2346 | logger.Errorw(ctx, "Cannot generate TD Instance", log.Fields{"Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2347 | return nil, omciErr.GetError() |
ozgecanetsia | b644196 | 2021-03-10 10:58:48 +0300 | [diff] [blame] | 2348 | |
| 2349 | } |
| 2350 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2351 | // SendDeleteGemIWTP deletes GemInterworkingTerminationPoint ME instance |
| 2352 | func (oo *OmciCC) SendDeleteGemIWTP(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2353 | rxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2354 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2355 | logger.Debugw(ctx, "send GemIwTp-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2356 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2357 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 2358 | |
| 2359 | meParams := me.ParamData{EntityID: aInstID} |
| 2360 | meInstance, omciErr := me.NewGemInterworkingTerminationPoint(meParams) |
| 2361 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2362 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 2363 | oframe.TransactionID(tid)) |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2364 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2365 | logger.Errorw(ctx, "Cannot encode GemIwTp for delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2366 | "Err": err, "device-id": oo.deviceID}) |
| 2367 | //TODO!!: refactoring improvement requested, here as an example for [VOL-3457]: |
| 2368 | // return (dual format) error code that can be used at caller for immediate error treatment |
| 2369 | // (relevant to all used sendXX() methods and their error conditions) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2370 | return nil, err |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2371 | } |
| 2372 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2373 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2374 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2375 | logger.Errorw(ctx, "Cannot serialize GemIwTp delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2376 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2377 | return nil, err |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2378 | } |
| 2379 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2380 | omciRxCallbackPair := CallbackPair{ |
| 2381 | CbKey: tid, |
| 2382 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2383 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2384 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2385 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2386 | logger.Errorw(ctx, "Cannot send GemIwTp delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2387 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2388 | return nil, err |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2389 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2390 | logger.Debug(ctx, "send GemIwTp-Delete-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2391 | return meInstance, nil |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2392 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2393 | logger.Errorw(ctx, "Cannot generate GemIwTp Instance for delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2394 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2395 | return nil, omciErr.GetError() |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2396 | } |
| 2397 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2398 | // SendDeleteGemNCTP deletes GemPortNetworkCtp ME instance |
| 2399 | func (oo *OmciCC) SendDeleteGemNCTP(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2400 | rxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2401 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2402 | logger.Debugw(ctx, "send GemNCtp-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2403 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2404 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 2405 | |
| 2406 | meParams := me.ParamData{EntityID: aInstID} |
| 2407 | meInstance, omciErr := me.NewGemPortNetworkCtp(meParams) |
| 2408 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2409 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 2410 | oframe.TransactionID(tid)) |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2411 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2412 | logger.Errorw(ctx, "Cannot encode GemNCtp for delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2413 | "Err": err, "device-id": oo.deviceID}) |
| 2414 | //TODO!!: refactoring improvement requested, here as an example for [VOL-3457]: |
| 2415 | // return (dual format) error code that can be used at caller for immediate error treatment |
| 2416 | // (relevant to all used sendXX() methods and their error conditions) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2417 | return nil, err |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2418 | } |
| 2419 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2420 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2421 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2422 | logger.Errorw(ctx, "Cannot serialize GemNCtp delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2423 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2424 | return nil, err |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2425 | } |
| 2426 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2427 | omciRxCallbackPair := CallbackPair{ |
| 2428 | CbKey: tid, |
| 2429 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2430 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2431 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2432 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2433 | logger.Errorw(ctx, "Cannot send GemNCtp delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2434 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2435 | return nil, err |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2436 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2437 | logger.Debug(ctx, "send GemNCtp-Delete-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2438 | return meInstance, nil |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2439 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2440 | logger.Errorw(ctx, "Cannot generate GemNCtp Instance for delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2441 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2442 | return nil, omciErr.GetError() |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2443 | } |
| 2444 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2445 | // SendDeleteDot1PMapper deletes Ieee8021PMapperServiceProfile ME instance |
| 2446 | func (oo *OmciCC) SendDeleteDot1PMapper(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2447 | rxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2448 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2449 | logger.Debugw(ctx, "send .1pMapper-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2450 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2451 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 2452 | |
| 2453 | meParams := me.ParamData{EntityID: aInstID} |
| 2454 | meInstance, omciErr := me.NewIeee8021PMapperServiceProfile(meParams) |
| 2455 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2456 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 2457 | oframe.TransactionID(tid)) |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2458 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2459 | logger.Errorw(ctx, "Cannot encode .1pMapper for delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2460 | "Err": err, "device-id": oo.deviceID}) |
| 2461 | //TODO!!: refactoring improvement requested, here as an example for [VOL-3457]: |
| 2462 | // return (dual format) error code that can be used at caller for immediate error treatment |
| 2463 | // (relevant to all used sendXX() methods and their error conditions) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2464 | return nil, err |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2465 | } |
| 2466 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2467 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2468 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2469 | logger.Errorw(ctx, "Cannot serialize .1pMapper delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2470 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2471 | return nil, err |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2472 | } |
| 2473 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2474 | omciRxCallbackPair := CallbackPair{ |
| 2475 | CbKey: tid, |
| 2476 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2477 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2478 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2479 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2480 | logger.Errorw(ctx, "Cannot send .1pMapper delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2481 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2482 | return nil, err |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2483 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2484 | logger.Debug(ctx, "send .1pMapper-Delete-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2485 | return meInstance, nil |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2486 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2487 | logger.Errorw(ctx, "Cannot generate .1pMapper Instance for delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2488 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2489 | return nil, omciErr.GetError() |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2490 | } |
| 2491 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2492 | // SendDeleteMBPConfigData deletes MacBridgePortConfigurationData ME instance |
| 2493 | func (oo *OmciCC) SendDeleteMBPConfigData(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2494 | rxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2495 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2496 | logger.Debugw(ctx, "send MBPCD-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2497 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2498 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 2499 | |
| 2500 | meParams := me.ParamData{EntityID: aInstID} |
| 2501 | meInstance, omciErr := me.NewMacBridgePortConfigurationData(meParams) |
| 2502 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2503 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 2504 | oframe.TransactionID(tid)) |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2505 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2506 | logger.Errorw(ctx, "Cannot encode MBPCD for delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2507 | "Err": err, "device-id": oo.deviceID}) |
| 2508 | //TODO!!: refactoring improvement requested, here as an example for [VOL-3457]: |
| 2509 | // return (dual format) error code that can be used at caller for immediate error treatment |
| 2510 | // (relevant to all used sendXX() methods and their error conditions) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2511 | return nil, err |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2512 | } |
| 2513 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2514 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2515 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2516 | logger.Errorw(ctx, "Cannot serialize MBPCD delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2517 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2518 | return nil, err |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2519 | } |
| 2520 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2521 | omciRxCallbackPair := CallbackPair{ |
| 2522 | CbKey: tid, |
| 2523 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2524 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2525 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2526 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2527 | logger.Errorw(ctx, "Cannot send MBPCD delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2528 | "Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2529 | return nil, err |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2530 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2531 | logger.Debug(ctx, "send MBPCD-Delete-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2532 | return meInstance, nil |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2533 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2534 | logger.Errorw(ctx, "Cannot generate MBPCD Instance for delete", log.Fields{ |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2535 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2536 | return nil, omciErr.GetError() |
mpagenko | 8b07c1b | 2020-11-26 10:36:31 +0000 | [diff] [blame] | 2537 | } |
| 2538 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2539 | // SendCreateMulticastGemIWTPVar creates MulticastGemInterworkingTerminationPoint ME instance |
| 2540 | func (oo *OmciCC) SendCreateMulticastGemIWTPVar(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2541 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2542 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2543 | logger.Debugw(ctx, "send MulticastGemIWTP-create-msg:", log.Fields{"device-id": oo.deviceID, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2544 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2545 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2546 | |
| 2547 | meInstance, omciErr := me.NewMulticastGemInterworkingTerminationPoint(params[0]) |
| 2548 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2549 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 2550 | oframe.AddDefaults(true)) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2551 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2552 | logger.Errorw(ctx, "Cannot encode MulticastGEMIWTP for create", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2553 | return nil, err |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2554 | } |
| 2555 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2556 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2557 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2558 | logger.Errorw(ctx, "Cannot serialize MulticastGEMIWTP create", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2559 | return nil, err |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2560 | } |
| 2561 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2562 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 2563 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2564 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2565 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2566 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2567 | logger.Errorw(ctx, "Cannot send MulticastGEMIWTP create", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2568 | return nil, err |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2569 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2570 | logger.Debug(ctx, "send MulticastGEMIWTP-create-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2571 | return meInstance, nil |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2572 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2573 | logger.Errorw(ctx, "Cannot generate MulticastGEMIWTP Instance", log.Fields{"Err": omciErr.GetError(), |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2574 | "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2575 | return nil, omciErr.GetError() |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2576 | } |
| 2577 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2578 | // SendSetMulticastGemIWTPVar sets MulticastGemInterworkingTerminationPoint ME instance |
| 2579 | func (oo *OmciCC) SendSetMulticastGemIWTPVar(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2580 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2581 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2582 | logger.Debugw(ctx, "send MulticastGemIWTP-set-msg:", log.Fields{"device-id": oo.deviceID, |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2583 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2584 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2585 | |
| 2586 | meInstance, omciErr := me.NewMulticastGemInterworkingTerminationPoint(params[0]) |
| 2587 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2588 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid), |
| 2589 | oframe.AddDefaults(true)) |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2590 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2591 | logger.Errorw(ctx, "Cannot encode MulticastGEMIWTP for set", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2592 | return nil, err |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2593 | } |
| 2594 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2595 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2596 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2597 | logger.Errorw(ctx, "Cannot serialize MulticastGEMIWTP create", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2598 | return nil, err |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2599 | } |
| 2600 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2601 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 2602 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2603 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2604 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2605 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2606 | logger.Errorw(ctx, "Cannot send MulticastGEMIWTP set", log.Fields{"Err": err, "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2607 | return nil, err |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2608 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2609 | logger.Debug(ctx, "send MulticastGEMIWTP-set-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2610 | return meInstance, nil |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2611 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2612 | logger.Errorw(ctx, "Cannot generate MulticastGEMIWTP Instance", log.Fields{"Err": omciErr.GetError(), |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2613 | "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2614 | return nil, omciErr.GetError() |
ozgecanetsia | b5000ef | 2020-11-27 14:38:20 +0300 | [diff] [blame] | 2615 | } |
| 2616 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2617 | // SendCreateMulticastOperationProfileVar creates MulticastOperationsProfile ME instance |
| 2618 | func (oo *OmciCC) SendCreateMulticastOperationProfileVar(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2619 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2620 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2621 | logger.Debugw(ctx, "send MulticastOperationProfile-create-msg:", log.Fields{"device-id": oo.deviceID, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2622 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2623 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2624 | |
| 2625 | meInstance, omciErr := me.NewMulticastOperationsProfile(params[0]) |
| 2626 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2627 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 2628 | oframe.AddDefaults(true)) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2629 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2630 | logger.Errorw(ctx, "Cannot encode MulticastOperationProfile for create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2631 | "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2632 | return nil, err |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2633 | } |
| 2634 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2635 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2636 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2637 | logger.Errorw(ctx, "Cannot serialize MulticastOperationProfile create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2638 | "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2639 | return nil, err |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2640 | } |
| 2641 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2642 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 2643 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2644 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2645 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2646 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2647 | logger.Errorw(ctx, "Cannot send MulticastOperationProfile create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2648 | "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2649 | return nil, err |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2650 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2651 | logger.Debug(ctx, "send MulticastOperationProfile-create-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2652 | return meInstance, nil |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2653 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2654 | logger.Errorw(ctx, "Cannot generate MulticastOperationProfile Instance", log.Fields{"Err": omciErr.GetError(), |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2655 | "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2656 | return nil, omciErr.GetError() |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2657 | } |
| 2658 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2659 | // SendSetMulticastOperationProfileVar sets MulticastOperationsProfile ME instance |
| 2660 | func (oo *OmciCC) SendSetMulticastOperationProfileVar(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2661 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2662 | tid := oo.GetNextTid(highPrio) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 2663 | logger.Debugw(ctx, "send MulticastOperationProfile-set-msg:", log.Fields{"device-id": oo.deviceID, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2664 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2665 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2666 | |
| 2667 | meInstance, omciErr := me.NewMulticastOperationsProfile(params[0]) |
| 2668 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2669 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid), |
| 2670 | oframe.AddDefaults(true)) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2671 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2672 | logger.Errorw(ctx, "Cannot encode MulticastOperationProfile for create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2673 | "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2674 | return nil, err |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2675 | } |
| 2676 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2677 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2678 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2679 | logger.Errorw(ctx, "Cannot serialize MulticastOperationProfile create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2680 | "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2681 | return nil, err |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2682 | } |
| 2683 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2684 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 2685 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2686 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2687 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2688 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2689 | logger.Errorw(ctx, "Cannot send MulticastOperationProfile create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2690 | "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2691 | return nil, err |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2692 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2693 | logger.Debug(ctx, "send MulticastOperationProfile-create-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2694 | return meInstance, nil |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2695 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2696 | logger.Errorw(ctx, "Cannot generate MulticastOperationProfile Instance", log.Fields{"Err": omciErr.GetError(), |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2697 | "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2698 | return nil, omciErr.GetError() |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2699 | } |
| 2700 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2701 | // SendCreateMulticastSubConfigInfoVar creates MulticastSubscriberConfigInfo ME instance |
| 2702 | func (oo *OmciCC) SendCreateMulticastSubConfigInfoVar(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2703 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2704 | tid := oo.GetNextTid(highPrio) |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2705 | logger.Debugw(ctx, "send MulticastSubConfigInfo-create-msg:", log.Fields{"device-id": oo.deviceID, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2706 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2707 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2708 | |
| 2709 | meInstance, omciErr := me.NewMulticastSubscriberConfigInfo(params[0]) |
| 2710 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2711 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 2712 | oframe.AddDefaults(true)) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2713 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2714 | logger.Errorw(ctx, "Cannot encode MulticastSubConfigInfo for create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2715 | "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2716 | return nil, err |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2717 | } |
| 2718 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2719 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2720 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2721 | logger.Errorw(ctx, "Cannot serialize MulticastSubConfigInfo create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2722 | "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2723 | return nil, err |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2724 | } |
| 2725 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2726 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 2727 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2728 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 2729 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2730 | if err != nil { |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2731 | logger.Errorw(ctx, "Cannot send MulticastSubConfigInfo create", log.Fields{"Err": err, |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2732 | "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2733 | return nil, err |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2734 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2735 | logger.Debug(ctx, "send MulticastSubConfigInfo-create-msg done") |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2736 | return meInstance, nil |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2737 | } |
dbainbri | 4d3a0dc | 2020-12-02 00:33:42 +0000 | [diff] [blame] | 2738 | logger.Errorw(ctx, "Cannot generate MulticastSubConfigInfo Instance", log.Fields{"Err": omciErr.GetError(), |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2739 | "device-id": oo.deviceID}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 2740 | return nil, omciErr.GetError() |
ozgecanetsia | 422dbf3 | 2020-10-28 14:07:19 +0300 | [diff] [blame] | 2741 | } |
Holger Hildebrandt | 0bd45f8 | 2021-01-11 13:29:37 +0000 | [diff] [blame] | 2742 | |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 2743 | // SendCreateVoipVoiceCTP nolint: unused |
| 2744 | func (oo *OmciCC) SendCreateVoipVoiceCTP(ctx context.Context, timeout int, highPrio bool, |
| 2745 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 2746 | tid := oo.GetNextTid(highPrio) |
| 2747 | logger.Debugw(ctx, "send VoipVoiceCTP-create-msg:", log.Fields{"device-id": oo.deviceID, |
| 2748 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2749 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2750 | |
| 2751 | meInstance, omciErr := me.NewVoipVoiceCtp(params[0]) |
| 2752 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2753 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 2754 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 2755 | if err != nil { |
| 2756 | logger.Errorw(ctx, "Cannot encode VoipVoiceCTP for create", log.Fields{"Err": err, |
| 2757 | "device-id": oo.deviceID}) |
| 2758 | return nil, err |
| 2759 | } |
| 2760 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2761 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 2762 | if err != nil { |
| 2763 | logger.Errorw(ctx, "Cannot serialize VoipVoiceCTP create", log.Fields{"Err": err, |
| 2764 | "device-id": oo.deviceID}) |
| 2765 | return nil, err |
| 2766 | } |
| 2767 | |
| 2768 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 2769 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 2770 | } |
| 2771 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 2772 | if err != nil { |
| 2773 | logger.Errorw(ctx, "Cannot send VoipVoiceCTP create", log.Fields{"Err": err, |
| 2774 | "device-id": oo.deviceID}) |
| 2775 | return nil, err |
| 2776 | } |
| 2777 | logger.Debug(ctx, "send VoipVoiceCTP-create-msg done") |
| 2778 | return meInstance, nil |
| 2779 | } |
| 2780 | logger.Errorw(ctx, "Cannot generate VoipVoiceCTP Instance", log.Fields{"Err": omciErr.GetError(), |
| 2781 | "device-id": oo.deviceID}) |
| 2782 | return nil, omciErr.GetError() |
| 2783 | } |
| 2784 | |
| 2785 | // SendSetVoipVoiceCTP nolint: unused |
| 2786 | func (oo *OmciCC) SendSetVoipVoiceCTP(ctx context.Context, timeout int, highPrio bool, |
| 2787 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 2788 | tid := oo.GetNextTid(highPrio) |
| 2789 | logger.Debugw(ctx, "send VoipVoiceCTP-set-msg:", log.Fields{"device-id": oo.deviceID, |
| 2790 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2791 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2792 | |
| 2793 | meInstance, omciErr := me.NewVoipVoiceCtp(params[0]) |
| 2794 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2795 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid), |
| 2796 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 2797 | if err != nil { |
| 2798 | logger.Errorw(ctx, "Cannot encode VoipVoiceCTP for set", log.Fields{"Err": err, |
| 2799 | "device-id": oo.deviceID}) |
| 2800 | return nil, err |
| 2801 | } |
| 2802 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2803 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 2804 | if err != nil { |
| 2805 | logger.Errorw(ctx, "Cannot serialize VoipVoiceCTP set", log.Fields{"Err": err, |
| 2806 | "device-id": oo.deviceID}) |
| 2807 | return nil, err |
| 2808 | } |
| 2809 | |
| 2810 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 2811 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 2812 | } |
| 2813 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 2814 | if err != nil { |
| 2815 | logger.Errorw(ctx, "Cannot send VoipVoiceCTP set", log.Fields{"Err": err, |
| 2816 | "device-id": oo.deviceID}) |
| 2817 | return nil, err |
| 2818 | } |
| 2819 | logger.Debug(ctx, "send VoipVoiceCTP-set-msg done") |
| 2820 | return meInstance, nil |
| 2821 | } |
| 2822 | logger.Errorw(ctx, "Cannot generate VoipVoiceCTP Instance", log.Fields{"Err": omciErr.GetError(), |
| 2823 | "device-id": oo.deviceID}) |
| 2824 | return nil, omciErr.GetError() |
| 2825 | } |
| 2826 | |
| 2827 | // SendDeleteVoipVoiceCTP nolint: unused |
| 2828 | func (oo *OmciCC) SendDeleteVoipVoiceCTP(ctx context.Context, timeout int, highPrio bool, |
| 2829 | rxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) { |
| 2830 | tid := oo.GetNextTid(highPrio) |
| 2831 | logger.Debugw(ctx, "send VoipVoiceCTP-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
| 2832 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2833 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 2834 | |
| 2835 | meParams := me.ParamData{EntityID: aInstID} |
| 2836 | meInstance, omciErr := me.NewVoipVoiceCtp(meParams) |
| 2837 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2838 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 2839 | oframe.TransactionID(tid)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 2840 | if err != nil { |
| 2841 | logger.Errorw(ctx, "Cannot encode VoipVoiceCTP for delete", log.Fields{ |
| 2842 | "Err": err, "device-id": oo.deviceID}) |
| 2843 | //TODO!!: refactoring improvement requested, here as an example for [VOL-3457]: |
| 2844 | // return (dual format) error code that can be used at caller for immediate error treatment |
| 2845 | // (relevant to all used sendXX() methods and their error conditions) |
| 2846 | return nil, err |
| 2847 | } |
| 2848 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2849 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 2850 | if err != nil { |
| 2851 | logger.Errorw(ctx, "Cannot serialize VoipVoiceCTP delete", log.Fields{ |
| 2852 | "Err": err, "device-id": oo.deviceID}) |
| 2853 | return nil, err |
| 2854 | } |
| 2855 | |
| 2856 | omciRxCallbackPair := CallbackPair{ |
| 2857 | CbKey: tid, |
| 2858 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 2859 | } |
| 2860 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 2861 | if err != nil { |
| 2862 | logger.Errorw(ctx, "Cannot send VoipVoiceCTP delete", log.Fields{ |
| 2863 | "Err": err, "device-id": oo.deviceID}) |
| 2864 | return nil, err |
| 2865 | } |
| 2866 | logger.Debug(ctx, "send VoipVoiceCTP-Delete-msg done") |
| 2867 | return meInstance, nil |
| 2868 | } |
| 2869 | logger.Errorw(ctx, "Cannot generate VoipVoiceCTP Instance for delete", log.Fields{ |
| 2870 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 2871 | return nil, omciErr.GetError() |
| 2872 | } |
| 2873 | |
| 2874 | // SendCreateVoipMediaProfile nolint: unused |
| 2875 | func (oo *OmciCC) SendCreateVoipMediaProfile(ctx context.Context, timeout int, highPrio bool, |
| 2876 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 2877 | tid := oo.GetNextTid(highPrio) |
| 2878 | logger.Debugw(ctx, "send VoipMediaProfile-create-msg:", log.Fields{"device-id": oo.deviceID, |
| 2879 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2880 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2881 | |
| 2882 | meInstance, omciErr := me.NewVoipMediaProfile(params[0]) |
| 2883 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2884 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 2885 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 2886 | if err != nil { |
| 2887 | logger.Errorw(ctx, "Cannot encode VoipMediaProfile for create", log.Fields{"Err": err, |
| 2888 | "device-id": oo.deviceID}) |
| 2889 | return nil, err |
| 2890 | } |
| 2891 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2892 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 2893 | if err != nil { |
| 2894 | logger.Errorw(ctx, "Cannot serialize VoipMediaProfile create", log.Fields{"Err": err, |
| 2895 | "device-id": oo.deviceID}) |
| 2896 | return nil, err |
| 2897 | } |
| 2898 | |
| 2899 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 2900 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 2901 | } |
| 2902 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 2903 | if err != nil { |
| 2904 | logger.Errorw(ctx, "Cannot send VoipMediaProfile create", log.Fields{"Err": err, |
| 2905 | "device-id": oo.deviceID}) |
| 2906 | return nil, err |
| 2907 | } |
| 2908 | logger.Debug(ctx, "send VoipMediaProfile-create-msg done") |
| 2909 | return meInstance, nil |
| 2910 | } |
| 2911 | logger.Errorw(ctx, "Cannot generate VoipMediaProfile Instance", log.Fields{"Err": omciErr.GetError(), |
| 2912 | "device-id": oo.deviceID}) |
| 2913 | return nil, omciErr.GetError() |
| 2914 | } |
| 2915 | |
| 2916 | // SendSetVoipMediaProfile nolint: unused |
| 2917 | func (oo *OmciCC) SendSetVoipMediaProfile(ctx context.Context, timeout int, highPrio bool, |
| 2918 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 2919 | tid := oo.GetNextTid(highPrio) |
| 2920 | logger.Debugw(ctx, "send VoipMediaProfile-set-msg:", log.Fields{"device-id": oo.deviceID, |
| 2921 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2922 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 2923 | |
| 2924 | meInstance, omciErr := me.NewVoipMediaProfile(params[0]) |
| 2925 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2926 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid), |
| 2927 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 2928 | if err != nil { |
| 2929 | logger.Errorw(ctx, "Cannot encode VoipMediaProfile for set", log.Fields{"Err": err, |
| 2930 | "device-id": oo.deviceID}) |
| 2931 | return nil, err |
| 2932 | } |
| 2933 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2934 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 2935 | if err != nil { |
| 2936 | logger.Errorw(ctx, "Cannot serialize VoipMediaProfile set", log.Fields{"Err": err, |
| 2937 | "device-id": oo.deviceID}) |
| 2938 | return nil, err |
| 2939 | } |
| 2940 | |
| 2941 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 2942 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 2943 | } |
| 2944 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 2945 | if err != nil { |
| 2946 | logger.Errorw(ctx, "Cannot send VoipMediaProfile set", log.Fields{"Err": err, |
| 2947 | "device-id": oo.deviceID}) |
| 2948 | return nil, err |
| 2949 | } |
| 2950 | logger.Debug(ctx, "send VoipMediaProfile-set-msg done") |
| 2951 | return meInstance, nil |
| 2952 | } |
| 2953 | logger.Errorw(ctx, "Cannot generate VoipMediaProfile Instance", log.Fields{"Err": omciErr.GetError(), |
| 2954 | "device-id": oo.deviceID}) |
| 2955 | return nil, omciErr.GetError() |
| 2956 | } |
| 2957 | |
| 2958 | // SendDeleteVoipMediaProfile nolint: unused |
| 2959 | func (oo *OmciCC) SendDeleteVoipMediaProfile(ctx context.Context, timeout int, highPrio bool, |
| 2960 | rxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) { |
| 2961 | tid := oo.GetNextTid(highPrio) |
| 2962 | logger.Debugw(ctx, "send VoipMediaProfile-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
| 2963 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 2964 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 2965 | |
| 2966 | meParams := me.ParamData{EntityID: aInstID} |
| 2967 | meInstance, omciErr := me.NewVoipMediaProfile(meParams) |
| 2968 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 2969 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 2970 | oframe.TransactionID(tid)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 2971 | if err != nil { |
| 2972 | logger.Errorw(ctx, "Cannot encode VoipMediaProfile for delete", log.Fields{ |
| 2973 | "Err": err, "device-id": oo.deviceID}) |
| 2974 | return nil, err |
| 2975 | } |
| 2976 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 2977 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 2978 | if err != nil { |
| 2979 | logger.Errorw(ctx, "Cannot serialize VoipMediaProfile delete", log.Fields{ |
| 2980 | "Err": err, "device-id": oo.deviceID}) |
| 2981 | return nil, err |
| 2982 | } |
| 2983 | |
| 2984 | omciRxCallbackPair := CallbackPair{ |
| 2985 | CbKey: tid, |
| 2986 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 2987 | } |
| 2988 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 2989 | if err != nil { |
| 2990 | logger.Errorw(ctx, "Cannot send VoipMediaProfile delete", log.Fields{ |
| 2991 | "Err": err, "device-id": oo.deviceID}) |
| 2992 | return nil, err |
| 2993 | } |
| 2994 | logger.Debug(ctx, "send VoipMediaProfile-Delete-msg done") |
| 2995 | return meInstance, nil |
| 2996 | } |
| 2997 | logger.Errorw(ctx, "Cannot generate VoipMediaProfile Instance for delete", log.Fields{ |
| 2998 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 2999 | return nil, omciErr.GetError() |
| 3000 | } |
| 3001 | |
| 3002 | // SendCreateVoiceServiceProfile nolint: unused |
| 3003 | func (oo *OmciCC) SendCreateVoiceServiceProfile(ctx context.Context, timeout int, highPrio bool, |
| 3004 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 3005 | tid := oo.GetNextTid(highPrio) |
| 3006 | logger.Debugw(ctx, "send VoiceServiceProfile-create-msg:", log.Fields{"device-id": oo.deviceID, |
| 3007 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3008 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 3009 | |
| 3010 | meInstance, omciErr := me.NewVoiceServiceProfile(params[0]) |
| 3011 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3012 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 3013 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3014 | if err != nil { |
| 3015 | logger.Errorw(ctx, "Cannot encode VoiceServiceProfile for create", log.Fields{"Err": err, |
| 3016 | "device-id": oo.deviceID}) |
| 3017 | return nil, err |
| 3018 | } |
| 3019 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3020 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3021 | if err != nil { |
| 3022 | logger.Errorw(ctx, "Cannot serialize VoiceServiceProfile create", log.Fields{"Err": err, |
| 3023 | "device-id": oo.deviceID}) |
| 3024 | return nil, err |
| 3025 | } |
| 3026 | |
| 3027 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 3028 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3029 | } |
| 3030 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3031 | if err != nil { |
| 3032 | logger.Errorw(ctx, "Cannot send VoiceServiceProfile create", log.Fields{"Err": err, |
| 3033 | "device-id": oo.deviceID}) |
| 3034 | return nil, err |
| 3035 | } |
| 3036 | logger.Debug(ctx, "send VoiceServiceProfile-create-msg done") |
| 3037 | return meInstance, nil |
| 3038 | } |
| 3039 | logger.Errorw(ctx, "Cannot generate VoiceServiceProfile Instance", log.Fields{"Err": omciErr.GetError(), |
| 3040 | "device-id": oo.deviceID}) |
| 3041 | return nil, omciErr.GetError() |
| 3042 | } |
| 3043 | |
| 3044 | // SendSetVoiceServiceProfile nolint: unused |
| 3045 | func (oo *OmciCC) SendSetVoiceServiceProfile(ctx context.Context, timeout int, highPrio bool, |
| 3046 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 3047 | tid := oo.GetNextTid(highPrio) |
| 3048 | logger.Debugw(ctx, "send VoiceServiceProfile-set-msg:", log.Fields{"device-id": oo.deviceID, |
| 3049 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3050 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 3051 | |
| 3052 | meInstance, omciErr := me.NewVoiceServiceProfile(params[0]) |
| 3053 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3054 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid), |
| 3055 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3056 | if err != nil { |
| 3057 | logger.Errorw(ctx, "Cannot encode VoiceServiceProfile for set", log.Fields{"Err": err, |
| 3058 | "device-id": oo.deviceID}) |
| 3059 | return nil, err |
| 3060 | } |
| 3061 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3062 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3063 | if err != nil { |
| 3064 | logger.Errorw(ctx, "Cannot serialize VoiceServiceProfile set", log.Fields{"Err": err, |
| 3065 | "device-id": oo.deviceID}) |
| 3066 | return nil, err |
| 3067 | } |
| 3068 | |
| 3069 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 3070 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3071 | } |
| 3072 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3073 | if err != nil { |
| 3074 | logger.Errorw(ctx, "Cannot send VoiceServiceProfile set", log.Fields{"Err": err, |
| 3075 | "device-id": oo.deviceID}) |
| 3076 | return nil, err |
| 3077 | } |
| 3078 | logger.Debug(ctx, "send VoiceServiceProfile-set-msg done") |
| 3079 | return meInstance, nil |
| 3080 | } |
| 3081 | logger.Errorw(ctx, "Cannot generate VoiceServiceProfile Instance", log.Fields{"Err": omciErr.GetError(), |
| 3082 | "device-id": oo.deviceID}) |
| 3083 | return nil, omciErr.GetError() |
| 3084 | } |
| 3085 | |
| 3086 | // SendDeleteVoiceServiceProfile nolint: unused |
| 3087 | func (oo *OmciCC) SendDeleteVoiceServiceProfile(ctx context.Context, timeout int, highPrio bool, |
| 3088 | rxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) { |
| 3089 | tid := oo.GetNextTid(highPrio) |
| 3090 | logger.Debugw(ctx, "send VoiceServiceProfile-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
| 3091 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3092 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 3093 | |
| 3094 | meParams := me.ParamData{EntityID: aInstID} |
| 3095 | meInstance, omciErr := me.NewVoiceServiceProfile(meParams) |
| 3096 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3097 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 3098 | oframe.TransactionID(tid)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3099 | if err != nil { |
| 3100 | logger.Errorw(ctx, "Cannot encode VoiceServiceProfile for delete", log.Fields{ |
| 3101 | "Err": err, "device-id": oo.deviceID}) |
| 3102 | return nil, err |
| 3103 | } |
| 3104 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3105 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3106 | if err != nil { |
| 3107 | logger.Errorw(ctx, "Cannot serialize VoiceServiceProfile delete", log.Fields{ |
| 3108 | "Err": err, "device-id": oo.deviceID}) |
| 3109 | return nil, err |
| 3110 | } |
| 3111 | |
| 3112 | omciRxCallbackPair := CallbackPair{ |
| 3113 | CbKey: tid, |
| 3114 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3115 | } |
| 3116 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3117 | if err != nil { |
| 3118 | logger.Errorw(ctx, "Cannot send VoiceServiceProfile delete", log.Fields{ |
| 3119 | "Err": err, "device-id": oo.deviceID}) |
| 3120 | return nil, err |
| 3121 | } |
| 3122 | logger.Debug(ctx, "send VoiceServiceProfile-Delete-msg done") |
| 3123 | return meInstance, nil |
| 3124 | } |
| 3125 | logger.Errorw(ctx, "Cannot generate VoiceServiceProfile Instance for delete", log.Fields{ |
| 3126 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 3127 | return nil, omciErr.GetError() |
| 3128 | } |
| 3129 | |
| 3130 | // SendCreateSIPUserData nolint: unused |
| 3131 | func (oo *OmciCC) SendCreateSIPUserData(ctx context.Context, timeout int, highPrio bool, |
| 3132 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 3133 | tid := oo.GetNextTid(highPrio) |
| 3134 | logger.Debugw(ctx, "send SIPUserData-create-msg:", log.Fields{"device-id": oo.deviceID, |
| 3135 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3136 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 3137 | |
| 3138 | meInstance, omciErr := me.NewSipUserData(params[0]) |
| 3139 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3140 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 3141 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3142 | if err != nil { |
| 3143 | logger.Errorw(ctx, "Cannot encode SIPUserData for create", log.Fields{"Err": err, |
| 3144 | "device-id": oo.deviceID}) |
| 3145 | return nil, err |
| 3146 | } |
| 3147 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3148 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3149 | if err != nil { |
| 3150 | logger.Errorw(ctx, "Cannot serialize SIPUserData create", log.Fields{"Err": err, |
| 3151 | "device-id": oo.deviceID}) |
| 3152 | return nil, err |
| 3153 | } |
| 3154 | |
| 3155 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 3156 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3157 | } |
| 3158 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3159 | if err != nil { |
| 3160 | logger.Errorw(ctx, "Cannot send SIPUserData create", log.Fields{"Err": err, |
| 3161 | "device-id": oo.deviceID}) |
| 3162 | return nil, err |
| 3163 | } |
| 3164 | logger.Debug(ctx, "send SIPUserData-create-msg done") |
| 3165 | return meInstance, nil |
| 3166 | } |
| 3167 | logger.Errorw(ctx, "Cannot generate SIPUserData Instance", log.Fields{"Err": omciErr.GetError(), |
| 3168 | "device-id": oo.deviceID}) |
| 3169 | return nil, omciErr.GetError() |
| 3170 | } |
| 3171 | |
| 3172 | // SendSetSIPUserData nolint: unused |
| 3173 | func (oo *OmciCC) SendSetSIPUserData(ctx context.Context, timeout int, highPrio bool, |
| 3174 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 3175 | tid := oo.GetNextTid(highPrio) |
| 3176 | logger.Debugw(ctx, "send SIPUserData-set-msg:", log.Fields{"device-id": oo.deviceID, |
| 3177 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3178 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 3179 | |
| 3180 | meInstance, omciErr := me.NewSipUserData(params[0]) |
| 3181 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3182 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid), |
| 3183 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3184 | if err != nil { |
| 3185 | logger.Errorw(ctx, "Cannot encode SIPUserData for set", log.Fields{"Err": err, |
| 3186 | "device-id": oo.deviceID}) |
| 3187 | return nil, err |
| 3188 | } |
| 3189 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3190 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3191 | if err != nil { |
| 3192 | logger.Errorw(ctx, "Cannot serialize SIPUserData set", log.Fields{"Err": err, |
| 3193 | "device-id": oo.deviceID}) |
| 3194 | return nil, err |
| 3195 | } |
| 3196 | |
| 3197 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 3198 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3199 | } |
| 3200 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3201 | if err != nil { |
| 3202 | logger.Errorw(ctx, "Cannot send SIPUserData set", log.Fields{"Err": err, |
| 3203 | "device-id": oo.deviceID}) |
| 3204 | return nil, err |
| 3205 | } |
| 3206 | logger.Debug(ctx, "send SIPUserData-set-msg done") |
| 3207 | return meInstance, nil |
| 3208 | } |
| 3209 | logger.Errorw(ctx, "Cannot generate SIPUserData Instance", log.Fields{"Err": omciErr.GetError(), |
| 3210 | "device-id": oo.deviceID}) |
| 3211 | return nil, omciErr.GetError() |
| 3212 | } |
| 3213 | |
| 3214 | // SendDeleteSIPUserData nolint: unused |
| 3215 | func (oo *OmciCC) SendDeleteSIPUserData(ctx context.Context, timeout int, highPrio bool, |
| 3216 | rxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) { |
| 3217 | tid := oo.GetNextTid(highPrio) |
| 3218 | logger.Debugw(ctx, "send SIPUserData-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
| 3219 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3220 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 3221 | |
| 3222 | meParams := me.ParamData{EntityID: aInstID} |
| 3223 | meInstance, omciErr := me.NewSipUserData(meParams) |
| 3224 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3225 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 3226 | oframe.TransactionID(tid)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3227 | if err != nil { |
| 3228 | logger.Errorw(ctx, "Cannot encode SIPUserData for delete", log.Fields{ |
| 3229 | "Err": err, "device-id": oo.deviceID}) |
| 3230 | return nil, err |
| 3231 | } |
| 3232 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3233 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3234 | if err != nil { |
| 3235 | logger.Errorw(ctx, "Cannot serialize SIPUserData delete", log.Fields{ |
| 3236 | "Err": err, "device-id": oo.deviceID}) |
| 3237 | return nil, err |
| 3238 | } |
| 3239 | |
| 3240 | omciRxCallbackPair := CallbackPair{ |
| 3241 | CbKey: tid, |
| 3242 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3243 | } |
| 3244 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3245 | if err != nil { |
| 3246 | logger.Errorw(ctx, "Cannot send SIPUserData delete", log.Fields{ |
| 3247 | "Err": err, "device-id": oo.deviceID}) |
| 3248 | return nil, err |
| 3249 | } |
| 3250 | logger.Debug(ctx, "send SIPUserData-Delete-msg done") |
| 3251 | return meInstance, nil |
| 3252 | } |
| 3253 | logger.Errorw(ctx, "Cannot generate SIPUserData Instance for delete", log.Fields{ |
| 3254 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 3255 | return nil, omciErr.GetError() |
| 3256 | } |
| 3257 | |
| 3258 | // SendCreateVoipApplicationServiceProfile nolint: unused |
| 3259 | func (oo *OmciCC) SendCreateVoipApplicationServiceProfile(ctx context.Context, timeout int, highPrio bool, |
| 3260 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 3261 | tid := oo.GetNextTid(highPrio) |
| 3262 | logger.Debugw(ctx, "send VoipApplicationServiceProfile-create-msg:", log.Fields{"device-id": oo.deviceID, |
| 3263 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3264 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 3265 | |
| 3266 | meInstance, omciErr := me.NewVoipApplicationServiceProfile(params[0]) |
| 3267 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3268 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 3269 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3270 | if err != nil { |
| 3271 | logger.Errorw(ctx, "Cannot encode VoipApplicationServiceProfile for create", log.Fields{"Err": err, |
| 3272 | "device-id": oo.deviceID}) |
| 3273 | return nil, err |
| 3274 | } |
| 3275 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3276 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3277 | if err != nil { |
| 3278 | logger.Errorw(ctx, "Cannot serialize VoipApplicationServiceProfile create", log.Fields{"Err": err, |
| 3279 | "device-id": oo.deviceID}) |
| 3280 | return nil, err |
| 3281 | } |
| 3282 | |
| 3283 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 3284 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3285 | } |
| 3286 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3287 | if err != nil { |
| 3288 | logger.Errorw(ctx, "Cannot send VoipApplicationServiceProfile create", log.Fields{"Err": err, |
| 3289 | "device-id": oo.deviceID}) |
| 3290 | return nil, err |
| 3291 | } |
| 3292 | logger.Debug(ctx, "send VoipApplicationServiceProfile-create-msg done") |
| 3293 | return meInstance, nil |
| 3294 | } |
| 3295 | logger.Errorw(ctx, "Cannot generate VoipApplicationServiceProfile Instance", log.Fields{"Err": omciErr.GetError(), |
| 3296 | "device-id": oo.deviceID}) |
| 3297 | return nil, omciErr.GetError() |
| 3298 | } |
| 3299 | |
| 3300 | // SendSetVoipApplicationServiceProfile nolint: unused |
| 3301 | func (oo *OmciCC) SendSetVoipApplicationServiceProfile(ctx context.Context, timeout int, highPrio bool, |
| 3302 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 3303 | tid := oo.GetNextTid(highPrio) |
| 3304 | logger.Debugw(ctx, "send VoipApplicationServiceProfile-set-msg:", log.Fields{"device-id": oo.deviceID, |
| 3305 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3306 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 3307 | |
| 3308 | meInstance, omciErr := me.NewVoipApplicationServiceProfile(params[0]) |
| 3309 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3310 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid), |
| 3311 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3312 | if err != nil { |
| 3313 | logger.Errorw(ctx, "Cannot encode VoipApplicationServiceProfile for set", log.Fields{"Err": err, |
| 3314 | "device-id": oo.deviceID}) |
| 3315 | return nil, err |
| 3316 | } |
| 3317 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3318 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3319 | if err != nil { |
| 3320 | logger.Errorw(ctx, "Cannot serialize VoipApplicationServiceProfile set", log.Fields{"Err": err, |
| 3321 | "device-id": oo.deviceID}) |
| 3322 | return nil, err |
| 3323 | } |
| 3324 | |
| 3325 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 3326 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3327 | } |
| 3328 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3329 | if err != nil { |
| 3330 | logger.Errorw(ctx, "Cannot send VoipApplicationServiceProfile set", log.Fields{"Err": err, |
| 3331 | "device-id": oo.deviceID}) |
| 3332 | return nil, err |
| 3333 | } |
| 3334 | logger.Debug(ctx, "send VoipApplicationServiceProfile-set-msg done") |
| 3335 | return meInstance, nil |
| 3336 | } |
| 3337 | logger.Errorw(ctx, "Cannot generate VoipApplicationServiceProfile Instance", log.Fields{"Err": omciErr.GetError(), |
| 3338 | "device-id": oo.deviceID}) |
| 3339 | return nil, omciErr.GetError() |
| 3340 | } |
| 3341 | |
| 3342 | // SendDeleteVoipApplicationServiceProfile nolint: unused |
| 3343 | func (oo *OmciCC) SendDeleteVoipApplicationServiceProfile(ctx context.Context, timeout int, highPrio bool, |
| 3344 | rxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) { |
| 3345 | tid := oo.GetNextTid(highPrio) |
| 3346 | logger.Debugw(ctx, "send SIPVoipApplicationServiceProfile-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
| 3347 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3348 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 3349 | |
| 3350 | meParams := me.ParamData{EntityID: aInstID} |
| 3351 | meInstance, omciErr := me.NewVoipApplicationServiceProfile(meParams) |
| 3352 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3353 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 3354 | oframe.TransactionID(tid)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3355 | if err != nil { |
| 3356 | logger.Errorw(ctx, "Cannot encode SIPVoipApplicationServiceProfile for delete", log.Fields{ |
| 3357 | "Err": err, "device-id": oo.deviceID}) |
| 3358 | return nil, err |
| 3359 | } |
| 3360 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3361 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3362 | if err != nil { |
| 3363 | logger.Errorw(ctx, "Cannot serialize SIPVoipApplicationServiceProfile delete", log.Fields{ |
| 3364 | "Err": err, "device-id": oo.deviceID}) |
| 3365 | return nil, err |
| 3366 | } |
| 3367 | |
| 3368 | omciRxCallbackPair := CallbackPair{ |
| 3369 | CbKey: tid, |
| 3370 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3371 | } |
| 3372 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3373 | if err != nil { |
| 3374 | logger.Errorw(ctx, "Cannot send SIPVoipApplicationServiceProfile delete", log.Fields{ |
| 3375 | "Err": err, "device-id": oo.deviceID}) |
| 3376 | return nil, err |
| 3377 | } |
| 3378 | logger.Debug(ctx, "send SIPVoipApplicationServiceProfile-Delete-msg done") |
| 3379 | return meInstance, nil |
| 3380 | } |
| 3381 | logger.Errorw(ctx, "Cannot generate SIPVoipApplicationServiceProfile Instance for delete", log.Fields{ |
| 3382 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 3383 | return nil, omciErr.GetError() |
| 3384 | } |
| 3385 | |
| 3386 | // SendCreateSIPAgentConfigData nolint: unused |
| 3387 | func (oo *OmciCC) SendCreateSIPAgentConfigData(ctx context.Context, timeout int, highPrio bool, |
| 3388 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 3389 | tid := oo.GetNextTid(highPrio) |
| 3390 | logger.Debugw(ctx, "send SIPAgentConfigData-create-msg:", log.Fields{"device-id": oo.deviceID, |
| 3391 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3392 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 3393 | |
| 3394 | meInstance, omciErr := me.NewSipAgentConfigData(params[0]) |
| 3395 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3396 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 3397 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3398 | if err != nil { |
| 3399 | logger.Errorw(ctx, "Cannot encode SIPAgentConfigData for create", log.Fields{"Err": err, |
| 3400 | "device-id": oo.deviceID}) |
| 3401 | return nil, err |
| 3402 | } |
| 3403 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3404 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3405 | if err != nil { |
| 3406 | logger.Errorw(ctx, "Cannot serialize SIPAgentConfigData create", log.Fields{"Err": err, |
| 3407 | "device-id": oo.deviceID}) |
| 3408 | return nil, err |
| 3409 | } |
| 3410 | |
| 3411 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 3412 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3413 | } |
| 3414 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3415 | if err != nil { |
| 3416 | logger.Errorw(ctx, "Cannot send SIPAgentConfigData create", log.Fields{"Err": err, |
| 3417 | "device-id": oo.deviceID}) |
| 3418 | return nil, err |
| 3419 | } |
| 3420 | logger.Debug(ctx, "send SIPAgentConfigData-create-msg done") |
| 3421 | return meInstance, nil |
| 3422 | } |
| 3423 | logger.Errorw(ctx, "Cannot generate SIPAgentConfigData Instance", log.Fields{"Err": omciErr.GetError(), |
| 3424 | "device-id": oo.deviceID}) |
| 3425 | return nil, omciErr.GetError() |
| 3426 | } |
| 3427 | |
| 3428 | // SendSetSIPAgentConfigData nolint: unused |
| 3429 | func (oo *OmciCC) SendSetSIPAgentConfigData(ctx context.Context, timeout int, highPrio bool, |
| 3430 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 3431 | tid := oo.GetNextTid(highPrio) |
| 3432 | logger.Debugw(ctx, "send SIPAgentConfigData-set-msg:", log.Fields{"device-id": oo.deviceID, |
| 3433 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3434 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 3435 | |
| 3436 | meInstance, omciErr := me.NewSipAgentConfigData(params[0]) |
| 3437 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3438 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid), |
| 3439 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3440 | if err != nil { |
| 3441 | logger.Errorw(ctx, "Cannot encode SIPAgentConfigData for set", log.Fields{"Err": err, |
| 3442 | "device-id": oo.deviceID}) |
| 3443 | return nil, err |
| 3444 | } |
| 3445 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3446 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3447 | if err != nil { |
| 3448 | logger.Errorw(ctx, "Cannot serialize SIPAgentConfigData set", log.Fields{"Err": err, |
| 3449 | "device-id": oo.deviceID}) |
| 3450 | return nil, err |
| 3451 | } |
| 3452 | |
| 3453 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 3454 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3455 | } |
| 3456 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3457 | if err != nil { |
| 3458 | logger.Errorw(ctx, "Cannot send SIPAgentConfigData set", log.Fields{"Err": err, |
| 3459 | "device-id": oo.deviceID}) |
| 3460 | return nil, err |
| 3461 | } |
| 3462 | logger.Debug(ctx, "send SIPAgentConfigData-set-msg done") |
| 3463 | return meInstance, nil |
| 3464 | } |
| 3465 | logger.Errorw(ctx, "Cannot generate SIPAgentConfigData Instance", log.Fields{"Err": omciErr.GetError(), |
| 3466 | "device-id": oo.deviceID}) |
| 3467 | return nil, omciErr.GetError() |
| 3468 | } |
| 3469 | |
| 3470 | // SendDeleteSIPAgentConfigData nolint: unused |
| 3471 | func (oo *OmciCC) SendDeleteSIPAgentConfigData(ctx context.Context, timeout int, highPrio bool, |
| 3472 | rxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) { |
| 3473 | tid := oo.GetNextTid(highPrio) |
| 3474 | logger.Debugw(ctx, "send SIPAgentConfigData-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
| 3475 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3476 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 3477 | |
| 3478 | meParams := me.ParamData{EntityID: aInstID} |
| 3479 | meInstance, omciErr := me.NewSipAgentConfigData(meParams) |
| 3480 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3481 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 3482 | oframe.TransactionID(tid)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3483 | if err != nil { |
| 3484 | logger.Errorw(ctx, "Cannot encode SIPAgentConfigData for delete", log.Fields{ |
| 3485 | "Err": err, "device-id": oo.deviceID}) |
| 3486 | return nil, err |
| 3487 | } |
| 3488 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3489 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3490 | if err != nil { |
| 3491 | logger.Errorw(ctx, "Cannot serialize SIPAgentConfigData delete", log.Fields{ |
| 3492 | "Err": err, "device-id": oo.deviceID}) |
| 3493 | return nil, err |
| 3494 | } |
| 3495 | |
| 3496 | omciRxCallbackPair := CallbackPair{ |
| 3497 | CbKey: tid, |
| 3498 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3499 | } |
| 3500 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3501 | if err != nil { |
| 3502 | logger.Errorw(ctx, "Cannot send SIPAgentConfigData delete", log.Fields{ |
| 3503 | "Err": err, "device-id": oo.deviceID}) |
| 3504 | return nil, err |
| 3505 | } |
| 3506 | logger.Debug(ctx, "send SIPAgentConfigData-Delete-msg done") |
| 3507 | return meInstance, nil |
| 3508 | } |
| 3509 | logger.Errorw(ctx, "Cannot generate SIPAgentConfigData Instance for delete", log.Fields{ |
| 3510 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 3511 | return nil, omciErr.GetError() |
| 3512 | } |
| 3513 | |
| 3514 | // SendCreateTCPUDPConfigData nolint: unused |
| 3515 | func (oo *OmciCC) SendCreateTCPUDPConfigData(ctx context.Context, timeout int, highPrio bool, |
| 3516 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 3517 | tid := oo.GetNextTid(highPrio) |
| 3518 | logger.Debugw(ctx, "send TCPUDPConfigData-create-msg:", log.Fields{"device-id": oo.deviceID, |
| 3519 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3520 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 3521 | |
| 3522 | meInstance, omciErr := me.NewTcpUdpConfigData(params[0]) |
| 3523 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3524 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 3525 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3526 | if err != nil { |
| 3527 | logger.Errorw(ctx, "Cannot encode TCPUDPConfigData for create", log.Fields{"Err": err, |
| 3528 | "device-id": oo.deviceID}) |
| 3529 | return nil, err |
| 3530 | } |
| 3531 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3532 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3533 | if err != nil { |
| 3534 | logger.Errorw(ctx, "Cannot serialize TCPUDPConfigData create", log.Fields{"Err": err, |
| 3535 | "device-id": oo.deviceID}) |
| 3536 | return nil, err |
| 3537 | } |
| 3538 | |
| 3539 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 3540 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3541 | } |
| 3542 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3543 | if err != nil { |
| 3544 | logger.Errorw(ctx, "Cannot send TCPUDPConfigData create", log.Fields{"Err": err, |
| 3545 | "device-id": oo.deviceID}) |
| 3546 | return nil, err |
| 3547 | } |
| 3548 | logger.Debug(ctx, "send TCPUDPConfigData-create-msg done") |
| 3549 | return meInstance, nil |
| 3550 | } |
| 3551 | logger.Errorw(ctx, "Cannot generate TCPUDPConfigData Instance", log.Fields{"Err": omciErr.GetError(), |
| 3552 | "device-id": oo.deviceID}) |
| 3553 | return nil, omciErr.GetError() |
| 3554 | } |
| 3555 | |
| 3556 | // SendSetTCPUDPConfigData nolint: unused |
| 3557 | func (oo *OmciCC) SendSetTCPUDPConfigData(ctx context.Context, timeout int, highPrio bool, |
| 3558 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 3559 | tid := oo.GetNextTid(highPrio) |
| 3560 | logger.Debugw(ctx, "send TCPUDPConfigData-set-msg:", log.Fields{"device-id": oo.deviceID, |
| 3561 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3562 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 3563 | |
| 3564 | meInstance, omciErr := me.NewTcpUdpConfigData(params[0]) |
| 3565 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3566 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid), |
| 3567 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3568 | if err != nil { |
| 3569 | logger.Errorw(ctx, "Cannot encode TCPUDPConfigData for set", log.Fields{"Err": err, |
| 3570 | "device-id": oo.deviceID}) |
| 3571 | return nil, err |
| 3572 | } |
| 3573 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3574 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3575 | if err != nil { |
| 3576 | logger.Errorw(ctx, "Cannot serialize TCPUDPConfigData set", log.Fields{"Err": err, |
| 3577 | "device-id": oo.deviceID}) |
| 3578 | return nil, err |
| 3579 | } |
| 3580 | |
| 3581 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 3582 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3583 | } |
| 3584 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3585 | if err != nil { |
| 3586 | logger.Errorw(ctx, "Cannot send TCPUDPConfigData set", log.Fields{"Err": err, |
| 3587 | "device-id": oo.deviceID}) |
| 3588 | return nil, err |
| 3589 | } |
| 3590 | logger.Debug(ctx, "send TCPUDPConfigData-set-msg done") |
| 3591 | return meInstance, nil |
| 3592 | } |
| 3593 | logger.Errorw(ctx, "Cannot generate TCPUDPConfigData Instance", log.Fields{"Err": omciErr.GetError(), |
| 3594 | "device-id": oo.deviceID}) |
| 3595 | return nil, omciErr.GetError() |
| 3596 | } |
| 3597 | |
| 3598 | // SendDeleteTCPUDPConfigData nolint: unused |
| 3599 | func (oo *OmciCC) SendDeleteTCPUDPConfigData(ctx context.Context, timeout int, highPrio bool, |
| 3600 | rxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) { |
| 3601 | tid := oo.GetNextTid(highPrio) |
| 3602 | logger.Debugw(ctx, "send TCPUDPConfigData-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
| 3603 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3604 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 3605 | |
| 3606 | meParams := me.ParamData{EntityID: aInstID} |
| 3607 | meInstance, omciErr := me.NewTcpUdpConfigData(meParams) |
| 3608 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3609 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 3610 | oframe.TransactionID(tid)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3611 | if err != nil { |
| 3612 | logger.Errorw(ctx, "Cannot encode TCPUDPConfigData for delete", log.Fields{ |
| 3613 | "Err": err, "device-id": oo.deviceID}) |
| 3614 | return nil, err |
| 3615 | } |
| 3616 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3617 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3618 | if err != nil { |
| 3619 | logger.Errorw(ctx, "Cannot serialize TCPUDPConfigData delete", log.Fields{ |
| 3620 | "Err": err, "device-id": oo.deviceID}) |
| 3621 | return nil, err |
| 3622 | } |
| 3623 | |
| 3624 | omciRxCallbackPair := CallbackPair{ |
| 3625 | CbKey: tid, |
| 3626 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3627 | } |
| 3628 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3629 | if err != nil { |
| 3630 | logger.Errorw(ctx, "Cannot send TCPUDPConfigData delete", log.Fields{ |
| 3631 | "Err": err, "device-id": oo.deviceID}) |
| 3632 | return nil, err |
| 3633 | } |
| 3634 | logger.Debug(ctx, "send TCPUDPConfigData-Delete-msg done") |
| 3635 | return meInstance, nil |
| 3636 | } |
| 3637 | logger.Errorw(ctx, "Cannot generate SIPAgentConfigData Instance for delete", log.Fields{ |
| 3638 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 3639 | return nil, omciErr.GetError() |
| 3640 | } |
| 3641 | |
| 3642 | // SendCreateIPHostConfigData nolint: unused |
| 3643 | func (oo *OmciCC) SendCreateIPHostConfigData(ctx context.Context, timeout int, highPrio bool, |
| 3644 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 3645 | tid := oo.GetNextTid(highPrio) |
| 3646 | logger.Debugw(ctx, "send IPHostConfigData-create-msg:", log.Fields{"device-id": oo.deviceID, |
| 3647 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3648 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 3649 | |
| 3650 | meInstance, omciErr := me.NewIpHostConfigData(params[0]) |
| 3651 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3652 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 3653 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3654 | if err != nil { |
| 3655 | logger.Errorw(ctx, "Cannot encode IPHostConfigData for create", log.Fields{"Err": err, |
| 3656 | "device-id": oo.deviceID}) |
| 3657 | return nil, err |
| 3658 | } |
| 3659 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3660 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3661 | if err != nil { |
| 3662 | logger.Errorw(ctx, "Cannot serialize IPHostConfigData create", log.Fields{"Err": err, |
| 3663 | "device-id": oo.deviceID}) |
| 3664 | return nil, err |
| 3665 | } |
| 3666 | |
| 3667 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 3668 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3669 | } |
| 3670 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3671 | if err != nil { |
| 3672 | logger.Errorw(ctx, "Cannot send IPHostConfigData create", log.Fields{"Err": err, |
| 3673 | "device-id": oo.deviceID}) |
| 3674 | return nil, err |
| 3675 | } |
| 3676 | logger.Debug(ctx, "send IPHostConfigData-create-msg done") |
| 3677 | return meInstance, nil |
| 3678 | } |
| 3679 | logger.Errorw(ctx, "Cannot generate IPHostConfigData Instance", log.Fields{"Err": omciErr.GetError(), |
| 3680 | "device-id": oo.deviceID}) |
| 3681 | return nil, omciErr.GetError() |
| 3682 | } |
| 3683 | |
| 3684 | // SendSetIPHostConfigData nolint: unused |
| 3685 | func (oo *OmciCC) SendSetIPHostConfigData(ctx context.Context, timeout int, highPrio bool, |
| 3686 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 3687 | tid := oo.GetNextTid(highPrio) |
| 3688 | logger.Debugw(ctx, "send IPHostConfigData-set-msg:", log.Fields{"device-id": oo.deviceID, |
| 3689 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3690 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 3691 | |
| 3692 | meInstance, omciErr := me.NewIpHostConfigData(params[0]) |
| 3693 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3694 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid), |
| 3695 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3696 | if err != nil { |
| 3697 | logger.Errorw(ctx, "Cannot encode IPHostConfigData for set", log.Fields{"Err": err, |
| 3698 | "device-id": oo.deviceID}) |
| 3699 | return nil, err |
| 3700 | } |
| 3701 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3702 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3703 | if err != nil { |
| 3704 | logger.Errorw(ctx, "Cannot serialize IPHostConfigData set", log.Fields{"Err": err, |
| 3705 | "device-id": oo.deviceID}) |
| 3706 | return nil, err |
| 3707 | } |
| 3708 | |
| 3709 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 3710 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3711 | } |
| 3712 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3713 | if err != nil { |
| 3714 | logger.Errorw(ctx, "Cannot send IPHostConfigData set", log.Fields{"Err": err, |
| 3715 | "device-id": oo.deviceID}) |
| 3716 | return nil, err |
| 3717 | } |
| 3718 | logger.Debug(ctx, "send IPHostConfigData-set-msg done") |
| 3719 | return meInstance, nil |
| 3720 | } |
| 3721 | logger.Errorw(ctx, "Cannot generate IPHostConfigData Instance", log.Fields{"Err": omciErr.GetError(), |
| 3722 | "device-id": oo.deviceID}) |
| 3723 | return nil, omciErr.GetError() |
| 3724 | } |
| 3725 | |
| 3726 | // SendDeleteIPHostConfigData nolint: unused |
| 3727 | func (oo *OmciCC) SendDeleteIPHostConfigData(ctx context.Context, timeout int, highPrio bool, |
| 3728 | rxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) { |
| 3729 | tid := oo.GetNextTid(highPrio) |
| 3730 | logger.Debugw(ctx, "send IPHostConfigData-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
| 3731 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3732 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 3733 | |
| 3734 | meParams := me.ParamData{EntityID: aInstID} |
| 3735 | meInstance, omciErr := me.NewIpHostConfigData(meParams) |
| 3736 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3737 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 3738 | oframe.TransactionID(tid)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3739 | if err != nil { |
| 3740 | logger.Errorw(ctx, "Cannot encode IPHostConfigData for delete", log.Fields{ |
| 3741 | "Err": err, "device-id": oo.deviceID}) |
| 3742 | return nil, err |
| 3743 | } |
| 3744 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3745 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3746 | if err != nil { |
| 3747 | logger.Errorw(ctx, "Cannot serialize IPHostConfigData delete", log.Fields{ |
| 3748 | "Err": err, "device-id": oo.deviceID}) |
| 3749 | return nil, err |
| 3750 | } |
| 3751 | |
| 3752 | omciRxCallbackPair := CallbackPair{ |
| 3753 | CbKey: tid, |
| 3754 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3755 | } |
| 3756 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3757 | if err != nil { |
| 3758 | logger.Errorw(ctx, "Cannot send IPHostConfigData delete", log.Fields{ |
| 3759 | "Err": err, "device-id": oo.deviceID}) |
| 3760 | return nil, err |
| 3761 | } |
| 3762 | logger.Debug(ctx, "send IPHostConfigData-Delete-msg done") |
| 3763 | return meInstance, nil |
| 3764 | } |
| 3765 | logger.Errorw(ctx, "Cannot generate IPHostConfigData Instance for delete", log.Fields{ |
| 3766 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 3767 | return nil, omciErr.GetError() |
| 3768 | } |
| 3769 | |
| 3770 | // SendCreateRTPProfileData nolint: unused |
| 3771 | func (oo *OmciCC) SendCreateRTPProfileData(ctx context.Context, timeout int, highPrio bool, |
| 3772 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 3773 | tid := oo.GetNextTid(highPrio) |
| 3774 | logger.Debugw(ctx, "send RTPProfileData-create-msg:", log.Fields{"device-id": oo.deviceID, |
| 3775 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3776 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 3777 | |
| 3778 | meInstance, omciErr := me.NewRtpProfileData(params[0]) |
| 3779 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3780 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 3781 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3782 | if err != nil { |
| 3783 | logger.Errorw(ctx, "Cannot encode RTPProfileData for create", log.Fields{"Err": err, |
| 3784 | "device-id": oo.deviceID}) |
| 3785 | return nil, err |
| 3786 | } |
| 3787 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3788 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3789 | if err != nil { |
| 3790 | logger.Errorw(ctx, "Cannot serialize RTPProfileData create", log.Fields{"Err": err, |
| 3791 | "device-id": oo.deviceID}) |
| 3792 | return nil, err |
| 3793 | } |
| 3794 | |
| 3795 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 3796 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3797 | } |
| 3798 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3799 | if err != nil { |
| 3800 | logger.Errorw(ctx, "Cannot send RTPProfileData create", log.Fields{"Err": err, |
| 3801 | "device-id": oo.deviceID}) |
| 3802 | return nil, err |
| 3803 | } |
| 3804 | logger.Debug(ctx, "send RTPProfileData-create-msg done") |
| 3805 | return meInstance, nil |
| 3806 | } |
| 3807 | logger.Errorw(ctx, "Cannot generate RTPProfileData Instance", log.Fields{"Err": omciErr.GetError(), |
| 3808 | "device-id": oo.deviceID}) |
| 3809 | return nil, omciErr.GetError() |
| 3810 | } |
| 3811 | |
| 3812 | // SendSetRTPProfileData nolint: unused |
| 3813 | func (oo *OmciCC) SendSetRTPProfileData(ctx context.Context, timeout int, highPrio bool, |
| 3814 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 3815 | tid := oo.GetNextTid(highPrio) |
| 3816 | logger.Debugw(ctx, "send RTPProfileData-set-msg:", log.Fields{"device-id": oo.deviceID, |
| 3817 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3818 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 3819 | |
| 3820 | meInstance, omciErr := me.NewRtpProfileData(params[0]) |
| 3821 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3822 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid), |
| 3823 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3824 | if err != nil { |
| 3825 | logger.Errorw(ctx, "Cannot encode RTPProfileData for set", log.Fields{"Err": err, |
| 3826 | "device-id": oo.deviceID}) |
| 3827 | return nil, err |
| 3828 | } |
| 3829 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3830 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3831 | if err != nil { |
| 3832 | logger.Errorw(ctx, "Cannot serialize RTPProfileData set", log.Fields{"Err": err, |
| 3833 | "device-id": oo.deviceID}) |
| 3834 | return nil, err |
| 3835 | } |
| 3836 | |
| 3837 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 3838 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3839 | } |
| 3840 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3841 | if err != nil { |
| 3842 | logger.Errorw(ctx, "Cannot send RTPProfileData set", log.Fields{"Err": err, |
| 3843 | "device-id": oo.deviceID}) |
| 3844 | return nil, err |
| 3845 | } |
| 3846 | logger.Debug(ctx, "send RTPProfileData-set-msg done") |
| 3847 | return meInstance, nil |
| 3848 | } |
| 3849 | logger.Errorw(ctx, "Cannot generate RTPProfileData Instance", log.Fields{"Err": omciErr.GetError(), |
| 3850 | "device-id": oo.deviceID}) |
| 3851 | return nil, omciErr.GetError() |
| 3852 | } |
| 3853 | |
| 3854 | // SendDeleteRTPProfileData nolint: unused |
| 3855 | func (oo *OmciCC) SendDeleteRTPProfileData(ctx context.Context, timeout int, highPrio bool, |
| 3856 | rxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) { |
| 3857 | tid := oo.GetNextTid(highPrio) |
| 3858 | logger.Debugw(ctx, "send RTPProfileData-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
| 3859 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3860 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 3861 | |
| 3862 | meParams := me.ParamData{EntityID: aInstID} |
| 3863 | meInstance, omciErr := me.NewRtpProfileData(meParams) |
| 3864 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3865 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 3866 | oframe.TransactionID(tid)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3867 | if err != nil { |
| 3868 | logger.Errorw(ctx, "Cannot encode RTPProfileData for delete", log.Fields{ |
| 3869 | "Err": err, "device-id": oo.deviceID}) |
| 3870 | return nil, err |
| 3871 | } |
| 3872 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3873 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3874 | if err != nil { |
| 3875 | logger.Errorw(ctx, "Cannot serialize RTPProfileData delete", log.Fields{ |
| 3876 | "Err": err, "device-id": oo.deviceID}) |
| 3877 | return nil, err |
| 3878 | } |
| 3879 | |
| 3880 | omciRxCallbackPair := CallbackPair{ |
| 3881 | CbKey: tid, |
| 3882 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3883 | } |
| 3884 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3885 | if err != nil { |
| 3886 | logger.Errorw(ctx, "Cannot send RTPProfileData delete", log.Fields{ |
| 3887 | "Err": err, "device-id": oo.deviceID}) |
| 3888 | return nil, err |
| 3889 | } |
| 3890 | logger.Debug(ctx, "send RTPProfileData-Delete-msg done") |
| 3891 | return meInstance, nil |
| 3892 | } |
| 3893 | logger.Errorw(ctx, "Cannot generate RTPProfileData Instance for delete", log.Fields{ |
| 3894 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 3895 | return nil, omciErr.GetError() |
| 3896 | } |
| 3897 | |
| 3898 | // SendCreateNetworkDialPlanTable nolint: unused |
| 3899 | func (oo *OmciCC) SendCreateNetworkDialPlanTable(ctx context.Context, timeout int, highPrio bool, |
| 3900 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 3901 | tid := oo.GetNextTid(highPrio) |
| 3902 | logger.Debugw(ctx, "send NetworkDialPlanTable-create-msg:", log.Fields{"device-id": oo.deviceID, |
| 3903 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3904 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 3905 | |
| 3906 | meInstance, omciErr := me.NewNetworkDialPlanTable(params[0]) |
| 3907 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3908 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 3909 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3910 | if err != nil { |
| 3911 | logger.Errorw(ctx, "Cannot encode NetworkDialPlanTable for create", log.Fields{"Err": err, |
| 3912 | "device-id": oo.deviceID}) |
| 3913 | return nil, err |
| 3914 | } |
| 3915 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3916 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3917 | if err != nil { |
| 3918 | logger.Errorw(ctx, "Cannot serialize NetworkDialPlanTable create", log.Fields{"Err": err, |
| 3919 | "device-id": oo.deviceID}) |
| 3920 | return nil, err |
| 3921 | } |
| 3922 | |
| 3923 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 3924 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3925 | } |
| 3926 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3927 | if err != nil { |
| 3928 | logger.Errorw(ctx, "Cannot send NetworkDialPlanTable create", log.Fields{"Err": err, |
| 3929 | "device-id": oo.deviceID}) |
| 3930 | return nil, err |
| 3931 | } |
| 3932 | logger.Debug(ctx, "send NetworkDialPlanTable-create-msg done") |
| 3933 | return meInstance, nil |
| 3934 | } |
| 3935 | logger.Errorw(ctx, "Cannot generate NetworkDialPlanTable Instance", log.Fields{"Err": omciErr.GetError(), |
| 3936 | "device-id": oo.deviceID}) |
| 3937 | return nil, omciErr.GetError() |
| 3938 | } |
| 3939 | |
| 3940 | // SendSetNetworkDialPlanTable nolint: unused |
| 3941 | func (oo *OmciCC) SendSetNetworkDialPlanTable(ctx context.Context, timeout int, highPrio bool, |
| 3942 | rxChan chan Message, params ...me.ParamData) (*me.ManagedEntity, error) { |
| 3943 | tid := oo.GetNextTid(highPrio) |
| 3944 | logger.Debugw(ctx, "send NetworkDialPlanTable-set-msg:", log.Fields{"device-id": oo.deviceID, |
| 3945 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3946 | "InstId": strconv.FormatInt(int64(params[0].EntityID), 16)}) |
| 3947 | |
| 3948 | meInstance, omciErr := me.NewNetworkDialPlanTable(params[0]) |
| 3949 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3950 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid), |
| 3951 | oframe.AddDefaults(true)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3952 | if err != nil { |
| 3953 | logger.Errorw(ctx, "Cannot encode NetworkDialPlanTable for set", log.Fields{"Err": err, |
| 3954 | "device-id": oo.deviceID}) |
| 3955 | return nil, err |
| 3956 | } |
| 3957 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 3958 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3959 | if err != nil { |
| 3960 | logger.Errorw(ctx, "Cannot serialize NetworkDialPlanTable set", log.Fields{"Err": err, |
| 3961 | "device-id": oo.deviceID}) |
| 3962 | return nil, err |
| 3963 | } |
| 3964 | |
| 3965 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 3966 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 3967 | } |
| 3968 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 3969 | if err != nil { |
| 3970 | logger.Errorw(ctx, "Cannot send NetworkDialPlanTable set", log.Fields{"Err": err, |
| 3971 | "device-id": oo.deviceID}) |
| 3972 | return nil, err |
| 3973 | } |
| 3974 | logger.Debug(ctx, "send NetworkDialPlanTable-set-msg done") |
| 3975 | return meInstance, nil |
| 3976 | } |
| 3977 | logger.Errorw(ctx, "Cannot generate NetworkDialPlanTable Instance", log.Fields{"Err": omciErr.GetError(), |
| 3978 | "device-id": oo.deviceID}) |
| 3979 | return nil, omciErr.GetError() |
| 3980 | } |
| 3981 | |
| 3982 | // SendDeleteNetworkDialPlanTable nolint: unused |
| 3983 | func (oo *OmciCC) SendDeleteNetworkDialPlanTable(ctx context.Context, timeout int, highPrio bool, |
| 3984 | rxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) { |
| 3985 | tid := oo.GetNextTid(highPrio) |
| 3986 | logger.Debugw(ctx, "send NetworkDialPlanTable-Delete-msg:", log.Fields{"device-id": oo.deviceID, |
| 3987 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 3988 | "InstId": strconv.FormatInt(int64(aInstID), 16)}) |
| 3989 | |
| 3990 | meParams := me.ParamData{EntityID: aInstID} |
| 3991 | meInstance, omciErr := me.NewNetworkDialPlanTable(meParams) |
| 3992 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 3993 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType, |
| 3994 | oframe.TransactionID(tid)) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 3995 | if err != nil { |
| 3996 | logger.Errorw(ctx, "Cannot encode NetworkDialPlanTable for delete", log.Fields{ |
| 3997 | "Err": err, "device-id": oo.deviceID}) |
| 3998 | return nil, err |
| 3999 | } |
| 4000 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 4001 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
ozgecanetsia | 0e3111f | 2021-10-19 18:04:15 +0300 | [diff] [blame] | 4002 | if err != nil { |
| 4003 | logger.Errorw(ctx, "Cannot serialize NetworkDialPlanTable delete", log.Fields{ |
| 4004 | "Err": err, "device-id": oo.deviceID}) |
| 4005 | return nil, err |
| 4006 | } |
| 4007 | |
| 4008 | omciRxCallbackPair := CallbackPair{ |
| 4009 | CbKey: tid, |
| 4010 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 4011 | } |
| 4012 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 4013 | if err != nil { |
| 4014 | logger.Errorw(ctx, "Cannot send NetworkDialPlanTable delete", log.Fields{ |
| 4015 | "Err": err, "device-id": oo.deviceID}) |
| 4016 | return nil, err |
| 4017 | } |
| 4018 | logger.Debug(ctx, "send NetworkDialPlanTable-Delete-msg done") |
| 4019 | return meInstance, nil |
| 4020 | } |
| 4021 | logger.Errorw(ctx, "Cannot generate NetworkDialPlanTable Instance for delete", log.Fields{ |
| 4022 | "Err": omciErr.GetError(), "device-id": oo.deviceID}) |
| 4023 | return nil, omciErr.GetError() |
| 4024 | } |
| 4025 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4026 | // SendSyncTime sends SynchronizeTimeRequest |
| 4027 | func (oo *OmciCC) SendSyncTime(ctx context.Context, timeout int, highPrio bool, rxChan chan Message) error { |
| 4028 | tid := oo.GetNextTid(highPrio) |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4029 | logger.Debugw(ctx, "send synchronize time request:", log.Fields{"device-id": oo.deviceID, |
| 4030 | "SequNo": strconv.FormatInt(int64(tid), 16)}) |
| 4031 | |
| 4032 | omciLayer := &omci.OMCI{ |
| 4033 | TransactionID: tid, |
| 4034 | MessageType: omci.SynchronizeTimeRequestType, |
| 4035 | // DeviceIdentifier: omci.BaselineIdent, // Optional, defaults to Baseline |
| 4036 | // Length: 0x28, // Optional, defaults to 40 octets |
| 4037 | } |
| 4038 | utcTime := time.Now().UTC() |
| 4039 | request := &omci.SynchronizeTimeRequest{ |
| 4040 | MeBasePacket: omci.MeBasePacket{ |
| 4041 | EntityClass: me.OnuGClassID, |
| 4042 | // Default Instance ID is 0 |
| 4043 | }, |
| 4044 | Year: uint16(utcTime.Year()), |
| 4045 | Month: uint8(utcTime.Month()), |
| 4046 | Day: uint8(utcTime.Day()), |
| 4047 | Hour: uint8(utcTime.Hour()), |
| 4048 | Minute: uint8(utcTime.Minute()), |
| 4049 | Second: uint8(utcTime.Second()), |
| 4050 | } |
| 4051 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 4052 | pkt, err := SerializeOmciLayer(ctx, omciLayer, request) |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4053 | if err != nil { |
| 4054 | logger.Errorw(ctx, "Cannot serialize synchronize time request", log.Fields{"Err": err, |
| 4055 | "device-id": oo.deviceID}) |
| 4056 | return err |
| 4057 | } |
| 4058 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4059 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 4060 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4061 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4062 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4063 | if err != nil { |
| 4064 | logger.Errorw(ctx, "Cannot send synchronize time request", log.Fields{"Err": err, |
| 4065 | "device-id": oo.deviceID}) |
| 4066 | return err |
| 4067 | } |
| 4068 | logger.Debug(ctx, "send synchronize time request done") |
| 4069 | return nil |
| 4070 | } |
| 4071 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4072 | // SendCreateOrDeleteEthernetPerformanceMonitoringHistoryME creates or deletes EthernetFramePerformanceMonitoringHistoryData ME instance |
| 4073 | func (oo *OmciCC) SendCreateOrDeleteEthernetPerformanceMonitoringHistoryME(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4074 | upstream bool, create bool, rxChan chan Message, entityID uint16) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4075 | tid := oo.GetNextTid(highPrio) |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4076 | logger.Debugw(ctx, "send ethernet-performance-monitoring-history-me-msg:", log.Fields{"device-id": oo.deviceID, |
| 4077 | "SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(entityID), 16), "create": create, "upstream": upstream}) |
| 4078 | meParam := me.ParamData{EntityID: entityID} |
| 4079 | var meInstance *me.ManagedEntity |
| 4080 | var omciErr me.OmciErrors |
| 4081 | if upstream { |
| 4082 | meInstance, omciErr = me.NewEthernetFramePerformanceMonitoringHistoryDataUpstream(meParam) |
| 4083 | } else { |
| 4084 | meInstance, omciErr = me.NewEthernetFramePerformanceMonitoringHistoryDataDownstream(meParam) |
| 4085 | } |
| 4086 | if omciErr.GetError() == nil { |
| 4087 | var omciLayer *omci.OMCI |
| 4088 | var msgLayer gopacket.SerializableLayer |
| 4089 | var err error |
| 4090 | if create { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 4091 | omciLayer, msgLayer, err = oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 4092 | oframe.AddDefaults(true)) |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4093 | } else { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 4094 | omciLayer, msgLayer, err = oframe.EncodeFrame(meInstance, omci.DeleteRequestType, oframe.TransactionID(tid), |
| 4095 | oframe.AddDefaults(true)) |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4096 | } |
| 4097 | if err != nil { |
| 4098 | logger.Errorw(ctx, "Cannot encode ethernet frame performance monitoring history data ME", |
| 4099 | log.Fields{"Err": err, "device-id": oo.deviceID, "upstream": upstream, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4100 | return nil, err |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4101 | } |
| 4102 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 4103 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4104 | if err != nil { |
| 4105 | logger.Errorw(ctx, "Cannot serialize ethernet frame performance monitoring history data ME", |
| 4106 | log.Fields{"Err": err, "device-id": oo.deviceID, "upstream": upstream, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4107 | return nil, err |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4108 | } |
| 4109 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4110 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 4111 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4112 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4113 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4114 | if err != nil { |
| 4115 | logger.Errorw(ctx, "Cannot send ethernet frame performance monitoring history data ME", |
| 4116 | log.Fields{"Err": err, "device-id": oo.deviceID, "upstream": upstream, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4117 | return nil, err |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4118 | } |
| 4119 | logger.Debugw(ctx, "send ethernet frame performance monitoring history data ME done", |
| 4120 | log.Fields{"device-id": oo.deviceID, "upstream": upstream, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4121 | return meInstance, nil |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4122 | } |
| 4123 | logger.Errorw(ctx, "Cannot generate ethernet frame performance monitoring history data ME Instance", |
| 4124 | log.Fields{"Err": omciErr.GetError(), "device-id": oo.deviceID, "upstream": upstream, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4125 | return nil, omciErr.GetError() |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4126 | } |
| 4127 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4128 | // SendCreateOrDeleteEthernetUniHistoryME creates or deletes EthernetPerformanceMonitoringHistoryData ME instance |
| 4129 | func (oo *OmciCC) SendCreateOrDeleteEthernetUniHistoryME(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4130 | create bool, rxChan chan Message, entityID uint16) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4131 | tid := oo.GetNextTid(highPrio) |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4132 | logger.Debugw(ctx, "send ethernet-uni-history-me-msg:", log.Fields{"device-id": oo.deviceID, |
| 4133 | "SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(entityID), 16), "create": create}) |
| 4134 | meParam := me.ParamData{EntityID: entityID} |
| 4135 | var meInstance *me.ManagedEntity |
| 4136 | var omciErr me.OmciErrors |
| 4137 | meInstance, omciErr = me.NewEthernetPerformanceMonitoringHistoryData(meParam) |
| 4138 | |
| 4139 | if omciErr.GetError() == nil { |
| 4140 | var omciLayer *omci.OMCI |
| 4141 | var msgLayer gopacket.SerializableLayer |
| 4142 | var err error |
| 4143 | if create { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 4144 | omciLayer, msgLayer, err = oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 4145 | oframe.AddDefaults(true)) |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4146 | } else { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 4147 | omciLayer, msgLayer, err = oframe.EncodeFrame(meInstance, omci.DeleteRequestType, oframe.TransactionID(tid), |
| 4148 | oframe.AddDefaults(true)) |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4149 | } |
| 4150 | if err != nil { |
| 4151 | logger.Errorw(ctx, "Cannot encode ethernet uni history data ME", |
| 4152 | log.Fields{"Err": err, "device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4153 | return nil, err |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4154 | } |
| 4155 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 4156 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4157 | if err != nil { |
| 4158 | logger.Errorw(ctx, "Cannot serialize ethernet uni history data ME", |
| 4159 | log.Fields{"Err": err, "device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4160 | return nil, err |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4161 | } |
| 4162 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4163 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 4164 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4165 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4166 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4167 | if err != nil { |
| 4168 | logger.Errorw(ctx, "Cannot send ethernet uni history data ME", |
| 4169 | log.Fields{"Err": err, "device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4170 | return nil, err |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4171 | } |
| 4172 | logger.Debugw(ctx, "send ethernet uni history data ME done", |
| 4173 | log.Fields{"device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4174 | return meInstance, nil |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4175 | } |
| 4176 | logger.Errorw(ctx, "Cannot generate ethernet uni history data ME Instance", |
| 4177 | log.Fields{"Err": omciErr.GetError(), "device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4178 | return nil, omciErr.GetError() |
Girish Gowdra | e0140f0 | 2021-02-02 16:55:09 -0800 | [diff] [blame] | 4179 | } |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4180 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4181 | // SendCreateOrDeleteFecHistoryME creates or deletes FecPerformanceMonitoringHistoryData ME instance |
| 4182 | func (oo *OmciCC) SendCreateOrDeleteFecHistoryME(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4183 | create bool, rxChan chan Message, entityID uint16) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4184 | tid := oo.GetNextTid(highPrio) |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4185 | logger.Debugw(ctx, "send fec-history-me-msg:", log.Fields{"device-id": oo.deviceID, |
| 4186 | "SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(entityID), 16), "create": create}) |
| 4187 | meParam := me.ParamData{EntityID: entityID} |
| 4188 | var meInstance *me.ManagedEntity |
| 4189 | var omciErr me.OmciErrors |
| 4190 | meInstance, omciErr = me.NewFecPerformanceMonitoringHistoryData(meParam) |
| 4191 | |
| 4192 | if omciErr.GetError() == nil { |
| 4193 | var omciLayer *omci.OMCI |
| 4194 | var msgLayer gopacket.SerializableLayer |
| 4195 | var err error |
| 4196 | if create { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 4197 | omciLayer, msgLayer, err = oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 4198 | oframe.AddDefaults(true)) |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4199 | } else { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 4200 | omciLayer, msgLayer, err = oframe.EncodeFrame(meInstance, omci.DeleteRequestType, oframe.TransactionID(tid), |
| 4201 | oframe.AddDefaults(true)) |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4202 | } |
| 4203 | if err != nil { |
| 4204 | logger.Errorw(ctx, "Cannot encode fec history data ME", |
| 4205 | log.Fields{"Err": err, "device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4206 | return nil, err |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4207 | } |
| 4208 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 4209 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4210 | if err != nil { |
| 4211 | logger.Errorw(ctx, "Cannot serialize fec history data ME", |
| 4212 | log.Fields{"Err": err, "device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4213 | return nil, err |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4214 | } |
| 4215 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4216 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 4217 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4218 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4219 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4220 | if err != nil { |
| 4221 | logger.Errorw(ctx, "Cannot send fec history data ME", |
| 4222 | log.Fields{"Err": err, "device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4223 | return nil, err |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4224 | } |
| 4225 | logger.Debugw(ctx, "send fec history data ME done", |
| 4226 | log.Fields{"device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4227 | return meInstance, nil |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4228 | } |
| 4229 | logger.Errorw(ctx, "Cannot generate fec history data ME Instance", |
| 4230 | log.Fields{"Err": omciErr.GetError(), "device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4231 | return nil, omciErr.GetError() |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4232 | } |
| 4233 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4234 | // SendCreateOrDeleteGemPortHistoryME deletes GemPortNetworkCtpPerformanceMonitoringHistoryData ME instance |
| 4235 | func (oo *OmciCC) SendCreateOrDeleteGemPortHistoryME(ctx context.Context, timeout int, highPrio bool, |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4236 | create bool, rxChan chan Message, entityID uint16) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4237 | tid := oo.GetNextTid(highPrio) |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4238 | logger.Debugw(ctx, "send gemport-history-me-msg:", log.Fields{"device-id": oo.deviceID, |
| 4239 | "SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(entityID), 16), "create": create}) |
| 4240 | meParam := me.ParamData{EntityID: entityID} |
| 4241 | var meInstance *me.ManagedEntity |
| 4242 | var omciErr me.OmciErrors |
| 4243 | meInstance, omciErr = me.NewGemPortNetworkCtpPerformanceMonitoringHistoryData(meParam) |
| 4244 | |
| 4245 | if omciErr.GetError() == nil { |
| 4246 | var omciLayer *omci.OMCI |
| 4247 | var msgLayer gopacket.SerializableLayer |
| 4248 | var err error |
| 4249 | if create { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 4250 | omciLayer, msgLayer, err = oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 4251 | oframe.AddDefaults(true)) |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4252 | } else { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 4253 | omciLayer, msgLayer, err = oframe.EncodeFrame(meInstance, omci.DeleteRequestType, oframe.TransactionID(tid), |
| 4254 | oframe.AddDefaults(true)) |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4255 | } |
| 4256 | if err != nil { |
| 4257 | logger.Errorw(ctx, "Cannot encode gemport history data ME", |
| 4258 | log.Fields{"Err": err, "device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4259 | return nil, err |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4260 | } |
| 4261 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 4262 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4263 | if err != nil { |
| 4264 | logger.Errorw(ctx, "Cannot serialize gemport history data ME", |
| 4265 | log.Fields{"Err": err, "device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4266 | return nil, err |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4267 | } |
| 4268 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4269 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 4270 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4271 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4272 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4273 | if err != nil { |
| 4274 | logger.Errorw(ctx, "Cannot send gemport history data ME", |
| 4275 | log.Fields{"Err": err, "device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4276 | return nil, err |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4277 | } |
| 4278 | logger.Debugw(ctx, "send gemport history data ME done", |
| 4279 | log.Fields{"device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4280 | return meInstance, nil |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4281 | } |
| 4282 | logger.Errorw(ctx, "Cannot generate gemport history data ME Instance", |
| 4283 | log.Fields{"Err": omciErr.GetError(), "device-id": oo.deviceID, "create": create, "InstId": strconv.FormatInt(int64(entityID), 16)}) |
ozgecanetsia | b36ed57 | 2021-04-01 10:38:48 +0300 | [diff] [blame] | 4284 | return nil, omciErr.GetError() |
Girish Gowdra | 5c5aaf4 | 2021-02-17 19:40:50 -0800 | [diff] [blame] | 4285 | } |
| 4286 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4287 | // SendStartSoftwareDownload sends StartSoftwareDownloadRequest |
| 4288 | func (oo *OmciCC) SendStartSoftwareDownload(ctx context.Context, timeout int, highPrio bool, |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4289 | rxChan chan Message, aImageMeID uint16, aDownloadWindowSize uint8, aFileLen uint32, aIsExtendedOmci bool) error { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4290 | tid := oo.GetNextTid(highPrio) |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4291 | logger.Debugw(ctx, "send StartSwDlRequest:", log.Fields{"device-id": oo.deviceID, |
| 4292 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 4293 | "InstId": strconv.FormatInt(int64(aImageMeID), 16)}) |
| 4294 | |
| 4295 | omciLayer := &omci.OMCI{ |
| 4296 | TransactionID: tid, |
| 4297 | MessageType: omci.StartSoftwareDownloadRequestType, |
| 4298 | // DeviceIdentifier: omci.BaselineIdent, // Optional, defaults to Baseline |
| 4299 | // Length: 0x28, // Optional, defaults to 40 octets |
| 4300 | } |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4301 | if aIsExtendedOmci { |
| 4302 | omciLayer.DeviceIdentifier = omci.ExtendedIdent |
| 4303 | } |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4304 | request := &omci.StartSoftwareDownloadRequest{ |
| 4305 | MeBasePacket: omci.MeBasePacket{ |
| 4306 | EntityClass: me.SoftwareImageClassID, |
| 4307 | EntityInstance: aImageMeID, //inactive image |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4308 | Extended: aIsExtendedOmci, |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4309 | }, |
| 4310 | WindowSize: aDownloadWindowSize, |
| 4311 | ImageSize: aFileLen, |
| 4312 | NumberOfCircuitPacks: 1, //parallel download to multiple circuit packs not supported |
| 4313 | CircuitPacks: []uint16{0}, //circuit pack indication don't care for NumberOfCircuitPacks=1, but needed by omci-lib |
| 4314 | } |
| 4315 | |
| 4316 | var options gopacket.SerializeOptions |
| 4317 | options.FixLengths = true |
| 4318 | buffer := gopacket.NewSerializeBuffer() |
| 4319 | err := gopacket.SerializeLayers(buffer, options, omciLayer, request) |
| 4320 | if err != nil { |
| 4321 | logger.Errorw(ctx, "Cannot serialize StartSwDlRequest", log.Fields{"Err": err, |
| 4322 | "device-id": oo.deviceID}) |
| 4323 | return err |
| 4324 | } |
| 4325 | outgoingPacket := buffer.Bytes() |
| 4326 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4327 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 4328 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4329 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4330 | err = oo.Send(ctx, outgoingPacket, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4331 | if err != nil { |
| 4332 | logger.Errorw(ctx, "Cannot send StartSwDlRequest", log.Fields{"Err": err, |
| 4333 | "device-id": oo.deviceID}) |
| 4334 | return err |
| 4335 | } |
| 4336 | logger.Debug(ctx, "send StartSwDlRequest done") |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4337 | return nil |
| 4338 | } |
| 4339 | |
kesavand | 011d516 | 2021-11-25 19:21:06 +0530 | [diff] [blame] | 4340 | // PrepareOnuSectionsOfWindow prepares a list of sections for each window |
| 4341 | //Before invoking this function the oo.mutexTid needs to be be locked so that |
| 4342 | //GetOnuSwSecNextTid can be invoked without further locking |
| 4343 | func (oo *OmciCC) PrepareOnuSectionsOfWindow(ctx context.Context, |
| 4344 | aImageMeID uint16, aAckRequest uint8, aDownloadSectionNo uint8, aSection []byte, |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4345 | omciMsgsPerWindow *ia.OmciMessages, aIsExtendedOmci bool) (OmciTransferStructure, error) { |
kesavand | 011d516 | 2021-11-25 19:21:06 +0530 | [diff] [blame] | 4346 | //onuswsections uses only low prioirity tids |
| 4347 | tid := oo.GetOnuSwSecNextTid() |
| 4348 | logger.Infow(ctx, "send DlSectionRequest:", log.Fields{"device-id": oo.deviceID, |
| 4349 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 4350 | "InstId": strconv.FormatInt(int64(aImageMeID), 16), "omci-ack": aAckRequest, "sectionNo": aDownloadSectionNo, "sectionData": aSection}) |
| 4351 | |
| 4352 | var omciTxReq OmciTransferStructure |
| 4353 | msgType := omci.DownloadSectionRequestType |
| 4354 | |
| 4355 | if aAckRequest > 0 { |
| 4356 | msgType = omci.DownloadSectionRequestWithResponseType |
| 4357 | |
| 4358 | } |
| 4359 | omciLayer := &omci.OMCI{ |
| 4360 | TransactionID: tid, |
| 4361 | MessageType: msgType, |
| 4362 | // DeviceIdentifier: omci.BaselineIdent, // Optional, defaults to Baseline |
| 4363 | // Length: 0x28, // Optional, defaults to 40 octets |
| 4364 | } |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4365 | if aIsExtendedOmci { |
| 4366 | omciLayer.DeviceIdentifier = omci.ExtendedIdent |
| 4367 | } |
kesavand | 011d516 | 2021-11-25 19:21:06 +0530 | [diff] [blame] | 4368 | localSectionData := make([]byte, len(aSection)) |
| 4369 | |
| 4370 | copy(localSectionData[:], aSection) // as long as DownloadSectionRequest defines array for SectionData we need to copy into the array |
| 4371 | request := &omci.DownloadSectionRequest{ |
| 4372 | MeBasePacket: omci.MeBasePacket{ |
| 4373 | EntityClass: me.SoftwareImageClassID, |
| 4374 | EntityInstance: aImageMeID, //inactive image |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4375 | Extended: aIsExtendedOmci, |
kesavand | 011d516 | 2021-11-25 19:21:06 +0530 | [diff] [blame] | 4376 | }, |
| 4377 | SectionNumber: aDownloadSectionNo, |
| 4378 | SectionData: localSectionData, |
| 4379 | } |
| 4380 | |
| 4381 | var options gopacket.SerializeOptions |
| 4382 | options.FixLengths = true |
| 4383 | buffer := gopacket.NewSerializeBuffer() |
| 4384 | err := gopacket.SerializeLayers(buffer, options, omciLayer, request) |
| 4385 | if err != nil { |
| 4386 | logger.Errorw(ctx, "Cannot serialize DlSectionRequest", log.Fields{"Err": err, |
| 4387 | "device-id": oo.deviceID}) |
| 4388 | return omciTxReq, err |
| 4389 | } |
| 4390 | outgoingPacket := buffer.Bytes() |
| 4391 | |
| 4392 | omciMsgsPerWindow.Messages = append(omciMsgsPerWindow.Messages, outgoingPacket) |
| 4393 | |
| 4394 | if aAckRequest > 0 { |
| 4395 | // only the last section should have a timeout as an ack is required only for the last section of the window |
| 4396 | omciTxReq = OmciTransferStructure{ |
| 4397 | withFramePrint: true, |
| 4398 | OnuSwWindow: omciMsgsPerWindow, |
| 4399 | } |
| 4400 | return omciTxReq, nil |
| 4401 | } |
| 4402 | |
| 4403 | return omciTxReq, nil |
| 4404 | } |
| 4405 | |
| 4406 | //SendOnuSwSectionsWindowWithRxSupervision sends onu swd sections |
| 4407 | func (oo *OmciCC) SendOnuSwSectionsWindowWithRxSupervision(ctx context.Context, |
| 4408 | aOmciTxRequest OmciTransferStructure, aTimeout int, rxChan chan Message) { |
| 4409 | if aOmciTxRequest.OnuSwWindow == nil { |
| 4410 | logger.Errorw(ctx, "SendOnuSwSectionsWindowWithRxSupervision: omciTxRequest.OnuSwWindow is nil", |
| 4411 | log.Fields{"device-id": oo.deviceID}) |
| 4412 | return |
| 4413 | |
| 4414 | } |
| 4415 | |
| 4416 | tid := oo.GetOnuSwSecLastTid() |
| 4417 | logger.Debugw(ctx, "SendOnuSwSectionsWindowWithRxSupervision tid for the last segment is ", log.Fields{"TID": tid}) |
| 4418 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 4419 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 4420 | } |
| 4421 | |
| 4422 | aOmciTxRequest.cbPair = omciRxCallbackPair |
| 4423 | logger.Debugw(ctx, "register-response-callback:", log.Fields{"for TansCorrId": aOmciTxRequest.cbPair.CbKey}) |
| 4424 | oo.mutexRxSchedMap.Lock() |
| 4425 | // it could be checked, if the callback key is already registered - but simply overwrite may be acceptable ... |
| 4426 | oo.rxSchedulerMap[aOmciTxRequest.cbPair.CbKey] = aOmciTxRequest.cbPair.CbEntry |
| 4427 | oo.mutexRxSchedMap.Unlock() |
| 4428 | |
| 4429 | chSuccess := make(chan bool) |
| 4430 | aOmciTxRequest.chSuccess = chSuccess |
| 4431 | aOmciTxRequest.timeout = aTimeout |
| 4432 | aOmciTxRequest.retries = CDefaultRetries |
| 4433 | |
| 4434 | //tid := aOmciTxRequest.cbPair.CbKey |
| 4435 | oo.mutexMonReq.Lock() |
| 4436 | oo.monitoredRequests[tid] = aOmciTxRequest |
| 4437 | oo.mutexMonReq.Unlock() |
| 4438 | |
| 4439 | retries := aOmciTxRequest.retries |
| 4440 | retryCounter := 0 |
| 4441 | if aTimeout == 0 { |
| 4442 | logger.Errorw(ctx, "no timeout present for last section of window", log.Fields{"device-id": oo.deviceID}) |
| 4443 | return |
| 4444 | } |
| 4445 | loop: |
| 4446 | for retryCounter <= retries { |
| 4447 | // the onu sw sections are enqueued only to the low priority queue |
| 4448 | oo.mutexLowPrioTxQueue.Lock() |
| 4449 | oo.lowPrioTxQueue.PushBack(aOmciTxRequest) |
| 4450 | oo.mutexLowPrioTxQueue.Unlock() |
| 4451 | |
| 4452 | go oo.sendQueuedRequests(ctx) |
| 4453 | |
| 4454 | select { |
| 4455 | case success := <-chSuccess: |
| 4456 | if success { |
| 4457 | logger.Debugw(ctx, "reqMon: response received in time", |
| 4458 | log.Fields{"tid": tid, "device-id": oo.deviceID}) |
| 4459 | } else { |
| 4460 | logger.Debugw(ctx, "reqMon: wait for response aborted", |
| 4461 | log.Fields{"tid": tid, "device-id": oo.deviceID}) |
| 4462 | } |
| 4463 | break loop |
| 4464 | case <-time.After(time.Duration(aTimeout) * time.Second): |
| 4465 | if retryCounter == retries { |
Holger Hildebrandt | 2b10764 | 2022-12-09 07:56:23 +0000 | [diff] [blame] | 4466 | if oo.pBaseDeviceHandler.IsOltAvailable() { |
| 4467 | logger.Errorw(ctx, "reqMon: timeout waiting for response - no of max retries reached - send ONU device event!", |
| 4468 | log.Fields{"tid": tid, "retries": retryCounter, "device-id": oo.deviceID}) |
| 4469 | oo.pOnuDeviceEntry.SendOnuDeviceEvent(ctx, OnuOmciCommunicationFailureSwUpgrade, OnuOmciCommunicationFailureSwUpgradeDesc) |
| 4470 | } else { |
| 4471 | logger.Errorw(ctx, "reqMon: timeout waiting for response - no of max retries reached - skip ONU device event: OLT unavailable!", |
| 4472 | log.Fields{"tid": tid, "retries": retryCounter, "device-id": oo.deviceID}) |
| 4473 | } |
Holger Hildebrandt | 66af5ce | 2022-09-07 13:38:02 +0000 | [diff] [blame] | 4474 | oo.incrementTxTimesouts() |
kesavand | 011d516 | 2021-11-25 19:21:06 +0530 | [diff] [blame] | 4475 | break loop |
| 4476 | } else { |
| 4477 | logger.Infow(ctx, "reqMon: timeout waiting for response - retry", |
| 4478 | log.Fields{"tid": tid, "retries": retryCounter, "device-id": oo.deviceID}) |
Holger Hildebrandt | 66af5ce | 2022-09-07 13:38:02 +0000 | [diff] [blame] | 4479 | oo.incrementTxRetries() |
kesavand | 011d516 | 2021-11-25 19:21:06 +0530 | [diff] [blame] | 4480 | } |
| 4481 | } |
| 4482 | retryCounter++ |
| 4483 | } |
| 4484 | oo.mutexMonReq.Lock() |
| 4485 | delete(oo.monitoredRequests, tid) |
| 4486 | oo.mutexMonReq.Unlock() |
| 4487 | } |
| 4488 | |
| 4489 | func (oo *OmciCC) sendOnuSwSectionsOfWindow(ctx context.Context, omciTxRequest OmciTransferStructure) error { |
Holger Hildebrandt | 66af5ce | 2022-09-07 13:38:02 +0000 | [diff] [blame] | 4490 | var lastSection []byte |
| 4491 | if omciTxRequest.OnuSwWindow != nil { |
| 4492 | lastSection = omciTxRequest.OnuSwWindow.Messages[len(omciTxRequest.OnuSwWindow.Messages)-1] |
| 4493 | } else { |
| 4494 | logger.Errorw(ctx, "invalid sw window received", log.Fields{"device-id": oo.deviceID}) |
| 4495 | return fmt.Errorf("invalid sw window received") |
| 4496 | } |
| 4497 | if omciTxRequest.withFramePrint { |
| 4498 | logger.Debugw(ctx, "sw-section-omci-message-to-send:", log.Fields{ |
kesavand | 011d516 | 2021-11-25 19:21:06 +0530 | [diff] [blame] | 4499 | "TxOmciMessage": hex.EncodeToString(lastSection), |
| 4500 | "device-id": oo.deviceID, |
| 4501 | "toDeviceType": oo.pBaseDeviceHandler.GetProxyAddressType(), |
| 4502 | "proxyDeviceID": oo.pBaseDeviceHandler.GetProxyAddressID(), |
| 4503 | "proxyAddress": oo.pBaseDeviceHandler.GetProxyAddress()}) |
| 4504 | } |
| 4505 | sendErr := oo.pBaseDeviceHandler.SendOnuSwSectionsOfWindow(ctx, oo.pBaseDeviceHandler.GetProxyAddress().AdapterEndpoint, omciTxRequest.OnuSwWindow) |
| 4506 | if sendErr != nil { |
Holger Hildebrandt | 66af5ce | 2022-09-07 13:38:02 +0000 | [diff] [blame] | 4507 | logger.Errorw(ctx, "send onu sw sections omci request error", log.Fields{"device-id": oo.deviceID, "error": sendErr}) |
kesavand | 011d516 | 2021-11-25 19:21:06 +0530 | [diff] [blame] | 4508 | return sendErr |
| 4509 | } |
Holger Hildebrandt | 66af5ce | 2022-09-07 13:38:02 +0000 | [diff] [blame] | 4510 | numberOfNoArSections := len(omciTxRequest.OnuSwWindow.Messages) - 1 // last section of window is sent with AR expected |
| 4511 | if lastSection[cOmciDeviceIdentifierPos] == byte(omci.BaselineIdent) { |
| 4512 | oo.increaseBaseTxNoArFramesBy(ctx, uint32(numberOfNoArSections)) |
| 4513 | oo.incrementBaseTxArFrames() |
| 4514 | } else { |
| 4515 | oo.increaseExtTxNoArFramesBy(ctx, uint32(numberOfNoArSections)) |
| 4516 | oo.incrementExtTxArFrames() |
| 4517 | } |
kesavand | 011d516 | 2021-11-25 19:21:06 +0530 | [diff] [blame] | 4518 | return nil |
| 4519 | } |
| 4520 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4521 | // SendDownloadSection sends DownloadSectionRequestWithResponse |
| 4522 | func (oo *OmciCC) SendDownloadSection(ctx context.Context, aTimeout int, highPrio bool, |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4523 | rxChan chan Message, aImageMeID uint16, aAckRequest uint8, aDownloadSectionNo uint8, aSection []byte, aPrint bool, aIsExtendedOmci bool) error { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4524 | tid := oo.GetNextTid(highPrio) |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4525 | logger.Debugw(ctx, "send DlSectionRequest:", log.Fields{"device-id": oo.deviceID, |
| 4526 | "SequNo": strconv.FormatInt(int64(tid), 16), |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4527 | "InstId": strconv.FormatInt(int64(aImageMeID), 16), "omci-ack": aAckRequest}) |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4528 | |
| 4529 | //TODO!!!: don't know by now on how to generate the possibly needed AR (or enforce it to 0) with current omci-lib |
| 4530 | // by now just try to send it as defined by omci-lib |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4531 | msgType := omci.DownloadSectionRequestType |
mpagenko | c26d4c0 | 2021-05-06 14:27:57 +0000 | [diff] [blame] | 4532 | var timeout int = 0 //default value for no response expected |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4533 | if aAckRequest > 0 { |
| 4534 | msgType = omci.DownloadSectionRequestWithResponseType |
mpagenko | c26d4c0 | 2021-05-06 14:27:57 +0000 | [diff] [blame] | 4535 | timeout = aTimeout |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4536 | } |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4537 | omciLayer := &omci.OMCI{ |
| 4538 | TransactionID: tid, |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4539 | MessageType: msgType, |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4540 | // DeviceIdentifier: omci.BaselineIdent, // Optional, defaults to Baseline |
| 4541 | // Length: 0x28, // Optional, defaults to 40 octets |
| 4542 | } |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4543 | if aIsExtendedOmci { |
| 4544 | omciLayer.DeviceIdentifier = omci.ExtendedIdent |
| 4545 | } |
Himani Chawla | 43f95ff | 2021-06-03 00:24:12 +0530 | [diff] [blame] | 4546 | localSectionData := make([]byte, len(aSection)) |
| 4547 | |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4548 | copy(localSectionData[:], aSection) // as long as DownloadSectionRequest defines array for SectionData we need to copy into the array |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4549 | request := &omci.DownloadSectionRequest{ |
| 4550 | MeBasePacket: omci.MeBasePacket{ |
| 4551 | EntityClass: me.SoftwareImageClassID, |
| 4552 | EntityInstance: aImageMeID, //inactive image |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4553 | Extended: aIsExtendedOmci, |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4554 | }, |
| 4555 | SectionNumber: aDownloadSectionNo, |
| 4556 | SectionData: localSectionData, |
| 4557 | } |
| 4558 | |
| 4559 | var options gopacket.SerializeOptions |
| 4560 | options.FixLengths = true |
| 4561 | buffer := gopacket.NewSerializeBuffer() |
| 4562 | err := gopacket.SerializeLayers(buffer, options, omciLayer, request) |
| 4563 | if err != nil { |
| 4564 | logger.Errorw(ctx, "Cannot serialize DlSectionRequest", log.Fields{"Err": err, |
| 4565 | "device-id": oo.deviceID}) |
| 4566 | return err |
| 4567 | } |
| 4568 | outgoingPacket := buffer.Bytes() |
| 4569 | |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4570 | //for initial debug purpose overrule the requested print state for some frames |
| 4571 | printFrame := aPrint |
| 4572 | if aAckRequest > 0 || aDownloadSectionNo == 0 { |
| 4573 | printFrame = true |
| 4574 | } |
| 4575 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4576 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
mpagenko | c26d4c0 | 2021-05-06 14:27:57 +0000 | [diff] [blame] | 4577 | // the callback is set even though no response might be required here, the tid (key) setting is needed here anyway |
| 4578 | // (used to avoid retransmission of frames with the same TID) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4579 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, printFrame /*aPrint*/}, |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4580 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4581 | err = oo.Send(ctx, outgoingPacket, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4582 | if err != nil { |
| 4583 | logger.Errorw(ctx, "Cannot send DlSectionRequest", log.Fields{"Err": err, |
| 4584 | "device-id": oo.deviceID}) |
| 4585 | return err |
| 4586 | } |
| 4587 | logger.Debug(ctx, "send DlSectionRequest done") |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4588 | return nil |
| 4589 | } |
| 4590 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4591 | //SendEndSoftwareDownload sends EndSoftwareDownloadRequest |
| 4592 | func (oo *OmciCC) SendEndSoftwareDownload(ctx context.Context, timeout int, highPrio bool, |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4593 | rxChan chan Message, aImageMeID uint16, aFileLen uint32, aImageCrc uint32, aIsExtendedOmci bool) error { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4594 | tid := oo.GetNextTid(highPrio) |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4595 | logger.Debugw(ctx, "send EndSwDlRequest:", log.Fields{"device-id": oo.deviceID, |
| 4596 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 4597 | "InstId": strconv.FormatInt(int64(aImageMeID), 16)}) |
| 4598 | |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4599 | omciLayer := &omci.OMCI{ |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4600 | TransactionID: tid, |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4601 | MessageType: omci.EndSoftwareDownloadRequestType, |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4602 | // DeviceIdentifier: omci.BaselineIdent, // Optional, defaults to Baseline |
| 4603 | // Length: 0x28, // Optional, defaults to 40 octets |
| 4604 | } |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4605 | if aIsExtendedOmci { |
| 4606 | omciLayer.DeviceIdentifier = omci.ExtendedIdent |
| 4607 | } |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4608 | request := &omci.EndSoftwareDownloadRequest{ |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4609 | MeBasePacket: omci.MeBasePacket{ |
| 4610 | EntityClass: me.SoftwareImageClassID, |
| 4611 | EntityInstance: aImageMeID, //inactive image |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4612 | Extended: aIsExtendedOmci, |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4613 | }, |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4614 | CRC32: aImageCrc, |
| 4615 | ImageSize: aFileLen, |
| 4616 | NumberOfInstances: 1, //parallel download to multiple circuit packs not supported |
| 4617 | ImageInstances: []uint16{0}, //don't care for NumberOfInstances=1, but probably needed by omci-lib as in startSwDlRequest |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4618 | } |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4619 | |
| 4620 | var options gopacket.SerializeOptions |
| 4621 | options.FixLengths = true |
| 4622 | buffer := gopacket.NewSerializeBuffer() |
| 4623 | err := gopacket.SerializeLayers(buffer, options, omciLayer, request) |
| 4624 | if err != nil { |
| 4625 | logger.Errorw(ctx, "Cannot serialize EndSwDlRequest", log.Fields{"Err": err, |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4626 | "device-id": oo.deviceID}) |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4627 | return err |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4628 | } |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4629 | outgoingPacket := buffer.Bytes() |
| 4630 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4631 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 4632 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4633 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4634 | err = oo.Send(ctx, outgoingPacket, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4635 | if err != nil { |
| 4636 | logger.Errorw(ctx, "Cannot send EndSwDlRequest", log.Fields{"Err": err, |
| 4637 | "device-id": oo.deviceID}) |
| 4638 | return err |
| 4639 | } |
| 4640 | logger.Debug(ctx, "send EndSwDlRequest done") |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4641 | return nil |
| 4642 | } |
| 4643 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4644 | // SendActivateSoftware sends ActivateSoftwareRequest |
| 4645 | func (oo *OmciCC) SendActivateSoftware(ctx context.Context, timeout int, highPrio bool, |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4646 | rxChan chan Message, aImageMeID uint16, aIsExtendedOmci bool) error { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4647 | tid := oo.GetNextTid(highPrio) |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4648 | logger.Debugw(ctx, "send ActivateSwRequest:", log.Fields{"device-id": oo.deviceID, |
| 4649 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 4650 | "InstId": strconv.FormatInt(int64(aImageMeID), 16)}) |
| 4651 | |
| 4652 | omciLayer := &omci.OMCI{ |
| 4653 | TransactionID: tid, |
| 4654 | MessageType: omci.ActivateSoftwareRequestType, |
| 4655 | // DeviceIdentifier: omci.BaselineIdent, // Optional, defaults to Baseline |
| 4656 | // Length: 0x28, // Optional, defaults to 40 octets |
| 4657 | } |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4658 | if aIsExtendedOmci { |
| 4659 | omciLayer.DeviceIdentifier = omci.ExtendedIdent |
| 4660 | } |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4661 | request := &omci.ActivateSoftwareRequest{ |
| 4662 | MeBasePacket: omci.MeBasePacket{ |
| 4663 | EntityClass: me.SoftwareImageClassID, |
| 4664 | EntityInstance: aImageMeID, //inactive image |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4665 | Extended: aIsExtendedOmci, |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4666 | }, |
| 4667 | ActivateFlags: 0, //unconditionally reset as the only relevant option here (regardless of VOIP) |
| 4668 | } |
| 4669 | |
| 4670 | var options gopacket.SerializeOptions |
| 4671 | options.FixLengths = true |
| 4672 | buffer := gopacket.NewSerializeBuffer() |
| 4673 | err := gopacket.SerializeLayers(buffer, options, omciLayer, request) |
| 4674 | if err != nil { |
| 4675 | logger.Errorw(ctx, "Cannot serialize ActivateSwRequest", log.Fields{"Err": err, |
| 4676 | "device-id": oo.deviceID}) |
| 4677 | return err |
| 4678 | } |
| 4679 | outgoingPacket := buffer.Bytes() |
| 4680 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4681 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 4682 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4683 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4684 | err = oo.Send(ctx, outgoingPacket, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4685 | if err != nil { |
| 4686 | logger.Errorw(ctx, "Cannot send ActivateSwRequest", log.Fields{"Err": err, |
| 4687 | "device-id": oo.deviceID}) |
| 4688 | return err |
| 4689 | } |
| 4690 | logger.Debug(ctx, "send ActivateSwRequest done") |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4691 | return nil |
| 4692 | } |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4693 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4694 | // SendCommitSoftware sends CommitSoftwareRequest |
| 4695 | func (oo *OmciCC) SendCommitSoftware(ctx context.Context, timeout int, highPrio bool, |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4696 | rxChan chan Message, aImageMeID uint16, aIsExtendedOmci bool) error { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4697 | tid := oo.GetNextTid(highPrio) |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4698 | logger.Debugw(ctx, "send CommitSwRequest:", log.Fields{"device-id": oo.deviceID, |
| 4699 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 4700 | "InstId": strconv.FormatInt(int64(aImageMeID), 16)}) |
| 4701 | |
| 4702 | omciLayer := &omci.OMCI{ |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4703 | TransactionID: tid, |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4704 | MessageType: omci.CommitSoftwareRequestType, |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4705 | // DeviceIdentifier: omci.BaselineIdent, // Optional, defaults to Baseline |
| 4706 | // Length: 0x28, // Optional, defaults to 40 octets |
| 4707 | } |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4708 | if aIsExtendedOmci { |
| 4709 | omciLayer.DeviceIdentifier = omci.ExtendedIdent |
| 4710 | } |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4711 | request := &omci.CommitSoftwareRequest{ |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4712 | MeBasePacket: omci.MeBasePacket{ |
| 4713 | EntityClass: me.SoftwareImageClassID, |
| 4714 | EntityInstance: aImageMeID, //inactive image |
Holger Hildebrandt | 5458d89 | 2022-05-31 09:52:06 +0000 | [diff] [blame] | 4715 | Extended: aIsExtendedOmci, |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4716 | }, |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4717 | } |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4718 | |
| 4719 | var options gopacket.SerializeOptions |
| 4720 | options.FixLengths = true |
| 4721 | buffer := gopacket.NewSerializeBuffer() |
| 4722 | err := gopacket.SerializeLayers(buffer, options, omciLayer, request) |
| 4723 | if err != nil { |
| 4724 | logger.Errorw(ctx, "Cannot serialize CommitSwRequest", log.Fields{"Err": err, |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4725 | "device-id": oo.deviceID}) |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4726 | return err |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4727 | } |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4728 | outgoingPacket := buffer.Bytes() |
| 4729 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4730 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 4731 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4732 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4733 | err = oo.Send(ctx, outgoingPacket, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
mpagenko | 15ff4a5 | 2021-03-02 10:09:20 +0000 | [diff] [blame] | 4734 | if err != nil { |
| 4735 | logger.Errorw(ctx, "Cannot send CommitSwRequest", log.Fields{"Err": err, |
| 4736 | "device-id": oo.deviceID}) |
| 4737 | return err |
| 4738 | } |
| 4739 | logger.Debug(ctx, "send CommitSwRequest done") |
mpagenko | 80622a5 | 2021-02-09 16:53:23 +0000 | [diff] [blame] | 4740 | return nil |
| 4741 | } |
| 4742 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4743 | //SendSelfTestReq sends TestRequest |
| 4744 | func (oo *OmciCC) SendSelfTestReq(ctx context.Context, classID me.ClassID, instdID uint16, timeout int, highPrio bool, rxChan chan Message) error { |
| 4745 | tid := oo.GetNextTid(highPrio) |
Girish Gowdra | 6afb56a | 2021-04-27 17:47:57 -0700 | [diff] [blame] | 4746 | logger.Debugw(ctx, "send self test request:", log.Fields{"device-id": oo.deviceID, |
| 4747 | "SequNo": strconv.FormatInt(int64(tid), 16), |
| 4748 | "InstId": strconv.FormatInt(int64(instdID), 16)}) |
| 4749 | omciLayer := &omci.OMCI{ |
| 4750 | TransactionID: tid, |
| 4751 | MessageType: omci.TestRequestType, |
| 4752 | // DeviceIdentifier: omci.BaselineIdent, // Optional, defaults to Baseline |
| 4753 | // Length: 0x28, // Optional, defaults to 40 octets |
| 4754 | } |
| 4755 | |
| 4756 | var request *omci.OpticalLineSupervisionTestRequest |
| 4757 | switch classID { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4758 | case me.AniGClassID: |
Girish Gowdra | 6afb56a | 2021-04-27 17:47:57 -0700 | [diff] [blame] | 4759 | request = &omci.OpticalLineSupervisionTestRequest{ |
| 4760 | MeBasePacket: omci.MeBasePacket{ |
| 4761 | EntityClass: classID, |
| 4762 | EntityInstance: instdID, |
| 4763 | }, |
| 4764 | SelectTest: uint8(7), // self test |
| 4765 | GeneralPurposeBuffer: uint16(0), |
| 4766 | VendorSpecificParameters: uint16(0), |
| 4767 | } |
| 4768 | default: |
| 4769 | logger.Errorw(ctx, "unsupported class id for self test request", log.Fields{"device-id": oo.deviceID, "classID": classID}) |
| 4770 | return fmt.Errorf("unsupported-class-id-for-self-test-request-%v", classID) |
| 4771 | } |
| 4772 | // Test serialization back to former string |
| 4773 | var options gopacket.SerializeOptions |
| 4774 | options.FixLengths = true |
| 4775 | |
| 4776 | buffer := gopacket.NewSerializeBuffer() |
| 4777 | err := gopacket.SerializeLayers(buffer, options, omciLayer, request) |
| 4778 | if err != nil { |
| 4779 | logger.Errorw(ctx, "Cannot serialize self test request", log.Fields{"Err": err, |
| 4780 | "device-id": oo.deviceID}) |
| 4781 | return err |
| 4782 | } |
| 4783 | outgoingPacket := buffer.Bytes() |
| 4784 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4785 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 4786 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
Girish Gowdra | 6afb56a | 2021-04-27 17:47:57 -0700 | [diff] [blame] | 4787 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4788 | err = oo.Send(ctx, outgoingPacket, timeout, 0, highPrio, omciRxCallbackPair) |
Girish Gowdra | 6afb56a | 2021-04-27 17:47:57 -0700 | [diff] [blame] | 4789 | if err != nil { |
| 4790 | logger.Errorw(ctx, "Cannot send self test request", log.Fields{"Err": err, |
| 4791 | "device-id": oo.deviceID}) |
| 4792 | return err |
| 4793 | } |
| 4794 | logger.Debug(ctx, "send self test request done") |
| 4795 | return nil |
| 4796 | } |
| 4797 | |
Holger Hildebrandt | 8680ca3 | 2021-05-19 10:30:53 +0000 | [diff] [blame] | 4798 | //nolint: gocyclo |
Holger Hildebrandt | 36747fd | 2022-03-14 09:47:17 +0000 | [diff] [blame] | 4799 | func (oo *OmciCC) isSuccessfulResponseWithMibDataSync(ctx context.Context, omciMsg *omci.OMCI, packet *gp.Packet) (bool, error) { |
| 4800 | |
| 4801 | nextLayer, err := omci.MsgTypeToNextLayer(omciMsg.MessageType, false) |
| 4802 | if err != nil { |
| 4803 | logger.Errorw(ctx, "omci-message: could not map msgType to nextLayer", log.Fields{"device-id": oo.deviceID}) |
| 4804 | return false, fmt.Errorf("could not map msgType to nextLayer - %s", oo.deviceID) |
| 4805 | } |
| 4806 | msgLayer := (*packet).Layer(nextLayer) |
| 4807 | if msgLayer != nil { |
| 4808 | // Note: Due to relaxed decoding, you may now still have a decoding error attached to the layers |
| 4809 | if failure := (*packet).ErrorLayer(); failure != nil { |
| 4810 | if nextLayer == omci.LayerTypeMibUploadNextResponse { |
| 4811 | // In the case of MibUploadNextResponse, we let the packet pass so that later processing |
| 4812 | // can examine for UnkonwnMEs and UnknownAttributes |
| 4813 | logger.Infow(ctx, "omci-message: MibUploadNextResponse packet with ErrorLayer - let it pass", |
| 4814 | log.Fields{"device-id": oo.deviceID, "error": failure.Error()}) |
| 4815 | return false, nil |
| 4816 | } else if nextLayer == omci.LayerTypeGetResponse { |
| 4817 | if resp := msgLayer.(*omci.GetResponse); resp != nil { |
| 4818 | if resp.NextLayerType() == omci.LayerTypeUnknownAttributes { |
| 4819 | unknownAttrLayer := (*packet).Layer(omci.LayerTypeUnknownAttributes) |
| 4820 | if unknownAttrLayer != nil { |
| 4821 | logger.Errorw(ctx, "omci-message: GetResponse packet contains unknownAttrLayer - skip it!", |
| 4822 | log.Fields{"device-id": oo.deviceID, "error": failure.Error(), "unknownAttrLayer": unknownAttrLayer}) |
| 4823 | return false, fmt.Errorf("packet contains unknownAttrLayer - %s", oo.deviceID) |
| 4824 | } |
| 4825 | } |
| 4826 | } |
| 4827 | } |
| 4828 | // Try to decode any further error information |
| 4829 | if decodeFailure, ok := failure.(*gopacket.DecodeFailure); ok && decodeFailure != nil { |
| 4830 | logger.Errorw(ctx, "omci-message: packet contains ErrorLayer with further info - skip it!", |
| 4831 | log.Fields{"device-id": oo.deviceID, "error": failure.Error(), "decodeFailure": decodeFailure.String()}) |
| 4832 | return false, fmt.Errorf("packet contains ErrorLayer with further info - %s", oo.deviceID) |
| 4833 | } |
| 4834 | logger.Errorw(ctx, "omci-message: packet contains ErrorLayer - skip it!", |
| 4835 | log.Fields{"device-id": oo.deviceID, "error": failure.Error()}) |
| 4836 | return false, fmt.Errorf("packet contains ErrorLayer - %s", oo.deviceID) |
| 4837 | } |
| 4838 | } else if failure := (*packet).ErrorLayer(); failure != nil { |
| 4839 | // message layer could not be decoded, but at least check if additional failure information is available |
| 4840 | if decodeFailure, ok := failure.(*gopacket.DecodeFailure); ok && decodeFailure != nil { |
Holger Hildebrandt | 93d183f | 2022-04-22 15:50:26 +0000 | [diff] [blame] | 4841 | errMsg := decodeFailure.String() |
| 4842 | if nextLayer == omci.LayerTypeMibUploadNextResponse { |
| 4843 | if strings.Contains(strings.ToLower(errMsg), "table decode") { |
| 4844 | // In the case of MibUploadNextResponse with non-standard table attributes, we let the packet pass |
| 4845 | // so that later processing can deal with it |
| 4846 | logger.Infow(ctx, "omci-message: MibUploadNextResponse packet with table attributes - let it pass", |
| 4847 | log.Fields{"device-id": oo.deviceID, "error": failure.Error()}) |
| 4848 | return false, nil |
| 4849 | } |
| 4850 | } |
Holger Hildebrandt | 36747fd | 2022-03-14 09:47:17 +0000 | [diff] [blame] | 4851 | logger.Errorw(ctx, "omci-message: could not decode msgLayer of packet, further info available - skip it!", |
Holger Hildebrandt | 93d183f | 2022-04-22 15:50:26 +0000 | [diff] [blame] | 4852 | log.Fields{"device-id": oo.deviceID, "error": failure.Error(), "decodeFailure": errMsg}) |
Holger Hildebrandt | 36747fd | 2022-03-14 09:47:17 +0000 | [diff] [blame] | 4853 | return false, fmt.Errorf("could not decode msgLayer of packet, further info available - %s", oo.deviceID) |
| 4854 | } |
| 4855 | logger.Errorw(ctx, "omci-message: could not decode msgLayer of packet, ErrorLayer available", |
| 4856 | log.Fields{"device-id": oo.deviceID, "error": failure.Error()}) |
| 4857 | return false, fmt.Errorf("could not decode msgLayer of packet, ErrorLayer available - %s", oo.deviceID) |
| 4858 | } else { |
| 4859 | logger.Errorw(ctx, "omci-message: could not decode msgLayer of packet", log.Fields{"device-id": oo.deviceID}) |
| 4860 | return false, fmt.Errorf("could not decode msgLayer of packet - %s", oo.deviceID) |
| 4861 | } |
| 4862 | |
Holger Hildebrandt | 0bd45f8 | 2021-01-11 13:29:37 +0000 | [diff] [blame] | 4863 | for _, v := range responsesWithMibDataSync { |
Holger Hildebrandt | 3124e30 | 2021-03-23 12:47:03 +0000 | [diff] [blame] | 4864 | if v == omciMsg.MessageType { |
Holger Hildebrandt | 3124e30 | 2021-03-23 12:47:03 +0000 | [diff] [blame] | 4865 | switch nextLayer { |
| 4866 | case omci.LayerTypeCreateResponse: |
Holger Hildebrandt | 8680ca3 | 2021-05-19 10:30:53 +0000 | [diff] [blame] | 4867 | if resp := msgLayer.(*omci.CreateResponse); resp != nil { |
| 4868 | if resp.Result == me.Success { |
Holger Hildebrandt | 36747fd | 2022-03-14 09:47:17 +0000 | [diff] [blame] | 4869 | return true, nil |
Holger Hildebrandt | 8680ca3 | 2021-05-19 10:30:53 +0000 | [diff] [blame] | 4870 | } |
Holger Hildebrandt | 3124e30 | 2021-03-23 12:47:03 +0000 | [diff] [blame] | 4871 | } |
| 4872 | case omci.LayerTypeDeleteResponse: |
Holger Hildebrandt | 8680ca3 | 2021-05-19 10:30:53 +0000 | [diff] [blame] | 4873 | if resp := msgLayer.(*omci.DeleteResponse); resp != nil { |
| 4874 | if resp.Result == me.Success { |
Holger Hildebrandt | 36747fd | 2022-03-14 09:47:17 +0000 | [diff] [blame] | 4875 | return true, nil |
Holger Hildebrandt | 8680ca3 | 2021-05-19 10:30:53 +0000 | [diff] [blame] | 4876 | } |
Holger Hildebrandt | 3124e30 | 2021-03-23 12:47:03 +0000 | [diff] [blame] | 4877 | } |
| 4878 | case omci.LayerTypeSetResponse: |
Holger Hildebrandt | 8680ca3 | 2021-05-19 10:30:53 +0000 | [diff] [blame] | 4879 | if resp := msgLayer.(*omci.SetResponse); resp != nil { |
| 4880 | if resp.Result == me.Success { |
Holger Hildebrandt | 36747fd | 2022-03-14 09:47:17 +0000 | [diff] [blame] | 4881 | return true, nil |
Holger Hildebrandt | 8680ca3 | 2021-05-19 10:30:53 +0000 | [diff] [blame] | 4882 | } |
Holger Hildebrandt | 3124e30 | 2021-03-23 12:47:03 +0000 | [diff] [blame] | 4883 | } |
| 4884 | case omci.LayerTypeStartSoftwareDownloadResponse: |
Holger Hildebrandt | 8680ca3 | 2021-05-19 10:30:53 +0000 | [diff] [blame] | 4885 | if resp := msgLayer.(*omci.StartSoftwareDownloadResponse); resp != nil { |
| 4886 | if resp.Result == me.Success { |
Holger Hildebrandt | 36747fd | 2022-03-14 09:47:17 +0000 | [diff] [blame] | 4887 | return true, nil |
Holger Hildebrandt | 8680ca3 | 2021-05-19 10:30:53 +0000 | [diff] [blame] | 4888 | } |
Holger Hildebrandt | 3124e30 | 2021-03-23 12:47:03 +0000 | [diff] [blame] | 4889 | } |
| 4890 | case omci.LayerTypeEndSoftwareDownloadResponse: |
Holger Hildebrandt | 8680ca3 | 2021-05-19 10:30:53 +0000 | [diff] [blame] | 4891 | if resp := msgLayer.(*omci.EndSoftwareDownloadResponse); resp != nil { |
| 4892 | if resp.Result == me.Success { |
Holger Hildebrandt | 36747fd | 2022-03-14 09:47:17 +0000 | [diff] [blame] | 4893 | return true, nil |
Holger Hildebrandt | 8680ca3 | 2021-05-19 10:30:53 +0000 | [diff] [blame] | 4894 | } |
Holger Hildebrandt | 3124e30 | 2021-03-23 12:47:03 +0000 | [diff] [blame] | 4895 | } |
| 4896 | case omci.LayerTypeActivateSoftwareResponse: |
Holger Hildebrandt | 8680ca3 | 2021-05-19 10:30:53 +0000 | [diff] [blame] | 4897 | if resp := msgLayer.(*omci.ActivateSoftwareResponse); resp != nil { |
| 4898 | if resp.Result == me.Success { |
Holger Hildebrandt | 36747fd | 2022-03-14 09:47:17 +0000 | [diff] [blame] | 4899 | return true, nil |
Holger Hildebrandt | 8680ca3 | 2021-05-19 10:30:53 +0000 | [diff] [blame] | 4900 | } |
Holger Hildebrandt | 3124e30 | 2021-03-23 12:47:03 +0000 | [diff] [blame] | 4901 | } |
| 4902 | case omci.LayerTypeCommitSoftwareResponse: |
Holger Hildebrandt | 8680ca3 | 2021-05-19 10:30:53 +0000 | [diff] [blame] | 4903 | if resp := msgLayer.(*omci.CommitSoftwareResponse); resp != nil { |
| 4904 | if resp.Result == me.Success { |
Holger Hildebrandt | 36747fd | 2022-03-14 09:47:17 +0000 | [diff] [blame] | 4905 | return true, nil |
Holger Hildebrandt | 8680ca3 | 2021-05-19 10:30:53 +0000 | [diff] [blame] | 4906 | } |
Holger Hildebrandt | 3124e30 | 2021-03-23 12:47:03 +0000 | [diff] [blame] | 4907 | } |
| 4908 | } |
Holger Hildebrandt | 0bd45f8 | 2021-01-11 13:29:37 +0000 | [diff] [blame] | 4909 | } |
| 4910 | } |
Holger Hildebrandt | 36747fd | 2022-03-14 09:47:17 +0000 | [diff] [blame] | 4911 | return false, nil |
Holger Hildebrandt | 0bd45f8 | 2021-01-11 13:29:37 +0000 | [diff] [blame] | 4912 | } |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 4913 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4914 | func (oo *OmciCC) processRequestMonitoring(ctx context.Context, aOmciTxRequest OmciTransferStructure) { |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 4915 | timeout := aOmciTxRequest.timeout |
mpagenko | c26d4c0 | 2021-05-06 14:27:57 +0000 | [diff] [blame] | 4916 | if timeout == 0 { |
| 4917 | //timeout 0 indicates that no response is expected - fire and forget |
Holger Hildebrandt | 3455551 | 2021-10-01 16:26:59 +0000 | [diff] [blame] | 4918 | // enqueue |
| 4919 | if aOmciTxRequest.highPrio { |
| 4920 | oo.mutexHighPrioTxQueue.Lock() |
| 4921 | oo.highPrioTxQueue.PushBack(aOmciTxRequest) |
| 4922 | oo.mutexHighPrioTxQueue.Unlock() |
| 4923 | } else { |
| 4924 | oo.mutexLowPrioTxQueue.Lock() |
| 4925 | oo.lowPrioTxQueue.PushBack(aOmciTxRequest) |
| 4926 | oo.mutexLowPrioTxQueue.Unlock() |
| 4927 | } |
| 4928 | go oo.sendQueuedRequests(ctx) |
mpagenko | c26d4c0 | 2021-05-06 14:27:57 +0000 | [diff] [blame] | 4929 | } else { |
mpagenko | 7455fd4 | 2021-06-10 16:25:55 +0000 | [diff] [blame] | 4930 | //the supervised sending with waiting on the response (based on TID) is called in background |
| 4931 | // to avoid blocking of the sender for the complete OMCI handshake procedure |
| 4932 | // to stay consistent with the processing tested so far, sending of next messages of the same control procedure |
| 4933 | // is ensured by the according control instances (FSM's etc.) (by waiting for the respective responses there) |
| 4934 | go oo.sendWithRxSupervision(ctx, aOmciTxRequest, timeout) |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 4935 | } |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 4936 | } |
| 4937 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4938 | func (oo *OmciCC) sendWithRxSupervision(ctx context.Context, aOmciTxRequest OmciTransferStructure, aTimeout int) { |
mpagenko | 7455fd4 | 2021-06-10 16:25:55 +0000 | [diff] [blame] | 4939 | chSuccess := make(chan bool) |
| 4940 | aOmciTxRequest.chSuccess = chSuccess |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4941 | tid := aOmciTxRequest.cbPair.CbKey |
mpagenko | 7455fd4 | 2021-06-10 16:25:55 +0000 | [diff] [blame] | 4942 | oo.mutexMonReq.Lock() |
| 4943 | oo.monitoredRequests[tid] = aOmciTxRequest |
| 4944 | oo.mutexMonReq.Unlock() |
| 4945 | |
| 4946 | retries := aOmciTxRequest.retries |
| 4947 | retryCounter := 0 |
| 4948 | loop: |
| 4949 | for retryCounter <= retries { |
Holger Hildebrandt | 3455551 | 2021-10-01 16:26:59 +0000 | [diff] [blame] | 4950 | // enqueue |
| 4951 | if aOmciTxRequest.highPrio { |
| 4952 | oo.mutexHighPrioTxQueue.Lock() |
| 4953 | oo.highPrioTxQueue.PushBack(aOmciTxRequest) |
| 4954 | oo.mutexHighPrioTxQueue.Unlock() |
| 4955 | } else { |
| 4956 | oo.mutexLowPrioTxQueue.Lock() |
| 4957 | oo.lowPrioTxQueue.PushBack(aOmciTxRequest) |
| 4958 | oo.mutexLowPrioTxQueue.Unlock() |
| 4959 | } |
| 4960 | go oo.sendQueuedRequests(ctx) |
mpagenko | 7455fd4 | 2021-06-10 16:25:55 +0000 | [diff] [blame] | 4961 | |
| 4962 | select { |
| 4963 | case success := <-chSuccess: |
| 4964 | if success { |
| 4965 | logger.Debugw(ctx, "reqMon: response received in time", |
| 4966 | log.Fields{"tid": tid, "device-id": oo.deviceID}) |
| 4967 | } else { |
| 4968 | logger.Debugw(ctx, "reqMon: wait for response aborted", |
| 4969 | log.Fields{"tid": tid, "device-id": oo.deviceID}) |
| 4970 | } |
| 4971 | break loop |
| 4972 | case <-time.After(time.Duration(aTimeout) * time.Second): |
| 4973 | if retryCounter == retries { |
Holger Hildebrandt | 2b10764 | 2022-12-09 07:56:23 +0000 | [diff] [blame] | 4974 | if oo.pBaseDeviceHandler.IsOltAvailable() { |
| 4975 | logger.Errorw(ctx, "reqMon: timeout waiting for response - no of max retries reached - send ONU device event!", |
| 4976 | log.Fields{"tid": tid, "retries": retryCounter, "device-id": oo.deviceID}) |
| 4977 | oo.pOnuDeviceEntry.SendOnuDeviceEvent(ctx, OnuOmciCommunicationFailureConfig, OnuOmciCommunicationFailureConfigDesc) |
| 4978 | } else { |
| 4979 | logger.Errorw(ctx, "reqMon: timeout waiting for response - no of max retries reached - skip ONU device event: OLT unavailable!", |
| 4980 | log.Fields{"tid": tid, "retries": retryCounter, "device-id": oo.deviceID}) |
| 4981 | } |
Holger Hildebrandt | 66af5ce | 2022-09-07 13:38:02 +0000 | [diff] [blame] | 4982 | oo.incrementTxTimesouts() |
mpagenko | 7455fd4 | 2021-06-10 16:25:55 +0000 | [diff] [blame] | 4983 | break loop |
| 4984 | } else { |
| 4985 | logger.Infow(ctx, "reqMon: timeout waiting for response - retry", |
| 4986 | log.Fields{"tid": tid, "retries": retryCounter, "device-id": oo.deviceID}) |
Holger Hildebrandt | 66af5ce | 2022-09-07 13:38:02 +0000 | [diff] [blame] | 4987 | oo.incrementTxRetries() |
mpagenko | 7455fd4 | 2021-06-10 16:25:55 +0000 | [diff] [blame] | 4988 | } |
| 4989 | } |
| 4990 | retryCounter++ |
| 4991 | } |
| 4992 | oo.mutexMonReq.Lock() |
| 4993 | delete(oo.monitoredRequests, tid) |
| 4994 | oo.mutexMonReq.Unlock() |
| 4995 | } |
| 4996 | |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 4997 | //CancelRequestMonitoring terminates monitoring of outstanding omci requests |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 4998 | func (oo *OmciCC) CancelRequestMonitoring(ctx context.Context) { |
Holger Hildebrandt | 12609a1 | 2022-03-25 13:23:25 +0000 | [diff] [blame] | 4999 | logger.Debugw(ctx, "CancelRequestMonitoring entered", log.Fields{"device-id": oo.deviceID}) |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 5000 | oo.mutexMonReq.RLock() |
| 5001 | for k := range oo.monitoredRequests { |
mpagenko | 8cd1bf7 | 2021-06-22 10:11:19 +0000 | [diff] [blame] | 5002 | //implement non-blocking channel send to avoid blocking on mutexMonReq later |
| 5003 | select { |
| 5004 | case oo.monitoredRequests[k].chSuccess <- false: |
Holger Hildebrandt | 12609a1 | 2022-03-25 13:23:25 +0000 | [diff] [blame] | 5005 | logger.Debugw(ctx, "send cancellation on omciRespChannel", |
| 5006 | log.Fields{"index": k, "device-id": oo.deviceID}) |
mpagenko | 8cd1bf7 | 2021-06-22 10:11:19 +0000 | [diff] [blame] | 5007 | default: |
Holger Hildebrandt | 12609a1 | 2022-03-25 13:23:25 +0000 | [diff] [blame] | 5008 | logger.Debugw(ctx, "cancellation could not be send on omciRespChannel (no receiver)", |
| 5009 | log.Fields{"index": k, "device-id": oo.deviceID}) |
mpagenko | 8cd1bf7 | 2021-06-22 10:11:19 +0000 | [diff] [blame] | 5010 | } |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 5011 | } |
| 5012 | oo.mutexMonReq.RUnlock() |
| 5013 | } |
| 5014 | |
| 5015 | //GetMaxOmciTimeoutWithRetries provides a timeout value greater than the maximum |
| 5016 | //time consumed for retry processing of a particular OMCI-request |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 5017 | func (oo *OmciCC) GetMaxOmciTimeoutWithRetries() time.Duration { |
| 5018 | return time.Duration((CDefaultRetries+1)*oo.pBaseDeviceHandler.GetOmciTimeout() + 1) |
Holger Hildebrandt | 366ef19 | 2021-05-05 11:07:44 +0000 | [diff] [blame] | 5019 | } |
Himani Chawla | 43f95ff | 2021-06-03 00:24:12 +0530 | [diff] [blame] | 5020 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 5021 | // SendCreateOrDeleteEthernetFrameExtendedPMME deletes EthernetFrameExtendedPm ME instance |
| 5022 | func (oo *OmciCC) SendCreateOrDeleteEthernetFrameExtendedPMME(ctx context.Context, timeout int, highPrio bool, |
Himani Chawla | 43f95ff | 2021-06-03 00:24:12 +0530 | [diff] [blame] | 5023 | upstream bool, create bool, rxChan chan Message, entityID uint16, classID me.ClassID, controlBlock []uint16) (*me.ManagedEntity, error) { |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 5024 | tid := oo.GetNextTid(highPrio) |
Himani Chawla | 43f95ff | 2021-06-03 00:24:12 +0530 | [diff] [blame] | 5025 | logger.Debugw(ctx, "send-ethernet-frame-extended-pm-me-msg:", log.Fields{"device-id": oo.deviceID, |
| 5026 | "SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(entityID), 16), "create": create, "upstream": upstream}) |
| 5027 | |
| 5028 | meParam := me.ParamData{EntityID: entityID, |
Holger Hildebrandt | 3ac49bd | 2022-02-07 17:46:43 +0000 | [diff] [blame] | 5029 | Attributes: me.AttributeValueMap{me.EthernetFrameExtendedPm_ControlBlock: controlBlock}, |
Himani Chawla | 43f95ff | 2021-06-03 00:24:12 +0530 | [diff] [blame] | 5030 | } |
| 5031 | var meInstance *me.ManagedEntity |
| 5032 | var omciErr me.OmciErrors |
| 5033 | if classID == me.EthernetFrameExtendedPmClassID { |
| 5034 | meInstance, omciErr = me.NewEthernetFrameExtendedPm(meParam) |
| 5035 | } else { |
| 5036 | meInstance, omciErr = me.NewEthernetFrameExtendedPm64Bit(meParam) |
| 5037 | } |
| 5038 | |
| 5039 | if omciErr.GetError() == nil { |
| 5040 | var omciLayer *omci.OMCI |
| 5041 | var msgLayer gopacket.SerializableLayer |
| 5042 | var err error |
| 5043 | if create { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 5044 | omciLayer, msgLayer, err = oframe.EncodeFrame(meInstance, omci.CreateRequestType, oframe.TransactionID(tid), |
| 5045 | oframe.AddDefaults(true)) |
Himani Chawla | 43f95ff | 2021-06-03 00:24:12 +0530 | [diff] [blame] | 5046 | } else { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 5047 | omciLayer, msgLayer, err = oframe.EncodeFrame(meInstance, omci.DeleteRequestType, oframe.TransactionID(tid), |
| 5048 | oframe.AddDefaults(true)) |
Himani Chawla | 43f95ff | 2021-06-03 00:24:12 +0530 | [diff] [blame] | 5049 | } |
| 5050 | if err != nil { |
| 5051 | logger.Errorw(ctx, "cannot-encode-ethernet-frame-extended-pm-me", |
| 5052 | log.Fields{"err": err, "device-id": oo.deviceID, "upstream": upstream, "create": create, "inst-id": strconv.FormatInt(int64(entityID), 16)}) |
| 5053 | return nil, err |
| 5054 | } |
| 5055 | |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 5056 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
Himani Chawla | 43f95ff | 2021-06-03 00:24:12 +0530 | [diff] [blame] | 5057 | if err != nil { |
| 5058 | logger.Errorw(ctx, "cannot-serialize-ethernet-frame-extended-pm-me", |
| 5059 | log.Fields{"err": err, "device-id": oo.deviceID, "upstream": upstream, "create": create, "inst-id": strconv.FormatInt(int64(entityID), 16)}) |
| 5060 | return nil, err |
| 5061 | } |
| 5062 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 5063 | omciRxCallbackPair := CallbackPair{CbKey: tid, |
| 5064 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
Himani Chawla | 43f95ff | 2021-06-03 00:24:12 +0530 | [diff] [blame] | 5065 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 5066 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
Himani Chawla | 43f95ff | 2021-06-03 00:24:12 +0530 | [diff] [blame] | 5067 | if err != nil { |
| 5068 | logger.Errorw(ctx, "Cannot send ethernet-frame-extended-pm-me", |
| 5069 | log.Fields{"Err": err, "device-id": oo.deviceID, "upstream": upstream, "create": create, "inst-id": strconv.FormatInt(int64(entityID), 16)}) |
| 5070 | return nil, err |
| 5071 | } |
| 5072 | logger.Debugw(ctx, "send-ethernet-frame-extended-pm-me-done", |
| 5073 | log.Fields{"device-id": oo.deviceID, "upstream": upstream, "create": create, "inst-id": strconv.FormatInt(int64(entityID), 16)}) |
| 5074 | return meInstance, nil |
| 5075 | } |
| 5076 | logger.Errorw(ctx, "cannot-generate-ethernet-frame-extended-pm-me-instance", |
| 5077 | log.Fields{"Err": omciErr.GetError(), "device-id": oo.deviceID, "upstream": upstream, "create": create, "inst-id": strconv.FormatInt(int64(entityID), 16)}) |
| 5078 | return nil, omciErr.GetError() |
| 5079 | } |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 5080 | |
| 5081 | // RLockMutexMonReq lock read access to monitoredRequests |
| 5082 | func (oo *OmciCC) RLockMutexMonReq() { |
| 5083 | oo.mutexMonReq.RLock() |
| 5084 | } |
| 5085 | |
| 5086 | // RUnlockMutexMonReq unlock read access to monitoredRequests |
| 5087 | func (oo *OmciCC) RUnlockMutexMonReq() { |
| 5088 | oo.mutexMonReq.RUnlock() |
| 5089 | } |
| 5090 | |
| 5091 | // GetMonitoredRequest get OmciTransferStructure for an omciTransID |
| 5092 | func (oo *OmciCC) GetMonitoredRequest(omciTransID uint16) (value OmciTransferStructure, exist bool) { |
| 5093 | value, exist = oo.monitoredRequests[omciTransID] |
| 5094 | return value, exist |
| 5095 | } |
| 5096 | |
| 5097 | // SetChMonitoredRequest sets chSuccess to indicate whether response was received or not |
| 5098 | func (oo *OmciCC) SetChMonitoredRequest(omciTransID uint16, chVal bool) { |
| 5099 | oo.monitoredRequests[omciTransID].chSuccess <- chVal |
| 5100 | } |
Himani Chawla | ee10b54 | 2021-09-20 16:46:40 +0530 | [diff] [blame] | 5101 | |
| 5102 | // SendSetEthernetFrameExtendedPMME sends the set request for ethernet frame extended type me |
| 5103 | func (oo *OmciCC) SendSetEthernetFrameExtendedPMME(ctx context.Context, timeout int, highPrio bool, |
| 5104 | rxChan chan Message, entityID uint16, classID me.ClassID, controlBlock []uint16) (*me.ManagedEntity, error) { |
| 5105 | tid := oo.GetNextTid(highPrio) |
| 5106 | logger.Debugw(ctx, "send-set-ethernet-frame-extended-pm-me-control-block:", log.Fields{"device-id": oo.deviceID, |
| 5107 | "SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(entityID), 16)}) |
| 5108 | |
| 5109 | meParams := me.ParamData{EntityID: entityID, |
Holger Hildebrandt | 3ac49bd | 2022-02-07 17:46:43 +0000 | [diff] [blame] | 5110 | Attributes: me.AttributeValueMap{me.EthernetFrameExtendedPm_ControlBlock: controlBlock}, |
Himani Chawla | ee10b54 | 2021-09-20 16:46:40 +0530 | [diff] [blame] | 5111 | } |
| 5112 | var meInstance *me.ManagedEntity |
| 5113 | var omciErr me.OmciErrors |
| 5114 | if classID == me.EthernetFrameExtendedPmClassID { |
| 5115 | meInstance, omciErr = me.NewEthernetFrameExtendedPm(meParams) |
| 5116 | } else { |
| 5117 | meInstance, omciErr = me.NewEthernetFrameExtendedPm64Bit(meParams) |
| 5118 | } |
| 5119 | |
| 5120 | if omciErr.GetError() == nil { |
mpagenko | 836a1fd | 2021-11-01 16:12:42 +0000 | [diff] [blame] | 5121 | omciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.SetRequestType, oframe.TransactionID(tid)) |
Himani Chawla | ee10b54 | 2021-09-20 16:46:40 +0530 | [diff] [blame] | 5122 | if err != nil { |
| 5123 | logger.Errorw(ctx, "cannot-encode-ethernet-frame-extended-pm-me", |
| 5124 | log.Fields{"err": err, "device-id": oo.deviceID, "inst-id": strconv.FormatInt(int64(entityID), 16)}) |
| 5125 | return nil, err |
| 5126 | } |
Holger Hildebrandt | a6ef0e8 | 2022-04-06 13:11:32 +0000 | [diff] [blame] | 5127 | pkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer) |
Himani Chawla | ee10b54 | 2021-09-20 16:46:40 +0530 | [diff] [blame] | 5128 | if err != nil { |
| 5129 | logger.Errorw(ctx, "cannot-serialize-ethernet-frame-extended-pm-me-set-msg", |
| 5130 | log.Fields{"err": err, "device-id": oo.deviceID, "inst-id": strconv.FormatInt(int64(entityID), 16)}) |
| 5131 | return nil, err |
| 5132 | } |
| 5133 | omciRxCallbackPair := CallbackPair{ |
| 5134 | CbKey: tid, |
| 5135 | CbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true}, |
| 5136 | } |
| 5137 | err = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair) |
| 5138 | if err != nil { |
| 5139 | logger.Errorw(ctx, "Cannot send ethernet-frame-extended-pm-me", |
| 5140 | log.Fields{"Err": err, "device-id": oo.deviceID, "inst-id": strconv.FormatInt(int64(entityID), 16)}) |
| 5141 | return nil, err |
| 5142 | } |
| 5143 | logger.Debugw(ctx, "send-ethernet-frame-extended-pm-me-set-msg-done", |
| 5144 | log.Fields{"device-id": oo.deviceID, "inst-id": strconv.FormatInt(int64(entityID), 16)}) |
| 5145 | return meInstance, nil |
| 5146 | } |
| 5147 | logger.Errorw(ctx, "cannot-generate-ethernet-frame-extended-pm-me-instance", |
| 5148 | log.Fields{"Err": omciErr.GetError(), "device-id": oo.deviceID, "inst-id": strconv.FormatInt(int64(entityID), 16)}) |
| 5149 | return nil, omciErr.GetError() |
| 5150 | } |
Holger Hildebrandt | e7cc609 | 2022-02-01 11:37:03 +0000 | [diff] [blame] | 5151 | |
| 5152 | // PrepareForGarbageCollection - remove references to prepare for garbage collection |
| 5153 | func (oo *OmciCC) PrepareForGarbageCollection(ctx context.Context, aDeviceID string) { |
| 5154 | logger.Debugw(ctx, "prepare for garbage collection", log.Fields{"device-id": aDeviceID}) |
| 5155 | oo.pBaseDeviceHandler = nil |
| 5156 | oo.pOnuDeviceEntry = nil |
| 5157 | oo.pOnuAlarmManager = nil |
| 5158 | } |
Holger Hildebrandt | 66af5ce | 2022-09-07 13:38:02 +0000 | [diff] [blame] | 5159 | |
| 5160 | // GetOmciCounters - TODO: add comment |
| 5161 | func (oo *OmciCC) GetOmciCounters() *extension.SingleGetValueResponse { |
| 5162 | oo.mutexCounters.RLock() |
| 5163 | defer oo.mutexCounters.RUnlock() |
| 5164 | resp := extension.SingleGetValueResponse{ |
| 5165 | Response: &extension.GetValueResponse{ |
| 5166 | Status: extension.GetValueResponse_OK, |
| 5167 | Response: &extension.GetValueResponse_OnuOmciStats{ |
| 5168 | OnuOmciStats: &extension.GetOnuOmciTxRxStatsResponse{}, |
| 5169 | }, |
| 5170 | }, |
| 5171 | } |
| 5172 | resp.Response.GetOnuOmciStats().BaseTxArFrames = oo.countersBase.txArFrames |
| 5173 | resp.Response.GetOnuOmciStats().BaseTxNoArFrames = oo.countersBase.txNoArFrames |
| 5174 | resp.Response.GetOnuOmciStats().BaseRxAkFrames = oo.countersBase.rxAkFrames |
| 5175 | resp.Response.GetOnuOmciStats().BaseRxNoAkFrames = oo.countersBase.rxNoAkFrames |
| 5176 | resp.Response.GetOnuOmciStats().ExtTxArFrames = oo.countersExt.txArFrames |
| 5177 | resp.Response.GetOnuOmciStats().ExtTxNoArFrames = oo.countersExt.txNoArFrames |
| 5178 | resp.Response.GetOnuOmciStats().ExtRxAkFrames = oo.countersExt.rxAkFrames |
| 5179 | resp.Response.GetOnuOmciStats().ExtRxNoAkFrames = oo.countersExt.rxNoAkFrames |
| 5180 | resp.Response.GetOnuOmciStats().TxOmciCounterRetries = oo.txRetries |
| 5181 | resp.Response.GetOnuOmciStats().TxOmciCounterTimeouts = oo.txTimeouts |
| 5182 | return &resp |
| 5183 | } |
| 5184 | |
| 5185 | // For more speed, separate functions for each counter |
| 5186 | |
| 5187 | func (oo *OmciCC) incrementBaseTxArFrames() { |
| 5188 | oo.mutexCounters.Lock() |
| 5189 | defer oo.mutexCounters.Unlock() |
| 5190 | oo.countersBase.txArFrames++ |
| 5191 | } |
| 5192 | |
| 5193 | func (oo *OmciCC) incrementExtTxArFrames() { |
| 5194 | oo.mutexCounters.Lock() |
| 5195 | defer oo.mutexCounters.Unlock() |
| 5196 | oo.countersExt.txArFrames++ |
| 5197 | } |
| 5198 | |
| 5199 | func (oo *OmciCC) incrementBaseRxAkFrames() { |
| 5200 | oo.mutexCounters.Lock() |
| 5201 | defer oo.mutexCounters.Unlock() |
| 5202 | oo.countersBase.rxAkFrames++ |
| 5203 | } |
| 5204 | |
| 5205 | func (oo *OmciCC) incrementExtRxAkFrames() { |
| 5206 | oo.mutexCounters.Lock() |
| 5207 | defer oo.mutexCounters.Unlock() |
| 5208 | oo.countersExt.rxAkFrames++ |
| 5209 | } |
| 5210 | |
| 5211 | func (oo *OmciCC) increaseBaseTxNoArFramesBy(ctx context.Context, value uint32) { |
| 5212 | oo.mutexCounters.Lock() |
| 5213 | defer oo.mutexCounters.Unlock() |
| 5214 | oo.countersBase.txNoArFrames += value |
| 5215 | } |
| 5216 | |
| 5217 | func (oo *OmciCC) increaseExtTxNoArFramesBy(ctx context.Context, value uint32) { |
| 5218 | oo.mutexCounters.Lock() |
| 5219 | defer oo.mutexCounters.Unlock() |
| 5220 | oo.countersExt.txNoArFrames += value |
| 5221 | } |
| 5222 | |
| 5223 | func (oo *OmciCC) incrementBaseRxNoAkFrames() { |
| 5224 | oo.mutexCounters.Lock() |
| 5225 | defer oo.mutexCounters.Unlock() |
| 5226 | oo.countersBase.rxNoAkFrames++ |
| 5227 | } |
| 5228 | |
| 5229 | func (oo *OmciCC) incrementExtRxNoAkFrames() { |
| 5230 | oo.mutexCounters.Lock() |
| 5231 | defer oo.mutexCounters.Unlock() |
| 5232 | oo.countersExt.rxNoAkFrames++ |
| 5233 | } |
| 5234 | |
| 5235 | func (oo *OmciCC) incrementTxRetries() { |
| 5236 | oo.mutexCounters.Lock() |
| 5237 | defer oo.mutexCounters.Unlock() |
| 5238 | oo.txRetries++ |
| 5239 | } |
| 5240 | |
| 5241 | func (oo *OmciCC) incrementTxTimesouts() { |
| 5242 | oo.mutexCounters.Lock() |
| 5243 | defer oo.mutexCounters.Unlock() |
| 5244 | oo.txTimeouts++ |
| 5245 | } |