Node creation API problems

Before posting something, READ the changelog, WATCH the videos, howto and provide following:
Your install is: Bare metal, ESXi, what CPU model, RAM, HD, what EVE version you have, output of the uname -a and any other info that might help us faster.

Moderator: mike

Post Reply
wlbrian
Posts: 5
Joined: Wed Mar 03, 2021 5:39 am

Node creation API problems

Post by wlbrian » Wed Mar 03, 2021 3:59 pm

Hello, I'm running the latest eve-ng pro bare-metal from ISO on a Dell R720 with two Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz CPUs (32 cores), 400GB RAM and just over 6TB of disks.
I have built out most of my image templates to verify correct operation and to better understand the overall system, and have now started to build scripts to autobuild labs corresponding to our actual internal networks.
After having success GETing a number of objects and POSTing some folder and lab creation to generate the over all structure, I moved on to node creation.
My first attempt to use the API to create a node within a lab had some unusual behaviour.
I started off with a truncated POST, only using the parameters that I wanted to set explicitly, thinking that the API code on the backed would use template defaults for the rest, but it threw quite a nasty HTML error as a response (which I have attached).
After this error, any attempt to manipulate nodes within that specific lab would result in a "could not lock lab", both using curl and the web GUI. Even deleting and recreating the lab with the same name wouldn't fix the issue. I had to delete both the lab AND the folder the lab was in. Then I could recreate both and things would everything would work normally again.
Once I created a POST with the full set of JSON, I was able to at least get a more normal response from the server, but it was still an error (despite the "success", no nodes were created in the lab) : {"code":201,"status":"success","message":"Max nodes reached ( 1024 )","data":{"id":1}}
Even using the curl from the eve-ng guide as-is (only changing situation specific arguments) still throws the same error, even on a brand new lab I've never run any API calls against:

curl -s -c /tmp/cookie -b /tmp/cookie -X POST -d '{"type":"qemu","template":"Aruba OS-CX Virtual Switch","config":"Unconfigured","delay":0,"icon":"Switch L3.png","image":"arubacx-10.04","name":"test-sw1","left":"35%","top":"25%","ram":"4096","console":"telnet","cpu":2,"ethernet":5,"uuid":"641a4800-1b19-427c-ae87-4a8ee90b7790"}' -H 'Content-type: application/json' https://127.0.0.1/api/labs/Folder/apitest.unl/nodes

{"code":201,"status":"success","message":"Max nodes reached ( 1024 )","data":{"id":1}}

This is a new install (just over a week, basically now use), so there aren't more than a handful of nodes across the entire install.
Other API calls work fine, so I don't think there are permissions problems or more general formatting issues with my curl or JSON syntax.
All other labs/nodes are stopped while doing these operations, so I don't think its a CPU/disk/memory resource issue.
I have rebooted the server to make sure it wasn't simply a process in a bad state.
I can confirm that I'm able to create/delete/run nodes within the lab from the web GUI.
Any assistance would be appreciated.
Thanks!

-Brian
You do not have the required permissions to view the files attached to this post.

ecze
Posts: 533
Joined: Wed Mar 15, 2017 1:54 pm

Re: Node creation API problems

Post by ecze » Fri Mar 05, 2021 12:39 am

Call is wrong anyway...

template name seems wrong ( you must use template name, not template label )
config is a index number

spy your browser to get full and correct parameters....

payload sample:

{"template":"nxosv9k","type":"qemu","count":"5","image":"nxosv9k-9.2.1","name":"NXOS","icon":"Nexus7K.png","uuid":"","cpulimit":"undefined","cpu":"2","ram":"8192","ethernet":"8","firstmac":"","qemu_version":"","qemu_arch":"","qemu_nic":"","qemu_options":"-machine type=pc,accel=kvm -serial mon:stdio -nographic -enable-kvm","ro_qemu_options":"-machine type=pc,accel=kvm -serial mon:stdio -nographic -enable-kvm","config":"0","sat":"0","delay":"0","console":"telnet","rdp_user":"","rdp_password":"","left":"1077","top":"203","postfix":1,"numberNodes":"5"}

E.

wlbrian
Posts: 5
Joined: Wed Mar 03, 2021 5:39 am

Re: Node creation API problems

Post by wlbrian » Fri Mar 05, 2021 1:12 am

Thanks, changing to the yml file name (minus the .yml) in the template parameter allowed me to successfully create the node.
I'm sure I'll be back with more questions as I get the netdisco->eve-ng scripts written!

Post Reply