Skip to content

Commit

Permalink
Move switch descriptions to application env list
Browse files Browse the repository at this point in the history
  • Loading branch information
rpt committed Jun 6, 2012
1 parent 566f238 commit 0460bef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
16 changes: 9 additions & 7 deletions apps/of_switch/src/of_switch.app.src
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{application, of_switch,
[
{description, "OpenFlow Logical Switch"},
[{description, "OpenFlow Logical Switch"},
{vsn, "1.2.1"},
{registered, []},
{applications, [
kernel,
{applications, [kernel,
stdlib,
lager
]},
lager]},
{mod, {ofs_app, []}},
{env, [{supported_versions, [1, 2, 3]},
{controllers, []},
{ports, []}]}
{ports, []},
{manufacturer_desc, <<"Dummy">>},
{hardware_desc, <<"Dummy">>},
{software_desc, <<"Dummy">>},
{serial_number, <<"Dummy">>},
{datapath_desc, <<"Dummy">>}]}
]}.
14 changes: 9 additions & 5 deletions apps/of_switch/src/ofs_userspace.erl
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,11 @@ ofp_barrier_request(State, #ofp_barrier_request{}) ->
{ok, ofp_desc_stats_reply(), #state{}} | {error, ofp_error(), #state{}}.
ofp_desc_stats_request(State, #ofp_desc_stats_request{}) ->
{ok, #ofp_desc_stats_reply{flags = [],
mfr_desc = <<"Dummy mfr_desc">>,
hw_desc = <<"Dummy hw_desc">>,
sw_desc = <<"Dummy sw_desc">>,
serial_num = <<"Dummy serial_num">>,
dp_desc = <<"Dummy dp_desc">>
mfr_desc = get_env(manufacturer_desc),
hw_desc = get_env(hardware_desc),
sw_desc = get_env(software_desc),
serial_num = get_env(serial_number),
dp_desc = get_env(datapath_desc)
}, State}.

%% @doc Get flow entry statistics.
Expand Down Expand Up @@ -428,3 +428,7 @@ ofp_group_features_stats_request(State, #ofp_group_features_stats_request{}) ->
%%%-----------------------------------------------------------------------------
%%% Helpers
%%%-----------------------------------------------------------------------------i

get_env(Env) ->
{ok, Value} = application:get_env(of_switch, Env),
Value.

0 comments on commit 0460bef

Please sign in to comment.