Skip to content

Commit

Permalink
fixup! virtuerl: add mac addr handling
Browse files Browse the repository at this point in the history
  • Loading branch information
verbit committed Sep 19, 2023
1 parent 534edc0 commit ca706c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions virtuerl/src/virtuerl_mgt.erl
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ handle_call({domain_create, Conf}, _From, State) ->
handle_call({domain_get, #{id := DomainID}}, _From, State) ->
{Table} = State,
Reply = case dets:lookup(Table, DomainID) of
[{_, #domain{network_id = NetworkID, ipv4_addr=IP, tap_name = TapName}}] ->
DomRet = #{network_id => NetworkID, ipv4_addr => virtuerl_net:format_ip_bitstring(IP), tap_name => iolist_to_binary(TapName)},
[{_, #domain{network_id = NetworkID, mac_addr = MacAddr, ipv4_addr=IP, tap_name = TapName}}] ->
DomRet = #{network_id => NetworkID, mac_addr => binary:encode_hex(MacAddr), ipv4_addr => virtuerl_net:format_ip_bitstring(IP), tap_name => iolist_to_binary(TapName)},
{ok, DomRet};
[] -> notfound
end,
Expand Down
3 changes: 3 additions & 0 deletions virtuerl/test/virtuerl_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,8 @@ test_domain(_Config) ->
<<_:6, Laa:2, _/binary>> = binary:decode_hex(MacAddr),
2 = Laa,

%% {ok, {{_, 200, _}, _, DomainBody1}} = httpc:request(DomainUri),
%% {ok, #{<<"mac_addr">> := MacAddr, <<"ipv4_addr">> := <<"192.168.111.39">>, <<"ipv6_addr">> := <<"2001:db8::8">>}} = thoas:decode(DomainBody1),

{ok, {{_, 204, _}, _, _}} = httpc:request(delete, {DomainUri, []}, [], []),
{ok, {{_, 204, _}, _, _}} = httpc:request(delete, {NetUri, []}, [], []).

0 comments on commit ca706c8

Please sign in to comment.