Skip to content

Commit 77de711

Browse files
author
Szymon Mentel
committed
Add initial application structure
1 parent 8f38834 commit 77de711

12 files changed

Lines changed: 256 additions & 2 deletions

.edts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:name "dobby_ofclient"
2+
:node-sname "dobby_ofclient_edts"
3+
:lib-dirs '("deps" "test")

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ deps
55
*.plt
66
erl_crash.dump
77
ebin
8-
rel/example_project
9-
.concrete/DEV_MODE
8+
rel/dobby_ofclient
109
.rebar
10+
rebar
11+
log
12+
logs

Makefile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
APPS = kernel stdlib sasl erts ssl tools runtime_tools crypto inets \
2+
public_key mnesia syntax_tools compiler
3+
COMBO_PLT = $(HOME)/.dobby_ofc_combo_dialyzer_plt
4+
5+
.PHONY: all compile deps test clean distclean ct
6+
7+
all: compile
8+
9+
compile:
10+
./rebar get-deps compile
11+
12+
deps:
13+
./rebar get-deps
14+
15+
test: compile
16+
./rebar skip_deps=true eunit
17+
18+
ct: compile
19+
./rebar ct
20+
21+
distclean: clean
22+
./rebar delete-deps
23+
24+
clean:
25+
./rebar clean
26+
27+
build_plt: compile
28+
dialyzer --build_plt --output_plt $(COMBO_PLT) --apps $(APPS) \
29+
deps/*/ebin
30+
31+
check_plt: compile
32+
dialyzer --check_plt --plt $(COMBO_PLT) --apps $(APPS) \
33+
deps/*/ebin
34+
35+
dialyzer: compile
36+
@echo
37+
@echo Use "'make check_plt'" to check PLT prior to using this target.
38+
@echo Use "'make build_plt'" to build PLT prior to using this target.
39+
@echo
40+
dialyzer --plt $(COMBO_PLT) ebin
41+
42+
dev: compile
43+
erl -pa ebin -pa deps/*/ebin \
44+
-eval "[application:start(A) || A <- [compiler, syntax_tools, goldrush, lager, dobby_ofclient]]"
45+
46+
compile test clean: rebar
47+
48+
rebar:
49+
wget -c http://github.com/rebar/rebar/wiki/rebar
50+
chmod +x $@

include/dobby_ofclient.hrl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
%%%=============================================================================
2+
%%% @copyright (C) 2015, Erlang Solutions Ltd
3+
%%% @author Szymon Mentel <szymon.mentel@erlang-solutions.com>
4+
%%%=============================================================================
5+
%% Add includes and records
6+

rebar.config

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{sub_dirs, ["deps"]}.
2+
3+
{deps,
4+
[{lager, "2.1.1", {git, "git://github.com/basho/lager", {tag, "2.1.1"}}}
5+
]}.
6+
7+
{cover_enabled, true}.
8+
{erl_opts, [{parse_transform, lager_transform}, debug_info]}.
9+
{edoc_opts, [{preprocess, true}]}.

src/dobby_ofclient.app.src

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{application, dobby_ofclient,
2+
[
3+
{description, "Dobby Client for OpenFlow"},
4+
{vsn, "0.1"},
5+
{registered, []},
6+
{applications, [
7+
kernel,
8+
stdlib,
9+
lager
10+
]},
11+
{mod, { dof_app, []}},
12+
{env, []}
13+
]}.

src/dobby_ofclient.erl

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
%%%=============================================================================
2+
%%% @copyright (C) 2015, Erlang Solutions Ltd
3+
%%% @author Szymon Mentel <szymon.mentel@erlang-solutions.com>
4+
%%% @doc <Module purpose>
5+
%%% @end
6+
%%%=============================================================================
7+
-module(dobby_ofclient).
8+
-copyright("2015, Erlang Solutions Ltd.").
9+
10+
%% API
11+
-export([get_path/2]).
12+
13+
%% Application callbacks
14+
-export([]).
15+
16+
%% -include_lib("").
17+
%% -include("").
18+
19+
%% -define(MYMAC, "MY").
20+
21+
%%------------------------------------------------------------------------------
22+
%% Types
23+
%%------------------------------------------------------------------------------
24+
25+
%% -record(some_rec, {id :: string()}).
26+
27+
%%%=============================================================================
28+
%%% Callbacks
29+
%%%=============================================================================
30+
31+
%%%=============================================================================
32+
%%% External functions
33+
%%%=============================================================================
34+
35+
-spec get_path(SrcEndpoint :: binary(), DstEndpoint :: binary()) ->
36+
{ok, Path :: digraph:graph()} | {error, Reason :: term()}.
37+
38+
get_path(SrcEndPoint, DstEndpoint) ->
39+
{ok, digraph:new()}.
40+
41+
%%%=============================================================================
42+
%%% Internal functions
43+
%%%=============================================================================

src/dof_app.erl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
%%%=============================================================================
2+
%%% @copyright (C) 2015, Erlang Solutions Ltd
3+
%%% @author Szymon Mentel <szymon.mentel@erlang-solutions.com>
4+
%%% @doc <Module purpose>
5+
%%% @end
6+
%%%=============================================================================
7+
-module(dof_app).
8+
9+
-behaviour(application).
10+
11+
%% Application callbacks
12+
-export([start/2, stop/1]).
13+
14+
%% ===================================================================
15+
%% Application callbacks
16+
%% ===================================================================
17+
18+
start(_StartType, _StartArgs) ->
19+
lager:info("[~p] Application started", [?MODULE]),
20+
dof_sup:start_link().
21+
22+
stop(_State) ->
23+
lager:info("[~p] Application stopped", [?MODULE]),
24+
ok.

src/dof_sup.erl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
%%%=============================================================================
2+
%%% @copyright (C) 2015, Erlang Solutions Ltd
3+
%%% @author Szymon Mentel <szymon.mentel@erlang-solutions.com>
4+
%%% @doc <Module purpose>
5+
%%% @end
6+
%%%=============================================================================
7+
-module(dof_sup).
8+
9+
-behaviour(supervisor).
10+
11+
%% API
12+
-export([start_link/0]).
13+
14+
%% Supervisor callbacks
15+
-export([init/1]).
16+
17+
%% ===================================================================
18+
%% API functions
19+
%% ===================================================================
20+
21+
start_link() ->
22+
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
23+
24+
%% ===================================================================
25+
%% Supervisor callbacks
26+
%% ===================================================================
27+
28+
init([]) ->
29+
{ok, { {one_for_one, 5, 10}, [
30+
% {Mod, {Mod, start_link, []}, permanent, Timeout, worker, [Mod]}).
31+
]} }.
32+

test/dobby_ofclient.test.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{config, [dobby_ofclient.cfg]}.
2+
{suites, ".", [dobby_ofclient_SUITE]}.

0 commit comments

Comments
 (0)