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