Add missing attribute in Metric in RSD 2.2

Change-Id: Iac848cdb87a7b6e90d7d9e7daa8f21f5839ef7a7
This commit is contained in:
Lin Yang
2019-05-24 16:20:53 -07:00
parent 0f1832b67d
commit 5f1954f328

View File

@@ -15,88 +15,77 @@
from sushy.resources import base
from rsd_lib import common as rsd_lib_common
from rsd_lib import base as rsd_lib_base
from rsd_lib import utils as rsd_lib_utils
class DiscreteTriggerConditionField(base.ListField):
class DiscreteTriggerConditionCollectionField(base.ListField):
name = base.Field("Name")
"""This property shall contain a name for the trigger"""
"""The name of trigger."""
trigger_value = base.Field("TriggerValue")
"""This property contains the value that sets a trigger"""
"""This property contains the value that sets a trigger."""
previous_value = base.Field("PreviousValue")
"""If present, this property shall contain a previous value that shall be
used in evaluating the behavior of setting the trigger.
"""
"""This property contains the previous value of the trigger."""
class NumericTriggerConditionField(base.ListField):
class NumericTriggerConditionCollectionField(base.ListField):
name = base.Field("Name")
"""This property shall contain a name for the trigger"""
"""The name of trigger."""
value = base.Field("Value", adapter=rsd_lib_utils.num_or_none)
"""This property shall contain the value of the trigger"""
"""This property contains the value of the trigger."""
direction_of_crossing = base.Field("DirectionOfCrossing")
"""If present, this property shall contain the direction of crossing. If
not present, the direction is not relevant
"""This property contains the direction that the previous value came from.
"""
class TriggerConditionField(base.CompositeField):
dwell_interval = base.Field("DwellInterval")
"""The value shall be an ISO 8601 conformant interval during which the
triggering state shall persist before the trigger is invoked.
"""TriggerCondition field
A trigger condition.
"""
dwell_interval = base.Field("DwellInterval")
"""The time in the triggering state before the trigger is invoked."""
trigger_type = base.Field("TriggerType")
"""The value of this property shall specific the type of trigger"""
"""The type of trigger."""
discrete_trigger_conditions = DiscreteTriggerConditionField(
"DiscreteTriggerConditions")
"""A Trigger condition based on TriggerDiscreteCondition"""
discrete_trigger_conditions = DiscreteTriggerConditionCollectionField(
"DiscreteTriggerConditions"
)
"""A Trigger condition based on TriggerDiscreteCondition."""
filter_trigger_condition = base.Field("FilterTriggerCondition")
"""A Trigger condition based on FilterTriggerCondition"""
"""A filter on the elements specified by OriginResources."""
numeric_trigger_conditions = NumericTriggerConditionField(
"NumericTriggerConditions")
"""A Trigger condition based on NumericTriggerConditions"""
numeric_trigger_conditions = NumericTriggerConditionCollectionField(
"NumericTriggerConditions"
)
"""A Trigger condition based on TriggerNumericCondition."""
class Metric(base.ResourceBase):
identity = base.Field("Id")
"""The metric identity"""
class Metric(rsd_lib_base.ResourceBase):
"""Metric resource class
name = base.Field('Name')
"""The metric name"""
description = base.Field('Description')
"""The metric description"""
Defines the use of a set of properties as metrics.
"""
metric_properties = base.Field("MetricProperties")
"""The report definition metric properties"""
collection_function = base.Field('CollectionFunction')
"""If present, the value shall define the function to apply over the
collection duration
"""A collection of URI for the properties on which this metric is
collected.
"""
collection_duration = base.Field('CollectionDuration')
"""This property shall not be present if MetricDefinition.Timescope=Point
or if MetricDefintion.Duration is present. If present, the value shall
be an ISO 8601 duration of the interval over which this metric value
shall be computed.
"""
collection_function = base.Field("CollectionFunction")
"""Function to perform over each sample."""
collection_duration = base.Field("CollectionDuration")
"""The value is the collection duration for each metric value."""
trigger_condition = TriggerConditionField("TriggerCondition")
"""If present the values define conditions that shall be met before the
event is triggered. This trigger applies to all properties defined by
the value of the MetricPropertyDeclaration property in the associated
MetricDefinition and as constrained by the MetricScope property.
"""
status = rsd_lib_common.StatusField('Status')
"""The report definition status"""
"""A Triggering condition for the event."""