Exporting the Guest Shell Rootfs and Querying the Result
This section contains payload examples to demonstrate how to use the NX-API REST API to control the state of the Guest Shell on the Cisco Nexus 3000 and 9000 Series switches.
For more information about the Guest Shell, see the Cisco Nexus 9000 Series NX-OS Programmability Guide:
Exporting the Guest Shell Rootfs
Exporting the Guest Shell Rootfs
POST http://<IP_address>/api/mo/sys/action.json
{
"actionLSubj": {
"attributes": {
"dn": "sys/action/lsubj-[sys]"
}
"children" : [{
"guestshellGuestShellExportLTask": {
"attributes": {
"adminSt": "start",
"dn": "sys/action/lsubj-[sys]/guestshellGuestShellExportLTask",
"freq": "one-shot",
"package" : "bootflash://sup-local/gs.ext4",
"descr": ""
}}}]}}
Note: This example was added in Release 9.3(3).
If you need to save a copy of the Guest Shell rootfs, or make it available to be enabled on other Cisco Nexus 3000 or 9000 Series switches, post a guestshellGuestShellExportLTask action. If the Guest Shell was activated when this request was posted, the Guest Shell is deactivated on the rootfs copied to the local media and then reactivated.
CLI Commands
The CLI command is equivalent to the payload example displayed in the pane on the right.
guestshell export rootfs package <export_uri>
Verifying a DME Configuration
The following table contains the distinguished name (DN) for each managed object (MO) in the DME payload. Issue a GET request using the DN to verify the configuration was posted or to get information about the configured properties of a particular object.
MO | DN |
---|---|
actionLSubj | sys/action/lsubj-{[oDn]} |
guestshellGuestShellExportLTask | sys/action/lsubj-{[oDn]}/guestshellGuestShellExportLTask |
actionLSubj Properties
The following table contains information about the actionLSubj properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.
Property Name | Data Type | Description | Values |
---|---|---|---|
dn | reference:BinRef | A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module. |
guestshellGuestShellExportLTask Properties
The following table contains information about the guestshellGuestShellExportLTask properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.
Property Name | Data Type | Description | Values |
---|---|---|---|
adminSt | action:AdminSt scalar:Enum8 | The administrative state of the object or policy. | SELECTION:
|
dn | reference:BinRef | A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module. | |
freq | action:Freq scalar:Time | Frequency at which tasks are executed | SELECTION:
|
package | infra:GuestshellPackageURI string:Basic | NO COMMENTS | RANGE:
Min: "256"
Max: "4096" (EXCLUDE) |
descr | action:Descr string:Basic | RANGE: Min: "0" Max: "128" | |
descr | action:Descr string:Basic | RANGE: Min: "0" Max: "128" |
Related Documentation
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload:
https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide:
Querying the Result of Exporting the Guest Shell Rootfs (Example 1)
Querying the Result of Exporting the Guest Shell Rootfs (Example 1)
GET http://<IP_Address>/api/mo/sys/action/lsubj-[sys]/guestshellGuestShellExportRslt.json
{
"totalCount": "1",
"imdata": [
{
"guestshellGuestShellExportRslt": {
"attributes": {
"ack": "no",
"childAction": "",
"descr": "Destination path provided is an existing file. Will overwrite.",
"dn": "sys/action/lsubj-[sys]/guestshellGuestShellExportRslt",
"endTs": "never",
"modTs": "never",
"operSt": "processing",
"peerClassId": "guestshellGuestShellExportLTask",
"qual": "",
"rSz": "100",
"rTm": "00:00:00:00.000",
"startTs": "2019-10-19T17:54:13.857+00:00",
"status": "",
"type": "clear"
}
}
}
]
}
Note: This example was added in Release 9.3(3).
The endTs
of “never”
and operSt
of “processing”
indicates that the export request is being processed, but it has yet to finish.
Repeating the request for the export result after some time shows an operSt
attribute of “completed”
and the time in which the disable request finished in the endTs
attribute as shown in example 2.
Verifying a DME Configuration
The following table contains the distinguished name (DN) for each managed object (MO) in the DME payload. Issue a GET request using the DN to verify the configuration was posted or to get information about the configured properties of a particular object.
MO | DN |
---|---|
guestshellGuestShellExportRslt | sys/action/lsubj-{[oDn]}/guestshellGuestShellExportRslt |
guestshellGuestShellExportRslt Properties
The following table contains information about the guestshellGuestShellExportRslt properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.
Property Name | Data Type | Description | Values |
---|---|---|---|
ack | scalar:Bool | The acknowledgement status of the fault. If a fault is acknowledged and cleared, it is immediately deleted. If a fault is not acknowledged and cleared, it is deleted after the retention interval. | SELECTION:
|
childAction | mo:ModificationChildAction scalar:Bitmask32 | Delete or ignore. For internal use only. | SELECTION:
|
descr | action:Descr string:Basic | RANGE: Min: "0" Max: "128" | |
dn | reference:BinRef | A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module. | |
endTs | mo:TStamp scalar:Date | The date and time when the task ended. | SELECTION:
|
modTs | mo:TStamp scalar:Date | The time when this object was last modified. | SELECTION:
|
operSt | action:OperSt scalar:Enum8 | The runtime state of the object or policy. | SELECTION:
|
peerClassId | mo:MoClassId | The BGP neighbor. | DEFAULT: guestshellGuestShellExportLTask |
qual | action:Qual string:Basic | The qualifier for the component status. | RANGE: Min: "0" Max: "512" |
rSz | action:RetentionSize scalar:Uint16 | The retention size of the task results. | RANGE:
Min: 1
Max: 1024 |
rTm | action:RetentionTime scalar:Time | The retention time of the task results. | |
startTs | mo:TStamp scalar:Date | The date and time when the task began. | SELECTION:
|
status | mo:ModificationStatus scalar:Bitmask32 | The upgrade status. This property is for internal use only. | SELECTION:
|
type | action:Type scalar:Enum8 | The specific type of the object or component. | SELECTION:
|
Related Documentation
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload:
https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide:
Querying the Result of Exporting the Guest Shell Rootfs (Example 2)
Querying the Result of Exporting the Guest Shell Rootfs (Example 2)
GET http://<IP_Address>/api/mo/sys/action/lsubj-[sys]/guestshellGuestShellExportRslt.json
{
"totalCount": "1",
"imdata": [
{
"guestshellGuestShellExportRslt": {
"attributes": {
"ack": "no",
"childAction": "",
"descr": "Guestshell activated successfully",
"dn": "sys/action/lsubj-[sys]/guestshellGuestShellExportRslt",
"endTs": "2019-10-19T17:53:45.574+00:00",
"modTs": "never",
"operSt": "completed",
"peerClassId": "guestshellGuestShellExportLTask",
"qual": "",
"rSz": "100",
"rTm": "00:00:00:00.000",
"startTs": "2019-10-19T17:53:07.246+00:00",
"status": "",
"type": "clear"
}
}
}
]
}
Note: This example was added in Release 9.3(3).
In this example, the Guest Shell was in the activated state when the export request was posted and it returned to the activated state as indicated in the descr
attribute.
Verifying a DME Configuration
The following table contains the distinguished name (DN) for each managed object (MO) in the DME payload. Issue a GET request using the DN to verify the configuration was posted or to get information about the configured properties of a particular object.
MO | DN |
---|---|
guestshellGuestShellExportRslt | sys/action/lsubj-{[oDn]}/guestshellGuestShellExportRslt |
guestshellGuestShellExportRslt Properties
The following table contains information about the guestshellGuestShellExportRslt properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.
Property Name | Data Type | Description | Values |
---|---|---|---|
ack | scalar:Bool | The acknowledgement status of the fault. If a fault is acknowledged and cleared, it is immediately deleted. If a fault is not acknowledged and cleared, it is deleted after the retention interval. | SELECTION:
|
childAction | mo:ModificationChildAction scalar:Bitmask32 | Delete or ignore. For internal use only. | SELECTION:
|
descr | action:Descr string:Basic | RANGE: Min: "0" Max: "128" | |
dn | reference:BinRef | A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module. | |
endTs | mo:TStamp scalar:Date | The date and time when the task ended. | SELECTION:
|
modTs | mo:TStamp scalar:Date | The time when this object was last modified. | SELECTION:
|
operSt | action:OperSt scalar:Enum8 | The runtime state of the object or policy. | SELECTION:
|
peerClassId | mo:MoClassId | The BGP neighbor. | DEFAULT: guestshellGuestShellExportLTask |
qual | action:Qual string:Basic | The qualifier for the component status. | RANGE: Min: "0" Max: "512" |
rSz | action:RetentionSize scalar:Uint16 | The retention size of the task results. | RANGE:
Min: 1
Max: 1024 |
rTm | action:RetentionTime scalar:Time | The retention time of the task results. | |
startTs | mo:TStamp scalar:Date | The date and time when the task began. | SELECTION:
|
status | mo:ModificationStatus scalar:Bitmask32 | The upgrade status. This property is for internal use only. | SELECTION:
|
type | action:Type scalar:Enum8 | The specific type of the object or component. | SELECTION:
|
Related Documentation
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload:
https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide: