Problem
I'm not sure this is a bug or intentional, but I experienced some unexpected behaviour trying to list subscriptions without specifying "service".
How to reproduce
I tried several released of FIWARE-BigBang, because I thought it worked as expected in previous releases. But this was actually not the case.
After installation with the default config.sh, run:
export FIWARE_TOKEN=sample_token
export BROKER_URL=https://example.com/v2/subscriptions
# Create a Subscription with Service and ServicePath
curl -X POST \
$BROKER_URL \
-H "Content-Type: application/json" \
-H "X-Auth-Token: $FIWARE_TOKEN" \
-H "Fiware-Service: myservice" \
-H "Fiware-ServicePath: /mysubservice" \
-d '{
"description": "Temperature subscription with Service and ServicePath",
"subject": {
"entities": [{"idPattern": ".*", "type": "Room"}],
"condition": {"attrs": ["temperature"]}
},
"notification": {
"http": {
"url": "http://my.listener.com/notify"
},
"attrs": ["temperature"]
},
"expires": "2024-12-31T14:00:00.00Z",
"throttling": 5
}'
# Create a Subscription without Service and ServicePath
curl -X POST \
$BROKER_URL \
-H "Content-Type: application/json" \
-H "X-Auth-Token: $FIWARE_TOKEN" \
-d '{
"description": "Humidity subscription without Service and ServicePath",
"subject": {
"entities": [{"idPattern": ".*", "type": "Room"}],
"condition": {"attrs": ["humidity"]}
},
"notification": {
"http": {
"url": "http://my.listener.com/notify"
},
"attrs": ["humidity"]
},
"expires": "2024-12-31T14:00:00.00Z",
"throttling": 5
}'
# Request the List of Subscriptions
curl -X GET \
$BROKER_URL \
-H "X-Auth-Token: $FIWARE_TOKEN" \
-H "Fiware-Service: myservice" \
-H "Fiware-ServicePath: /mysubservice"
curl -X GET \
$BROKER_URL \
-H "X-Auth-Token: $FIWARE_TOKEN"
This returns the subscriptions as expected.
Now using NGSI-GO
# Request "myservice"
$ ngsi list subscriptions --verbose --service myservice
667448ae33211b06ef0c241e active 2024-12-31T14:00:00.000Z Temperature subscription with Service and ServicePath
# Request without "--service"
$ ngsi list subscriptions --verbose
667448ae33211b06ef0c241e active 2024-12-31T14:00:00.000Z Temperature subscription with Service and ServicePath
So whether --service myservice is provided as argument or not, the same subscription ("with Service") is returned.
I was able to request the subscription "without Service" like this
$ ngsi list subscriptions --service "" --verbose
667448b733211b06ef0c241f active 2024-12-31T14:00:00.000Z Humidity subscription without Service and ServicePath
Expected Behaviour
I would expect NGSI GO to return the same subscriptions as if calling the API with cURL.
- When
--service <service_name> parameter is provided, list all subscriptions of that service
- When the
--service parameter is not set, list all subscriptions of the "default" tenant
Problem
I'm not sure this is a bug or intentional, but I experienced some unexpected behaviour trying to list subscriptions without specifying "service".
How to reproduce
I tried several released of FIWARE-BigBang, because I thought it worked as expected in previous releases. But this was actually not the case.
After installation with the default
config.sh, run:This returns the subscriptions as expected.
Now using NGSI-GO
So whether
--service myserviceis provided as argument or not, the same subscription ("with Service") is returned.I was able to request the subscription "without Service" like this
$ ngsi list subscriptions --service "" --verbose 667448b733211b06ef0c241f active 2024-12-31T14:00:00.000Z Humidity subscription without Service and ServicePathExpected Behaviour
I would expect NGSI GO to return the same subscriptions as if calling the API with cURL.
--service <service_name>parameter is provided, list all subscriptions of that service--serviceparameter is not set, list all subscriptions of the "default" tenant