A restructure of the returned 'get_redis_info' has been done.
The function is now returning a set of host/port collection
based on the required service: pair, central, ha or norep.
This change takes also into account the migration of the redis
configuration parameters from config.yml to constant.yml.
In particular the ports of the redis/valkey services are now
fully defined under the database.xxxx.redis_... keys.
The commit also consider the case of the multi-site config
where the connections to the ha nodes has to be switched to
the port used by haproxy service.
Change-Id: Ie33f2630fde9926391dd5906c0518b0618887621
* ngcp.get_redis_ports() requires no arguments and returns
a hash ref, containing Redis/Valkey related info e.g.:
redis = ngcp.get_redis_info
redis.ports.local
Local database port by default or HA port if mutli site
is enabled and the node has 'db' role
redis.ports.central
Central database port by default or HA port if multi site
is enabled
redis.ports.norep
No replication port, used when certain services configured
to write concurrently on the pair of nodes.
Defaults to redis.port + 1
* fix indentation of "Current known meta-variables"
Change-Id: I97bb06d0d8d5c29930d8176ade2c958a9a0b36c0
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.
Change-Id: I010cd9d544bd505446f0016ecc6302a987921570
Currently it's Debian/testing with trixie/sid yet, though to not fail
with templates handling, let's add initial support for it.
Addresses:
| 2024-09-17 14:17:07 spce: Error: Cannot process template '/etc/ngcp-config/templates/etc/apt/sources.list.d/debian.list.tt2':
| undef error - Error: unsupported Debian codename trixie at (eval 16) line 31.
|
| 2024-09-17 14:17:07 spce: Error: Generating /etc/apt/sources.list.d/debian.list based on /etc/ngcp-config/templates/etc/apt/sources.list.d/debian.list.tt2: FAILED
Change-Id: Ib31bfec1373c51b3faeacc41a085b7229bff139e
The sort function is undefined in scalar context, which means a call
site that calls these functions in scalar context will trigger undefined
behavior.
Sort the result and return the list.
Fixes: Subroutines::ProhibitReturnSort
Warned-by: perlcritic
Change-Id: I355b5e3e412bc91c297a46a73bb6caba6e969f54
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.
Change-Id: Iec7f9dd6d13270d9afa78fbe126f0e41d21b6ed7
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