FIWARE / tutorials.TourGuide-App

:mortar_board: FIWARE Tour Guide Application.
https://fiwaretourguide.readthedocs.io/
MIT License
17 stars 19 forks source link

CLI: Add sensors commands #133

Closed dmabtrg closed 8 years ago

dmabtrg commented 8 years ago

This PR adds the sensors, sensors create, sensors update, sensors send-data and sensors simulate-data commands to the CLI. This PR depends on #127.

This will fail until https://github.com/telefonicaid/iotagent-ul/issues/135 is fixed.

FiwareULPGC commented 8 years ago

We have tried this PR four times from a clean state ( removing all containers and images) and we still get the following error:

devtourguide@devtourguide:~/workspace/fiwareulpgc/fiware-devguide-app$ ./tour-guide sensors create
Waiting for tourguide to be ready [1]... OK.
Generating sensors for restaurants...
Response code: 400
Response headers: { 'x-powered-by': 'Express',
  'fiware-correlator': 'eddb9e57-f9b9-48aa-ba4f-7dfaec0ca81b',
  'content-type': 'application/json; charset=utf-8',
  'content-length': '118',
  etag: 'W/"76-nwOyJPj8ZTs2yftSro6J6w"',
  date: 'Thu, 08 Sep 2016 20:07:03 GMT',
  connection: 'close' }
Response data: {"name":"MISSING_CONFIG_PARAMS","message":"The following mandatory configuration parameters were missing: [\"type\"]"}
{"name":"MISSING_CONFIG_PARAMS","message":"The following mandatory configuration parameters were missing: [\"type\"]"}

In order to test this PR we are following this steps:

git checkout develop
git fetch --all
git merge upstream/develop 
git checkout -b test_branch
git merge dmabtrg/feature/cli-sensors
./tour-guide start
wait until tourguide started
./tour-guide sensors create 
albertinisg commented 8 years ago

I'll check it out!

albertinisg commented 8 years ago

The issue here was the same as with the Keyrock image. Until the image is build with the new changes, the changes are not in the image so, the cli scripts for the sensors are not inside the container. To test it, you can modify the docker-compose.yml to have the scripts available inside the container adding a volume in Tourguide:

tourguide:
    image: fiware/tutorials.tourguide-app:latest
    hostname: tourguide
    container_name: tourguide
    links:
        - orion
        - keyrock
        - idas
        - cygnus
    environment:
        - ORION_HOSTNAME=orion
        - ORION_NO_PROXY_HOSTNAME=orion
        - ORION_PORT=1026
        - ORION_PEP_ENABLED=false
        - IDAS_PORT=7896
        - IDAS_ADMIN_PORT=4041
        - IDAS_FIWARE_SERVICE=tourguide
        - IDAS_FIWARE_SERVICE_PATH=/
        - IDAS_API_KEY=tourguide-devices
        - IDM_HOSTNAME=keyrock
        - IDM_PORT=8000
    volumes_from:
        - keyrock
    volumes:
        - ../tutorials.TourGuide-App:/home/tourguide/tutorials.TourGuide-App

Then you can start it and create the sensors:

./tour-guide start
wait until tourguide started
./tour-guide sensors create 

I've tested and worked for me!

FiwareULPGC commented 8 years ago

Thanks for the test instructions! We have followed them and now we can use ./tourguide sensors create but we have a problem related to simulate data. If we perform ./tour-guide sensors create and then ./tour-guide sensors simulate-data -i b4056ec69fece581ef3319aba1b72c11cc4684ba-dining-temperature -t temperature -d 5 we get the following:

1

If we perform ./tour-guide sensors simulate-data -i b4056ec69fece581ef3319aba1b72c11cc4684ba-dining-temperature -t temperature -d 5 without create sensors we get:

2

Are we using the command incorrectly?

albertinisg commented 8 years ago

Fixed in 2dcd7c1 . Still, I'm having some issues using send-data and simulate-data. By executing the command, I get the following response:

./tour-guide sensors send-data -i d0136015ae5bda329a2d3211bfbfca53705ac687-kitchen-temperature -d 't|18'
{"name":"DEVICE_GROUP_NOT_FOUND","message":"Couldn\t find device group"}

But I still don't know the reason. I guess it's something related with https://github.com/telefonicaid/iotagent-ul/issues/135#issuecomment-245243227 so I'll have a look and ping you back!

albertinisg commented 8 years ago

I've updated the latest commit 7edf8601a3f1e92c4aac4a9d15f30e5b1bf68be6 fixing the last issue. Could you test it? Thanks!

FiwareULPGC commented 8 years ago

LGTM