@@ -18,6 +18,7 @@ extern sai_object_id_t gUnderlayIfId;
18
18
extern sai_object_id_t gSwitchId ;
19
19
extern PortsOrch* gPortsOrch ;
20
20
extern CrmOrch* gCrmOrch ;
21
+ extern QosOrch* gQosOrch ;
21
22
22
23
TunnelDecapOrch::TunnelDecapOrch (DBConnector *db, string tableName) : Orch(db, tableName)
23
24
{
@@ -32,7 +33,7 @@ void TunnelDecapOrch::doTask(Consumer& consumer)
32
33
{
33
34
return ;
34
35
}
35
-
36
+ string table_name = consumer. getTableName ();
36
37
auto it = consumer.m_toSync .begin ();
37
38
while (it != consumer.m_toSync .end ())
38
39
{
@@ -41,8 +42,8 @@ void TunnelDecapOrch::doTask(Consumer& consumer)
41
42
string key = kfvKey (t);
42
43
string op = kfvOp (t);
43
44
44
- IpAddresses dst_ip_addresses ;
45
- IpAddress src_ip_address ( " 0.0.0.0 " ) ;
45
+ IpAddresses ip_addresses ;
46
+ IpAddress src_ip ;
46
47
IpAddress* p_src_ip = nullptr ;
47
48
string tunnel_type;
48
49
string dscp_mode;
@@ -51,7 +52,6 @@ void TunnelDecapOrch::doTask(Consumer& consumer)
51
52
string ttl_mode;
52
53
sai_object_id_t dscp_to_dc_map_id = SAI_NULL_OBJECT_ID;
53
54
sai_object_id_t tc_to_pg_map_id = SAI_NULL_OBJECT_ID;
54
- TunnelTermType term_type = TUNNEL_TERM_TYPE_P2MP;
55
55
56
56
bool valid = true ;
57
57
@@ -83,7 +83,7 @@ void TunnelDecapOrch::doTask(Consumer& consumer)
83
83
{
84
84
try
85
85
{
86
- dst_ip_addresses = IpAddresses (fvValue (i));
86
+ ip_addresses = IpAddresses (fvValue (i));
87
87
}
88
88
catch (const std::invalid_argument &e)
89
89
{
@@ -93,17 +93,15 @@ void TunnelDecapOrch::doTask(Consumer& consumer)
93
93
}
94
94
if (exists)
95
95
{
96
- setIpAttribute (key, dst_ip_addresses , tunnelTable.find (key)->second .tunnel_id );
96
+ setIpAttribute (key, ip_addresses , tunnelTable.find (key)->second .tunnel_id );
97
97
}
98
98
}
99
99
else if (fvField (i) == " src_ip" )
100
100
{
101
101
try
102
102
{
103
- src_ip_address = IpAddress (fvValue (i));
104
- p_src_ip = &src_ip_address;
105
- // Tunnel term type is set to P2P when source ip is present
106
- term_type = TUNNEL_TERM_TYPE_P2P;
103
+ src_ip = IpAddress (fvValue (i));
104
+ p_src_ip = &src_ip;
107
105
}
108
106
catch (const std::invalid_argument &e)
109
107
{
@@ -174,15 +172,15 @@ void TunnelDecapOrch::doTask(Consumer& consumer)
174
172
}
175
173
else if (fvField (i) == decap_dscp_to_tc_field_name)
176
174
{
177
- dscp_to_dc_map_id = resolveQosMapId ( key, decap_dscp_to_tc_field_name, t);
175
+ dscp_to_dc_map_id = gQosOrch -> resolveTunnelQosMap (table_name, key, decap_dscp_to_tc_field_name, t);
178
176
if (exists && dscp_to_dc_map_id != SAI_NULL_OBJECT_ID)
179
177
{
180
178
setTunnelAttribute (fvField (i), dscp_to_dc_map_id, tunnel_id);
181
179
}
182
180
}
183
181
else if (fvField (i) == decap_tc_to_pg_field_name)
184
182
{
185
- tc_to_pg_map_id = resolveQosMapId ( key, decap_tc_to_pg_field_name, t);
183
+ tc_to_pg_map_id = gQosOrch -> resolveTunnelQosMap (table_name, key, decap_tc_to_pg_field_name, t);
186
184
if (exists && tc_to_pg_map_id != SAI_NULL_OBJECT_ID)
187
185
{
188
186
setTunnelAttribute (fvField (i), tc_to_pg_map_id, tunnel_id);
@@ -194,8 +192,8 @@ void TunnelDecapOrch::doTask(Consumer& consumer)
194
192
if (valid && !exists)
195
193
{
196
194
197
- if (addDecapTunnel (key, tunnel_type, dst_ip_addresses , p_src_ip, dscp_mode, ecn_mode, encap_ecn_mode, ttl_mode,
198
- term_type, dscp_to_dc_map_id, tc_to_pg_map_id))
195
+ if (addDecapTunnel (key, tunnel_type, ip_addresses , p_src_ip, dscp_mode, ecn_mode, encap_ecn_mode, ttl_mode,
196
+ dscp_to_dc_map_id, tc_to_pg_map_id))
199
197
{
200
198
SWSS_LOG_NOTICE (" Tunnel(s) added to ASIC_DB." );
201
199
}
@@ -233,7 +231,6 @@ void TunnelDecapOrch::doTask(Consumer& consumer)
233
231
* @param[in] dscp - dscp mode (uniform/pipe)
234
232
* @param[in] ecn - ecn mode (copy_from_outer/standard)
235
233
* @param[in] ttl - ttl mode (uniform/pipe)
236
- * @param[in] term_type - The type of tunnel term
237
234
* @param[in] dscp_to_tc_map_id - Map ID for remapping DSCP to TC (decap)
238
235
* @param[in] tc_to_pg_map_id - Map ID for remapping TC to PG (decap)
239
236
*
@@ -249,7 +246,6 @@ bool TunnelDecapOrch::addDecapTunnel(
249
246
string ecn,
250
247
string encap_ecn,
251
248
string ttl,
252
- TunnelTermType term_type,
253
249
sai_object_id_t dscp_to_tc_map_id,
254
250
sai_object_id_t tc_to_pg_map_id)
255
251
{
@@ -262,6 +258,7 @@ bool TunnelDecapOrch::addDecapTunnel(
262
258
sai_attribute_t attr;
263
259
vector<sai_attribute_t > tunnel_attrs;
264
260
sai_object_id_t overlayIfId;
261
+ TunnelTermType term_type = TUNNEL_TERM_TYPE_P2MP;
265
262
266
263
// create the overlay router interface to create a LOOPBACK type router interface (decap)
267
264
vector<sai_attribute_t > overlay_intf_attrs;
@@ -310,6 +307,7 @@ bool TunnelDecapOrch::addDecapTunnel(
310
307
copy (attr.value .ipaddr , p_src_ip->to_string ());
311
308
tunnel_attrs.push_back (attr);
312
309
src_ip = *p_src_ip;
310
+ term_type = TUNNEL_TERM_TYPE_P2P;
313
311
}
314
312
315
313
// decap ecn mode (copy from outer/standard)
@@ -474,7 +472,7 @@ bool TunnelDecapOrch::addDecapTunnelTermEntries(string tunnelKey, swss::IpAddres
474
472
// check if the there's an entry already for the key pair
475
473
if (existingIps.find (key) != existingIps.end ())
476
474
{
477
- SWSS_LOG_ERROR (" %s already exists. Did not create entry." , key.c_str ());
475
+ SWSS_LOG_NOTICE (" %s already exists. Did not create entry." , key.c_str ());
478
476
}
479
477
else
480
478
{
@@ -941,34 +939,3 @@ IpAddresses TunnelDecapOrch::getDstIpAddresses(std::string tunnelKey)
941
939
return tunnelTable[tunnelKey].dst_ip_addrs ;
942
940
}
943
941
944
- /* *
945
- * Function Description:
946
- * @brief Resolve the map id from QosOrch
947
- *
948
- * Arguments:
949
- * @param[in] tunnle_name - The name of tunnel
950
- * @param[in] map_type_name - The type of referenced QoS map
951
- * @param[in] tuple - The KeyOpFieldsValuesTuple that contains keys - values
952
- *
953
- * Return Values:
954
- * @return The sai_object_id of referenced map, or SAI_NULL_OBJECT_ID if there's an error
955
- */
956
- sai_object_id_t TunnelDecapOrch::resolveQosMapId (std::string tunnle_name, std::string map_type_name, KeyOpFieldsValuesTuple& tuple)
957
- {
958
- sai_object_id_t id;
959
- string object_name;
960
- ref_resolve_status status = resolveFieldRefValue (QosOrch::getTypeMap (), map_type_name, qos_to_ref_table_map.at (map_type_name), tuple, id, object_name);
961
- if (status == ref_resolve_status::success)
962
- {
963
-
964
- setObjectReference (QosOrch::getTypeMap (), CFG_TUNNEL_TABLE_NAME, tunnle_name, map_type_name, object_name);
965
- SWSS_LOG_INFO (" Resolved QoS map for tunnel %s type %s name %s" , tunnle_name.c_str (), map_type_name.c_str (), object_name.c_str ());
966
- return id;
967
- }
968
- else
969
- {
970
- SWSS_LOG_ERROR (" Failed to resolce QoS map for tunnel %s type %s" , tunnle_name.c_str (), map_type_name.c_str ());
971
- return SAI_NULL_OBJECT_ID;
972
- }
973
-
974
- }
0 commit comments