From 71ee32e3a1ac96be4ca3364d0a0c6e8666f4278c Mon Sep 17 00:00:00 2001 From: Harrish <108512835+sj-harrish@users.noreply.github.com> Date: Wed, 11 Oct 2023 10:08:05 +0530 Subject: [PATCH] added new doc files --- docs/NTP.md | 2 +- docs/ZTP.md | 7 ++-- docs/boot.md | 56 +++++++++++++++++++++++++++ docs/clock.md | 51 +++++++++++++++++++++++++ docs/counters.md | 52 +++++++++++++++++++------ docs/cpuUtil.md | 51 +++++++++++++++++++++++++ docs/memUtil.md | 51 +++++++++++++++++++++++++ docs/reboot.md | 28 ++++++++++++++ docs/tacacs.md | 98 ++++++++++++++++++++++++++++++++++++++++++++++++ docs/timezone.md | 39 +++++++++++++++++++ docs/uptime.md | 45 ++++++++++++++++++++++ mkdocs.yml | 10 +++++ 12 files changed, 475 insertions(+), 15 deletions(-) create mode 100644 docs/boot.md create mode 100644 docs/clock.md create mode 100644 docs/cpuUtil.md create mode 100644 docs/memUtil.md create mode 100644 docs/reboot.md create mode 100644 docs/tacacs.md create mode 100644 docs/timezone.md create mode 100644 docs/uptime.md diff --git a/docs/NTP.md b/docs/NTP.md index fe7b61f..934b35e 100644 --- a/docs/NTP.md +++ b/docs/NTP.md @@ -16,7 +16,7 @@ node = opbapi.connect_to('SN2010') Configure NTP server

In order to configure NTP server information, the API, configNTP(), must be invoked with the server IPv4 as input parameters. ```py -node.configSNMPcomm(ip="128.123.123.123") +node.configNTP(ip="128.123.123.123") ``` diff --git a/docs/ZTP.md b/docs/ZTP.md index aded204..6efcb8a 100644 --- a/docs/ZTP.md +++ b/docs/ZTP.md @@ -14,9 +14,10 @@ node = opbapi.connect_to('SN2010') ``` Configure ZTP -

In order to configure ZTP enable or disable, the API, configZTP(), must be invoked with dictionary input within the object, 'dt'. +

In order to enable or disable ZTP, the API, configZTP(), must be invoked with dictionary input within the object, 'dt'. ```py -node.configZTP("ztp_status": "enable | disable") +node.configZTP(dt = {"ztp_status":"enable | disable"}) + Get/Show ZTP server

Retrieves ZTP status @@ -40,7 +41,7 @@ b'{{"ztp-status": "disabled"}}

- + diff --git a/docs/boot.md b/docs/boot.md new file mode 100644 index 0000000..8b78527 --- /dev/null +++ b/docs/boot.md @@ -0,0 +1,56 @@ +# Boot + +Import OPBNOS API + +```py +import opb_api as opbapi +``` + +Initialize client +

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') +``` + +Get System Boot information + + : Retrieves system boot information. + +```py +node.execute(['show boot']) +``` +Output + +```py +b'{"BootInfo": {"Next": "OPBNOS-master.192-dirty-20230831.072719", "Available": "OPBNOS-master.192-dirty-20230831.072719", "Current": "OPBNOS-master.192-dirty-20230831.072719"}}' +``` + +

The below table has a list of attributes that pertain to this particular API: +

"ztp_status"ztp_status" "enable|disable" indicates whether ztp enable or disable on the system
+ + + + + + + + + + + + + + + + + + + + + + + + + +
AttributeValuesDescription
"Next""OPBNOS-master.192-dirty-20230831.072719"next boot device
"Available""OPBNOS-master.192-dirty-20230831.072719"available boot device
"Current""OPBNOS-master.192-dirty-20230831.072719"current boot device
diff --git a/docs/clock.md b/docs/clock.md new file mode 100644 index 0000000..87cbdb6 --- /dev/null +++ b/docs/clock.md @@ -0,0 +1,51 @@ +# System Clock + +Import OPBNOS API + +```py +import opb_api as opbapi +``` + +Initialize client +

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') +``` + +Get/Show Clock Information +

Retrieves system clock information + +```py +node.execute(['show clock']) +``` +Output +

