blob: 4ab7356d64c3c0caef1833146618877a9fbf0a24 [file] [log] [blame]
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +05301/*
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
17package core
18
19import (
20 "errors"
Orhan Kupusoglu66b00d82020-03-13 12:06:33 +030021 "math/rand"
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +053022
Thiyagarajan Subramanic4f8da82020-02-05 16:08:26 +053023 "github.com/opencord/openolt-scale-tester/config"
Orhan Kupusoglu66b00d82020-03-13 12:06:33 +030024 "github.com/opencord/voltha-lib-go/v3/pkg/log"
25 "github.com/opencord/voltha-lib-go/v3/pkg/ponresourcemanager"
26 oop "github.com/opencord/voltha-protos/v3/go/openolt"
27 tp_pb "github.com/opencord/voltha-protos/v3/go/tech_profile"
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +053028 "golang.org/x/net/context"
29 "google.golang.org/grpc/codes"
30 "google.golang.org/grpc/status"
31)
32
33const (
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +053034 DhcpIPProto = 17
Girish Gowdraef1b7c42020-01-23 16:27:48 +053035
36 //Constants utilised while forming HSIA Flow
37 HsiaFlow = "HSIA_FLOW"
38
39 //Constants utilised while forming DHCP IPV4 Flow
40 DhcpFlowIPV4 = "DHCP_FLOW_IPV4"
41 IPv4EthType = 0x800 //2048
42 DhcpSrcPortIPV4 = 68
43 DhcpDstPortIPV4 = 67
44
45 //Constants utilised while forming DHCP IPV6 Flow
46 DhcpFlowIPV6 = "DHCP_FLOW_IPV6"
47 IPv6EthType = 0x86dd //34525
48 DhcpSrcPortIPV6 = 547
49 DhcpDstPortIPV6 = 546
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +053050
51 //Constants utilised while forming EAPOL Flow
52 EapolFlow = "EAPOL_FLOW"
53 EapEthType = 0x888e //34958
54
55 //Direction constant
56 Upstream = "upstream"
57 Downstream = "downstream"
58
59 //PacketTagType constant
60 PacketTagType = "pkt_tag_type"
61 Untagged = "untagged"
62 SingleTag = "single_tag"
63 DoubleTag = "double_tag"
Orhan Kupusoglu66b00d82020-03-13 12:06:33 +030064
65 VoipFlow = "VOIP_FLOW"
66
67 VodFlow = "VOD_FLOW"
68
69 MgmtFlow = "MGMT_FLOW"
70
71 IgmpProto = 2
72 IgmpFlow = "IGMP_FLOW"
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +053073)
74
Orhan Kupusoglu66b00d82020-03-13 12:06:33 +030075const (
76 MacSize = 6
77 MacMin = 0x0
78 MacMax = 0xFF
79)
80
81type GroupData struct {
82 Subs Subscriber `json:"subscriber"`
83 GroupID uint32 `json:"groupID"`
84 Weight uint32 `json:"weight"`
85 Priority uint32 `json:"priority"`
86 OnuID uint32 `json:"onuID"`
87 UniID uint32 `json:"uniID"`
88 AllocID uint32 `json:"allocId"`
89 GemPortID uint32 `json:"gemPortIds"`
90 SchedPolicy tp_pb.SchedulingPolicy `json:"schedPolicy"`
91 AddGroup bool `json:"addGroup"`
92 AddFlow bool `json:"addFlow"`
93 AddSched bool `json:"addSched"`
94 AddQueue bool `json:"addQueue"`
95 AddMember bool `json:"addMember"`
96}
97
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +053098func getTrafficSched(subs *Subscriber, direction tp_pb.Direction) []*tp_pb.TrafficScheduler {
99 var SchedCfg *tp_pb.SchedulerConfig
Orhan Kupusoglu66b00d82020-03-13 12:06:33 +0300100 var err error
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +0530101
102 if direction == tp_pb.Direction_DOWNSTREAM {
Orhan Kupusoglu66b00d82020-03-13 12:06:33 +0300103 SchedCfg, err = subs.RsrMgr.ResourceMgrs[subs.PonIntf].TechProfileMgr.
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +0530104 GetDsScheduler(subs.TpInstance[subs.TestConfig.TpIDList[0]])
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +0530105 } else {
Orhan Kupusoglu66b00d82020-03-13 12:06:33 +0300106 SchedCfg, err = subs.RsrMgr.ResourceMgrs[subs.PonIntf].TechProfileMgr.
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +0530107 GetUsScheduler(subs.TpInstance[subs.TestConfig.TpIDList[0]])
108 }
109
Orhan Kupusoglu66b00d82020-03-13 12:06:33 +0300110 if err != nil {
111 log.Errorw("Failed to create traffic schedulers", log.Fields{"direction": direction, "error": err})
112 return nil
113 }
114
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +0530115 // hard-code for now
116 cir := 16000
117 cbs := 5000
118 eir := 16000
119 ebs := 5000
120 pir := cir + eir
121 pbs := cbs + ebs
122
123 TrafficShaping := &tp_pb.TrafficShapingInfo{Cir: uint32(cir), Cbs: uint32(cbs), Pir: uint32(pir), Pbs: uint32(pbs)}
124
125 TrafficSched := []*tp_pb.TrafficScheduler{subs.RsrMgr.ResourceMgrs[subs.PonIntf].TechProfileMgr.
126 GetTrafficScheduler(subs.TpInstance[subs.TestConfig.TpIDList[0]], SchedCfg, TrafficShaping)}
127
128 return TrafficSched
129}
130
131func getTrafficQueues(subs *Subscriber, direction tp_pb.Direction) []*tp_pb.TrafficQueue {
132
Orhan Kupusoglu66b00d82020-03-13 12:06:33 +0300133 trafficQueues, err := subs.RsrMgr.ResourceMgrs[subs.PonIntf].TechProfileMgr.
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +0530134 GetTrafficQueues(subs.TpInstance[subs.TestConfig.TpIDList[0]], direction)
135
Orhan Kupusoglu66b00d82020-03-13 12:06:33 +0300136 if err == nil {
137 return trafficQueues
138 }
139
140 log.Errorw("Failed to create traffic queues", log.Fields{"direction": direction, "error": err})
141 return nil
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +0530142}
143
144func FormatClassfierAction(flowType string, direction string, subs *Subscriber) (oop.Classifier, oop.Action) {
145 var flowClassifier oop.Classifier
146 var actionCmd oop.ActionCmd
147 var actionInfo oop.Action
148
149 if direction == Upstream {
150 switch flowType {
151 case EapolFlow:
152 flowClassifier.EthType = EapEthType
153 flowClassifier.OVid = subs.Ctag
154 flowClassifier.PktTagType = SingleTag
155 actionCmd.TrapToHost = true
156 actionInfo.Cmd = &actionCmd
Girish Gowdraef1b7c42020-01-23 16:27:48 +0530157 case DhcpFlowIPV4:
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +0530158 flowClassifier.EthType = IPv4EthType
159 flowClassifier.IpProto = DhcpIPProto
Girish Gowdraef1b7c42020-01-23 16:27:48 +0530160 flowClassifier.SrcPort = DhcpSrcPortIPV4
161 flowClassifier.DstPort = DhcpDstPortIPV4
162 flowClassifier.PktTagType = SingleTag
163 actionCmd.TrapToHost = true
164 actionInfo.Cmd = &actionCmd
165 case DhcpFlowIPV6:
166 flowClassifier.EthType = IPv6EthType
167 flowClassifier.IpProto = DhcpIPProto
168 flowClassifier.SrcPort = DhcpSrcPortIPV6
169 flowClassifier.DstPort = DhcpDstPortIPV6
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +0530170 flowClassifier.PktTagType = SingleTag
171 actionCmd.TrapToHost = true
172 actionInfo.Cmd = &actionCmd
173 case HsiaFlow:
174 flowClassifier.OVid = subs.Ctag
175 flowClassifier.PktTagType = SingleTag
176 actionCmd.AddOuterTag = true
177 actionInfo.Cmd = &actionCmd
178 actionInfo.OVid = subs.Stag
179 default:
180 log.Errorw("Unsupported flow type", log.Fields{"flowtype": flowType,
181 "direction": direction})
182 }
183 } else if direction == Downstream {
184 switch flowType {
185 case EapolFlow:
186 log.Errorw("Downstream EAP flows are not required instead controller "+
187 "packet outs EAP response directly to onu in downstream", log.Fields{"flowtype": flowType,
188 "direction": direction})
Girish Gowdraef1b7c42020-01-23 16:27:48 +0530189 case DhcpFlowIPV4:
190 log.Errorw("Downstream DHCPIPV4 flows are not required instead we have "+
191 "NNI trap flows already installed", log.Fields{"flowtype": flowType,
192 "direction": direction})
193 case DhcpFlowIPV6:
194 log.Errorw("Downstream DHCPIPV6 flows are not required instead we have "+
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +0530195 "NNI trap flows already installed", log.Fields{"flowtype": flowType,
196 "direction": direction})
197 case HsiaFlow:
198 flowClassifier.OVid = subs.Stag
199 flowClassifier.IVid = subs.Ctag
200 flowClassifier.PktTagType = DoubleTag
201 actionCmd.RemoveOuterTag = true
202 actionInfo.Cmd = &actionCmd
Girish Gowdra187322d2020-01-20 18:59:21 +0530203 actionInfo.OVid = subs.Stag
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +0530204 default:
205 log.Errorw("Unsupported flow type", log.Fields{"flowtype": flowType,
206 "direction": direction})
207 }
208 }
209 return flowClassifier, actionInfo
210}
211
212func AddFlow(subs *Subscriber, flowType string, direction string, flowID uint32,
Girish Gowdrad4bdd372020-03-09 14:56:15 -0700213 allocID uint32, gemID uint32, pcp uint32) error {
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +0530214 log.Infow("add-flow", log.Fields{"WorkFlow": subs.TestConfig.WorkflowName, "FlowType": flowType,
215 "direction": direction, "flowID": flowID})
216 var err error
217
218 flowClassifier, actionInfo := FormatClassfierAction(flowType, direction, subs)
Girish Gowdrad4bdd372020-03-09 14:56:15 -0700219 // Update the o_pbit for which this flow has to be classified
220 flowClassifier.OPbits = pcp
Thiyagarajan Subramanib83b0432020-01-08 13:43:28 +0530221 flow := oop.Flow{AccessIntfId: int32(subs.PonIntf), OnuId: int32(subs.OnuID),
222 UniId: int32(subs.UniID), FlowId: flowID,
223 FlowType: direction, AllocId: int32(allocID), GemportId: int32(gemID),
224 Classifier: &flowClassifier, Action: &actionInfo,
225 Priority: 1000, PortNo: subs.UniPortNo}
226
227 _, err = subs.OpenOltClient.FlowAdd(context.Background(), &flow)
228
229 st, _ := status.FromError(err)
230 if st.Code() == codes.AlreadyExists {
231 log.Debugw("Flow already exists", log.Fields{"err": err, "deviceFlow": flow})
232 return nil
233 }
234
235 if err != nil {
236 log.Errorw("Failed to Add flow to device", log.Fields{"err": err, "deviceFlow": flow})
237 return errors.New(ReasonCodeToReasonString(FLOW_ADD_FAILED))
238 }
239 log.Debugw("Flow added to device successfully ", log.Fields{"flow": flow})
240
241 return nil
242}
Thiyagarajan Subramanic4f8da82020-02-05 16:08:26 +0530243
244func AddLldpFlow(oo oop.OpenoltClient, config *config.OpenOltScaleTesterConfig, rsrMgr *OpenOltResourceMgr) error {
245 var flowID []uint32
246 var err error
247
Orhan Kupusoglu66b00d82020-03-13 12:06:33 +0300248 if flowID, err = rsrMgr.ResourceMgrs[uint32(config.NniIntfID)].GetResourceID(context.Background(), uint32(config.NniIntfID),
Thiyagarajan Subramanic4f8da82020-02-05 16:08:26 +0530249 ponresourcemanager.FLOW_ID, 1); err != nil {
250 return err
251 }
252
253 flowClassifier := &oop.Classifier{EthType: 35020, PktTagType: "untagged"}
254 actionCmd := &oop.ActionCmd{TrapToHost: true}
255 actionInfo := &oop.Action{Cmd: actionCmd}
256
257 flow := oop.Flow{AccessIntfId: -1, OnuId: -1, UniId: -1, FlowId: flowID[0],
258 FlowType: "downstream", AllocId: -1, GemportId: -1,
259 Classifier: flowClassifier, Action: actionInfo,
260 Priority: 1000, PortNo: uint32(config.NniIntfID)}
261
262 _, err = oo.FlowAdd(context.Background(), &flow)
263
264 st, _ := status.FromError(err)
265 if st.Code() == codes.AlreadyExists {
266 log.Debugw("Flow already exists", log.Fields{"err": err, "deviceFlow": flow})
267 return nil
268 }
269
270 if err != nil {
271 log.Errorw("Failed to Add LLDP flow to device", log.Fields{"err": err, "deviceFlow": flow})
Orhan Kupusoglu66b00d82020-03-13 12:06:33 +0300272 rsrMgr.ResourceMgrs[uint32(config.NniIntfID)].FreeResourceID(context.Background(), uint32(config.NniIntfID),
Thiyagarajan Subramanic4f8da82020-02-05 16:08:26 +0530273 ponresourcemanager.FLOW_ID, flowID)
274 return err
275 }
276 log.Debugw("LLDP flow added to device successfully ", log.Fields{"flow": flow})
277
278 return nil
279}
Orhan Kupusoglu66b00d82020-03-13 12:06:33 +0300280
281func GenerateMac(isRand bool) []byte {
282 var mac []byte
283
284 if isRand {
285 for i := 0; i < MacSize; i++ {
286 mac = append(mac, byte(rand.Intn(MacMax-MacMin)+MacMin))
287 }
288 } else {
289 mac = []byte{0x12, 0xAB, 0x34, 0xCD, 0x56, 0xEF}
290 }
291
292 return mac
293}
294
295func GenerateMulticastMac(onu_id uint32, group_id uint32) []byte {
296 var mac []byte
297
298 mac = []byte{0x01, 0x00, 0x5E}
299
300 mac = append(mac, byte(onu_id%255))
301 mac = append(mac, byte(rand.Intn(MacMax-MacMin)+MacMin))
302 mac = append(mac, byte(group_id))
303
304 return mac
305}
306
307func PerformGroupOperation(grp *GroupData, groupCfg *oop.Group) (*oop.Empty, error) {
308 oo := grp.Subs.OpenOltClient
309
310 var err error
311 var res *oop.Empty
312
313 if res, err = oop.OpenoltClient.PerformGroupOperation(oo, context.Background(), groupCfg); err != nil {
314 log.Errorw("Failed to perform - PerformGroupOperation()", log.Fields{"err": err})
315 return nil, err
316 }
317
318 log.Info("Successfully called - PerformGroupOperation()")
319
320 return res, nil
321}
322
323func CreateGroup(grp *GroupData) (*oop.Empty, error) {
324 var groupCfg oop.Group
325
326 log.Infow("creating group", log.Fields{"GroupID": grp.GroupID})
327
328 groupCfg.Command = oop.Group_SET_MEMBERS
329 groupCfg.GroupId = grp.GroupID
330
331 return PerformGroupOperation(grp, &groupCfg)
332}
333
334func OpMulticastTrafficQueue(grp *GroupData, isCreating bool) (*oop.Empty, error) {
335 log.Infow("operating on multicast traffic queue", log.Fields{"Creating": isCreating, "GroupID": grp.GroupID})
336
337 oo := grp.Subs.OpenOltClient
338
339 var request tp_pb.TrafficQueues
340 request.IntfId = grp.Subs.PonIntf
341 request.OnuId = grp.Subs.OnuID
342 request.UniId = grp.Subs.UniID
343
344 var trafficQueues []*tp_pb.TrafficQueue
345
346 var trafficQueue tp_pb.TrafficQueue
347 trafficQueue.Direction = tp_pb.Direction_DOWNSTREAM
348 trafficQueue.Priority = grp.Priority
349 trafficQueue.Weight = grp.Weight
350 trafficQueue.GemportId = grp.GemPortID
351 trafficQueue.SchedPolicy = grp.SchedPolicy
352
353 trafficQueues = append(trafficQueues, &trafficQueue)
354
355 request.TrafficQueues = trafficQueues
356
357 var err error
358 var res *oop.Empty
359
360 if isCreating {
361 if res, err = oop.OpenoltClient.CreateTrafficQueues(oo, context.Background(), &request); err != nil {
362 log.Errorw("Failed to perform - CreateTrafficQueues()", log.Fields{"err": err})
363 return nil, err
364 }
365
366 log.Info("Successfully called - CreateTrafficQueues()")
367 } else {
368 if res, err = oop.OpenoltClient.RemoveTrafficQueues(oo, context.Background(), &request); err != nil {
369 log.Errorw("Failed to perform - RemoveTrafficQueues()", log.Fields{"err": err})
370 return nil, err
371 }
372
373 log.Info("Successfully called - RemoveTrafficQueues()")
374 }
375
376 return res, nil
377}
378
379func AddMulticastFlow(grp *GroupData) error {
380 log.Infow("add multicast flow", log.Fields{"GroupID": grp.GroupID})
381
382 oo := grp.Subs.OpenOltClient
383 config := grp.Subs.TestConfig
384 rsrMgr := grp.Subs.RsrMgr
385
386 var flowID []uint32
387 var err error
388
389 if flowID, err = rsrMgr.ResourceMgrs[uint32(config.NniIntfID)].GetResourceID(context.Background(), uint32(config.NniIntfID),
390 ponresourcemanager.FLOW_ID, 1); err != nil {
391 return err
392 }
393
394 flowClassifier := &oop.Classifier{
395 IPbits: 255,
396 OPbits: 255,
397 IVid: 55,
398 OVid: 255,
399 DstMac: GenerateMulticastMac(grp.Subs.OnuID, grp.GroupID),
400 PktTagType: DoubleTag}
401
402 flow := oop.Flow{AccessIntfId: int32(grp.Subs.PonIntf), OnuId: int32(grp.Subs.OnuID), UniId: int32(grp.Subs.UniID), FlowId: flowID[0],
403 FlowType: "multicast", AllocId: int32(grp.AllocID), GemportId: int32(grp.GemPortID),
404 Classifier: flowClassifier, Priority: int32(grp.Priority), PortNo: uint32(grp.Subs.UniPortNo), GroupId: uint32(grp.GroupID)}
405
406 _, err = oo.FlowAdd(context.Background(), &flow)
407
408 st, _ := status.FromError(err)
409 if st.Code() == codes.AlreadyExists {
410 log.Debugw("Flow already exists", log.Fields{"err": err, "deviceFlow": flow})
411 return nil
412 }
413
414 if err != nil {
415 log.Errorw("Failed to add multicast flow to device", log.Fields{"err": err, "deviceFlow": flow})
416 rsrMgr.ResourceMgrs[uint32(grp.Subs.PonIntf)].FreeResourceID(context.Background(), uint32(config.NniIntfID),
417 ponresourcemanager.FLOW_ID, flowID)
418 return err
419 }
420
421 log.Debugw("Multicast flow added to device successfully ", log.Fields{"flow": flow})
422
423 return nil
424}
425
426func AddMulticastSched(grp *GroupData) error {
427 log.Infow("creating multicast sched", log.Fields{"GroupID": grp.GroupID})
428
429 SchedCfg := &tp_pb.SchedulerConfig{
430 Direction: tp_pb.Direction_DOWNSTREAM,
431 AdditionalBw: tp_pb.AdditionalBW_AdditionalBW_BestEffort,
432 Priority: grp.Priority,
433 Weight: grp.Weight,
434 SchedPolicy: tp_pb.SchedulingPolicy_WRR}
435
436 // hard-code for now
437 cir := 1948
438 cbs := 31768
439 eir := 100
440 ebs := 1000
441 pir := cir + eir
442 pbs := cbs + ebs
443
444 TfShInfo := &tp_pb.TrafficShapingInfo{Cir: uint32(cir), Cbs: uint32(cbs), Pir: uint32(pir), Pbs: uint32(pbs)}
445
446 TrafficSched := []*tp_pb.TrafficScheduler{grp.Subs.RsrMgr.ResourceMgrs[grp.Subs.PonIntf].TechProfileMgr.
447 GetTrafficScheduler(grp.Subs.TpInstance[grp.Subs.TestConfig.TpIDList[0]], SchedCfg, TfShInfo)}
448
449 if TrafficSched == nil {
450 log.Error("Create scheduler for multicast traffic failed")
451 return errors.New(ReasonCodeToReasonString(SCHED_CREATION_FAILED))
452 }
453
454 log.Debugw("Sending Traffic scheduler create to device",
455 log.Fields{"Direction": tp_pb.Direction_DOWNSTREAM, "TrafficScheds": TrafficSched})
456
457 if _, err := grp.Subs.OpenOltClient.CreateTrafficSchedulers(context.Background(), &tp_pb.TrafficSchedulers{
458 IntfId: grp.Subs.PonIntf, OnuId: grp.Subs.OnuID,
459 UniId: grp.Subs.UniID, PortNo: grp.Subs.UniPortNo,
460 TrafficScheds: TrafficSched}); err != nil {
461 log.Errorw("Failed to create traffic schedulers", log.Fields{"error": err})
462 return errors.New(ReasonCodeToReasonString(SCHED_CREATION_FAILED))
463 }
464
465 return nil
466}
467
468func OpMemberToGroup(grp *GroupData, isAdding bool) (*oop.Empty, error) {
469 log.Infow("operating on group", log.Fields{"Adding": isAdding})
470
471 var groupCfg oop.Group
472
473 if isAdding {
474 groupCfg.Command = oop.Group_ADD_MEMBERS
475 } else {
476 groupCfg.Command = oop.Group_REMOVE_MEMBERS
477 }
478
479 groupCfg.GroupId = grp.GroupID
480
481 var members []*oop.GroupMember
482
483 var member0 oop.GroupMember
484 member0.InterfaceId = grp.Subs.PonIntf
485 member0.GemPortId = grp.GemPortID
486 member0.Priority = grp.Priority
487 //member0.SchedPolicy = tp_pb.SchedulingPolicy_WRR
488 member0.InterfaceType = oop.GroupMember_PON
489
490 members = append(members, &member0)
491
492 groupCfg.Members = members
493
494 return PerformGroupOperation(grp, &groupCfg)
495}
496
497func AddMulticastQueueFlow(grp *GroupData) error {
498 var err error
499
500 log.Debugw("Create multicast queue flow", log.Fields{"GroupID": grp.GroupID, "AddGroup": grp.AddGroup,
501 "AddFlow": grp.AddFlow, "AddSched": grp.AddSched, "AddQueue": grp.AddQueue, "AddMember": grp.AddMember})
502
503 if grp.AddGroup {
504 if _, err = CreateGroup(grp); err != nil {
505 log.Error("Failed to add group to device")
506 return err
507 }
508 }
509
510 if grp.AddFlow {
511 if err = AddMulticastFlow(grp); err != nil {
512 log.Error("Failed to add multicast flow to device")
513 return err
514 }
515 }
516
517 if grp.AddSched {
518 if err = AddMulticastSched(grp); err != nil {
519 log.Error("Failed to add multicast sched to device")
520 return err
521 }
522 }
523
524 if grp.AddQueue {
525 if _, err = OpMulticastTrafficQueue(grp, true); err != nil {
526 log.Error("Failed to add multicast queue to device")
527 return err
528 }
529 }
530
531 if grp.AddMember {
532 if _, err = OpMemberToGroup(grp, true); err != nil {
533 log.Error("Failed to add member to group")
534 return err
535 }
536 }
537
538 return nil
539}