Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
 ryu/tests/unit/ofproto/mkdata/Makefile       |  5 +++++
 ryu/tests/unit/ofproto/mkdata/rebar.config   |  3 +++
 ryu/tests/unit/ofproto/mkdata/src/er.app.src |  8 +++++++
 ryu/tests/unit/ofproto/mkdata/src/x.erl      | 31 ++++++++++++++++++++++++++++
 4 files changed, 47 insertions(+)
 create mode 100644 ryu/tests/unit/ofproto/mkdata/Makefile
 create mode 100644 ryu/tests/unit/ofproto/mkdata/rebar.config
 create mode 100644 ryu/tests/unit/ofproto/mkdata/src/er.app.src
 create mode 100644 ryu/tests/unit/ofproto/mkdata/src/x.erl

diff --git a/ryu/tests/unit/ofproto/mkdata/Makefile 
b/ryu/tests/unit/ofproto/mkdata/Makefile
new file mode 100644
index 0000000..be1e8d8
--- /dev/null
+++ b/ryu/tests/unit/ofproto/mkdata/Makefile
@@ -0,0 +1,5 @@
+
+generate:
+       rebar get-deps
+       rebar compile
+       erl -pa ebin deps/*/ebin -s x x -s init stop
diff --git a/ryu/tests/unit/ofproto/mkdata/rebar.config 
b/ryu/tests/unit/ofproto/mkdata/rebar.config
new file mode 100644
index 0000000..90cb051
--- /dev/null
+++ b/ryu/tests/unit/ofproto/mkdata/rebar.config
@@ -0,0 +1,3 @@
+{deps,
+ [{of_protocol, ".*",
+   {git, "http://github.com/FlowForwarding/of_protocol.git";, {branch, 
"master"}}}]}.
diff --git a/ryu/tests/unit/ofproto/mkdata/src/er.app.src 
b/ryu/tests/unit/ofproto/mkdata/src/er.app.src
new file mode 100644
index 0000000..cd793c5
--- /dev/null
+++ b/ryu/tests/unit/ofproto/mkdata/src/er.app.src
@@ -0,0 +1,8 @@
+{application, er,
+ [{description, "generate test data"},
+  {vsn, "1.0"},
+  {applications,
+   [kernel,
+    stdlib,
+    of_protocol]}]}.
+
diff --git a/ryu/tests/unit/ofproto/mkdata/src/x.erl 
b/ryu/tests/unit/ofproto/mkdata/src/x.erl
new file mode 100644
index 0000000..2921b99
--- /dev/null
+++ b/ryu/tests/unit/ofproto/mkdata/src/x.erl
@@ -0,0 +1,31 @@
+-module(x).
+-compile(export_all).
+
+-include_lib("of_protocol/include/of_protocol.hrl").
+-include_lib("of_protocol/include/ofp_v3.hrl").
+
+do(Body) ->
+    Name = atom_to_list(element(1, Body)),
+    io:format("processing ~s~n", [Name]),
+    Msg = ofp_v3_encode:do(#ofp_message{version=3, xid=0, body=Body}),
+    {ok, F} = file:open(["../data/", Name, ".packet"], [write, binary]),
+    ok = file:write(F, Msg),
+    ok = file:close(F).
+
+x() ->
+    lists:map(fun do/1, [
+        #ofp_desc_stats_reply{flags = [], mfr_desc = <<"mfr">>,
+                              hw_desc = <<"hw">>, sw_desc = <<"sw">>,
+                              serial_num = <<"serial">>,
+                              dp_desc = <<"dp">>},
+        #ofp_packet_out{
+            buffer_id = no_buffer,in_port = controller,
+            actions = 
+                [#ofp_action_output{seq = 14,port = all,max_len = 65535}],
+            data = 
+                <<242,11,164,208,63,112,242,11,164,125,248,234,8,0,69,0,
+                  0,84,248,26,0,0,255,1,175,139,10,0,0,1,10,0,0,2,8,0,2,
+                  8,247,96,0,0,49,214,2,0,0,0,0,0,171,141,45,49,0,0,0,0,
+                  16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,
+                  34,35,36,37,38,39,40,41,42,43,44,45,46,47,0,0,0,0,0,0,
+                  0,0>>}]).
-- 
1.8.1.5


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to