void helperCheckLaneMap() { SWSS_LOG_ENTER(); auto redisLaneMap = redisGetLaneMap(); auto laneMap = saiGetHardwareLaneMap(); if (redisLaneMap.size() == 0) { SWSS_LOG_INFO("no lanes defined in redis, seems like it is first syncd start"); // TODO put ports to db ? redisSaveLaneMap(laneMap); redisLaneMap = laneMap; // copy } if (laneMap.size() != redisLaneMap.size()) { SWSS_LOG_ERROR("lanes map size differ: %lu vs %lu", laneMap.size(), redisLaneMap.size()); exit(EXIT_FAILURE); } for (auto kv: laneMap) { sai_uint32_t lane = kv.first; sai_object_id_t portId = kv.second; if (redisLaneMap.find(lane) == redisLaneMap.end()) { SWSS_LOG_ERROR("lane %u not found in redis", lane); exit(EXIT_FAILURE); } if (redisLaneMap[lane] != portId) { // if this happens, we need to remap VIDTORID and RIDTOVID SWSS_LOG_ERROR("FIXME: lane port id differs: %llx vs %llx, port ids must be remapped", portId, redisLaneMap[lane]); exit(EXIT_FAILURE); } } }
bool isVeryFirstRun() { std::lock_guard<std::mutex> lock(g_mutex); SWSS_LOG_ENTER(); // if lane map is not defined in redis db then // we assume this is very first start of syncd // later on we can add additional checks here auto redisLaneMap = redisGetLaneMap(); bool firstRun = redisLaneMap.size() == 0; SWSS_LOG_NOTICE("First Run: %s", firstRun ? "True" : "False"); return firstRun; }