Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api doc #4

Merged
merged 7 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions docs/NTP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# NTP

<strong>Import OPBNOS API</strong>

```py
import opb_api as opbapi
```

<strong>Initialize client</strong>
<p>Use the appropriate JSON file that corresponds to the targetted device name. This JSON file should contain request body parameters corresponding to any potential configuration/post requests.

```py
node = opbapi.connect_to('SN2010')
```

<strong>Configure NTP server</strong>
<p>In order to configure NTP server information, the API, configNTP(), must be invoked with the server IPv4 as input parameters.
```py
node.configNTP(ip="128.123.123.123")
```
<table>
<tbody>
<thead>
<tr>
<th>Attribute</th>
<th>Values</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>ip</td>
<td>"128.XXX.XXX.XXX"</td>
<td>NTP server IPv4 value</td>
</tr>
</tbody>
</table>

<strong>Get/Show NTP server</strong>
<p> Retrieves NTP servers details

```py
node.execute(['show ntp'])
```
<strong>Output</strong>
<p> This is an example of the output of the above command:
```py
Not added yet.
```
49 changes: 49 additions & 0 deletions docs/ZTP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# ZTP

<strong>Import OPBNOS API</strong>

```py
import opb_api as opbapi
```

<strong>Initialize client</strong>
<p>Use the appropriate JSON file that corresponds to the targetted device name. This JSON file should contain request body parameters corresponding to any potential configuration/post requests.

```py
node = opbapi.connect_to('SN2010')
```

