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

Function test13

dpdk/app/test/test_lpm.c:937–993  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

935 * */
936
937int32_t
938test13(void)
939{
940 struct rte_lpm *lpm = NULL;
941 struct rte_lpm_config config;
942
943 config.max_rules = MAX_RULES;
944 config.number_tbl8s = NUMBER_TBL8S;
945 config.flags = 0;
946 uint32_t ip, i, next_hop_add_1, next_hop_add_2, next_hop_return;
947 uint8_t depth;
948 int32_t status = 0;
949
950 lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);
951 TEST_LPM_ASSERT(lpm != NULL);
952
953 ip = RTE_IPV4(128, 0, 0, 0);
954 depth = 24;
955 next_hop_add_1 = 100;
956
957 status = rte_lpm_add(lpm, ip, depth, next_hop_add_1);
958 TEST_LPM_ASSERT(status == 0);
959
960 status = rte_lpm_lookup(lpm, ip, &next_hop_return);
961 TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add_1));
962
963 depth = 32;
964 next_hop_add_2 = 101;
965
966 for (i = 0; i < 1000; i++) {
967 status = rte_lpm_add(lpm, ip, depth, next_hop_add_2);
968 TEST_LPM_ASSERT(status == 0);
969
970 status = rte_lpm_lookup(lpm, ip, &next_hop_return);
971 TEST_LPM_ASSERT((status == 0) &&
972 (next_hop_return == next_hop_add_2));
973
974 status = rte_lpm_delete(lpm, ip, depth);
975 TEST_LPM_ASSERT(status == 0);
976
977 status = rte_lpm_lookup(lpm, ip, &next_hop_return);
978 TEST_LPM_ASSERT((status == 0) &&
979 (next_hop_return == next_hop_add_1));
980 }
981
982 depth = 24;
983
984 status = rte_lpm_delete(lpm, ip, depth);
985 TEST_LPM_ASSERT(status == 0);
986
987 status = rte_lpm_lookup(lpm, ip, &next_hop_return);
988 TEST_LPM_ASSERT(status == -ENOENT);
989
990 rte_lpm_free(lpm);
991
992 return PASS;
993}
994

Callers

nothing calls this directly

Calls 5

rte_lpm_createFunction · 0.50
rte_lpm_addFunction · 0.50
rte_lpm_lookupFunction · 0.50
rte_lpm_deleteFunction · 0.50
rte_lpm_freeFunction · 0.50

Tested by

no test coverage detected