3 Replies Latest reply on Aug 22, 2019 1:13 AM by aggarwalvinay31

    [NSX-T Power CLI]

    jjto Lurker

      I am testing the PowerCLI capabilities for our NSX-T deployment and I'm finding some errors that I'm unable to sort out. Since I'm quite newbie with this, I'm sure someone here will be able to shed some light to my issue.


      Basically, I'm trying to show the routing table of our Tier-0 logical router using Get-NsxtService cmd-let but I'm getting an invalid_request error with error code 299 "Required data source parameter source=realtime is missing". Both logical_router_id &  transport_node_id are correct.


      After successfully connecting to our NSXT:


      PS C:\Users\USER1> Get-NsxtService -Name com.vmware.nsx.logical_routers.routing.route_table


                                                    Name Documentation

                                                    ---- -------------




      PS C:\Users\USER1> $routingtable.help


      Documentation :

      Operations    : com.vmware.nsx.model.logical_router_route_table list(string logical_router_id, string transport_node_id, string? cursor, string? included_fields, long? page_size, boolean? sort_ascending, string? sort_by, string?




      Constants     : LIST_SOURCE_CACHED: Possible value for source of operation RouteTable.list.



                      LIST_SOURCE_REALTIME: Possible value for source of operation RouteTable.list.


      PS C:\Users\USER1> $routingtable.list("742b99e2-00e1-4691-9c00-362146coco55","356ec501-6b2a-4rr1-b16e-bd23549c91c8")

      A server error occurred: 'com.vmware.vapi.std.errors.invalid_request': . Check $Error[0].Exception.ServerError for more details.

      At line:1 char:1

      + $routingtable.list("742b99e2-00e1-4691-9c00-362146coco55","356ec501-6 ...

      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

          + CategoryInfo          : OperationStopped: (:) [], CisServerException

          + FullyQualifiedErrorId : VMware.VimAutomation.Cis.Core.Types.V1.CisServerException


      PS C:\Users\USER1> $Error[0].Exception.ServerError | ConvertTo-Json


          "Help":  {

                       "Documentation":  "The InvalidRequest error indicates that the request is malformed in such a way that the server is unable to process it. \n Examples: \n\n   - The XML in a SOAP request is not well-formed so the server cannot parse the request. \n   - The XML in a SOAP request is well-formed but does not match the structure required by the SOAP specification. \n   - A JSON-RPC request is not valid JSON. \n   - The JSON sent in a JSON-RPC request is not a valid JSON-RPC Request object. \n   - The Request object from a JSON-RPC request does not match the structure required by the API infrastructure. \n  \n Counterexamples: \n\n   - The parameter has a value that is not with the required range. The InvalidArgument error would be used instead. \n   - The name of the operation specified in the request doesn\u0027t not match any known operation. The NotFound error would be used instead. \n  \n Some transport protocols (for example JSON-RPC) include their own mechanism for reporting these kinds of errors, and the API infrastructure for a programming language may expose the errors using a language specific mechanism, so this error might not be used.\n",

                       "messages":  {

                                        "Documentation":  "Stack of one or more localizable messages for human error consumers. \n The message at the top of the stack (first in the list) describes the error from the perspective of the operation the client invoked. Each subsequent message in the stack describes the \"cause\" of the prior message.\n"


                       "data":  {

                                    "Documentation":  "Data to facilitate clients responding to the operation reporting a standard error to indicating that it was unable to complete successfully. \n Operations may provide data that clients can use when responding to errors. Since the data that clients need may be specific to the context of the operation reporting the error, different operations that report the same error may provide different data in the error. The documentation for each each operation will describe what, if any, data it provides for each error it reports. The ArgumentLocations, FileLocations, and TransientIndication structures are intended as possible values for this field. DynamicID may also be useful as a value for this field (although that is not its primary purpose). Some services may provide their own specific structures for use as the value of this field when reporting errors from their operations.\n\nSome operations will not set this field when reporting errors."



          "messages":  [




          "data":  {

                       "httpStatus":  {

                                          "Value":  "BAD_REQUEST"


                       "error_code":  {

                                          "Value":  299


                       "module_name":  {

                                           "Value":  "common-services"


                       "error_message":  {

                                             "Value":  "Required data source parameter source=realtime is missing."






      I tried to perform the same operation with Get-LogicalRouterRoutingTable cmdlet but I'm having issues too.


      PS C:\Users\USER1>  Get-LogicalRouterRoutingRoutingTable -LogicalRouterId "742b99e2-00e1-4691-9c00-362146coco55" -TransportNodeId "356ec501-6b2a-4rr1-b16e-bd23549c91c8"

      Get-LogicalRouterRoutingRoutingTable :

      At line:1 char:2

      +  Get-LogicalRouterRoutingRoutingTable -LogicalRouterId "742b99e2-00e1 ...

      +  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

          + CategoryInfo          : NotSpecified: (:) [Get-LogicalRouterRoutingRoutingTable], InvalidRequest

          + FullyQualifiedErrorId : VMware.VimAutomation.Cis.Core.Commands.Nsx.InvalidRequest,VMware.VimAutomation.Cis.Core.Commands.Nsx.GetLogicalRouterRoutingRoutingTable

        • 1. Re: [NSX-T Power CLI]
          aggarwalvinay31 Novice

          This is quite interesting. Even though source is listed as optional in com.vmware.nsx.logical_routers.routing.route_table class, when you supply command it is expecting you to provide realtime value for source as a input.


          Try this command below:




          Let me know if it works. It worked for me in hands on lab.


          You can combined the result by using .results and selecting fields that you require. This will give you a nice view. For Example:


          $routingtable.list("742b99e2-00e1-4691-9c00-362146coco55","356ec501-6b2a-4rr1-b16e-bd23549c91c8","`t","None","1000",1,"None","realtime").results | select-object next_hop, network



          Was it helpful? Let us know by completing this short survey here.



          • 2. Re: [NSX-T Power CLI]
            jjto Lurker

            Yes, it works! Seems the documentation is not as accurate as it should! I will take this in mind if I find similar issues with other commands. Thanks!

            • 3. Re: [NSX-T Power CLI]
              aggarwalvinay31 Novice

              Glad to hear that it worked for you.