diff options
author | Alberto Compagno <acompagn+fdio@cisco.com> | 2017-10-03 16:23:11 +0200 |
---|---|---|
committer | Alberto Compagno <acompagn+fdio@cisco.com> | 2017-10-03 16:29:47 +0200 |
commit | d8f9cb6679e009bfe45f4b111c5eb6beae56752a (patch) | |
tree | 2e1bd1b2b088d8c2c4deb12d85133831149ace2f | |
parent | d7ad2a78bb85224d0baa91a415f92e28e10a43e3 (diff) |
Fix on the packet generator for cicn and added packet generator script
Change-Id: Ic75f65e733727317600dcdbfb662452b7f91e93b
Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
-rwxr-xr-x | cicn-plugin/CMakeLists.txt | 1 | ||||
-rw-r--r-- | cicn-plugin/cicn/cicn_pg.c | 20 | ||||
-rw-r--r-- | cicn-plugin/test/README | 48 | ||||
-rw-r--r-- | cicn-plugin/test/icn_pg | 11 |
4 files changed, 73 insertions, 7 deletions
diff --git a/cicn-plugin/CMakeLists.txt b/cicn-plugin/CMakeLists.txt index 2836a044..7a7e8f4b 100755 --- a/cicn-plugin/CMakeLists.txt +++ b/cicn-plugin/CMakeLists.txt @@ -93,6 +93,7 @@ include_directories(SYSTEM) include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(./) include_directories(cicn/test) +include_directories(${VPP_INCLUDE_DIR}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -march=native -O3") add_library(cicn_api_test_plugin SHARED diff --git a/cicn-plugin/cicn/cicn_pg.c b/cicn-plugin/cicn/cicn_pg.c index 91bf1759..f150fded 100644 --- a/cicn-plugin/cicn/cicn_pg.c +++ b/cicn-plugin/cicn/cicn_pg.c @@ -348,7 +348,7 @@ icnpg_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, /* Stuff the counter value into the last name-comp */ C_PUTINT64 ((name0 + namelen0 - 8), namecounter); - namecounter += 1LL; + namecounter += 1ULL; /* Rewrite and send */ ip0->src_address.as_u32 = sm->pgen_clt_src_addr; @@ -593,7 +593,7 @@ icnpg_node_server_fn (vlib_main_t * vm, /* Change message and packet from Interest to Content */ *(body0 + 1) = CICN_PKT_TYPE_CONTENT; - C_PUTINT16 (body0 + 8, CICN_MSG_TYPE_CONTENT); + C_PUTINT16 (body0 + 14, CICN_MSG_TYPE_CONTENT); vlib_buffer_t *rb = NULL; rb = vlib_get_buffer (vm, sm->pgen_svr_buffer_idx); @@ -624,10 +624,13 @@ icnpg_node_server_fn (vlib_main_t * vm, b0 = vlib_get_buffer (vm, index); body0 = vlib_buffer_get_current (b0); + // Update interest lifetime to cache time + C_PUTINT16 (body0 + 8, CICN_HDR_TLV_CACHE_TIME); + // Update the length of the message uint16_t msg_len; - C_GETINT16 (msg_len, body0 + 10); - C_PUTINT16 (body0 + 10, msg_len + bytes_to_copy); + C_GETINT16 (msg_len, body0 + 16); + C_PUTINT16 (body0 + 16, msg_len + bytes_to_copy); // Update the length of the packet C_PUTINT16 (body0 + 2, pkt_len + bytes_to_copy); @@ -671,7 +674,7 @@ icnpg_node_server_fn (vlib_main_t * vm, /* Change message and packet types from Interest to Content */ *(body1 + 1) = CICN_PKT_TYPE_CONTENT; - C_PUTINT16 (body1 + 8, CICN_MSG_TYPE_CONTENT); + C_PUTINT16 (body1 + 14, CICN_MSG_TYPE_CONTENT); vlib_buffer_t *rb = NULL; rb = vlib_get_buffer (vm, sm->pgen_svr_buffer_idx); @@ -702,10 +705,13 @@ icnpg_node_server_fn (vlib_main_t * vm, b1 = vlib_get_buffer (vm, index); body1 = vlib_buffer_get_current (b1); + // Update interest lifetime to cache time + C_PUTINT16 (body1 + 8, CICN_HDR_TLV_CACHE_TIME); + // Update the length of the message uint16_t msg_len; - C_GETINT16 (msg_len, body1 + 10); - C_PUTINT16 (body1 + 10, msg_len + bytes_to_copy); + C_GETINT16 (msg_len, body1 + 16); + C_PUTINT16 (body1 + 16, msg_len + bytes_to_copy); // Update the length of the packet C_PUTINT16 (body1 + 2, pkt_len + bytes_to_copy); diff --git a/cicn-plugin/test/README b/cicn-plugin/test/README new file mode 100644 index 00000000..2a33598c --- /dev/null +++ b/cicn-plugin/test/README @@ -0,0 +1,48 @@ +Packet generator for ICN + +The packet generator for ICN requires at least 3 vpp nodes: an icn packet generator +client, an icn packet generator server and a third vpp node running the +cicn-plugin. Both icn packet generator client and server are are part of the +cicn-plugin for vpp. The topology should be similar to the following: + +vpp1 (PG client) <--> vpp2 (cicn-plugin) <--> vpp3 (PG server) + +vpp2 is the node that we are going to benchmark. + +The current packet generator client requests subsequent content to the packet +generator server. Interest and content name is the following: + +ccnx:/ccnxpg/<Chunk_number> + +The Chunk number (u64) is iteratively incremented after an interest is issued. + + +CONFIGURATION +Vpp1 must contain a pg interface (e.g., pg0) configured +with the IP address 192.168.128.245 and be able to forward packet to +192.168.128.1. The following configuration takes care of setting the pg +interface, setting 192.168.128.1 reachable through the pg interface and the icn +pg client. It assume that the next cicn hop answer to the ip 192.168.128.2 and +it is reachable through a local interface with the ip address +192.168.128.3. There ip addresses can be set arbitrarily, modifications must be +done in both vpp1 and vpp2. IMPORTANT: In the following example, the port 33301 +is used to pass packets to the icn pg client plugin. Modification to such port +requires to change the packet definition on the icn-pg file. + +vpp# exec <path-to>/icn-pg +vpp# set int ip addr pg0 192.168.128.245/24 +vpp# cicn pgen client port 33301 src 192.168.128.3:33301 dest 192.168.128.2:6363 + +To run the icn_pg packet generator script configure vpp as follows. + +vpp# packet-generator enable + +Following the example, Vpp2 must be set to be reachable to the ip address +192.168.128.2 and have a face +192.168.128.2:6363<-->192.168.128.3:33301. Moreover vpp2 must be able to forward +packets (and interest) to the packet generator server. + +Vpp3 configuration is simple. It must be configured to accept packets from +vpp2. The cicn packet generator plugin can be configured in this way: + +vpp# cicn pgen server port 6363 size 1200
\ No newline at end of file diff --git a/cicn-plugin/test/icn_pg b/cicn-plugin/test/icn_pg new file mode 100644 index 00000000..043b25a3 --- /dev/null +++ b/cicn-plugin/test/icn_pg @@ -0,0 +1,11 @@ +packet-generator new { + name icn-pg + limit 1 + size 72-72 + node ip4-input + no-recycle + data { + UDP: 192.168.128.1 -> 192.168.128.245 + hex 0x18db821500341b930100002cff00000e0001000203e90001001a000000160001000663636e787067001000088000000000000000 + } +}
\ No newline at end of file |