13. Software Upgrade

13.1. Release Notes

The Sipwise C5 version mr7.5.11 has the following important changes:

  • Upgrade from Debian 9 (stretch) to Debian 10 (buster) [TT#60950]
  • Add LNP NCOS pattern filter (See Section 6.3.2.2, “Creating Rules per NCOS Level” in the handbook to have more details) [TT#60903]
  • Conversion of kamailio location records from datetime to timestamp format [TT#23358]
  • Add support for tel:uri in inbound From and PAI headers [TT#61251]
  • Rework and optimise the customer calls fraud control and notification logic [TT#51409]
  • [Carrier] New feature ngcpcfg push-parallel to apply changes on all nodes in parallel [TT#63758]
  • New ngcp-exporter component that exports active subscriber NCOS levels into .csv files [TT#62951]
  • Upgrade Kamailio from version 5.1.6 to 5.2.3 [TT#56950]
  • Upgrade MariaDB from version 10.1 to 10.3 [TT#60950]
  • Rework block_in_clir subscriber/customer’s preference (See Section 6.3.1.3, “Block Anonymous Numbers” in the handbook to have more details) [TT#47593]

Please find the complete changelog in our release notes on our WEB site.

13.2. Overview

The Sipwise C5 software upgrade procedure to mr7.5.11 will perform several fundamental tasks:

  • Upgrade the base system from Debian 9 (stretch) to Debian 10 (buster)
  • upgrade the NGCP software packages
  • upgrade the NGCP configuration templates
  • upgrade the NGCP DB schema
  • upgrade the NGCP configuration schema
  • upgrade the base system within Debian 10 (buster) to the latest package versions

The software upgrade is usually performed by Sipwise engineers according to the following steps:

  • create the software upgrade plan
  • execute pre-upgrade steps: patchtt, customtt, backups
  • make the sp2 node active
  • ensure that the sp1 node is standby
  • perform the software upgrade on the sp1 node
  • schedule and make services switchover to the sp1 node
  • ensure that the sp1 node performs well (otherwise, perform a switch back)
  • perform the software upgrade on the sp2 node
  • perform the system post-upgrade testing and cleanup
warning

The only allowed software upgrade path is the one described above. All the other theoretically possible upgrade scenarios can lead to unpredictable results.

13.3. Planning a software upgrade

Confirm the following information:

  • which system should be upgraded (LAB/LIVE, country, etc.)
  • the date and time schedule for each of the steps above (keeping the time zone in mind)
  • a confirmed timeframe for the upgrade operation (allowed switchover timeframe)
  • the basic functionality test (BFT) to be executed before the start of the software upgrade and after the switchovers to ensure that the new release does not show critical issues (the BFT scenario should be prepared by the customer engineers)
  • actions to be taken if the software upgrade operation cannot be completed within the defined maintenance window
  • contact persons and ways of communication in case of emergency
  • ensure that the customer and/or Sipwise engineers have access to the virtual consoles of the servers: KVM, iDRAC, AMM

13.4. Preparing the software upgrade

It is recommended to execute the preparatory steps in this chapter a few days before the actual software upgrade. They do not cause a service downtime, so it is safe to execute them during peak hours.

13.4.1. Log into the C5 standby node

tip

Use the static server IP address so you can switch between the nodes.

Run the terminal multiplexer under the sipwise user (to reuse the Sipwise .screenrc settings that are convenient for working in multiple windows):

screen -S my_screen_name_for_ngcp_upgrade

Become root inside your screen session:

sudo -s

13.4.2. Check the overall system status

Check the overall system status:

ngcp-status --all

Make sure that the cluster health status is OK: Check the nodes in parallel, using the clish command:

  • ngcp-clish "ngcp version summary" - ensure that all cluster nodes have correct/expected from version
  • ngcp-clish "ngcp version package installed ngcp-ngcp-pro" - ensur that the metapackages version is equal to the ngcp version above
  • ngcp-clish "ngcp version package check" - ensure that all nodes have the identical Debian package installed
info

Software must be identical on all nodes (before and after the upgrade!)

  • ngcp-clish "ngcp cluster ssh connectivity" - check SSH connectivity from the current node to the peer
  • ngcp-clish "ngcp cluster ssh crossconnectivity" - check SSH cross-connectivity
  • ngcp-clish "ngcp monit summary" - all required services must be running on corresponding nodes
  • ngcp-clish "ngcp cluster status" - active node(s) (with all services running) must print "all", the other(s) must print "none"
  • ngcp-clish "ngcp status collective-check" - all checks must be OK
  • ngcp-clish "ngcp show date" - date and time must be in sync on all the servers
  • ngcp-clish "ngcp show dns-servers" - ensure that the DNS configuration is consistent among the nodes
info

to exit from ngcp-clish press Ctrl+Z (or type exit):

# ngcp-clish
Entering 'clish-enable' view (press Ctrl+Z to exit)...
# exit
#

13.4.3. Check access to license server and license validity

Check from within the system (better from all nodes, for extra safety) that the license server is accessible from the network point of view, and that these commands do not end with timeouts or HTTP errors:

ping -c 3 -w 5 license.sipwise.com

curl --head https://license.sipwise.com/

Also ensure that:

  • /proc/ngcp/check contains the string "ok" (if not, check logs)
  • and that there are no errors or important warnings in /ngcp-data/logs/licensed.log (/var/log/ngcp/licensed.log in systems before mr6.5).

13.4.4. Evaluate and update custom modifications

For the below steps, investigate and make sure you understand why the custom modifications were introduced and if they are still required after the software upgrade. If the custom modifications are not required anymore, remove them (e.g. if a bug was fixed in the target release and the existing patch becomes irrelevant).

Create tickets to Sipwise developers to make relevant custom modifications part of the product in future releases. This allows you to get rid of the customtt files one day.

warning

If you directly change the working configuration (e.g. add custom templates or change the existing ones) for some reason, then the system must be thoroughly tested after these changes have been applied. Continue with the software upgrade preparation only if the results of the tests are acceptable.

Find the local changes to the template files:

ngcp-customtt-diff-helper

The script will also ask you if you would like to download the templates for your target release. To download the new templates separately, execute:

ngcp-customtt-diff-helper -d

In the tmp folder provided by the script, you can review the patchtt files or merge the current customtt with the new tt2 templates, creating the new customtt.tt2 files. Once you do this, archive the new patchtt/customtt files to reapply your custom modifications after the software upgrade:

ngcp-customtt-diff-helper -t

Find all available script options with the "-h" parameter.

warning

Starting from version mr7.0.1 a new kamailio module called "pv_headers" has been introduced. This new module enables storing all headers in XAVP to freely modify them in the kamailio logic and only apply them once when it’s time for the packet to be routed outside. The main goal of the module is to offload the intermediate header processing into the XAVP dynamic container as well as provide with high-level methods and pseudovariables to simplify SIP message header modifications. The module is enabled by default in kamailio proxy and all the templates have been updated to use this new logic. Before proceeding with the upgrade it is essential that the customtt/patchtt you have in place are updated to this new format. At appendix you can find additional information on the module.

13.4.5. Check system integrity

Check if there are any *.tt2.dpkg-dist files among the templates. They usually appear when tt2 files are modified directly instead of creating customtt/patchtt files. If you find any *.tt2.dpkg-dist files, treat the corresponding tt2 files as if they were customtt.tt2 and introduce the changes from the existing tt2 files into the new templates (create associated customtt.tt2 or patchtt.tt2) before the software upgrade.

find /etc/ngcp-config -name \*.tt2.dpkg-dist

Note that in the end all *.tt2.dpkg-dist files must be removed before the software upgrade as they prevent the upgrade script from updating the tt2 files.

Check and remove dpkg files left from previous software upgrades.

Make sure that the list is empty before you continue:

find /etc/ngcp-config -name \*.tt2.dpkg\*

Log into all the servers.

Open separate windows for all the servers inside your "screen" session. (Press Ctrl+a + c to open a new window, Ctrl+a + a or Ctrl+a + [0-9] to change the window. Ctrl+a + " shows the list of all your windows. Use Ctrl+a + A to change the window names to corresponding hosts).

Changes made directly in tt2 templates will be lost after the software upgrade. Only custom changes made in customtt.tt2 or added by patchtt.tt2 files will be kept. Hence, check the system for locally modified tt2 files on all nodes:

ngcp-status --integrity

13.4.6. Check the configuration framework status

Check the configuration framework status on all nodes. All checks must show the "OK" result and there must be no actions required:

ngcpcfg status

Check the replication on both nodes. The result must always show:

Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Seconds_Behind_Master: 0

Test the cluster failover to see if everything works fine on the second node as well. On the standby node execute:

ngcp-make-active

Create two test subscribers or use the credentials for existing ones. Register subscribers with the platform and perform a test call to ensure that call routing and media flow are working fine.

Run "apt-get update" on all nodes and ensure that you do not have any warnings and errors in the output.

warning

If the installation uses locally specified mirrors, then the mirrors must be switched to the Sipwise APT repositories (at least for the software upgrade). Otherwise, the public Debian mirrors may not provide packages for old Releases anymore or at least provide outdated ones!

13.4.7. Check migration of location entries from Mysql to Redis DB

warning

Upgrade to mr7.5 is allowed with kamailio.location in Redis DB only! It is necessary for the proper migration of location records from datetime to bigint/epoch.

Starting from mr6.2.1, location, acc and dialogs data are stored in RedisDB allowing better system performances. Before proceed with the upgrade, check if location data are already migrated to RedisDB:

ngcpcfg values "kamailio.proxy.redis.usrloc"

If the answer is yes, then skip this sub-chapter and proceed with the next one. On the contrary, an answer equals to no means that the migration process has not been completed. This happens because, to be more flexible and to reduce the downtime of the system, only acc and dialogs data have been moved automatically to RedisDB. Migration of location data is a step that should be done manually and it was probably skipped during previous upgrades.

To proceed with the migration and complete the process, execute the following commands during out of business hours.

  • On the standby management node (web01a/db01a on Carrier) pull outstanding ngcpcfg changes (if any):
ngcpcfg pull
  • Enable location data storage on RedisDB:
ngcpcfg set /etc/ngcp-config/config.yml "kamailio.proxy.redis.usrloc=yes"
  • Apply the changes to configuration templates:
ngcpcfg apply 'Enable location data storage on RedisDB'
important

Execute the following 3 steps one after another with as short as possible delay between them.

  • Migrate all location data from MySQL to Redis DB using an adhoc script:
ngcp-location-migrate
  • Update the internal counters for accurate statistics about location entries: (This step can be executed any time location entries have been manually modified)
ngcp-location-sync
  • Make the node active (proxy, ngcp-panel and mediator services will start with the new configuration):
ngcp-make-active
  • Push changes:
ngcpcfg push
  • Clean old location data stored in MySQL using an adhoc script:
ngcp-location-migrate -c

13.4.8. Check access to deb.sipwise.com

Ensure that both management nodes have access to deb.sipwise.com by executing the following commands on a management node:

ngcp-approx-cache-helper --check --node sp1

ngcp-approx-cache-helper --check --node sp2

If --check is not recognised, as it likely happens when upgrading from mr6.5 and early mr7.x versions, use the short form instead:

ngcp-approx-cache-helper -c --node sp1

ngcp-approx-cache-helper -c --node sp2

The checks must show only 200 OK results. If you see cannot connect!, Received 404 or any other error, check these possible causes:

  • A node does not have a connection to deb.sipwise.com
  • The deb.sipwise.com whitelist does not have the node’s public IP (IPv6) address.

13.5. Upgrading Sipwise C5

info

The document describes upgrade from all mr7.4.* and mr6.5.* LTS releases.

Make sure you are prepared to spend about two hours upgrading the system. Note that a short service downtime is possible during the services switchover to the upgraded node.

Start with the software upgrade on the standby sp1 node. Then, switch the services over to the upgraded node and upgrade the other (now standby) sp2 node, as described in the steps below.

13.5.1. License check

The Sipwise C5 — starting from mr6.5.1 release — enforce software licensing restrictions in form of a regular comparison of the licensed services and capacities against the actual usage patterns of the platform. In case some functionalities are enabled but not licensed, an error in syslog will be reported and the impacted services will be automatically deactivated.

Before proceeding with the upgrade, please take some time to check that all the modules not licensed are actually disabled in config.yml file. To verify if they are enabled execute the following commands:

ngcpcfg values sems.prepaid.enable
ngcpcfg values sems.prepaid.inew.enable
ngcpcfg values pbx.enable
ngcpcfg values pushd.enable
ngcpcfg values intercept.enable
ngcpcfg values voisniff.admin_panel
ngcpcfg values voisniff.daemon.li_x1x2x3.enable
ngcpcfg values voisniff.daemon.start

If the output of one of the commands is yes but the module is not licensed, you have to deactivate it. For example, in case of pre-paid billing module execute:

ngcpcfg set /etc/ngcp-config/config.yml sems.prepaid.enable=no
ngcpcfg apply 'Disable prepaid module'
ngcpcfg push
warning

Please, pay particular attention to pre-paid billing module because it is enabled by default.

13.5.2. Preparing for maintenance mode

Sipwise C5 introduces Maintenance Mode with its mr5.4.1 release. The maintenance mode of Sipwise C5 will disable some background services (for instance: ngcp-mediator) during the software upgrade. It thus prevents the system from getting into an inconsistent state while the upgrade is being performed. You can activate maintenance mode by applying a simple configuration change as described later.

  • Pull pending configuration (if any):
ngcpcfg pull
  • Enable maintenance mode:
ngcpcfg set /etc/ngcp-config/config.yml "general.maintenance=yes"
  • Apply configuration changes by executing:
ngcpcfg apply 'Enabling maintenance mode before the upgrade to mr7.5.11'
ngcpcfg push all

13.5.3. Switch to the new repositories

To specify the new list of APT data sources, execute the following commands on both nodes:

NGCP_CURRENT_VERSION=$(cat /etc/ngcp_version)
sed -i "s/${NGCP_CURRENT_VERSION}/mr7.5.11/" /etc/apt/sources.list.d/sipwise.list
sed -i "s/stretch/buster/g" /etc/apt/sources.list.d/sipwise.list /etc/apt/sources.list.d/debian.list
warning

Do not use "ngcpcfg apply/build" after executing the above commands, as otherwise the changes will be overwritten and you will have to redo this step.

13.5.4. Download the new packages into the approx cache (on standby node only)

warning

Customers with far-sighted software upgrade policies usually have pre-production installations to test the services in their environment before upgrading the production platform. In this case, the approx cache should be updated on both platforms simultaneously to synchronize the package versions between them, hence consider carefully before executing this step.

To download the latest package metadata into the approx cache, execute the following command on the standby node. This action ensures that both nodes have identical packages after the software upgrade:

ngcp-approx-cache-helper --auto --node localhost

13.5.5. Install the package used to upgrade C5

Run the following commands on both nodes to install the package responsible for upgrading C5 to a newer release:

apt-get update
apt-get install ngcp-upgrade-pro

13.5.6. ngcp-upgrade options

The following options in ngcp-upgrade can be specially useful in some instances of upgrade:

  • --step-by-step: confirm before proceeding to next step. With this option the upgrade operation is performed confirming every step before execution, with the possibility to instruct to continue without confirming further steps until the end (if confirmation is only needed for some steps at the beginning).
  • --pause-before-step STEP_NAME: pause execution before step, given by the name of the script (e.g. "backup_mysql_db"). This option can be useful in several scenarios, for example:

    • to help to debug problems or work around known problems during upgrades. In this case the operator can pause at a given step known to be problematic or just before a problematic set, perform some manual checks or changes, then continue the upgrade until another step (with confirmation like with the recent option --step-by-step), or just continue without stop until the end
    • another use might be to help to speed up upgrades when it involves several nodes: they can all proceed in parallel when it’s known to be safe to do so; then perform some parts in lock-step (some nodes waiting until others finish with some stage); then continue in parallel until the end
  • --skip-db-backup: This will speed-up the process in cases where it’s deemed unnecessary, and this is very likely in the upgrade of nodes other than the first.

13.5.7. Upgrade the first PRO node

Execute the upgrade script on the standby node as root:

ngcp-upgrade
info

Sipwise C5 can be upgraded to mr7.5.11 from previous release or previous build only. The script ngcp-upgrade will find all the possible destination releases for the upgrade and makes it possible to choose the proper one.

info

If there is an error during the upgrade, the ngcp-upgrade script will request you to solve it. Once you’ve fixed the problem, just execute ngcp-upgrade again and it will continue from the previous step.

The upgrade script will ask you to confirm that you want to start. Read the given information carefully, and if you agree, proceed with y.

The upgrade process will take several minutes, depending on your network connection and server performance. After everything has been updated successfully, it will finally ask you to reboot your system. Confirm to let the system reboot (it will boot with an updated kernel).

13.5.7.1. Useful options in ngcp-upgrade

The following options in ngcp-upgrade can be useful for this phase of upgrades:

  • --step-by-step: confirm before proceeding to next step.
  • --pause-before-step STEP_NAME: pause execution before step, given by the name of the script (e.g. "backup_mysql_db").

See a more detailed description of the options in: ngcp-upgrade options

13.5.8. The custom modification handling (optional)

Introduce the custom changes to configuration templates if needed (by adding corresponding patchtt/customtt files). Apply the changes to configuration templates and send them to the shared storage and the other node:

ngcpcfg apply 'Added custom changes when the first node was upgraded'
ngcpcfg push --nobuild --noapply

13.5.9. Promote the upgraded standby node to active

Execute on the current standby node as root:

ngcp-make-active

13.5.10. Upgrade the second PRO node

Go to the new standby node. Run the upgrade script as root:

ngcp-upgrade

The upgrade script will ask you to confirm that you want to start. Read the given information carefully, and if you agree, proceed with y.

The upgrade process will take several minutes, depending on your network connection and server performance. After everything has been updated successfully, it will finally ask you to reboot your system. Confirm to let the system reboot (it will boot with an updated kernel).

13.5.10.1. Useful options in ngcp-upgrade

The following options in ngcp-upgrade can be useful for this phase of upgrades, because it is very likely that the backup was already performed in the upgrade of the first node:

  • --skip-db-backup: This will speed-up the process in cases where it’s deemed unnecessary.

See a more detailed description of the options in: ngcp-upgrade options

13.6. Post-upgrade tasks

13.6.1. Disabling maintenance mode

In order to disable the maintenance mode, do the following:

  • Pull outstanding ngcpcfg changes (if any):
ngcpcfg pull
  • Disable the maintenance mode:
ngcpcfg set /etc/ngcp-config/config.yml "general.maintenance=no"
  • Apply the changes to configuration templates:
ngcpcfg apply 'Disable the maintenance mode after the upgrade to mr7.5.11'
ngcpcfg push all

13.6.2. Post-upgrade checks

When everything has finished successfully, check that replication is running. Check ngcp-status --all. Finally, do a basic functionality test. Check the web interface, register two test subscribers and perform a test call between them to ensure call routing works.

info

You can find a backup of some important configuration files of your existing installation under /ngcp-data/backup/ngcp-mr7.5.11-* (where * is a place holder for a timestamp) in case you need to roll back something at any time. A log file of the upgrade procedure is available at /ngcp-data/backup/ngcp-mr7.5.11-*/upgrade.log.

13.7. Applying the Latest Hotfixes

If your current release is already the latest or you prefer to be on the LTS release, we still suggest appling the latest hotfixes and critical bug fixes.

Execute all steps as described in Section 13.4, “Preparing the software upgrade”. They include the system checks, customtt/patchtt preparation and others. It is important to execute all the steps from the above chapter.

13.7.1. Update the approx cache on the standby node

The main goal of the following command is to download the new packages into the approx cache. So all the nodes in the cluster will get identical packages.

ngcp-approx-cache-helper --auto --node localhost

13.7.2. Apply hotfixes on the standby node

ngcp-update

13.7.3. Recheck or update the custom configuration templates

Merge/add the custom configuration templates if needed.

Apply the changes to configuration templates:

ngcpcfg apply 'apply customtt/patchtt after installing the latest packages'

Send the new templates to the shared storage and the other node.

ngcpcfg push --nobuild --noapply all

13.7.4. Promote the standby node to active

Execute on the standby node as root:

ngcp-make-active

Check in a minute that the node became active:

ngcp-check-active

13.7.5. Apply hotfixes on the second node

ngcp-update

Execute the final checks as described in the Post-upgrade checks section.