From ca706c866bb09911fe90e2b16c2b788ff2b1ac29 Mon Sep 17 00:00:00 2001 From: Ilya Verbitskiy Date: Tue, 19 Sep 2023 23:48:58 +0200 Subject: [PATCH] fixup! virtuerl: add mac addr handling --- virtuerl/src/virtuerl_mgt.erl | 4 ++-- virtuerl/test/virtuerl_SUITE.erl | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/virtuerl/src/virtuerl_mgt.erl b/virtuerl/src/virtuerl_mgt.erl index 0cc5d36..c4447b8 100644 --- a/virtuerl/src/virtuerl_mgt.erl +++ b/virtuerl/src/virtuerl_mgt.erl @@ -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, diff --git a/virtuerl/test/virtuerl_SUITE.erl b/virtuerl/test/virtuerl_SUITE.erl index 787b0da..42dcace 100644 --- a/virtuerl/test/virtuerl_SUITE.erl +++ b/virtuerl/test/virtuerl_SUITE.erl @@ -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, []}, [], []).