How to access OneFlow REST API in Opennebula 5.2?


(Ranjith Kumar) #1

I want to implement oneflow service via REST api.

$ curl -u “username:password” https://oneflow.server

What is oneflow.server address? Is it the sunstone ip or host ip address? I gave the sunstone ip its not working?


(Felipe Arturo Polanco) #2

run this in the frontend:
(assuming SystemD distro)
systemctl start opennebula-flow
systemctl enable opennebula-flow (for boot starting)
systemctl start opennebula-gate
systemctl enable opennebula-gate (for boot starting)

Normally the onegate server is located in the same frontend, so you should see the ports opened in the frontend server, after that make sure your application can reach the IP of the frontend via internally or externally.

Bonus:
Here is a REST call I use all the time to pass custom variables between VMs and Oneflow for autoscaling.

//first source the context.sh located in /dev/sr0, mount it somewhere and source it.

curl -X “PUT” “${ONEGATE_ENDPOINT}/vm” --header “X-ONEGATE-TOKEN: $ONEGATE_TOKEN” --header “X-ONEGATE-VMID: $VMID” -d “MYVAR1=6”


(Ranjith Kumar) #3

How create services from service template with name using REST api. While instantiating a service template i want to give name to the service like this:

curl -u “oneadmin:password” http://...:*/service_template/0/action --data ‘{“name”: “ranjith”, “action”: {“perform”:“insantiate”}}’

This is creating service with default name. i want to add my own name. How to do it?