Welcome to the first chapter of the xconfwebconfig tutorial! In this chapter, we will explore the purpose, architecture, setup instructions, and API details for the xconfwebconfig project. By the end of this chapter, you will have a solid understanding of what this project does, the tools it uses, and how to interact with its APIs.
xconfwebconfig is a backend application designed to manage firmware and configuration settings for set-top boxes (STBs). It acts as the central system responsible for determining which firmware version an STB should use and provides the necessary information to the devices. However, it does not handle the actual firmware download or update process.
- Firmware Management: Determines the correct firmware version for STBs based on various inputs (e.g., model, environment, etc.).
- Device Configuration Management (DCM): Provides configuration settings for remote devices like STBs and DVRs.
- Feature Control: Enables or disables specific features on devices based on predefined rules.
The project is built using the following core components and tools:
- Language: Golang
- Web Framework:
gorilla/mux - Database: Cassandra DB
This architecture ensures high scalability, efficient data handling, and robust performance, which are critical for managing large populations of STBs.
flowchart TD
A[STB Device] -->|Requests Firmware/Settings| B[xconfwebconfig]
B -->|Fetches Data| C[Cassandra DB]
C -->|Returns Data| B
B -->|Responds with JSON| A
- STB Device: Sends HTTP requests to
xconfwebconfigwith details like MAC address, model, firmware version, etc. - xconfwebconfig: Processes the request, applies rules, and fetches data from the Cassandra database.
- Cassandra DB: Stores all the necessary firmware, configuration, and rule data.
Follow these steps to get the xconfwebconfig application up and running.
- Install and run Cassandra DB.
- Use the
db_init.cqlfile (located in thedbfolder) to create the necessary database schema.
- Copy the
config/sample_xconfwebconfig.conffile to a new location and edit it to override specific environment properties.
Run the following commands to build the binary:
cd .../xconfwebconfig
makeBefore running the application, export the required environment variables:
export SAT_CLIENT_ID='xxxxxx'
export SAT_CLIENT_SECRET='yyyyyy'
export SECURITY_TOKEN_KEY='zzzzzz'Then, start the application:
mkdir -p /app/logs/xconfwebconfig
cd .../xconfwebconfig
bin/xconfwebconfig-linux-amd64 -f config/sample_xconfwebconfig.confThe xconfwebconfig application exposes several APIs that allow STBs and other systems to interact with it. Below, we provide an overview of the primary APIs and their usage.
| PATH | METHOD | QUERY PARAMETERS | DESCRIPTION |
|---|---|---|---|
/xconf/swu/{applicationType} |
GET |
eStbMac, ipAddress, env, model, firmwareVersion, partnerId, etc. |
Returns firmware information for the STB. |
/xconf/swu/bse |
GET |
ipAddress |
Returns BSE configuration. |
/xconf/{applicationType}/runningFirmwareVersion/info |
GET |
mac |
Returns activation and minimum firmware details. |
/estbfirmware/checkMinimumFirmware |
GET |
mac |
Checks if the device has the minimum firmware version. |
curl --location --request GET 'https://<xconf-path>/xconf/swu/stb?eStbMac=AA:AA:AA:AA:AA:AA&env=DEV&model=TEST_MODEL'{
"firmwareDownloadProtocol": "http",
"firmwareFilename": "FIRMWARE-NAME.bin",
"firmwareLocation": "http://example-url.com/cgi-bin/x1-sign-redirect.pl",
"firmwareVersion": "1.0.0",
"rebootImmediately": true
}| PATH | METHOD | QUERY PARAMETERS | DESCRIPTION |
|---|---|---|---|
/loguploader/getSettings/{applicationType} |
GET |
estbMacAddress, ipAddress, env, etc. |
Returns configuration settings for the STB. |
/loguploader/getTelemetryProfiles/{applicationType} |
GET |
Same as above | Returns Telemetry 2.0 profiles. |
curl --location --request GET 'https://<xconf-path>/loguploader/getSettings/stb?estbMacAddress=AA:AA:AA:AA:AA:AA'{
"urn:settings:CheckSchedule:cron": "19 7 * * *",
"urn:settings:LogUploadSettings:UploadRepository:URL": "https://upload-repository-url.com",
"urn:settings:TelemetryProfile": {
"id": "c34518e8-0af5-4524-b96d-c2efb1904458",
"schedule": "*/15 * * * *"
}
}| PATH | METHOD | QUERY PARAMETERS | DESCRIPTION |
|---|---|---|---|
/featureControl/getSettings/{applicationType} |
GET |
estbMacAddress, ipAddress, env, etc. |
Returns enabled/disabled features for the device. |
curl --location --request GET 'https://<xconf-path>/featureControl/getSettings?estbMacAddress=AA:AA:AA:AA:AA:AA' \
--header 'Accept: application/json'{
"featureControl": {
"features": [
{
"name": "TEST_FEATURE",
"enable": true
}
]
}
}Rules are used to apply specific logic for firmware, configuration, telemetry, and feature management. There are six different rule types:
- FirmwareRule
- DCM Rule
- TelemetryRule
- TelemetryTwoRule
- SettingRule
- FeatureRule
Each rule consists of conditions, which are applied to determine the appropriate response.
{
"negated": false,
"condition": {
"freeArg": {
"type": "STRING",
"name": "model"
},
"operation": "IS",
"fixedArg": {
"value": "TEST_MODEL"
}
}
}In this chapter, we explored the xconfwebconfig project, its architecture, setup process, and API documentation. You learned how xconfwebconfig enables firmware and configuration management for STBs and how to interact with its APIs.
Next, we’ll dive deeper into how the HTTP server and routing are implemented in the project. Continue to HTTP Server and Routing.
Generated by AI Codebase Knowledge Builder