1 diff --git a/src/common/utils/utils.go b/src/common/utils/utils.go
5 +++ b/src/common/utils/utils.go
7 +/*******************************************************************************
8 + * Copyright 2020 Samsung Electronics All Rights Reserved.
10 + * Licensed under the Apache License, Version 2.0 (the "License");
11 + * you may not use this file except in compliance with the License.
12 + * You may obtain a copy of the License at
14 + * http://www.apache.org/licenses/LICENSE-2.0
16 + * Unless required by applicable law or agreed to in writing, software
17 + * distributed under the License is distributed on an "AS IS" BASIS,
18 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 + * See the License for the specific language governing permissions and
20 + * limitations under the License.
22 + *******************************************************************************/
24 +// Package utils helps us keep utility functions like ping for common usage
29 + "restinterface/resthelper"
33 + pingAPI = "/api/v1/ping"
34 + internalPort = 56002
35 + logPrefix = "[utils]"
39 + logTag = logPrefix + "[Ping]"
40 + helper resthelper.RestHelper
45 + util = new(utilsImpl)
46 + helper = resthelper.GetHelper()
49 +type utilsImpl struct{}
51 +type UtilsHelper interface {
52 + PingDevice(ip string) bool
55 +// GetHelper returns utilImpl instance
56 +func GetHelper() UtilsHelper {
60 +func (ut *utilsImpl) PingDevice(ip string) bool {
61 + targetURL := helper.MakeTargetURL(ip, internalPort, pingAPI)
62 + _, _, err := helper.DoGet(targetURL)
64 + log.Println(logTag, "PING Error:", err.Error())