New default port: 5311

Change-Id: I74a7fd4e8b808350f5b153ca8cd8dd85cade0827
This commit is contained in:
aviau 2015-07-03 09:10:13 -04:00
parent a6c0d3f889
commit 61c59b730f
16 changed files with 44 additions and 44 deletions

View File

@ -13,8 +13,8 @@ You'll need to provide the Surveil API URL. You can do this with the
``--surveil-api-url`` parameter, but it's easier to just set it as environment ``--surveil-api-url`` parameter, but it's easier to just set it as environment
variable:: variable::
export SURVEIL_API_URL=http://localhost:8080/v2 export SURVEIL_API_URL=http://localhost:5311/v2
export SURVEIL_AUTH_URL=http://localhost:8080/v2/auth export SURVEIL_AUTH_URL=http://localhost:5311/v2/auth
You'll find complete documentation on the shell by running ``surveil help``. You'll find complete documentation on the shell by running ``surveil help``.
@ -31,8 +31,8 @@ Python API
To use the python API, simply create a client with the endpoint:: To use the python API, simply create a client with the endpoint::
from surveilclient import client from surveilclient import client
c = client.Client('http://localhost:8080/v2', c = client.Client('http://localhost:5311/v2',
auth_url='http://localhost:8080/v2/auth', auth_url='http://localhost:5311/v2/auth',
version='2_0') version='2_0')
hosts = c.config.hosts.list() hosts = c.config.hosts.list()

View File

