Skip to content

Commit efb4530

Browse files
authored
[orchagent, DTel]: report session support to set user vrf (sonic-net#2326)
[Dtel] Fix set user vrf in DTel report session and confirm the DTel report sent out via the user vrf
1 parent d82874d commit efb4530

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

orchagent/dtelorch.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include "converter.h"
66
#include "ipprefix.h"
77
#include "swssnet.h"
8+
#include "directory.h"
9+
#include "vrforch.h"
810

911
using namespace std;
1012
using namespace swss;
@@ -13,6 +15,7 @@ extern sai_switch_api_t* sai_switch_api;
1315
extern sai_dtel_api_t* sai_dtel_api;
1416
extern sai_object_id_t gVirtualRouterId;
1517
extern sai_object_id_t gSwitchId;
18+
extern Directory<Orch*> gDirectory;
1619

1720
dtelEventLookup_t dTelEventLookup =
1821
{
@@ -1152,9 +1155,14 @@ void DTelOrch::doDtelReportSessionTableTask(Consumer &consumer)
11521155
}
11531156
else if (fvField(i) == VRF)
11541157
{
1155-
rs_attr.id = SAI_DTEL_REPORT_SESSION_ATTR_VIRTUAL_ROUTER_ID;
1156-
/* TODO: find a way to convert vrf to oid */
1158+
string vrf_name = fvValue(i);
11571159
rs_attr.value.oid = gVirtualRouterId;
1160+
if (vrf_name != "default")
1161+
{
1162+
VRFOrch* vrf_orch = gDirectory.get<VRFOrch*>();
1163+
rs_attr.value.oid = vrf_orch->getVRFid(vrf_name);
1164+
}
1165+
rs_attr.id = SAI_DTEL_REPORT_SESSION_ATTR_VIRTUAL_ROUTER_ID;
11581166
report_session_attr.push_back(rs_attr);
11591167
}
11601168
else if (fvField(i) == TRUNCATE_SIZE)

0 commit comments

Comments
 (0)