Add missing attribute in EthernetSwitch in RSD 2.2

Change-Id: Ia2f3c908bcf83c1d6b12230764fdd79d253ec541
This commit is contained in:
Lin Yang 2019-05-24 14:15:19 -07:00
parent f96b095e35
commit 7047651bed

View File

@ -13,16 +13,15 @@
# License for the specific language governing permissions and limitations
# under the License.
from rsd_lib.resources.v2_1.ethernet_switch import ethernet_switch \
as v2_1_ethernet_switch
from rsd_lib.resources.v2_2.ethernet_switch import ethernet_switch_metrics
from rsd_lib.resources.v2_2.ethernet_switch import ethernet_switch_port
from sushy.resources import base
from sushy import utils
from rsd_lib.resources.v2_1.ethernet_switch import ethernet_switch
from rsd_lib.resources.v2_2.ethernet_switch import ethernet_switch_metrics
from rsd_lib.resources.v2_2.ethernet_switch import ethernet_switch_port
class EthernetSwitch(v2_1_ethernet_switch.EthernetSwitch):
class EthernetSwitch(ethernet_switch.EthernetSwitch):
@property
@utils.cache_it
def ports(self):
@ -37,21 +36,17 @@ class EthernetSwitch(v2_1_ethernet_switch.EthernetSwitch):
redfish_version=self.redfish_version,
)
def _get_metrics_path(self):
"""Helper function to find the Metrics path"""
return utils.get_sub_resource_path_by(self, "Metrics")
@property
@utils.cache_it
def metrics(self):
"""Property to provide reference to `EthernetSwitchMetrics` instance
It is calculated once when it is queried for the first time. On
refresh, this property is reset.
It is calculated once when it is queried for the first time. On
refresh, this property is reset.
"""
return ethernet_switch_metrics.EthernetSwitchMetrics(
self._conn,
self._get_metrics_path(),
utils.get_sub_resource_path_by(self, "Metrics"),
redfish_version=self.redfish_version,
)