2. API methods to add a Host
Objective
Create a host with the R81 API using the SmartConsole CLI. Use the R81 Management API guide as a reference.
Instructions
Step |
Instructions |
|||
---|---|---|---|---|
1 |
Open Chrome on the desktop and navigate to (https://203.0.113.80/api_docs) to access the API reference. |
|||
2 |
Select Network Objects > Host > add host in the navigation tree on the left side of the page. |
|||
3 |
Notice the four options for what method is used to access the API. The four methods are :
Each method is listed in the API guide. Click SmartConsole CLI: |
|||
4 |
Review the options of how to add a host using the SmartConsole CLI. Check the example at the bottom of the page :
|
|||
5 |
Move back to the SmartConsole and open Network Objects on the right side of the page. |
|||
6 |
Notice there are no hosts configured on the management server since there are no counts for hosts listed in this view. |
|||
7 |
Open the SmartConsole CLI from the left side of the SmartConsole – the icon is named Command Line.
|
|||
8 |
In the SmartConsole CLI add a host with the following : |
|||
9 |
Review the host that was added using the Networks Objects on the right side of the screen. Notice that a host is now listed on the object tree. |
|||
10 |
Now using the R81 API Guide, delete the host Task1host that was created using the SmartConsole CLI:
|
|||
11 |
Publish your changes using the publish button at the top of the SmartConsole. All changes done with the SmartConsole CLI will use the publish/ discard options from SmartConsole.
|
Objective
Create a host with the R81 API using mgmt_cli from the management server.
Use the R81 Management API guide as a reference.
Instructions
Step |
Instructions |
|||
---|---|---|---|---|
1 |
Using the R81 API Guide, review the command to add host using the mgmt_cli tool.
|
|||
2 |
Switch back to the SSH window to the R81.10 Management server , Add a host named Task2host with an ip address of 22.22.22.22:
|
|||
3 |
Next delete the host. Use the API guide as a reference for removal. This time pass the userid “api_user” to the command:
|
|||
4 |
Now run the same command to add the host, but use the following flags when running the command - “ -r true “:
|
|||
5 |
Delete the host Task2host using the mgmt_cli:
|
Objective
Learn how to use the R81 Management API to add multiple elements from a CSV file.
To use CSV we utilize a batch function in the API to add multiple elements.
Instructions
Step |
Instructions |
|||
---|---|---|---|---|
1 |
In the SSH session make sure you are in the R8X_Mgmt_Scripts directory on the management server. Use the pwd command to verify. |
|||
2 |
Review the hosts.csv file by running the command :
|
|||
3 |
Review the SmartConsole and see the new hosts that were created : |
|||
4 |
Overlay the SSH session on top of the SmartConsole so you can see the hosts on the right of SmartConsole. Watch the objects lock and disappear when the following command is run to remove the objects:
|