Add manager resource for RSD2.2 and 2.3
Change-Id: Ib7dd870d7536cce12059fb7abffbea3e51bbb0cc
This commit is contained in:
parent
83a8bd3223
commit
8b0350759c
0
rsd_lib/resources/v2_2/manager/__init__.py
Normal file
0
rsd_lib/resources/v2_2/manager/__init__.py
Normal file
53
rsd_lib/resources/v2_2/manager/manager.py
Normal file
53
rsd_lib/resources/v2_2/manager/manager.py
Normal file
@ -0,0 +1,53 @@
|
||||
# Copyright 2019 Intel, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from rsd_lib.resources.v2_1.manager import manager as v2_1_manager
|
||||
from sushy.resources import base
|
||||
|
||||
|
||||
class ManagerResetFiled(base.CompositeField):
|
||||
target = base.Field("target")
|
||||
"""The manager reset target"""
|
||||
|
||||
|
||||
class ActionsField(base.CompositeField):
|
||||
manager_reset = ManagerResetFiled("#Manager.Reset")
|
||||
"""The acyions manager reset """
|
||||
|
||||
|
||||
class Manager(v2_1_manager.Manager):
|
||||
actions = ActionsField("Actions")
|
||||
"""The manager actions"""
|
||||
|
||||
|
||||
class ManagerCollection(base.ResourceCollectionBase):
|
||||
description = base.Field("Description")
|
||||
"""The manager collection description"""
|
||||
|
||||
@property
|
||||
def _resource_type(self):
|
||||
return Manager
|
||||
|
||||
def __init__(self, connector, path, redfish_version=None):
|
||||
"""A class representing a Manager Collection
|
||||
|
||||
:param connector: A Connector instance
|
||||
:param path: The canonical path to the chassis collection resource
|
||||
:param redfish_version: The version of RedFish. Used to construct
|
||||
the object according to schema of the given version.
|
||||
"""
|
||||
super(ManagerCollection, self).__init__(connector,
|
||||
path,
|
||||
redfish_version)
|
0
rsd_lib/resources/v2_3/manager/__init__.py
Normal file
0
rsd_lib/resources/v2_3/manager/__init__.py
Normal file
92
rsd_lib/tests/unit/json_samples/v2_2/manager.json
Normal file
92
rsd_lib/tests/unit/json_samples/v2_2/manager.json
Normal file
@ -0,0 +1,92 @@
|
||||
{
|
||||
"@odata.context":"/redfish/v1/$metadata#Manager.Manager",
|
||||
"@odata.id":"/redfish/v1/Managers/PSME",
|
||||
"@odata.type":"#Manager.v1_2_0.Manager",
|
||||
"Id":"1",
|
||||
"Name":"Manager",
|
||||
"ManagerType":"BMC",
|
||||
"Description":"BMC",
|
||||
"ServiceEntryPointUUID":"92384634-2938-2342-8820-489239905423",
|
||||
"UUID":"00000000-0000-0000-0000-000000000000",
|
||||
"Model":"Joo Janta 200",
|
||||
"DateTime":"2015-03-13T04:14:33+06:00",
|
||||
"DateTimeLocalOffset":"+06:00",
|
||||
"Status":{
|
||||
"State":"Enabled",
|
||||
"Health":"OK",
|
||||
"HealthRollup":null
|
||||
},
|
||||
"GraphicalConsole":{
|
||||
"ServiceEnabled":true,
|
||||
"MaxConcurrentSessions":2,
|
||||
"ConnectTypesSupported":[
|
||||
"KVMIP"
|
||||
]
|
||||
},
|
||||
"SerialConsole":{
|
||||
"ServiceEnabled":true,
|
||||
"MaxConcurrentSessions":1,
|
||||
"ConnectTypesSupported":[
|
||||
"Telnet",
|
||||
"SSH",
|
||||
"IPMI"
|
||||
]
|
||||
},
|
||||
"CommandShell":{
|
||||
"ServiceEnabled":true,
|
||||
"MaxConcurrentSessions":4,
|
||||
"ConnectTypesSupported":[
|
||||
"Telnet",
|
||||
"SSH"
|
||||
]
|
||||
},
|
||||
"FirmwareVersion":"1.00",
|
||||
"NetworkProtocol":{
|
||||
"@odata.id":"/redfish/v1/Managers/PSME/NetworkProtocol"
|
||||
},
|
||||
"EthernetInterfaces":{
|
||||
"@odata.id":"/redfish/v1/Managers/PSME/EthernetInterfaces"
|
||||
},
|
||||
"Links":{
|
||||
"@odata.type":"#Manager.v1_1_0.Links",
|
||||
"ManagerForServers":[
|
||||
|
||||
],
|
||||
"ManagerForChassis":[
|
||||
{
|
||||
"@odata.id":"/redfish/v1/Chassis/FabricModule1"
|
||||
}
|
||||
],
|
||||
"ManagerInChassis":{
|
||||
"@odata.id":"/redfish/v1/Chassis/Drawer1"
|
||||
},
|
||||
"Oem":{
|
||||
"Intel_RackScale":{
|
||||
"@odata.type":"#Intel.Oem.ManagerLinks",
|
||||
"ManagerForServices":[
|
||||
{
|
||||
"@odata.id":"/redfish/v1/Services/RSS1"
|
||||
}
|
||||
],
|
||||
"ManagerForSwitches":[
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Oem":{
|
||||
|
||||
},
|
||||
"PowerState":"On",
|
||||
"Actions":{
|
||||
"#Manager.Reset":{
|
||||
"target":"/redfish/v1/Managers/PSME/Actions/Manager.Reset",
|
||||
"ResetType@Redfish.AllowableValues":[
|
||||
|
||||
]
|
||||
},
|
||||
"Oem":{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
19
rsd_lib/tests/unit/json_samples/v2_2/manager_collection.json
Normal file
19
rsd_lib/tests/unit/json_samples/v2_2/manager_collection.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"@odata.context":"/redfish/v1/$metadata#ManagerCollection.ManagerCollection",
|
||||
"@odata.id":"/redfish/v1/Managers",
|
||||
"@odata.type":"#ManagerCollection.ManagerCollection",
|
||||
"Name":"Manager Collection",
|
||||
"Description":"description-as-string",
|
||||
"Members@odata.count":3,
|
||||
"Members":[
|
||||
{
|
||||
"@odata.id":"/redfish/v1/Managers/BMC1"
|
||||
},
|
||||
{
|
||||
"@odata.id":"/redfish/v1/Managers/BMC2"
|
||||
},
|
||||
{
|
||||
"@odata.id":"/redfish/v1/Managers/PSME"
|
||||
}
|
||||
]
|
||||
}
|
65
rsd_lib/tests/unit/resources/v2_2/manager/test_manager.py
Normal file
65
rsd_lib/tests/unit/resources/v2_2/manager/test_manager.py
Normal file
@ -0,0 +1,65 @@
|
||||
# Copyright 2019 Intel, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
|
||||
import mock
|
||||
|
||||
from sushy.tests.unit import base
|
||||
|
||||
from rsd_lib.resources.v2_2.manager import manager
|
||||
|
||||
|
||||
class TestManager(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestManager, self).setUp()
|
||||
self.conn = mock.Mock()
|
||||
|
||||
with open('rsd_lib/tests/unit/json_samples/v2_2/manager.json',
|
||||
'r') as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
|
||||
self.manager_inst = manager.Manager(self.conn,
|
||||
'/redfish/v1/Manager/PSME',
|
||||
redfish_version='1.0.2')
|
||||
|
||||
def test_parse_attributes(self):
|
||||
self.manager_inst._parse_attributes()
|
||||
self.assertEqual('/redfish/v1/Managers/PSME/Actions/Manager.Reset',
|
||||
self.manager_inst.actions.manager_reset.target)
|
||||
|
||||
|
||||
class TestManagerCollection(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestManagerCollection, self).setUp()
|
||||
self.conn = mock.Mock()
|
||||
|
||||
with open('rsd_lib/tests/unit/json_samples/v2_2/'
|
||||
'manager_collection.json', 'r') as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
|
||||
self.manager_col = manager.ManagerCollection(self.conn,
|
||||
'redfish/v1/Managers',
|
||||
redfish_version='1.0.2')
|
||||
|
||||
def test_parse_attributes(self):
|
||||
self.manager_col._parse_attributes()
|
||||
self.assertEqual('description-as-string', self.manager_col.description)
|
||||
self.assertEqual(('/redfish/v1/Managers/BMC1',
|
||||
'/redfish/v1/Managers/BMC2',
|
||||
'/redfish/v1/Managers/PSME',),
|
||||
self.manager_col.members_identities)
|
Loading…
x
Reference in New Issue
Block a user