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
admin_export_fields and reseller_export_fields were
each exposed as arrays of plain strings (respective
sql fragments).
now objects will be used instead, to carry perl snippets.
Change-Id: Iccf1d4675d8bb433a17aabb34e14d5dfff2cf318
Add a new config flag to interfaces to allow usage with just a shared IP
address configured, without a static IP address. This requires special
routing to be set up by the operator and can be used on dummy interfaces
as well.
We explicitly disallow this usage for any interface that has a type of
ha_int or ssh_* or mon_*.
Change-Id: Id950a525d2f499fdd17a0a9fee876f01e9f01d87
These are redundant and bogus aliases for get_mgmt_node, which were
reading from a generated templated file instead of getting the
information from the source. Keep the alias around for now in case a
customer is still using this function.
Change-Id: I5aec69313d97bef5bbc655d18f03e7c9af0dbc21
recently added *_concurrent_calls_* fields are not
understood otherwise.
was supposed to be case-insensitive ever since, as
also mariadb ignores case of colnames.
the only exception is "HEADER=<header name>" tag names,
where <header name> is case-sensitive on purpose.
Change-Id: I5e8cd63657e76348150280621df51edc1b0c867d
We should not be scanning the entire out list on each iteration, but
just once at the end to remove any duplicate entries.
Change-Id: Ie6524b5f660e1bd62fc73e2808bc6634bdba2dca
The out variable holds a list of hash references, so the grep cannot
work here. Instead track the ips in a separate hash to track whether
they are unique.
Change-Id: I46b26eb25887de08a91f95d24080e1c06b6d3ff7