From 9971a50cab06c4272046bc0786cc8150804b5d4b Mon Sep 17 00:00:00 2001 From: Alex Terrell Date: Thu, 7 May 2020 10:47:46 -0600 Subject: [PATCH] Fixed typo in homebrew instructions --- ... SDK 3.0 Application Developers Guide.html | 6898 ++++------------- 1 file changed, 1296 insertions(+), 5602 deletions(-) diff --git a/Cradlepoint NCOS SDK 3.0 Application Developers Guide.html b/Cradlepoint NCOS SDK 3.0 Application Developers Guide.html index 0de324fc..045a661a 100644 --- a/Cradlepoint NCOS SDK 3.0 Application Developers Guide.html +++ b/Cradlepoint NCOS SDK 3.0 Application Developers Guide.html @@ -1,3749 +1,187 @@ - + - - - - - - - - + - + - +

Cradlepoint NCOS SDK 3.0 -Application Developers Guide

+12.0pt;margin-left:0in;background:white'>Cradlepoint NCOS SDK 3.0 +Application Developers Guide

Introduction

+12.0pt;margin-left:0in;background:white'>Introduction

Cradlepoint’s NetCloud OS (NCOS) SDK provides the ability to -customize the functionality of Cradlepoint devices with applications written in -Python. Python applications written with the SDK are securely downloaded to the -device and enabled using NetCloud Manager (NCM). Cradlepoint’s -SDK allows for extending and enhancing the functionality of Cradlepoint -devices, FOG computing, and managing IoT devices.

+12.0pt;margin-left:0in;background:white'>Cradlepoint’s NetCloud OS (NCOS) +SDK provides the ability to customize the functionality of Cradlepoint devices +with applications written in Python. Python applications written with the SDK +are securely downloaded to the device and enabled using NetCloud Manager (NCM). +Cradlepoint’s SDK allows for extending and enhancing the functionality of +Cradlepoint devices, FOG computing, and managing IoT devices.

Supported -Functionality

+12.0pt;margin-left:0in;background:white'>Supported +Functionality

For the scope of this document, NetCloud OS (NCOS) Apps are -limited to the non-privileged Python scripts. Supported functionality includes -the following:

+font-family:"Arial",sans-serif;color:black'>For the scope of this document, +NetCloud OS (NCOS) Apps are limited to the non-privileged Python scripts. +Supported functionality includes the following:

·       Standard TCP/UDP/SSL socket servers -function on ports higher than 1024.

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       Standard +TCP/UDP/SSL socket servers function on ports higher than 1024.

·       Standard TCP/UDP/SSL socket client to other -devices (or the device as 127.0.0.1/localhost).

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       Standard +TCP/UDP/SSL socket client to other devices (or the device as +127.0.0.1/localhost).

·       Access to serial ports via the PySerial module, including native and USB-serial ports.

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       Access to +serial ports via the PySerial module, including native and USB-serial ports.

·       Ability to PING external devices.

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       Ability to +PING external devices.

·       UI Extensibility (i.e. Hot Spot splash page or -other UI WEB pages)

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       UI +Extensibility (i.e. Hot Spot splash page or other UI WEB pages)

·       Access to the NCOS API (aka: status and control -tree data).

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       Access to +the NCOS API (aka: status and control tree data).

·       USB Memory device file access.

- -

What is not Supported

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       USB Memory +device file access.

+ +

What is not +Supported

·       Any form of natively-compiled -or kernel-linked code (.pyc, .so files)

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       Any form of +natively-compiled or kernel-linked code (.pyc, .so files)

·       Any function requiring privileged (or root) -permissions.

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       Any function +requiring privileged (or root) permissions.

Application Support

+12.0pt;margin-left:0in;background:white'>Application +Support

Please refer to the Please refer to the SDK Support Statement.
+color:#015BA7'>SDK Support Statement
.

Cradlepoint publishes and supports the SDK toolkit for customers and partners to build their own applications. Cradlepoint neither develops any custom SDK @@ -3758,43 +196,34 @@
NCOS SDK Applications can introduce security and other potential issues when not carefully engineered. Test your code thoroughly before deploying it to -production devices.

+production devices.

Application -Development

+12.0pt;margin-left:0in;background:white'>Application +Development

For ease of development and debugging, an application can be -directly installed into a device that has been placed into Developer Mode. Once -the application is fully debugged and ready for deployment, it can be installed -via NCM at the group level.

+font-family:"Arial",sans-serif;color:black'>For ease of development and +debugging, an application can be directly installed into a device that has been +placed into Developer Mode. Once the application is fully debugged and ready +for deployment, it can be installed via NCM at the group level.

SDK Toolset

+12.0pt;margin-left:0in;background:white'>SDK +Toolset

Cradlepoint has a simplified SDK, written in Python, that builds -and creates an app package. The SDK, along with sample applications, is located -in the Cradlepoint has a simplified SDK, +written in Python, that builds and creates an app package. The SDK, along with +sample applications, is located in the Cradlepoint SDK GitHub repository.
+style='font-size:9.0pt;font-family:"Arial",sans-serif;color:#015BA7'>Cradlepoint +SDK GitHub repository
.

For app development, the SDK is used to install, start, stop, uninstall, and check the status of an application in a locally-connected development device. @@ -3802,2381 +231,1646 @@ for production deployment. Application development can be done on Linux, OS X, and Windows operating systems with the same SDK.

-This document is specifically written for SDK version 3.0 and above.

+This document is specifically written for SDK version 3.0 and above.

Developer Community

+12.0pt;margin-left:0in;background:white'>Developer +Community

Cradlepoint has a Developer Community Portal

+font-family:"Arial",sans-serif;color:black'>Cradlepoint has a Developer +Community Portal

Cradlepoint Knowledge -Base

+12.0pt;margin-left:0in;background:white'>Cradlepoint +Knowledge Base

Our Customer Community has articles related to the SDK, as well -as forums to leverage knowledge, share, and collaborate with other developers. -This forum is actively monitored by Cradlepoint to answer your questions.

+font-family:"Arial",sans-serif;color:black'>Our Customer +Community has articles related to the SDK, as well as forums to +leverage knowledge, share, and collaborate with other developers. This forum is +actively monitored by Cradlepoint to answer your questions.

NCOS Python -Environment

+12.0pt;margin-left:0in;background:white'>NCOS +Python Environment

NCOS application are written in Python. However, for storage space -and security purposes, the NCOS Python environment is a subset of a typical -Python installation on a computer. A list of the installed Python modules in an -NCOS device is available by installing and running the sample app named “python_module_list” that is included with the SDK sample -apps. The “python_module_list” application writes the -names of the installed Python modules on a device to that device’s log.
+font-family:"Arial",sans-serif;color:black'>NCOS application are written in +Python. However, for storage space and security purposes, the NCOS Python +environment is a subset of a typical Python installation on a computer. A list +of the installed Python modules in an NCOS device is available by installing +and running the sample app named “python_module_list” that is included with the +SDK sample apps. The “python_module_list” application writes the names of the +installed Python modules on a device to that device’s log.

New Python files can be added to your application, but their dependencies must also adhere to the NCOS Python environment. These new Python files/modules can be copied to the main application directory or can be installed using pip. If -pip is used, any 'egg' or 'dist' directories can be -deleted. They are not required for functionality and will just use up memory -unnecessarily when installed into the NCOS device.
+pip is used, any 'egg' or 'dist' directories can be deleted. They are not +required for functionality and will just use up memory unnecessarily when +installed into the NCOS device.

-Example pip command:

+Example pip command:

-

pip(3) install --ignore-install --target=<path to application -directory> <module name>

+

pip(3) install --ignore-install +--target=<path to application directory> <module name>


+font-family:"Arial",sans-serif;color:black'>
Note: Use pip on Windows and pip3 on Linux or OS X.

Environment

+12.0pt;margin-left:0in;background:white'>Environment

Use the following sections to set up your development environment -to work with the Cradlepoint SDK.

+font-family:"Arial",sans-serif;color:black'>Use the following sections to set +up your development environment to work with the Cradlepoint SDK.

Computer Setup -Instructions

+12.0pt;margin-left:0in;background:white'>Computer +Setup Instructions

Download the SDK and sample apps from Download the SDK and sample apps +from https://github.com/cradlepoint/sdk-samples. Below are the setup instructions for:

+style='font-size:9.0pt;font-family:"Arial",sans-serif;color:#015BA7'>https://github.com/cradlepoint/sdk-samples. Below are +the setup instructions for:

·       -·       Linux 

+color:#015BA7'>Linux 

·       -·       OS X

+color:#015BA7'>OS X

·       -·       Windows

+color:#015BA7'>Windows

Note: Command line commands must be performed in the order they -appear.

+font-family:"Arial",sans-serif;color:black'>Note: Command line commands must be +performed in the order they appear.

Linux

+12.0pt;margin-left:0in;background:white'>Linux

1.     -Install Python 3.7 or -newer from 1.     Install +Python 3.7 or newer from python.org.

+font-family:"Arial",sans-serif;color:#015BA7'>python.org.

2.     -Add Linux development -libraries by using the following commands:

- -

sudo apt-get install libffi-dev

- -

sudo apt-get install libssl-dev

- -

sudo apt-get install sshpass

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>2.     Add Linux +development libraries by using the following commands:

+ +

sudo apt-get +install libffi-dev

+ +

sudo apt-get +install libssl-dev

+ +

sudo apt-get +install sshpass

3.     -Install Python libraries -by using the following commands.

+0in;margin-left:30.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>3.     Install +Python libraries by using the following commands.

-

sudo apt-get install python3-pip

+

sudo apt-get +install python3-pip

-

pip3 install requests

+

pip3 install +requests

-

pip3 install pyopenssl

+

pip3 install +pyopenssl

-

pip3 install -cryptography

+

pip3 install +cryptography

Useful tools

+12.0pt;margin-left:0in;background:white'>Useful tools

PyCharm (community version is free): PyCharm (community version is +free): https://www.jetbrains.com/pycharm/download/#section=linux.

+style='font-size:9.0pt;font-family:"Arial",sans-serif;color:#015BA7'>https://www.jetbrains.com/pycharm/download/#section=linux.

Mac OS X

+12.0pt;margin-left:0in;background:white'>Mac OS X

1.     -Install Python 3.7 or -newer from 1.     Install +Python 3.7 or newer from python.org.

+font-family:"Arial",sans-serif;color:#015BA7'>python.org.

2.     -Install HomeBrew for package updates by using the following -commands:

- -

/usr/bin/ruby --e "$(curl -fsSL 2.     Install +HomeBrew for package updates by using the following commands:

+ +

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&quot;

+color:#015BA7'>https://raw.githubusercontent.com/Homebrew/install/master/install)”

3.     -Install these required -libraries by using the following commands:

- -

brew install openssl

- -

brew install http://git.io/sshpass.rb

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>3.     Install +these required libraries by using the following commands:

+ +

brew install +openssl

+ +