This is an example of the output of the above command: +```py +b'{"currentTime": "Sat 07 Oct 2023 01:12:59 AM UTC"}' +``` + +

The below table lists and describes input and output attributes: + + + + + + + + + + + + + + + + +
AttributeValuesDescription
"currentTime""Sat 07 Oct 2023 01:12:59 AM UTC"indicates current server clock (time, date, day and timezone)
+ +Note: Output of clock API +

API will not produce any output unless the below status code in produced, indicating a server error. +```py +Status : 500 -> Response : b'500' +``` diff --git a/docs/counters.md b/docs/counters.md index 1a619db..59cc9ce 100644 --- a/docs/counters.md +++ b/docs/counters.md @@ -22,27 +22,57 @@ node.execute(['show interface counters']) ``` Output ```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":{...}...} ``` -Get/Show SNMP Trap -: Retrieves SNMP traps +Clear Interface Counters +

In order to delete all interface counters, the API, configInterfacesCounters(), can be invoked with no paramters. +```py +node.configInterfacesCounters() +``` + +Get/Show Interface Counters - Ethernet specific +: Retrieves Interface counter information as per the specified ethernet ```py -node.execute(['show snmp-trap']) +node.execute(['show interface counters ']) ``` Output ```py -b'{"1": {"DestPort": "161","v2TrapDest": "Null","DestIp": "10.4.4.11","vrf": "None","Community": "public"}} +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}} ``` - : The API, configReboot(), reboots the system by accepting dictionary request body input to indicate authorization. +Clear Flow Counters +

In order to clear opb flow counters, the API, clearFlowCounters(), can be invoked with no paramters. ```py -node.configReboot(dt={"reboot":"yes"}) +node.clearFlowCounters(flow="flow1", r_id="1") ``` -Output -

Note: Client will receive the below status codes for both deleting funtions to indicate a successful request. +

The below table lists and describes input attributes: + + + + + + + + + + + + + + + + + + + + + +
AttributeValuesDescription
"flow""flow1"flow identification
"r_id"intrule id number
+ +Note: Output of clear APIs +

APIs will not produce any output unless the below status code in produced, indicating a server error. ```py -Status : 200 -> Response : b'200' +Status : 500 -> Response : b'500' ``` -

The status code '500' indicates a server error. diff --git a/docs/cpuUtil.md b/docs/cpuUtil.md new file mode 100644 index 0000000..aa01490 --- /dev/null +++ b/docs/cpuUtil.md @@ -0,0 +1,51 @@ +# CPU Utilization + +Import OPBNOS API + +```py +import opb_api as opbapi +``` + +Initialize client +

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') +``` + +Get/Show CPU Utilization +

Retrieves system CPU utilization + +```py +node.execute(['show cpu util']) +``` +Output +

This is an example of the output of the above command: +```py +b'{"%CPU_Util": "14.249999999999998"}' +``` + +

The below table lists and describes input and output attributes: + + + + + + + + + + + + + + + + +
AttributeValuesDescription
"CPU_Util"floatindicates average CPU usage
+ +Note: Output of the API +

API will not produce any output unless the below status code in produced, indicating a server error. +```py +Status : 500 -> Response : b'500' +``` diff --git a/docs/memUtil.md b/docs/memUtil.md new file mode 100644 index 0000000..202c3f2 --- /dev/null +++ b/docs/memUtil.md @@ -0,0 +1,51 @@ +# Memory Utilization + +Import OPBNOS API + +```py +import opb_api as opbapi +``` + +Initialize client +

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') +``` + +Get/Show Memory Utilization +

Retrieves system memory utilization + +```py +node.execute(['show memory utilisation']) +``` +Output +

This is an example of the output of the above command: +```py +b'{"%MEM_Util": "13.5"}' +``` + +

The below table lists and describes input and output attributes: + + + + + + + + + + + + + + + + +
AttributeValuesDescription
"MEM_Util"floatindicates memory usage
+ +Note: Output of the API +

API will not produce any output unless the below status code in produced, indicating a server error. +```py +Status : 500 -> Response : b'500' +``` diff --git a/docs/reboot.md b/docs/reboot.md new file mode 100644 index 0000000..1d083d0 --- /dev/null +++ b/docs/reboot.md @@ -0,0 +1,28 @@ +# Reboot +

