Getting Started
Let's get started with Network as Code! This quick-start guide will help you create an account, get your application keys, and set up your development environment, so that you too can start programming global mobile networks.
Initial setup
Request access
Use the Request Access form accessible from the top-right corner of the page.
Get your first App Key
Please, be careful with your App Keys. Treat them like secrets or passwords. Do not commit them to Git or show them publicly anywhere. Stolen App Keys may be used for malicious purposes and can cause harm in the wrong hands.
-
When your account is active, click the button to Log in again to on our Network-as-Code developer portal. Your username should appear at the top-right corner of the page when you're logged in, click it and head over to your Dashboard.
NOTE: A default application and authorization key are automatically created for you on your dashboard.
-
From the Handy Links section, you can create and manage organizations, view analytics and billing options. Your default application key is right below this section, and you can show, hide or copy it to your clipboard.
-
To access the API Hub, click the Create and Manage Organizations option from the Handy Links section and then API Hub. You will see all your available APIs and from there you can subscribe to them.
NOTE: If you've been assigned with a developer role in an organization, read how you can check organization app keys.
Subscribe to APIs and test them
From the API Hub:
- Select a specific API to test, for example the Quality-of-service on Demand (QoD) one.
- Click the button Subscribe to Test.
- Then, all you'll need to do is choose the right plan for you and click Subscribe to confirm your selection. A message for successful subscription should show on the screen!
- Finally, go back to the API you selected and click Test Endpoint to use it.
Creating your first Network as Code project
Create a new Python project
This will be used only for the Python SDK, as other languages can have their own methods.
We recommend using a dependency management tool, such as venv or Poetry, to manage your Python project's dependencies. This guide will use venv for the sake of simplicity.
Open the terminal and create a new directory for your project. Let's call it nac-hello-world
.
mkdir nac-hello-world
Then, move into this newly created directory, create a virtual environment called env
and finally, activate it.
cd nac-hello-world
python3 -m venv env
source env/bin/activate
Install the Network as Code SDK
Let's install the latest version of the Network as Code SDK.
NOTE: Before installing the NaC package, make sure you are using the Python version 3.9 or higher. Also, for TypeScript packages to work properly, install the latest version of node.
pip install network_as_code
Make your first Network as Code program
Open the project directory (nac-hello-world
) in your favorite code editor,
such as Visual Studio Code, Emacs, or Vim and create a file called main
with the file extension for the programming language you are using,
for example, main.py
, main.ts
, etc.
Copy one of the following code-snippet example into main
:
import network_as_code as nac
# We begin by creating a Network-as-Code client
client = nac.NetworkAsCodeClient(
token="<your-application-key-here>"
)
What does this code do? It creates a new NetworkAsCodeClient
object which will store your application key.
The NetworkAsCodeClient
is the entry-point to all the functionality Network as Code provides.
Replace the <your-application-key-here>
with the App Key you copied earlier from your Dashboard.
Authorization: Network as Code allows querying any device for its location, modify its network parameters, find out whether it's connected to the Internet or not and so on. However, you can only perform these actions against devices you are authorized to use. This does not apply to test-devices from the Developer Sandbox described above. Read our Consent and identity management policy carefully.
Getting a test-device ID from the Developer Sandbox
Developers and enterprises get test-device IDs uniquely assigned to their account, so they can try out our Developer Sandbox. This sandbox provides 5G simulators for different APIs, such as Quality-on-Demand, Device Location, Device Status and Slicing. You can make API and SDK calls in a safe environment for testing purposes. No consent or authorization is required, and you won't get billed or have rate limits at this stage.
- Log in to your Network-as-Code account
- Click your username at the top-right corner and head over to your Dashboard.
- From the Devices section, you can add or choose devices and get unique test-device IDs to use as a parameter in your SDKs!
Trying out a Quality-of-service on Demand (QoD) session
Network as Code provides a feature called QoD, which allows simple management of a device's bandwidth and latency, among other things. With our project skeleton already ready we can try creating a QoD session for a dummy device:
What's next?
You've now set up everything you need to use Network as Code and had a quick taste of how it is used to program the network. Feel free to browse our growing catalog of features to learn more!
Check out our documentation for the following features:
We hope you enjoy using Network as Code!
Last updated on May 21, 2024