Skip to content

Commit

Permalink
Move pktgen.bess to conf dir and use sim utils
Browse files Browse the repository at this point in the history
- Moved ddp-rss-pktgen.bess from bessctl to conf dir
- Remove duplicate code and use utils in sim.py

Signed-off-by: Saikrishna Edupuganti <saikrishna.edupuganti@intel.com>
  • Loading branch information
krsna1729 committed Feb 22, 2021
1 parent 411296a commit d5b2448
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 69 deletions.
67 changes: 0 additions & 67 deletions bessctl/module_tests/ddp-rss-pktgen.bess

This file was deleted.

32 changes: 32 additions & 0 deletions conf/pktgen.bess
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""
docker run --name pktgen -td --restart unless-stopped \
--cpuset-cpus=15-16 --ulimit memlock=-1 --cap-add IPC_LOCK \
-v /dev/hugepages:/dev/hugepages -v "$PWD/conf":/opt/bess/bessctl/conf \
--device=/dev/vfio/vfio --device=/dev/vfio/176 \
upf-epc-bess:"$(<VERSION)" -grpc-url=0.0.0.0:10514
"""

import conf.sim as sim

# flow create 0 ingress pattern eth / ipv4 / udp / gtpu / ipv4 / end actions rss types ipv4 l3-src-only end key_len 0 queues end / end
n39_pkts = [sim.gen_gtpu_packet(128, "22:53:7a:15:58:50", "9e:b2:d3:34:ab:27", "11.1.1.129", "198.18.0.1", "16.0.0.1", "9.9.9.9", 0x123456),]
n36_pkts = [sim.gen_gtpu_packet(128, "22:53:7a:15:58:50", "9e:b2:d3:34:ab:27", "11.1.1.129", "198.18.0.1", "16.0.0.1", "6.6.6.6", 0x123456),]

# flow create 1 ingress pattern eth / ipv4 / udp / gtpu / ipv4 / end actions rss types ipv4 l3-dst-only end key_len 0 queues end / end
n9_pkts = [sim.gen_gtpu_packet(128, "22:53:7a:15:58:50", "c2:9c:55:d4:8a:f6", "13.1.1.199", "198.19.0.1", "9.9.9.9", "16.0.0.1", 0x123456),]

#flow create 1 ingress pattern eth / ipv4 / end actions rss types ipv4 l3-dst-only end key_len 0 queues end / end
n6_pkts = [sim.gen_inet_packet(128, "22:53:7a:15:58:50", "c2:9c:55:d4:8a:f6", "6.6.6.6", "16.0.0.1"),]

p = PMDPort(port_id=0)
pout::PortOut(port=p.name)

n3seq_kwargs = sim.gen_gtpu_sequpdate_args(5000, "16.0.0.1", 62, 0x30000000)
n9seq_kwargs = sim.gen_gtpu_sequpdate_args(5000, "16.0.0.1", 66, 0x90000000)
n6seq_kwargs = sim.gen_inet_sequpdate_args(5000, "16.0.0.1")

Source() -> Rewrite(templates=n39_pkts) -> n39update::SequentialUpdate(**n3seq_kwargs) -> L4Checksum() -> IPChecksum() -> pout
Source() -> Rewrite(templates=n36_pkts) -> n36update::SequentialUpdate(**n3seq_kwargs) -> L4Checksum() -> IPChecksum() -> pout

Source() -> Rewrite(templates=n9_pkts) -> n9update::SequentialUpdate(**n9seq_kwargs) -> L4Checksum() -> IPChecksum() -> pout
Source() -> Rewrite(templates=n6_pkts) -> n6update::SequentialUpdate(**n6seq_kwargs) -> L4Checksum() -> IPChecksum() -> pout
2 changes: 1 addition & 1 deletion conf/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def gen_inet_packet(size, src_mac, dst_mac, src_ip, dst_ip):
return bytes(pkt)


def get_inet_sequpdate_args(max_session, start_ue_ip):
def gen_inet_sequpdate_args(max_session, start_ue_ip):
kwargs = {"fields": [
{'offset': 30, 'size': 4, 'min': ip2long(start_ue_ip),
'max': ip2long(start_ue_ip)+max_session-1}]}
Expand Down
2 changes: 1 addition & 1 deletion conf/up4.bess
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ if parser.mode == 'sim':
parser.sim_start_n3_teid))

n3_seq = sim.gen_gtpu_sequpdate_args(parser.sim_total_flows, parser.sim_start_ue_ip, 62, parser.sim_start_n3_teid)
n6_seq = sim.get_inet_sequpdate_args(parser.sim_total_flows, parser.sim_start_ue_ip)
n6_seq = sim.gen_inet_sequpdate_args(parser.sim_total_flows, parser.sim_start_ue_ip)
n9_seq = sim.gen_gtpu_sequpdate_args(parser.sim_total_flows, parser.sim_start_ue_ip, 66, parser.sim_start_n9_teid)

if parser.sim_core == "n6":
Expand Down

0 comments on commit d5b2448

Please sign in to comment.