Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [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 | |
| 17 | package core |
| 18 | |
| 19 | import ( |
| 20 | "errors" |
Girish Gowdra | d4bdd37 | 2020-03-09 14:56:15 -0700 | [diff] [blame] | 21 | "strings" |
Thiyagarajan Subramani | b83b043 | 2020-01-08 13:43:28 +0530 | [diff] [blame] | 22 | |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 23 | "github.com/opencord/openolt-scale-tester/config" |
Orhan Kupusoglu | 66b00d8 | 2020-03-13 12:06:33 +0300 | [diff] [blame] | 24 | "github.com/opencord/voltha-lib-go/v3/pkg/log" |
Orhan Kupusoglu | 66b00d8 | 2020-03-13 12:06:33 +0300 | [diff] [blame] | 25 | oop "github.com/opencord/voltha-protos/v3/go/openolt" |
| 26 | tp_pb "github.com/opencord/voltha-protos/v3/go/tech_profile" |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 27 | "golang.org/x/net/context" |
| 28 | "google.golang.org/grpc/codes" |
| 29 | "google.golang.org/grpc/status" |
| 30 | ) |
| 31 | |
| 32 | func init() { |
| 33 | _, _ = log.AddPackage(log.JSON, log.DebugLevel, nil) |
| 34 | } |
| 35 | |
| 36 | // A dummy struct to comply with the WorkFlow interface. |
| 37 | type AttWorkFlow struct { |
| 38 | } |
| 39 | |
Girish Gowdra | ef1b7c4 | 2020-01-23 16:27:48 +0530 | [diff] [blame] | 40 | func AddDhcpIPV4Flow(oo oop.OpenoltClient, config *config.OpenOltScaleTesterConfig, rsrMgr *OpenOltResourceMgr) error { |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 41 | var flowID uint32 |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 42 | var err error |
| 43 | |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 44 | if flowID, err = rsrMgr.GetFlowID(context.Background(), uint32(config.NniIntfID)); err != nil { |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 45 | return err |
| 46 | } |
| 47 | |
Girish Gowdra | ef1b7c4 | 2020-01-23 16:27:48 +0530 | [diff] [blame] | 48 | // DHCP IPV4 |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 49 | flowClassifier := &oop.Classifier{EthType: 2048, IpProto: 17, SrcPort: 67, DstPort: 68, PktTagType: "double_tag"} |
| 50 | actionCmd := &oop.ActionCmd{TrapToHost: true} |
| 51 | actionInfo := &oop.Action{Cmd: actionCmd} |
| 52 | |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 53 | flow := oop.Flow{AccessIntfId: -1, OnuId: -1, UniId: -1, FlowId: flowID, |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 54 | FlowType: "downstream", AllocId: -1, GemportId: -1, |
| 55 | Classifier: flowClassifier, Action: actionInfo, |
Girish Gowdra | ef1b7c4 | 2020-01-23 16:27:48 +0530 | [diff] [blame] | 56 | Priority: 1000, PortNo: uint32(config.NniIntfID)} |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 57 | |
| 58 | _, err = oo.FlowAdd(context.Background(), &flow) |
| 59 | |
| 60 | st, _ := status.FromError(err) |
| 61 | if st.Code() == codes.AlreadyExists { |
| 62 | log.Debugw("Flow already exists", log.Fields{"err": err, "deviceFlow": flow}) |
| 63 | return nil |
| 64 | } |
| 65 | |
| 66 | if err != nil { |
Girish Gowdra | ef1b7c4 | 2020-01-23 16:27:48 +0530 | [diff] [blame] | 67 | log.Errorw("Failed to Add DHCP IPv4 to device", log.Fields{"err": err, "deviceFlow": flow}) |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 68 | return err |
| 69 | } |
Girish Gowdra | ef1b7c4 | 2020-01-23 16:27:48 +0530 | [diff] [blame] | 70 | log.Debugw("DHCP IPV4 added to device successfully ", log.Fields{"flow": flow}) |
| 71 | |
| 72 | return nil |
| 73 | } |
| 74 | |
| 75 | func AddDhcpIPV6Flow(oo oop.OpenoltClient, config *config.OpenOltScaleTesterConfig, rsrMgr *OpenOltResourceMgr) error { |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 76 | var flowID uint32 |
Girish Gowdra | ef1b7c4 | 2020-01-23 16:27:48 +0530 | [diff] [blame] | 77 | var err error |
| 78 | |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 79 | if flowID, err = rsrMgr.GetFlowID(context.Background(), uint32(config.NniIntfID)); err != nil { |
Girish Gowdra | ef1b7c4 | 2020-01-23 16:27:48 +0530 | [diff] [blame] | 80 | return err |
| 81 | } |
| 82 | |
| 83 | // DHCP IPV6 |
| 84 | flowClassifier := &oop.Classifier{EthType: 34525, IpProto: 17, SrcPort: 546, DstPort: 547, PktTagType: "double_tag"} |
| 85 | actionCmd := &oop.ActionCmd{TrapToHost: true} |
| 86 | actionInfo := &oop.Action{Cmd: actionCmd} |
| 87 | |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 88 | flow := oop.Flow{AccessIntfId: -1, OnuId: -1, UniId: -1, FlowId: flowID, |
Girish Gowdra | ef1b7c4 | 2020-01-23 16:27:48 +0530 | [diff] [blame] | 89 | FlowType: "downstream", AllocId: -1, GemportId: -1, |
| 90 | Classifier: flowClassifier, Action: actionInfo, |
| 91 | Priority: 1000, PortNo: uint32(config.NniIntfID)} |
| 92 | |
| 93 | _, err = oo.FlowAdd(context.Background(), &flow) |
| 94 | |
| 95 | st, _ := status.FromError(err) |
| 96 | if st.Code() == codes.AlreadyExists { |
| 97 | log.Debugw("Flow already exists", log.Fields{"err": err, "deviceFlow": flow}) |
| 98 | return nil |
| 99 | } |
| 100 | |
| 101 | if err != nil { |
| 102 | log.Errorw("Failed to Add DHCP IPV6 to device", log.Fields{"err": err, "deviceFlow": flow}) |
Girish Gowdra | ef1b7c4 | 2020-01-23 16:27:48 +0530 | [diff] [blame] | 103 | return err |
| 104 | } |
| 105 | log.Debugw("DHCP IPV6 added to device successfully ", log.Fields{"flow": flow}) |
| 106 | |
| 107 | return nil |
| 108 | } |
| 109 | |
Girish Gowdra | ef1b7c4 | 2020-01-23 16:27:48 +0530 | [diff] [blame] | 110 | func ProvisionAttNniTrapFlow(oo oop.OpenoltClient, config *config.OpenOltScaleTesterConfig, rsrMgr *OpenOltResourceMgr) error { |
| 111 | _ = AddDhcpIPV4Flow(oo, config, rsrMgr) |
| 112 | _ = AddDhcpIPV6Flow(oo, config, rsrMgr) |
| 113 | _ = AddLldpFlow(oo, config, rsrMgr) |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 114 | |
| 115 | return nil |
| 116 | } |
| 117 | |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 118 | func (att AttWorkFlow) ProvisionScheds(subs *Subscriber) error { |
| 119 | var trafficSched []*tp_pb.TrafficScheduler |
| 120 | |
| 121 | log.Info("provisioning-scheds") |
| 122 | |
| 123 | if trafficSched = getTrafficSched(subs, tp_pb.Direction_DOWNSTREAM); trafficSched == nil { |
| 124 | log.Error("ds-traffic-sched-is-nil") |
| 125 | return errors.New(ReasonCodeToReasonString(SCHED_CREATION_FAILED)) |
| 126 | } |
| 127 | |
| 128 | log.Debugw("Sending Traffic scheduler create to device", |
| 129 | log.Fields{"Direction": tp_pb.Direction_DOWNSTREAM, "TrafficScheds": trafficSched}) |
| 130 | if _, err := subs.OpenOltClient.CreateTrafficSchedulers(context.Background(), &tp_pb.TrafficSchedulers{ |
| 131 | IntfId: subs.PonIntf, OnuId: subs.OnuID, |
| 132 | UniId: subs.UniID, PortNo: subs.UniPortNo, |
| 133 | TrafficScheds: trafficSched}); err != nil { |
| 134 | log.Errorw("Failed to create traffic schedulers", log.Fields{"error": err}) |
| 135 | return errors.New(ReasonCodeToReasonString(SCHED_CREATION_FAILED)) |
| 136 | } |
| 137 | |
| 138 | if trafficSched = getTrafficSched(subs, tp_pb.Direction_UPSTREAM); trafficSched == nil { |
| 139 | log.Error("us-traffic-sched-is-nil") |
| 140 | return errors.New(ReasonCodeToReasonString(SCHED_CREATION_FAILED)) |
| 141 | } |
| 142 | |
| 143 | log.Debugw("Sending Traffic scheduler create to device", |
| 144 | log.Fields{"Direction": tp_pb.Direction_UPSTREAM, "TrafficScheds": trafficSched}) |
| 145 | if _, err := subs.OpenOltClient.CreateTrafficSchedulers(context.Background(), &tp_pb.TrafficSchedulers{ |
| 146 | IntfId: subs.PonIntf, OnuId: subs.OnuID, |
| 147 | UniId: subs.UniID, PortNo: subs.UniPortNo, |
| 148 | TrafficScheds: trafficSched}); err != nil { |
| 149 | log.Errorw("Failed to create traffic schedulers", log.Fields{"error": err}) |
| 150 | return errors.New(ReasonCodeToReasonString(SCHED_CREATION_FAILED)) |
| 151 | } |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 152 | return nil |
| 153 | } |
| 154 | |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 155 | func (att AttWorkFlow) ProvisionQueues(subs *Subscriber) error { |
| 156 | log.Info("provisioning-queues") |
| 157 | |
| 158 | var trafficQueues []*tp_pb.TrafficQueue |
| 159 | if trafficQueues = getTrafficQueues(subs, tp_pb.Direction_DOWNSTREAM); trafficQueues == nil { |
| 160 | log.Error("Failed to create traffic queues") |
| 161 | return errors.New(ReasonCodeToReasonString(QUEUE_CREATION_FAILED)) |
| 162 | } |
| 163 | |
| 164 | // On receiving the CreateTrafficQueues request, the driver should create corresponding |
| 165 | // downstream queues. |
| 166 | log.Debugw("Sending Traffic Queues create to device", |
| 167 | log.Fields{"Direction": tp_pb.Direction_DOWNSTREAM, "TrafficQueues": trafficQueues}) |
| 168 | if _, err := subs.OpenOltClient.CreateTrafficQueues(context.Background(), |
| 169 | &tp_pb.TrafficQueues{IntfId: subs.PonIntf, OnuId: subs.OnuID, |
| 170 | UniId: subs.UniID, PortNo: subs.UniPortNo, |
| 171 | TrafficQueues: trafficQueues}); err != nil { |
| 172 | log.Errorw("Failed to create traffic queues in device", log.Fields{"error": err}) |
| 173 | return errors.New(ReasonCodeToReasonString(QUEUE_CREATION_FAILED)) |
| 174 | } |
| 175 | |
| 176 | if trafficQueues = getTrafficQueues(subs, tp_pb.Direction_UPSTREAM); trafficQueues == nil { |
| 177 | log.Error("Failed to create traffic queues") |
| 178 | return errors.New(ReasonCodeToReasonString(QUEUE_CREATION_FAILED)) |
| 179 | } |
| 180 | |
| 181 | // On receiving the CreateTrafficQueues request, the driver should create corresponding |
| 182 | // upstream queues. |
| 183 | log.Debugw("Sending Traffic Queues create to device", |
| 184 | log.Fields{"Direction": tp_pb.Direction_UPSTREAM, "TrafficQueues": trafficQueues}) |
| 185 | if _, err := subs.OpenOltClient.CreateTrafficQueues(context.Background(), |
| 186 | &tp_pb.TrafficQueues{IntfId: subs.PonIntf, OnuId: subs.OnuID, |
| 187 | UniId: subs.UniID, PortNo: subs.UniPortNo, |
| 188 | TrafficQueues: trafficQueues}); err != nil { |
| 189 | log.Errorw("Failed to create traffic queues in device", log.Fields{"error": err}) |
| 190 | return errors.New(ReasonCodeToReasonString(QUEUE_CREATION_FAILED)) |
| 191 | } |
| 192 | |
| 193 | return nil |
| 194 | } |
| 195 | |
| 196 | func (att AttWorkFlow) ProvisionEapFlow(subs *Subscriber) error { |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 197 | var err error |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 198 | var flowID uint32 |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 199 | var gemPortIDs []uint32 |
| 200 | |
| 201 | var allocID = subs.TpInstance[subs.TestConfig.TpIDList[0]].UsScheduler.AllocID |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 202 | for _, gem := range subs.TpInstance[subs.TestConfig.TpIDList[0]].UpstreamGemPortAttributeList { |
| 203 | gemPortIDs = append(gemPortIDs, gem.GemportID) |
| 204 | } |
| 205 | |
Girish Gowdra | d4bdd37 | 2020-03-09 14:56:15 -0700 | [diff] [blame] | 206 | for idx, gemID := range gemPortIDs { |
| 207 | pBitMap := subs.TpInstance[subs.TestConfig.TpIDList[0]].UpstreamGemPortAttributeList[idx].PbitMap |
| 208 | for pos, pbitSet := range strings.TrimPrefix(pBitMap, "0b") { |
| 209 | if pbitSet == '1' { |
| 210 | pcp := uint32(len(strings.TrimPrefix(pBitMap, "0b"))) - 1 - uint32(pos) |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 211 | if flowID, err = subs.RsrMgr.GetFlowID(context.Background(), uint32(subs.PonIntf)); err != nil { |
Girish Gowdra | d4bdd37 | 2020-03-09 14:56:15 -0700 | [diff] [blame] | 212 | return errors.New(ReasonCodeToReasonString(FLOW_ID_GENERATION_FAILED)) |
| 213 | } else { |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 214 | if err := AddFlow(subs, EapolFlow, Upstream, flowID, allocID, gemID, pcp); err != nil { |
Girish Gowdra | d4bdd37 | 2020-03-09 14:56:15 -0700 | [diff] [blame] | 215 | return err |
| 216 | } |
| 217 | } |
Thiyagarajan Subramani | b83b043 | 2020-01-08 13:43:28 +0530 | [diff] [blame] | 218 | } |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 219 | } |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 220 | } |
| 221 | return nil |
| 222 | } |
| 223 | |
Girish Gowdra | ef1b7c4 | 2020-01-23 16:27:48 +0530 | [diff] [blame] | 224 | func (att AttWorkFlow) ProvisionDhcpIPV4Flow(subs *Subscriber) error { |
Thiyagarajan Subramani | b83b043 | 2020-01-08 13:43:28 +0530 | [diff] [blame] | 225 | var err error |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 226 | var flowID uint32 |
Thiyagarajan Subramani | b83b043 | 2020-01-08 13:43:28 +0530 | [diff] [blame] | 227 | var gemPortIDs []uint32 |
| 228 | |
| 229 | var allocID = subs.TpInstance[subs.TestConfig.TpIDList[0]].UsScheduler.AllocID |
| 230 | for _, gem := range subs.TpInstance[subs.TestConfig.TpIDList[0]].UpstreamGemPortAttributeList { |
| 231 | gemPortIDs = append(gemPortIDs, gem.GemportID) |
| 232 | } |
| 233 | |
Girish Gowdra | d4bdd37 | 2020-03-09 14:56:15 -0700 | [diff] [blame] | 234 | for idx, gemID := range gemPortIDs { |
| 235 | pBitMap := subs.TpInstance[subs.TestConfig.TpIDList[0]].UpstreamGemPortAttributeList[idx].PbitMap |
| 236 | for pos, pbitSet := range strings.TrimPrefix(pBitMap, "0b") { |
| 237 | if pbitSet == '1' { |
| 238 | pcp := uint32(len(strings.TrimPrefix(pBitMap, "0b"))) - 1 - uint32(pos) |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 239 | if flowID, err = subs.RsrMgr.GetFlowID(context.Background(), uint32(subs.PonIntf)); err != nil { |
Girish Gowdra | d4bdd37 | 2020-03-09 14:56:15 -0700 | [diff] [blame] | 240 | return errors.New(ReasonCodeToReasonString(FLOW_ID_GENERATION_FAILED)) |
| 241 | } else { |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 242 | if err := AddFlow(subs, DhcpFlowIPV4, Upstream, flowID, allocID, gemID, pcp); err != nil { |
Girish Gowdra | d4bdd37 | 2020-03-09 14:56:15 -0700 | [diff] [blame] | 243 | return err |
| 244 | } |
| 245 | } |
Girish Gowdra | ef1b7c4 | 2020-01-23 16:27:48 +0530 | [diff] [blame] | 246 | } |
| 247 | } |
| 248 | } |
| 249 | return nil |
| 250 | } |
| 251 | |
| 252 | func (att AttWorkFlow) ProvisionDhcpIPV6Flow(subs *Subscriber) error { |
| 253 | var err error |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 254 | var flowID uint32 |
Girish Gowdra | ef1b7c4 | 2020-01-23 16:27:48 +0530 | [diff] [blame] | 255 | var gemPortIDs []uint32 |
| 256 | |
| 257 | var allocID = subs.TpInstance[subs.TestConfig.TpIDList[0]].UsScheduler.AllocID |
| 258 | for _, gem := range subs.TpInstance[subs.TestConfig.TpIDList[0]].UpstreamGemPortAttributeList { |
| 259 | gemPortIDs = append(gemPortIDs, gem.GemportID) |
| 260 | } |
| 261 | |
Girish Gowdra | d4bdd37 | 2020-03-09 14:56:15 -0700 | [diff] [blame] | 262 | for idx, gemID := range gemPortIDs { |
| 263 | pBitMap := subs.TpInstance[subs.TestConfig.TpIDList[0]].UpstreamGemPortAttributeList[idx].PbitMap |
| 264 | for pos, pbitSet := range strings.TrimPrefix(pBitMap, "0b") { |
| 265 | if pbitSet == '1' { |
| 266 | pcp := uint32(len(strings.TrimPrefix(pBitMap, "0b"))) - 1 - uint32(pos) |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 267 | if flowID, err = subs.RsrMgr.GetFlowID(context.Background(), uint32(subs.PonIntf)); err != nil { |
Girish Gowdra | d4bdd37 | 2020-03-09 14:56:15 -0700 | [diff] [blame] | 268 | return errors.New(ReasonCodeToReasonString(FLOW_ID_GENERATION_FAILED)) |
| 269 | } else { |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 270 | if err := AddFlow(subs, DhcpFlowIPV6, Upstream, flowID, allocID, gemID, pcp); err != nil { |
Girish Gowdra | d4bdd37 | 2020-03-09 14:56:15 -0700 | [diff] [blame] | 271 | return err |
| 272 | } |
| 273 | } |
Thiyagarajan Subramani | b83b043 | 2020-01-08 13:43:28 +0530 | [diff] [blame] | 274 | } |
| 275 | } |
| 276 | } |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 277 | return nil |
| 278 | } |
| 279 | |
| 280 | func (att AttWorkFlow) ProvisionIgmpFlow(subs *Subscriber) error { |
| 281 | log.Info("att-workflow-does-not-support-igmp-yet--nothing-to-do") |
| 282 | return nil |
| 283 | } |
| 284 | |
| 285 | func (att AttWorkFlow) ProvisionHsiaFlow(subs *Subscriber) error { |
Thiyagarajan Subramani | b83b043 | 2020-01-08 13:43:28 +0530 | [diff] [blame] | 286 | var err error |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 287 | var flowID uint32 |
Thiyagarajan Subramani | b83b043 | 2020-01-08 13:43:28 +0530 | [diff] [blame] | 288 | var gemPortIDs []uint32 |
| 289 | |
| 290 | var allocID = subs.TpInstance[subs.TestConfig.TpIDList[0]].UsScheduler.AllocID |
| 291 | for _, gem := range subs.TpInstance[subs.TestConfig.TpIDList[0]].UpstreamGemPortAttributeList { |
| 292 | gemPortIDs = append(gemPortIDs, gem.GemportID) |
| 293 | } |
| 294 | |
Girish Gowdra | d4bdd37 | 2020-03-09 14:56:15 -0700 | [diff] [blame] | 295 | for idx, gemID := range gemPortIDs { |
| 296 | pBitMap := subs.TpInstance[subs.TestConfig.TpIDList[0]].UpstreamGemPortAttributeList[idx].PbitMap |
| 297 | for pos, pbitSet := range strings.TrimPrefix(pBitMap, "0b") { |
| 298 | if pbitSet == '1' { |
| 299 | pcp := uint32(len(strings.TrimPrefix(pBitMap, "0b"))) - 1 - uint32(pos) |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 300 | if flowID, err = subs.RsrMgr.GetFlowID(context.Background(), uint32(subs.PonIntf)); err != nil { |
Girish Gowdra | d4bdd37 | 2020-03-09 14:56:15 -0700 | [diff] [blame] | 301 | return errors.New(ReasonCodeToReasonString(FLOW_ID_GENERATION_FAILED)) |
| 302 | } else { |
| 303 | var errUs, errDs error |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 304 | if errUs = AddFlow(subs, HsiaFlow, Upstream, flowID, allocID, gemID, pcp); errUs != nil { |
Girish Gowdra | d4bdd37 | 2020-03-09 14:56:15 -0700 | [diff] [blame] | 305 | log.Errorw("failed to install US HSIA flow", |
| 306 | log.Fields{"onuID": subs.OnuID, "uniID": subs.UniID, "intf": subs.PonIntf}) |
| 307 | } |
Girish Gowdra | aeceb84 | 2020-08-21 12:10:39 -0700 | [diff] [blame^] | 308 | if errDs = AddFlow(subs, HsiaFlow, Downstream, flowID, allocID, gemID, pcp); errDs != nil { |
Girish Gowdra | d4bdd37 | 2020-03-09 14:56:15 -0700 | [diff] [blame] | 309 | log.Errorw("failed to install US HSIA flow", |
| 310 | log.Fields{"onuID": subs.OnuID, "uniID": subs.UniID, "intf": subs.PonIntf}) |
| 311 | } |
| 312 | if errUs != nil && errDs != nil { |
Girish Gowdra | d4bdd37 | 2020-03-09 14:56:15 -0700 | [diff] [blame] | 313 | } |
| 314 | if errUs != nil || errDs != nil { |
| 315 | if errUs != nil { |
| 316 | return errUs |
| 317 | } |
| 318 | return errDs |
| 319 | } |
Girish Gowdra | ef1b7c4 | 2020-01-23 16:27:48 +0530 | [diff] [blame] | 320 | } |
Thiyagarajan Subramani | b83b043 | 2020-01-08 13:43:28 +0530 | [diff] [blame] | 321 | } |
| 322 | } |
| 323 | } |
Girish Gowdra | 6450343 | 2020-01-07 10:59:10 +0530 | [diff] [blame] | 324 | return nil |
| 325 | } |
Orhan Kupusoglu | 66b00d8 | 2020-03-13 12:06:33 +0300 | [diff] [blame] | 326 | |
| 327 | func (att AttWorkFlow) ProvisionVoipFlow(subs *Subscriber) error { |
| 328 | log.Info("att-workflow-does-not-support-voip-yet--nothing-to-do") |
| 329 | return nil |
| 330 | } |
| 331 | |
| 332 | func (att AttWorkFlow) ProvisionVodFlow(subs *Subscriber) error { |
| 333 | log.Info("att-workflow-does-not-support-vod-yet--nothing-to-do") |
| 334 | return nil |
| 335 | } |
| 336 | |
| 337 | func (att AttWorkFlow) ProvisionMgmtFlow(subs *Subscriber) error { |
| 338 | log.Info("att-workflow-does-not-support-mgmt-yet--nothing-to-do") |
| 339 | return nil |
| 340 | } |
| 341 | |
| 342 | func (att AttWorkFlow) ProvisionMulticastFlow(subs *Subscriber) error { |
| 343 | log.Info("att-workflow-does-not-support-multicast-yet--nothing-to-do") |
| 344 | return nil |
| 345 | } |