khenaidoo | bf6e7bb | 2018-08-14 22:27:29 -0400 | [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 | package grpc |
| 17 | |
| 18 | import ( |
| 19 | "context" |
| 20 | "errors" |
| 21 | "github.com/golang/protobuf/ptypes/empty" |
| 22 | "github.com/opencord/voltha-go/common/log" |
William Kurkian | daa6bb2 | 2019-03-07 12:26:28 -0500 | [diff] [blame] | 23 | "github.com/opencord/voltha-protos/go/common" |
| 24 | "github.com/opencord/voltha-protos/go/openflow_13" |
| 25 | "github.com/opencord/voltha-protos/go/voltha" |
khenaidoo | bf6e7bb | 2018-08-14 22:27:29 -0400 | [diff] [blame] | 26 | ) |
| 27 | |
| 28 | type DefaultAPIHandler struct { |
| 29 | } |
| 30 | |
khenaidoo | b920354 | 2018-09-17 22:56:37 -0400 | [diff] [blame] | 31 | func init() { |
| 32 | log.AddPackage(log.JSON, log.WarnLevel, nil) |
| 33 | } |
| 34 | |
khenaidoo | bf6e7bb | 2018-08-14 22:27:29 -0400 | [diff] [blame] | 35 | func NewDefaultAPIHandler() *DefaultAPIHandler { |
| 36 | handler := &DefaultAPIHandler{} |
| 37 | return handler |
| 38 | } |
| 39 | |
| 40 | func (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 | |
khenaidoo | 6417b6c | 2019-03-01 18:18:01 -0500 | [diff] [blame] | 45 | func (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 | |
khenaidoo | 54e0ddf | 2019-02-27 16:21:33 -0500 | [diff] [blame] | 50 | func (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 | |
khenaidoo | bf6e7bb | 2018-08-14 22:27:29 -0400 | [diff] [blame] | 55 | func (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 | |
| 60 | func (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 | |
| 65 | func (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 | |
| 70 | func (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 | |
| 75 | func (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 | |
| 80 | func (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 | |
| 85 | func (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 | |
| 90 | func (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 | |
| 95 | func (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 | |
| 100 | func (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 | |
| 105 | func (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 | |
| 110 | func (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 | |
| 115 | func (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 | |
| 120 | func (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 | |
| 125 | func (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 | |
khenaidoo | 7ccedd5 | 2018-12-14 16:48:54 -0500 | [diff] [blame] | 130 | func (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 | |
| 135 | func (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 | |
khenaidoo | bf6e7bb | 2018-08-14 22:27:29 -0400 | [diff] [blame] | 143 | func (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 | |
| 148 | func (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 | |
| 153 | func (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 | |
| 158 | func (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 | |
| 163 | func (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 | |
| 168 | func (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 | |
| 173 | func (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 | |
| 178 | func (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 | |
| 183 | func (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 | |
| 188 | func (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 | |
| 193 | func (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 | |
| 198 | func (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 | |
| 203 | func (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 | |
| 208 | func (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 | |
| 213 | func (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 | |
| 218 | func (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 | |
| 223 | func (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 | |
| 228 | func (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 | |
| 233 | func (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 | |
| 238 | func (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 | |
| 243 | func (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 | |
| 248 | func (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 | |
| 253 | func (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 | |
| 258 | func (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 | |
| 263 | func (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 | |
| 268 | func (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 | |
| 273 | func (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 | |
| 278 | func (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 | |
| 283 | func (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 Barbarie | 6e1bd50 | 2018-11-05 22:44:45 -0500 | [diff] [blame] | 287 | |
| 288 | func (handler *DefaultAPIHandler) StreamPacketsOut(packetsOut voltha.VolthaService_StreamPacketsOutServer) error { |
| 289 | log.Debugw("StreamPacketsOut-request", log.Fields{"packetsOut": packetsOut}) |
| 290 | return errors.New("UnImplemented") |
| 291 | } |
| 292 | |
| 293 | func (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 | |
| 301 | func (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 | |
| 309 | func (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 | } |
Manikkaraj k | b1a1092 | 2019-07-29 12:10:34 -0400 | [diff] [blame] | 316 | |
| 317 | func (handler *DefaultAPIHandler) UpdateLogicalDeviceMeterTable(ctx context.Context, mod *openflow_13.MeterModUpdate) (*empty.Empty, error) { |
| 318 | log.Debugw("UpdateLogicalDeviceMeterTable-request", log.Fields{"meter": mod}) |
| 319 | return nil, errors.New("UnImplemented") |
| 320 | } |
| 321 | |
| 322 | func (handler *DefaultAPIHandler) ListLogicalDeviceMeters(ctx context.Context, id *voltha.ID) (*openflow_13.Meters, error) { |
| 323 | log.Debugw("ListLogicalDeviceMeters-unimplemented", log.Fields{"id": id}) |
| 324 | return nil, nil |
| 325 | } |