pfcp-tool: n-sessions [1/4]: add generators for TEID and UE IP

Add the ability to establish a large number of sessions automatically.
Useful for load testing.

Related: SYS#6590
Change-Id: Iec164a222782d382aefe8d0342f398ebba1eac05
This commit is contained in:
Neels Janosch Hofmeyr
2024-07-31 05:07:52 +02:00
committed by Neels Hofmeyr
parent 2b3e46d3b1
commit 968666caab
2 changed files with 19 additions and 0 deletions

View File

@@ -48,6 +48,8 @@ void g_pfcp_tool_alloc(void *ctx)
};
INIT_LLIST_HEAD(&g_pfcp_tool->peers);
g_pfcp_tool->next_ue_addr_state = 0xc0a90001;
}
struct pfcp_tool_peer *pfcp_tool_peer_find(const struct osmo_sockaddr *remote_addr)
@@ -183,3 +185,14 @@ uint64_t peer_new_seid(struct pfcp_tool_peer *peer)
{
return peer->next_seid_state++;
}
uint32_t pfcp_tool_new_teid(void)
{
return g_pfcp_tool->next_teid_state++;
}
int pfcp_tool_next_ue_addr(struct osmo_sockaddr_str *dst)
{
uint32_t addr = g_pfcp_tool->next_ue_addr_state++;
return osmo_sockaddr_str_from_32h(dst, addr, 0);
}

View File

@@ -100,6 +100,9 @@ struct g_pfcp_tool {
struct osmo_pfcp_endpoint *ep;
struct llist_head peers;
uint32_t next_teid_state;
uint32_t next_ue_addr_state;
};
extern struct g_pfcp_tool *g_pfcp_tool;
@@ -117,3 +120,6 @@ void pfcp_tool_rx_msg(struct osmo_pfcp_endpoint *ep, struct osmo_pfcp_msg *m, st
int peer_tx(struct pfcp_tool_peer *peer, struct osmo_pfcp_msg *m);
uint64_t peer_new_seid(struct pfcp_tool_peer *peer);
uint32_t pfcp_tool_new_teid(void);
int pfcp_tool_next_ue_addr(struct osmo_sockaddr_str *dst);