DNS Zones: List / Get (#271)

* Add Zone List / Get Support

* Addressing code review comments

* Adding v2 to DNS client

* List / Get unit tests plus updates to results for unit tests to work.

* DNS v2 List acceptance tests

* add failing unit test for dns v2 allpages

* Changing acceptance test for DNS v2 to use AllPages

* Adding empty zones.go file for package requirements

* Change ttl back to int

* DNS v2 Zones ListOpts
diff --git a/openstack/dns/v2/zones/testing/doc.go b/openstack/dns/v2/zones/testing/doc.go
new file mode 100644
index 0000000..54a0d21
--- /dev/null
+++ b/openstack/dns/v2/zones/testing/doc.go
@@ -0,0 +1,2 @@
+// dns_zones_v2
+package testing
diff --git a/openstack/dns/v2/zones/testing/fixtures.go b/openstack/dns/v2/zones/testing/fixtures.go
new file mode 100644
index 0000000..473ca90
--- /dev/null
+++ b/openstack/dns/v2/zones/testing/fixtures.go
@@ -0,0 +1,165 @@
+package testing
+
+import (
+	"fmt"
+	"net/http"
+	"testing"
+	"time"
+
+	"github.com/gophercloud/gophercloud"
+	"github.com/gophercloud/gophercloud/openstack/dns/v2/zones"
+	th "github.com/gophercloud/gophercloud/testhelper"
+	"github.com/gophercloud/gophercloud/testhelper/client"
+)
+
+// List Output is a sample response to a List call.
+const ListOutput = `
+{
+    "links": {
+      "self": "http://example.com:9001/v2/zones"
+    },
+    "metadata": {
+      "total_count": 2
+    },
+    "zones": [
+        {
+            "id": "a86dba58-0043-4cc6-a1bb-69d5e86f3ca3",
+            "pool_id": "572ba08c-d929-4c70-8e42-03824bb24ca2",
+            "project_id": "4335d1f0-f793-11e2-b778-0800200c9a66",
+            "name": "example.org.",
+            "email": "joe@example.org",
+            "ttl": 7200,
+            "serial": 1404757531,
+            "status": "ACTIVE",
+            "action": "CREATE",
+            "description": "This is an example zone.",
+            "masters": [],
+            "type": "PRIMARY",
+            "transferred_at": null,
+            "version": 1,
+            "created_at": "2014-07-07T18:25:31.275934",
+            "updated_at": null,
+            "links": {
+              "self": "https://127.0.0.1:9001/v2/zones/a86dba58-0043-4cc6-a1bb-69d5e86f3ca3"
+            }
+        },
+        {
+            "id": "34c4561c-9205-4386-9df5-167436f5a222",
+            "pool_id": "572ba08c-d929-4c70-8e42-03824bb24ca2",
+            "project_id": "4335d1f0-f793-11e2-b778-0800200c9a66",
+            "name": "foo.example.com.",
+            "email": "joe@foo.example.com",
+            "ttl": 7200,
+            "serial": 1488053571,
+            "status": "ACTIVE",
+            "action": "CREATE",
+            "description": "This is another example zone.",
+            "masters": ["example.com."],
+            "type": "PRIMARY",
+            "transferred_at": null,
+            "version": 1,
+            "created_at": "2014-07-07T18:25:31.275934",
+            "updated_at": "2015-02-25T20:23:01.234567",
+            "links": {
+              "self": "https://127.0.0.1:9001/v2/zones/34c4561c-9205-4386-9df5-167436f5a222"
+            }
+        }
+    ]
+}
+`
+
+// GetOutput is a sample response to a Get call.
+const GetOutput = `
+{
+    "id": "a86dba58-0043-4cc6-a1bb-69d5e86f3ca3",
+    "pool_id": "572ba08c-d929-4c70-8e42-03824bb24ca2",
+    "project_id": "4335d1f0-f793-11e2-b778-0800200c9a66",
+    "name": "example.org.",
+    "email": "joe@example.org",
+    "ttl": 7200,
+    "serial": 1404757531,
+    "status": "ACTIVE",
+    "action": "CREATE",
+    "description": "This is an example zone.",
+    "masters": [],
+    "type": "PRIMARY",
+    "transferred_at": null,
+    "version": 1,
+    "created_at": "2014-07-07T18:25:31.275934",
+    "updated_at": null,
+    "links": {
+      "self": "https://127.0.0.1:9001/v2/zones/a86dba58-0043-4cc6-a1bb-69d5e86f3ca3"
+    }
+}
+`
+
+// FirstZone is the first result in ListOutput
+var FirstZoneCreatedAt, _ = time.Parse(gophercloud.RFC3339MilliNoZ, "2014-07-07T18:25:31.275934")
+var FirstZone = zones.Zone{
+	ID:          "a86dba58-0043-4cc6-a1bb-69d5e86f3ca3",
+	PoolID:      "572ba08c-d929-4c70-8e42-03824bb24ca2",
+	ProjectID:   "4335d1f0-f793-11e2-b778-0800200c9a66",
+	Name:        "example.org.",
+	Email:       "joe@example.org",
+	TTL:         7200,
+	Serial:      1404757531,
+	Status:      "ACTIVE",
+	Action:      "CREATE",
+	Description: "This is an example zone.",
+	Masters:     []string{},
+	Type:        "PRIMARY",
+	Version:     1,
+	CreatedAt:   FirstZoneCreatedAt,
+	Links: map[string]interface{}{
+		"self": "https://127.0.0.1:9001/v2/zones/a86dba58-0043-4cc6-a1bb-69d5e86f3ca3",
+	},
+}
+
+var SecondZoneCreatedAt, _ = time.Parse(gophercloud.RFC3339MilliNoZ, "2014-07-07T18:25:31.275934")
+var SecondZoneUpdatedAt, _ = time.Parse(gophercloud.RFC3339MilliNoZ, "2015-02-25T20:23:01.234567")
+var SecondZone = zones.Zone{
+	ID:          "34c4561c-9205-4386-9df5-167436f5a222",
+	PoolID:      "572ba08c-d929-4c70-8e42-03824bb24ca2",
+	ProjectID:   "4335d1f0-f793-11e2-b778-0800200c9a66",
+	Name:        "foo.example.com.",
+	Email:       "joe@foo.example.com",
+	TTL:         7200,
+	Serial:      1488053571,
+	Status:      "ACTIVE",
+	Action:      "CREATE",
+	Description: "This is another example zone.",
+	Masters:     []string{"example.com."},
+	Type:        "PRIMARY",
+	Version:     1,
+	CreatedAt:   SecondZoneCreatedAt,
+	UpdatedAt:   SecondZoneUpdatedAt,
+	Links: map[string]interface{}{
+		"self": "https://127.0.0.1:9001/v2/zones/34c4561c-9205-4386-9df5-167436f5a222",
+	},
+}
+
+// ExpectedZonesSlice is the slice of results that should be parsed
+// from ListOutput, in the expected order.
+var ExpectedZonesSlice = []zones.Zone{FirstZone, SecondZone}
+
+// HandleListSuccessfully configures the test server to respond to a List request.
+func HandleListSuccessfully(t *testing.T) {
+	th.Mux.HandleFunc("/zones", func(w http.ResponseWriter, r *http.Request) {
+		th.TestMethod(t, r, "GET")
+		th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
+
+		w.Header().Add("Content-Type", "application/json")
+		fmt.Fprintf(w, ListOutput)
+	})
+}
+
+// HandleGetSuccessfully configures the test server to respond to a List request.
+func HandleGetSuccessfully(t *testing.T) {
+	th.Mux.HandleFunc("/zones/a86dba58-0043-4cc6-a1bb-69d5e86f3ca3", func(w http.ResponseWriter, r *http.Request) {
+		th.TestMethod(t, r, "GET")
+		th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
+
+		w.Header().Add("Content-Type", "application/json")
+		fmt.Fprintf(w, GetOutput)
+	})
+}
diff --git a/openstack/dns/v2/zones/testing/requests_test.go b/openstack/dns/v2/zones/testing/requests_test.go
new file mode 100644
index 0000000..b7dd667
--- /dev/null
+++ b/openstack/dns/v2/zones/testing/requests_test.go
@@ -0,0 +1,50 @@
+package testing
+
+import (
+	"testing"
+
+	"github.com/gophercloud/gophercloud/openstack/dns/v2/zones"
+	"github.com/gophercloud/gophercloud/pagination"
+	th "github.com/gophercloud/gophercloud/testhelper"
+	"github.com/gophercloud/gophercloud/testhelper/client"
+)
+
+func TestList(t *testing.T) {
+	th.SetupHTTP()
+	defer th.TeardownHTTP()
+	HandleListSuccessfully(t)
+
+	count := 0
+	err := zones.List(client.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) {
+		count++
+		actual, err := zones.ExtractZones(page)
+		th.AssertNoErr(t, err)
+		th.CheckDeepEquals(t, ExpectedZonesSlice, actual)
+
+		return true, nil
+	})
+	th.AssertNoErr(t, err)
+	th.CheckEquals(t, 1, count)
+}
+
+func TestListAllPages(t *testing.T) {
+	th.SetupHTTP()
+	defer th.TeardownHTTP()
+	HandleListSuccessfully(t)
+
+	allPages, err := zones.List(client.ServiceClient(), nil).AllPages()
+	th.AssertNoErr(t, err)
+	allZones, err := zones.ExtractZones(allPages)
+	th.AssertNoErr(t, err)
+	th.CheckEquals(t, 2, len(allZones))
+}
+
+func TestGet(t *testing.T) {
+	th.SetupHTTP()
+	defer th.TeardownHTTP()
+	HandleGetSuccessfully(t)
+
+	actual, err := zones.Get(client.ServiceClient(), "a86dba58-0043-4cc6-a1bb-69d5e86f3ca3").Extract()
+	th.AssertNoErr(t, err)
+	th.CheckDeepEquals(t, &FirstZone, actual)
+}