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" |
| 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 | |
| 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 | |
| 45 | func (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 | |
| 50 | func (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 | |
| 55 | func (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 | |
| 60 | func (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 | |
| 65 | func (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 | |
| 70 | func (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 | |
| 75 | func (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 | |
| 80 | func (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 | |
| 85 | func (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 | |
| 90 | func (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 | |
| 95 | func (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 | |
| 100 | func (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 | |
| 105 | func (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 | |
| 110 | func (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 | |
| 115 | func (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 | |
| 120 | func (handler *DefaultAPIHandler) GetDevice(ctx context.Context, id *voltha.ID) (*voltha.Device, error) { |
| 121 | log.Debugw("GetDevice-request", log.Fields{"id": id}) |
| 122 | return nil, errors.New("UnImplemented") |
| 123 | } |
| 124 | |
| 125 | func (handler *DefaultAPIHandler) CreateDevice(ctx context.Context, device *voltha.Device) (*voltha.Device, error) { |
| 126 | log.Debugw("CreateDevice-request", log.Fields{"device": *device}) |
| 127 | return nil, errors.New("UnImplemented") |
| 128 | } |
| 129 | |
| 130 | func (handler *DefaultAPIHandler) EnableDevice(ctx context.Context, id *voltha.ID) (*empty.Empty, error) { |
| 131 | log.Debugw("EnableDevice-request", log.Fields{"id": *id}) |
| 132 | return nil, errors.New("UnImplemented") |
| 133 | } |
| 134 | |
| 135 | func (handler *DefaultAPIHandler) DisableDevice(ctx context.Context, id *voltha.ID) (*empty.Empty, error) { |
| 136 | log.Debugw("DisableDevice-request", log.Fields{"id": *id}) |
| 137 | return nil, errors.New("UnImplemented") |
| 138 | } |
| 139 | |
| 140 | func (handler *DefaultAPIHandler) RebootDevice(ctx context.Context, id *voltha.ID) (*empty.Empty, error) { |
| 141 | log.Debugw("RebootDevice-request", log.Fields{"id": *id}) |
| 142 | return nil, errors.New("UnImplemented") |
| 143 | } |
| 144 | |
| 145 | func (handler *DefaultAPIHandler) DeleteDevice(ctx context.Context, id *voltha.ID) (*empty.Empty, error) { |
| 146 | log.Debugw("DeleteDevice-request", log.Fields{"id": *id}) |
| 147 | return nil, errors.New("UnImplemented") |
| 148 | } |
| 149 | |
| 150 | func (handler *DefaultAPIHandler) DownloadImage(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) { |
| 151 | log.Debugw("DownloadImage-request", log.Fields{"img": *img}) |
| 152 | return nil, errors.New("UnImplemented") |
| 153 | } |
| 154 | |
| 155 | func (handler *DefaultAPIHandler) GetImageDownloadStatus(ctx context.Context, img *voltha.ImageDownload) (*voltha.ImageDownload, error) { |
| 156 | log.Debugw("GetImageDownloadStatus-request", log.Fields{"img": *img}) |
| 157 | return nil, errors.New("UnImplemented") |
| 158 | } |
| 159 | |
| 160 | func (handler *DefaultAPIHandler) GetImageDownload(ctx context.Context, img *voltha.ImageDownload) (*voltha.ImageDownload, error) { |
| 161 | log.Debugw("getdevice-request", log.Fields{"img": *img}) |
| 162 | return nil, errors.New("UnImplemented") |
| 163 | } |
| 164 | |
| 165 | func (handler *DefaultAPIHandler) ListImageDownloads(ctx context.Context, id *voltha.ID) (*voltha.ImageDownloads, error) { |
| 166 | log.Debugw("ListImageDownloads-request", log.Fields{"id": *id}) |
| 167 | return nil, errors.New("UnImplemented") |
| 168 | } |
| 169 | |
| 170 | func (handler *DefaultAPIHandler) CancelImageDownload(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) { |
| 171 | log.Debugw("CancelImageDownload-request", log.Fields{"img": *img}) |
| 172 | return nil, errors.New("UnImplemented") |
| 173 | } |
| 174 | |
| 175 | func (handler *DefaultAPIHandler) ActivateImageUpdate(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) { |
| 176 | log.Debugw("ActivateImageUpdate-request", log.Fields{"img": *img}) |
| 177 | return nil, errors.New("UnImplemented") |
| 178 | } |
| 179 | |
| 180 | func (handler *DefaultAPIHandler) RevertImageUpdate(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) { |
| 181 | log.Debugw("RevertImageUpdate-request", log.Fields{"img": *img}) |
| 182 | return nil, errors.New("UnImplemented") |
| 183 | } |
| 184 | |
| 185 | func (handler *DefaultAPIHandler) ListDevicePorts(ctx context.Context, id *voltha.ID) (*voltha.Ports, error) { |
| 186 | log.Debugw("ListDevicePorts-request", log.Fields{"id": *id}) |
| 187 | return nil, errors.New("UnImplemented") |
| 188 | } |
| 189 | |
| 190 | func (handler *DefaultAPIHandler) ListDevicePmConfigs(ctx context.Context, id *voltha.ID) (*voltha.PmConfigs, error) { |
| 191 | log.Debugw("ListDevicePmConfigs-request", log.Fields{"id": *id}) |
| 192 | return nil, errors.New("UnImplemented") |
| 193 | } |
| 194 | |
| 195 | func (handler *DefaultAPIHandler) UpdateDevicePmConfigs(ctx context.Context, configs *voltha.PmConfigs) (*empty.Empty, error) { |
| 196 | log.Debugw("UpdateDevicePmConfigs-request", log.Fields{"configs": *configs}) |
| 197 | return nil, errors.New("UnImplemented") |
| 198 | } |
| 199 | |
| 200 | func (handler *DefaultAPIHandler) ListDeviceFlows(ctx context.Context, id *voltha.ID) (*openflow_13.Flows, error) { |
| 201 | log.Debugw("ListDeviceFlows-request", log.Fields{"id": *id}) |
| 202 | return nil, errors.New("UnImplemented") |
| 203 | } |
| 204 | |
| 205 | func (handler *DefaultAPIHandler) ListDeviceFlowGroups(ctx context.Context, id *voltha.ID) (*openflow_13.FlowGroups, error) { |
| 206 | log.Debugw("ListDeviceFlowGroups-request", log.Fields{"id": *id}) |
| 207 | return nil, errors.New("UnImplemented") |
| 208 | } |
| 209 | |
| 210 | func (handler *DefaultAPIHandler) ListDeviceTypes(ctx context.Context, empty *empty.Empty) (*voltha.DeviceTypes, error) { |
| 211 | log.Debug("ListDeviceTypes-request") |
| 212 | return nil, errors.New("UnImplemented") |
| 213 | } |
| 214 | |
| 215 | func (handler *DefaultAPIHandler) GetDeviceType(ctx context.Context, id *voltha.ID) (*voltha.DeviceType, error) { |
| 216 | log.Debugw("GetDeviceType-request", log.Fields{"id": *id}) |
| 217 | return nil, errors.New("UnImplemented") |
| 218 | } |
| 219 | |
| 220 | func (handler *DefaultAPIHandler) ListDeviceGroups(ctx context.Context, empty *empty.Empty) (*voltha.DeviceGroups, error) { |
| 221 | log.Debug("ListDeviceGroups-request") |
| 222 | return nil, errors.New("UnImplemented") |
| 223 | } |
| 224 | |
| 225 | func (handler *DefaultAPIHandler) GetDeviceGroup(ctx context.Context, id *voltha.ID) (*voltha.DeviceGroup, error) { |
| 226 | log.Debugw("GetDeviceGroup-request", log.Fields{"id": *id}) |
| 227 | return nil, errors.New("UnImplemented") |
| 228 | } |
| 229 | |
| 230 | func (handler *DefaultAPIHandler) CreateAlarmFilter(ctx context.Context, filter *voltha.AlarmFilter) (*voltha.AlarmFilter, error) { |
| 231 | log.Debugw("CreateAlarmFilter-request", log.Fields{"filter": *filter}) |
| 232 | return nil, errors.New("UnImplemented") |
| 233 | } |
| 234 | |
| 235 | func (handler *DefaultAPIHandler) GetAlarmFilter(ctx context.Context, id *voltha.ID) (*voltha.AlarmFilter, error) { |
| 236 | log.Debugw("GetAlarmFilter-request", log.Fields{"id": id}) |
| 237 | return nil, errors.New("UnImplemented") |
| 238 | } |
| 239 | |
| 240 | func (handler *DefaultAPIHandler) UpdateAlarmFilter(ctx context.Context, filter *voltha.AlarmFilter) (*voltha.AlarmFilter, error) { |
| 241 | log.Debugw("UpdateAlarmFilter-request", log.Fields{"filter": *filter}) |
| 242 | return nil, errors.New("UnImplemented") |
| 243 | } |
| 244 | |
| 245 | func (handler *DefaultAPIHandler) DeleteAlarmFilter(ctx context.Context, id *voltha.ID) (*empty.Empty, error) { |
| 246 | log.Debugw("DeleteAlarmFilter-request", log.Fields{"id": *id}) |
| 247 | return nil, errors.New("UnImplemented") |
| 248 | } |
| 249 | |
| 250 | func (handler *DefaultAPIHandler) ListAlarmFilters(ctx context.Context, empty *empty.Empty) (*voltha.AlarmFilters, error) { |
| 251 | log.Debug("ListAlarmFilters-request") |
| 252 | return nil, errors.New("UnImplemented") |
| 253 | } |
| 254 | |
| 255 | func (handler *DefaultAPIHandler) GetImages(ctx context.Context, id *voltha.ID) (*voltha.Images, error) { |
| 256 | log.Debugw("GetImages-request", log.Fields{"id": id}) |
| 257 | return nil, errors.New("UnImplemented") |
| 258 | } |
| 259 | |
| 260 | func (handler *DefaultAPIHandler) SelfTest(ctx context.Context, id *voltha.ID) (*voltha.SelfTestResponse, error) { |
| 261 | log.Debugw("SelfTest-request", log.Fields{"id": id}) |
| 262 | return nil, errors.New("UnImplemented") |
| 263 | } |