Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-present Open Networking Foundation |
| 3 | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package omci |
| 18 | |
| 19 | import ( |
| 20 | "encoding/hex" |
| 21 | "errors" |
| 22 | "fmt" |
Elia Battiston | ac63b11 | 2022-01-12 18:40:49 +0100 | [diff] [blame] | 23 | "math/rand" |
| 24 | "strconv" |
| 25 | |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 26 | "github.com/google/gopacket" |
Andrea Campanella | 10426e2 | 2021-10-15 17:58:04 +0200 | [diff] [blame] | 27 | "github.com/opencord/omci-lib-go/v2" |
| 28 | me "github.com/opencord/omci-lib-go/v2/generated" |
David K. Bainbridge | c415efe | 2021-08-19 13:05:21 +0000 | [diff] [blame] | 29 | "github.com/opencord/voltha-protos/v5/go/openolt" |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 30 | log "github.com/sirupsen/logrus" |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 31 | ) |
| 32 | |
| 33 | func ParseGetRequest(omciPkt gopacket.Packet) (*omci.GetRequest, error) { |
| 34 | msgLayer := omciPkt.Layer(omci.LayerTypeGetRequest) |
| 35 | if msgLayer == nil { |
| 36 | err := "omci Msg layer could not be detected for LayerTypeGetRequest" |
| 37 | omciLogger.Error(err) |
| 38 | return nil, errors.New(err) |
| 39 | } |
| 40 | msgObj, msgOk := msgLayer.(*omci.GetRequest) |
| 41 | if !msgOk { |
| 42 | err := "omci Msg layer could not be assigned for LayerTypeGetRequest" |
| 43 | omciLogger.Error(err) |
| 44 | return nil, errors.New(err) |
| 45 | } |
| 46 | return msgObj, nil |
| 47 | } |
| 48 | |
Matteo Scandolo | c00e97a | 2021-05-27 11:45:27 -0700 | [diff] [blame] | 49 | func CreateGetResponse(omciPkt gopacket.Packet, omciMsg *omci.OMCI, onuSn *openolt.SerialNumber, mds uint8, |
| 50 | activeImageEntityId uint16, committedImageEntityId uint16, standbyImageVersion string, activeImageVersion string, |
| 51 | committedImageVersion string, onuDown bool) ([]byte, error) { |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 52 | |
| 53 | msgObj, err := ParseGetRequest(omciPkt) |
| 54 | |
| 55 | if err != nil { |
| 56 | return nil, err |
| 57 | } |
| 58 | |
| 59 | omciLogger.WithFields(log.Fields{ |
| 60 | "EntityClass": msgObj.EntityClass, |
| 61 | "EntityInstance": msgObj.EntityInstance, |
| 62 | "AttributeMask": fmt.Sprintf("%x", msgObj.AttributeMask), |
Matteo Scandolo | 992a23e | 2021-02-04 15:35:04 -0800 | [diff] [blame] | 63 | }).Trace("received-omci-get-request") |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 64 | |
| 65 | var response *omci.GetResponse |
| 66 | switch msgObj.EntityClass { |
| 67 | case me.Onu2GClassID: |
| 68 | response = createOnu2gResponse(msgObj.AttributeMask, msgObj.EntityInstance) |
| 69 | case me.OnuGClassID: |
Matteo Scandolo | 5863f00 | 2021-02-08 08:08:14 -0800 | [diff] [blame] | 70 | response = createOnugResponse(msgObj.AttributeMask, msgObj.EntityInstance, onuSn) |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 71 | case me.SoftwareImageClassID: |
Matteo Scandolo | c00e97a | 2021-05-27 11:45:27 -0700 | [diff] [blame] | 72 | response = createSoftwareImageResponse(msgObj.AttributeMask, msgObj.EntityInstance, |
| 73 | activeImageEntityId, committedImageEntityId, standbyImageVersion, activeImageVersion, committedImageVersion) |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 74 | case me.IpHostConfigDataClassID: |
| 75 | response = createIpHostResponse(msgObj.AttributeMask, msgObj.EntityInstance) |
Elia Battiston | ac63b11 | 2022-01-12 18:40:49 +0100 | [diff] [blame] | 76 | case me.VoipConfigDataClassID: |
| 77 | response = createVoipConfigDataResponse(msgObj.AttributeMask, msgObj.EntityInstance) |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 78 | case me.UniGClassID: |
Girish Gowdra | 996d81e | 2021-04-21 16:16:27 -0700 | [diff] [blame] | 79 | response = createUnigResponse(msgObj.AttributeMask, msgObj.EntityInstance, onuDown) |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 80 | case me.PhysicalPathTerminationPointEthernetUniClassID: |
Elia Battiston | ac63b11 | 2022-01-12 18:40:49 +0100 | [diff] [blame] | 81 | response = createPptpEthernetResponse(msgObj.AttributeMask, msgObj.EntityInstance, onuDown) |
| 82 | case me.PhysicalPathTerminationPointPotsUniClassID: |
| 83 | response = createPptpPotsResponse(msgObj.AttributeMask, msgObj.EntityInstance, onuDown) |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 84 | case me.AniGClassID: |
| 85 | response = createAnigResponse(msgObj.AttributeMask, msgObj.EntityInstance) |
| 86 | case me.OnuDataClassID: |
Matteo Scandolo | 992a23e | 2021-02-04 15:35:04 -0800 | [diff] [blame] | 87 | response = createOnuDataResponse(msgObj.AttributeMask, msgObj.EntityInstance, mds) |
Girish Gowdra | a539f52 | 2021-02-15 23:00:45 -0800 | [diff] [blame] | 88 | case me.EthernetFramePerformanceMonitoringHistoryDataUpstreamClassID: |
| 89 | response = createEthernetFramePerformanceMonitoringHistoryDataUpstreamResponse(msgObj.AttributeMask, msgObj.EntityInstance) |
| 90 | case me.EthernetFramePerformanceMonitoringHistoryDataDownstreamClassID: |
| 91 | response = createEthernetFramePerformanceMonitoringHistoryDataDownstreamResponse(msgObj.AttributeMask, msgObj.EntityInstance) |
| 92 | case me.EthernetPerformanceMonitoringHistoryDataClassID: |
| 93 | response = createEthernetPerformanceMonitoringHistoryDataResponse(msgObj.AttributeMask, msgObj.EntityInstance) |
Girish Gowdra | 6d9a1a4 | 2021-03-05 16:07:15 -0800 | [diff] [blame] | 94 | case me.FecPerformanceMonitoringHistoryDataClassID: |
| 95 | response = createFecPerformanceMonitoringHistoryDataResponse(msgObj.AttributeMask, msgObj.EntityInstance) |
| 96 | case me.GemPortNetworkCtpPerformanceMonitoringHistoryDataClassID: |
| 97 | response = createGemPortNetworkCtpPerformanceMonitoringHistoryData(msgObj.AttributeMask, msgObj.EntityInstance) |
Himani Chawla | 6bd190a | 2021-07-09 15:31:01 +0530 | [diff] [blame] | 98 | case me.EthernetFrameExtendedPmClassID, |
| 99 | me.EthernetFrameExtendedPm64BitClassID: |
| 100 | response = createEthernetFrameExtendedPmGetResponse(msgObj.EntityClass, msgObj.AttributeMask, msgObj.EntityInstance) |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 101 | default: |
| 102 | omciLogger.WithFields(log.Fields{ |
| 103 | "EntityClass": msgObj.EntityClass, |
| 104 | "EntityInstance": msgObj.EntityInstance, |
| 105 | "AttributeMask": fmt.Sprintf("%x", msgObj.AttributeMask), |
| 106 | }).Warnf("do-not-know-how-to-handle-get-request-for-me-class") |
| 107 | return nil, nil |
| 108 | } |
| 109 | |
Matteo Scandolo | 992a23e | 2021-02-04 15:35:04 -0800 | [diff] [blame] | 110 | pkt, err := Serialize(omci.GetResponseType, response, omciMsg.TransactionID) |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 111 | if err != nil { |
| 112 | omciLogger.WithFields(log.Fields{ |
| 113 | "Err": err, |
| 114 | "TxID": strconv.FormatInt(int64(omciMsg.TransactionID), 16), |
Matteo Scandolo | 78d5ee1 | 2021-04-14 11:11:32 -0700 | [diff] [blame] | 115 | }).Error("cannot-Serialize-GetResponse") |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 116 | return nil, err |
| 117 | } |
| 118 | |
| 119 | log.WithFields(log.Fields{ |
| 120 | "TxID": strconv.FormatInt(int64(omciMsg.TransactionID), 16), |
| 121 | "pkt": hex.EncodeToString(pkt), |
| 122 | }).Trace("omci-get-response") |
| 123 | |
| 124 | return pkt, nil |
| 125 | } |
| 126 | |
| 127 | func createOnu2gResponse(attributeMask uint16, entityID uint16) *omci.GetResponse { |
| 128 | |
| 129 | managedEntity, meErr := me.NewOnu2G(me.ParamData{ |
| 130 | EntityID: entityID, |
| 131 | Attributes: me.AttributeValueMap{ |
| 132 | "ManagedEntityId": entityID, |
Matteo Scandolo | ef4e8f8 | 2021-05-17 11:20:49 -0700 | [diff] [blame] | 133 | "EquipmentId": ToOctets("12345123451234512345", 20), |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 134 | "OpticalNetworkUnitManagementAndControlChannelOmccVersion": 180, |
| 135 | "VendorProductCode": 0, |
| 136 | "SecurityCapability": 1, |
| 137 | "SecurityMode": 1, |
| 138 | "TotalPriorityQueueNumber": 1, |
| 139 | "TotalTrafficSchedulerNumber": 1, |
| 140 | "Deprecated": 1, |
| 141 | "TotalGemPortIdNumber": 32, |
| 142 | "Sysuptime": 319389947, // NOTE need to be smarter? |
| 143 | "ConnectivityCapability": 127, |
| 144 | "CurrentConnectivityMode": 5, |
| 145 | "QualityOfServiceQosConfigurationFlexibility": 48, |
| 146 | "PriorityQueueScaleFactor": 1, |
| 147 | }, |
| 148 | }) |
| 149 | |
| 150 | if meErr.GetError() != nil { |
| 151 | omciLogger.Errorf("NewOnu2G %v", meErr.Error()) |
| 152 | return nil |
| 153 | } |
| 154 | |
| 155 | return &omci.GetResponse{ |
| 156 | MeBasePacket: omci.MeBasePacket{ |
| 157 | EntityClass: me.Onu2GClassID, |
| 158 | }, |
| 159 | Attributes: managedEntity.GetAttributeValueMap(), |
| 160 | AttributeMask: attributeMask, |
| 161 | Result: me.Success, |
| 162 | } |
| 163 | } |
| 164 | |
Matteo Scandolo | 5863f00 | 2021-02-08 08:08:14 -0800 | [diff] [blame] | 165 | func createOnugResponse(attributeMask uint16, entityID uint16, onuSn *openolt.SerialNumber) *omci.GetResponse { |
| 166 | |
| 167 | managedEntity, meErr := me.NewOnuG(me.ParamData{ |
| 168 | EntityID: entityID, |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 169 | Attributes: me.AttributeValueMap{ |
| 170 | "ManagedEntityId": entityID, |
Matteo Scandolo | ef4e8f8 | 2021-05-17 11:20:49 -0700 | [diff] [blame] | 171 | "VendorId": ToOctets("BBSM", 4), |
| 172 | "Version": ToOctets("v0.0.1", 14), |
Matteo Scandolo | 5863f00 | 2021-02-08 08:08:14 -0800 | [diff] [blame] | 173 | "SerialNumber": append(onuSn.VendorId, onuSn.VendorSpecific...), |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 174 | "TrafficManagementOption": 0, |
| 175 | "Deprecated": 0, |
| 176 | "BatteryBackup": 0, |
| 177 | "AdministrativeState": 0, |
| 178 | "OperationalState": 0, |
| 179 | "OnuSurvivalTime": 10, |
Matteo Scandolo | ef4e8f8 | 2021-05-17 11:20:49 -0700 | [diff] [blame] | 180 | "LogicalOnuId": ToOctets("BBSM", 24), |
| 181 | "LogicalPassword": ToOctets("BBSM", 12), |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 182 | "CredentialsStatus": 0, |
| 183 | "ExtendedTcLayerOptions": 0, |
| 184 | }, |
Matteo Scandolo | 5863f00 | 2021-02-08 08:08:14 -0800 | [diff] [blame] | 185 | }) |
| 186 | |
| 187 | if meErr.GetError() != nil { |
| 188 | omciLogger.Errorf("NewOnu2G %v", meErr.Error()) |
| 189 | return nil |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 190 | } |
Matteo Scandolo | 5863f00 | 2021-02-08 08:08:14 -0800 | [diff] [blame] | 191 | |
| 192 | return &omci.GetResponse{ |
| 193 | MeBasePacket: omci.MeBasePacket{ |
| 194 | EntityClass: me.OnuGClassID, |
| 195 | }, |
| 196 | Attributes: managedEntity.GetAttributeValueMap(), |
| 197 | AttributeMask: attributeMask, |
| 198 | Result: me.Success, |
| 199 | } |
| 200 | |
| 201 | //return &omci.GetResponse{ |
| 202 | // MeBasePacket: omci.MeBasePacket{ |
| 203 | // EntityClass: me.OnuGClassID, |
| 204 | // EntityInstance: entityID, |
| 205 | // }, |
| 206 | // Attributes: me.AttributeValueMap{ |
| 207 | // |
| 208 | // }, |
| 209 | // Result: me.Success, |
| 210 | // AttributeMask: attributeMask, |
| 211 | //} |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 212 | } |
| 213 | |
Matteo Scandolo | c00e97a | 2021-05-27 11:45:27 -0700 | [diff] [blame] | 214 | func createSoftwareImageResponse(attributeMask uint16, entityInstance uint16, activeImageEntityId uint16, |
| 215 | committedImageEntityId uint16, standbyImageVersion string, activeImageVersion string, committedImageVersion string) *omci.GetResponse { |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 216 | |
| 217 | omciLogger.WithFields(log.Fields{ |
| 218 | "EntityInstance": entityInstance, |
Matteo Scandolo | c00e97a | 2021-05-27 11:45:27 -0700 | [diff] [blame] | 219 | "AttributeMask": attributeMask, |
Matteo Scandolo | 21195d6 | 2021-04-07 14:31:23 -0700 | [diff] [blame] | 220 | }).Trace("received-get-software-image-request") |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 221 | |
| 222 | // Only one image can be active and committed |
| 223 | committed := 0 |
| 224 | active := 0 |
Matteo Scandolo | c00e97a | 2021-05-27 11:45:27 -0700 | [diff] [blame] | 225 | version := standbyImageVersion |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 226 | if entityInstance == activeImageEntityId { |
| 227 | active = 1 |
Matteo Scandolo | c00e97a | 2021-05-27 11:45:27 -0700 | [diff] [blame] | 228 | version = activeImageVersion |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 229 | } |
| 230 | if entityInstance == committedImageEntityId { |
| 231 | committed = 1 |
Matteo Scandolo | c00e97a | 2021-05-27 11:45:27 -0700 | [diff] [blame] | 232 | version = committedImageVersion |
| 233 | } |
| 234 | |
| 235 | imageHash, err := hex.DecodeString(hex.EncodeToString([]byte(version))) |
| 236 | if err != nil { |
| 237 | omciLogger.WithFields(log.Fields{ |
| 238 | "entityId": entityInstance, |
| 239 | "active": active, |
| 240 | "committed": committed, |
| 241 | "err": err, |
| 242 | }).Error("cannot-generate-image-hash") |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 243 | } |
| 244 | |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 245 | // NOTE that we need send the response for the correct ME Instance or the adapter won't process it |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 246 | res := &omci.GetResponse{ |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 247 | MeBasePacket: omci.MeBasePacket{ |
| 248 | EntityClass: me.SoftwareImageClassID, |
| 249 | EntityInstance: entityInstance, |
| 250 | }, |
| 251 | Attributes: me.AttributeValueMap{ |
| 252 | "ManagedEntityId": 0, |
Matteo Scandolo | c00e97a | 2021-05-27 11:45:27 -0700 | [diff] [blame] | 253 | "Version": ToOctets(version, 14), |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 254 | "IsCommitted": committed, |
| 255 | "IsActive": active, |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 256 | "IsValid": 1, |
Matteo Scandolo | c00e97a | 2021-05-27 11:45:27 -0700 | [diff] [blame] | 257 | "ProductCode": ToOctets("BBSIM-ONU", 25), |
| 258 | "ImageHash": imageHash, |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 259 | }, |
| 260 | Result: me.Success, |
| 261 | AttributeMask: attributeMask, |
| 262 | } |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 263 | |
| 264 | omciLogger.WithFields(log.Fields{ |
| 265 | "omciMessage": res, |
| 266 | "entityId": entityInstance, |
| 267 | "active": active, |
| 268 | "committed": committed, |
Matteo Scandolo | 21195d6 | 2021-04-07 14:31:23 -0700 | [diff] [blame] | 269 | }).Trace("Reporting SoftwareImage") |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 270 | |
| 271 | return res |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | func createIpHostResponse(attributeMask uint16, entityInstance uint16) *omci.GetResponse { |
| 275 | return &omci.GetResponse{ |
| 276 | MeBasePacket: omci.MeBasePacket{ |
| 277 | EntityClass: me.IpHostConfigDataClassID, |
| 278 | EntityInstance: entityInstance, |
| 279 | }, |
| 280 | Attributes: me.AttributeValueMap{ |
| 281 | "ManagedEntityId": 0, |
Matteo Scandolo | ef4e8f8 | 2021-05-17 11:20:49 -0700 | [diff] [blame] | 282 | "MacAddress": ToOctets("aabbcc", 6), |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 283 | }, |
| 284 | Result: me.Success, |
| 285 | AttributeMask: attributeMask, |
| 286 | } |
| 287 | } |
| 288 | |
Elia Battiston | ac63b11 | 2022-01-12 18:40:49 +0100 | [diff] [blame] | 289 | func createVoipConfigDataResponse(attributeMask uint16, entityInstance uint16) *omci.GetResponse { |
| 290 | return &omci.GetResponse{ |
| 291 | MeBasePacket: omci.MeBasePacket{ |
| 292 | EntityClass: me.VoipConfigDataClassID, |
| 293 | EntityInstance: entityInstance, |
| 294 | }, |
| 295 | Attributes: me.AttributeValueMap{ |
| 296 | "ManagedEntityId": 0, |
| 297 | "AvailableSignallingProtocols": 1, |
| 298 | "SignallingProtocolUsed": 1, |
| 299 | "AvailableVoipConfigurationMethods": 1, |
| 300 | "VoipConfigurationMethodUsed": 1, |
| 301 | "VoipConfigurationAddressPointer": 0xFFFF, |
| 302 | "VoipConfigurationState": 0, |
| 303 | "RetrieveProfile": 0, |
| 304 | "ProfileVersion": 0, |
| 305 | }, |
| 306 | Result: me.Success, |
| 307 | AttributeMask: attributeMask, |
| 308 | } |
| 309 | } |
| 310 | |
Girish Gowdra | 996d81e | 2021-04-21 16:16:27 -0700 | [diff] [blame] | 311 | func createUnigResponse(attributeMask uint16, entityID uint16, onuDown bool) *omci.GetResponse { |
| 312 | // Valid values for uni_admin_state are 0 (unlocks) and 1 (locks) |
| 313 | omciAdminState := 1 |
| 314 | if !onuDown { |
| 315 | omciAdminState = 0 |
| 316 | } |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 317 | managedEntity, meErr := me.NewUniG(me.ParamData{ |
| 318 | EntityID: entityID, |
| 319 | Attributes: me.AttributeValueMap{ |
| 320 | "ManagedEntityId": entityID, |
| 321 | "Deprecated": 0, |
Girish Gowdra | 996d81e | 2021-04-21 16:16:27 -0700 | [diff] [blame] | 322 | "AdministrativeState": omciAdminState, |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 323 | "ManagementCapability": 0, |
| 324 | "NonOmciManagementIdentifier": 1, |
| 325 | "RelayAgentOptions": 1, |
| 326 | }, |
| 327 | }) |
| 328 | |
| 329 | if meErr.GetError() != nil { |
| 330 | omciLogger.Errorf("NewUniG %v", meErr.Error()) |
| 331 | return nil |
| 332 | } |
| 333 | |
| 334 | return &omci.GetResponse{ |
| 335 | MeBasePacket: omci.MeBasePacket{ |
Girish Gowdra | c3fd50c | 2021-03-12 16:14:44 -0800 | [diff] [blame] | 336 | EntityClass: me.UniGClassID, |
| 337 | EntityInstance: entityID, |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 338 | }, |
| 339 | Attributes: managedEntity.GetAttributeValueMap(), |
| 340 | AttributeMask: attributeMask, |
| 341 | Result: me.Success, |
| 342 | } |
| 343 | } |
| 344 | |
Elia Battiston | ac63b11 | 2022-01-12 18:40:49 +0100 | [diff] [blame] | 345 | func createPptpEthernetResponse(attributeMask uint16, entityID uint16, onuDown bool) *omci.GetResponse { |
Girish Gowdra | 996d81e | 2021-04-21 16:16:27 -0700 | [diff] [blame] | 346 | // Valid values for oper_state are 0 (enabled) and 1 (disabled) |
| 347 | // Valid values for uni_admin_state are 0 (unlocks) and 1 (locks) |
| 348 | onuAdminState := 1 |
| 349 | if !onuDown { |
| 350 | onuAdminState = 0 |
| 351 | } |
| 352 | onuOperState := onuAdminState // For now make the assumption that oper state reflects the admin state |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 353 | managedEntity, meErr := me.NewPhysicalPathTerminationPointEthernetUni(me.ParamData{ |
| 354 | EntityID: entityID, |
| 355 | Attributes: me.AttributeValueMap{ |
| 356 | "ManagedEntityId": entityID, |
| 357 | "ExpectedType": 0, |
| 358 | "SensedType": 0, |
| 359 | "AutoDetectionConfiguration": 0, |
| 360 | "EthernetLoopbackConfiguration": 0, |
Girish Gowdra | 996d81e | 2021-04-21 16:16:27 -0700 | [diff] [blame] | 361 | "AdministrativeState": onuAdminState, |
| 362 | "OperationalState": onuOperState, |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 363 | "ConfigurationInd": 0, |
| 364 | "MaxFrameSize": 0, |
| 365 | "DteOrDceInd": 0, |
| 366 | "PauseTime": 0, |
| 367 | "BridgedOrIpInd": 0, |
| 368 | "Arc": 0, |
| 369 | "ArcInterval": 0, |
| 370 | "PppoeFilter": 0, |
| 371 | "PowerControl": 0, |
| 372 | }, |
| 373 | }) |
| 374 | |
| 375 | if meErr.GetError() != nil { |
| 376 | omciLogger.Errorf("NewPhysicalPathTerminationPointEthernetUni %v", meErr.Error()) |
| 377 | return nil |
| 378 | } |
| 379 | |
| 380 | return &omci.GetResponse{ |
| 381 | MeBasePacket: omci.MeBasePacket{ |
Girish Gowdra | c3fd50c | 2021-03-12 16:14:44 -0800 | [diff] [blame] | 382 | EntityClass: me.PhysicalPathTerminationPointEthernetUniClassID, |
| 383 | EntityInstance: entityID, |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 384 | }, |
| 385 | Attributes: managedEntity.GetAttributeValueMap(), |
| 386 | AttributeMask: attributeMask, |
| 387 | Result: me.Success, |
| 388 | } |
| 389 | } |
| 390 | |
Elia Battiston | ac63b11 | 2022-01-12 18:40:49 +0100 | [diff] [blame] | 391 | func createPptpPotsResponse(attributeMask uint16, entityID uint16, onuDown bool) *omci.GetResponse { |
| 392 | // Valid values for oper_state are 0 (enabled) and 1 (disabled) |
| 393 | // Valid values for uni_admin_state are 0 (unlocks) and 1 (locks) |
| 394 | onuAdminState := 1 |
| 395 | if !onuDown { |
| 396 | onuAdminState = 0 |
| 397 | } |
| 398 | onuOperState := onuAdminState // For now make the assumption that oper state reflects the admin state |
| 399 | managedEntity, meErr := me.NewPhysicalPathTerminationPointPotsUni(me.ParamData{ |
| 400 | EntityID: entityID, |
| 401 | Attributes: me.AttributeValueMap{ |
| 402 | "ManagedEntityId": entityID, |
| 403 | "AdministrativeState": onuAdminState, |
| 404 | "Deprecated": 0, |
| 405 | "Arc": 0, |
| 406 | "ArcInterval": 0, |
| 407 | "Impedance": 0, |
| 408 | "TransmissionPath": 0, |
| 409 | "RxGain": 0, |
| 410 | "TxGain": 0, |
| 411 | "OperationalState": onuOperState, |
| 412 | "HookState": 0, |
| 413 | "PotsHoldoverTime": 0, |
| 414 | "NominalFeedVoltage": 0, |
| 415 | "LossOfSoftswitch": 0, |
| 416 | }, |
| 417 | }) |
| 418 | |
| 419 | if meErr.GetError() != nil { |
| 420 | omciLogger.Errorf("NewPhysicalPathTerminationPointPotsUni %v", meErr.Error()) |
| 421 | return nil |
| 422 | } |
| 423 | |
| 424 | return &omci.GetResponse{ |
| 425 | MeBasePacket: omci.MeBasePacket{ |
| 426 | EntityClass: me.PhysicalPathTerminationPointPotsUniClassID, |
| 427 | EntityInstance: entityID, |
| 428 | }, |
| 429 | Attributes: managedEntity.GetAttributeValueMap(), |
| 430 | AttributeMask: attributeMask, |
| 431 | Result: me.Success, |
| 432 | } |
| 433 | } |
| 434 | |
Girish Gowdra | a539f52 | 2021-02-15 23:00:45 -0800 | [diff] [blame] | 435 | func createEthernetFramePerformanceMonitoringHistoryDataUpstreamResponse(attributeMask uint16, entityID uint16) *omci.GetResponse { |
Girish Gowdra | a539f52 | 2021-02-15 23:00:45 -0800 | [diff] [blame] | 436 | managedEntity, meErr := me.NewEthernetFramePerformanceMonitoringHistoryDataUpstream(me.ParamData{ |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 437 | EntityID: entityID, |
| 438 | Attributes: me.AttributeValueMap{ |
Girish Gowdra | a539f52 | 2021-02-15 23:00:45 -0800 | [diff] [blame] | 439 | "ManagedEntityId": entityID, |
| 440 | "IntervalEndTime": 0, // This ideally should increment by 1 every collection interval, but staying 0 for simulation is Ok for now. |
| 441 | "ThresholdData12Id": 0, |
| 442 | "DropEvents": rand.Intn(100), |
| 443 | "Octets": rand.Intn(100), |
| 444 | "Packets": rand.Intn(100), |
| 445 | "BroadcastPackets": rand.Intn(100), |
| 446 | "MulticastPackets": rand.Intn(100), |
| 447 | "CrcErroredPackets": rand.Intn(100), |
| 448 | "UndersizePackets": rand.Intn(100), |
| 449 | "OversizePackets": rand.Intn(100), |
| 450 | "Packets64Octets": rand.Intn(100), |
| 451 | "Packets65To127Octets": rand.Intn(100), |
| 452 | "Packets128To255Octets": rand.Intn(100), |
| 453 | "Packets256To511Octets": rand.Intn(100), |
| 454 | "Packets512To1023Octets": rand.Intn(100), |
| 455 | "Packets1024To1518Octets": rand.Intn(100), |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 456 | }, |
| 457 | }) |
| 458 | |
| 459 | if meErr.GetError() != nil { |
Girish Gowdra | a539f52 | 2021-02-15 23:00:45 -0800 | [diff] [blame] | 460 | omciLogger.Errorf("NewEthernetFramePerformanceMonitoringHistoryDataUpstream %v", meErr.Error()) |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 461 | return nil |
| 462 | } |
| 463 | |
| 464 | return &omci.GetResponse{ |
| 465 | MeBasePacket: omci.MeBasePacket{ |
Girish Gowdra | a539f52 | 2021-02-15 23:00:45 -0800 | [diff] [blame] | 466 | EntityClass: me.EthernetFramePerformanceMonitoringHistoryDataUpstreamClassID, |
| 467 | EntityInstance: entityID, |
| 468 | }, |
| 469 | Attributes: managedEntity.GetAttributeValueMap(), |
| 470 | AttributeMask: attributeMask, |
| 471 | Result: me.Success, |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | func createEthernetFramePerformanceMonitoringHistoryDataDownstreamResponse(attributeMask uint16, entityID uint16) *omci.GetResponse { |
Girish Gowdra | a539f52 | 2021-02-15 23:00:45 -0800 | [diff] [blame] | 476 | managedEntity, meErr := me.NewEthernetFramePerformanceMonitoringHistoryDataDownstream(me.ParamData{ |
| 477 | EntityID: entityID, |
| 478 | Attributes: me.AttributeValueMap{ |
| 479 | "ManagedEntityId": entityID, |
| 480 | "IntervalEndTime": 0, // This ideally should increment by 1 every collection interval, but staying 0 for simulation is Ok for now. |
| 481 | "ThresholdData12Id": 0, |
| 482 | "DropEvents": rand.Intn(100), |
| 483 | "Octets": rand.Intn(100), |
| 484 | "Packets": rand.Intn(100), |
| 485 | "BroadcastPackets": rand.Intn(100), |
| 486 | "MulticastPackets": rand.Intn(100), |
| 487 | "CrcErroredPackets": rand.Intn(100), |
| 488 | "UndersizePackets": rand.Intn(100), |
| 489 | "OversizePackets": rand.Intn(100), |
| 490 | "Packets64Octets": rand.Intn(100), |
| 491 | "Packets65To127Octets": rand.Intn(100), |
| 492 | "Packets128To255Octets": rand.Intn(100), |
| 493 | "Packets256To511Octets": rand.Intn(100), |
| 494 | "Packets512To1023Octets": rand.Intn(100), |
| 495 | "Packets1024To1518Octets": rand.Intn(100), |
| 496 | }, |
| 497 | }) |
| 498 | |
| 499 | if meErr.GetError() != nil { |
| 500 | omciLogger.Errorf("NewEthernetFramePerformanceMonitoringHistoryDataDownstream %v", meErr.Error()) |
| 501 | return nil |
| 502 | } |
| 503 | |
Girish Gowdra | a539f52 | 2021-02-15 23:00:45 -0800 | [diff] [blame] | 504 | return &omci.GetResponse{ |
| 505 | MeBasePacket: omci.MeBasePacket{ |
| 506 | EntityClass: me.EthernetFramePerformanceMonitoringHistoryDataDownstreamClassID, |
| 507 | EntityInstance: entityID, |
| 508 | }, |
| 509 | Attributes: managedEntity.GetAttributeValueMap(), |
| 510 | AttributeMask: attributeMask, |
| 511 | Result: me.Success, |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | func createEthernetPerformanceMonitoringHistoryDataResponse(attributeMask uint16, entityID uint16) *omci.GetResponse { |
Girish Gowdra | a539f52 | 2021-02-15 23:00:45 -0800 | [diff] [blame] | 516 | managedEntity, meErr := me.NewEthernetPerformanceMonitoringHistoryData(me.ParamData{ |
| 517 | EntityID: entityID, |
| 518 | Attributes: me.AttributeValueMap{ |
| 519 | "ManagedEntityId": entityID, |
| 520 | "IntervalEndTime": 0, // This ideally should increment by 1 every collection interval, but staying 0 for simulation is Ok for now. |
| 521 | "ThresholdData12Id": 0, |
| 522 | "FcsErrors": rand.Intn(100), |
| 523 | "ExcessiveCollisionCounter": rand.Intn(100), |
| 524 | "LateCollisionCounter": rand.Intn(100), |
| 525 | "FramesTooLong": rand.Intn(100), |
| 526 | "BufferOverflowsOnReceive": rand.Intn(100), |
| 527 | "BufferOverflowsOnTransmit": rand.Intn(100), |
| 528 | "SingleCollisionFrameCounter": rand.Intn(100), |
| 529 | "MultipleCollisionsFrameCounter": rand.Intn(100), |
| 530 | "SqeCounter": rand.Intn(100), |
| 531 | "DeferredTransmissionCounter": rand.Intn(100), |
| 532 | "InternalMacTransmitErrorCounter": rand.Intn(100), |
| 533 | "CarrierSenseErrorCounter": rand.Intn(100), |
| 534 | "AlignmentErrorCounter": rand.Intn(100), |
| 535 | "InternalMacReceiveErrorCounter": rand.Intn(100), |
| 536 | }, |
| 537 | }) |
| 538 | |
| 539 | if meErr.GetError() != nil { |
| 540 | omciLogger.Errorf("NewEthernetPerformanceMonitoringHistoryData %v", meErr.Error()) |
| 541 | return nil |
| 542 | } |
| 543 | |
Girish Gowdra | a539f52 | 2021-02-15 23:00:45 -0800 | [diff] [blame] | 544 | return &omci.GetResponse{ |
| 545 | MeBasePacket: omci.MeBasePacket{ |
| 546 | EntityClass: me.EthernetPerformanceMonitoringHistoryDataClassID, |
| 547 | EntityInstance: entityID, |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 548 | }, |
| 549 | Attributes: managedEntity.GetAttributeValueMap(), |
| 550 | AttributeMask: attributeMask, |
| 551 | Result: me.Success, |
| 552 | } |
| 553 | } |
| 554 | |
Girish Gowdra | 6d9a1a4 | 2021-03-05 16:07:15 -0800 | [diff] [blame] | 555 | func createFecPerformanceMonitoringHistoryDataResponse(attributeMask uint16, entityID uint16) *omci.GetResponse { |
| 556 | managedEntity, meErr := me.NewFecPerformanceMonitoringHistoryData(me.ParamData{ |
| 557 | EntityID: entityID, |
| 558 | Attributes: me.AttributeValueMap{ |
| 559 | "ManagedEntityId": entityID, |
| 560 | "IntervalEndTime": 0, // This ideally should increment by 1 every collection interval, but staying 0 for simulation is Ok for now. |
| 561 | "ThresholdData12Id": 0, |
| 562 | "CorrectedBytes": rand.Intn(100), |
| 563 | "CorrectedCodeWords": rand.Intn(100), |
| 564 | "UncorrectableCodeWords": rand.Intn(100), |
| 565 | "TotalCodeWords": rand.Intn(100), |
| 566 | "FecSeconds": rand.Intn(100), |
| 567 | }, |
| 568 | }) |
| 569 | |
| 570 | if meErr.GetError() != nil { |
| 571 | omciLogger.Errorf("NewFecPerformanceMonitoringHistoryData %v", meErr.Error()) |
| 572 | return nil |
| 573 | } |
| 574 | |
| 575 | // FEC History counter fits within single gem payload. |
| 576 | // No need of the logical we use in other Ethernet History counters or Gem Port History counters |
| 577 | |
| 578 | return &omci.GetResponse{ |
| 579 | MeBasePacket: omci.MeBasePacket{ |
| 580 | EntityClass: me.FecPerformanceMonitoringHistoryDataClassID, |
| 581 | EntityInstance: entityID, |
| 582 | }, |
| 583 | Attributes: managedEntity.GetAttributeValueMap(), |
| 584 | AttributeMask: attributeMask, |
| 585 | Result: me.Success, |
| 586 | } |
| 587 | } |
| 588 | |
| 589 | func createGemPortNetworkCtpPerformanceMonitoringHistoryData(attributeMask uint16, entityID uint16) *omci.GetResponse { |
| 590 | managedEntity, meErr := me.NewGemPortNetworkCtpPerformanceMonitoringHistoryData(me.ParamData{ |
| 591 | EntityID: entityID, |
| 592 | Attributes: me.AttributeValueMap{ |
| 593 | "ManagedEntityId": entityID, |
| 594 | "IntervalEndTime": 0, // This ideally should increment by 1 every collection interval, but staying 0 for simulation is Ok for now. |
| 595 | "ThresholdData12Id": 0, |
| 596 | "TransmittedGemFrames": rand.Intn(100), |
| 597 | "ReceivedGemFrames": rand.Intn(100), |
| 598 | "ReceivedPayloadBytes": rand.Intn(100), |
| 599 | "TransmittedPayloadBytes": rand.Intn(100), |
| 600 | "EncryptionKeyErrors": rand.Intn(100), |
| 601 | }, |
| 602 | }) |
| 603 | |
| 604 | if meErr.GetError() != nil { |
| 605 | omciLogger.Errorf("NewGemPortNetworkCtpPerformanceMonitoringHistoryData %v", meErr.Error()) |
| 606 | return nil |
| 607 | } |
| 608 | |
Girish Gowdra | 6d9a1a4 | 2021-03-05 16:07:15 -0800 | [diff] [blame] | 609 | return &omci.GetResponse{ |
| 610 | MeBasePacket: omci.MeBasePacket{ |
| 611 | EntityClass: me.GemPortNetworkCtpPerformanceMonitoringHistoryDataClassID, |
| 612 | EntityInstance: entityID, |
| 613 | }, |
| 614 | Attributes: managedEntity.GetAttributeValueMap(), |
| 615 | AttributeMask: attributeMask, |
| 616 | Result: me.Success, |
| 617 | } |
| 618 | } |
| 619 | |
Matteo Scandolo | 992a23e | 2021-02-04 15:35:04 -0800 | [diff] [blame] | 620 | func createOnuDataResponse(attributeMask uint16, entityID uint16, mds uint8) *omci.GetResponse { |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 621 | managedEntity, meErr := me.NewOnuData(me.ParamData{ |
| 622 | EntityID: entityID, |
| 623 | Attributes: me.AttributeValueMap{ |
| 624 | "ManagedEntityId": entityID, |
Matteo Scandolo | 992a23e | 2021-02-04 15:35:04 -0800 | [diff] [blame] | 625 | "MibDataSync": mds, |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 626 | }, |
| 627 | }) |
| 628 | |
| 629 | if meErr.GetError() != nil { |
| 630 | omciLogger.Errorf("NewOnuData %v", meErr.Error()) |
| 631 | return nil |
| 632 | } |
| 633 | |
| 634 | return &omci.GetResponse{ |
| 635 | MeBasePacket: omci.MeBasePacket{ |
Girish Gowdra | a539f52 | 2021-02-15 23:00:45 -0800 | [diff] [blame] | 636 | EntityClass: me.OnuDataClassID, |
| 637 | EntityInstance: entityID, |
| 638 | }, |
| 639 | Attributes: managedEntity.GetAttributeValueMap(), |
| 640 | AttributeMask: attributeMask, |
| 641 | Result: me.Success, |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | func createAnigResponse(attributeMask uint16, entityID uint16) *omci.GetResponse { |
| 646 | managedEntity, meErr := me.NewAniG(me.ParamData{ |
| 647 | EntityID: entityID, |
| 648 | Attributes: me.AttributeValueMap{ |
| 649 | "ManagedEntityId": entityID, |
| 650 | "SrIndication": 0, |
| 651 | "TotalTcontNumber": 0, |
| 652 | "GemBlockLength": 0, |
| 653 | "PiggybackDbaReporting": 0, |
| 654 | "Deprecated": 0, |
| 655 | "SignalFailThreshold": 0, |
| 656 | "SignalDegradeThreshold": 0, |
| 657 | "Arc": 0, |
| 658 | "ArcInterval": 0, |
| 659 | "OpticalSignalLevel": rand.Intn(16000), // generate some random power level than defaulting to 0 |
| 660 | "LowerOpticalThreshold": 0, |
| 661 | "UpperOpticalThreshold": 0, |
| 662 | "OnuResponseTime": 0, |
| 663 | "TransmitOpticalLevel": rand.Intn(16000), // generate some random power level than defaulting to 0 |
| 664 | "LowerTransmitPowerThreshold": 0, |
| 665 | "UpperTransmitPowerThreshold": 0, |
| 666 | }, |
| 667 | }) |
| 668 | |
| 669 | if meErr.GetError() != nil { |
| 670 | omciLogger.Errorf("NewAniG %v", meErr.Error()) |
| 671 | return nil |
| 672 | } |
| 673 | |
| 674 | return &omci.GetResponse{ |
| 675 | MeBasePacket: omci.MeBasePacket{ |
| 676 | EntityClass: me.AniGClassID, |
| 677 | EntityInstance: entityID, |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 678 | }, |
| 679 | Attributes: managedEntity.GetAttributeValueMap(), |
| 680 | AttributeMask: attributeMask, |
| 681 | Result: me.Success, |
| 682 | } |
| 683 | } |
| 684 | |
Himani Chawla | 6bd190a | 2021-07-09 15:31:01 +0530 | [diff] [blame] | 685 | func createEthernetFrameExtendedPmGetResponse(meClass me.ClassID, attributeMask uint16, entityID uint16) *omci.GetResponse { |
| 686 | |
| 687 | callback := me.NewEthernetFrameExtendedPm |
| 688 | if meClass != me.EthernetFrameExtendedPmClassID { |
| 689 | callback = me.NewEthernetFrameExtendedPm64Bit |
| 690 | } |
| 691 | managedEntity, meErr := callback(me.ParamData{ |
| 692 | EntityID: entityID, |
| 693 | Attributes: me.AttributeValueMap{ |
| 694 | "ManagedEntityId": entityID, |
| 695 | "DropEvents": rand.Intn(100), |
| 696 | "Octets": rand.Intn(100), |
| 697 | "Frames": rand.Intn(100), |
| 698 | "BroadcastFrames": rand.Intn(100), |
| 699 | "MulticastFrames": rand.Intn(100), |
| 700 | "CrcErroredFrames": rand.Intn(100), |
| 701 | "UndersizeFrames": rand.Intn(100), |
| 702 | "OversizeFrames": rand.Intn(100), |
| 703 | "Frames64Octets": rand.Intn(100), |
| 704 | "Frames65To127Octets": rand.Intn(100), |
| 705 | "Frames128To255Octets": rand.Intn(100), |
| 706 | "Frames256To511Octets": rand.Intn(100), |
| 707 | "Frames512To1023Octets": rand.Intn(100), |
| 708 | "Frames1024To1518Octets": rand.Intn(100), |
| 709 | }, |
| 710 | }) |
| 711 | |
| 712 | if meErr.GetError() != nil { |
| 713 | omciLogger.Errorf("NewEthernetFrameExtendedPm %v", meErr.Error()) |
| 714 | return nil |
| 715 | } |
| 716 | |
| 717 | return &omci.GetResponse{ |
| 718 | MeBasePacket: omci.MeBasePacket{ |
| 719 | EntityClass: meClass, |
| 720 | EntityInstance: entityID, |
| 721 | }, |
| 722 | Attributes: managedEntity.GetAttributeValueMap(), |
| 723 | AttributeMask: attributeMask, |
| 724 | Result: me.Success, |
| 725 | } |
| 726 | } |
| 727 | |
Matteo Scandolo | ef4e8f8 | 2021-05-17 11:20:49 -0700 | [diff] [blame] | 728 | func ToOctets(str string, size int) []byte { |
Matteo Scandolo | f9d4341 | 2021-01-12 11:11:34 -0800 | [diff] [blame] | 729 | asciiBytes := []byte(str) |
| 730 | |
| 731 | if len(asciiBytes) < size { |
| 732 | missing := size - len(asciiBytes) |
| 733 | for i := 0; i < missing; i++ { |
| 734 | asciiBytes = append(asciiBytes, []byte{0x00}[0]) |
| 735 | } |
| 736 | } |
| 737 | return asciiBytes |
| 738 | } |