def test_get_gw_device_status(self): # NOTE(salv-orlando): This unit test mocks backend calls rather than # leveraging the fake NSX API client with mock.patch.object(nsxlib, 'do_request') as request_mock: l2gwlib.get_gateway_device_status(self.fake_cluster, 'whatever') request_mock.assert_called_once_with( "GET", "/ws.v1/transport-node/whatever/status", cluster=self.fake_cluster)
def get_nsx_device_status(cluster, nsx_uuid): try: status_up = l2gwlib.get_gateway_device_status(cluster, nsx_uuid) if status_up: return networkgw_db.STATUS_ACTIVE else: return networkgw_db.STATUS_DOWN except api_exc.NsxApiException: return networkgw_db.STATUS_UNKNOWN except n_exc.NotFound: return networkgw_db.ERROR
def get_nsx_device_status(cluster, nsx_uuid): try: status_up = l2gwlib.get_gateway_device_status( cluster, nsx_uuid) if status_up: return networkgw_db.STATUS_ACTIVE else: return networkgw_db.STATUS_DOWN except api_exc.NsxApiException: return networkgw_db.STATUS_UNKNOWN except n_exc.NotFound: return networkgw_db.ERROR