Merge "New api for getting VPN session status"
This commit is contained in:
commit
a49a9dc94a
@ -325,6 +325,16 @@ class TestSession(test_resources.BaseTestResource):
|
|||||||
data=jsonutils.dumps(fake_sess, sort_keys=True),
|
data=jsonutils.dumps(fake_sess, sort_keys=True),
|
||||||
headers=self.default_headers())
|
headers=self.default_headers())
|
||||||
|
|
||||||
|
def test_session_get_status(self):
|
||||||
|
uuid = test_constants.FAKE_VPN_SESS_ID
|
||||||
|
mocked_resource = self.get_mocked_resource()
|
||||||
|
mocked_resource.get_status(uuid)
|
||||||
|
test_client.assert_json_call(
|
||||||
|
'get', mocked_resource,
|
||||||
|
'https://1.2.3.4/api/v1/%s/%s/status?source=realtime' % (
|
||||||
|
mocked_resource.uri_segment, uuid),
|
||||||
|
headers=self.default_headers())
|
||||||
|
|
||||||
|
|
||||||
class TestService(test_resources.BaseTestResource):
|
class TestService(test_resources.BaseTestResource):
|
||||||
|
|
||||||
|
@ -401,6 +401,14 @@ class Session(utils.NsxLibApiBase):
|
|||||||
body['enabled'] = enabled
|
body['enabled'] = enabled
|
||||||
return self.client.update(self.get_path(uuid), body=body)
|
return self.client.update(self.get_path(uuid), body=body)
|
||||||
|
|
||||||
|
def get_status(self, uuid, source='realtime'):
|
||||||
|
try:
|
||||||
|
return self.client.get(
|
||||||
|
self.get_path(uuid + '/status?source=%s' % source))
|
||||||
|
except Exception as e:
|
||||||
|
LOG.warning("No status found for session %s: %s", uuid, e)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
class Service(utils.NsxLibApiBase):
|
class Service(utils.NsxLibApiBase):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user