diff --git a/vmware_nsxlib/tests/unit/v3/test_cluster.py b/vmware_nsxlib/tests/unit/v3/test_cluster.py index 15e4ea5c..5e4fa111 100644 --- a/vmware_nsxlib/tests/unit/v3/test_cluster.py +++ b/vmware_nsxlib/tests/unit/v3/test_cluster.py @@ -200,20 +200,7 @@ class RequestsHTTPProviderTestCase(unittest.TestCase): mock_cluster.nsxlib_config = conf return (mock_cluster, mock_ep, mock_conn) - def test_validate_connection_method_v1(self): - mock_cluster, mock_ep, mock_conn = self._validate_con_mocks('2.3.0') - provider = cluster.NSXRequestsHTTPProvider() - with mock.patch.object(client.JSONRESTClient, "get", - return_value={'application_status': 'DOWN'}): - self.assertRaises(nsxlib_exc.ResourceNotFound, - provider.validate_connection, - mock_cluster, mock_ep, mock_conn) - - with mock.patch.object(client.JSONRESTClient, "get", - return_value={'application_status': 'WORKING'}): - provider.validate_connection(mock_cluster, mock_ep, mock_conn) - - def test_validate_connection_method_v2(self): + def test_validate_connection_method(self): mock_cluster, mock_ep, mock_conn = self._validate_con_mocks('2.4.0') provider = cluster.NSXRequestsHTTPProvider() with mock.patch.object(client.JSONRESTClient, "get", diff --git a/vmware_nsxlib/v3/__init__.py b/vmware_nsxlib/v3/__init__.py index 9c1e740b..5d5abb9b 100644 --- a/vmware_nsxlib/v3/__init__.py +++ b/vmware_nsxlib/v3/__init__.py @@ -125,36 +125,18 @@ class NsxLib(lib.NsxLibBase): @property def validate_connection_method(self): """Return a method that will validate the NSX manager status""" - def check_manager_status_v1(client, manager_url): - """MP healthcheck for Version 2.3 and below""" - # Try to get the cluster status silently and with no retries - status = client.get('operational/application/status', - silent=True, with_retries=False) - if (not status or status.get('application_status') != 'WORKING'): - msg = _("Manager is not in working state: %s") % status - LOG.warning(msg) - raise exceptions.ResourceNotFound( - manager=manager_url, operation=msg) - def check_manager_status_v2(client, manager_url): + def check_manager_status(client, manager_url): """MP healthcheck for Version 2.4 and above""" # Try to get the status silently and with no retries status = client.get('reverse-proxy/node/health', silent=True, with_retries=False) - if (not status or not status.get('healthy', False)): + if not status or not status.get('healthy', False): msg = _("Manager is not in working state: %s") % status LOG.warning(msg) raise exceptions.ResourceNotFound( manager=manager_url, operation=msg) - def check_manager_status(client, manager_url): - # Decide on the healthcheck by the version (if already initialized) - if (self.nsx_version and - version.LooseVersion(self.nsx_version) >= - version.LooseVersion(nsx_constants.NSX_VERSION_2_4_0)): - return check_manager_status_v2(client, manager_url) - return check_manager_status_v1(client, manager_url) - return check_manager_status def get_version(self):