brew install http://git.io/sshpass.rb

4.     -Install the Python -libraries by using the following commands:

+0in;margin-left:30.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>4.     Install the +Python libraries by using the following commands:

-

pip3 install -U pip

+

pip3 install -U +pip

-

pip3 install requests

+

pip3 install +requests

-

pip3 install pyopenssl

+

pip3 install +pyopenssl

-

pip3 install -cryptography

+

pip3 install +cryptography

Useful tools

+12.0pt;margin-left:30.0pt;background:white'>Useful tools

·       PyCharm (community version is free): ·       PyCharm +(community version is free): https://www.jetbrains.com/pycharm/download/#section=macOS.

+style='font-size:9.0pt;font-family:"Arial",sans-serif;color:#015BA7'>https://www.jetbrains.com/pycharm/download/#section=macOS.

Windows

+12.0pt;margin-left:0in;background:white'>Windows

1.     -Install Python 3.7 or -newer from 1.     Install +Python 3.7 or newer from https://www.python.org/downloads/windows/.

+style='font-size:9.0pt;font-family:"Arial",sans-serif;color:#015BA7'>https://www.python.org/downloads/windows/.

2.     -The SDK requires OpenSSL -tools to generate digital signatures. Go to https://slproweb.com/products/Win32OpenSSL.html and download the 'Light' version based on -your machine (i.e. Win64 or Win32). Run the executable after it is downloaded -to install OpenSSL.

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>2.     The SDK +requires OpenSSL tools to generate digital signatures. Go to https://slproweb.com/products/Win32OpenSSL.html and +download the 'Light' version based on your machine (i.e. Win64 or Win32). Run +the executable after it is downloaded to install OpenSSL.

3.     -Open a terminal window -and use the following commands to install the Python libraries.

- -

python -m pip install -U -pip

- -

python -m pip install pyserial

- -

python -m pip install -requests

- -

python -m pip install pyopenssl

- -

Useful tools

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>3.     Open a +terminal window and use the following commands to install the Python libraries.

+ +

python -m pip +install -U pip

+ +

python -m pip +install pyserial

+ +

python -m pip +install requests

+ +

python -m pip +install pyopenssl

+ +

Useful tools

·       Putty: http://www.putty.org/

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       Putty: http://www.putty.org/

·       PyCharm (community version is free): ·       PyCharm +(community version is free): https://www.jetbrains.com/pycharm/download/#section=windows.

+color:#015BA7'>https://www.jetbrains.com/pycharm/download/#section=windows.

·       7-zip: http://www.7-zip.org/

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       7-zip: http://www.7-zip.org/

·       MarkdownPadhttp://markdownpad.com/

- -

Development

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       MarkdownPad: http://markdownpad.com/

+ +

Development

Use the following sections to learn about how Cradlepoint SDK apps -are structured and how to build and debug your own SDK app.

+font-family:"Arial",sans-serif;color:black'>Use the following sections to learn +about how Cradlepoint SDK apps are structured and how to build and debug your +own SDK app.

NCOS SDK Directory -Structure

+12.0pt;margin-left:0in;background:white'>NCOS SDK +Directory Structure

Below is the directory structure for the SDK and sample -applications. The BOLD items are modified or created by the -developer. The other files are used by the SDK or are referenced by the other -files.

+font-family:"Arial",sans-serif;color:black'>Below is the directory structure +for the SDK and sample applications. The BOLD items are +modified or created by the developer. The other files are used by the SDK or +are referenced by the other files.

·       sdk-samples-master (directory)

+0in;margin-left:30.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>·       sdk-samples-master +(directory)

·       app_template_csclient (directory for the application)

+12.0pt;margin-left:60.0pt;text-indent:-.25in;background:white'>·       app_template_csclient (directory +for the application)

·       tools (directory)

+12.0pt;margin-left:60.0pt;text-indent:-.25in;background:white'>·       tools +(directory)

·       bin (directory)

+12.0pt;margin-left:1.25in;text-indent:-.25in;background:white'>·       bin +(directory)

·       package_application.py - Used by SDK.

+12.0pt;margin-left:120.0pt;text-indent:-.25in;background:white'>·       package_application.py +- Used by SDK.

·       validate_application.py - Used by SDK.

+12.0pt;margin-left:120.0pt;text-indent:-.25in;background:white'>·       validate_application.py +- Used by SDK.

·       pscp.exe - An executable use on Windows by the -SDK.

+12.0pt;margin-left:120.0pt;text-indent:-.25in;background:white'>·       pscp.exe - +An executable use on Windows by the SDK.

·       sdk_setting.ini - Used by the SDK and contains the -settings for building the app and connecting to the local NCOS device.

+12.0pt;margin-left:60.0pt;text-indent:-.25in;background:white'>·       sdk_setting.ini - Used +by the SDK and contains the settings for building the app and connecting to the +local NCOS device.

·       make.py – Python script used by the SDK to build -and install apps and check app status.

+12.0pt;margin-left:60.0pt;text-indent:-.25in;background:white'>·       make.py – +Python script used by the SDK to build and install apps and check app status.

·       NCOS_SDK_Application_Development_Guide.html

+12.0pt;margin-left:60.0pt;text-indent:-.25in;background:white'>·       NCOS_SDK_Application_Development_Guide.html

·       NCOS_APIs_for_Applications.html

+12.0pt;margin-left:60.0pt;text-indent:-.25in;background:white'>·       NCOS_APIs_for_Applications.html

