Create uni command in BBSimctl
Clean up UNI command and add filtering to UNI services
Change-Id: I1a54d786ca71a602c0ca0113f030c6caa1bc9cc7
diff --git a/internal/bbsimctl/commands/services.go b/internal/bbsimctl/commands/services.go
index d3b6bdd..1f3216a 100644
--- a/internal/bbsimctl/commands/services.go
+++ b/internal/bbsimctl/commands/services.go
@@ -41,7 +41,7 @@
_, _ = parser.AddCommand("service", "Service Commands", "Commands to interact with ONU Services", &ServiceOptions{})
}
-func getServices() *pb.Services {
+func getServices(OnuSn string, UniID string) (*pb.Services, error) {
client, conn := connect()
defer conn.Close()
@@ -50,17 +50,23 @@
ctx, cancel := context.WithTimeout(context.Background(), config.GlobalConfig.Grpc.Timeout)
defer cancel()
- services, err := client.GetServices(ctx, &pb.Empty{})
+ req := pb.UNIRequest{
+ OnuSerialNumber: OnuSn,
+ UniID: UniID,
+ }
+
+ services, err := client.GetServices(ctx, &req)
+
+ return services, err
+}
+
+func (options *ServiceList) Execute(args []string) error {
+ services, err := getServices("", "")
+
if err != nil {
log.Fatalf("could not get OLT: %v", err)
return nil
}
- return services
-}
-
-func (options *ServiceList) Execute(args []string) error {
- services := getServices()
-
// print out
tableFormat := format.Format(DEFAULT_SERVICE_HEADER_FORMAT)
if err := tableFormat.Execute(os.Stdout, true, services.Items); err != nil {