Fiware: Issue when registering a service through IDAS - fiware

I'm using IDAS. I can register a service through an IoT Agent, but if I try to do it using the iota manager, seems that I can't due to an issue with the protocols. When I try to register it:
curl -X POST 172.21.0.23:8091/iot/services \
-i \
-H "Content-Type: application/json" \
-H "Fiware-Service: sanitysrvm" \
-H "Fiware-ServicePath: /sanitysspath" \
-d '{"services": [{ "apikey": "apikey", "token": "token", "cbroker": "http://127.0.0.1:1026", "entity_type": "thingsrv", "protocol": ["PDI-IoTA-UltraLight"] }]}'
I get this response:
HTTP/1.1 400 Bad Request
Connection: close
Host: 172.21.0.23:8091
Content-Length: 94
Content-Type: application/json
{"reason":"The request is not well formed","details":"No exists protocol PDI-IoTA-UltraLight"}
I have checked the protocols:
http://172.21.0.23:8091/iot/protocols
But seems that there are none:
{ "count": 0,"protocols": []}
Is this issue related, as it seems, with the protocol?
Can be that the protocol wan't correctly defined when installing the IDAS?
How should I define the protocols?
Thanks!

I think you just installed IDAS iot-agent-base-xxxxxxx, and not the iot-agent-ul-xxxxxxx rpm package
I have a running installation and I installed it as follows (you may change the DGIT_VERSION and DGIT_COMMIT values in cmake command to build a newer version if possible):
git clone https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus.git
pwd
cd fiware....
mkdir -p build/Release
cd build/Release
cmake -DGIT_VERSION=20527 -DGIT_COMMIT=217023407f25ed258043cfc00a46b6c05fb0b52c -DMQTT=ON -DCMAKE_BUILD_TYPE=Release ../../
make install
make package
The packages will be created in pack/Linux/RPM/
rpm -i iot-agent-base-xxxxxxx
rpm -i iot-agent-ul-xxxxxx
IDAS will be installed in /usr/local/iot
Hope this helps you.

Related

Google Cloud SDK cURL cloud not resolve host

I am trying to setup Google Cloud Api on windows. I spend many hours to fix this issue read all related questions nothing helps!
First I set the variable
set GOOGLE_APPLICATION_CREDENTIALS="C:\Users\Desktop\directory\filename.json"
curl -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
--data "{
'input':{
'text':'Android is a mobile operating system developed by Google,
based on the Linux kernel and designed primarily for
touchscreen mobile devices such as smartphones and tablets.'
},
'voice':{
'languageCode':'en-gb',
'name':'en-GB-Standard-A',
'ssmlGender':'FEMALE'
},
'audioConfig':{
'audioEncoding':'MP3'
}
}" "https://texttospeech.googleapis.com/v1/text:synthesize" > synthesize-text.txt
As describe in google documentation. But in command line
curl: (6) cloud not resolve host: auth
curl: (6) cloud not resolve host: application-default
curl: (6) cloud not resolve host: print-access-token
Show me this error. In synthesize-text.txt says that error code 401.
How can I fix this. Any help appreciate.
Edit:
When I excuse the gcloud auth application-default print-acces-token command
Returns Environment variable does not exist! But ı excute the set command. What am I doing wrong ?
This is due to windows doesn't accept the $(gcloud auth application-default print-access-token) usage.
You can try writing the command output for the print-access-token to a file. For instance:
gcloud auth application-default print-access-token > token.txt
Then you can assign this to an environment variable:
set /p token=<token.txt
And try running your Text-to-Speech API request like this:
curl -H "Authorization: Bearer "%token% \
-H "Content-Type: application/json; charset=utf-8" \
--data "{
'input':{
'text':'Android is a mobile operating system developed by Google,
based on the Linux kernel and designed primarily for
touchscreen mobile devices such as smartphones and tablets.'
},
'voice':{
'languageCode':'en-gb',
'name':'en-GB-Standard-A',
'ssmlGender':'FEMALE'
},
'audioConfig':{
'audioEncoding':'MP3'
}
}" "https://texttospeech.googleapis.com/v1/text:synthesize" > synthesize-text.txt
Alternatively, you can try using the API Keys for your requests. For instance:
curl -H "Content-Type: application/json; charset=utf-8" \
--data "{
'input':{
'text':'Android is a mobile operating system developed by Google,
based on the Linux kernel and designed primarily for
touchscreen mobile devices such as smartphones and tablets.'
},
'voice':{
'languageCode':'en-gb',
'name':'en-GB-Standard-A',
'ssmlGender':'FEMALE'
},
'audioConfig':{
'audioEncoding':'MP3'
}
}" "https://texttospeech.googleapis.com/v1/text:synthesize?key=YOUR_API_KEY" > synthesize-text.txt

hadoop + ambari cluster change configuration

I want to upload the new bluprint.json file to my ambari cluster as the following
curl -u admin:admin -H "X-Requested-By: ambari" -X GET http://10.14.5.40:8080/api/v1/clusters/HDP6?format=blueprint -o /tmp/1-HDP6_blueprint.json
when I run it , seems that every thing is ok because we not get any warning /error
but when I read the ambari GUI parameters I see that the new bluprint.json not affected the ambari cluster with the new configuration
how to debug this ?, or how to get notification from the curl ... syntax about what happens ?
Please note that curl command you used is for downloading existing cluster configuration in blueprint format (its XGET).
You will have to use curl -XPOST to register and upload new blueprint to ambari.
curl --verbose -H "X-Requested-By: ambari" -X POST -u admin:admin http://10.14.5.40:8080/api/v1/blueprints/:HDP6new?validate_topology=false --data "#./blueprint.json"
Also note that, to change existing cluster configuration, uploading modified bluetooth is not correct way. You may refer this document for modifying configurations.

OpenShift/Origin API call to initiate a deployment

Hi :) I'm trying to mimic the oc cli API call to the master node that initiates a deployment. So eventually, I can have a chatbot that can initiate a deployment without needing to install the oc cli.
What is the API call to initiate a deployment?
When I look at what the oc cli is doing with oc deploy <app> --latest --loglevel=9. I see it fetching information only:
curl -k -v -XGET -H "Authorization: Bearer <token>" -H "User-Agent: oc/v1.3.0 (darwin/amd64) openshift/d451518" -H "Accept: application/json, */*" https://<host>:<port>/oapi/v1/namespaces/<namespace>/deploymentconfigs/<app>
curl -k -v -XGET -H "User-Agent: oc/v1.3.0+52492b4 (darwin/amd64) kubernetes/52492b4" -H "Authorization: Bearer <token>" -H "Accept: application/json, */*" https://<host>:<port>/api/v1/namespaces/<namespace>/replicationcontrollers/<app>-15
Where does it make the call to initiate the deployment? And how do I mimic it?
I wasn't able to find anything in these docs:
https://docs.openshift.org/latest/rest_api/openshift_v1.html
https://docs.openshift.org/latest/rest_api/kubernetes_v1.html
Thank you for your time!
Not sure if this is where you are wanting to go but your maybe looking for this
create instantiate of a DeploymentRequest
POST /oapi/v1/namespaces/{namespace}/deploymentconfigs/{name}/instantiate
https://docs.openshift.org/latest/rest_api/openshift_v1.html#create-instantiate-of-a-deploymentrequest
https://docs.openshift.org/latest/rest_api/openshift_v1.html#v1-deploymentrequest

SDC from the CLI. Cannot install a product on VM

