Changing the CPU Memory Size that the Guest Shell Uses 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:

https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-installation-and-configuration-guides-list.html/

Changing the Amount of CPU the Guest Shell Uses

Changing the Amount of CPU the Guest Shell Uses
POST http://<IP_address>/api/mo/sys/action.json
{
"actionLSubj": {
  "attributes": {
    "dn": "sys/action/lsubj-[sys]"
  }
  "children" : [{
      "guestshellGuestShellResizeCPULTask": {
      "attributes": {
        "adminSt": "start",
        "dn": "sys/action/lsubj-[sys]/guestshellGuestShellResizeCPULTask",
        "freq": "one-shot",
        "percent": "12",
        "descr": ""
}}}]}}

Note: This example was added in Release 9.3(3).

To change the amount of CPU resources that the Guest Shell may use, post a guestshellGuestShellResizeCPULTask action specifying the percentage of system CPU for the Guest Shell. This request completes immediately, but the actual adjustment happens the next time the Guest Shell is enabled or rebooted.

To see the result of the resize request, get the guestshellGuestShellResizeCPURslt


CLI Commands

The CLI command is equivalent to the payload example displayed in the pane on the right.

guestshell resize cpu <percent>


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.

MODN
actionLSubj sys/action/lsubj-{[oDn]}
guestshellGuestShellResizeCPULTask sys/action/lsubj-{[oDn]}/guestshellGuestShellResizeCPULTask


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 NameData TypeDescriptionValues
dn
reference:BinRef
A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module.


guestshellGuestShellResizeCPULTask Properties