Initiates Device Reboot +Import OPBNOS API + +```py +import opb_api as opbapi +``` + +Initialize client +

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') +``` + +Device Reboot + + : The API, configReboot(), reboots the system by accepting dictionary request body input to indicate authorization. + +```py +node.configReboot(dt={"reboot":"yes"}) +``` +Output +

Note: Client will receive the below status codes for both deleting funtions to indicate a successful request. +```py +Status : 200 -> Response : b'200' +``` +

The status code '500' indicates a server error. diff --git a/docs/tacacs.md b/docs/tacacs.md new file mode 100644 index 0000000..970bf2a --- /dev/null +++ b/docs/tacacs.md @@ -0,0 +1,98 @@ +# TACACS + +**Import OPBNOS API** + +```py +import opb_api as opbapi +``` + +**Initialize client** +

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') +``` + +Configure TACACS Server +

In order to configure TACACS server information, the API, configTACACS(), must be invoked with input parameter, 'dt'. 'dt' accepts all request body inputs in a dictionary format. +```py +node.configTACACS(dt = {"host": "10.4.4.11","timeout": 8,"priority": 1,"auth_type": "pap","passkey": "support"}) +``` +

The below table has a list of attributes that pertain to this particular API: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AttributeValuesDescription
"host""10.X.X.XX"host id
"timeout"intindicates timeout value
"priority"intindicates priority
"auth_type""pap"indicates authorization type (password authorization protocol)
"passkey""support"server user credential string
+ +Configure TACACS Global Server +

In order to configure port information, the API, configTACACSglobal(), must be invoked with input parameter, 'dt'. 'dt' accepts all request body inputs in a dictionary format. +```py +node.configTACACS(dt = {"auth_type": "pap","timeout": 8,"passkey": "support"}) +``` +

The below table has a list of attributes that pertain to this particular API: + + + + + + + + + + + + + + + + + + + + + + + + + + +
AttributeValuesDescription
"auth_type""pap"indicates authorization type (password authorization protocol)
"timeout"intindicates timeout value
"passkey""support"server user credential string
+ +Note: Output of APIs +

APIs will not produce any output unless the below status code in produced, indicating a server error. +```py +Status : 500 -> Response : b'500' +``` diff --git a/docs/timezone.md b/docs/timezone.md new file mode 100644 index 0000000..2134e8d --- /dev/null +++ b/docs/timezone.md @@ -0,0 +1,39 @@ +# Timezone + +Import OPBNOS API + +```py +import opb_api as opbapi +``` + +Initialize client +

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') +``` + +Configure Timezone +

In order to configure SNMP community information, the API, configSNMPcomm(), must be invoked with appropriate parameters in dictionary format within the parameter 'dt'. +```py +node.configTimezone(dt = {"timezone": "Asia/Kolkata"}) +``` + +

The below table lists and describes input attributes: + + + + + + + + + + + + + + + + +
AttributeValuesDescription
"timezone""Asia/Kolkata"indicates preferred timezone
diff --git a/docs/uptime.md b/docs/uptime.md new file mode 100644 index 0000000..c764ff9 --- /dev/null +++ b/docs/uptime.md @@ -0,0 +1,45 @@ +# System Uptime + +Import OPBNOS API + +```py +import opb_api as opbapi +``` + +Initialize client +

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') +``` + +Get/Show System Uptime +

Retrieves system uptime + +```py +node.execute(['show uptime']) +``` +Output +

This is an example of the output of the above command: +```py +b'{"uptime": "01:05:51 up 26 days, 20:09, 2 users, load average: 0.54, 0.50, 0.51"}' +``` + +

The below table lists and describes input and output attributes: + + + + + + + + + + + + + + + + +
AttributeValuesDescription
"uptime""01:05:51 up 26 days, 20:09, 2 users, load average: 0.54, 0.50, 0.51"indicates system uptime information
diff --git a/mkdocs.yml b/mkdocs.yml index c907b1e..1fd3ec2 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -31,3 +31,13 @@ nav: - NTP: NTP.md - ZTP: ZTP.md - SNMP: snmp.md + - Time: + - Timezone: timezone.md + - Uptime: uptime.md + - Clock: clock.md + - Utilization: + - CPU Util: cpuUtil.md + - Memory Util: memUtil.md + - System: + - Boot Info: boot.md + - reboot: reboot.md