Based on the sdk_setting.ini file, the make.py script builds all -files located in the app_name directory +font-family:"Arial",sans-serif;color:black'>Based on the sdk_setting.ini file, +the make.py script builds all files located in the app_name directory into a tar.gz package that can then been installed into the device. This installation is performed either directly into the device (if in -DEV mode) or via NCM for grouped devices.

+DEV mode) or via NCM for grouped devices.

Application Package -Anatomy

+12.0pt;margin-left:0in;background:white'>Application +Package Anatomy

An NCOS application package, which is a tar.gz archive, -consists of a set of files that includes the Python script, start/stop scripts, -initialization files, along with manifest and signature files. This package of -files is built by the SDK based on the sdk_settings.ini. Some of these files, -like the manifest and signature files, are created by the make.py tool. Others -are created by the application developer. Below are the example contents for -a tar.gz archive created for a NCOS application. The BOLD items -are modified or created by the developer. The other files are used by the SDK -or are referenced by the other files.

+font-family:"Arial",sans-serif;color:black'>An NCOS application package, which +is a tar.gz archive, consists of a set of files that includes +the Python script, start/stop scripts, initialization files, along with +manifest and signature files. This package of files is built by the SDK based +on the sdk_settings.ini. Some of these files, like the manifest and signature +files, are created by the make.py tool. Others are created by the application +developer. Below are the example contents for a tar.gz archive +created for a NCOS application. The BOLD items are modified or +created by the developer. The other files are used by the SDK or are referenced +by the other files.

·       app_template_csclient (directory)

+0in;margin-left:30.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>·       app_template_csclient (directory)

·       METADATA (directory)

+0in;margin-left:60.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>·       METADATA +(directory)

·       MANIFEST.json - Contains a file list along with hash -signatures and other app the package initialization data.

+margin-left:1.25in;margin-bottom:.0001pt;text-indent:-.25in;background:white'>·       MANIFEST.json +- Contains a file list along with hash signatures and other app the package +initialization data.

·       SIGNATURE.DS - A signature file for the app -package.

+margin-left:1.25in;margin-bottom:.0001pt;text-indent:-.25in;background:white'>·       SIGNATURE.DS +- A signature file for the app package.

·       app_template_csclient.py - The application Python file.

+0in;margin-left:60.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>·       app_template_csclient.py - The +application Python file.

·       csclient.py - Python file containing the EventingCSClient() -class, with methods for interacting with the NCOS API.

+0in;margin-left:60.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>·       csclient.py +- Python file containing the EventingCSClient() class, with methods for +interacting with the NCOS API.

·       package.ini – Package and app settings.

+0in;margin-left:60.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>·       package.ini – +Package and app settings.

·       start.sh - The script run when the app is started.

+0in;margin-left:60.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>·       start.sh - The +script run when the app is started.

·       stop.sh - The script run when the app is stopped. This is not -required unless one needs a specific action preformed when the application is -stopped.

+0in;margin-left:60.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>·       stop.sh - The +script run when the app is stopped. This is not required unless one needs a specific +action preformed when the application is stopped.

csclient.py

+font-family:"Arial",sans-serif;color:black'>csclient.py

A python file containing the EventingCSClient() class with methods for interacting with the NCOS API.

+font-family:"Arial",sans-serif;color:black'>A python file containing the +EventingCSClient() class with methods for interacting with the NCOS API.

Import the class and instantiate it by passing the string name of -your app as the only argument.  The app -name is used to identify the app when writing logs or sending custom alerts.  In the below example, the EventingCSClient() class is -instantiated as “cp” for simplified syntax:

+font-family:"Arial",sans-serif;color:black'>Import the class and instantiate it +by passing the string name of your app as the only argument.  The app name is +used to identify the app when writing logs or sending custom alerts.  In the +below example, the EventingCSClient() class is instantiated as “cp” for +simplified syntax:

from csclient import EventingCSClient

+font-family:"Arial",sans-serif;color:black'>from csclient import +EventingCSClient

cp = EventingCSClient(‘app_template_csclient’)

+font-family:"Arial",sans-serif;color:black'>cp = EventingCSClient(‘app_template_csclient’)

The EventingCSClient() class, now instantiated as cp, has the following methods -for interacting with the NCOS API:

- -

·       .log() – writes an info level system log

- -

·       Accepts log text (string)

- -

·       Usage example:

- -

cp.log(‘This is my log text!’)

+font-family:"Arial",sans-serif;color:black'>The EventingCSClient() class, now +instantiated as cp, has the following methods for interacting with the NCOS +API:

+ +

·       +.log() – writes an info level system log

+ +

Accepts log +text (string)

+ +

Usage +example:

+ +

cp.log(‘This is my log text!’)

01:43:33 PM INFO My_App -This is my log text!

- -

·       .get() – gets a value from the NCOS API

- -

·       Accepts NCOS Path (string)

- -

·       Returns requested value (no need to specify -“data” key)

- -

·       Usage example – get system ID and log it:

- -

