Repository: EMCECS/python-ecsclient

Issue:
Add support for the Nodes endpoint
Implement the Node endpoint for versions 2.x, 3.0, and 3.1.

Discussion:
coveralls: 
[![Coverage Status](https://coveralls.io/builds/13861017/badge)](https://coveralls.io/builds/13861017)

Coverage increased (+0.07%) to 57.514% when pulling **d6471385ce6b8908ac9dac4950bfd0831f64a106 on ecs-3_1-support** into **671ad67baabb986cc33409ea5b41411b87013fcf on master**.


Patch:
diff --git a/VERSION b/VERSION
index e25d8d9..0664a8f 100644
--- a/VERSION
+++ b/VERSION
@@ -1,1 +1,1 @@
-1.1.5
+1.1.6
diff --git a/ecsclient/common/provisioning/data_store.py b/ecsclient/common/provisioning/data_store.py
index 69f0402..6968d2b 100644
--- a/ecsclient/common/provisioning/data_store.py
+++ b/ecsclient/common/provisioning/data_store.py
@@ -200,7 +200,7 @@ class DataStore(object):
 
         :param name: User provided name (not verified or unique)
         :param description: User provided description (not verified or unique)
-        :param node_id: IP address for the commodity node
+        :param node_id: ID of the commodity node
         :param storage_pool_id: Desired storage pool ID for creating data store
         :returns a task object
         """
diff --git a/ecsclient/common/provisioning/node.py b/ecsclient/common/provisioning/node.py
index 2af37ec..6ab144a 100644
--- a/ecsclient/common/provisioning/node.py
+++ b/ecsclient/common/provisioning/node.py
@@ -19,9 +19,9 @@ class Node(object):
         """
         self.conn = connection
 
-    def get_nodes(self):
+    def list(self):
         """
-        Gets the data nodes that are currently configured in the cluster.
+        Gets a list of the data nodes that are currently configured in the cluster.
 
         Required role(s):
 
diff --git a/ecsclient/schemas.py b/ecsclient/schemas.py
index 4a9c003..8a763c3 100644
--- a/ecsclient/schemas.py
+++ b/ecsclient/schemas.py
@@ -796,3 +796,38 @@ VDC_KEYSTORE = {
         "chain"
     ]
 }
+
+NODE = {
+    "type": "object",
+    "properties": {
+        "rackId": {"type": "string"},
+        "version": {"type": "string"},
+        "nodeid": {"type": "string"},
+        "isLocal": {"type": "boolean"},
+        "nodename": {"type": "string"},
+        "ip": {"type": "string"},
+    },
+    "required": [
+        "rackId",
+        "version",
+        "nodeid",
+        "isLocal",
+        "nodename",
+        "ip"
+    ]
+}
+
+NODE_LIST = {
+    "type": "object",
+    "properties": {
+        "node": {
+            "type": "array",
+            "items": NODE,
+            "minItems": 1,
+            "uniqueItems": True
+        }
+    },
+    "required": [
+        "node"
+    ]
+}


Test patch:
diff --git a/tests/functional/test_node.py b/tests/functional/test_node.py
new file mode 100644
index 0000000..95a6492
--- /dev/null
+++ b/tests/functional/test_node.py
@@ -0,0 +1,9 @@
+from ecsclient import schemas
+from tests import functional
+
+
+class TestNode(functional.BaseTestCase):
+
+    def test_node_list(self):
+        response = self.client.node.list()
+        self.assertValidSchema(response, schemas.NODE_LIST)
diff --git a/tests/unit/test_node.py b/tests/unit/test_node.py
index 5c01719..541e22f 100644
--- a/tests/unit/test_node.py
+++ b/tests/unit/test_node.py
@@ -2,7 +2,6 @@ import testtools
 from requests_mock.contrib import fixture
 from mock import MagicMock
 from mock import mock
-from mock import patch
 from six.moves import http_client
 from ecsclient.client import Client
 from ecsclient.common.exceptions import ECSClientException
@@ -46,14 +45,14 @@ class TestNode(testtools.TestCase):
         self.requests_mock = self.useFixture(fixture.Fixture())
 
     @mock.patch('ecsclient.common.token_request.TokenRequest.get_token')
-    def test_get_nodes_throw_exception(self, mock_get_token):
+    def test_list_nodes_throw_exception(self, mock_get_token):
         self.requests_mock.register_uri('GET', 'https://127.0.0.1:4443/vdc/nodes',
                                         status_code=http_client.INTERNAL_SERVER_ERROR,
                                         text='Server Error')
         mock_get_token.return_value = 'FAKE-TOKEN-123'
 
         with super(testtools.TestCase, self).assertRaises(ECSClientException) as error:
-            self.client.node.get_nodes()
+            self.client.node.list()
 
         exception = error.exception
         self.assertEqual(self.requests_mock.last_request.method, 'GET')
@@ -63,13 +62,13 @@ class TestNode(testtools.TestCase):
         self.assertEqual(exception.http_status, http_client.INTERNAL_SERVER_ERROR)
 
     @mock.patch('ecsclient.common.token_request.TokenRequest.get_token')
-    def test_get_nodes(self, mock_get_token):
+    def test_list_nodes(self, mock_get_token):
         mock_get_token.return_value = 'FAKE-TOKEN-123'
         self.requests_mock.register_uri('GET', 'https://127.0.0.1:4443/vdc/nodes',
                                         status_code=http_client.OK,
                                         json=self.returned_json)
 
-        response = self.client.node.get_nodes()
+        response = self.client.node.list()
 
         self.assertEqual(self.requests_mock.last_request.method, 'GET')
         self.assertEqual(self.requests_mock.last_request.url, 'https://127.0.0.1:4443/vdc/nodes')