Skip to content

4. Development Workflows⚓︎

The xApp Dev Environment described in the Quick Guide section is a great way to quickly deploy the full xApp Framework, with the xApp Library in place and the xApp fully integrated into dRAX. In this section, we will explain the different workflows you can use in the development cycle.

4.1 Development in the container⚓︎

Once the xApp Dev Environment is deployed, you can access the xApp Dev Environment container as described in the Quick Guide section:

kubectl exec -it <pod_name> -- /bin/bash

As part of the xApp Dev Environment, we have pre-installed tools such as:

  • vim
  • nano
  • Git

You are of course free to install any additional packages. This initial set should be enough to get you started in editing the xApp python files and backing up your code to Git. You can start the xApp by running:

python3 xapp_main.py

4.2 Using ssh to access container⚓︎

If for any reason you don’t have access to the dRAX host machine or the kubectl command, you can also access the xApp Dev Environment using ssh. First, discover which port is used on the host machine as the ssh port for your xApp Dev environment. You can do this by going to the dRAX Dashboard and navigating to xApps Management -> Overview. Find you xApp Dev Environment, and click the Show button under the Services column. You should see multiple services associated with your xApp, one of which should be the dev-ssh service. You will find the port on which this service is exposed under the NodePort column (it will be in the range of 30 000 - 32 000). You can now ssh into your xApp Dev Environment by using the IP of the dRAX host machine, the dev-ssh service nodePort, and the SSH Password set during the deployment of the xApp Dev Environment:

ssh -p <dev-ssh-nodeport> xapp@<drax-host-ip>

You now have access to the python files in the xApp Core which are located in _/home/xapp/xapp_core _inside the container. You can edit the python files and start the xApp as normal using:

python3 xapp_main.py

4.3 Using local IDE to edit xApp Dev Environment files⚓︎

As an xApp developer, it is often easier to develop the xApp in an IDE or user-friendly text editor. You may use a tool called sshfs to mount the files from the xApp Dev Environment container onto your local machine. This way you can edit the files locally in any text editor you want, and the changes will also take effect in the dRAX Dev Environment. Of course, you still need to access the xApp Dev Environment of ssh into it to actually start or stop the xApp!

You can install sshfs using the following command:

sudo apt install -y sshfs

Next create a folder where you will mount the remote files:

mkdir /path/to/xapp-dev-file

Finally use the sshfs command to mount the files:

sshfs -p <dev-ssh-node-port> xapp@<drax-host-ip>:/home/xapp/xapp_core /path/to/xapp-dev-files

The xapp_core files will now be available in the "xapp-dev-files" folder you just created.

NOTE: You still have to access the xApp Development Environment via kubectl or ssh into it in order to run the actual xApp with the "python3 xapp_main.py" command.

4.4 Using Visual Studio Code for an integrated development environment⚓︎

You can use Visual Studio Code to get an integrated development environment. Visual Studio Code has the "remote-ssh" extension which lets you connect to a remote ssh host, access the remote files in the user friendly text editor of VS Code, and have a terminal open to the remote host.

4.4.1 Install VS Code⚓︎

You can download the VS Code from: https://code.visualstudio.com/download

4.4.2 Install Remote-SSH in VS Code⚓︎

You need to install the remote-ssh extension in VS Code, and configure it to connect to your xApp Dev Environment (taking into account the ssh password and port used).

In the left hand menu, select the Extensions tab. Search for Remote-SSH and install the extension.

4.4.3 Adding the xApp Dev Environment as new SSH host⚓︎

Next, click F1 on the keyboard to open the Command Pallete (or VSCode -> View -> Command Palette). Now start typing "remote-ssh add new" and select the option that appears: "Remote-SSH: Add New SSH Host…".

Follow the instruction to enter the ssh command:

ssh -p <dev-ssh-port> xapp@<drax-host-ip>

You will be asked to supply a ssh config file. Since we will use the password for ssh, you can just pick the default one. Or if you know what you are doing, you can create or select your ssh config file.

4.4.4 Connecting to xApp Dev Environment⚓︎

You can now find the newly added host, or your xApp Dev Environment, in the “Remote Explorer” tab on the left. You will see the host and can click on it to connect. You will be asked for the ssh password in the process (you might be asked for the ssh password a couple of times which is normal).

4.4.5 Adding a SSH key to the xApp Dev Environment⚓︎

You can of course add your public ssh key to the xApp Dev Environment and then use that in the ssh config file of VS Code Remote-SSH, which makes the connection process easier. Of course you have to keep in mind that once the xApp Dev environment is deleted, all your data in the xApp Dev Environment including the ssh key will be deleted. When deploying a new xApp Dev Environment, you have to set up the ssh key again.

4.4.6 Troubleshooting⚓︎

There is a known issue if you try to connect to the remote xApp Dev Environment using the remote-ssh extension in VS Code. When you try to connect, you can get an error message:

“Could not establish connection to “10.8.0.1”: Downloading VS Code Server failed - please install either curl or wget on the remote”

To resolve it, you need to kill the VS Code server on the remote using the following command:

VSCode -> View -> Command Palette -> input "remote" -> Select Remote-SSH: Kill VS Code Server on Host…

You can then select the IP address of your xApp Dev Environment, and will be required to enter the ssh password. Once the process completes, reconnect to the remote ssh again and it should work this time.

Back to top