Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Obtaining an Authentication Token to Work with the Network Activator APIs

    You must obtain an authentication token from the Keystone Authentication Server on the central server before you work with the Network Activator APIs. When you have obtained the token, you can store it and use it for all future operations with the Network Activator API.

    This procedure uses the following Keystone Authentication Server API:
    https://server-IP-address:35357/v2.0/auth/tokens

    Table 1 shows the fields that you must specify for this procedure.

    Table 1: Required Fields for Obtaining a Token to Work with Network Activator APIs

    Field

    Description

    Example

    auth: tenantName

    Tenant name—admin (fixed text string)

    admin

    passwordCredentials: username

    Username—admin (fixed text string)

    admin

    passwordCredentials: password

    Password for accessing the API server

    contrail123

    To obtain a token:

    1. Issue a REST call to get a token.

      The API returns a token.
      For example:

      user@host:~$ curl -kd '{"auth":{"tenantName":"admin", "passwordCredentials":{"username":"admin", "password":"contrail123"}}}' -H "Content-type: application/json" https://10.155.90.203:35357/v2.0/tokens
      {"access": {"token": {"issued_at": "2016-03-06T06:49:38.245074", "expires": "2016-03-06T07:49:38Z", "id": "MIIGHgYJKoZIhvcNAQcCoIIGDzCCBgsCAQE-YLa1fos0wsAnO5zYw==", "tenant": {"description": "Admin Tenant", "enabled": true, "id": "0b372a0338a743c1b127fbd99d90b95c", "name": "admin"}}, "serviceCatalog": [{"endpoints": [{"adminURL": "https://10.155.68.120:32768", "region": "regionOne", "internalURL": "https://10.155.68.120:32768/v1/AUTH_0b372a0338a743c1b127fbd99d90b95c", "id": "50609049e5204ddcadb511487bd75ec1", "publicURL": "https://10.155.68.120:32768/v1/AUTH_0b372a0338a743c1b127fbd99d90b95c"}, {"adminURL": "https://10.155.90.203:32768", "region": "central", "internalURL": "https://10.155.90.203:32768/v1/AUTH_0b372a0338a743c1b127fbd99d90b95c", "id": "4cbb5018d5344e7f9f9ef7508154b15c", "publicURL": "https://10.155.90.203:32768/v1/AUTH_0b372a0338a743c1b127fbd99d90b95c"}], "endpoints_links": [], "type": "object-store", "name": "swift"}], "user": {"username": "admin", "roles_links": [], "id": "53bc145e1ad84a71a704a62201fd4468", "roles": [{"name": "admin"}], "name": "admin"}, "metadata": {"is_admin": 0, "roles": ["fbaff5e3b77049f2ac559ae96888f585"]}}}

      Note: The token is typically an extremely long sequence, and these examples show a shorter sequence, which is easier to read.

    2. Store the token in an environment variable so that you can use it for subsequent API operations.
      For example:
      user@host:~$ export OS_TOKEN=MIIGHgYJKoZIhvcNAQcCoIIGDzCCBgsCAQE-YLa1fos0wsAnO5zYw==
      user@host:~$ echo $OS_TOKEN
      MIIGHgYJKoZIhvcNAQcCoIIGDzCCBgsCAQE-YLa1fos0wsAnO5zYw==

    Modified: 2016-10-19