@ -49,7 +49,7 @@ class SurveilShell(object):
parser.add_argument('--surveil-api-url', parser.add_argument('--surveil-api-url',
default=utils.env( default=utils.env(
'SURVEIL_API_URL', 'SURVEIL_API_URL',
default='http://localhost:8080/v2'), default='http://localhost:5311/v2'),
help='Defaults to env[SURVEIL_API_URL].') help='Defaults to env[SURVEIL_API_URL].')
parser.add_argument('--surveil-api-version', parser.add_argument('--surveil-api-version',

View File

@ -23,7 +23,7 @@ from surveilclient.common import http
class TestHttp(unittest.TestCase): class TestHttp(unittest.TestCase):
def setUp(self): def setUp(self):
self.surveil_url = 'http://surveil:8080/v1' self.surveil_url = 'http://surveil:5311/v1'
self.client = http.HTTPClient(self.surveil_url, authenticated=False) self.client = http.HTTPClient(self.surveil_url, authenticated=False)
@httpretty.activate @httpretty.activate

View File

@ -22,16 +22,16 @@ from surveilclient.v2_0 import client as v2_0_client
class TestClient(unittest.TestCase): class TestClient(unittest.TestCase):
def test_client_default_version(self): def test_client_default_version(self):
sc = client.Client('http://localhost:8080/sdf', sc = client.Client('http://localhost:5311/sdf',
auth_url='http://localhost:8080/v2/auth') auth_url='http://localhost:5311/v2/auth')
self.assertTrue(isinstance(sc, v2_0_client.Client)) self.assertTrue(isinstance(sc, v2_0_client.Client))
def test_client_init_v1(self): def test_client_init_v1(self):
sc = client.Client('http://localhost:8080/v1', version='1_0') sc = client.Client('http://localhost:5311/v1', version='1_0')
self.assertTrue(isinstance(sc, v1_0_client.Client)) self.assertTrue(isinstance(sc, v1_0_client.Client))
def test_client_init_v2(self): def test_client_init_v2(self):
sc = client.Client('http://localhost:8080/v2', sc = client.Client('http://localhost:5311/v2',
auth_url='http://localhost:8080/v2/auth', auth_url='http://localhost:5311/v2/auth',
version='2_0') version='2_0')
self.assertTrue(isinstance(sc, v2_0_client.Client)) self.assertTrue(isinstance(sc, v2_0_client.Client))

View File

@ -22,7 +22,7 @@ class TestAcknowledge(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_create(self): def test_create(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/actions/acknowledge", httpretty.POST, "http://localhost:5311/v2/actions/acknowledge",
body='{"message": "Ack received!"}') body='{"message": "Ack received!"}')
self.client.actions.acknowledge.create( self.client.actions.acknowledge.create(

View File

@ -22,7 +22,7 @@ class TestDowntime(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_create(self): def test_create(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/actions/downtime", httpretty.POST, "http://localhost:5311/v2/actions/downtime",
body='{"message": "Ack received!"}') body='{"message": "Ack received!"}')
self.client.actions.downtime.create( self.client.actions.downtime.create(

View File

@ -23,7 +23,7 @@ class TestRecheck(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_create(self): def test_create(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/actions/recheck", httpretty.POST, "http://localhost:5311/v2/actions/recheck",
body='{"message": "Ack received!"}') body='{"message": "Ack received!"}')
self.client.actions.recheck.create( self.client.actions.recheck.create(

View File

@ -22,8 +22,8 @@ from surveilclient import client
class ClientTest(unittest.TestCase): class ClientTest(unittest.TestCase):
def setUp(self): def setUp(self):
self.client = client.Client('http://localhost:8080/v2', self.client = client.Client('http://localhost:5311/v2',
auth_url='http://localhost:8080/v2/auth', auth_url='http://localhost:5311/v2/auth',
version='2_0') version='2_0')
# Mock the _get_auth_token call # Mock the _get_auth_token call

View File

@ -22,7 +22,7 @@ class TestCheckModulations(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_create(self): def test_create(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/config/checkmodulations", httpretty.POST, "http://localhost:5311/v2/config/checkmodulations",
body='{"message": "Ack received!"}') body='{"message": "Ack received!"}')
self.client.config.checkmodulations.create( self.client.config.checkmodulations.create(
@ -41,7 +41,7 @@ class TestCheckModulations(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_list(self): def test_list(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.GET, "http://localhost:8080/v2/config/checkmodulations", httpretty.GET, "http://localhost:5311/v2/config/checkmodulations",
body='[{"checkmodulation_name": "test","check_command": "test",' body='[{"checkmodulation_name": "test","check_command": "test",'
'"check_period": "test"}]' '"check_period": "test"}]'
) )
@ -55,7 +55,7 @@ class TestCheckModulations(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_delete(self): def test_delete(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.DELETE, "http://localhost:8080/v2/config/" httpretty.DELETE, "http://localhost:5311/v2/config/"
"checkmodulations/checkmodulation_to_delete", "checkmodulations/checkmodulation_to_delete",
body='body') body='body')

View File

@ -25,7 +25,7 @@ class TestCommands(clienttest.ClientTest):
def test_list(self): def test_list(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.GET, httpretty.GET,
"http://localhost:8080/v2/config/commands", "http://localhost:5311/v2/config/commands",
body='[{"command_name":"myCommand"}]' body='[{"command_name":"myCommand"}]'
) )
@ -37,7 +37,7 @@ class TestCommands(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_create(self): def test_create(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/config/commands", httpretty.POST, "http://localhost:5311/v2/config/commands",
body='{"command_name": "new_command", "command_line": "new_line"}' body='{"command_name": "new_command", "command_line": "new_line"}'
) )
@ -58,7 +58,7 @@ class TestCommands(clienttest.ClientTest):
def test_show(self): def test_show(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.GET, httpretty.GET,
"http://localhost:8080/v2/config/commands/command_to_show", "http://localhost:5311/v2/config/commands/command_to_show",
body='{"command_name": "command_to_show", "command_line": "line"}' body='{"command_name": "command_to_show", "command_line": "line"}'
) )
@ -78,7 +78,7 @@ class TestCommands(clienttest.ClientTest):
def test_update(self): def test_update(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.PUT, httpretty.PUT,
"http://localhost:8080/v2/config/commands/command_to_update", "http://localhost:5311/v2/config/commands/command_to_update",
body='{"command_line": "updated command_line"}' body='{"command_line": "updated command_line"}'
) )
@ -99,7 +99,7 @@ class TestCommands(clienttest.ClientTest):
def test_delete(self): def test_delete(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.DELETE, httpretty.DELETE,
"http://localhost:8080/v2/config/commands/command_to_delete", "http://localhost:5311/v2/config/commands/command_to_delete",
body="body" body="body"
) )

View File

@ -24,7 +24,7 @@ class TestHosts(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_list(self): def test_list(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.GET, "http://localhost:8080/v2/config/hosts", httpretty.GET, "http://localhost:5311/v2/config/hosts",
body='[{"host_name": "host1"}]' body='[{"host_name": "host1"}]'
) )
@ -38,7 +38,7 @@ class TestHosts(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_create(self): def test_create(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/config/hosts", httpretty.POST, "http://localhost:5311/v2/config/hosts",
body='{"host_name": "new_host", "address": "192.168.2.1"}' body='{"host_name": "new_host", "address": "192.168.2.1"}'
) )
@ -59,7 +59,7 @@ class TestHosts(clienttest.ClientTest):
def test_show(self): def test_show(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.GET, httpretty.GET,
"http://localhost:8080/v2/config/hosts/host_name_to_show", "http://localhost:5311/v2/config/hosts/host_name_to_show",
body='{"host_name": "host_name_to_show"}' body='{"host_name": "host_name_to_show"}'
) )
@ -76,7 +76,7 @@ class TestHosts(clienttest.ClientTest):
def test_update(self): def test_update(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.PUT, httpretty.PUT,
"http://localhost:8080/v2/config/hosts/host_name_to_update", "http://localhost:5311/v2/config/hosts/host_name_to_update",
body='{"test": "test"}' body='{"test": "test"}'
) )
@ -99,7 +99,7 @@ class TestHosts(clienttest.ClientTest):
def test_delete(self): def test_delete(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.DELETE, httpretty.DELETE,
"http://localhost:8080/v2/config/hosts/host_name_to_delete", "http://localhost:5311/v2/config/hosts/host_name_to_delete",
body="body" body="body"
) )

View File

@ -22,7 +22,7 @@ class TestServices(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_list(self): def test_list(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.GET, "http://localhost:8080/v2/config/services", httpretty.GET, "http://localhost:5311/v2/config/services",
body='[{"service_name": "service1"}]' body='[{"service_name": "service1"}]'
) )
@ -36,7 +36,7 @@ class TestServices(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_create(self): def test_create(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/config/services", httpretty.POST, "http://localhost:5311/v2/config/services",
body='{"service_name": "new_service"}' body='{"service_name": "new_service"}'
) )
@ -53,7 +53,7 @@ class TestServices(clienttest.ClientTest):
def test_delete(self): def test_delete(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.DELETE, httpretty.DELETE,
"http://localhost:8080/v2/config/hosts/host_name/" + "http://localhost:5311/v2/config/hosts/host_name/" +
"services/service_description", "services/service_description",
body="body" body="body"
) )

View File

@ -23,7 +23,7 @@ class TestEvents(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_list(self): def test_list(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/status/events", httpretty.POST, "http://localhost:5311/v2/status/events",
body='[{"host_name": "sfl.com", "service_description": "cpu", ' body='[{"host_name": "sfl.com", "service_description": "cpu", '
'"event_type": "ALERT", "output": "Ok"},' '"event_type": "ALERT", "output": "Ok"},'
'{"host_name": "sfl.com", "service_description": "cpu", ' '{"host_name": "sfl.com", "service_description": "cpu", '
@ -53,7 +53,7 @@ class TestEvents(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_list_with_live_query(self): def test_list_with_live_query(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/status/events", httpretty.POST, "http://localhost:5311/v2/status/events",
body='[{"host_name": "sfl.com", "service_description": "cpu", ' body='[{"host_name": "sfl.com", "service_description": "cpu", '
'"event_type": "ALERT", "output": "Ok"},' '"event_type": "ALERT", "output": "Ok"},'
'{"host_name": "sfl.com", "service_description": "cpu", ' '{"host_name": "sfl.com", "service_description": "cpu", '

View File

@ -24,7 +24,7 @@ class TestHosts(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_list(self): def test_list(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/status/hosts", httpretty.POST, "http://localhost:5311/v2/status/hosts",
body='[{"host_name": "host1"}]' body='[{"host_name": "host1"}]'
) )
@ -38,7 +38,7 @@ class TestHosts(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_get(self): def test_get(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.GET, "http://localhost:8080/v2/status/hosts/hostname", httpretty.GET, "http://localhost:5311/v2/status/hosts/hostname",
body='{"host_name": "host1"}' body='{"host_name": "host1"}'
) )
@ -52,7 +52,7 @@ class TestHosts(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_submit_host_check_result(self): def test_submit_host_check_result(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/status/hosts/localhost" httpretty.POST, "http://localhost:5311/v2/status/hosts/localhost"
"/results", "/results",
body='' body=''
) )

View File

@ -22,7 +22,7 @@ class TestMetrics(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_list_metrics(self): def test_list_metrics(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/status/" httpretty.POST, "http://localhost:5311/v2/status/"
"hosts/localhost/metrics/load1", "hosts/localhost/metrics/load1",
body='[{"min": "2", "warning": "15", "value": "3"},' body='[{"min": "2", "warning": "15", "value": "3"},'
'{"min": "5", "warning": "200", "value": "150"}]' '{"min": "5", "warning": "200", "value": "150"}]'
@ -43,7 +43,7 @@ class TestMetrics(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_list_service(self): def test_list_service(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/status/hosts/localhost" httpretty.POST, "http://localhost:5311/v2/status/hosts/localhost"
"/services/load/metrics/load1", "/services/load/metrics/load1",
body='[{"min": "2", "warning": "15", "value": "3"},' body='[{"min": "2", "warning": "15", "value": "3"},'
'{"min": "5", "warning": "200", "value": "150"}]' '{"min": "5", "warning": "200", "value": "150"}]'
@ -64,7 +64,7 @@ class TestMetrics(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_show(self): def test_show(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.GET, "http://localhost:8080/v2/status/hosts/localhost" httpretty.GET, "http://localhost:5311/v2/status/hosts/localhost"
"/metrics/load1", "/metrics/load1",
body='{"min": "2", "warning": "15", "value": "3"}' body='{"min": "2", "warning": "15", "value": "3"}'
) )
@ -79,7 +79,7 @@ class TestMetrics(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_show_service(self): def test_show_service(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.GET, "http://localhost:8080/v2/status/hosts/localhost" httpretty.GET, "http://localhost:5311/v2/status/hosts/localhost"
"/services/load/metrics/load1", "/services/load/metrics/load1",
body='{"min": "2", "warning": "15", "value": "3"}' body='{"min": "2", "warning": "15", "value": "3"}'
) )
@ -95,7 +95,7 @@ class TestMetrics(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_list_metrics_name(self): def test_list_metrics_name(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.GET, "http://localhost:8080/v2/status/hosts/localhost" httpretty.GET, "http://localhost:5311/v2/status/hosts/localhost"
"/metrics", "/metrics",
body='[{"metric_name": "rta"},{"metric_name": "load5"}]' body='[{"metric_name": "rta"},{"metric_name": "load5"}]'
) )

View File

@ -24,7 +24,7 @@ class TestServices(clienttest.ClientTest):
@httpretty.activate @httpretty.activate
def test_list(self): def test_list(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/status/services", httpretty.POST, "http://localhost:5311/v2/status/services",
body='[{"service_name": "service1"}]' body='[{"service_name": "service1"}]'
) )
@ -39,7 +39,7 @@ class TestServices(clienttest.ClientTest):
def test_submit_service_check_result(self): def test_submit_service_check_result(self):
httpretty.register_uri( httpretty.register_uri(
httpretty.POST, httpretty.POST,
"http://localhost:8080/v2/status/hosts/localhost" "http://localhost:5311/v2/status/hosts/localhost"
"/services/testservice/results", "/services/testservice/results",
body='' body=''
) )