<strong>Configure ZTP</strong>
<p>In order to enable or disable ZTP, the API, configZTP(), must be invoked with dictionary input within the object, 'dt'.
```py
node.configZTP(dt = {"ztp_status":"enable | disable"})

<strong>Get/Show ZTP server</strong>
<p> Retrieves ZTP status

```py
node.execute(['show ztp status'])
```
<strong>Output</strong>
<p> This is an example of the output of the above command:
```py
b'{{"ztp-status": "disabled"}}
```
<p> The below table lists and describes input and output attributes:
<table>
<tbody>
<thead>
<tr>
<th>Attribute</th>
<th>Values</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>"ztp_status"</td>
<td>"enable|disable"</td>
<td>indicates whether ztp enable or disable on the system</td>
</tr>
</tbody>
</table>
56 changes: 56 additions & 0 deletions docs/boot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Boot

<strong>Import OPBNOS API</strong>

```py
import opb_api as opbapi
```

<strong>Initialize client</strong>
<p>Use the appropriate JSON file that corresponds to the targetted device name. This JSON file should contain request body parameters corresponding to any potential configuration/post requests.

```py
node = opbapi.connect_to('SN2010')
```

<strong>Get System Boot information</strong>

<py> : Retrieves system boot information.

```py
node.execute(['show boot'])
```
<strong>Output</strong>

```py
b'{"BootInfo": {"Next": "OPBNOS-master.192-dirty-20230831.072719", "Available": "OPBNOS-master.192-dirty-20230831.072719", "Current": "OPBNOS-master.192-dirty-20230831.072719"}}'
```

<p> The below table has a list of attributes that pertain to this particular API:
<table>
<tbody>
<thead>
<tr>
<th>Attribute</th>
<th>Values</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>"Next"</td>
<td>"OPBNOS-master.192-dirty-20230831.072719"</td>
<td>next boot device</td>
</tr>
<tr>
<td>"Available"</td>
<td>"OPBNOS-master.192-dirty-20230831.072719"</td>
<td>available boot device</td>
</tr>
<tr>
<td>"Current"</td>
<td>"OPBNOS-master.192-dirty-20230831.072719"</td>
<td>current boot device</td>
</tr>
</tbody>
</table>
51 changes: 51 additions & 0 deletions docs/clock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# System Clock

<strong>Import OPBNOS API</strong>

```py
import opb_api as opbapi
```

<strong>Initialize client</strong>
<p>Use the appropriate JSON file that corresponds to the targetted device name. This JSON file should contain request body parameters corresponding to any potential configuration/post requests.

```py
node = opbapi.connect_to('SN2010')
```

<strong>Get/Show Clock Information</strong>
<p> Retrieves system clock information

```py
node.execute(['show clock'])
```
<strong>Output</strong>
<p> This is an example of the output of the above command:
```py
b'{"currentTime": "Sat 07 Oct 2023 01:12:59 AM UTC"}'
```

<p> The below table lists and describes input and output attributes:
<table>
<tbody>
<thead>
<tr>
<th>Attribute</th>
<th>Values</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>"currentTime"</td>
<td>"Sat 07 Oct 2023 01:12:59 AM UTC"</td>
<td>indicates current server clock (time, date, day and timezone)</td>
</tr>
</tbody>
</table>

<strong>Note: Output of clock API</strong>
<p> API will not produce any output unless the below status code in produced, indicating a server error.
```py
Status : 500 -> Response : b'500'
```
78 changes: 78 additions & 0 deletions docs/counters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Counters
<p> Shows and Configures performance counters
<strong>Import OPBNOS API</strong>

```py
import opb_api as opbapi
```

<strong>Initialize client</strong>
<p>Use the appropriate JSON file that corresponds to the targetted device name. This JSON file should contain request body parameters corresponding to any potential configuration/post requests.

```py
node = opbapi.connect_to('SN2010')
```

<strong>Get/Show Interface Counters</strong>

<py>: Retrieves available performance counter

```py
node.execute(['show interface counters'])
```
<strong>Output</strong>
```py
b'{"Ethernet1_1": {"IF_IN_OCTETS": 0, "IF_IN_UCAST_PKTS": 0, "IF_IN_NON_UCAST_PKTS": 0, "IF_IN_DISCARDS": 0, "IF_IN_ERRORS": 0, "IF_OUT_OCTETS": 0, "IF_OUT_UCAST_PKTS": 0, "IF_OUT_NON_UCAST_PKTS": 0, "IF_OUT_DISCARDS": 0, "IF_OUT_ERRORS": 0, "IF_IN_MULTICAST_PKTS": 0, "IF_OUT_MULTICAST_PKTS": 0}, "Ethernet2_1":{...}...}
```

<strong>Clear Interface Counters</strong>
<p>In order to delete all interface counters, the API, configInterfacesCounters(), can be invoked with no paramters.
```py
node.configInterfacesCounters()
```

<strong>Get/Show Interface Counters - Ethernet specific</strong>
<py>: Retrieves Interface counter information as per the specified ethernet

```py
node.execute(['show interface counters <Ethernet1_1>'])
```
<strong>Output</strong>
```py
b'{"Ethernet1_1": {"IF_IN_OCTETS": 0, "IF_IN_UCAST_PKTS": 0, "IF_IN_NON_UCAST_PKTS": 0, "IF_IN_DISCARDS": 0, "IF_IN_ERRORS": 0, "IF_OUT_OCTETS": 0, "IF_OUT_UCAST_PKTS": 0, "IF_OUT_NON_UCAST_PKTS": 0, "IF_OUT_DISCARDS": 0, "IF_OUT_ERRORS": 0, "IF_IN_MULTICAST_PKTS": 0, "IF_OUT_MULTICAST_PKTS": 0}}
```

<strong>Clear Flow Counters</strong>
<p>In order to clear opb flow counters, the API, clearFlowCounters(), can be invoked with no paramters.
```py
node.clearFlowCounters(flow="flow1", r_id="1")
```
<p> The below table lists and describes input attributes:
<table>
<tbody>
<thead>
<tr>
<th>Attribute</th>
<th>Values</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>"flow"</td>
<td>"flow1"</td>
<td>flow identification</td>
</tr>
<tr>
<td>"r_id"</td>
<td>int</td>
<td>rule id number</td>
</tr>
</tbody>
</table>

<strong>Note: Output of clear APIs</strong>
<p> APIs will not produce any output unless the below status code in produced, indicating a server error.
```py
Status : 500 -> Response : b'500'
```
51 changes: 51 additions & 0 deletions docs/cpuUtil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# CPU Utilization

<strong>Import OPBNOS API</strong>

```py
import opb_api as opbapi
```

<strong>Initialize client</strong>
<p>Use the appropriate JSON file that corresponds to the targetted device name. This JSON file should contain request body parameters corresponding to any potential configuration/post requests.

```py
node = opbapi.connect_to('SN2010')
```

<strong>Get/Show CPU Utilization</strong>
<p> Retrieves system CPU utilization

```py
node.execute(['show cpu util'])
```
<strong>Output</strong>
<p> This is an example of the output of the above command:
```py
b'{"%CPU_Util": "14.249999999999998"}'
```

<p> The below table lists and describes input and output attributes:
<table>
<tbody>
<thead>
<tr>
<th>Attribute</th>
<th>Values</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>"CPU_Util"</td>
<td>float</td>
<td>indicates average CPU usage</td>
</tr>
</tbody>
</table>

<strong>Note: Output of the API</strong>
<p> API will not produce any output unless the below status code in produced, indicating a server error.
```py
Status : 500 -> Response : b'500'
```
Loading