Stephane Barbarie | 3559506 | 2018-02-08 08:34:39 -0500 | [diff] [blame] | 1 | package nbi |
| 2 | |
| 3 | import ( |
| 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 | |
| 10 | type XPonSimHandler struct { |
| 11 | device *core.XPonSimDevice |
| 12 | } |
| 13 | |
| 14 | func NewXPonSimHandler() *XPonSimHandler { |
| 15 | var handler *XPonSimHandler |
| 16 | handler = &XPonSimHandler{} |
| 17 | return handler |
| 18 | } |
| 19 | |
| 20 | func (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 | } |
| 27 | func (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 | } |
| 34 | func (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 | } |
| 41 | func (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 | } |
| 48 | func (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 | } |
| 55 | func (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 | } |
| 62 | func (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 | } |
| 69 | func (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 | } |
| 76 | func (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 | } |
| 83 | func (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 | } |
| 90 | func (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 | } |
| 97 | func (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 | } |
| 104 | func (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 | } |
| 111 | func (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 | } |
| 118 | func (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 | } |