5 #ifndef ctrlplane_misc_utils_h
6 #define ctrlplane_misc_utils_h
8 #include <sandesh/sandesh_trace.h>
9 #include <sandesh/common/vns_types.h>
10 #include <sandesh/common/vns_constants.h>
16 #define VERSION_TRACE_BUF "VersionTrace"
20 #define VERSION_TRACE(obj, ...) do { \
21 obj::TraceMsg(VersionTraceBuf, __FILE__, __LINE__, ##__VA_ARGS__); \
24 #define VERSION_LOG(obj, categ, ...)\
26 obj::Send(g_vns_constants.CategoryNames.find(categ)->second,\
27 SandeshLevel::SYS_INFO, __FILE__, __LINE__, ##__VA_ARGS__);\
30 #if (__cplusplus < 201103L)
31 #define ARRAYBYTES_FILL(obj, val) (obj).assign((val));
32 #define GENERIC_RAW_ARRAY(obj) obj.c_array()
34 #define ARRAYBYTES_FILL(obj, val) (obj).fill((val));
35 #define GENERIC_RAW_ARRAY(obj) obj.data()
48 static std::map<BuildModule, std::string>
MapInit() {
49 std::map<BuildModule, std::string> m;
50 m[
Agent] =
"contrail-vrouter-agent ";
53 m[
Dns] =
"contrail-dns ";
57 typedef std::multimap<std::time_t, std::string>
FileMMap;
63 static void GetHostIp(
const std::string name, std::vector<std::string> &ip_list);
65 static bool GetPlatformInfo(std::string &distro, std::string &code_name);
71 static std::string
BaseName(std::string filename);
73 std::string &rpm_version,
74 std::string &build_num);
78 #endif // ctrlplane_misc_utils_h
static std::string BaseName(std::string filename)
static void GetHostIp(const std::string name, std::vector< std::string > &ip_list)
static bool GetBuildInfo(BuildModule id, const std::string &build_info, std::string &result)
static void LogVersionInfo(const std::string str, Category::type categ)
static bool GetPlatformInfo(std::string &distro, std::string &code_name)
static time_t GetUpTimeSeconds()
boost::shared_ptr< TraceBuffer< SandeshTrace > > SandeshTraceBufferPtr
static const int MaxCoreFiles
static const std::map< BuildModule, std::string > BuildModuleNames
static bool GetContrailVersionInfo(BuildModule id, std::string &rpm_version, std::string &build_num)
static time_t set_startup_time_secs()
SandeshTraceBufferPtr VersionTraceBuf
static std::map< BuildModule, std::string > MapInit()
static const std::string CoreFileDir
static bool GetVersionInfoInternal(const std::string &cmd, std::string &rpm_version, std::string &build_num)
static time_t startup_time_secs_
static const std::string ContrailVersionCmd
std::multimap< std::time_t, std::string > FileMMap