blob: bef627e03c3dddce37c51b4e339a0e3044d953b9 [file] [log] [blame]
Matteo Scandolo8df63df2019-09-12 10:34:32 -07001/*
2 * Portions copyright 2019-present Open Networking Foundation
3 * Original copyright 2019-present Ciena Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18package commands
19
20import (
21 "context"
Matteo Scandolo10f965c2019-09-24 10:40:46 -070022 "fmt"
Anand S Katti09541352020-01-29 15:54:01 +053023 "os"
24 "strconv"
25 "strings"
26
Matteo Scandolo8df63df2019-09-12 10:34:32 -070027 "github.com/jessevdk/go-flags"
Anand S Katti09541352020-01-29 15:54:01 +053028 "github.com/olekukonko/tablewriter"
Matteo Scandolo8df63df2019-09-12 10:34:32 -070029 pb "github.com/opencord/bbsim/api/bbsim"
30 "github.com/opencord/bbsim/internal/bbsimctl/config"
31 "github.com/opencord/cordctl/pkg/format"
32 log "github.com/sirupsen/logrus"
Matteo Scandolo8df63df2019-09-12 10:34:32 -070033)
34
35const (
Matteo Scandolo8a574812021-05-20 15:18:53 -070036 DEFAULT_ONU_DEVICE_HEADER_FORMAT = "table{{ .PonPortID }}\t{{ .ID }}\t{{ .SerialNumber }}\t{{ .OperState }}\t{{ .InternalState }}\t{{ .ImageSoftwareExpectedSections }}\t{{ .ImageSoftwareReceivedSections }}\t{{ .ActiveImageEntityId }}\t{{ .CommittedImageEntityId }}"
37 DEFAULT_ONU_DEVICE_HEADER_FORMAT_WITH_SERVICES = "table{{ .PonPortID }}\t{{ .ID }}\t{{ .SerialNumber }}\t{{ .OperState }}\t{{ .InternalState }}\t{{ .ImageSoftwareExpectedSections }}\t{{ .ImageSoftwareReceivedSections }}\t{{ .ActiveImageEntityId }}\t{{ .CommittedImageEntityId }}\t{{ .Unis }}"
38 DEFAULT_UNI_HEADER_FORMAT = "table{{ .OnuSn }}\t{{ .OnuID }}\t{{ .ID }}\t{{ .MeID }}\t{{ .PortNo }}\t{{ .OperState }}"
39 DEFAULT_UNI_HEADER_FORMAT_WITH_SERVICES = "table{{ .OnuSn }}\t{{ .OnuID }}\t{{ .ID }}\t{{ .MeID }}\t{{ .PortNo }}\t{{ .OperState }}\t{{ .Services }}"
Matteo Scandolo8df63df2019-09-12 10:34:32 -070040)
41
Matteo Scandolo10f965c2019-09-24 10:40:46 -070042type OnuSnString string
Arjun E K57a7fcb2020-01-30 06:44:45 +000043type IgmpSubAction string
Onur Kalinagac9f9faca2021-01-21 14:04:34 +000044type GroupAddress string
Arjun E K57a7fcb2020-01-30 06:44:45 +000045
46const IgmpJoinKey string = "join"
47const IgmpLeaveKey string = "leave"
Arjun E Kdd443f02020-02-07 15:24:01 +000048const IgmpJoinKeyV3 string = "joinv3"
Arjun E K57a7fcb2020-01-30 06:44:45 +000049
Matteo Scandolo618a6582020-09-09 12:21:29 -070050var IgmpAllowedActions = []string{IgmpJoinKey, IgmpLeaveKey, IgmpJoinKeyV3}
51
Matteo Scandolo4a036262020-08-17 15:56:13 -070052type ONUList struct {
53 Verbose bool `short:"v" long:"verbose" description:"Print all the informations we have about ONUs"`
54}
Matteo Scandolod2ca2c72019-10-04 16:50:22 -070055
56type ONUGet struct {
Matteo Scandolo4a036262020-08-17 15:56:13 -070057 Verbose bool `short:"v" long:"verbose" description:"Print all the informations we have about ONUs"`
58 Args struct {
59 OnuSn OnuSnString
60 } `positional-args:"yes" required:"yes"`
61}
62
Matteo Scandoloef4e8f82021-05-17 11:20:49 -070063type ONUUnis struct {
Matteo Scandolo8a574812021-05-20 15:18:53 -070064 Verbose bool `short:"v" long:"verbose" description:"Print all the informations we have about UNIs"`
65 Args struct {
Matteo Scandoloef4e8f82021-05-17 11:20:49 -070066 OnuSn OnuSnString
67 } `positional-args:"yes" required:"yes"`
68}
69
Matteo Scandolo10f965c2019-09-24 10:40:46 -070070type ONUShutDown struct {
71 Args struct {
72 OnuSn OnuSnString
73 } `positional-args:"yes" required:"yes"`
Matteo Scandolo8df63df2019-09-12 10:34:32 -070074}
75
Matteo Scandolo10f965c2019-09-24 10:40:46 -070076type ONUPowerOn struct {
77 Args struct {
78 OnuSn OnuSnString
79 } `positional-args:"yes" required:"yes"`
80}
81
Matteo Scandoloe383d5d2019-10-25 14:47:27 -070082type ONUEapolRestart struct {
83 Args struct {
84 OnuSn OnuSnString
85 } `positional-args:"yes" required:"yes"`
86}
87
88type ONUDhcpRestart struct {
89 Args struct {
90 OnuSn OnuSnString
91 } `positional-args:"yes" required:"yes"`
92}
93
Arjun E K57a7fcb2020-01-30 06:44:45 +000094type ONUIgmp struct {
95 Args struct {
Onur Kalinagac9f9faca2021-01-21 14:04:34 +000096 OnuSn OnuSnString
97 SubAction IgmpSubAction
98 GroupAddress GroupAddress
Arjun E K57a7fcb2020-01-30 06:44:45 +000099 } `positional-args:"yes" required:"yes"`
100}
101
Pragya Arya8bdb4532020-03-02 17:08:09 +0530102type ONUTrafficSchedulers struct {
103 Args struct {
104 OnuSn OnuSnString
105 } `positional-args:"yes" required:"yes"`
106}
107
108type ONUFlows struct {
109 Args struct {
110 OnuSn OnuSnString
111 } `positional-args:"yes" required:"yes"`
112}
113
Matteo Scandolo10f965c2019-09-24 10:40:46 -0700114type ONUOptions struct {
Anand S Katti09541352020-01-29 15:54:01 +0530115 List ONUList `command:"list"`
116 Get ONUGet `command:"get"`
Matteo Scandoloef4e8f82021-05-17 11:20:49 -0700117 Unis ONUUnis `command:"unis"`
Anand S Katti09541352020-01-29 15:54:01 +0530118 ShutDown ONUShutDown `command:"shutdown"`
119 PowerOn ONUPowerOn `command:"poweron"`
120 RestartEapol ONUEapolRestart `command:"auth_restart"`
121 RestartDchp ONUDhcpRestart `command:"dhcp_restart"`
122 Igmp ONUIgmp `command:"igmp"`
123 TrafficSchedulers ONUTrafficSchedulers `command:"traffic_schedulers"`
Anand S Katti86552f92020-03-03 21:56:32 +0530124 Alarms AlarmOptions `command:"alarms"`
Pragya Arya8bdb4532020-03-02 17:08:09 +0530125 Flows ONUFlows `command:"flows"`
Matteo Scandolo10f965c2019-09-24 10:40:46 -0700126}
127
128func RegisterONUCommands(parser *flags.Parser) {
Shrey Baid688b4242020-07-10 20:40:10 +0530129 _, _ = parser.AddCommand("onu", "ONU Commands", "Commands to query and manipulate ONU devices", &ONUOptions{})
Matteo Scandolo10f965c2019-09-24 10:40:46 -0700130}
131
Matteo Scandolo10f965c2019-09-24 10:40:46 -0700132func getONUs() *pb.ONUs {
133
134 client, conn := connect()
Matteo Scandolo8df63df2019-09-12 10:34:32 -0700135 defer conn.Close()
Matteo Scandolo8df63df2019-09-12 10:34:32 -0700136
137 // Contact the server and print out its response.
Matteo Scandolo8df63df2019-09-12 10:34:32 -0700138 ctx, cancel := context.WithTimeout(context.Background(), config.GlobalConfig.Grpc.Timeout)
139 defer cancel()
Matteo Scandolo10f965c2019-09-24 10:40:46 -0700140
141 onus, err := client.GetONUs(ctx, &pb.Empty{})
Matteo Scandolo8df63df2019-09-12 10:34:32 -0700142 if err != nil {
Matteo Scandolo2bf742a2019-10-01 11:33:34 -0700143 log.Fatalf("could not get OLT: %v", err)
Matteo Scandolo8df63df2019-09-12 10:34:32 -0700144 return nil
145 }
146 return onus
147}
148
Matteo Scandolo10f965c2019-09-24 10:40:46 -0700149func (options *ONUList) Execute(args []string) error {
Matteo Scandolo8df63df2019-09-12 10:34:32 -0700150 onus := getONUs()
151
152 // print out
Matteo Scandolo4a036262020-08-17 15:56:13 -0700153 var tableFormat format.Format
154 if options.Verbose {
155 tableFormat = format.Format(DEFAULT_ONU_DEVICE_HEADER_FORMAT_WITH_SERVICES)
156 } else {
157 tableFormat = format.Format(DEFAULT_ONU_DEVICE_HEADER_FORMAT)
158 }
Matteo Scandolo8df63df2019-09-12 10:34:32 -0700159 if err := tableFormat.Execute(os.Stdout, true, onus.Items); err != nil {
160 log.Fatalf("Error while formatting ONUs table: %s", err)
161 }
162
163 return nil
164}
Matteo Scandolo10f965c2019-09-24 10:40:46 -0700165
Matteo Scandolod2ca2c72019-10-04 16:50:22 -0700166func (options *ONUGet) Execute(args []string) error {
167 client, conn := connect()
168 defer conn.Close()
169
170 ctx, cancel := context.WithTimeout(context.Background(), config.GlobalConfig.Grpc.Timeout)
171 defer cancel()
172 req := pb.ONURequest{
173 SerialNumber: string(options.Args.OnuSn),
174 }
175 res, err := client.GetONU(ctx, &req)
176
177 if err != nil {
Matteo Scandolo4a036262020-08-17 15:56:13 -0700178 log.Fatalf("Cannot not get ONU %s: %v", options.Args.OnuSn, err)
Matteo Scandolod2ca2c72019-10-04 16:50:22 -0700179 return err
180 }
181
Matteo Scandolo4a036262020-08-17 15:56:13 -0700182 var tableFormat format.Format
183 if options.Verbose {
184 tableFormat = format.Format(DEFAULT_ONU_DEVICE_HEADER_FORMAT_WITH_SERVICES)
185 } else {
186 tableFormat = format.Format(DEFAULT_ONU_DEVICE_HEADER_FORMAT)
187 }
Matteo Scandolod2ca2c72019-10-04 16:50:22 -0700188 if err := tableFormat.Execute(os.Stdout, true, []*pb.ONU{res}); err != nil {
189 log.Fatalf("Error while formatting ONUs table: %s", err)
190 }
191
192 return nil
193}
194
Matteo Scandoloef4e8f82021-05-17 11:20:49 -0700195func (options *ONUUnis) Execute(args []string) error {
196
197 client, conn := connect()
198 defer conn.Close()
199
200 ctx, cancel := context.WithTimeout(context.Background(), config.GlobalConfig.Grpc.Timeout)
201 defer cancel()
202 req := pb.ONURequest{
203 SerialNumber: string(options.Args.OnuSn),
204 }
205 res, err := client.GetOnuUnis(ctx, &req)
206
207 if err != nil {
208 log.Fatalf("Cannot not get unis for ONU %s: %v", options.Args.OnuSn, err)
209 return err
210 }
211
Matteo Scandolo8a574812021-05-20 15:18:53 -0700212 var tableFormat format.Format
213 if options.Verbose {
214 tableFormat = format.Format(DEFAULT_UNI_HEADER_FORMAT_WITH_SERVICES)
215 } else {
216 tableFormat = format.Format(DEFAULT_UNI_HEADER_FORMAT)
217 }
Matteo Scandoloef4e8f82021-05-17 11:20:49 -0700218 if err := tableFormat.Execute(os.Stdout, true, res.Items); err != nil {
219 log.Fatalf("Error while formatting Unis table: %s", err)
220 }
221
222 return nil
223}
224
Matteo Scandolo10f965c2019-09-24 10:40:46 -0700225func (options *ONUShutDown) Execute(args []string) error {
226
227 client, conn := connect()
228 defer conn.Close()
229
230 ctx, cancel := context.WithTimeout(context.Background(), config.GlobalConfig.Grpc.Timeout)
231 defer cancel()
232 req := pb.ONURequest{
233 SerialNumber: string(options.Args.OnuSn),
234 }
235 res, err := client.ShutdownONU(ctx, &req)
236
237 if err != nil {
Matteo Scandoloe383d5d2019-10-25 14:47:27 -0700238 log.Fatalf("Cannot shutdown ONU %s: %v", options.Args.OnuSn, err)
Matteo Scandolo10f965c2019-09-24 10:40:46 -0700239 return err
240 }
241
242 fmt.Println(fmt.Sprintf("[Status: %d] %s", res.StatusCode, res.Message))
243
244 return nil
245}
246
247func (options *ONUPowerOn) Execute(args []string) error {
248 client, conn := connect()
249 defer conn.Close()
250
251 ctx, cancel := context.WithTimeout(context.Background(), config.GlobalConfig.Grpc.Timeout)
252 defer cancel()
253 req := pb.ONURequest{
254 SerialNumber: string(options.Args.OnuSn),
255 }
256 res, err := client.PoweronONU(ctx, &req)
257
258 if err != nil {
Matteo Scandoloe383d5d2019-10-25 14:47:27 -0700259 log.Fatalf("Cannot power on ONU %s: %v", options.Args.OnuSn, err)
260 return err
261 }
262
263 fmt.Println(fmt.Sprintf("[Status: %d] %s", res.StatusCode, res.Message))
264
265 return nil
266}
267
268func (options *ONUEapolRestart) Execute(args []string) error {
269 client, conn := connect()
270 defer conn.Close()
271
272 ctx, cancel := context.WithTimeout(context.Background(), config.GlobalConfig.Grpc.Timeout)
273 defer cancel()
274 req := pb.ONURequest{
275 SerialNumber: string(options.Args.OnuSn),
276 }
277 res, err := client.RestartEapol(ctx, &req)
278
279 if err != nil {
280 log.Fatalf("Cannot restart EAPOL for ONU %s: %v", options.Args.OnuSn, err)
281 return err
282 }
283
284 fmt.Println(fmt.Sprintf("[Status: %d] %s", res.StatusCode, res.Message))
285
286 return nil
287}
288
289func (options *ONUDhcpRestart) Execute(args []string) error {
290 client, conn := connect()
291 defer conn.Close()
292
293 ctx, cancel := context.WithTimeout(context.Background(), config.GlobalConfig.Grpc.Timeout)
294 defer cancel()
295 req := pb.ONURequest{
296 SerialNumber: string(options.Args.OnuSn),
297 }
298 res, err := client.RestartDhcp(ctx, &req)
299
300 if err != nil {
301 log.Fatalf("Cannot restart DHCP for ONU %s: %v", options.Args.OnuSn, err)
Matteo Scandolo10f965c2019-09-24 10:40:46 -0700302 return err
303 }
304
305 fmt.Println(fmt.Sprintf("[Status: %d] %s", res.StatusCode, res.Message))
306
307 return nil
308}
309
Arjun E K57a7fcb2020-01-30 06:44:45 +0000310func (options *ONUIgmp) Execute(args []string) error {
311 client, conn := connect()
312 defer conn.Close()
313
314 ctx, cancel := context.WithTimeout(context.Background(), config.GlobalConfig.Grpc.Timeout)
315 defer cancel()
316
317 req := pb.ONURequest{
318 SerialNumber: string(options.Args.OnuSn),
319 }
320
321 var subActionVal pb.SubActionTypes
322 if string(options.Args.SubAction) == IgmpJoinKey {
323 subActionVal = pb.SubActionTypes_JOIN
324 } else if string(options.Args.SubAction) == IgmpLeaveKey {
325 subActionVal = pb.SubActionTypes_LEAVE
Anand S Katti09541352020-01-29 15:54:01 +0530326 } else if string(options.Args.SubAction) == IgmpJoinKeyV3 {
327 subActionVal = pb.SubActionTypes_JOINV3
328 }
Arjun E K57a7fcb2020-01-30 06:44:45 +0000329
330 igmpReq := pb.IgmpRequest{
331 OnuReq: &req,
332 SubActionVal: subActionVal,
Onur Kalinagac9f9faca2021-01-21 14:04:34 +0000333 GroupAddress: string(options.Args.GroupAddress),
Arjun E K57a7fcb2020-01-30 06:44:45 +0000334 }
335 res, err := client.GetONU(ctx, igmpReq.OnuReq)
336 if err != nil {
337 log.WithFields(log.Fields{
338 "SerialNumber": options.Args.OnuSn,
339 }).Errorf("Cannot not get details on ONU error: %v", err)
340 }
341 log.WithFields(log.Fields{
342 "SerialNumber": igmpReq.OnuReq.SerialNumber,
Onur Kalinagac9f9faca2021-01-21 14:04:34 +0000343 }).Debugf("ONU has identified : %s", res)
Arjun E K57a7fcb2020-01-30 06:44:45 +0000344
345 igmpRes, igmpErr := client.ChangeIgmpState(ctx, &igmpReq)
346 if igmpErr != nil {
347 log.WithFields(log.Fields{
348 "SubAction": options.Args.SubAction,
349 }).Errorf("Could not process Action: error: %v", igmpErr)
350 } else {
351 log.WithFields(log.Fields{
352 "SubAction": options.Args.SubAction,
353 }).Debugf("igmp state has been changed with response: %s",
354 igmpRes.Message)
355 }
356
357 return nil
358}
359
Pragya Arya8bdb4532020-03-02 17:08:09 +0530360func (options *ONUFlows) Execute(args []string) error {
361 client, conn := connect()
362 defer conn.Close()
363
364 ctx, cancel := context.WithTimeout(context.Background(), config.GlobalConfig.Grpc.Timeout)
365 defer cancel()
366 req := pb.ONURequest{
367 SerialNumber: string(options.Args.OnuSn),
368 }
369 res, err := client.GetFlows(ctx, &req)
370 if err != nil {
371 log.Errorf("Cannot get flows for ONU %s: %v", options.Args.OnuSn, err)
372 return err
373 }
374
375 if res.Flows == nil {
376 fmt.Println(fmt.Sprintf("ONU %s has no flows", options.Args.OnuSn))
377 return nil
378 }
379
380 flowHeader := []string{
381 "access_intf_id",
382 "onu_id",
383 "uni_id",
384 "flow_id",
385 "flow_type",
386 "eth_type",
387 "alloc_id",
388 "network_intf_id",
389 "gemport_id",
390 "classifier",
391 "action",
392 "priority",
393 "cookie",
394 "port_no",
395 }
396
397 tableFlow := tablewriter.NewWriter(os.Stdout)
398 tableFlow.SetRowLine(true)
399 fmt.Fprintf(os.Stdout, "ONU Flows:\n")
400 tableFlow.SetHeader(flowHeader)
401
402 for _, flow := range res.Flows {
403 flowInfo := []string{}
404 flowInfo = append(flowInfo,
405 strconv.Itoa(int(flow.AccessIntfId)),
406 strconv.Itoa(int(flow.OnuId)),
407 strconv.Itoa(int(flow.UniId)),
408 strconv.Itoa(int(flow.FlowId)),
409 flow.FlowType,
410 fmt.Sprintf("%x", flow.Classifier.EthType),
411 strconv.Itoa(int(flow.AllocId)),
412 strconv.Itoa(int(flow.NetworkIntfId)),
413 strconv.Itoa(int(flow.GemportId)),
414 flow.Classifier.String(),
415 flow.Action.String(),
416 strconv.Itoa(int(flow.Priority)),
417 strconv.Itoa(int(flow.Cookie)),
418 strconv.Itoa(int(flow.PortNo)),
419 )
420 tableFlow.Append(flowInfo)
421 }
422 tableFlow.Render()
423 tableFlow.SetNewLine("")
424 return nil
425}
426
Matteo Scandolo10f965c2019-09-24 10:40:46 -0700427func (onuSn *OnuSnString) Complete(match string) []flags.Completion {
428 client, conn := connect()
429 defer conn.Close()
430
431 ctx, cancel := context.WithTimeout(context.Background(), config.GlobalConfig.Grpc.Timeout)
432 defer cancel()
433
434 onus, err := client.GetONUs(ctx, &pb.Empty{})
435 if err != nil {
Matteo Scandolo86e8ce62019-10-11 12:03:10 -0700436 log.Fatalf("could not get ONUs: %v", err)
Matteo Scandolo10f965c2019-09-24 10:40:46 -0700437 return nil
438 }
439
440 list := make([]flags.Completion, 0)
441 for _, k := range onus.Items {
442 if strings.HasPrefix(k.SerialNumber, match) {
443 list = append(list, flags.Completion{Item: k.SerialNumber})
444 }
445 }
446
447 return list
448}
Anand S Katti09541352020-01-29 15:54:01 +0530449
Matteo Scandolo618a6582020-09-09 12:21:29 -0700450func (onuSn *IgmpSubAction) Complete(match string) []flags.Completion {
451 list := make([]flags.Completion, 0)
452 for _, k := range IgmpAllowedActions {
453 if strings.HasPrefix(k, match) {
454 list = append(list, flags.Completion{Item: k})
455 }
456 }
457 return list
458}
459
Anand S Katti09541352020-01-29 15:54:01 +0530460func (options *ONUTrafficSchedulers) Execute(args []string) error {
461 client, conn := connect()
462 defer conn.Close()
463
464 ctx, cancel := context.WithTimeout(context.Background(), config.GlobalConfig.Grpc.Timeout)
465 defer cancel()
466 req := pb.ONURequest{
467 SerialNumber: string(options.Args.OnuSn),
468 }
469 res, err := client.GetOnuTrafficSchedulers(ctx, &req)
470 if err != nil {
471 log.Fatalf("Cannot get traffic schedulers for ONU %s: %v", options.Args.OnuSn, err)
472 return err
473 }
474
475 if res.TraffSchedulers == nil {
476 log.Fatalf("Cannot get traffic schedulers for ONU: %s (unavailable)", options.Args.OnuSn)
477 return nil
478 }
479
480 SchedulerHeader := []string{"Direction",
481 "AllocId",
482 "Scheduler.Direction",
483 "Scheduler.AdditionalBw",
484 "Scheduler.Priority",
485 "Scheduler.Weight",
486 "Scheduler.SchedPolicy",
487 }
488
489 ShapingInfoHeader := []string{"InferredAdditionBwIndication",
490 "Cbs",
491 "Cir",
492 "Gir",
493 "Pbs",
494 "Pir",
495 }
496
497 SchedulerVals := []string{}
498 ShapingInfoVals := []string{}
499 for _, v := range res.TraffSchedulers.TrafficScheds {
500 SchedulerVals = append(SchedulerVals,
501 v.GetDirection().String(),
502 strconv.Itoa(int(v.GetAllocId())),
503 v.Scheduler.GetDirection().String(),
504 v.Scheduler.GetAdditionalBw().String(),
505 strconv.Itoa(int(v.Scheduler.GetPriority())),
506 strconv.Itoa(int(v.Scheduler.GetWeight())),
507 v.GetScheduler().GetSchedPolicy().String(),
508 )
509
510 ShapingInfoVals = append(ShapingInfoVals,
511 v.TrafficShapingInfo.GetAddBwInd().String(),
512 strconv.Itoa(int(v.TrafficShapingInfo.GetCbs())),
513 strconv.Itoa(int(v.TrafficShapingInfo.GetCir())),
514 strconv.Itoa(int(v.TrafficShapingInfo.GetGir())),
515 strconv.Itoa(int(v.TrafficShapingInfo.GetPbs())),
516 strconv.Itoa(int(v.TrafficShapingInfo.GetPir())),
517 )
518 }
519
520 fmt.Fprintf(os.Stdout, "OnuId: %d \n", int(res.TraffSchedulers.OnuId))
521 fmt.Fprintf(os.Stdout, "IntfId: %d \n", int(res.TraffSchedulers.IntfId))
522 fmt.Fprintf(os.Stdout, "UniId: %d \n", int(res.TraffSchedulers.UniId))
523 fmt.Fprintf(os.Stdout, "OnuPortNo: %d \n", int(res.TraffSchedulers.PortNo))
524
525 tableSched := tablewriter.NewWriter(os.Stdout)
526 tableSched.SetRowLine(true)
527 fmt.Fprintf(os.Stdout, "Traffic Schedulers Info:\n")
528 tableSched.SetHeader(SchedulerHeader)
529 tableSched.Append(SchedulerVals)
530 tableSched.Render()
531 tableSched.SetNewLine("")
532
533 tableShap := tablewriter.NewWriter(os.Stdout)
534 tableShap.SetRowLine(true)
535 fmt.Fprintf(os.Stdout, "Traffic Shaping Info:\n")
536 tableShap.SetHeader(ShapingInfoHeader)
537 tableShap.Append(ShapingInfoVals)
538 tableShap.Render()
539
540 return nil
541}