[PTP dual NIC config] Fix parameters from legacy
In the automatic migration of single-instance PTP configuration for multi-instance support, the value of 'uds_address' parameter missed the "ptp4l-" prefix like used in the apply of hieradata in case the user has not provided it. Also, the 'update-rate' and 'summary-updates' have to be no longer migrated, since they are now set with fixed values in the phc2sys command-line options. Finally, it fixes the creation of associated PTP interfaces for the legacy instances, where it should be done for every interface in the old configuration that was set to either 'slave' or 'master' (not 'none'). Test Plan: PASS: Patching then checked phc2sys-legacy configuration file. Task: 44567 Story: 2009248 Signed-off-by: Douglas Henrique Koerich <douglashenrique.koerich@windriver.com> Change-Id: I388adc3447c520cd02abce05aa7df346a663c46c
This commit is contained in:
parent
a889ee27f5
commit
b3c3b5d066
|
@ -27,7 +27,7 @@ from psycopg2.extras import DictCursor
|
|||
|
||||
LOG = log.get_logger(__name__)
|
||||
|
||||
INTERFACE_PTP_ROLE_SLAVE = 'slave'
|
||||
INTERFACE_PTP_ROLE_NONE = 'none'
|
||||
|
||||
# PTP instance types
|
||||
PTP_INSTANCE_TYPE_PTP4L = 'ptp4l'
|
||||
|
@ -61,6 +61,10 @@ PTP_PARAMETER_DEFAULT_DOMAIN = '0'
|
|||
PTP_PARAMETER_BC_JBOD = 'boundary_clock_jbod'
|
||||
PTP_BOUNDARY_CLOCK_JBOD_1 = '1'
|
||||
|
||||
# PTP service parameters NOT migrated from legacy configuration
|
||||
PTP_PARAMETER_UPDATE_RATE = 'update-rate'
|
||||
PTP_PARAMETER_SUMMARY_UPDATES = 'summary-updates'
|
||||
|
||||
|
||||
def main():
|
||||
action = None
|
||||
|
@ -230,10 +234,10 @@ def _move_ptp_parameters(connection):
|
|||
|
||||
with connection.cursor(cursor_factory=DictCursor) as cur:
|
||||
# List all the interfaces with ptp_role=slave
|
||||
cur.execute("SELECT id FROM interfaces WHERE ptp_role = %s;",
|
||||
(INTERFACE_PTP_ROLE_SLAVE,))
|
||||
cur.execute("SELECT id FROM interfaces WHERE ptp_role <> %s;",
|
||||
(INTERFACE_PTP_ROLE_NONE,))
|
||||
slave_ifaces = cur.fetchall()
|
||||
LOG.debug("There are %d interfaces with ptp_role=slave" %
|
||||
LOG.debug("There are %d interfaces with ptp_role != none" %
|
||||
len(slave_ifaces))
|
||||
|
||||
LOG.info("Creating PTP instances for legacy parameters")
|
||||
|
@ -282,7 +286,7 @@ def _move_ptp_parameters(connection):
|
|||
|
||||
# Add 'uds_address' parameter to phy2sys instance for linkage
|
||||
# with ptp4l instance
|
||||
uds_address_path = '/var/run/%s' % PTP_INSTANCE_LEGACY_PTP4L
|
||||
uds_address_path = '/var/run/ptp4l-%s' % PTP_INSTANCE_LEGACY_PTP4L
|
||||
uds_address_uuid = _insert_ptp_parameter(connection,
|
||||
PTP_PARAMETER_UDS_ADDRESS,
|
||||
uds_address_path)
|
||||
|
@ -302,6 +306,11 @@ def _move_ptp_parameters(connection):
|
|||
domain_number = PTP_PARAMETER_DEFAULT_DOMAIN
|
||||
for param in param_entries:
|
||||
|
||||
if (param['name'] == PTP_PARAMETER_UPDATE_RATE or
|
||||
param['name'] == PTP_PARAMETER_SUMMARY_UPDATES):
|
||||
LOG.info("Found %s parameter, ignored" % param['name'])
|
||||
continue
|
||||
|
||||
if param['name'] == PTP_PARAMETER_DOMAIN_NUMBER:
|
||||
domain_number = param['value'] # overwrite default
|
||||
continue # skip it for below
|
||||
|
|
|
@ -1888,6 +1888,10 @@ PTP_PARAMETER_DOMAIN_NUMBER = 'domainNumber'
|
|||
PTP_PARAMETER_DEFAULT_DOMAIN = '0'
|
||||
PTP_PARAMETER_BC_JBOD = 'boundary_clock_jbod'
|
||||
|
||||
# PTP service parameters NOT migrated from legacy configuration
|
||||
PTP_PARAMETER_UPDATE_RATE = 'update-rate'
|
||||
PTP_PARAMETER_SUMMARY_UPDATES = 'summary-updates'
|
||||
|
||||
# Patching PTP entities
|
||||
PTP_INSTANCE_ARRAY_PATH = '/ptp_instances/-'
|
||||
PTP_INTERFACE_ARRAY_PATH = '/ptp_interfaces/-'
|
||||
|
|
|
@ -7235,8 +7235,8 @@ class ConductorManager(service.PeriodicService):
|
|||
slave_ifaces_list = [
|
||||
iface
|
||||
for iface in ifaces_list
|
||||
if iface['ptp_role'] == constants.INTERFACE_PTP_ROLE_SLAVE]
|
||||
LOG.debug("There are %d interfaces with ptp_role=slave" %
|
||||
if iface['ptp_role'] != constants.INTERFACE_PTP_ROLE_NONE]
|
||||
LOG.debug("There are %d interfaces with ptp_role != none" %
|
||||
len(slave_ifaces_list))
|
||||
|
||||
LOG.info("Creating PTP instances for legacy parameters")
|
||||
|
@ -7269,7 +7269,7 @@ class ConductorManager(service.PeriodicService):
|
|||
# Add 'uds_address' parameter to phy2sys instance for linkage with
|
||||
# ptp4l instance
|
||||
uds_address_path = \
|
||||
'/var/run/%s' % constants.PTP_INSTANCE_LEGACY_PTP4L
|
||||
'/var/run/ptp4l-%s' % constants.PTP_INSTANCE_LEGACY_PTP4L
|
||||
self._update_ptp_add_parameter_to_instance(
|
||||
phc2sys_uuid,
|
||||
constants.PTP_PARAMETER_UDS_ADDRESS,
|
||||
|
@ -7293,6 +7293,12 @@ class ConductorManager(service.PeriodicService):
|
|||
domain_number = constants.PTP_PARAMETER_DEFAULT_DOMAIN
|
||||
for param in ptp_svc_parameters_list:
|
||||
|
||||
if param['name'] == constants.PTP_PARAMETER_UPDATE_RATE or \
|
||||
(param['name'] ==
|
||||
constants.PTP_PARAMETER_SUMMARY_UPDATES):
|
||||
LOG.info("Found %s parameter, ignored" % param['name'])
|
||||
continue
|
||||
|
||||
if param['name'] == constants.PTP_PARAMETER_DOMAIN_NUMBER:
|
||||
domain_number = param['value'] # overwrite default
|
||||
continue # skip it for below
|
||||
|
|
Loading…
Reference in New Issue