blob: 2589bbb67b347ce7a2645dbc9fe733a3247504ec [file] [log] [blame]
Chip Boling610117d2021-09-09 11:24:34 -05001/*
2 * Copyright (c) 2018 - present. Boling Consulting Solutions (bcsw.net)
3 * Copyright 2020-present Open Networking Foundation
4
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8
9 * http://www.apache.org/licenses/LICENSE-2.0
10
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18package meframe
19
20import (
21 "errors"
22 "fmt"
23 "github.com/google/gopacket"
Andrea Campanellae0cd8232021-10-15 15:10:23 +020024 . "github.com/opencord/omci-lib-go/v2"
25 me "github.com/opencord/omci-lib-go/v2/generated"
Chip Boling610117d2021-09-09 11:24:34 -050026)
27
28func GetCurrentDataRequestFrame(m *me.ManagedEntity, opt options) (gopacket.SerializableLayer, error) {
29 if opt.frameFormat == ExtendedIdent {
30 return nil, errors.New("extended message set for this message type is not supported")
31 }
32 mask, err := checkAttributeMask(m, opt.attributeMask)
33 if err != nil {
34 return nil, err
35 }
36 // Common for all MEs
37 meLayer := &GetCurrentDataRequest{
38 MeBasePacket: MeBasePacket{
39 EntityClass: m.GetClassID(),
40 EntityInstance: m.GetEntityID(),
41 Extended: opt.frameFormat == ExtendedIdent,
42 },
43 }
44 // Get payload space available
45 maxPayload := maxPacketAvailable(m, opt)
46
47 // TODO: Lots of work to do
48
49 fmt.Println(mask, maxPayload)
50 return meLayer, errors.New("todo: Not implemented")
51}
52
53func GetCurrentDataResponseFrame(m *me.ManagedEntity, opt options) (gopacket.SerializableLayer, error) {
54 if opt.frameFormat == ExtendedIdent {
55 return nil, errors.New("extended message set for this message type is not supported")
56 }
57 mask, err := checkAttributeMask(m, opt.attributeMask)
58 if err != nil {
59 return nil, err
60 }
61 // Common for all MEs
62 meLayer := &GetCurrentDataResponse{
63 MeBasePacket: MeBasePacket{
64 EntityClass: m.GetClassID(),
65 EntityInstance: m.GetEntityID(),
66 Extended: opt.frameFormat == ExtendedIdent,
67 },
68 }
69 // Get payload space available
70 maxPayload := maxPacketAvailable(m, opt)
71
72 // TODO: Lots of work to do
73
74 fmt.Println(mask, maxPayload)
75 return meLayer, errors.New("todo: Not implemented")
76}