Following what says here, I got a connection refused using this curl:
curl -v -H "Content-Type: application/json" -H "Accept: application/xml" -H "X-Auth-Token: 756cfb31e062216544215f54447e2716" -H "Tenant-Id: your-tenant-id" -X POST "http://saggita.lab.fi-ware.org:8080/sdc/rest/vdc/{your-tenant-id}/productInstance"
I changed it to what seems the appropriate URL:
cat test-data | curl --insecure -v -H "Content-Type: application/json" -H "Accept: application/xml" -H "X-Auth-Token: 756cfb31e062216544215f54447e2716" -H "Tenant-Id: your-tenant-id" -X POST "https://saggita.lab.fi-ware.org:8443/sdc/rest/vdc/{your-tenant-id}/productInstance" --data-binary #-
Comment: I used the file test-data as payload, I show later what payload I am using.
With that petition (with the appropriate auth token and specific parameters for my environment) I got:
Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
Seems is expecting JSON instead of XML, so I rearranged like this:
cat test-data | curl --insecure -v -H "Content-Type: application/xml" -H "Accept: application/xml" -H "X-Auth-Token: 756cfb31e062216544215f54447e2716" -H "Tenant-Id: your-tenant-id" -X POST "https://saggita.lab.fi-ware.org:8443/sdc/rest/vdc/{your-tenant-id}/productInstance" --data-binary #-
And I got this message no matter how I change payload:
{"message":"The entity is not valid","code":42}
I tried this two payloads (with the example of installing apache):
<productInstanceDto>
<vm>
<ip>MYIP</ip>
<fqn>same as hostname, I don't have DNS resolution</fqn>
<hostname>MYHOSTNAME</hostname>
</vm>
<product>
<productDescription/>
<name>apache2</name>
</product>
<attributes>
<key>custom_att_02</key>
<value>default_value_plain</value>
<type>Plain</type>
</attributes>
</productInstanceDto>
What I see as a very minimialist and clear payload
<productInstanceDto>
<vm>
<ip>MYIP</ip>
</vm>
<product>
<name>apache2</name>
</product>
</productInstanceDto>
By the way, I see so unfortunate fields like fqdn (could be missing, no dns resolution on that server), version (why I have to know the version of the product I want to install, this does not appear in the Product Catalogue), the missing of VM_ID parameter: available, easy and unique.
What I'm doing wrong?
Thanks
You are using the FIWARE Lab infrastructure for using the SDC component. However, they are some requirements to install software inside the VM, for instance, having chef/puppet installed, to have the VM registered in the chef-server (you can have a look at https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Software_Deployment_%26_Configuration_-_Installation_and_Administration_Guide). Thus, my suggestion if you want to use SDC in FIWARE Lab infrastructure is that you use the blueprint capabilities in the cloud portal (cloud.lab.fiware.org), which deploy the VMs, prepare the VMs, register the VMs in the chef-server and so on. You can have a look at the video blueprints in http://help.lab.fiware.org/.

Wget windows and multiple --header switches

I'm trying to use wget 1.11.4 running on Windows Server 2003 to do some JSON with a web site. I can retrieve info OK but I can't send any. I'm not positive that my JSON is formatted correctly but there seems to be a more fundamental problem.
If I do:
wget --header="Authorization: Bearer <redacted>" --no-check-certificate --post-data="{'workspaces':{'title':'CMC Regulatory Support','creator_role':'maven'}}" https://api.mavenlink.com/api/v1/workspaces.json
I get a JSON error back from the site "ERROR 422: Unprocessable Entity." But if I add another --header:
wget -S --header="Authorization: Bearer <redacted>" -–header="Content-Type: application/json" --no-check-certificate --post-data="{'workspaces':{'title':'CMC Regulatory Support','creator_role':'maven'}}" https://api.mavenlink.com/api/v1/workspaces.json
I get:
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\Program Files\GnuWin32/etc/wgetrc
wget: invalid option -- û
Usage: wget [OPTION]... [URL]...
Try `wget --help' for more options.
but the manual clearly states that multiple --header switches are allowed, and I see that swithc used in examples on the web?. WTF?
Your second --header parameter before the Content-Type contains different dashes.
-–header="Content-Type
If you fix it wget will send the request.