mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-23 00:39:52 +00:00
add laneLink conflict check result DFX
Signed-off-by: 15958027009 <xiguodong1@huawei.com>
This commit is contained in:
parent
1be61aafe4
commit
8ba85dcf65
@ -59,6 +59,11 @@ LNN_ASSIGNER(Errcode, TriggerReason, triggerReason)
|
||||
LNN_ASSIGNER(Int64, AuthSeq, authSeq)
|
||||
LNN_ASSIGNER(Errcode, OnlineDevCnt, onlineDevCnt)
|
||||
LNN_ASSIGNER(Int32, Interval, interval)
|
||||
LNN_ASSIGNER(Int32, LaneLinkType, laneLinkType)
|
||||
LNN_ASSIGNER(Int32, HmlChannelId, hmlChannelId)
|
||||
LNN_ASSIGNER(Int32, P2pChannelId, p2pChannelId)
|
||||
LNN_ASSIGNER(Int32, StaChannelId, staChannelId)
|
||||
LNN_ASSIGNER(Int32, ApChannelId, apChannelId)
|
||||
LNN_ASSIGNER(String, PeerDeviceInfo, peerDeviceInfo)
|
||||
LNN_ASSIGNER(AnonymizeString, PeerIp, peerIp)
|
||||
LNN_ASSIGNER(AnonymizeString, PeerBrMac, peerBrMac)
|
||||
@ -74,7 +79,7 @@ LNN_ASSIGNER(AnonymizeString, PeerUdidHash, peerUdidHash)
|
||||
LNN_ASSIGNER(String, CallerPkg, callerPkg)
|
||||
LNN_ASSIGNER(String, CalleePkg, calleePkg)
|
||||
|
||||
#define LNN_ASSIGNER_SIZE 39 // Size of g_connAssigners
|
||||
#define LNN_ASSIGNER_SIZE 44 // Size of g_connAssigners
|
||||
static const HiSysEventParamAssigner g_lnnAssigners[] = {
|
||||
{ "STAGE_RES", HISYSEVENT_INT32, LnnAssignerResult },
|
||||
{ "ERROR_CODE", HISYSEVENT_INT32, LnnAssignerErrcode },
|
||||
@ -101,6 +106,11 @@ static const HiSysEventParamAssigner g_lnnAssigners[] = {
|
||||
{ "AUTH_SEQ", HISYSEVENT_INT64, LnnAssignerAuthSeq },
|
||||
{ "ONLINE_DEV_CNT", HISYSEVENT_INT32, LnnAssignerOnlineDevCnt },
|
||||
{ "INTERVAL", HISYSEVENT_INT32, LnnAssignerInterval },
|
||||
{ "LANE_LINK_TYPE", HISYSEVENT_INT32, LnnAssignerLaneLinkType },
|
||||
{ "HML_CHANNEL_ID", HISYSEVENT_INT32, LnnAssignerHmlChannelId },
|
||||
{ "P2P_CHANNEL_ID", HISYSEVENT_INT32, LnnAssignerP2pChannelId },
|
||||
{ "STA_CHANNEL_ID", HISYSEVENT_INT32, LnnAssignerStaChannelId },
|
||||
{ "AP_CHANNEL_ID", HISYSEVENT_INT32, LnnAssignerApChannelId },
|
||||
{ "PEER_DEV_INFO", HISYSEVENT_STRING, LnnAssignerPeerDeviceInfo },
|
||||
{ "PEER_IP", HISYSEVENT_STRING, LnnAssignerPeerIp },
|
||||
{ "PEER_BR_MAC", HISYSEVENT_STRING, LnnAssignerPeerBrMac },
|
||||
|
@ -36,6 +36,7 @@ typedef enum {
|
||||
EVENT_SCENE_LNN = 1,
|
||||
EVENT_SCENE_JOIN_LNN = 2,
|
||||
EVENT_SCENE_LEAVE_LNN = 3,
|
||||
EVENT_SCENE_LANE = 4,
|
||||
} LnnEventScene;
|
||||
|
||||
typedef enum {
|
||||
@ -76,6 +77,10 @@ typedef enum {
|
||||
EVENT_STAGE_LEAVE_LNN = 1,
|
||||
} LnnEventLeaveLnnStage;
|
||||
|
||||
typedef enum {
|
||||
EVENT_STAGE_LANE_CONFLICT = 1,
|
||||
} LnnEventLaneStage;
|
||||
|
||||
typedef enum {
|
||||
DB_TRIGGER = 0,
|
||||
DM_TRIGGER = 1,
|
||||
@ -158,6 +163,11 @@ typedef struct {
|
||||
int64_t authSeq; // AUTH_SEQ
|
||||
int32_t onlineDevCnt; // ONLINE_DEV_CNT_FOR_LNN_TIME_LATENCY
|
||||
int32_t interval; // BROADCAST_INTERVAL
|
||||
int32_t laneLinkType; // LANE_LINK_TYPE
|
||||
int32_t hmlChannelId; // HML_CHANNEL_ID
|
||||
int32_t p2pChannelId; // P2P_CHANNEL_ID
|
||||
int32_t staChannelId; // STA_CHANNEL_ID
|
||||
int32_t apChannelId; // AP_CHANNEL_ID
|
||||
const char *peerDeviceInfo; // PEER_DEV_INFO
|
||||
const char *peerIp; // PEER_IP
|
||||
const char *peerBrMac; // PEER_BR_MAC
|
||||
|
@ -146,6 +146,11 @@ BUSCENTER_BEHAVIOR:
|
||||
AUTH_SEQ: { type: INT64, desc: auth seq }
|
||||
ONLINE_DEV_CNT: { type: INT32, desc: current online device num for time latency }
|
||||
INTERVAL: { type: INT32, desc: broadcast interval }
|
||||
LANE_LINK_TYPE: { type: INT32, desc: lane link type }
|
||||
HML_CHANNEL_ID: { type: INT32, desc: hml channel id }
|
||||
P2P_CHANNEL_ID: { type: INT32, desc: p2p channel id }
|
||||
STA_CHANNEL_ID: { type: INT32, desc: sta channel id }
|
||||
AP_CHANNEL_ID: { type: INT32, desc: ap channel id }
|
||||
PEER_DEV_INFO: { type: STRING, desc: peer device lnn info }
|
||||
PEER_IP: { type: STRING, desc: peer device ip }
|
||||
PEER_BR_MAC: { type: STRING, desc: peer device br mac }
|
||||
|
@ -101,6 +101,11 @@ MATCHER_P2(LnnValidParamArrayMatcher, inExtra, validSize, "lnn valid param array
|
||||
MatchLnnEventNameTypeExtraInt64Param(params, ++index, extra.authSeq);
|
||||
MatchLnnEventNameTypeExtraInt32Param(params, ++index, extra.onlineDevCnt);
|
||||
MatchLnnEventNameTypeExtraInt32Param(params, ++index, extra.interval);
|
||||
MatchLnnEventNameTypeExtraInt32Param(params, ++index, extra.laneLinkType);
|
||||
MatchLnnEventNameTypeExtraInt32Param(params, ++index, extra.hmlChannelId);
|
||||
MatchLnnEventNameTypeExtraInt32Param(params, ++index, extra.p2pChannelId);
|
||||
MatchLnnEventNameTypeExtraInt32Param(params, ++index, extra.staChannelId);
|
||||
MatchLnnEventNameTypeExtraInt32Param(params, ++index, extra.apChannelId);
|
||||
MatchLnnEventNameTypeExtraStrParam(params, ++index, extra.peerDeviceInfo);
|
||||
MatchLnnEventNameTypeExtraStrParamAnony(params, ++index, extra.peerIp);
|
||||
MatchLnnEventNameTypeExtraStrParamAnony(params, ++index, extra.peerBrMac);
|
||||
|
@ -26,6 +26,100 @@ using namespace testing::ext;
|
||||
namespace OHOS {
|
||||
class LnnEventTest : public testing::Test { };
|
||||
|
||||
static LnnEventExtra validExtra = {
|
||||
.result = 1,
|
||||
.errcode = 2,
|
||||
.authId = 3,
|
||||
.discServerType = 4,
|
||||
.gearCycle = 5,
|
||||
.gearDuration = 6,
|
||||
.connectionId = 7,
|
||||
.authLinkType = 8,
|
||||
.authRequestId = 9,
|
||||
.authCostTime = 10,
|
||||
.lnnType = 11,
|
||||
.onlineNum = 12,
|
||||
.peerDeviceAbility = 13,
|
||||
.onlineType = 14,
|
||||
.osType = 15,
|
||||
.connOnlineReason = 16,
|
||||
.laneId = 17,
|
||||
.chanReqId = 18,
|
||||
.connReqId = 19,
|
||||
.strategy = 20,
|
||||
.timeLatency = 21,
|
||||
.triggerReason = 22,
|
||||
.authSeq = 23,
|
||||
.onlineDevCnt = 24,
|
||||
.interval = 25,
|
||||
.laneLinkType = 26,
|
||||
.hmlChannelId = 27,
|
||||
.p2pChannelId = 28,
|
||||
.staChannelId = 29,
|
||||
.apChannelId = 30,
|
||||
.peerDeviceInfo = "testPeerDeviceInfo",
|
||||
.peerIp = "10.11.12.1",
|
||||
.peerBrMac = "dd:15:bc:b9:f2:04",
|
||||
.peerBleMac = "dd:15:bc:b9:f2:04",
|
||||
.peerWifiMac = "dd:15:bc:b9:f2:04",
|
||||
.peerPort = "testPeerPort",
|
||||
.peerUdid = "a8ynvpdaihw1f6nknjd2hkfhxljxypkr6kvjsbhnhpp16974uo4fvsrpfa6t50fm",
|
||||
.peerNetworkId = "a8ynvpdaihw1f6nknjd2hkfhxljxypkr6kvjsbhnhpp16974uo4fvsrpfa6t50fm",
|
||||
.localDeviceType = "testLocalDeviceType",
|
||||
.peerDeviceType = "testPeerDeviceType",
|
||||
.localUdidHash = "8f37c149495d2a45",
|
||||
.peerUdidHash = "9ada389cd0898797",
|
||||
.callerPkg = "testCallerPkg",
|
||||
.calleePkg = "testCalleePkg",
|
||||
};
|
||||
|
||||
static LnnEventExtra invalidExtra = {
|
||||
.result = -1, // vaild
|
||||
.errcode = -2, // valid
|
||||
.authId = -3, // vaild
|
||||
.discServerType = -4,
|
||||
.gearCycle = -5,
|
||||
.gearDuration = -6,
|
||||
.connectionId = -7,
|
||||
.authLinkType = -8,
|
||||
.authRequestId = -9,
|
||||
.authCostTime = -10,
|
||||
.lnnType = -11,
|
||||
.onlineNum = -12,
|
||||
.peerDeviceAbility = -13,
|
||||
.onlineType = -14,
|
||||
.osType = -15,
|
||||
.connOnlineReason = 0,
|
||||
.laneId = -17,
|
||||
.chanReqId = -18,
|
||||
.connReqId = -19,
|
||||
.strategy = -20,
|
||||
.timeLatency = -21,
|
||||
.triggerReason = -22,
|
||||
.authSeq = -23,
|
||||
.onlineDevCnt = -24,
|
||||
.interval = -25,
|
||||
.laneLinkType = -26,
|
||||
.hmlChannelId = -27,
|
||||
.p2pChannelId = -28,
|
||||
.staChannelId = -29,
|
||||
.apChannelId = -30,
|
||||
.peerDeviceInfo = "",
|
||||
.peerIp = "",
|
||||
.peerBrMac = "",
|
||||
.peerBleMac = "",
|
||||
.peerWifiMac = "",
|
||||
.peerPort = "",
|
||||
.peerUdid = "",
|
||||
.peerNetworkId = "",
|
||||
.localDeviceType = "",
|
||||
.peerDeviceType = "",
|
||||
.localUdidHash = "",
|
||||
.peerUdidHash = "",
|
||||
.callerPkg = "\0",
|
||||
.calleePkg = nullptr,
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.name: LnnEventTest001
|
||||
* @tc.desc: Test lnn event form size
|
||||
@ -59,47 +153,6 @@ HWTEST_F(LnnEventTest, LnnEventTest001, TestSize.Level0)
|
||||
*/
|
||||
HWTEST_F(LnnEventTest, LnnEventTest002, TestSize.Level0)
|
||||
{
|
||||
LnnEventExtra validExtra = {
|
||||
.result = 1,
|
||||
.errcode = 2,
|
||||
.authId = 3,
|
||||
.discServerType = 4,
|
||||
.gearCycle = 5,
|
||||
.gearDuration = 6,
|
||||
.connectionId = 7,
|
||||
.authLinkType = 8,
|
||||
.authRequestId = 9,
|
||||
.authCostTime = 10,
|
||||
.lnnType = 11,
|
||||
.onlineNum = 12,
|
||||
.peerDeviceAbility = 13,
|
||||
.onlineType = 14,
|
||||
.osType = 15,
|
||||
.connOnlineReason = 16,
|
||||
.laneId = 17,
|
||||
.chanReqId = 18,
|
||||
.connReqId = 19,
|
||||
.strategy = 20,
|
||||
.timeLatency = 21,
|
||||
.triggerReason = 22,
|
||||
.authSeq = 23,
|
||||
.onlineDevCnt = 24,
|
||||
.interval = 25,
|
||||
.peerDeviceInfo = "testPeerDeviceInfo",
|
||||
.peerIp = "10.11.12.1",
|
||||
.peerBrMac = "dd:15:bc:b9:f2:04",
|
||||
.peerBleMac = "dd:15:bc:b9:f2:04",
|
||||
.peerWifiMac = "dd:15:bc:b9:f2:04",
|
||||
.peerPort = "testPeerPort",
|
||||
.peerUdid = "a8ynvpdaihw1f6nknjd2hkfhxljxypkr6kvjsbhnhpp16974uo4fvsrpfa6t50fm",
|
||||
.peerNetworkId = "a8ynvpdaihw1f6nknjd2hkfhxljxypkr6kvjsbhnhpp16974uo4fvsrpfa6t50fm",
|
||||
.localDeviceType = "testLocalDeviceType",
|
||||
.peerDeviceType = "testPeerDeviceType",
|
||||
.localUdidHash = "8f37c149495d2a45",
|
||||
.peerUdidHash = "9ada389cd0898797",
|
||||
.callerPkg = "testCallerPkg",
|
||||
.calleePkg = "testCalleePkg",
|
||||
};
|
||||
constexpr int32_t VALID_EXTRA_SIZE = LNN_ASSIGNER_SIZE;
|
||||
|
||||
HiSysEventMock mock;
|
||||
@ -118,47 +171,6 @@ HWTEST_F(LnnEventTest, LnnEventTest002, TestSize.Level0)
|
||||
*/
|
||||
HWTEST_F(LnnEventTest, LnnEventTest003, TestSize.Level0)
|
||||
{
|
||||
LnnEventExtra invalidExtra = {
|
||||
.result = -1, // vaild
|
||||
.errcode = -2, // valid
|
||||
.authId = -3, // vaild
|
||||
.discServerType = -4,
|
||||
.gearCycle = -5,
|
||||
.gearDuration = -6,
|
||||
.connectionId = -7,
|
||||
.authLinkType = -8,
|
||||
.authRequestId = -9,
|
||||
.authCostTime = -10,
|
||||
.lnnType = -11,
|
||||
.onlineNum = -12,
|
||||
.peerDeviceAbility = -13,
|
||||
.onlineType = -14,
|
||||
.osType = -15,
|
||||
.connOnlineReason = 0,
|
||||
.laneId = -17,
|
||||
.chanReqId = -18,
|
||||
.connReqId = -19,
|
||||
.strategy = -20,
|
||||
.timeLatency = -21,
|
||||
.triggerReason = -22,
|
||||
.authSeq = -23,
|
||||
.onlineDevCnt = -24,
|
||||
.interval = -25,
|
||||
.peerDeviceInfo = "",
|
||||
.peerIp = "",
|
||||
.peerBrMac = "",
|
||||
.peerBleMac = "",
|
||||
.peerWifiMac = "",
|
||||
.peerPort = "",
|
||||
.peerUdid = "",
|
||||
.peerNetworkId = "",
|
||||
.localDeviceType = "",
|
||||
.peerDeviceType = "",
|
||||
.localUdidHash = "",
|
||||
.peerUdidHash = "",
|
||||
.callerPkg = "\0",
|
||||
.calleePkg = nullptr,
|
||||
};
|
||||
constexpr int32_t VALID_EXTRA_SIZE = 3; // result, errcode, authId is valid
|
||||
constexpr int32_t VALID_EXTRA_MATCHER_SIZE = 9;
|
||||
HiSysEventMock mock;
|
||||
|
Loading…
Reference in New Issue
Block a user