Hi,
i wrote one yang module which have notification container as alarms, in that 3 alarms are mentioned. I have written an erlang application where it registered to the
notification stream. When i generate the alarm from application, notification is sent succesfully but it is not displayed in the netconf browser. what can be the mistake iam doing here? Any one can help me to solve this?
Below is my yang file:
notification alarms {
leaf wss_communication_error {
type leafref{
path "/performance/wss_communication_error";
}
mandatory true;
}
leaf high_input_channel_power_alarm {
type leafref{
path "/performance/high_input_channel_power_alarm";
}
}
leaf low_input_channel_power_alarm {
type leafref{
path "/performance/low_input_channel_power_alarm";
}
}
}
and Source code is below:
start() ->
application:start(econfd),
timer:sleep(1000),
proc_lib:spawn(fun go/0).
go() ->
process_flag(trap_exit, true),
NCbs = #confd_notification_stream_cbs{
streamname = alarms
},
application:start(econfd),
{ok,Daemon} = econfd:init_daemon(common_daemon, ?CONFD_TRACE, user, none,
{127,0,0,1}, ?CONFD_PORT),
{ok, Register_notify_stream} = econfd:register_notification_stream(Daemon, NCbs),
ok = econfd:register_done(Daemon),
application:set_env(common_daemon, register_notify_stream ,Register_notify_stream),
ok.
generate_wss_communication_error( Present_or_absent ) ->
Notify_path = [{[?NAMESPACE|alarms],start},
{[?NAMESPACE|wss_communication_error], Present_or_absent },
{[?NAMESPACE|alarms],stop}],
send_notification( Notify_path ).
send_notification( Notify_path ) ->
{ok, Register_notify_stream} =
application:get_env(common_daemon,register_notify_stream),
case econfd:notification_send(Register_notify_stream, atime(), Notify_path) of
ok -> io:format("Sent notification ~n"),
ok;
Error -> io:format("Failed to send notification: ~p~n", [Error])
end.