blob: 0cc76c5f2d6ffddc8a386d466b05c1e5543e4903 [file] [log] [blame]
khenaidoobf6e7bb2018-08-14 22:27:29 -04001/*
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 */
16package grpc
17
18import (
19 "context"
20 "errors"
21 "github.com/golang/protobuf/ptypes/empty"
22 "github.com/opencord/voltha-go/common/log"
23 "github.com/opencord/voltha-go/protos/common"
24 "github.com/opencord/voltha-go/protos/openflow_13"
25 "github.com/opencord/voltha-go/protos/voltha"
26)
27
28type DefaultAPIHandler struct {
29}
30
khenaidoob9203542018-09-17 22:56:37 -040031func init() {
32 log.AddPackage(log.JSON, log.WarnLevel, nil)
33}
34
khenaidoobf6e7bb2018-08-14 22:27:29 -040035func NewDefaultAPIHandler() *DefaultAPIHandler {
36 handler := &DefaultAPIHandler{}
37 return handler
38}
39
40func (handler *DefaultAPIHandler) UpdateLogLevel(ctx context.Context, logging *voltha.Logging) (*empty.Empty, error) {
41 log.Debugw("UpdateLogLevel-request", log.Fields{"newloglevel": logging.Level, "intval": int(logging.Level)})
42 return nil, errors.New("UnImplemented")
43}
44
45func (handler *DefaultAPIHandler) GetVoltha(ctx context.Context, empty *empty.Empty) (*voltha.Voltha, error) {
46 log.Debug("GetVoltha-request")
47 return nil, errors.New("UnImplemented")
48}
49
50func (handler *DefaultAPIHandler) ListCoreInstances(ctx context.Context, empty *empty.Empty) (*voltha.CoreInstances, error) {
51 log.Debug("ListCoreInstances-request")
52 return nil, errors.New("UnImplemented")
53}
54
55func (handler *DefaultAPIHandler) GetCoreInstance(ctx context.Context, id *voltha.ID) (*voltha.CoreInstance, error) {
56 log.Debugw("GetCoreInstance-request", log.Fields{"id": *id})
57 return nil, errors.New("UnImplemented")
58}
59
60func (handler *DefaultAPIHandler) ListAdapters(ctx context.Context, empty *empty.Empty) (*voltha.Adapters, error) {
61 log.Debug("ListAdapters-request")
62 return nil, errors.New("UnImplemented")
63}
64
65func (handler *DefaultAPIHandler) ListLogicalDevices(ctx context.Context, empty *empty.Empty) (*voltha.LogicalDevices, error) {
66 log.Debug("ListLogicalDevices-request")
67 return nil, errors.New("UnImplemented")
68}
69
70func (handler *DefaultAPIHandler) GetLogicalDevice(ctx context.Context, id *voltha.ID) (*voltha.LogicalDevice, error) {
71 log.Debugw("GetLogicalDevice-request", log.Fields{"id": *id})
72 return nil, errors.New("UnImplemented")
73}
74
75func (handler *DefaultAPIHandler) ListLogicalDevicePorts(ctx context.Context, id *voltha.ID) (*voltha.LogicalPorts, error) {
76 log.Debugw("ListLogicalDevicePorts-request", log.Fields{"id": *id})
77 return nil, errors.New("UnImplemented")
78}
79
80func (handler *DefaultAPIHandler) GetLogicalDevicePort(ctx context.Context, id *voltha.LogicalPortId) (*voltha.LogicalPort, error) {
81 log.Debugw("GetLogicalDevicePort-request", log.Fields{"id": *id})
82 return nil, errors.New("UnImplemented")
83}
84
85func (handler *DefaultAPIHandler) EnableLogicalDevicePort(ctx context.Context, id *voltha.LogicalPortId) (*empty.Empty, error) {
86 log.Debugw("EnableLogicalDevicePort-request", log.Fields{"id": *id})
87 return nil, errors.New("UnImplemented")
88}
89
90func (handler *DefaultAPIHandler) DisableLogicalDevicePort(ctx context.Context, id *voltha.LogicalPortId) (*empty.Empty, error) {
91 log.Debugw("DisableLogicalDevicePort-request", log.Fields{"id": *id})
92 return nil, errors.New("UnImplemented")
93}
94
95func (handler *DefaultAPIHandler) ListLogicalDeviceFlows(ctx context.Context, id *voltha.ID) (*openflow_13.Flows, error) {
96 log.Debugw("ListLogicalDeviceFlows-request", log.Fields{"id": *id})
97 return nil, errors.New("UnImplemented")
98}
99
100func (handler *DefaultAPIHandler) UpdateLogicalDeviceFlowTable(ctx context.Context, flow *openflow_13.FlowTableUpdate) (*empty.Empty, error) {
101 log.Debugw("UpdateLogicalDeviceFlowTable-request", log.Fields{"flow": *flow})
102 return nil, errors.New("UnImplemented")
103}
104
105func (handler *DefaultAPIHandler) UpdateLogicalDeviceFlowGroupTable(ctx context.Context, flow *openflow_13.FlowGroupTableUpdate) (*empty.Empty, error) {
106 log.Debugw("UpdateLogicalDeviceFlowGroupTable-request", log.Fields{"flow": *flow})
107 return nil, errors.New("UnImplemented")
108}
109
110func (handler *DefaultAPIHandler) ListLogicalDeviceFlowGroups(ctx context.Context, id *voltha.ID) (*openflow_13.FlowGroups, error) {
111 log.Debugw("ListLogicalDeviceFlowGroups-request", log.Fields{"id": *id})
112 return nil, errors.New("UnImplemented")
113}
114
115func (handler *DefaultAPIHandler) ListDevices(ctx context.Context, empty *empty.Empty) (*voltha.Devices, error) {
116 log.Debug("ListDevices-request")
117 return nil, errors.New("UnImplemented")
118}
119
khenaidoo7ccedd52018-12-14 16:48:54 -0500120func (handler *DefaultAPIHandler) ListDeviceIds(ctx context.Context, empty *empty.Empty) (*voltha.IDs, error) {
121 log.Debug("ListDeviceIDs-request")
122 return nil, errors.New("UnImplemented")
123}
124
125func (handler *DefaultAPIHandler) ReconcileDevices(ctx context.Context, ids *voltha.IDs) (*empty.Empty, error) {
126 if ids != nil {
127 log.Debugw("ReconcileDevices-request", log.Fields{"length": len(ids.Items)})
128 return nil, errors.New("UnImplemented")
129 }
130 return nil, errors.New("ids-null")
131}
132
khenaidoobf6e7bb2018-08-14 22:27:29 -0400133func (handler *DefaultAPIHandler) GetDevice(ctx context.Context, id *voltha.ID) (*voltha.Device, error) {
134 log.Debugw("GetDevice-request", log.Fields{"id": id})
135 return nil, errors.New("UnImplemented")
136}
137
138func (handler *DefaultAPIHandler) CreateDevice(ctx context.Context, device *voltha.Device) (*voltha.Device, error) {
139 log.Debugw("CreateDevice-request", log.Fields{"device": *device})
140 return nil, errors.New("UnImplemented")
141}
142
143func (handler *DefaultAPIHandler) EnableDevice(ctx context.Context, id *voltha.ID) (*empty.Empty, error) {
144 log.Debugw("EnableDevice-request", log.Fields{"id": *id})
145 return nil, errors.New("UnImplemented")
146}
147
148func (handler *DefaultAPIHandler) DisableDevice(ctx context.Context, id *voltha.ID) (*empty.Empty, error) {
149 log.Debugw("DisableDevice-request", log.Fields{"id": *id})
150 return nil, errors.New("UnImplemented")
151}
152
153func (handler *DefaultAPIHandler) RebootDevice(ctx context.Context, id *voltha.ID) (*empty.Empty, error) {
154 log.Debugw("RebootDevice-request", log.Fields{"id": *id})
155 return nil, errors.New("UnImplemented")
156}
157
158func (handler *DefaultAPIHandler) DeleteDevice(ctx context.Context, id *voltha.ID) (*empty.Empty, error) {
159 log.Debugw("DeleteDevice-request", log.Fields{"id": *id})
160 return nil, errors.New("UnImplemented")
161}
162
163func (handler *DefaultAPIHandler) DownloadImage(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) {
164 log.Debugw("DownloadImage-request", log.Fields{"img": *img})
165 return nil, errors.New("UnImplemented")
166}
167
168func (handler *DefaultAPIHandler) GetImageDownloadStatus(ctx context.Context, img *voltha.ImageDownload) (*voltha.ImageDownload, error) {
169 log.Debugw("GetImageDownloadStatus-request", log.Fields{"img": *img})
170 return nil, errors.New("UnImplemented")
171}
172
173func (handler *DefaultAPIHandler) GetImageDownload(ctx context.Context, img *voltha.ImageDownload) (*voltha.ImageDownload, error) {
174 log.Debugw("getdevice-request", log.Fields{"img": *img})
175 return nil, errors.New("UnImplemented")
176}
177
178func (handler *DefaultAPIHandler) ListImageDownloads(ctx context.Context, id *voltha.ID) (*voltha.ImageDownloads, error) {
179 log.Debugw("ListImageDownloads-request", log.Fields{"id": *id})
180 return nil, errors.New("UnImplemented")
181}
182
183func (handler *DefaultAPIHandler) CancelImageDownload(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) {
184 log.Debugw("CancelImageDownload-request", log.Fields{"img": *img})
185 return nil, errors.New("UnImplemented")
186}
187
188func (handler *DefaultAPIHandler) ActivateImageUpdate(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) {
189 log.Debugw("ActivateImageUpdate-request", log.Fields{"img": *img})
190 return nil, errors.New("UnImplemented")
191}
192
193func (handler *DefaultAPIHandler) RevertImageUpdate(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) {
194 log.Debugw("RevertImageUpdate-request", log.Fields{"img": *img})
195 return nil, errors.New("UnImplemented")
196}
197
198func (handler *DefaultAPIHandler) ListDevicePorts(ctx context.Context, id *voltha.ID) (*voltha.Ports, error) {
199 log.Debugw("ListDevicePorts-request", log.Fields{"id": *id})
200 return nil, errors.New("UnImplemented")
201}
202
203func (handler *DefaultAPIHandler) ListDevicePmConfigs(ctx context.Context, id *voltha.ID) (*voltha.PmConfigs, error) {
204 log.Debugw("ListDevicePmConfigs-request", log.Fields{"id": *id})
205 return nil, errors.New("UnImplemented")
206}
207
208func (handler *DefaultAPIHandler) UpdateDevicePmConfigs(ctx context.Context, configs *voltha.PmConfigs) (*empty.Empty, error) {
209 log.Debugw("UpdateDevicePmConfigs-request", log.Fields{"configs": *configs})
210 return nil, errors.New("UnImplemented")
211}
212
213func (handler *DefaultAPIHandler) ListDeviceFlows(ctx context.Context, id *voltha.ID) (*openflow_13.Flows, error) {
214 log.Debugw("ListDeviceFlows-request", log.Fields{"id": *id})
215 return nil, errors.New("UnImplemented")
216}
217
218func (handler *DefaultAPIHandler) ListDeviceFlowGroups(ctx context.Context, id *voltha.ID) (*openflow_13.FlowGroups, error) {
219 log.Debugw("ListDeviceFlowGroups-request", log.Fields{"id": *id})
220 return nil, errors.New("UnImplemented")
221}
222
223func (handler *DefaultAPIHandler) ListDeviceTypes(ctx context.Context, empty *empty.Empty) (*voltha.DeviceTypes, error) {
224 log.Debug("ListDeviceTypes-request")
225 return nil, errors.New("UnImplemented")
226}
227
228func (handler *DefaultAPIHandler) GetDeviceType(ctx context.Context, id *voltha.ID) (*voltha.DeviceType, error) {
229 log.Debugw("GetDeviceType-request", log.Fields{"id": *id})
230 return nil, errors.New("UnImplemented")
231}
232
233func (handler *DefaultAPIHandler) ListDeviceGroups(ctx context.Context, empty *empty.Empty) (*voltha.DeviceGroups, error) {
234 log.Debug("ListDeviceGroups-request")
235 return nil, errors.New("UnImplemented")
236}
237
238func (handler *DefaultAPIHandler) GetDeviceGroup(ctx context.Context, id *voltha.ID) (*voltha.DeviceGroup, error) {
239 log.Debugw("GetDeviceGroup-request", log.Fields{"id": *id})
240 return nil, errors.New("UnImplemented")
241}
242
243func (handler *DefaultAPIHandler) CreateAlarmFilter(ctx context.Context, filter *voltha.AlarmFilter) (*voltha.AlarmFilter, error) {
244 log.Debugw("CreateAlarmFilter-request", log.Fields{"filter": *filter})
245 return nil, errors.New("UnImplemented")
246}
247
248func (handler *DefaultAPIHandler) GetAlarmFilter(ctx context.Context, id *voltha.ID) (*voltha.AlarmFilter, error) {
249 log.Debugw("GetAlarmFilter-request", log.Fields{"id": id})
250 return nil, errors.New("UnImplemented")
251}
252
253func (handler *DefaultAPIHandler) UpdateAlarmFilter(ctx context.Context, filter *voltha.AlarmFilter) (*voltha.AlarmFilter, error) {
254 log.Debugw("UpdateAlarmFilter-request", log.Fields{"filter": *filter})
255 return nil, errors.New("UnImplemented")
256}
257
258func (handler *DefaultAPIHandler) DeleteAlarmFilter(ctx context.Context, id *voltha.ID) (*empty.Empty, error) {
259 log.Debugw("DeleteAlarmFilter-request", log.Fields{"id": *id})
260 return nil, errors.New("UnImplemented")
261}
262
263func (handler *DefaultAPIHandler) ListAlarmFilters(ctx context.Context, empty *empty.Empty) (*voltha.AlarmFilters, error) {
264 log.Debug("ListAlarmFilters-request")
265 return nil, errors.New("UnImplemented")
266}
267
268func (handler *DefaultAPIHandler) GetImages(ctx context.Context, id *voltha.ID) (*voltha.Images, error) {
269 log.Debugw("GetImages-request", log.Fields{"id": id})
270 return nil, errors.New("UnImplemented")
271}
272
273func (handler *DefaultAPIHandler) SelfTest(ctx context.Context, id *voltha.ID) (*voltha.SelfTestResponse, error) {
274 log.Debugw("SelfTest-request", log.Fields{"id": id})
275 return nil, errors.New("UnImplemented")
276}
Stephane Barbarie6e1bd502018-11-05 22:44:45 -0500277
278func (handler *DefaultAPIHandler) StreamPacketsOut(packetsOut voltha.VolthaService_StreamPacketsOutServer) error {
279 log.Debugw("StreamPacketsOut-request", log.Fields{"packetsOut": packetsOut})
280 return errors.New("UnImplemented")
281}
282
283func (handler *DefaultAPIHandler) ReceivePacketsIn(
284 empty *empty.Empty,
285 packetsIn voltha.VolthaService_ReceivePacketsInServer,
286) error {
287 log.Debugw("ReceivePacketsIn-request", log.Fields{"packetsIn": packetsIn})
288 return errors.New("UnImplemented")
289}
290
291func (handler *DefaultAPIHandler) ReceiveChangeEvents(
292 empty *empty.Empty,
293 changeEvents voltha.VolthaService_ReceiveChangeEventsServer,
294) error {
295 log.Debugw("ReceiveChangeEvents-request", log.Fields{"changeEvents": changeEvents})
296 return errors.New("UnImplemented")
297}
298
299func (handler *DefaultAPIHandler) Subscribe(
300 ctx context.Context,
301 ofAgent *voltha.OfAgentSubscriber,
302) (*voltha.OfAgentSubscriber, error) {
303 log.Debugw("Subscribe-request", log.Fields{"ofAgent": ofAgent})
304 return nil, errors.New("UnImplemented")
305}