-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Link Style Settings #6
Comments
Hello, thank you for the proposal. However, I believe this is an EVE-NG Pro feature. I checked the EVE-NG |
I pinged RedFish to get you a license - will buy you one if they can't issue w/out a PO. You can find my email address in a bunch of metasploit modules if you just Meantime, if you could scaffold the logic (i'm not great with the way structures are being defined here) to implement, i'm happy to test in our lab. We dont expose it to the WAN and i can't provide third parties access due to NDAs around what's in it but i write enough Go to be dangerous (offsec person, have to do a bit of everything) and probably get this over the finish line between engineering tasks. |
These should be the viable keys for the params hash to a
which you should be able to get from the topology endpoint (https://www.eve-ng.net/index.php/how-to-eve-ng-api/) when it dumps the JSON of all links. Our call for that is def get_topology(id = nil, path = @lab)
get_lab(path + '/topology' + (id.nil? ? '' : "/#{id}"))
end If you don't already have a toplogy data type, might be handy to implement as a way to access their side of state structurally (when you go hard against their API, it can ... have issues. RedFish and crew have done tons of work to help with that over the last couple of years but its not 100% foolproof yet). |
Actually, come to think of it... when i wrote that Ruby lib there was a ton of undocumented stuff as well which i had to MiTM out of the browser's interaction with EVE. Anything you can do in the browser you can do in the API, its just not necessarily all documented. |
Once I have EVE-NG Pro up and running, implementing those structures should be relatively quick. I noticed the EVE-NG API documentation isn’t very comprehensive; I usually dive straight into the source code it’s faster than making all the requests and dissecting everything one step at a time. I also noticed that their API didn’t respond correctly when I sent requests too quickly, but adding a mutex to handle one request at a time was enough to resolve the issue. |
If you'd like me to prioritize certain features over others, please create a separate issue for each feature so I can address them in order of priority. |
My version for the actual dispatch of HTTP methods is gory manual stuff (part of why the Ruby lib was never published) but here's a taste of horror: def _call(uri, data = nil)
# Cleanup URI
uri = "/#{uri}" unless uri[0] == '/'
uri = "/api#{uri}" unless uri =~ /^\/api/
uri.gsub!(/\/\//,'/')
# Build params
params = {
:url => @server + uri,
:method => caller_locations(1,1)[0].label.to_sym,
:headers => {
:content_type => :json,
:accept => :json
},
:cookies => (@cookies.dup || {}).merge({'html5' => '-1'}),
:verify_ssl => @verify_ssl
}
params[:payload] = (data.is_a?(Hash) ? data.to_json : data) if [:post, :put].any? { |m| params[:method] == m }
@last_params ||= {}
@last_params[params[:method]] = params.dup if uri !~ /status$|login$/
# Run request, retry
ctr = 0
begin
res = RestClient::Request.execute(params)
@cookies.merge!(res.cookies)
rescue RestClient::PreconditionFailed => e
puts e
puts e.backtrace
ctr += 1
raise e if ctr > 3
logout
sleep 1
login
session_info
system_status
retry
rescue RestClient::BadRequest, RestClient::InternalServerError => e
@last_error = e
res = e.http_body
end
raise "#{res}" if res == "{\"code\":400,\"status\":\"fail\",\"message\":\"Failed to lock the lab (60061).\"}"
return res
end |
Roger, i think this is the top one. Will create lower priority ones for tracking. |
Thanks for setting this up - declarative interaction with the API is a much more sane approach than what we've been doing with a bespoke Ruby lib.
The link styling calls are fun, our imperative version is:
which calls
to figure out what's connected to what and then
PUT
the style params into thenode
API endpoint's/style
target.We use this in calls such as
which for a TF provider can be left to the user quite easily since everyone has their own way of representing link attributes.
Not sure how much of that logic belongs in your interface lib and how much goes into the provider but looks to me like
UpdateNodeInterface
could be expanded for this in the SDK and expose a clean interface to the provider to set style as a nested schema on the link.The text was updated successfully, but these errors were encountered: