Skip to content

Instantly share code, notes, and snippets.

@saliceti
Created October 19, 2015 14:58
Show Gist options
  • Save saliceti/9b64ed5bb91b6def4cdb to your computer and use it in GitHub Desktop.
Save saliceti/9b64ed5bb91b6def4cdb to your computer and use it in GitHub Desktop.
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