Skip to content

Commit 6b52aae

Browse files
mint570SRAVANI KANASANI
authored andcommitted
Add IPv6 src IP as new ternary key field for table ipv6_tunnel_termination_table
Signed-off-by: SRAVANI KANASANI <kanasanis@google.com>
1 parent e09a0d0 commit 6b52aae

File tree

7 files changed

+404
-152
lines changed

7 files changed

+404
-152
lines changed

orchagent/p4orch/p4orch_util.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,11 @@ std::string KeyGenerator::generateTunnelKey(const std::string &tunnel_id)
259259
}
260260

261261
std::string KeyGenerator::generateIpv6TunnelTermKey(
262-
const swss::IpAddress &dst_ipv6_ip,
263-
const swss::IpAddress &dst_ipv6_mask,
264-
const std::string& vrf_id) {
262+
const swss::IpAddress& src_ipv6_ip, const swss::IpAddress& src_ipv6_mask,
263+
const swss::IpAddress& dst_ipv6_ip, const swss::IpAddress& dst_ipv6_mask) {
265264
std::map<std::string, std::string> fv_map = {
265+
{p4orch::kDecapSrcIpv6Ip, src_ipv6_ip.to_string()},
266+
{p4orch::kDecapSrcIpv6Mask, src_ipv6_mask.to_string()},
266267
{p4orch::kDecapDstIpv6Ip, dst_ipv6_ip.to_string()},
267268
{p4orch::kDecapDstIpv6Mask, dst_ipv6_mask.to_string()}};
268269
return generateKey(fv_map);

orchagent/p4orch/p4orch_util.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ constexpr char* kDisableSrcMacRewrite = "disable_src_mac_rewrite";
103103
constexpr char* kDisableDstMacRewrite = "disable_dst_mac_rewrite";
104104
constexpr char* kDisableVlanRewrite = "disable_vlan_rewrite";
105105
constexpr char* kIpv6TunnelTermAction = "mark_for_tunnel_decap_and_set_vrf";
106+
constexpr char* kDecapSrcIpv6 = "src_ipv6";
106107
constexpr char* kDecapDstIpv6 = "dst_ipv6";
108+
constexpr char* kDecapSrcIpv6Ip = "src_ipv6_ip";
109+
constexpr char* kDecapSrcIpv6Mask = "src_ipv6_mask";
107110
constexpr char* kDecapDstIpv6Ip = "dst_ipv6_ip";
108111
constexpr char* kDecapDstIpv6Mask = "dst_ipv6_mask";
109112

@@ -318,6 +321,8 @@ struct P4AclRuleAppDbEntry
318321
struct Ipv6TunnelTermAppDbEntry
319322
{
320323
// Match
324+
swss::IpAddress src_ipv6_ip;
325+
swss::IpAddress src_ipv6_mask;
321326
swss::IpAddress dst_ipv6_ip;
322327
swss::IpAddress dst_ipv6_mask;
323328
// Action
@@ -412,9 +417,10 @@ class KeyGenerator
412417

413418
static std::string generateTunnelKey(const std::string &tunnel_id);
414419

415-
static std::string generateIpv6TunnelTermKey(const swss::IpAddress &dst_ipv6_ip,
416-
const swss::IpAddress &dst_ipv6_mask,
417-
const std::string& vrf_id);
420+
static std::string generateIpv6TunnelTermKey(const swss::IpAddress& src_ipv6_ip,
421+
const swss::IpAddress& src_ipv6_mask,
422+
const swss::IpAddress& dst_ipv6_ip,
423+
const swss::IpAddress& dst_ipv6_mask);
418424

419425
static std::string generateExtTableKey(const std::string &table_name, const std::string &table_key);
420426

orchagent/p4orch/tests/p4orch_util_test.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ TEST(P4OrchUtilTest, KeyGeneratorTest)
5151

5252
auto ipv6_tunnel_term_key =
5353
KeyGenerator::generateIpv6TunnelTermKey(
54-
swss::IpAddress("::1"), swss::IpAddress("::1"), "vrf_id");
54+
swss::IpAddress("::1"), swss::IpAddress("::1"), swss::IpAddress("::2"),
55+
swss::IpAddress("::2"));
5556
EXPECT_EQ(
56-
"dst_ipv6_ip=::1:dst_ipv6_mask=::1", ipv6_tunnel_term_key);
57+
"dst_ipv6_ip=::2:dst_ipv6_mask=::2:src_ipv6_ip=::1:src_ipv6_mask=::1",
58+
ipv6_tunnel_term_key);
5759
}
5860

