blob: 28cb2057227369404b969803322f9c216479ea7b [file] [log] [blame]
Zack Williams41513bf2018-07-07 20:08:35 -07001/*
2 * Copyright 2017-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 */
Stephane Barbarie35595062018-02-08 08:34:39 -050016package nbi
17
18import (
19 "context"
20 "github.com/golang/protobuf/ptypes/empty"
21 "github.com/opencord/voltha/ponsim/v2/core"
22 "github.com/opencord/voltha/protos/go/voltha"
23)
24
25type XPonSimHandler struct {
26 device *core.XPonSimDevice
27}
28
29func NewXPonSimHandler() *XPonSimHandler {
30 var handler *XPonSimHandler
31 handler = &XPonSimHandler{}
32 return handler
33}
34
35func (handler *XPonSimHandler) CreateInterface(
36 ctx context.Context,
37 config *voltha.InterfaceConfig,
38) (*empty.Empty, error) {
39 handler.device.CreateInterface(ctx, config)
40 return &empty.Empty{}, nil
41}
42func (handler *XPonSimHandler) UpdateInterface(
43 ctx context.Context,
44 config *voltha.InterfaceConfig,
45) (*empty.Empty, error) {
46 handler.device.UpdateInterface(ctx, config)
47 return &empty.Empty{}, nil
48}
49func (handler *XPonSimHandler) RemoveInterface(
50 ctx context.Context,
51 config *voltha.InterfaceConfig,
52) (*empty.Empty, error) {
53 handler.device.RemoveInterface(ctx, config)
54 return &empty.Empty{}, nil
55}
56func (handler *XPonSimHandler) CreateTcont(
57 ctx context.Context,
58 config *voltha.TcontInterfaceConfig,
59) (*empty.Empty, error) {
60 handler.device.CreateTcont(ctx, config.TcontsConfigData, config.TrafficDescriptorProfileConfigData)
61 return &empty.Empty{}, nil
62}
63func (handler *XPonSimHandler) UpdateTcont(
64 ctx context.Context,
65 config *voltha.TcontInterfaceConfig,
66) (*empty.Empty, error) {
67 handler.device.UpdateTcont(ctx, config.TcontsConfigData, config.TrafficDescriptorProfileConfigData)
68 return &empty.Empty{}, nil
69}
70func (handler *XPonSimHandler) RemoveTcont(
71 ctx context.Context,
72 config *voltha.TcontInterfaceConfig,
73) (*empty.Empty, error) {
74 handler.device.RemoveTcont(ctx, config.TcontsConfigData, config.TrafficDescriptorProfileConfigData)
75 return &empty.Empty{}, nil
76}
77func (handler *XPonSimHandler) CreateGemport(
78 ctx context.Context,
79 config *voltha.InterfaceConfig,
80) (*empty.Empty, error) {
81 handler.device.CreateGemport(ctx, config)
82 return &empty.Empty{}, nil
83}
84func (handler *XPonSimHandler) UpdateGemport(
85 ctx context.Context,
86 config *voltha.InterfaceConfig,
87) (*empty.Empty, error) {
88 handler.device.UpdateGemport(ctx, config)
89 return &empty.Empty{}, nil
90}
91func (handler *XPonSimHandler) RemoveGemport(
92 ctx context.Context,
93 config *voltha.InterfaceConfig,
94) (*empty.Empty, error) {
95 handler.device.RemoveGemport(ctx, config)
96 return &empty.Empty{}, nil
97}
98func (handler *XPonSimHandler) CreateMulticastGemport(
99 ctx context.Context,
100 config *voltha.InterfaceConfig,
101) (*empty.Empty, error) {
102 handler.device.CreateMulticastGemport(ctx, config)
103 return &empty.Empty{}, nil
104}
105func (handler *XPonSimHandler) UpdateMulticastGemport(
106 ctx context.Context,
107 config *voltha.InterfaceConfig,
108) (*empty.Empty, error) {
109 handler.device.UpdateMulticastGemport(ctx, config)
110 return &empty.Empty{}, nil
111}
112func (handler *XPonSimHandler) RemoveMulticastGemport(
113 ctx context.Context,
114 config *voltha.InterfaceConfig,
115) (*empty.Empty, error) {
116 handler.device.RemoveMulticastGemport(ctx, config)
117 return &empty.Empty{}, nil
118}
119func (handler *XPonSimHandler) CreateMulticastDistributionSet(
120 ctx context.Context,
121 config *voltha.InterfaceConfig,
122) (*empty.Empty, error) {
123 handler.device.CreateMulticastDistributionSet(ctx, config)
124 return &empty.Empty{}, nil
125}
126func (handler *XPonSimHandler) UpdateMulticastDistributionSet(
127 ctx context.Context,
128 config *voltha.InterfaceConfig,
129) (*empty.Empty, error) {
130 handler.device.UpdateMulticastDistributionSet(ctx, config)
131 return &empty.Empty{}, nil
132}
133func (handler *XPonSimHandler) RemoveMulticastDistributionSet(
134 ctx context.Context,
135 config *voltha.InterfaceConfig,
136) (*empty.Empty, error) {
137 handler.device.RemoveMulticastDistributionSet(ctx, config)
138 return &empty.Empty{}, nil
139}