This document describes the scripts available in the doc/scripts directory that
help manage the FIWARE context broker.
File: register_all_subscriptions.sh
Description: This script registers all subscriptions from the context broker
with a Redmine instance. It fetches all subscriptions, filters those with the
X-Redmine-GTT-Subscription-Template-URL header, and makes a POST request to the
URL specified in the header for each subscription.
Usage:
./doc/scripts/register_all_subscriptions.sh <api_key>Arguments:
api_key: The API key for your Redmine instance. This can also be provided through theREDMINE_API_KEYenvironment variable.
Environment Variables:
REDMINE_API_KEY: The API key for your Redmine instance. This is used if theapi_keyargument is not provided.BROKER_URL: The base URL for your Orion Context Broker. Defaults tohttp://app.local:1026if not set.BROKER_TOKEN: The bearer token for authentication. If provided, it will be used in theAuthorizationheader for the requests.FIWARE_SERVICE: The FIWARE service for the subscriptions (optional).FIWARE_SERVICEPATH: The FIWARE service path for the subscriptions (optional).
Note: Make sure to set the BROKER_URL and BROKER_TOKEN (optional) environment
variables to your context broker URL and authentication token respectively
before running this script.
To prepend an environment variable to a command in the terminal, you can do so like this:
BROKER_URL=your_broker_url ./doc/scripts/register_all_subscriptions.sh <redmine_api_key>Replace redmine_api_key with your actual Redmine API key and your_broker_url
with the correct URL. This will set the BROKER_URL environment variables for
the duration of the register_all_subscriptions.sh script.
File: delete_all_subscriptions.sh
Description: This script deletes all subscriptions from the context broker.
It makes a GET request to the /v2/subscriptions endpoint to retrieve all
subscriptions, and then makes DELETE requests to the
/v2/subscriptions/{subscriptionId} endpoint to delete each one.
Usage:
./doc/scripts/delete_all_subscriptions.shEnvironment Variables:
BROKER_URL: The base URL for your Orion Context Broker. Defaults tohttp://app.local:1026if not set.BROKER_TOKEN: The bearer token for authentication. If provided, it will be used in theAuthorizationheader for the requests.FIWARE_SERVICE: The FIWARE service for the subscriptions (optional).FIWARE_SERVICEPATH: The FIWARE service path for the subscriptions (optional).
Note: This script does not require any arguments. Make sure to set the
BROKER_URL and BROKER_TOKEN (optional) environment variables to your context
broker URL and authentication token respectively before running this script.
To prepend an environment variable to a command in the terminal, you can do so like this:
BROKER_URL=your_broker_url ./doc/scripts/delete_all_subscriptions.shReplace your_broker_url with your broker URL. This will set the
BROKER_URL environment variable for the duration of the
delete_all_subscriptions.sh script.