The following table contains information about the guestshellGuestShellResizeCPULTask 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 NameData TypeDescriptionValues
adminSt
action:AdminSt
scalar:Enum8
The administrative state of the object or policy.SELECTION:
  • 0 - unknown
  • 1 - start
  • 2 - stop
  • 3 - suspend
  • DEFAULT: unknown(0)
  • 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 executedSELECTION:
  • 0ull - one-shot
  • DEFAULT: 0
  • percent
    guestshell:CpuPercent
    scalar:Uint32
    NO COMMENTS RANGE: Min: (long)0l Max: (long)100l
  • DEFAULT: 0u
  • 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:

    http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

    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:

    https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

    Querying the Result of the CPU Resize Request (Success)

    Querying the Result of the CPU Resize Request (Success)
    
    GET http://<IP_Address>/api/node/mo/sys/action/lsubj-[sys]/guestshellGuestShellResizeCPURslt.json
    
    {
        "totalCount": "1",
        "imdata": [
            {
                "guestshellGuestShellResizeCPURslt": {
                    "attributes": {
                        "ack": "no",
                        "childAction": "",
                        "descr": "Please disable/enable or reboot the guest shell for system CPU share to be resized",
                        "dn": "sys/action/lsubj-[sys]/guestshellGuestShellResizeCPURslt",
                        "endTs": "2019-10-19T12:05:08.845+00:00",
                        "modTs": "never",
                        "operSt": "completed",
                        "peerClassId": "guestshellGuestShellResizeCPULTask",
                        "qual": "",
                        "rSz": "100",
                        "rTm": "00:00:00:00.000",
                        "startTs": "2019-10-19T12:05:08.844+00:00",
                        "status": "",
                        "type": "clear"
                    }
                }
            }
        ]
    }
    


    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.

    MODN
    guestshellGuestShellResizeCPURslt sys/action/lsubj-{[oDn]}/guestshellGuestShellResizeCPURslt


    guestshellGuestShellResizeCPURslt Properties

    The following table contains information about the guestshellGuestShellResizeCPURslt 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 NameData TypeDescriptionValues
    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:
  • false - no
  • true - yes
  • DEFAULT: no(false)
  • childAction
    mo:ModificationChildAction
    scalar:Bitmask32
    Delete or ignore. For internal use only.SELECTION:
  • 16384u - deleteAll
  • 4096u - ignore
  • 8192u - deleteNonPresent
  • DEFAULT: 0
  • 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:
  • 0ull - never
  • DEFAULT: never(0ull)
  • modTs
    mo:TStamp
    scalar:Date
    The time when this object was last modified.SELECTION:
  • 0ull - never
  • DEFAULT: never(0ull)
  • operSt
    action:OperSt
    scalar:Enum8
    The runtime state of the object or policy.SELECTION:
  • 0 - scheduled
  • 1 - processing
  • 2 - completed
  • 3 - cancelled
  • 4 - failed
  • 5 - indeterminate
  • 6 - suspended
  • 7 - crashsuspect
  • DEFAULT: scheduled(0)
  • peerClassId
    mo:MoClassId
    The BGP neighbor.DEFAULT: guestshellGuestShellResizeCPULTask
    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
  • DEFAULT: 100
  • 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:
  • 0ull - never
  • DEFAULT: never(0ull)
  • status
    mo:ModificationStatus
    scalar:Bitmask32
    The upgrade status. This property is for internal use only.SELECTION:
  • 16u - replaced
  • 2u - created
  • 4u - modified
  • 8u - deleted
  • DEFAULT: 0
  • type
    action:Type
    scalar:Enum8
    The specific type of the object or component.SELECTION:
  • 1 - clear
  • 2 - reset
  • 3 - reload
  • 4 - locate
  • 5 - install
  • 6 - test
  • 7 - collect
  • 8 - interface-in-service
  • DEFAULT: clear(1)

  • Related Documentation

    For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:

    http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

    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:

    https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

    Querying the Result of the CPU Resize Request (Failed)

    Querying the Result of the CPU Resize Request (Failed)
    
    GET http://<IP_Address>/api/node/mo/sys/action/lsubj-[sys]/guestshellGuestShellResizeCPURslt.json
    
    {
        "totalCount": "1",
        "imdata": [
            {
                "guestshellGuestShellResizeCPURslt": {
                    "attributes": {
                        "ack": "no",
                        "childAction": "",
                        "descr": "Error: requested system CPU share exceeds maximum (20% CPU remaining)",
                        "dn": "sys/action/lsubj-[sys]/guestshellGuestShellResizeCPURslt",
                        "endTs": "2019-10-19T12:05:47.527+00:00",
                        "modTs": "never",
                        "operSt": "failed",
                        "peerClassId": "guestshellGuestShellResizeCPULTask",
                        "qual": "",
                        "rSz": "100",
                        "rTm": "00:00:00:00.000",
                        "startTs": "2019-10-19T12:05:47.526+00:00",
                        "status": "",
                        "type": "clear"
                    }
                }
            }
        ]
    }
    

    Different Cisco Nexus 3000 and 9000 Series switches may have different allowances for how much CPU the Guest Shell may use in times of contention. If the requested percentage is not allowed, the resize result will have a operSt value of “failed” and the descr attribute will indicate the reason.


    guestshellGuestShellResizeCPURslt Properties

    The following table contains information about the guestshellGuestShellResizeCPURslt 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 NameData TypeDescriptionValues
    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:
  • false - no
  • true - yes
  • DEFAULT: no(false)
  • childAction
    mo:ModificationChildAction
    scalar:Bitmask32
    Delete or ignore. For internal use only.SELECTION:
  • 16384u - deleteAll
  • 4096u - ignore
  • 8192u - deleteNonPresent
  • DEFAULT: 0
  • 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:
  • 0ull - never
  • DEFAULT: never(0ull)
  • modTs
    mo:TStamp
    scalar:Date
    The time when this object was last modified.SELECTION:
  • 0ull - never
  • DEFAULT: never(0ull)
  • operSt
    action:OperSt
    scalar:Enum8
    The runtime state of the object or policy.SELECTION:
  • 0 - scheduled
  • 1 - processing
  • 2 - completed
  • 3 - cancelled
  • 4 - failed
  • 5 - indeterminate
  • 6 - suspended
  • 7 - crashsuspect
  • DEFAULT: scheduled(0)
  • peerClassId
    mo:MoClassId
    The BGP neighbor.DEFAULT: guestshellGuestShellResizeCPULTask
    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
  • DEFAULT: 100
  • 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:
  • 0ull - never
  • DEFAULT: never(0ull)
  • status
    mo:ModificationStatus
    scalar:Bitmask32
    The upgrade status. This property is for internal use only.SELECTION:
  • 16u - replaced
  • 2u - created
  • 4u - modified
  • 8u - deleted
  • DEFAULT: 0
  • type
    action:Type
    scalar:Enum8
    The specific type of the object or component.SELECTION:
  • 1 - clear
  • 2 - reset
  • 3 - reload
  • 4 - locate
  • 5 - install
  • 6 - test
  • 7 - collect
  • 8 - interface-in-service
  • DEFAULT: clear(1)

  • Related Documentation

    Note: The property information for this example was added in Release 9.3(3).


    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.

    MODN
    guestshellGuestShellResizeCPURslt sys/action/lsubj-{[oDn]}/guestshellGuestShellResizeCPURslt


    guestshellGuestShellResizeCPURslt Properties

    The following table contains information about the guestshellGuestShellResizeCPURslt 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 NameData TypeDescriptionValues
    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:
  • false - no
  • true - yes
  • DEFAULT: no(false)
  • childAction
    mo:ModificationChildAction
    scalar:Bitmask32
    Delete or ignore. For internal use only.SELECTION:
  • 16384u - deleteAll
  • 4096u - ignore
  • 8192u - deleteNonPresent
  • DEFAULT: 0
  • 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:
  • 0ull - never
  • DEFAULT: never(0ull)
  • modTs
    mo:TStamp
    scalar:Date
    The time when this object was last modified.SELECTION:
  • 0ull - never
  • DEFAULT: never(0ull)
  • operSt
    action:OperSt
    scalar:Enum8
    The runtime state of the object or policy.SELECTION:
  • 0 - scheduled
  • 1 - processing
  • 2 - completed
  • 3 - cancelled
  • 4 - failed
  • 5 - indeterminate
  • 6 - suspended
  • 7 - crashsuspect
  • DEFAULT: scheduled(0)
  • peerClassId
    mo:MoClassId
    The BGP neighbor.DEFAULT: guestshellGuestShellResizeCPULTask
    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
  • DEFAULT: 100
  • 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:
  • 0ull - never
  • DEFAULT: never(0ull)
  • status
    mo:ModificationStatus
    scalar:Bitmask32
    The upgrade status. This property is for internal use only.SELECTION:
  • 16u - replaced
  • 2u - created
  • 4u - modified
  • 8u - deleted
  • DEFAULT: 0
  • type
    action:Type
    scalar:Enum8
    The specific type of the object or component.SELECTION:
  • 1 - clear
  • 2 - reset
  • 3 - reload
  • 4 - locate
  • 5 - install
  • 6 - test
  • 7 - collect
  • 8 - interface-in-service
  • DEFAULT: clear(1)

  • Related Documentation

    For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:

    http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

    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:

    https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html