Category     

SDK: Router Apps/SDK Installation in Windows

« Go Back

Information

 
Content

Introduction

The document walk through the steps in installing the Cradlepoint Router Apps/SDK under Windows. The basic procedure should work in any of the newer Windows, including Windows 7 and Windows 10.

Install Python 3.5.1

Summary

  As of router firmware 6.2, the Cradlepoint routers will use 3.5.1, and since you are loading your Router App/SDK as Python source (text files), matching the exact version is not critical. However, do NOT try to use Python 2.7 or anything older than 3.3! As you work, try to keep your usage as generic as possible, making it easier to reuse your code on other versions of Python. Be warned that future Cradlepoint firmware may change to newer versions, so someday, you will need to migrate your SDK code.
  • Note: as of June 2016 and FW 6.1, the router is using Python 3.3 - however, since it will change soon, start with 3.5.1
  • Repeated Warning - you cannot use Python 2.7, as the basic method call design has changed (among other things).
  • Download Python 3.5.1 from https://www.python.org/downloads/release/python-351/

Installation

The download comes in a variety of forms, such as an EXE or MSI file. Running this and selecting defaults will install Python in C:\Python35. If you only plan to use one version of Python, then change the default installation to enable the “Add python.exe to Path”. However, this forces most tools to use this same version of Python. The default (not adding) allows you to manually manage the PATH, as explained in the next section.
User-added image


Manual PATH management

Since Windows does not use Python for core operating functions, you can select to manually enable 1 of N different versions. For use in Windows command line (aka: MD-DOS Window), create the following batch file using a name of your choice, then copy into a standard Windows program location such as C:\Windows or  C:\Windows\System32.

If you need to install multiple versions for use with other tools, then as long as they are installed in unique directories, they coexist fine. For example, version 3.5.1 will install in C:\Python35, and a second batch named py35.bat can be used to enable it. Including the PYTHONPATH is optional – normally Python and PyCharm find things where expected. However, I have found that including the base (or root) of your SDK working projects prevents weird situations where all of a sudden, Python can file "D:\your_code\sdk\make.py" and "D:\your_code\sdk\cp_lib\{file}.py", but cannot find "D:\your_code\sdk\tools\{file}.py".
 
REM py35.bat – enable Python access in DOS/command window mode
set PATH=%PATH%;C:\Python35
set PYTHONPATH=D:\your_code\sdk;

Install Suggested Tools

SSH and SCP - Putty

During development, you will require both SSH and SCP. Default installation from the EXE will place it in a Windows locations such as C:\Program Files (x86)\PuTTY. 
  • Download Putty from http://www.putty.org/
  • Do a standard default installation. 
  • Access SSH (putty.exe) via menus or a desktop shortcut.
  • Copy the SCP command (pscp.exe) to a %PATH% location, such as C:\Python35

PyCharm IDE – Community Version

