Amarisoft

Remote API

 

The purpose of this tutorial is to show you how to do use RemoteAPI. Remote API is a tool to let you communicate with Callbox using WebSocket protocol and any programming lanaguage supporting WebSocket. In Amaricall box, you will have a special script installed by default for RemoteAPI utilization.

Most of the test equipment support their own automation / remote control mechanism and the most commonly used mechanism would be GPIB/SCPI (skippy). Amarisoft also provides its own automation / remote control mechanism, but it is not based on SCPI. Instead Amarisoft product provides a special automation/remote controll tool named 'Remote API'. The Remote API is based on Java Script utilizing Web Socket to control/communicate with Amari Callbox or UEsim. The command format is in json format.

Remote API would seem a little bit complicated and confusing at the beginning if you are just familiar with SCPI type of command, but you would relize that Remote API would provide wider range of controllability than most of the SCPI style command set. I would strongly suggest you to try Remote API and try to get familiar with the tool.

NOTE :  Remote API in  Python, we not providing Python based remote API in standard release package, but you may use the sample Python code in this tutorial. You may use it as it is or modify as you like.

 

 

Table of Contents

 

 

Test Setup

 

You can use any kind of test setup that allow you to get UE attached to callbox.

 

 

Check if nodeJ is installed

 

Remote API is based on standard WebSocket protocol, so you can use any language (e.g, Python, Perl etc) to utilize this functionality, but Java script is the most widely tested by Amarisoft for this purpose

To use RemoteAPI with javascript, we need to install a javascript package called NodeJ. In recent callbox (I used 2021-11-19 release), it seems the NodeJ is installed by default. The objective of this section is to check if the nodeJ is installed and functioning properly

 

Try the command : { node -v }. If you get any result (i.e, version number) printed out, it mean that NodeJ is already installed on the PC

RemoteAPI NodeJ CheckUp 02

As a quick test, run { node } command and you will get node program prompt (NOTE : This is just to check if node is propery working. This is NOT the way you run RemoteAPI. For running RemoteAPI, refer the section Checking ws,js and try with some of the basic examples in this tutorial).

RemoteAPI NodeJ CheckUp 03

You may define a simple HelloWorld() function and call it and check if it works OK.

RemoteAPI NodeJ CheckUp 04

Press Ctrl+D to get out of node program

 

 

What if nodeJ is not installed

 

If nodeJ package is not installed on the PC (callbox), you can install it with following commands. In this case, you need to get your PC connected to the internet

RemoteAPI NodeJ Install 01

RemoteAPI NodeJ Install 02

 

 

 

Finding ws.js

 

The location of ws.js is a little bit different depending on release of the installlation package.

If you are using a little bit older versions, you may find it at  /root/mme/doc as shown below.

RemoteAPI NodeJ CheckUp 01

But in recent relase, the location of ws has changed. If you don't find the ws.js in /root/mme/doc, you can check out /root/enb, /root/mme, /root/ots  or you can search the location of the ws.js file using 'find' command as shown below.

RemoteAPI NodeJ CheckUp 05

 

 

 

Checking ws.js

The simplest way to check if the remoteAPI is properly running is to send a simple command and see if you get the proper response as shown below. For this specific test, you just need to make it sure that lte service but you don't need to get any UE attached.

RemoteAPI ws checkup 01

RemoteAPI ws checkup 02

 

 

How to figure out IP and Port number for Callbox (or UEsim) component ?

 

It would be easier to use component name in the remote API command, but if you want to use the IP and port number and you don't know the specific IP:port number for the component that you want to communicate. You can easily fiture it out from ws.js file. Open up ws.js in a text editor and you can figure it out as below.

RemoteAPI ComponentIP 01

 

NOTE : The IP address and Port Number shown above is based on the default value of com_addr parameter as shown below in each cfg file (e.g, enb.cfg, mme.cfg etc). If you change this parameter, you have to use the explicit IP and port number when you send RemoteAPI command.

RemoteAPI ComponentIP 02

 

 

enb Remote API

 

A challenge to use Remote API is that it is difficult to figure out accurate syntax of the each API just from the document. Main objective of this tutorial is to make a list of examples that is tested working. You may just copy and past of these examples for your needs but be careful about the parameter value and change those values as per the call status which your DUT is in (e.g, UE ID). This list will keep updated as I try more. So refer to the latest version of this tutorial to get more examples.

NOTE :  Refer to lteenb.pdf -  10. Remote API for the official description of the eNB/gNB related Remote API Command

NOTE :  In the examples shown below, I used 'enb' instead of the specific IP. This would work if you are running these commands on Callbox PC without changing com_addr parameter in the configuration file. But if you have changed com_addr parameter in the configuration file or if you are running the RemoteAPI from other PC, you need to put a specific < IP:port > in the place of 'end' in the following examples (e.g, ./ws.js 192.168.1.15:9000 '{"message":"config_get"}')  

NOTE : some number shown in this example (e.g, enb_ue_id) is context dependant meaning it should be changed according to the call status in the call box as of testing. Otherwise, the command would not work and may generate errors