system_id = cp.get('config/system/system_id’)

+style='font-size:9.0pt;font-family:"Arial",sans-serif;color:black'>01:43:33 PM +INFO My_App This is my log text!

+ +

·       +.get() – gets a value from the NCOS API

+ +

Accepts NCOS +Path (string)

+ +

Returns +requested value (no need to specify “data” key)

+ +

Usage +example – get system ID and log it:

+ +

system_id = cp.get('config/system/system_id’)

cp.log(system_id)

+font-family:"Arial",sans-serif;color:black'>cp.log(system_id)

11:22:17 AM INFO my_app -AER2200-AER

- -

·       .put() – put a value to the NCOS API path

- -

·       Accepts a path (string) and payload (accepts -JSON) and puts the payload in the path

- -

·       Usage example – set system ID:

- -

cp.put(‘config/system/system_id’, -‘MyRouter’)

- -

·       .alert() – Sends a custom NCM alert

- -

·       Accepts alert text (string)

- -

·       Usage example:

- -

cp.alert(‘This is my alert text!’)

+style='font-size:9.0pt;font-family:"Arial",sans-serif;color:black'>11:22:17 AM +INFO my_app AER2200-AER

+ +

·       +.put() – put a value to the NCOS API path

+ +

·       +Accepts a path (string) and payload (accepts JSON) and puts the +payload in the path

+ +

·       +Usage example – set system ID:

+ +

cp.put(‘config/system/system_id’, +‘MyRouter’)

+ +

·       +.alert() – Sends a custom NCM alert

+ +

Accepts +alert text (string)

+ +

Usage +example:

+ +

cp.alert(‘This is my alert text!’)

Cradlepoint NetCloud: Custom Alert

+font-family:"Arial",sans-serif;color:black'>Cradlepoint NetCloud: Custom Alert

Alert Name         Custom -Alert

+font-family:"Arial",sans-serif;color:black'>Alert Name         Custom Alert

Description         app_template_csclient This is my alert text!

+font-family:"Arial",sans-serif;color:black'>Description         app_template_csclient +This is my alert text!

MAC Address     00:30:44:36:57:B1

+font-family:"Arial",sans-serif;color:black'>MAC Address     00:30:44:36:57:B1

Device Name      TLAB 900

+font-family:"Arial",sans-serif;color:black'>Device Name      TLAB 900

Group Name      

+font-family:"Arial",sans-serif;color:black'>Group Name      

Timestamp         2020-02-14 -15:10:12 MST

- -

·       .post() create a new list item -in the NCOS API

- -

·       Accepts a path (string) and payload (JSON) and -creates a new list item.

- -

·       Usage example – add a user:

- -

cp.post('config/system/users', {'username': ‘MyUser’, 'password': ‘MyPass’, -'group': 'admin'})

- -

·       .delete() – delete a value from the NCOS API

- -

·       Accepts a path (string) to a value to delete

- -

·       Usage example – delete a LAN (default guestLAN):

- -

cp.delete(‘config/lan/1’)

- -

·       .register() – register a function for callback on an API value change

- -

·       A callback is a “push” function where you tell -NCOS to call your function when a specific API value changes.  The path and value are passed to your -function to be handled as necessary.

- -

·       Requires the following 3 positional arguments -(action, path, function):

- -

·       action or method (string) such as ‘put’

- -

·       path to the value (string)

- -

·       function to call – do not include parenthesis.  When the path receives the action, -it will call your function and pass the path and value to -it.

+font-family:"Arial",sans-serif;color:black'>Timestamp         2020-02-14 +15:10:12 MST

+ +

·       +.post() create a new list item in the NCOS +API

+ +

Accepts a +path (string) and payload (JSON) and creates a new list item.

+ +

Usage +example – add a user:

+ +

cp.post('config/system/users', +{'username': ‘MyUser’, 'password': ‘MyPass’, 'group': 'admin'})

+ +

·       +.delete() – delete a value from the NCOS API

+ +

Accepts a +path (string) to a value to delete

+ +

Usage +example – delete a LAN (default guestLAN):

+ +

cp.delete(‘config/lan/1’)

+ +

·       +.register() – register a function for callback on an API +value change

+ +

A callback +is a “push” function where you tell NCOS to call your function when a specific +API value changes.  The path and value are passed to your function to be +handled as necessary.

+ +

Requires the +following 3 positional arguments (action, path, function):

+ +

·       +action or method (string) such as ‘put’

+ +

·       +path to the value (string)

+ +

·       +function to call – do not include parenthesis.  When the path +receives the action, it will call your function and pass the path +and value to it.

 

+font-family:"Arial",sans-serif;color:black'> 

·       Usage example – call a function when the primary -WAN device changes:

+12.0pt;margin-left:0in;text-indent:0in;background:white'>Usage +example – call a function when the primary WAN device changes:

def wan_change(path, value, *args):

+font-family:"Arial",sans-serif;color:black'>def wan_change(path, value, *args):

    cp.log(f'Primary WAN UID = {value}’)

+font-family:"Arial",sans-serif;color:black'>    cp.log(f'Primary WAN UID = +{value}’)

       

+font-family:"Arial",sans-serif;color:black'>       

cp.register('put', '/device/wan/connection/primary', wan_change)

+12.0pt;margin-left:1.0in;background:white'>cp.register('put', +'/device/wan/connection/primary', wan_change)

·       -Your -function must expect the following positional arguments (path, value, *args):

+margin-bottom:12.0pt;margin-left:.5in;text-indent:0in;background:white'>Your +function must expect the following positional arguments (path, value, *args):

·       Path·       +Path is the API path to the key, or field, that you registered for -callback on.

+callback on.

·       Value is the current value of the key in the path

+margin-bottom:12.0pt;margin-left:1.5in;text-indent:-.25in;background:white'>·       +Value is the current value of the key in the path

·       *args contains dynamic arguments

+margin-bottom:12.0pt;margin-left:1.5in;text-indent:-.25in;background:white'>·       +*args contains dynamic arguments

 

+margin-bottom:12.0pt;margin-left:1.0in;background:white'> 

·       return completes the function.

+margin-bottom:12.0pt;margin-left:.5in;text-indent:0in;background:white'>return +completes the function.

 

+font-family:"Arial",sans-serif;color:black'> 

package.ini
+font-family:"Arial",sans-serif;color:black'>package.ini


This initialization file contains information and about the application and items that affect installation and execution. This information is shown in -/status/system/sdk within the NCOS config store for -installed apps.
+/status/system/sdk within the NCOS config store for installed apps.

-For example:

- -

[hello_world]

- -

uuid=7042c8fd-fe7a-4846-aed1-e3f8d6a1c91c

- -

vendor=Cradlepoint

- -

notes=Hello World Demo -Application

- -

firmware_major=7

- -

firmware_minor=1

- -

auto_start=true

- -

restart=false

- -

reboot=true

- -

version_major=1

- -

version_minor=0

+For example:

+ +

[hello_world]

+ +

uuid=7042c8fd-fe7a-4846-aed1-e3f8d6a1c91c

+ +

vendor=Cradlepoint

+ +

notes=Hello World Demo Application

+ +

firmware_major=7

+ +

firmware_minor=1

+ +

auto_start=true

+ +

restart=false

+ +

reboot=true

+ +

version_major=1

+ +

version_minor=0

·       [hello_world]

+0in;margin-left:30.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>·       [hello_world]

This must contain the name of the application. In this example, hello_world is the application name.

+font-family:"Arial",sans-serif;color:black'>This must contain the name of the +application. In this example, hello_world is the application name.

·       uuid

+0in;margin-left:30.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>·       uuid

Every app must contain a universally unique identifier (UUID). If -left blank, the make.py “build” action will generate and populate UUID for the -app.

+font-family:"Arial",sans-serif;color:black'>Every app must contain a +universally unique identifier (UUID). If left blank, the make.py “build” action +will generate and populate UUID for the app.

·       vendor

+0in;margin-left:30.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>·       vendor

This is the vendor name for the app.

+font-family:"Arial",sans-serif;color:black'>This is the vendor name for the +app.

·       notes

+0in;margin-left:30.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>·       notes

Add notes to describe the app or anything else.

+font-family:"Arial",sans-serif;color:black'>Add notes to describe the app or +anything else.

·       firmware_major and firmware_minor

+0in;margin-left:30.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>·       firmware_major and firmware_minor

This is the version of NCOS that the app was orginially -written to work with. Information only.

+font-family:"Arial",sans-serif;color:black'>This is the version of NCOS that +the app was orginially written to work with. Information only.

·       auto_start

+0in;margin-left:30.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>·       auto_start

If set to 'true', the app will automatically start after -installation.

+font-family:"Arial",sans-serif;color:black'>If set to 'true', the app will +automatically start after installation.

·       restart 

+0in;margin-left:30.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>·       restart 

If set to 'true', the application will be restarted if it dies or -is not running. If false, the device will not attempt to restart the -application.

+font-family:"Arial",sans-serif;color:black'>If set to 'true', the application +will be restarted if it dies or is not running. If false, the device will not +attempt to restart the application.

·       reboot 

+0in;margin-left:30.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>·       reboot 

If set to 'true', the application will be started following a -device reboot. Otherwise, it will not be restarted.

+font-family:"Arial",sans-serif;color:black'>If set to 'true', the application +will be started following a device reboot. Otherwise, it will not be restarted.

·       version_major and version_minor

+0in;margin-left:30.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>·       version_major and version_minor

This contains the app version. This must be incremented for any -new production app used installed via NCM. It will not re-install the same -version that already exists in the device.

+font-family:"Arial",sans-serif;color:black'>This contains the app version. This +must be incremented for any new production app used installed via NCM. It will +not re-install the same version that already exists in the device.


+font-family:"Arial",sans-serif;color:black'>
start.sh

This script is executed to start the application in the device. It contains the command to start the Python script and pass any arguments if needed.
-For example:

+For example:

-

#!/bin/bash

+

#!/bin/bash

-

cppython hello_world.py

+

cppython hello_world.py

stop.sh
+font-family:"Arial",sans-serif;color:black'>stop.sh


This script is executed when the application is stopped in the device. It contains the command to stop the Python script and pass any arguments. This is not required unless one needs a specific action preformed when the application is stopped.
-For example:

+For example:

-

#!/bin/bash

+

#!/bin/bash

-

cppython hello_world.py

+

cppython hello_world.py

-

 

+

 

make.py

+12.0pt;margin-left:0in;background:white'>make.py


+font-family:"Arial",sans-serif;color:black'>
The SDK includes a Python make.py file that is compatible for Windows, Linux -and OS X platforms.

+and OS X platforms.

make.py actions are:

+font-family:"Arial",sans-serif;color:black'>make.py actions are:

default (i.e. no action given): Print a help file

+font-family:"Arial",sans-serif;color:black'>default (i.e. no action given): Print a +help file

clean: Clean all project +font-family:"Arial",sans-serif;color:black'>clean: Clean all project artifacts. To clean all the apps, add the option "all" (i.e. clean -all).

+all).

build or package: Create the app archive tar.gz file. To build all the apps, add -the option "all" (i.e. build all). Any directory containing a -package.ini file is considered an app.

+font-family:"Arial",sans-serif;color:black'>build or package: Create the +app archive tar.gz file. To build all the apps, add the option "all" +(i.e. build all). Any directory containing a package.ini file is considered an +app.

status: Fetch and print -current app status from the locally connected device.

+font-family:"Arial",sans-serif;color:black'>status: Fetch and +print current app status from the locally connected device.

install: Secure copy the app -archive to a locally connected device. The device must already be in SDK DEV -mode via registration and licensing in NCM.
+font-family:"Arial",sans-serif;color:black'>install
: Secure +copy the app archive to a locally connected device. The device must already be +in SDK DEV mode via registration and licensing in NCM.

Note: A 'Connection reset by peer' error displays even when the application is successfully copied to the device. This occurs when the device drops the -connections after the file copy is complete.

+connections after the file copy is complete.

start: Start the app on the -locally connected device.

+font-family:"Arial",sans-serif;color:black'>start: Start the +app on the locally connected device.

stop: Stop the app on the -locally connected device.

+font-family:"Arial",sans-serif;color:black'>stop: Stop the +app on the locally connected device.

uninstall: Uninstall the app from -the locally connected device.

+font-family:"Arial",sans-serif;color:black'>uninstall: Uninstall +the app from the locally connected device.

purge: Purge all apps from -the locally connected device.

+font-family:"Arial",sans-serif;color:black'>purge: Purge all +apps from the locally connected device.

uuid: This will create a new UUID for the app and write it to the -package.ini file.

+12.0pt;margin-left:0in;background:white'>uuid: This will +create a new UUID for the app and write it to the package.ini file.

unit: Run any unit tests -associated with selected app.

+font-family:"Arial",sans-serif;color:black'>unit: Run any +unit tests associated with selected app.

system: Run any system tests -associated with selected app.

+font-family:"Arial",sans-serif;color:black'>system: Run any +system tests associated with selected app.

help: Print the help -information.

+font-family:"Arial",sans-serif;color:black'>help: Print +the help information.


+font-family:"Arial",sans-serif;color:black'>
make.py usage

All SDK functions are contained in the make.py Python file. While this executable is the same regardless of the workstation platform, the Python -command is not. Use the following Python command based on your platform:

+command is not. Use the following Python command based on your platform:

·       Linux or OS X:

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       Linux or OS +X:

python3

+font-family:"Arial",sans-serif;color:black'>python3

·       Windows:

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       Windows:

python

+font-family:"Arial",sans-serif;color:black'>python

The command structure is:

+font-family:"Arial",sans-serif;color:black'>The command structure is:

-

python(3) make.py <action>

+

python(3) make.py <action>

The make.py usage is as follows:

+font-family:"Arial",sans-serif;color:black'>The make.py usage is as follows:

1.     -Update the -sdk_setting.ini file based on your needs.

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>1.     Update the sdk_setting.ini +file based on your needs.

Example:

- -

[sdk]

- -

app_name=hello_world

- -

dev_client_ip=192.168.0.1

- -

dev_client_username=admin

- -

dev_client_password=44224267

+font-family:"Arial",sans-serif;color:black'>Example:

+ +

[sdk]

+ +

app_name=hello_world

+ +

dev_client_ip=192.168.0.1

+ +

dev_client_username=admin

+ +

dev_client_password=44224267

2.     -Build the application -package:

- -

python(3) make.py build

- -

Packaging hello_world

+0in;margin-left:30.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>2.     Build the +application package:

+ +

python(3) +make.py build

+ +

Packaging +hello_world

3.     -Test connectivity with -your device via the status target:

- -

python(3) make.py status

- -

 

- -

{

- -

    "success": true,

- -

    "data": {

- -

        "service": -"started",

- -

        "summary": "Service -Started",

- -

        "mode": "devmode",

- -

        "apps": []

- -

    }

- -

}

+0in;margin-left:30.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>3.     Test connectivity +with your device via the status target:

+ +

python(3) +make.py status

+ +

 

+ +

{

+ +

    +"success": true,

+ +

    +"data": {

+ +

        +"service": "started",

+ +

        +"summary": "Service Started",

+ +

        +"mode": "devmode",

+ +

        +"apps": []

+ +

    }

+ +

}

4.     -Install the application -on your device:

- -

python(3) make.py install

- -

 

- -

Installing -hello_world.tar.gz in NCOS device 192.168.0.1.

- -

Warning: Permanently -added '192.168.0.1' (RSA) to the list of known hosts.

- -

Received disconnect from -192.168.0.1 port 22:11: Bye Bye

- -

Disconnected from -192.168.0.1 port 22

- -

lost connection

+0in;margin-left:30.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>4.     Install the application +on your device:

+ +

python(3) +make.py install

+ +

 

+ +

Installing +hello_world.tar.gz in NCOS device 192.168.0.1.

+ +

Warning: +Permanently added '192.168.0.1' (RSA) to the list of known hosts.

+ +

Received +disconnect from 192.168.0.1 port 22:11: Bye Bye

+ +

Disconnected +from 192.168.0.1 port 22

+ +

lost connection

5.     -Get the application -execution status from your device:

- -

python(3) make.py status

- -

 

- -

{

- -

    "success": true,

- -

    "data": {

- -

        "service": -"started",

- -

        "summary": "Service -Started",

- -

        "mode": "devmode",

- -

        "apps": [

- -

            {

- -

                "_id_": -"8a7f79cb-b11b-44bc-bd33-0f4ab3f06d60",

- -

                "app": {

- -

                    "uuid": -"8a7f79cb-b11b-44bc-bd33-0f4ab3f06d60",

- -

                    "name": "hello_world",

- -

                    "date": -"2020-03-09T14:15:24.936508",

- -

                    "restart": true,

- -

                    "reboot": true,

- -

                    "auto_start": -true,

- -

                    "vendor": -"Cradlepoint",

- -

                    "version_major": -0,

- -

                    "version_minor": -1

- -

                },

- -

                "state": -"started",

- -

                "summary": -"Started Application"

- -

            }

- -

        ]

- -

    }

- -

}

- -

 

- -

 

- -

NCOS -Syslog for Debugging

+0in;margin-left:30.0pt;margin-bottom:.0001pt;text-indent:-.25in;background: +white'>5.     Get the +application execution status from your device:

+ +

python(3) +make.py status

+ +

 

+ +

{

+ +

    +"success": true,

+ +

    +"data": {

+ +

        +"service": "started",

+ +

        +"summary": "Service Started",

+ +

        +"mode": "devmode",

+ +

        +"apps": [

+ +

            {

+ +

                +"_id_": "8a7f79cb-b11b-44bc-bd33-0f4ab3f06d60",

+ +

                +"app": {

+ +

                    +"uuid": "8a7f79cb-b11b-44bc-bd33-0f4ab3f06d60",

+ +

                    +"name": "hello_world",

+ +

                    +"date": "2020-03-09T14:15:24.936508",

+ +

                    +"restart": true,

+ +

                    +"reboot": true,

+ +

                    +"auto_start": true,

+ +

                    +"vendor": "Cradlepoint",

+ +

                    +"version_major": 0,

+ +

                    +"version_minor": 1

+ +

                +},

+ +

                +"state": "started",

+ +

                +"summary": "Started Application"

+ +

            }

+ +

        ]

+ +

    }

+ +

}

+ +

 

+ +

 

+ +

NCOS +Syslog for Debugging

Application debugging is accomplished with the use of system logs. -You can also view logs via CLI commands when logged into the NCOS device console. -This console is available by logging into the device with SSH or by opening a -console from the device admin pages.
+font-family:"Arial",sans-serif;color:black'>Application debugging is +accomplished with the use of system logs. You can also view logs via CLI +commands when logged into the NCOS device console. This console is available by +logging into the device with SSH or by opening a console from the device admin +pages.

-Use the following steps to open the device console from the device admin pages:

+Use the following steps to open the device console from the device admin pages:

1.     -Click System

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>1.     Click System

2.     -Click System -Control.

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>2.     Click System +Control.

3.     -Click Device Options.

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>3.     Click Device +Options.

4.     -Click the Device -Console button.

- -

log (displays logs in -the terminal window)

- -

log -f (continuously -displays log entries as they are written)

- -

log -s <text> -(search for logs that contain <text> and displays them)

- -

log -s -i <text> (search for logs that contain <text> -but case insensitive)

- -

log clear (clears the -log buffer)

- -

help log (display the -log command options)

- -

 

- -

 

- -

NCOS Development Mode

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>4.     Click +the Device Console button.

+ +

log (displays +logs in the terminal window)

+ +

log -f +(continuously displays log entries as they are written)

+ +

log -s <text> +(search for logs that contain <text> and displays them)

+ +

log -s -i +<text> (search for logs that contain <text> but case insensitive)

+ +

log clear +(clears the log buffer)

+ +

help log +(display the log command options)

+ +

 

+ +

 

+ +

NCOS +Development Mode

To install an application directly to the device without using -NCM, the NCOS device must be placed in DEV mode. One would -typically debug and test an application using DEV mode prior -to using NCM for installation. DEV mode allows for quicker and -easier testing and debugging. Instructions for setting up an NCOS device -for DEV mode are in the article To install an application directly +to the device without using NCM, the NCOS device must be placed in DEV mode. +One would typically debug and test an application using DEV mode +prior to using NCM for installation. DEV mode allows for +quicker and easier testing and debugging. Instructions for setting up an NCOS +device for DEV mode are in the article NCOS: SDK Enable -Developer Mode.

+color:#015BA7'>NCOS: SDK Enable Developer Mode.

NCM Application -Deployment

+12.0pt;margin-left:0in;background:white'>NCM +Application Deployment

NCM is used to securely deploy applications to devices at the -group level. If an application tar.gz package is uploaded to NCM and then -assigned to an NCOS device group, NCM securely downloads and installs the -application to the devices within the group. For security, the application -files are not user accessible within NCM or devices. That is, one is not able -to download the application from the device or NCM.

- -

Related Articles/Links

+font-family:"Arial",sans-serif;color:black'>NCM is used to securely deploy +applications to devices at the group level. If an application tar.gz package is +uploaded to NCM and then assigned to an NCOS device group, NCM securely +downloads and installs the application to the devices within the group. For +security, the application files are not user accessible within NCM or devices. +That is, one is not able to download the application from the device or NCM.

+ +

Related +Articles/Links

·       -Cradlepoint SDK GitHub repository

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       Cradlepoint SDK GitHub repository

·       -SDK and Sample Applications

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       SDK and Sample Applications

·       -Cradlepoint ·       Cradlepoint Developer Community Portal

+9.0pt;font-family:"Arial",sans-serif;color:#015BA7'>Developer Community Portal

·       -·       Cradlepoint Cradlepoint Customer Community

+style='font-size:9.0pt;font-family:"Arial",sans-serif;color:#015BA7'>Customer +Community

·       -·       Cradlepoint -Developer/API Site

+color:#015BA7'>Cradlepoint Developer/API Site

·       -Pycharm for Linux

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       Pycharm +for Linux

·       -Pycharm for OS X

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       Pycharm +for OS X

·       -·       Pycharm for Windows

+target="_blank">Pycharm for Windows

·       -7-zip 

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       7-zip 

·       -MarkdownPad

- -

 

+12.0pt;margin-left:30.0pt;text-indent:-.25in;background:white'>·       MarkdownPad

+ +