When we pass an empty string the current to_yaml() function generates
broken YAML such as "--- ''", which then breaks code parsing that
expecting valid YAML. If we pass an empty string, return an empty string
as well.
(cherry picked from commit ae2d6e6ed2)
(cherry picked from commit 81a79af51e)
Change-Id: I8743bed2ca9888409a2f74fa0012f65b7b307e21
some templates need to produce yaml output
(ie. copy entire portions of config.yml), which
supported with this change, ie.
[% Utils.to_yaml(element_from_configyml) %]
there is libtemplate-plugin-yaml-perl, which is
avoided to not (re-) introduce deps other than
YAML::XS.
(cherry picked from commit fda5db9456)
(cherry picked from commit d13cc99fb4)
Change-Id: Ieaeb7eb1dd0347466c9184b6f7cff05c556f6de0
After some experimentation it was found to best to keep these platforms
independent, and integrate them externally as usual, instead of trying
to merge them into a single platform.
Change-Id: I19d721dece38d104b73cae573332571c4bef0fbf
We need to get the network information for the remote site. So we add
a new library file, and extend the get_all_shared_ips* ones to support
specifying a site name, defaulting to 'current'.
Change-Id: Id133ba1fc62b758c0779ac5951075c10cdf5736c
Add a library to return the full list of ping nodes to use for HA
verification. This makes it possible to print an identical list of ping
nodes in several places without code duplication.
The code is taken from templates/pacemaker/cluster.crm
Change-Id: Ie121a6062a15c09bf15af1761a22c5f4bcc3199e
This new library code will fetch a list of instances for a given service
name with a specific status.
Change-Id: I161af48d777e8478a8f1358ffd40c996cee9b4a5
Until Debian/bookworm is getting the new stable release, it's
known as bookworm/sid in /etc/debian_version.
Fixes:
| sp1: Error: Cannot process template '/etc/ngcp-config/templates/etc/default/ngcp-proxy.tt2':
| undef error - Error: unsupported Debian codename bookworm at (eval 16) line 30.
Change-Id: Idfe0119ce47cbe8fdcbcd57e9a2c2014e93cf6e1
This makes this function spN ready, by getting the entire list of
siblings and returning the first of them.
Change-Id: Ifc69b1764bc6d8c1007b8b567f4158a66eca81d8
This method returns a sorted list of hostnames for the pair of the
specified hostname, except itself. This is useful for spN support.
Change-Id: I4e7d46de4f480f4c56701b1663877812f74e3640
Connections between instances were reworked to let easier to read
and configured and to improve the validation.
This commit adapt the script get_all_ips_of_connection_for_instance
to the new format and also the corresponding tests.
Change-Id: I6b9d21912a7db968e6c374e0afe210016ac4e879
Due to proposal to refactor the 'get_hosts_records_for_db_connections'
some improvements and "shrinking" of that has been applied.
This however doesn't change a result which this script produces.
Change-Id: Ib977a8c05af59e158b66a238a52d4f91f090c162
Let's remove the duplicate implementation, and simply off-load to the
command, so that we only need to modify one place.
As a side effect, this removes a bogus fallback value of 'self' for
CE systems, which should have been 'spce'.
Change-Id: I70b48caad3da4123a3399254deda73c381ae67d9
Add support for getting the nodename for any hostname in an NGCP
cluster.
We switch from fetching this information from the filesystem to the one
contained now in network.yml.
We accept up to 9 nodes per "pair", from sp1 to sp9, so for Carrier
setups that means hostnames ending from 'a' to 'i'. On CE the nodename
is called "spce".
If we cannot match the hostname to a known pattern we will error out.
Change-Id: I80c287046d02f60193479febee427615474043e3
This is a script, which properly prepares hosts records for
connections towards nosql/sql DBs.
It is able to differentiate the Carrier grade from the PRO setup.
It creates the following list of records:
- at least one record towards central node of the 'db' role (db.central);
- at least one record towards central node of the 'db' role (nosql.central) ;
- records for each PRX/LB node pointing to replicated pair and replicated central ;
In the Carrier grade:
- db.central, points to -> shared IP of the central DB (only on Proxy nodes)
- nosql.central, points to -> shared IP of the central Nosql server (only on Proxy nodes)
- LB has records (for all LB nodes) of replicated pair (nosql db)
pointing to its 'ha_int' type IP address
- Proxy has records (for all Proxy nodes) of replicated pair (nosql db, sql db)
and replicated central type (db only), pointing to its 'ha_int' type IP address
In the PRO setup:
- db.central, points to -> own 'ha_int' type IP address
- nosql.central, points to -> own 'ha_int' type IP address
- records (for all nodes) of replicated pair (nosql db, sql db) and
replicated central type (sql db only), pointing to its 'ha_int' type IP address
This gives us a way for the nosql db / sql db be listening on the
internal IP addresses (not on the loopback ifaces) and not use floating IPs
to be reachable constantly by instances.
Meanwhile instances constantly remain using local nosql/sql DB
(of course excluding a case with the Carrier,
where central sql db/nosql db has a remote shared IP).
Change-Id: Ifceb9fccab48cf78856f8aa8752c3a8b769e3f63
The YAML::XS module handles its passed or returned data for Load() and
Dump() as raw UTF-8, irrespective of perl's UTF-8 string markers. When
we use these functions we need to use a «:raw» encoding or we will end
up with doubly encoded strings.
We also need to tell the Template Toolkit to use UTF-8 as encoding, and
then setup the file handles to use the appropriate encodings.
Change-Id: I37a6811f0680763d7177c3ad92ddf9b890869e66
We need to add a new script, which finds and grabs
a list needed advertised ip addresses for a particular instance.
Change-Id: Id33c4e2d4de071c5feb34dd9346a33ef4a61381b
Defining instances connections could be necessary (for example in SEMS)
to get both the IP of the sip_int interface of LB instance and the IP
of the sip_ext interface.
This is not currently possible because we are allowing definitions of
only one interface type per connection.
The new supported structure is:
connections:
lb:
- type: instance
name: A
interfaces:
- name: vlan1720
type: sip_int
- name: vlan1721
type: sip_ext
* pre-commit: exclude dirs from end-of-file-fixer hook
Change-Id: I832645cb916ee7f2febbea6397a439ea06fbe955
Returns an array of IPs from the connection list passed as argument
The ips are retrieved from the definition of other instances or hosts
@param argv.connection the connection list of the instance
@return out the array of IPs.
* ignore vscode files
Change-Id: I1e108f00d771e5af1d479ffa2cbced786d15e25f
This will be used in the templates for values that are scaled based on
the number of online CPUs on the system, such as process pools, or load
averages.
Change-Id: I3666873f327becc3f7a02be02dba82493b29252e
This method takes a string and replaces %-style meta-variables in it.
Current supported meta-variable is %v for the NGCP version.
Change-Id: I9c932e603a5791115a176b9fea25baff87cab6b9
These have been around for enough time to leave admins room to switch to
the new alternatives. Time for cleanup.
Change-Id: I40a51c8107daf53a6d7fd24b5035bbc2aff77bb6
Interfaces have to be renamed in mr9.5 for Debian bullseye, the decision
was to do eth*->neth*.
During upgrades (with the method of installing the new version in a
second partition), when we change the names in
/ngcp-fallback/etc/ngcp-config/network.yml and then "chroot
/ngcp-fallback ngcpcfg build", the config built from template
"dnsmasq.pxe_hosts" uses this function, and gets less than the expected
interfaces (only "lo", see [1]), and "dnsmasq.d/dhcp.conf" doesn't get
the IP of those "neth*" interfaces in the line "dhcp-option=" (see [2]).
This is because this function only returns interfaces which "exist", so
even if they are configured in network.yml for the new version, they do
not exist in the current/old release and live system, so they are not
returned.
One option is to remove this check altogether, since it does not make a
lot of sense. At the time of building config, one of the interfaces
might be down, and still the configuration should be built for it.
But on the other hand, maybe there are cases like some services expect
all the configured interfaces up when they start, and they refuse to
start if this is not the case. In general, it's changing the default of
many years, so it's a bit dangerous and can lead to obscure errors.
So the current change is a compromise: continue with the same behaviour,
but special-case this renaming of mr9.5, and if the interface in
question is named e.g. "neth0" then consider it valid if the interface
that exists is "eth0", because this is pretty much guaranteed in this
version, and in future versions we shouldn't have interfaces named
"eth0" (so they cannot be active).
[1] This happened and commit 02c737439a01382784f739882430399180d9ef93
from templates.git ("TT#123200 Force dnsmasq listen all 'boot_int'
interfaces from network.yml") tried to address it in another way,
but it still fails due to what's explained above. Presumably in the
past it got "eth0" as the only interface to listen to, after that
commit it gets all interfaces, but since "neth*" are marked as
inexistent, it only gets "lo" in the end. Diff:
--- a/dnsmasq.pxe_hosts
+++ b/dnsmasq.pxe_hosts
@@ -1,3 +1,3 @@
-192.168.255.251 sp1
+127.0.0.1 sp1
192.168.255.252 sp2
-192.168.255.250 sp
+ sp
[2] Diff of the file:
-dhcp-option=6,192.168.255.251,192.168.255.252
+dhcp-option=6,127.0.0.1,192.168.255.252
So it gets 127.0.0.1 from "lo" interface, instead of
"192.168.255.251" from the "neth*" one.
Change-Id: I50458dd8906899af7c7467347fdf9e1ad82a8f48
Serializing data structures via TT Template::Plugin::Utils::to_perl()
uses Data::Dumper internally.
But Data::Dumper does not sort hash keys by default, which causes
different output with each run of ngcpcfg.
->Sortkeys(1) therefor will no ensure concise output.
Change-Id: Ia3954db042e9ddab675d1d582c2ea6e7ad56b807
We return a list of hashes from get_all_shared_*ips_for_host, and cannot
simply sort alphabetically, we need to sort based on a specific key.
Change-Id: If17fced472aea0a96dc2a4ef05956633a691cadf
The li role needs to be active also when the li_dist is active, as per
our own documentation. This also has the nice effect of simplifying the
code.
Change-Id: I34845e58130c6cdebb933c608006b6a4979c2ad6
Change get_debian_release into set_debian_info, and make the former call
the latter.
This new library will populate debian.version and debian.codename from
the current system.
Change-Id: If0d5ed6da359b35e9ef4a6135944c3a7a58848c1