Package: oscurl
oscurlis a tool to access OpenStack APIs as raw. You can specify method,
URL path and body of HTTP requests freely. It’s useful to test, check or
confirm OpenStack APIs.FeaturescURL-like access to OpenStack APIsHandle Keystone authentication and insertX-Auth-Tokenheader;
You do not need to handle Keystone authentication manuallyConstruct URL based on OpenStack service endpoints (relative mode)Support multiple output formats: raw, YAML, JSON, header only and body onlyShow request header and bodyKeystone v3 and v2 supportMicroversioning header support. ‘latest’ is used by default.Support multiple ways to specify keystone credentials:Legacy way to useOS_*environment variablesos-client-config viaOS_CLOUDenvironment variableJSON input forPOSTandPUTrequestsInstallationoscurl is available at PyPI (the Python Packaging Index).
To install oscurl, just run:$ pip install oscurlUsageSet environment variables as same as you use nova command:$ source credential_fileor if you have os-client-config configuration like /etc/openstack/clouds.yaml:$ export OS_CLOUD=<env-name>Run oscurl:$ oscurl -p /servers
HTTP/1.1 200 OK
X-Compute-Request-Id: req-e5d6537e-9db8-48a2-abfb-f3a63f17add5
Content-Type: application/json
Content-Length: 15
Date: Sun, 22 Jun 2014 12:20:46 GMT

{"servers": []}oscurl--helpshows the options.oscurl--full-helpshows the options from os-client-config too.Environment VariablesThe following environment variables can be used
to change the default behavior.OSCURL_SERVICE: the default service type.
Service types registered in Keystone service catalog like
likecompute,volume,identity,imageandnetworkOSCURL_FORMAT: the default format used to display API responsesOSCURL_METHOD: the default method to be usedExamplesGet server list from Nova:$ oscurl -p /serversGet flavor list from Nova:$ oscurl -p /flavorsGet image list from Glance:$ oscurl -s image -p /imagesGet volume list from Cinder:$ oscurl -s volume -p /volumesGet network list from Neutron:$ oscurl -s network -p /v2.0/networksCreate a new instance by passing the input as JSON file:$ oscurl -m POST -p /servers -i create_instance_body.jsonor:$ oscurl -m POST -p /servers -i - < create_instance_body.jsonThe content ofcreate_instance_body.jsonis like below:{
    "server": {
        "name": "server-test-1",
        "imageRef": "19befdd4-248b-4b8d-b586-8a91a8bf8623",
        "flavorRef": "1",
        "max_count": 1,
        "min_count": 1,
        "networks": [
            {
                "uuid": "6a2c033b-3f50-4f43-97fa-2517ccdc28d9"
            }
        ],
        "security_groups": [
            {
                "name": "default"
            }
        ]
    }
}Show an instance information:$ oscurl -p /servers/fdec5b9e-9b6a-4eb4-8684-6c75cd275559Delete an instance:$ oscurl -p /servers/fdec5b9e-9b6a-4eb4-8684-6c75cd275559 -m DELETEOutput mode--show-modecontrols what are shown.ALLshows request and response including both headers and body.RESPshows response headers and body. Request headers and body
are not shown.BODYshows response body only. Useful if you pass output
to another program likejq.Output Format--formatcontrols the output format of response body.RAW: Show response body as-is (Default):$ oscurl -p /servers -r RESP
HTTP/1.1 200 OK
Content-Length: 296
Content-Type: application/json
Openstack-Api-Version: compute 2.42
X-Openstack-Nova-Api-Version: 2.42
Vary: OpenStack-API-Version, X-OpenStack-Nova-API-Version
X-Compute-Request-Id: req-565bb028-c144-40cc-8fb5-52f1c5ff3b58
Date: Fri, 24 Mar 2017 09:07:08 GMT
Connection: keep-alive

{"servers": [{"id": "2820fcfc-3cd2-4a40-8c01-3c9544cfbc59", "links": [{"href": "http://172.27.201.206:8774/v2.1/servers/2820fcfc-3cd2-4a40-8c01-3c9544cfbc59", "rel": "self"}, {"href": "http://172.27.201.206:8774/servers/2820fcfc-3cd2-4a40-8c01-3c9544cfbc59", "rel": "bookmark"}], "name": "vm1"}]}JSON: Human-readable JSON format:$ oscurl -p /servers --show-mode RESP -f JSON
HTTP/1.1 200 OK
Content-Length: 296
Content-Type: application/json
Openstack-Api-Version: compute 2.42
X-Openstack-Nova-Api-Version: 2.42
Vary: OpenStack-API-Version, X-OpenStack-Nova-API-Version
X-Compute-Request-Id: req-3293cc26-c336-454a-b361-0a97aaa8c571
Date: Fri, 24 Mar 2017 09:09:14 GMT
Connection: keep-alive

{
  "servers": [
    {
      "id": "2820fcfc-3cd2-4a40-8c01-3c9544cfbc59",
      "links": [
        {
          "href": "http://172.27.201.206:8774/v2.1/servers/2820fcfc-3cd2-4a40-8c01-3c9544cfbc59",
          "rel": "self"
        },
        {
          "href": "http://172.27.201.206:8774/servers/2820fcfc-3cd2-4a40-8c01-3c9544cfbc59",
          "rel": "bookmark"
        }
      ],
      "name": "vm1"
    }
  ]
}YAML: HTTP response body in YAML:$ oscurl -p /servers --show-mode RESP -f YAML
HTTP/1.1 200 OK
Content-Length: 296
Content-Type: application/json
Openstack-Api-Version: compute 2.42
X-Openstack-Nova-Api-Version: 2.42
Vary: OpenStack-API-Version, X-OpenStack-Nova-API-Version
X-Compute-Request-Id: req-69d39243-cd55-4ee8-a6cf-9eb7a7e94fad
Date: Fri, 24 Mar 2017 09:11:18 GMT
Connection: keep-alive

servers:
- id: 2820fcfc-3cd2-4a40-8c01-3c9544cfbc59
  links:
  - {href: 'http://172.27.201.206:8774/v2.1/servers/2820fcfc-3cd2-4a40-8c01-3c9544cfbc59',
    rel: self}
  - {href: 'http://172.27.201.206:8774/servers/2820fcfc-3cd2-4a40-8c01-3c9544cfbc59',
    rel: bookmark}
  name: vm1