Skip to content

Commit 5a3cd29

Browse files
authored
Merge pull request #196 from DMTF/Fix195-SetServiceIdentification
Added 'setserviceid' option to rf_manager_config.py
2 parents de45d6a + 7a80dd8 commit 5a3cd29

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

docs/rf_manager_config.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ A tool to manage managers in a service.
1111
```
1212
usage: rf_manager_config.py [-h] --user USER --password PASSWORD --rhost RHOST
1313
[--manager MANAGER] [--debug]
14-
{info,reset,getnet,setnet,resettodefaults,settime,getprotocol,setprotocol}
14+
{info,reset,getnet,setnet,resettodefaults,settime,getprotocol,setprotocol,setserviceid}
1515
...
1616
1717
A tool to manage managers in a service
1818
1919
positional arguments:
20-
{info,reset,getnet,setnet,resettodefaults,settime,getprotocol,setprotocol}
20+
{info,reset,getnet,setnet,resettodefaults,settime,getprotocol,setprotocol,setserviceid}
2121
info Displays information about a manager
2222
reset Resets a manager
2323
getnet Displays information about an Ethernet interface
@@ -26,6 +26,7 @@ positional arguments:
2626
settime Sets the date-time on a manager
2727
getprotocol Displays network protocol information about a manager
2828
setprotocol Configures network protocol settings on a manager
29+
setserviceid Sets the service identification for a manager
2930
3031
required arguments:
3132
--user USER, -u USER The user name for authentication
@@ -342,3 +343,27 @@ Example:
342343
$ rf_manager_config.py -u root -p root -r https://192.168.1.100 setprotocol -prot IPMI -dis
343344
Configuring IPMI...
344345
```
346+
347+
### Set Service Identification
348+
349+
Sets the service identification for a manager
350+
351+
```
352+
usage: rf_manager_config.py setserviceid [-h] --id ID
353+
354+
options:
355+
-h, --help show this help message and exit
356+
--id ID, -i ID The service identification to set
357+
```
358+
359+
The tool will log into the service specified by the *rhost* argument using the credentials provided by the *user* and *password* arguments.
360+
It will then locate the manager specified by the *manager* argument, and applies the *id* value to the manager instance.
361+
362+
* If *manager* is not specified, and if the service has exactly one manager, it will perform the operation on the one manager.
363+
364+
Example:
365+
366+
```
367+
$ rf_manager_config.py -u root -p root -r https://192.168.1.100 setserviceid -i 'New Identifier'
368+
Setting the identification to 'New Identifier'...
369+
```

redfish_utilities/managers.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def get_manager(context, manager_id=None):
123123
return manager
124124

125125

126-
def set_manager(context, manager_id=None, date_time=None, date_time_offset=None):
126+
def set_manager(context, manager_id=None, date_time=None, date_time_offset=None, service_id=None):
127127
"""
128128
Finds a manager matching the given identifier and sets one or more properties
129129
@@ -132,6 +132,7 @@ def set_manager(context, manager_id=None, date_time=None, date_time_offset=None)
132132
manager_id: The manager to locate; if None, perform on the only manager
133133
date_time: The date-time value to set
134134
date_time_offset: The date-time offset value to set
135+
service_id: The service identification value to set
135136
136137
Returns:
137138
The response of the PATCH
@@ -146,6 +147,8 @@ def set_manager(context, manager_id=None, date_time=None, date_time_offset=None)
146147
payload["DateTime"] = date_time
147148
if date_time_offset is not None:
148149
payload["DateTimeLocalOffset"] = date_time_offset
150+
if service_id is not None:
151+
payload["ServiceIdentification"] = service_id
149152

150153
# Update the manager
151154
headers = None
@@ -181,6 +184,7 @@ def print_manager(manager):
181184
"PartNumber",
182185
"SparePartNumber",
183186
"SerialNumber",
187+
"ServiceIdentification",
184188
]
185189
print("Manager {} Info".format(manager.dict["Id"]))
186190
for property in manager_properties:

scripts/rf_manager_config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@
8888
setprotocol_argget.add_argument("--enable", "-en", action="store_true", help="Enable the selected protocol")
8989
setprotocol_argget.add_argument("--disable", "-dis", action="store_true", help="Disable the selected protocol")
9090
setprotocol_argget.add_argument("--port", "-port", type=int, help="The port number to assign the protocol")
91+
setserviceid_argget = subparsers.add_parser("setserviceid", help="Sets the service identification for a manager")
92+
setserviceid_argget.add_argument("--id", "-i", type=str, required=True, help="The service identification to set")
9193
args = argget.parse_args()
9294

9395
if args.debug:
@@ -215,6 +217,9 @@
215217
network_protocol_setting[args.protocol]["Port"] = args.port
216218
print("Configuring {}...".format(args.protocol))
217219
redfish_utilities.set_manager_network_protocol(redfish_obj, args.manager, network_protocol_setting)
220+
elif args.command == "setserviceid":
221+
print("Setting the identification to '{}'...".format(args.id))
222+
redfish_utilities.set_manager(redfish_obj, args.manager, service_id=args.id)
218223
else:
219224
manager = redfish_utilities.get_manager(redfish_obj, args.manager)
220225
redfish_utilities.print_manager(manager)

0 commit comments

Comments
 (0)