Matteo Scandolo | 4b077aa | 2021-02-16 17:33:37 -0800 | [diff] [blame] | 1 | /* |
Joey Armstrong | 14628cd | 2023-01-10 08:38:31 -0500 | [diff] [blame] | 2 | * Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors |
Matteo Scandolo | 4b077aa | 2021-02-16 17:33:37 -0800 | [diff] [blame] | 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 commands |
| 18 | |
| 19 | import ( |
| 20 | pb "github.com/opencord/bbsim/api/bbsim" |
| 21 | "github.com/opencord/bbsim/internal/bbsimctl/config" |
| 22 | log "github.com/sirupsen/logrus" |
| 23 | "google.golang.org/grpc" |
| 24 | ) |
| 25 | |
| 26 | func connect() (pb.BBSimClient, *grpc.ClientConn) { |
| 27 | conn, err := grpc.Dial(config.GlobalConfig.Server, grpc.WithInsecure()) |
| 28 | |
| 29 | if err != nil { |
| 30 | log.Fatalf("did not connect: %v", err) |
| 31 | return nil, conn |
| 32 | } |
| 33 | return pb.NewBBSimClient(conn), conn |
| 34 | } |