The li match was triggering for all wildcards and when li mode was not
enabled in some way then we were getting negative results.
The proper way to solve the original problem is to relegate the matching
of the li modes to the end, so that we can properly match on wildcards
and not interfere with other roles.
Change-Id: I7cb559a8dc10e8a832c2e2bcd78f1effc1cc101a
Fixes: commit 236b56d990
Currently `/etc/debian_version` for Debian/buster systems includes:
buster/sid
So until we get the according version number via base-files, also
check for the codename instead. Make it more generic so it works for
any upcoming release that uses ".*/sid", to not run into the issue
again with e.g. the upcoming Debian/release codenamed bullseye (the
release expected after buster).
Thanks: Manuel Montecelo for improving my initial version
Change-Id: I59e6adea98b6c228daa2b5ebe14872c4a35b8920
NGCP doesn't use NDB anymore and also it looks like non-safe commit
as the commit has been done by user 'ngcp-config <root@4bd5de92c84d>' :-D
Removing it.
This reverts commit 9f4d913f6b.
Change-Id: Ie91442a1f33e9ddcae5589c095d19c9e46cd68cb
To be able to generate an authorized_keys file from templates we need
to fetch the public ssh keys for the root user. This function will make
this task easier.
Change-Id: If8edef0e77a5f3c1167fe8dfd0e92e4d9e468a6a
This partially reverts commit bc8ae9e795.
We should not match li_dist with regexes as then we would trap cases
that we should not be covering by the li_dist mapping logic. Just do
exact matches.
This also fixes the hypothetical case with other regexes that are not
the wrongly specified '*'.
Change-Id: I9d9d850969e03fa9dc587f2d47a688bc0359e63c
Otherwise it matches on 'li/li_dist' cases and the library get_all_ips
returns no IPs if called like:
> argv.role='*';
> argv.type='*';
> PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips';
> all_ips = out;
This is a hotfix commit for backporting into mr6.4.1 while the "proper" fix
should be re-considered and committed for mr6.5+
P.S we have 3 tt2 templates where we have * in argv parameters.
P.P.S. The code is from Andreas, tnx for the fix!
Change-Id: I119a687389075d2ebdcd824ed457f768b5fb2123
the following additional fields can be used in
admin_export_fields/reseller_export_fields in config.yml:
- FURNISHED_CHARGE_INFO:
the fci data returned by external lnp requests
- HEADER_*:
the value of a sip header. * is the sip header name,
which is case-sensitive.
Change-Id: Ie0c95d341648fc63fff23ea2d3054b70fa2cf9e9
This adds an additional virtual li_dist role on top of the existing li
role. The difference is that li is the cluster simpli acting in central
mode, while li_dist is the cluster acting in distributed mode.
Change-Id: I930c93380a0e88649c325b7faf3c0fb86d78e5ff
The Template class accepts both a hash reference and a hash to get the
configuration arguments. And the Dancer framework passes those as a
hash.
Change-Id: Ic9ae758bd81a2bb3108900e6f92ad91ad88f3cc9
Move the ngcp object variable into NGCP::Template::Object, and make
NGCP::Template just a customized variant of Template that we can use
instead.
This way we hide all the internal details of how to set up the
environment we need to process NGCP templates.
Change-Id: I690cf1a74551f4751380a506ddcc047b0942ba21
This is another good candidate to replace with a proper ngcp method, as
the function is already implemented as a PERL block, and the most used
"function".
Change-Id: I49dc638a197a0215ea65c0a60c82c6c556aca3fa
This replaces the old has_role Template "function" with a proper method
of the ngcp object, anywhere we need to check for the host role,
including other macros that could not use our previous "function"
before. Which will make it possible to modify the has_role behavior in
a single place, and affect all code paths.
Change-Id: I73526aa77fab3dec8f33361e142164204d7c1481
The perl Template::Toolkit is very rich, but its "function" support is a
bit poor. The ways to do it are either via MACRO directives, or by
simulating them with one function per file and then using PROCESS on
these. The problem is that this is very clunky, does not support
nesting, as we'd need different "argument" names for each "function",
and it's quite cumbersome to use, need to assign aguments passed
beforehand, and then assign back a designated return value from another
variable. This is also one of the reasons some of the functions are not
encapsulated, and have been inlined in various loops, because it was not
possible to cleanly PROCESS them from those call sites.
Instead we should use its native support for perl objects and perl
subroutines, which exposes these as proper methods of a designated
variable, and have none of the above mentioned problems. So we'll switch
from constructs such as:
argv.arg-a = variable;
argv.arg-b = 'value';
PROCESS 'path-to-library-dir/function'
result = out
into:
result = ngcp.function(variable, 'value');
In addition this might actually be faster, as it does not require
processing additional files, and it's all just native perl code.
This will be exposed within the NGCP templates as the ngcp object, and
new member functions will start replacing our old and clunky native
Template PROCESS-style library.
Change-Id: Id2f0d181c695a9dd074646881b7d9de3478570af
new columns available:
EVENT_TIMESTAMP: same as TIMESTAMP (the edr event timestamp),
but including formatting (fractional seconds + rounding)
exactly like cdr START_TIME/INIT_TIME/END_TIME
EVENT_TIMEZONE: the subscriber's inherited timezone
TIMESTAMP_LOCALIZED: the event's timestamp with the
subscriber's inherited timezone applied. same formatting
as EVENT_TIMESTAMP
Change-Id: Id63b92d111e1c5bdb36e9f710f1d464e9e7ed44c
Nodename is always 'sp1' or 'sp2' for both PRO and Carrier,
while none of them are available into Carrier's network.yml.
We should not destroy proper nodename in 'out' on Carrier
(in CE failover code). Ensure we are on CE before using 'self'.
P.S CE network.yml uses 'hosts.self' historically as we never
controlled the server filename on CE.
Change-Id: I6042511e8383a01b1439323204284cfb087e7bca
The variable nodename is defined inside 'PERL' section only
and not available in template toolkit env, so we should check
variable 'out' here, as it currently contains the actual value.
The library has been created long time ago, while
we never used it previously, so the issue has been hidden here.
Change-Id: Iac3547fd60126456feea85d7bb5ffcdc6edb23a2
new fields for cdr exports:
TIMEZONE:
a. call to offnet destination: take source subscriber's inherited tz
b. offnet to local destination: take destination subscriber's inherited tz
c. onnet calls: take the *source* subscriber's inherited tz
(see cdr-exporter.pl -> source reseller folder will contain the
cdr only)
d. transit calls: take system timezone
INIT_TIME_LOCALIZED: init time with timezone applied
START_TIME: start time with timezone applied
END_TIME: end time with timezone applied
Change-Id: I29590fc1b6f37269294518cfece4b4e16f25c3e6
* ['online', 'inactive'] as default
* introduced in order to be able to filter values at templates
so we have the ability to install new nodes without
impacting the working system
Change-Id: I78739f66f80da310347861e86b682fcf72745080
Stop inferring from the metapackage presence and instead use the
variable general.ngcp_type from the constants.yml file which should now
always be present.
Change-Id: I68e97f6894094fe6a1589fa73b048b061eae4a7b
ticket 13069 describes in detail the additions for event-based
billing required by a customer of the hpbx platform. these
additional edr fields will allow to export a single column
showing the subscriber alias for both start and stop profile
events.
Change-Id: Ibd2f9b05ed708521b23cf3db09c68267cf085e3b
In templates' bootenv/sources.list.d/{debian,sipwise}.list we
don't want to hardcode the Debian release, but instead make sure
it matches the underlying Debian release.
Change-Id: I9c844fa2f22bdfa4008b7ff2b9afe9f6634f7d29
For iptables firewall rules it is necessary to translate hostnames,
which may be used in config.yml into a list of IPs as returned by
"gethostbyname".
Change-Id: I149227d5031534d3826a2c91012a599f7c7c4756
There are currently several places in templates where we do request
ngcp version, lets create a helper here, then we will be able to
switch on it after the next LTS is released (mr5.5).
Unfortunately we cannot switch on it before the next LTS,
otherwise upgrade mr4.4->mr5.5 may be corrupted by users.
If sp1 has been upgraded already and sp2 is not while
sp2 has received new templates already while ngcpcfg package
is still old -> templates cannot be built as helper is not found.
Change-Id: Icce966097335eddb7b09303ac2ef8081092bb8f3
the way we create these output timestamps with fractional
seconds is wrong, because FROM_UNIXTIME is not truncating
its argument to int, but its rounds up/down.
"CONCAT(FROM_UNIXTIME(accounting.cdr.start_time +
accounting.cdr.duration), \".
\", SUBSTRING_INDEX(accounting.cdr.start_time +
accounting.cdr.duration, \".\",
-1))"
correct values are:
start: 2016-09-06 06:58:27.586
+duration: 0.520
end: 2016-09-06 06:58:28.120
so all of init_time, start_time, end_time are wrongn. fix
means an explicit int cast via FLOOR:
"CONCAT(FROM_UNIXTIME(FLOOR(accounting.cdr.start_time +
accounting.cdr.duration)), \".
\", SUBSTRING_INDEX(accounting.cdr.start_time +
accounting.cdr.duration, \".\",
-1))"
Change-Id: If6afaed4b1a573b36d0151c0d39eea05ba14b9ba