NOTE :  For Windows users, you may get errors if you just copy and paste the command as below. Check out JSON String issue on Windows to workaround the problem.

 

 

enb Remote API for cell specific configurations

 

One of the most complicated and sometimes confusing Remote API format would be for those configurations that are applied for a specific cell. It would be a good idea of understanding the general structure of Remote API command for this type of configuration. The general structure of the remote API command for this category is as shown below.

RemoteAPI eNB Cell Params 01

 

There are a lot of configurations that belong to this category. In the  lteenb.pdf -  10. Remote API , the parameters indicated as below belong to this category meaning you need to use the same format shown above.

RemoteAPI eNB Cell Params 02

 

There are other types of message that uses the same RemoteAPI command structure. It is 'cells' parameters for sib_set message as shown below.

RemoteAPI eNB Cell Params 03

 

In the  lteenb.pdf -  10. Remote API , the parameters indicated as below belong to this category meaning you need to use the same format shown above.

RemoteAPI eNB Cell Params 04

 

Followings are the list of other examples that belong to this category. (NOTE : If you are just interested in getting a proper syntax, you may just copy the example here and change cell id and configuration values as per your need. If you want to see the final outcome of the execution of these commands in real test, click on Related Tutorial).

Remote API Command

Related Tutorial

./ws.js enb '{"message":"config_set","cells":{"1":{"inactivity_timer":6000}}}'

RemoteAPI_PhyMAC

./ws.js enb '{"message":"config_set","cells":{"1":{"pdsch_mcs":2}}}'

RemoteAPI_PhyMAC

./ws.js enb '{"message":"config_set","cells":{"1":{"force_dl_schedule":true}}}'

RemoteAPI_PhyMAC

./ws.js enb '{"message":"config_set","cells":{"1":{"pdsch_fixed_rb_alloc":true,"pdsch_fixed_rb_start":0,"pdsch_fixed_rb_l_crb":20}}}'

RemoteAPI_PhyMAC

./ws.js enb '{"message":"config_set","cells":{"1":{"pusch_mcs":2}}}'

RemoteAPI_PhyMAC

./ws.js enb '{"message":"config_set","cells":{"1":{"force_full_bsr":true}}}'

RemoteAPI_PhyMAC

./ws.js enb '{"message":"sib_set","cells":{"1":{"sib1":{"p_max":20}}}}'

RemoteAPI SIB

./ws.js enb '{"message":"sib_set","cells":{"1":{"sib3":{ "type": "hex", "payload" : "000c16043f95aa0007ae"}}}}'

RemoteAPI SIB

 

 

 

mme Remote API

 

A challenge to use Remote API is that it is difficult to figure out accurate syntax of the each API just from the document. Main objective of this tutorial is to make a list of examples that is tested working. You may just copy and past of these examples for your needs but be careful about the parameter value and change those values as per the call status which your DUT is in (e.g, UE ID). This list will keep updated as I try more. So refer to the latest version of this tutorial to get more examples.

NOTE :  For Windows users, you may get errors if you just copy and paste the command as below. Check out JSON String issue on Windows to workaround the problem.

NOTE :  Refer to ltemme.pdf - 6. Remote API

 

 

UEsim Remote API

 

A challenge to use Remote API is that it is difficult to figure out accurate syntax of the each API just from the document. Main objective of this tutorial is to make a list of examples that is tested working. You may just copy and past of these examples for your needs but be careful about the parameter value and change those values as per the call status which your DUT is in (e.g, UE ID). This list will keep updated as I try more. So refer to the latest version of this tutorial to get more examples.

NOTE :  For Windows users, you may get errors if you just copy and paste the command as below. Check out JSON String issue on Windows to workaround the problem.

NOTE : Refer to lteue.pdf - 7. Remote API

 

 

Application Examples

 

Followings are examples of Remote API that are used in various other tutorials in tech-academy.

 

 

Troubleshooting Tips

 

Syntax Error : Unexpected Token

Very often ( for example, when you copy and paste Remote API command from the document into your command prompt or when you made some typos), you may see a syntax error : Unexpected Token. In this case, you can figure out the exact position of the character that caused the problem from the error message as shown below.  

RemoteAPI TroubleshootTips UnexpectedToken 01

NOTE : when you copy and paste the command from a document, it may cause this kind of error because some quotation mark (' or ") would not be properly pasted. In this case, retype these quotation mark.

 

JSON String issue on Windows 

You may get errors when you run the same command on Windows PC. It seems this is due to the way how Windows command line program handles JSON string. Even on the same Windows operating system, you would need different solution for different type of command line window (e.g, regular command line window vs powershell window).  Following is the example done on Windows 11.

If you run the command as you do on Linux, you may get errors as shown below.

RemoteAPI TroubleshootTips Windows Error 01

If you are running the command from Powershell, changing the string format as shown below may fix the problem. ( node ws.js 192.168.100.17:9001 '{\"message\":\"config_get\"}' )

RemoteAPI TroubleshootTips Windows Error 02

If you are running the command on regular command line window, changing the string format as shown below may fix the problem. ( node ws.js 192.168.100.17:9001"{\"message\":\"config_get\"}")

RemoteAPI TroubleshootTips Windows Error 03