• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

travelping / capwap / 203

pending completion
203

Pull #19

travis-ci-com

web-flow
Flexible options for DHCP relay suboptions
Pull Request #19: dhcp relay

53 of 53 new or added lines in 2 files covered. (100.0%)

643 of 3151 relevant lines covered (20.41%)

1417.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/capwap_http_api.erl
1
%% Copyright (C) 2013-2017, Travelping GmbH <info@travelping.com>
2

3
%% This program is free software: you can redistribute it and/or modify
4
%% it under the terms of the GNU Affero General Public License as published by
5
%% the Free Software Foundation, either version 3 of the License, or
6
%% (at your option) any later version.
7

8
%% This program is distributed in the hope that it will be useful,
9
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
10
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
%% GNU Affero General Public License for more details.
12

13
%% You should have received a copy of the GNU Affero General Public License
14
%% along with this program.  If not, see <http://www.gnu.org/licenses/>.
15

16
-module(capwap_http_api).
17

18
-export([start_link/0]).
19

20
-define(DEFAULT_PORT,        8000).
21
-define(DEFAULT_IP,     {127, 0, 0, 1}).
22
-define(ACCEPTORS_NUM,  100).
23

24
start_link() ->
25
    HttpConfig = application:get_env(capwap, http_api, []),
×
26
    Port = proplists:get_value(port, HttpConfig, ?DEFAULT_PORT),
×
27
    IP = proplists:get_value(ip, HttpConfig, ?DEFAULT_IP),
×
28
    INet = get_inet(IP),
×
29
    AcceptorsNum = proplists:get_value(acceptors_num, HttpConfig, ?ACCEPTORS_NUM),
×
30
    Dispatch = cowboy_router:compile([
×
31
                {'_', [
32
            {"/metrics",        capwap_http_api_handler, []},
33
            {"/metrics/[...]",  capwap_http_api_handler, []},
34
            {"/api/v1/version", capwap_http_api_handler, []},
35

36
            {"/api/v1/wtp",                           capwap_http_api_handler, []},
37
            {"/api/v1/wtp/:id",                       capwap_http_api_handler, []},
38
            {"/api/v1/wtp/:id/update/:link/:hash",    capwap_http_api_handler, []},
39
            {"/api/v1/wtp/:id/set-ssid/:ssid[/:rid]", capwap_http_api_handler, []},
40
            {"/api/v1/wtp/:id/stop-radio/:rid",       capwap_http_api_handler, []},
41

42
            {"/api/v1/station",     capwap_http_api_handler, []},
43
            {"/api/v1/station/:id", capwap_http_api_handler, []},
44

45
            {"/api/v1/dp/wtp-list", capwap_http_api_handler, []},
46
            {"/api/v1/dp/stats",    capwap_http_api_handler, []},
47

48
            {"/api/v1/spec/ui",       capwap_swagger_ui_handler, []},
49
            {"/api/v1/spec/ui/[...]", cowboy_static, {priv_dir, capwap, "static"}}
50
                ]}
51
        ]),
52
    TransOpts = [{port, Port}, {ip, IP}, INet, {num_acceptors, AcceptorsNum}],
×
53
    ProtoOpts = #{env => #{dispatch => Dispatch}},
×
54
    cowboy:start_clear(capwap_http_api, TransOpts, ProtoOpts).
×
55

56
get_inet({_, _, _, _}) ->
57
    inet;
×
58
get_inet({_, _, _, _, _, _, _, _}) ->
59
    inet6.
×
60

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2024 Coveralls, Inc