Created
October 19, 2015 14:58
-
-
Save saliceti/9b64ed5bb91b6def4cdb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "net/http" | |
require "uri" | |
require "json" | |
def print_router_routes(name, ip) | |
uri = URI.parse("http://#{ip}:8080/routes") | |
http = Net::HTTP.new(uri.host, uri.port) | |
request = Net::HTTP::Get.new(uri.request_uri) | |
request.basic_auth("router_user", "router_password") | |
response = http.request(request) | |
puts name + '-' + ip | |
puts JSON.load(response.body)["cf-example-ruby-sinatra.colin2345.cf2.paas.alphagov.co.uk"] | |
end | |
print_router_routes "router_z1/0", "10.0.0.21" | |
print_router_routes "router_z1/1", "10.0.0.24" | |
print_router_routes "router_z2/0", "10.0.0.23" | |
print_router_routes "router_z2/1", "10.0.0.26" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment