Browse files

parent

  • Loading branch information...
1 parent d57adc0 commit a0a1cb393d0ab30519f0271010035706b65797ba @hejin1026 committed May 31, 2012
Showing with 13 additions and 6 deletions.
  1. +1 −1 src/mit_board.erl
  2. +1 −1 src/mit_cpe.erl
  3. +1 −1 src/mit_eoc.erl
  4. +3 −2 src/mit_onu.erl
  5. +1 −1 src/mit_port.erl
  6. +6 −0 src/mit_util.erl
View
2 src/mit_board.erl
@@ -110,7 +110,7 @@ do_init() ->
{value, Boardid} = dataset:get_value(boardid, Board),
Rdn = "slot=" ++ to_list(Boardid),
Dn = Rdn ++ "," ++ to_list(Bdn),
- mit:update(#entry{dn = to_binary(Dn), uid = to_binary(Buid), type = board, data = Board});
+ mit:update(#entry{dn = to_binary(Dn), uid = to_binary(Buid),parent = Bdn, type = board, data = Board});
false ->
ignore
end
View
2 src/mit_cpe.erl
@@ -166,7 +166,7 @@ init([]) ->
{ok, state};
{error, Reason} ->
?ERROR("mit_cpe start failure...~p",[Reason]),
- {stop, Reason}
+ {ok, state}
end.
%%--------------------------------------------------------------------
View
2 src/mit_eoc.erl
@@ -149,7 +149,7 @@ init([]) ->
{ok, state};
{error, Reason} ->
?ERROR("start eocs failure...~p",[Reason]),
- {stop, Reason}
+ {ok, state}
end.
%%--------------------------------------------------------------------
View
5 src/mit_onu.erl
@@ -182,10 +182,11 @@ init([]) ->
end,
{value, Rdn} = dataset:get_value(rdn, Onu),
case mit:lookup(id, to_binary("olt:" ++ integer_to_list(OltId))) of
- {ok, #entry{data = Olt}} ->
+ {ok, #entry{dn = OltDn, data = Olt}} ->
+ ?INFO("insert onu :~p", [OltDn]),
{value, OltIp} = dataset:get_value(ip, Olt),
Dn = lists:concat(["onu=", to_list(Rdn), ",", "olt=", to_list(OltIp)]),
- mit:update(Entry#entry{dn = to_binary(Dn), parent = mit_util:bdn(Dn)});
+ mit:update(Entry#entry{dn = to_binary(Dn), parent = OltDn});
false ->
ignore
end
View
2 src/mit_port.erl
@@ -182,7 +182,7 @@ do_init([Port|Ports]) ->
Rdn = "port=" ++ to_list(PortIndex),
Dn = Rdn ++ "," ++ binary_to_list(DevDn),
mit:update(#entry{dn = to_binary(Dn), uid = mit_util:uid(port,Id),
- type = port, parent = mit_util:bdn(Dn), data = Port});
+ type = port, parent = DevDn, data = Port});
false -> ingore
end,
do_init(Ports).
View
6 src/mit_util.erl
@@ -11,6 +11,7 @@
-export([bdn/1,
rdn/1,
uid/2,
+ nid/1,
get_type/1,
format/3,
merge/2,
@@ -62,6 +63,11 @@ uid(gem, Id) ->
uid(vlan, Id) ->
to_binary("vlan:" ++ integer_to_list(Id)).
+nid(undefined) ->
+ undefined;
+nid(Uid) ->
+ [_Type,Id] = string:tokens(binary_to_list(Uid), ":"),
+ Id.
merge(NewAttrs, OldAttrs) ->
merge(unchanged, NewAttrs, OldAttrs).

0 comments on commit a0a1cb3

Please sign in to comment.