Skip to content

Commit

Permalink
examples: adding service account generation steps
Browse files Browse the repository at this point in the history
Change-Id: Id946f9d33af4f00fb27bdcfde5c57362f9491491
  • Loading branch information
noredistribution committed Feb 21, 2024
1 parent 55b5f5b commit 5decc59
Show file tree
Hide file tree
Showing 14 changed files with 65 additions and 5 deletions.
30 changes: 27 additions & 3 deletions docs/content/connecting/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,35 @@ In future releases we intend to support mutual TLS authentication which does not

For more details on gRPC authentication, see: [authentication](https://grpc.io/docs/guides/auth/).


## Token Based Authentication

This style of authentication uses the token received from the HTTP login API.
Tokens can be either received from the HTTP login API (only last for 24 hours) or can be generated on for service accounts (recommended).

Service accounts have been introduced in [2020.3.0](https://www.arista.com/en/support/toi/cvp-2020-3-0/14664-service-accounts) and have been on CVaaS from the beginning.

The steps to create a service account token are (both CV on-prem and CVaaS):

1. Go to Settings
2. Go to Access Control - Service Accounts
3. Create a Service account if there isn't one by clicking on the `+ New Service Account button`

![service account 1](./static/svc_account1.png)

4. Fill out the form and click `Add`

![service account 2](./static/svc_account2.png)

5. Edit the service account by clicking on it and generate a token

![service account 3](./static/svc_account3.png)

![service account 4](./static/svc_account4.png)

{{% notice note %}}
The service account token will not be retreivable after clicking Ok. It is recommended to store it somewhere safe.
{{% /notice %}}

Read on if you are interested in generating a short lived token for CloudVision on-prem using the HTTP login API.

The following examples use `python` but Go, Java, or any other language capable of HTTP requests will work almost identically. To make the HTTP request, we will use the `requests` library which is available through `pip`:

Expand All @@ -27,7 +52,6 @@ python -m pip install requests

#### Example: token from login


```python
import requests
import json
Expand Down
Binary file added docs/content/connecting/static/svc_account1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/content/connecting/static/svc_account2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/content/connecting/static/svc_account3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/content/connecting/static/svc_account4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions docs/content/examples/REST/bugexposure/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ chapter: false

{{% toc %}}

{{% notice tip %}}
To generate a service account token please refer to the [authentication](../../../connecting/_index.md#authentication) chapter.
{{% /notice %}}

{{% notice info %}}
BugExposure Resource APIs are supported from CVP 2022.1.0 or newer and in CloudVision-as-a-Service.
{{% /notice %}}
Expand Down
4 changes: 4 additions & 0 deletions docs/content/examples/REST/changecontrol/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ chapter: false

{{% toc %}}

{{% notice tip %}}
To generate a service account token please refer to the [authentication](../../../connecting/_index.md#authentication) chapter.
{{% /notice %}}

{{% notice info %}}
Change Control Resource APIs are supported from CVP 2021.2.0 or newer and in CloudVision-as-a-Service.
{{% /notice %}}
Expand Down
4 changes: 4 additions & 0 deletions docs/content/examples/REST/dashboard/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ chapter: false

{{% toc %}}

{{% notice tip %}}
To generate a service account token please refer to the [authentication](../../../connecting/_index.md#authentication) chapter.
{{% /notice %}}

{{% notice info %}}
Dashboard Resource APIs are supported from CVP 2021.3.0 (gRPC only) or newer and in CloudVision-as-a-Service.
The REST endpoint for on-prem is available from 2022.3.0.
Expand Down
8 changes: 6 additions & 2 deletions docs/content/examples/REST/endpointlocation/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ chapter: false

{{% toc %}}

{{% notice tip %}}
To generate a service account token please refer to the [authentication](../../../connecting/_index.md#authentication) chapter.
{{% /notice %}}

{{% notice info %}}
Endpointlocation Resource APIs are supported from CVP 2021.1.0 or newer and in CloudVision-as-a-Service.
{{% /notice %}}
Expand Down Expand Up @@ -177,7 +181,7 @@ Output:
## Get the location of an endpoint based on its IP Address

{{% notice info %}}
To successfully find the endpoint, the IP address of the endpoint has to exist in either the MAC or ARP or DHCP
To successfully find the endpoint, the IP address of the endpoint has to exist in either the MAC or ARP or DHCP
or inventory tables and in the LLDP neighbor table.
{{% /notice %}}

Expand Down Expand Up @@ -275,5 +279,5 @@ Output:
### python

The GetAll RPC is not implemented in this resource API, however a combination of cloudvision.Connector
and the GetOne rAPI can be used to generate a report of all connected endpoints. An example that achieves this can be
and the GetOne rAPI can be used to generate a report of all connected endpoints. An example that achieves this can be
found on the [cloudvision-python](https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/Connector/get_endpoints_ext.py) repo.
4 changes: 4 additions & 0 deletions docs/content/examples/REST/events/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ chapter: false

{{% toc %}}

{{% notice tip %}}
To generate a service account token please refer to the [authentication](../../../connecting/_index.md#authentication) chapter.
{{% /notice %}}

{{% notice tip %}}
[jq](https://stedolan.github.io/jq/) can be used to easily format and parse the outputs.
{{% /notice %}}
Expand Down
4 changes: 4 additions & 0 deletions docs/content/examples/REST/inventory/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ chapter: false

{{% toc %}}

{{% notice tip %}}
To generate a service account token please refer to the [authentication](../../../connecting/_index.md#authentication) chapter.
{{% /notice %}}

{{% notice tip %}}
[jq](https://stedolan.github.io/jq/) can be used to easily format and parse the outputs.
{{% /notice %}}
Expand Down
4 changes: 4 additions & 0 deletions docs/content/examples/REST/lifecycle/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ chapter: false

{{% toc %}}

{{% notice tip %}}
To generate a service account token please refer to the [authentication](../../../connecting/_index.md#authentication) chapter.
{{% /notice %}}

{{% notice info %}}
Lifecycle Resource APIs are supported from CVP 2022.1.1 or newer and in CloudVision-as-a-Service.
{{% /notice %}}
Expand Down
4 changes: 4 additions & 0 deletions docs/content/examples/REST/studios and workspaces/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ chapter: false

{{% toc %}}

{{% notice tip %}}
To generate a service account token please refer to the [authentication](../../../connecting/_index.md#authentication) chapter.
{{% /notice %}}

{{% notice tip %}}
[jq](https://stedolan.github.io/jq/) can be used to easily format and parse the outputs.
{{% /notice %}}
Expand Down
4 changes: 4 additions & 0 deletions docs/content/examples/REST/tag/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ chapter: false

{{% toc %}}

{{% notice tip %}}
To generate a service account token please refer to the [authentication](../../../connecting/_index.md#authentication) chapter.
{{% /notice %}}

{{% notice tip %}}
[jq](https://stedolan.github.io/jq/) can be used to easily format and parse the outputs.
{{% /notice %}}
Expand Down

0 comments on commit 5decc59

Please sign in to comment.