MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test20

Function test20

dpdk/app/test/test_lpm6.c:1234–1295  ·  view source on GitHub ↗

* Add two rules, lookup to hit the more specific one, lookup to hit the less * specific one delete the less specific rule and lookup previous values again; * add a more specific rule than the existing rule, lookup again */

Source from the content-addressed store, hash-verified

1232 * add a more specific rule than the existing rule, lookup again
1233 */
1234int32_t
1235test20(void)
1236{
1237 struct rte_lpm6 *lpm = NULL;
1238 struct rte_lpm6_config config;
1239 uint8_t ip[16];
1240 uint8_t depth;
1241 uint32_t next_hop_add, next_hop_return;
1242 int32_t status = 0;
1243
1244 config.max_rules = MAX_RULES;
1245 config.number_tbl8s = NUMBER_TBL8S;
1246 config.flags = 0;
1247
1248 lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config);
1249 TEST_LPM_ASSERT(lpm != NULL);
1250
1251 IPv6(ip, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1252 depth = 24;
1253 next_hop_add = 100;
1254
1255 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
1256 TEST_LPM_ASSERT(status == 0);
1257
1258 IPv6(ip, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10);
1259 depth = 128;
1260 next_hop_add = 101;
1261
1262 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
1263 TEST_LPM_ASSERT(status == 0);
1264
1265 status = rte_lpm6_lookup(lpm, ip, &next_hop_return);
1266 TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));
1267
1268 IPv6(ip, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1269 next_hop_add = 100;
1270
1271 status = rte_lpm6_lookup(lpm, ip, &next_hop_return);
1272 TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));
1273
1274 IPv6(ip, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1275 depth = 24;
1276
1277 status = rte_lpm6_delete(lpm, ip, depth);
1278 TEST_LPM_ASSERT(status == 0);
1279
1280 status = rte_lpm6_lookup(lpm, ip, &next_hop_return);
1281 TEST_LPM_ASSERT(status == -ENOENT);
1282
1283 IPv6(ip, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10);
1284 depth = 128;
1285
1286 status = rte_lpm6_delete(lpm, ip, depth);
1287 TEST_LPM_ASSERT(status == 0);
1288
1289 status = rte_lpm6_lookup(lpm, ip, &next_hop_return);
1290 TEST_LPM_ASSERT(status == -ENOENT);
1291

Callers

nothing calls this directly

Calls 6

IPv6Function · 0.85
rte_lpm6_createFunction · 0.50
rte_lpm6_addFunction · 0.50
rte_lpm6_lookupFunction · 0.50
rte_lpm6_deleteFunction · 0.50
rte_lpm6_freeFunction · 0.50

Tested by

no test coverage detected