Allow configuration of PTP master/slave interfaces

With this change a new field ptp_role will be added to the interfaces
table. This will allow administrators to configure which interfaces will
be used for PTP serivces. Only platform or SRIOV interfaces may be
specified for PTP use. If a host has clock_synchronization=ptp there
must be at least one host interface with a ptp_role value specified.

Change-Id: I86eddebf2f716f76d4eb9a5b5698a61ff3aec566
Story: 2006759
Task: 37690
Signed-off-by: David Sullivan <david.sullivan@windriver.com>
This commit is contained in:
David Sullivan
2019-12-01 23:56:20 -05:00
parent 638487f67b
commit 8ad91e1cbf
17 changed files with 562 additions and 8 deletions

View File

@@ -17,7 +17,7 @@ CREATION_ATTRIBUTES = ['ifname', 'iftype', 'ihost_uuid', 'imtu', 'ifclass',
'providernetworks', 'datanetworks', 'ifcapabilities', 'ports', 'imac',
'vlan_id', 'uses', 'used_by',
'ipv4_mode', 'ipv6_mode', 'ipv4_pool', 'ipv6_pool',
'sriov_numvfs', 'sriov_vf_driver']
'sriov_numvfs', 'sriov_vf_driver', 'ptp_role']
class iinterface(base.Resource):

View File

@@ -16,7 +16,7 @@ from cgtsclient.v1 import iinterface as iinterface_utils
def _print_iinterface_show(cc, iinterface):
fields = ['ifname', 'iftype', 'ports',
'imac', 'imtu', 'ifclass',
'imac', 'imtu', 'ifclass', 'ptp_role',
'aemode', 'schedpolicy', 'txhashpolicy',
'uuid', 'ihost_uuid',
'vlan_id', 'uses', 'used_by',
@@ -164,11 +164,16 @@ def do_host_if_delete(cc, args):
metavar='<sriov vf driver>',
choices=['netdevice', 'vfio'],
help='The SR-IOV VF driver for this device')
@utils.arg('--ptp-role',
dest='ptp_role',
metavar='<ptp role>',
choices=['master', 'slave', 'none'],
help='The PTP role for this interface')
def do_host_if_add(cc, args):
"""Add an interface."""
field_list = ['ifname', 'iftype', 'imtu', 'ifclass', 'aemode',
'txhashpolicy', 'vlan_id',
'txhashpolicy', 'vlan_id', 'ptp_role',
'ipv4_mode', 'ipv6_mode', 'ipv4_pool', 'ipv6_pool',
'sriov_numvfs', 'sriov_vf_driver']
@@ -254,11 +259,16 @@ def do_host_if_add(cc, args):
metavar='<sriov vf driver>',
choices=['netdevice', 'vfio'],
help='The SR-IOV VF driver for this device')
@utils.arg('--ptp-role',
dest='ptp_role',
metavar='<ptp role>',
choices=['master', 'slave', 'none'],
help='The PTP role for this interface')
def do_host_if_modify(cc, args):
"""Modify interface attributes."""
rwfields = ['iftype', 'ifname', 'imtu', 'aemode', 'txhashpolicy',
'ports', 'ifclass',
'ports', 'ifclass', 'ptp_role',
'ipv4_mode', 'ipv6_mode', 'ipv4_pool', 'ipv6_pool',
'sriov_numvfs', 'sriov_vf_driver']