You'll create your code the fastest - and avoid the most stupid bugs - by using a quality Python-aware tool such as PyCharm, which does code-checking, warning you of potential mistakes.
  • Download PyCharm from https://www.jetbrains.com/pycharm/download/#section=windows 
  • Do a standard default installation of the free "Community" version of PyCharm. 
  • If you intend to work extensively in Python or do web development (outside the scope of Cradlepoint's Router App/SDK), then consider buying a license for the full version, as it includes support for JavaScript and common Python web tools such as Django and the Google APP Engine. 
  • The first time you run PyCharm, you may need to select you Python binary by browsing to C:\Python35

7-Zip archive tools

You're all familiar with "ZIP" files, but did you know 'ZIP' is not a compression format, but a tool which handles a collection of different compression methods? Cradlepoint engineering has selected to use a form of compression/archive NOT supported by PKZIP, who are the trademark owners of ZIP and WINZIP. Instead, the SDK uses TAR (https://en.wikipedia.org/wiki/Tar_%28computing%29) and GZIP (http://www.gzip.org/)  One reason, is that TAR allows a UNIX filesystem (complete with permissions and user id) to be moved into the Cradlepoint router. Regardless, handling tar-gzip archives is not complex. The SDK 'make.py' handles this for you, using the standard Python modules TARFILE and GZIP. On Windows, the best tool for manually handling tar.gzip files is 7-Zip, which should actually be used by all modern engineers, as it not only handles ZIP, GZIP, TAR, but also 7z, ARC, RAR, and other formats one finds on the web. 
  • Download from http://www.7-zip.org/ 
  • Older stable versions are fine – use the 64-bit if possible, as it runs faster (& is multi-threaded).

OpenSSL Binaries

The MAKE.PY requires some OpenSSL tools to generate digital signatures.

PIP (how public Python extensions are managed)

PIP comes preinstalled in Python 3.5, but requires manual installation in Python 3.3. PIP is a smart tool which understands module dependencies – for example, when you install pyopenssl (below), the PIP will also install pyasn1, cryptography, and a few others. The actual code is installed in C:\Python35\Lib\site-packages

Normally, you can use PyCharm to install PIP-supported modules. However, you can speed your work by manually installing the following:
  • Open a DOS/Command Window
  • Run your "py35" batch file (or as you named it)
  • Start by confirming your PIP is the latest. 
    • Run "python -m pip install -U pip"
    • Repeat this in the future if PyCharm ever warns you that your PIP version is an old version.
If you are trying to use an older Python, such as Python 3.3, you can find instructions for including PIP on the internet. If you have the SDK Sample Code installed, then get-pip.py is included within the "tools" sub-directory, which will add PIP to older Python. But again, Python 3.5.1 COMES with PIP included, so other than testing for updates, you do not need to install PIP

Once your PIP is running properly, then use it to add these modules:
  • Serial port support: Run "python -m pip install -U pyserial"
  • Router API access: Run "python -m pip install -U requests"
  • OpenSSL and crypto tools: Run "python -m pip install -U pyopenssl"

Install Optional Tools

Text Editor Suitable for Programming

For manually editing text files, you need an editor which includes the following:
  • Can force a file to use spaces, never tabs (aka: converts tabs to spaces). While Python happily supports either tabs and spaces, it FAILS if a file has these mixed! So always use spaces only.
  • Can force a file to use a specific end-of-line (EOL), which in the SDK case is a UNIX <NewLine> only. Like spaces & tabs, mixing EOL is bad, and depending now the file is opened, a Windows-style file opened on Linux might appear to have a blank line between each actual line ('\r\n' becomes '\r\n\n').
  • Nice-to-have: a tabbed multi-document interface.
  • Nice-to-have: Python language highlighting
  • '''''Never use Windows stock NOTEPAD app''''' – instead select another text editor, then change the Windows file association to open .txt files in your programming editor. I suggest Notepad++
  • Download from https://notepad-plus-plus.org/ 
  • Note that there is also a "portable version", which means it runs gracefully on a USB flash drive, installing nothing on the host Windows PC.

Markdown Editor - for readme.md files

Traditionally, programmers should include some basic "start here" documentation in their projects. While some use Microsoft Word or complex HTML/XML, people generally want a file which can be both edited with a common text editor, yet display with a nice formatted look-and-fell. With the growth of GIT revision control and https://github.com/, many people create a "readme.md" file in each directory. The GITHUB web portable shows readme.md ("markdown format") files as-if the representative "index.html" page for each sub-directory of source code. PyCharm DOES include a free markdown add-on, but I prefer a tool with a simpler split screen, which shows your markdown text next to the formatted preview. I suggest MarkdownPad2, which has a free and pad version:

Optional Hardware Tools

Second Ethernet Port

Consider buying a cheap USB Ethernet port ($10 to $20), which you can link to a LOCAL port on your Cradlepoint router. This allows your PC to have direct access (by its normal Ethernet port) to your home network and the internet, while offering limited filtered access to the Cradlepoint router – without the need for DHCP. This also avoids disruptions to your work-station Internet access anytime you need to reboot your router. 

An example home network:
  • The home router runs as a DHCP server and offers 172.19.0.x IP addresses. The development computer and Cradlepoint router WAN port therefore may be assigned DHCP IP addresses such as 172.19.0.203 and 172.19.0.208.
  • Go to the "network properties" of your USB network port, and set a manual IP to match the LOCAL ports on the Cradlepoint router, which maybe 192.168.0.1 for the router and 192.168.0.203 for the computer. By NOT setting a default gateway/router IP, you insure Windows NEVER attempts to access the internet via the USB Ethernet.
  • In this example, pointing your web browser to 172.19.0.1 brings up the home page of your cable/broadband router, while pointing your web browser to 192.168.0.1 brings up the home page of your Cradlepoint router.
Another value of this second Ethernet port, is that anytime you use an Ethernet sniffer on the second network, it will be very "quiet", showing mainly the traffic you wish to see. Your home devices and Windows computer will put the dozens of browse/query messages per second on the first/internet-connected network! A good network sniffer is the open source tool: https://www.wireshark.org/
 

 
Knowledge Home | Product