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