TT#42706 Add ngcpcfg libraries: get_ngcp_hosts/get_ngcp_neighbours

Change-Id: I9847e1f62ce14bec878a44e67d4f4ebfc7171dbb
changes/62/22862/4
Alexander Lutay 7 years ago
parent ecbb5e97e4
commit 425540d71d

@ -0,0 +1,29 @@
[%
# vi: ft=tt2
# Return an array with name for all nodes.
#
# @param argv.status node status [ online, offline, inactive ]
# default value: ['online', 'inactive']
# @return out The array of fields "name", e.g.: [ 'sp1', 'sp2' ]
IF !argv.status.size;
argv.status = ['online', 'inactive'];
END;
status = {
online = 0
offline = 0
inactive = 0
};
FOREACH val IN argv.status;
status.$val = 1;
END;
out = [];
FOREACH host IN hosts.keys.sort;
NEXT UNLESS status.item(hosts.$host.status);
out.push( host );
END;
-%]

@ -0,0 +1,30 @@
[%
# vi: ft=tt2
# Return an array of name for all neighbours (all nodes without self).
#
# @param argv.status node status [ online, offline, inactive ]
# default value: ['online', 'inactive']
# @return out The array of fields "name", e.g.: [ 'sp1', 'sp2' ]
IF !argv.status.size;
argv.status = ['online', 'inactive'];
END;
status = {
online = 0
offline = 0
inactive = 0
};
FOREACH val IN argv.status;
status.$val = 1;
END;
out = [];
FOREACH host IN hosts.keys.sort;
NEXT UNLESS status.item(hosts.$host.status);
NEXT IF host == ngcp.get_nodename();
out.push( host );
END;
-%]
Loading…
Cancel
Save