5961
TEST(P4OrchUtilTest, ParseP4RTKeyTest)

orchagent/p4orch/tests/tunnel_decap_group_manager_test.cpp

Lines changed: 275 additions & 107 deletions
Large diffs are not rendered by default.

orchagent/p4orch/tunnel_decap_group_manager.cpp

Lines changed: 84 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ std::vector<sai_attribute_t> prepareSaiAttrs(
7070
attr.value.s32 = SAI_TUNNEL_TERM_TABLE_ENTRY_TYPE_MP2MP;
7171
attrs.push_back(attr);
7272

73+
// Match on source IP.
74+
attr.id = SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_SRC_IP;
75+
swss::copy(attr.value.ipaddr, ipv6_tunnel_term_entry.src_ipv6_ip);
76+
attrs.push_back(attr);
77+
// Match on source MASK.
78+
attr.id = SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_SRC_IP_MASK;
79+
swss::copy(attr.value.ipaddr, ipv6_tunnel_term_entry.src_ipv6_mask);
80+
attrs.push_back(attr);
7381
// Match on destination IP.
7482
attr.id = SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_DST_IP;
7583
swss::copy(attr.value.ipaddr, ipv6_tunnel_term_entry.dst_ipv6_ip);
@@ -135,14 +143,24 @@ ReturnCode TunnelDecapGroupManager::validateIpv6TunnelTermAppDbEntry(
135143
<< "Invalid action " << QuotedVar(app_db_entry.action_str)
136144
<< " of Ipv6 tunnel termination table entry";
137145
}
146+
if (app_db_entry.src_ipv6_ip.isV4()) {
147+
return ReturnCode(StatusCode::SWSS_RC_INVALID_PARAM)
148+
<< QuotedVar(prependParamField("src_ipv6_ip"))
149+
<< " field is not IPv6";
150+
}
151+
if (app_db_entry.src_ipv6_mask.isV4()) {
152+
return ReturnCode(StatusCode::SWSS_RC_INVALID_PARAM)
153+
<< QuotedVar(prependParamField("src_ipv6_mask"))
154+
<< " field is not IPv6";
155+
}
138156
if (app_db_entry.dst_ipv6_ip.isV4()) {
139157
return ReturnCode(StatusCode::SWSS_RC_INVALID_PARAM)
140158
<< QuotedVar(prependParamField("dst_ipv6_ip"))
141159
<< " field is not IPv6";
142160
}
143161
if (app_db_entry.dst_ipv6_mask.isV4()) {
144162
return ReturnCode(StatusCode::SWSS_RC_INVALID_PARAM)
145-
<< QuotedVar(prependParamField("dst_ipv6_ip"))
163+
<< QuotedVar(prependParamField("dst_ipv6_mask"))
146164
<< " field is not IPv6";
147165
}
148166
return ReturnCode();
@@ -153,10 +171,11 @@ ReturnCode TunnelDecapGroupManager::validateIpv6TunnelTermAppDbEntry(
153171
const std::string& operation) {
154172
SWSS_LOG_ENTER();
155173

156-
Ipv6TunnelTermTableEntry entry =
157-
Ipv6TunnelTermTableEntry(app_db_entry.dst_ipv6_ip,
158-
app_db_entry.dst_ipv6_mask, app_db_entry.vrf_id);
159-
174+
Ipv6TunnelTermTableEntry entry = Ipv6TunnelTermTableEntry(
175+
app_db_entry.src_ipv6_ip, app_db_entry.src_ipv6_mask,
176+
app_db_entry.dst_ipv6_ip, app_db_entry.dst_ipv6_mask,
177+
app_db_entry.vrf_id);
178+
160179
if (operation == SET_COMMAND) {
161180
RETURN_IF_ERROR(validateIpv6TunnelTermAppDbEntry(app_db_entry));
162181
if (getIpv6TunnelTermEntry(entry.ipv6_tunnel_term_key) == nullptr) {
@@ -174,6 +193,8 @@ ReturnCode TunnelDecapGroupManager::validateIpv6TunnelTermAppDbEntry(
174193
return ReturnCode(StatusCode::SWSS_RC_NOT_FOUND)
175194
<< "No VRF found with id " << QuotedVar(entry.vrf_id) << " for "
176195
<< "Ipv6 tunnel termination table entry that matches on "
196+
<< QuotedVar(entry.src_ipv6_ip.to_string()) << "&"
197+
<< QuotedVar(entry.src_ipv6_mask.to_string()) << " and "
177198
<< QuotedVar(entry.dst_ipv6_ip.to_string()) << "&"
178199
<< QuotedVar(entry.dst_ipv6_mask.to_string());
179200
}
@@ -211,12 +232,17 @@ ReturnCode TunnelDecapGroupManager::validateIpv6TunnelTermAppDbEntry(
211232
}
212233

213234
Ipv6TunnelTermTableEntry::Ipv6TunnelTermTableEntry(
235+
const swss::IpAddress& src_ipv6_ip, const swss::IpAddress& src_ipv6_mask,
214236
const swss::IpAddress& dst_ipv6_ip, const swss::IpAddress& dst_ipv6_mask,
215237
const std::string& vrf_id)
216-
: dst_ipv6_ip(dst_ipv6_ip), dst_ipv6_mask(dst_ipv6_mask), vrf_id(vrf_id) {
217-
SWSS_LOG_ENTER();
218-
ipv6_tunnel_term_key = KeyGenerator::generateIpv6TunnelTermKey(
219-
dst_ipv6_ip, dst_ipv6_mask, vrf_id);
238+
: src_ipv6_ip(src_ipv6_ip),
239+
src_ipv6_mask(src_ipv6_mask),
240+
dst_ipv6_ip(dst_ipv6_ip),
241+
dst_ipv6_mask(dst_ipv6_mask),
242+
vrf_id(vrf_id) {
243+
SWSS_LOG_ENTER();
244+
ipv6_tunnel_term_key = KeyGenerator::generateIpv6TunnelTermKey(
245+
src_ipv6_ip, src_ipv6_mask, dst_ipv6_ip, dst_ipv6_mask);
220246
}
221247

222248
ReturnCode TunnelDecapGroupManager::getSaiObject(const std::string& json_key,
@@ -269,10 +295,9 @@ ReturnCode TunnelDecapGroupManager::drain() {
269295
auto& app_db_entry = *app_db_entry_or;
270296

271297
const std::string ipv6_tunnel_term_entry_key =
272-
KeyGenerator::generateIpv6TunnelTermKey(app_db_entry.dst_ipv6_ip,
273-
app_db_entry.dst_ipv6_mask,
274-
app_db_entry.vrf_id);
275-
298+
KeyGenerator::generateIpv6TunnelTermKey(
299+
app_db_entry.src_ipv6_ip, app_db_entry.src_ipv6_mask,
300+
app_db_entry.dst_ipv6_ip, app_db_entry.dst_ipv6_mask);
276301
bool update =
277302
(getIpv6TunnelTermEntry(ipv6_tunnel_term_entry_key) != nullptr);
278303

@@ -334,11 +359,25 @@ TunnelDecapGroupManager::deserializeIpv6TunnelTermAppDbEntry(
334359
Ipv6TunnelTermAppDbEntry app_db_entry = {};
335360

336361
// Default IP and mask.
362+
app_db_entry.src_ipv6_ip = swss::IpAddress("0:0:0:0:0:0:0:0");
363+
app_db_entry.src_ipv6_mask = swss::IpAddress("0:0:0:0:0:0:0:0");
337364
app_db_entry.dst_ipv6_ip = swss::IpAddress("0:0:0:0:0:0:0:0");
338365
app_db_entry.dst_ipv6_mask = swss::IpAddress("0:0:0:0:0:0:0:0");
339366

340367
try {
341368
nlohmann::json j = nlohmann::json::parse(key);
369+
if (j.find(prependMatchField(p4orch::kDecapSrcIpv6)) != j.end()) {
370+
std::string src_ipv6 = j[prependMatchField(p4orch::kDecapSrcIpv6)];
371+
const auto& src_ip_and_mask =
372+
swss::tokenize(src_ipv6, p4orch::kDataMaskDelimiter);
373+
if (src_ip_and_mask.size() != 2) {
374+
return ReturnCode(StatusCode::SWSS_RC_INVALID_PARAM)
375+
<< "Invalid Ipv6 tunnel termination table entry: "
376+
<< "should be in the format of <value> & <mask>.";
377+
}
378+
app_db_entry.src_ipv6_ip = swss::IpAddress(trim(src_ip_and_mask[0]));
379+
app_db_entry.src_ipv6_mask = swss::IpAddress(trim(src_ip_and_mask[1]));
380+
}
342381
if (j.find(prependMatchField(p4orch::kDecapDstIpv6)) != j.end()) {
343382
std::string ipv6 = j[prependMatchField(p4orch::kDecapDstIpv6)];
344383
const auto& ip_and_mask =
@@ -389,7 +428,9 @@ std::vector<ReturnCode> TunnelDecapGroupManager::createIpv6TunnelTermEntries(
389428
for (size_t i = 0; i < ipv6_tunnel_term_entries.size(); ++i) {
390429
statuses[i] = StatusCode::SWSS_RC_NOT_EXECUTED;
391430
entries.push_back(
392-
Ipv6TunnelTermTableEntry(ipv6_tunnel_term_entries[i].dst_ipv6_ip,
431+
Ipv6TunnelTermTableEntry(ipv6_tunnel_term_entries[i].src_ipv6_ip,
432+
ipv6_tunnel_term_entries[i].src_ipv6_mask,
433+
ipv6_tunnel_term_entries[i].dst_ipv6_ip,
393434
ipv6_tunnel_term_entries[i].dst_ipv6_mask,
394435
ipv6_tunnel_term_entries[i].vrf_id));
395436

@@ -451,10 +492,11 @@ std::vector<ReturnCode> TunnelDecapGroupManager::removeIpv6TunnelTermEntries(
451492

452493
const std::string ipv6_tunnel_term_entry_key =
453494
KeyGenerator::generateIpv6TunnelTermKey(
495+
ipv6_tunnel_term_entries[i].src_ipv6_ip,
496+
ipv6_tunnel_term_entries[i].src_ipv6_mask,
454497
ipv6_tunnel_term_entries[i].dst_ipv6_ip,
455-
ipv6_tunnel_term_entries[i].dst_ipv6_mask,
456-
ipv6_tunnel_term_entries[i].vrf_id);
457-
498+
ipv6_tunnel_term_entries[i].dst_ipv6_mask);
499+
458500
// getIpv6TunnelTermEntry() may return a nullptr.
459501
// For entry deletion operations validateIpv6TunnelTermAppDbEntry() checks
460502
// if the getIpv6TunnelTermEntry() function returns nullptr.
@@ -563,9 +605,9 @@ std::string TunnelDecapGroupManager::verifyState(
563605
auto& app_db_entry = *app_db_entry_or;
564606

565607
const std::string ipv6_tunnel_term_entry_key =
566-
KeyGenerator::generateIpv6TunnelTermKey(app_db_entry.dst_ipv6_ip,
567-
app_db_entry.dst_ipv6_mask,
568-
app_db_entry.vrf_id);
608+
KeyGenerator::generateIpv6TunnelTermKey(
609+
app_db_entry.src_ipv6_ip, app_db_entry.src_ipv6_mask,
610+
app_db_entry.dst_ipv6_ip, app_db_entry.dst_ipv6_mask);
569611
auto* ipv6_tunnel_term_entry =
570612
getIpv6TunnelTermEntry(ipv6_tunnel_term_entry_key);
571613
if (ipv6_tunnel_term_entry == nullptr) {
@@ -591,9 +633,10 @@ std::string TunnelDecapGroupManager::verifyStateCache(
591633
const Ipv6TunnelTermAppDbEntry& app_db_entry,
592634
const Ipv6TunnelTermTableEntry* ipv6_tunnel_term_entry) {
593635
const std::string ipv6_tunnel_term_entry_key =
594-
KeyGenerator::generateIpv6TunnelTermKey(app_db_entry.dst_ipv6_ip,
595-
app_db_entry.dst_ipv6_mask,
596-
app_db_entry.vrf_id);
636+
KeyGenerator::generateIpv6TunnelTermKey(
637+
app_db_entry.src_ipv6_ip, app_db_entry.src_ipv6_mask,
638+
app_db_entry.dst_ipv6_ip, app_db_entry.dst_ipv6_mask);
639+
597640
ReturnCode status =
598641
validateIpv6TunnelTermAppDbEntry(app_db_entry, SET_COMMAND);
599642
if (!status.ok()) {
@@ -621,6 +664,24 @@ std::string TunnelDecapGroupManager::verifyStateCache(
621664
<< " in Tunnel Decap Group manager.";
622665
return msg.str();
623666
}
667+
if (app_db_entry.src_ipv6_ip != ipv6_tunnel_term_entry->src_ipv6_ip) {
668+
std::stringstream msg;
669+
msg << "Ipv6 tunnel termination table entry with src_ipv6_ip "
670+
<< QuotedVar(app_db_entry.src_ipv6_ip.to_string())
671+
<< " does not match internal cache "
672+
<< QuotedVar(ipv6_tunnel_term_entry->src_ipv6_ip.to_string())
673+
<< " in Tunnel Decap Group manager.";
674+
return msg.str();
675+
}
676+
if (app_db_entry.src_ipv6_mask != ipv6_tunnel_term_entry->src_ipv6_mask) {
677+
std::stringstream msg;
678+
msg << "Ipv6 tunnel termination table entry with src_ipv6_mask "
679+
<< QuotedVar(app_db_entry.src_ipv6_mask.to_string())
680+
<< " does not match internal cache "
681+
<< QuotedVar(ipv6_tunnel_term_entry->src_ipv6_mask.to_string())
682+
<< " in Tunnel Decap Group manager.";
683+
return msg.str();
684+
}
624685
if (app_db_entry.dst_ipv6_ip != ipv6_tunnel_term_entry->dst_ipv6_ip) {
625686
std::stringstream msg;
626687
msg << "Ipv6 tunnel termination table entry with dst_ipv6_ip "

orchagent/p4orch/tunnel_decap_group_manager.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ extern "C" {
1818
// Ipv6TunnelTermTableEntry holds TunnelDecapGroupManager's internal cache of
1919
// tunnel termination table entry. Example:
2020
// P4RT:FIXED_IPV6_TUNNEL_TERMINATION_TABLE:{"match/dst_ipv6_64bit":
21-
// "2607:f8b0:c145:9300:: & ffff:ffff:ffff:ff00::"}
21+
// "2607:f8b0:c145:9300:: & ffff:ffff:ffff:ff00::",
22+
// "match/src_ipv6_64bit":"2607:f8b0:c145:9300:: & ffff:ffff:ffff:ff00::"}
2223
// "action" = "mark_for_tunnel_decap_and_set_vrf",
2324
// "param/vrf_id" = "b4-traffic",
2425
// "controller_metadata" = "..."
@@ -29,6 +30,8 @@ struct Ipv6TunnelTermTableEntry {
2930

3031
// Fields from P4 table.
3132
// Match
33+
swss::IpAddress src_ipv6_ip;
34+
swss::IpAddress src_ipv6_mask;
3235
swss::IpAddress dst_ipv6_ip;
3336
swss::IpAddress dst_ipv6_mask;
3437
// Action
@@ -39,7 +42,9 @@ struct Ipv6TunnelTermTableEntry {
3942
// SAI OID of the vrf_id for SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_VR_ID
4043
sai_object_id_t vrf_oid = SAI_NULL_OBJECT_ID;
4144

42-
Ipv6TunnelTermTableEntry(const swss::IpAddress& dst_ipv6_ip,
45+
Ipv6TunnelTermTableEntry(const swss::IpAddress& src_ipv6_ip,
46+
const swss::IpAddress& src_ipv6_mask,
47+
const swss::IpAddress& dst_ipv6_ip,
4348
const swss::IpAddress& dst_ipv6_mask,
4449
const std::string& vrf_id);
4550
};

tests/p4rt/test_p4rt_tunnel_decap.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@ class P4RtTunnelDecapWrapper(util.DBInterface):
1616

1717
ASIC_DB_TBL_NAME = "ASIC_STATE:SAI_OBJECT_TYPE_TUNNEL_TERM_TABLE_ENTRY"
1818
SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_TUNNEL_TYPE = "SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_TUNNEL_TYPE"
19+
SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_SRC_IP = "SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_SRC_IP"
20+
SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_SRC_IP_MASK = "SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_SRC_IP_MASK"
1921
SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_TYPE = "SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_TYPE"
2022
SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_DST_IP = "SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_DST_IP"
2123
SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_DST_IP_MASK = "SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_DST_IP_MASK"
2224
SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_VR_ID = "SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_VR_ID"
2325
SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_ACTION_TUNNEL_ID = "SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_ACTION_TUNNEL_ID"
2426

25-
def generate_app_db_key(self, ipv6):
27+
def generate_app_db_key(self, src_ipv6, dst_ipv6):
2628
d = {}
27-
d[util.prepend_match_field("dst_ipv6")] = ipv6
29+
d[util.prepend_match_field("src_ipv6")] = src_ipv6
30+
d[util.prepend_match_field("dst_ipv6")] = dst_ipv6
31+
2832
key = json.dumps(d, separators=(",", ":"))
2933
return self.TBL_NAME + ":" + key
3034

@@ -61,19 +65,19 @@ def test_TunnelDecapGroupAddModifyAndDelete(self, dvs, testlog):
6165
self._p4rt_tunnel_decap_wrapper.asic_db, self._p4rt_tunnel_decap_wrapper.ASIC_DB_TBL_NAME)
6266

6367
# 1. Create tunnel decap group
64-
ipv6 = "2001:db8:3c4d:15::&ffff:ffff:ffff:ffff::"
68+
src_ipv6 = "4001:db8:3c4d:17::&ffff:ffff:ffff:ffff::"
69+
dst_ipv6 = "2001:db8:3c4d:15::&ffff:ffff:ffff:ffff::"
6570
action = "mark_for_tunnel_decap_and_set_vrf"
6671
vrf_id = "b4-traffic"
6772

6873
attr_list_in_app_db = [(self._p4rt_tunnel_decap_wrapper.ACTION, action),
6974
(util.prepend_param_field(
7075
self._p4rt_tunnel_decap_wrapper.VRF_ID), vrf_id)]
71-
tunnel_decap_group_key = self._p4rt_tunnel_decap_wrapper.generate_app_db_key(ipv6)
76+
tunnel_decap_group_key = self._p4rt_tunnel_decap_wrapper.generate_app_db_key(src_ipv6, dst_ipv6)
7277
self._p4rt_tunnel_decap_wrapper.set_app_db_entry(
7378
tunnel_decap_group_key, attr_list_in_app_db)
7479
util.verify_response(
7580
self._response_consumer, tunnel_decap_group_key, attr_list_in_app_db, "SWSS_RC_SUCCESS")
76-
7781
# Query application database for tunnel decap group entries
7882
appl_tunnel_decap_group_entries = util.get_keys(
7983
self._p4rt_tunnel_decap_wrapper.appl_db,
@@ -108,12 +112,14 @@ def test_TunnelDecapGroupAddModifyAndDelete(self, dvs, testlog):
108112
assert status == True
109113

110114
# Get oid of dummy tunnel
111-
dummy_tunnel_oid = fvs[5][1]
115+
dummy_tunnel_oid = fvs[7][1]
112116
assert dummy_tunnel_oid != None
113117

114118
expected_attr_list_in_asic_db = [
115119
(self._p4rt_tunnel_decap_wrapper.SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_TUNNEL_TYPE, "SAI_TUNNEL_TYPE_IPINIP"),
116120
(self._p4rt_tunnel_decap_wrapper.SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_TYPE, "SAI_TUNNEL_TERM_TABLE_ENTRY_TYPE_MP2MP"),
121+
(self._p4rt_tunnel_decap_wrapper.SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_SRC_IP, "4001:db8:3c4d:17::"),
122+
(self._p4rt_tunnel_decap_wrapper.SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_SRC_IP_MASK, "ffff:ffff:ffff:ffff::"),
117123
(self._p4rt_tunnel_decap_wrapper.SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_DST_IP, "2001:db8:3c4d:15::"),
118124
(self._p4rt_tunnel_decap_wrapper.SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_DST_IP_MASK, "ffff:ffff:ffff:ffff::"),
119125
(self._p4rt_tunnel_decap_wrapper.SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_VR_ID, self.vrf_state['entry_id']),
@@ -155,14 +161,15 @@ def test_TunnelDecapGroupModifyNotImplemented(self, dvs, testlog):
155161
self._set_up(dvs)
156162

157163
# Create tunnel decap group
158-
ipv6 = "2001:db8:3c4d:15::&ffff:ffff:ffff:ffff::"
164+
src_ipv6 = "5001:db8:3c4d:7::&ffff:ffff:ffff:ffff::"
165+
dst_ipv6 = "2001:db8:3c4d:15::&ffff:ffff:ffff:ffff::"
159166
action = "mark_for_tunnel_decap_and_set_vrf"
160167
vrf_id = "b4-traffic"
161168

162169
attr_list_in_app_db = [(self._p4rt_tunnel_decap_wrapper.ACTION, action),
163170
(util.prepend_param_field(
164171
self._p4rt_tunnel_decap_wrapper.VRF_ID), vrf_id)]
165-
tunnel_decap_group_key = self._p4rt_tunnel_decap_wrapper.generate_app_db_key(ipv6)
172+
tunnel_decap_group_key = self._p4rt_tunnel_decap_wrapper.generate_app_db_key(src_ipv6, dst_ipv6)
166173
self._p4rt_tunnel_decap_wrapper.set_app_db_entry(
167174
tunnel_decap_group_key, attr_list_in_app_db)
168175
util.verify_response(
@@ -185,15 +192,17 @@ def test_TunnelDecapGroupDeleteBeforeAddFails(self, dvs, testlog):
185192
# Initialize database connectors
186193
self._set_up(dvs)
187194

188-
ipv6 = "2001:db8:3c4d:15::&ffff:ffff:ffff:ffff::"
189-
190-
tunnel_decap_group_key = self._p4rt_tunnel_decap_wrapper.generate_app_db_key(ipv6)
195+
src_ipv6 = "3001:db8:3c4d:11::&ffff:ffff:ffff:ffff::"
196+
dst_ipv6 = "2001:db8:3c4d:15::&ffff:ffff:ffff:ffff::"
197+
tunnel_decap_group_key = self._p4rt_tunnel_decap_wrapper.generate_app_db_key(
198+
src_ipv6, dst_ipv6)
191199

192200
# Remove tunnel decap group fails
193201
self._p4rt_tunnel_decap_wrapper.remove_app_db_entry(
194202
tunnel_decap_group_key)
195203
util.verify_response(
196204
self._response_consumer, tunnel_decap_group_key, [], "SWSS_RC_NOT_FOUND",
197205
"[OrchAgent] Ipv6 tunnel termination table entry with key "
198-
"'dst_ipv6_ip=2001:db8:3c4d:15:::dst_ipv6_mask=ffff:ffff:ffff:ffff::' "
206+
"'dst_ipv6_ip=2001:db8:3c4d:15:::dst_ipv6_mask=ffff:ffff:ffff:ffff:::"
207+
"src_ipv6_ip=3001:db8:3c4d:11:::src_ipv6_mask=ffff:ffff:ffff:ffff::' "
199208
"does not exist in tunnel decap group manager")

0 commit comments

Comments
 (0)