You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ne...@apache.org on 2017/01/13 23:36:13 UTC
[17/29] incubator-trafficcontrol git commit: Add vendor directory
with current dependencies
Add vendor directory with current dependencies
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/4563a049
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/4563a049
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/4563a049
Branch: refs/heads/master
Commit: 4563a04911fbcc19a96ba0630ede004dd8ff41bc
Parents: 0ebd6a1
Author: sbogacz <sb...@zvelo.com>
Authored: Tue Jan 10 19:58:57 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
.../traffic_ops/client/cachegroup.go | 53 ++
.../traffic_ops/client/cdn.go | 66 ++
.../traffic_ops/client/crconfig.go | 30 +
.../traffic_ops/client/delivery_service.go | 189 ++++++
.../client/delivery_service_endpoints.go | 59 ++
.../client/delivery_service_endpoints_test.go | 130 ++++
.../client/delivery_service_resources.go | 211 ++++++
.../traffic_ops/client/fixtures/cachegroup.go | 35 +
.../traffic_ops/client/fixtures/cdn.go | 30 +
.../client/fixtures/delivery_service.go | 194 ++++++
.../traffic_ops/client/fixtures/hardware.go | 33 +
.../traffic_ops/client/fixtures/parameter.go | 32 +
.../traffic_ops/client/fixtures/profile.go | 31 +
.../traffic_ops/client/fixtures/server.go | 151 +++++
.../client/fixtures/stats_summary.go | 33 +
.../client/fixtures/traffic_monitor_config.go | 116 ++++
.../client/fixtures/traffic_router_config.go | 162 +++++
.../traffic_ops/client/fixtures/types.go | 30 +
.../traffic_ops/client/fixtures/user.go | 34 +
.../traffic_ops/client/hardware.go | 50 ++
.../traffic_ops/client/parameter.go | 52 ++
.../traffic_ops/client/profile.go | 48 ++
.../traffic_ops/client/server.go | 139 ++++
.../traffic_ops/client/stats_summary.go | 127 ++++
.../traffic_ops/client/tests/cachegroup_test.go | 98 +++
.../traffic_ops/client/tests/cdn_test.go | 137 ++++
.../client/tests/conf/seelog.xml.test | 9 +
.../client/tests/delivery_service_test.go | 666 +++++++++++++++++++
.../traffic_ops/client/tests/hardware_test.go | 92 +++
.../traffic_ops/client/tests/parameter_test.go | 92 +++
.../traffic_ops/client/tests/profile_test.go | 86 +++
.../traffic_ops/client/tests/server_test.go | 310 +++++++++
.../client/tests/stats_summary_test.go | 98 +++
.../client/tests/traffic_monitor_config_test.go | 200 ++++++
.../client/tests/traffic_ops_test.go | 78 +++
.../client/tests/traffic_router_config_test.go | 211 ++++++
.../traffic_ops/client/tests/type_test.go | 80 +++
.../traffic_ops/client/tests/user_test.go | 98 +++
.../client/traffic_monitor_config.go | 162 +++++
.../traffic_ops/client/traffic_ops.go | 306 +++++++++
.../traffic_ops/client/traffic_router_config.go | 237 +++++++
.../traffic_ops/client/type.go | 68 ++
.../traffic_ops/client/user.go | 56 ++
traffic_stats/vendor/github.com/cihub/seelog | 1 +
.../influxdata/influxdb/client/v2/client.go | 526 +++++++++++++++
.../influxdb/client/v2/client_test.go | 525 +++++++++++++++
.../influxdb/client/v2/example_test.go | 265 ++++++++
.../influxdata/influxdb/client/v2/udp.go | 112 ++++
48 files changed, 6548 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/cachegroup.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/cachegroup.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/cachegroup.go
new file mode 100644
index 0000000..44aadd9
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/cachegroup.go
@@ -0,0 +1,53 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package client
+
+import "encoding/json"
+
+// CacheGroupResponse ...
+type CacheGroupResponse struct {
+ Version string `json:"version"`
+ Response []CacheGroup `json:"response"`
+}
+
+// CacheGroup contains information about a given Cachegroup in Traffic Ops.
+type CacheGroup struct {
+ Name string `json:"name"`
+ ShortName string `json:"shortName"`
+ Latitude float64 `json:"latitude,string"`
+ Longitude float64 `json:"longitude,string"`
+ ParentName string `json:"parentCachegroupName,omitempty"`
+ Type string `json:"typeName,omitempty"`
+ LastUpdated string `json:"lastUpdated,omitempty"`
+}
+
+// CacheGroups gets the CacheGroups in an array of CacheGroup structs
+// (note CacheGroup used to be called location)
+func (to *Session) CacheGroups() ([]CacheGroup, error) {
+ url := "/api/1.2/cachegroups.json"
+ resp, err := to.request("GET", url, nil)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+
+ var data CacheGroupResponse
+ if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
+ return nil, err
+ }
+
+ return data.Response, nil
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/cdn.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/cdn.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/cdn.go
new file mode 100644
index 0000000..665382e
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/cdn.go
@@ -0,0 +1,66 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package client
+
+import (
+ "encoding/json"
+ "fmt"
+)
+
+// CDNResponse ...
+type CDNResponse struct {
+ Version string `json:"version"`
+ Response []CDN `json:"response"`
+}
+
+// CDN ...
+type CDN struct {
+ Name string `json:"name"`
+ LastUpdated string `json:"lastUpdated"`
+}
+
+// CDNs gets an array of CDNs
+func (to *Session) CDNs() ([]CDN, error) {
+ url := "/api/1.2/cdns.json"
+ resp, err := to.request("GET", url, nil)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+
+ var data CDNResponse
+ if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
+ return nil, err
+ }
+ return data.Response, nil
+}
+
+// CDNName gets an array of CDNs
+func (to *Session) CDNName(name string) ([]CDN, error) {
+ url := fmt.Sprintf("/api/1.2/cdns/name/%s.json", name)
+ resp, err := to.request("GET", url, nil)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+
+ var data CDNResponse
+ if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
+ return nil, err
+ }
+
+ return data.Response, nil
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/crconfig.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/crconfig.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/crconfig.go
new file mode 100644
index 0000000..56b079e
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/crconfig.go
@@ -0,0 +1,30 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package client
+
+import "fmt"
+
+// CRConfigRaw Deprecated: use GetCRConfig instead
+func (to *Session) CRConfigRaw(cdn string) ([]byte, error) {
+ bytes, _, err := to.GetCRConfig(cdn)
+ return bytes, err
+}
+
+// GetCRConfig returns the raw JSON bytes of the CRConfig from Traffic Ops, and whether the bytes were from the client's internal cache.
+func (to *Session) GetCRConfig(cdn string) ([]byte, CacheHitStatus, error) {
+ url := fmt.Sprintf("/CRConfig-Snapshots/%s/CRConfig.json", cdn)
+ return to.getBytesWithTTL(url, tmPollingInterval)
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/delivery_service.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/delivery_service.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/delivery_service.go
new file mode 100644
index 0000000..58b0df4
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/delivery_service.go
@@ -0,0 +1,189 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package client
+
+import "encoding/json"
+
+// DeliveryServices gets an array of DeliveryServices
+func (to *Session) DeliveryServices() ([]DeliveryService, error) {
+ var data GetDeliveryServiceResponse
+ err := get(to, deliveryServicesEp(), &data)
+ if err != nil {
+ return nil, err
+ }
+
+ return data.Response, nil
+}
+
+// DeliveryService gets the DeliveryService for the ID it's passed
+func (to *Session) DeliveryService(id string) (*DeliveryService, error) {
+ var data GetDeliveryServiceResponse
+ err := get(to, deliveryServiceEp(id), &data)
+ if err != nil {
+ return nil, err
+ }
+
+ return &data.Response[0], nil
+}
+
+// CreateDeliveryService creates the DeliveryService it's passed
+func (to *Session) CreateDeliveryService(ds *DeliveryService) (*DeliveryServiceResponse, error) {
+ var data DeliveryServiceResponse
+ jsonReq, err := json.Marshal(ds)
+ if err != nil {
+ return nil, err
+ }
+ err = post(to, deliveryServicesEp(), jsonReq, &data)
+ if err != nil {
+ return nil, err
+ }
+
+ return &data, nil
+}
+
+// UpdateDeliveryService updates the DeliveryService matching the ID it's passed with
+// the DeliveryService it is passed
+func (to *Session) UpdateDeliveryService(id string, ds *DeliveryService) (*DeliveryServiceResponse, error) {
+ var data DeliveryServiceResponse
+ jsonReq, err := json.Marshal(ds)
+ if err != nil {
+ return nil, err
+ }
+ err = put(to, deliveryServiceEp(id), jsonReq, &data)
+ if err != nil {
+ return nil, err
+ }
+
+ return &data, nil
+}
+
+// DeleteDeliveryService deletes the DeliveryService matching the ID it's passed
+func (to *Session) DeleteDeliveryService(id string) (*DeleteDeliveryServiceResponse, error) {
+ var data DeleteDeliveryServiceResponse
+ err := del(to, deliveryServiceEp(id), &data)
+ if err != nil {
+ return nil, err
+ }
+
+ return &data, nil
+}
+
+// DeliveryServiceState gets the DeliveryServiceState for the ID it's passed
+func (to *Session) DeliveryServiceState(id string) (*DeliveryServiceState, error) {
+ var data DeliveryServiceStateResponse
+ err := get(to, deliveryServiceStateEp(id), &data)
+ if err != nil {
+ return nil, err
+ }
+
+ return &data.Response, nil
+}
+
+// DeliveryServiceHealth gets the DeliveryServiceHealth for the ID it's passed
+func (to *Session) DeliveryServiceHealth(id string) (*DeliveryServiceHealth, error) {
+ var data DeliveryServiceHealthResponse
+ err := get(to, deliveryServiceHealthEp(id), &data)
+ if err != nil {
+ return nil, err
+ }
+
+ return &data.Response, nil
+}
+
+// DeliveryServiceCapacity gets the DeliveryServiceCapacity for the ID it's passed
+func (to *Session) DeliveryServiceCapacity(id string) (*DeliveryServiceCapacity, error) {
+ var data DeliveryServiceCapacityResponse
+ err := get(to, deliveryServiceCapacityEp(id), &data)
+ if err != nil {
+ return nil, err
+ }
+
+ return &data.Response, nil
+}
+
+// DeliveryServiceRouting gets the DeliveryServiceRouting for the ID it's passed
+func (to *Session) DeliveryServiceRouting(id string) (*DeliveryServiceRouting, error) {
+ var data DeliveryServiceRoutingResponse
+ err := get(to, deliveryServiceRoutingEp(id), &data)
+ if err != nil {
+ return nil, err
+ }
+
+ return &data.Response, nil
+}
+
+// DeliveryServiceServer gets the DeliveryServiceServer
+func (to *Session) DeliveryServiceServer(page, limit string) ([]DeliveryServiceServer, error) {
+ var data DeliveryServiceServerResponse
+ err := get(to, deliveryServiceServerEp(page, limit), &data)
+ if err != nil {
+ return nil, err
+ }
+
+ return data.Response, nil
+}
+
+// DeliveryServiceSSLKeysByID gets the DeliveryServiceSSLKeys by ID
+func (to *Session) DeliveryServiceSSLKeysByID(id string) (*DeliveryServiceSSLKeys, error) {
+ var data DeliveryServiceSSLKeysResponse
+ err := get(to, deliveryServiceSSLKeysByIDEp(id), &data)
+ if err != nil {
+ return nil, err
+ }
+
+ return &data.Response, nil
+}
+
+// DeliveryServiceSSLKeysByHostname gets the DeliveryServiceSSLKeys by Hostname
+func (to *Session) DeliveryServiceSSLKeysByHostname(hostname string) (*DeliveryServiceSSLKeys, error) {
+ var data DeliveryServiceSSLKeysResponse
+ err := get(to, deliveryServiceSSLKeysByHostnameEp(hostname), &data)
+ if err != nil {
+ return nil, err
+ }
+
+ return &data.Response, nil
+}
+
+func get(to *Session, endpoint string, respStruct interface{}) error {
+ return makeReq(to, "GET", endpoint, nil, respStruct)
+}
+
+func post(to *Session, endpoint string, body []byte, respStruct interface{}) error {
+ return makeReq(to, "POST", endpoint, body, respStruct)
+}
+
+func put(to *Session, endpoint string, body []byte, respStruct interface{}) error {
+ return makeReq(to, "PUT", endpoint, body, respStruct)
+}
+
+func del(to *Session, endpoint string, respStruct interface{}) error {
+ return makeReq(to, "DELETE", endpoint, nil, respStruct)
+}
+
+func makeReq(to *Session, method, endpoint string, body []byte, respStruct interface{}) error {
+ resp, err := to.request(method, endpoint, body)
+ if err != nil {
+ return err
+ }
+ defer resp.Body.Close()
+
+ if err := json.NewDecoder(resp.Body).Decode(respStruct); err != nil {
+ return err
+ }
+
+ return nil
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/delivery_service_endpoints.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/delivery_service_endpoints.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/delivery_service_endpoints.go
new file mode 100644
index 0000000..d07171f
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/delivery_service_endpoints.go
@@ -0,0 +1,59 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package client
+
+const apiBase = "/api/1.2"
+const dsPath = "/deliveryservices"
+
+func deliveryServicesEp() string {
+ return apiBase + dsPath + ".json"
+}
+
+func deliveryServiceBaseEp(id string) string {
+ return apiBase + dsPath + "/" + id
+}
+
+func deliveryServiceEp(id string) string {
+ return deliveryServiceBaseEp(id) + ".json"
+}
+
+func deliveryServiceStateEp(id string) string {
+ return deliveryServiceBaseEp(id) + "/state.json"
+}
+
+func deliveryServiceHealthEp(id string) string {
+ return deliveryServiceBaseEp(id) + "/health.json"
+}
+
+func deliveryServiceCapacityEp(id string) string {
+ return deliveryServiceBaseEp(id) + "/capacity.json"
+}
+
+func deliveryServiceRoutingEp(id string) string {
+ return deliveryServiceBaseEp(id) + "/routing.json"
+}
+
+func deliveryServiceServerEp(page, limit string) string {
+ return apiBase + "/deliveryserviceserver.json?page=" + page + "&limit=" + limit
+}
+
+func deliveryServiceSSLKeysByIDEp(id string) string {
+ return apiBase + dsPath + "/xmlId/" + id + "/sslkeys.json"
+}
+
+func deliveryServiceSSLKeysByHostnameEp(hostname string) string {
+ return apiBase + dsPath + "/hostname/" + hostname + "/sslkeys.json"
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/delivery_service_endpoints_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/delivery_service_endpoints_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/delivery_service_endpoints_test.go
new file mode 100644
index 0000000..f698b72
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/delivery_service_endpoints_test.go
@@ -0,0 +1,130 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package client
+
+import (
+ "testing"
+
+ "github.com/jheitz200/test_helper"
+)
+
+func TestDeliveryServicesEp(t *testing.T) {
+ testHelper.Context(t, "Given the need to test that DeliveryServices uses the correct URL")
+
+ ep := deliveryServicesEp()
+ expected := "/api/1.2/deliveryservices.json"
+ if ep != expected {
+ testHelper.Error(t, "Should get back %s for \"deliveryServicesEp\", got: %s", expected, ep)
+ } else {
+ testHelper.Success(t, "Should be able to get the correct delivery services endpoint")
+ }
+}
+
+func TestDeliveryServiceEp(t *testing.T) {
+ testHelper.Context(t, "Given the need to test that DeliveryService uses the correct URL")
+
+ ep := deliveryServiceEp("123")
+ expected := "/api/1.2/deliveryservices/123.json"
+ if ep != expected {
+ testHelper.Error(t, "Should get back %s for \"deliveryServiceEp\", got: %s", expected, ep)
+ } else {
+ testHelper.Success(t, "Should be able to get the correct delivery service endpoint")
+ }
+}
+
+func TestDeliveryServiceStateEp(t *testing.T) {
+ testHelper.Context(t, "Given the need to test that DeliveryServiceState uses the correct URL")
+
+ ep := deliveryServiceStateEp("123")
+ expected := "/api/1.2/deliveryservices/123/state.json"
+ if ep != expected {
+ testHelper.Error(t, "Should get back %s for \"deliveryServiceStateEp\", got: %s", expected, ep)
+ } else {
+ testHelper.Success(t, "Should be able to get the correct delivery service state endpoint")
+ }
+}
+
+func TestDeliveryServiceHealthEp(t *testing.T) {
+ testHelper.Context(t, "Given the need to test that DeliveryServiceHealth uses the correct URL")
+
+ ep := deliveryServiceHealthEp("123")
+ expected := "/api/1.2/deliveryservices/123/health.json"
+ if ep != expected {
+ testHelper.Error(t, "Should get back %s for \"deliveryServiceHealthEp\", got: %s", expected, ep)
+ } else {
+ testHelper.Success(t, "Should be able to get the correct delivery service health endpoint")
+ }
+}
+
+func TestDeliveryServiceCapacityEp(t *testing.T) {
+ testHelper.Context(t, "Given the need to test that DeliveryServiceCapacity uses the correct URL")
+
+ ep := deliveryServiceCapacityEp("123")
+ expected := "/api/1.2/deliveryservices/123/capacity.json"
+ if ep != expected {
+ testHelper.Error(t, "Should get back %s for \"deliveryServiceCapacityEp\", got: %s", expected, ep)
+ } else {
+ testHelper.Success(t, "Should be able to get the correct delivery service capacity endpoint")
+ }
+}
+
+func TestDeliveryServiceRoutingEp(t *testing.T) {
+ testHelper.Context(t, "Given the need to test that DeliveryServiceRouting uses the correct URL")
+
+ ep := deliveryServiceRoutingEp("123")
+ expected := "/api/1.2/deliveryservices/123/routing.json"
+ if ep != expected {
+ testHelper.Error(t, "Should get back %s for \"deliveryServiceRoutingEp\", got: %s", expected, ep)
+ } else {
+ testHelper.Success(t, "Should be able to get the correct delivery service routing endpoint")
+ }
+}
+
+func TestDeliveryServiceServerEp(t *testing.T) {
+ testHelper.Context(t, "Given the need to test that DeliveryServiceServer uses the correct URL")
+
+ ep := deliveryServiceServerEp("1", "2")
+ expected := "/api/1.2/deliveryserviceserver.json?page=1&limit=2"
+ if ep != expected {
+ testHelper.Error(t, "Should get back %s for \"deliveryServiceServerEp\", got: %s", expected, ep)
+ } else {
+ testHelper.Success(t, "Should be able to get the correct delivery service server endpoint")
+ }
+}
+
+func TestDeliveryServiceSSLKeysByIDEp(t *testing.T) {
+ testHelper.Context(t, "Given the need to test that DeliveryServiceSSLKeysByID uses the correct URL")
+
+ ep := deliveryServiceSSLKeysByIDEp("123")
+ expected := "/api/1.2/deliveryservices/xmlId/123/sslkeys.json"
+ if ep != expected {
+ testHelper.Error(t, "Should get back %s for \"deliveryServiceSSLKeysByIDEp\", got: %s", expected, ep)
+ } else {
+ testHelper.Success(t, "Should be able to get the correct delivery service SSL Keys by ID endpoint")
+ }
+}
+
+func TestDeliveryServiceSSLKeysByHostnameEp(t *testing.T) {
+ testHelper.Context(t, "Given the need to test that DeliveryServiceSSLKeysByHostname uses the correct URL")
+
+ ep := deliveryServiceSSLKeysByHostnameEp("some-host")
+ expected := "/api/1.2/deliveryservices/hostname/some-host/sslkeys.json"
+ if ep != expected {
+ testHelper.Error(t, "Should get back %s for \"deliveryServiceSSLKeysByHostnameEp\", got: %s", expected, ep)
+ } else {
+ testHelper.Success(t, "Should be able to get the correct delivery service SSL Keys by hostname endpoint")
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/delivery_service_resources.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/delivery_service_resources.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/delivery_service_resources.go
new file mode 100644
index 0000000..a65734c
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/delivery_service_resources.go
@@ -0,0 +1,211 @@
+/*
+ Copyright 2015 Comcast Cable Communications Management, LLC
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package client
+
+// GetDeliveryServiceResponse ...
+type GetDeliveryServiceResponse struct {
+ Version string `json:"version"`
+ Response []DeliveryService `json:"response"`
+}
+
+// DeliveryServiceResponse ...
+type DeliveryServiceResponse struct {
+ Response DeliveryService `json:"response"`
+ Alerts []DeliveryServiceAlert `json:"alerts"`
+}
+
+// DeleteDeliveryServiceResponse ...
+type DeleteDeliveryServiceResponse struct {
+ Alerts []DeliveryServiceAlert `json:"alerts"`
+}
+
+// DeliveryService ...
+type DeliveryService struct {
+ ID string `json:"id"`
+ XMLID string `json:"xmlId"`
+ Active bool `json:"active"`
+ DSCP string `json:"dscp"`
+ Signed bool `json:"signed"`
+ QStringIgnore string `json:"qstringIgnore"`
+ GeoLimit string `json:"geoLimit"`
+ GeoProvider string `json:"geoProvider"`
+ HTTPBypassFQDN string `json:"httpBypassFqdn"`
+ DNSBypassIP string `json:"dnsBypassIp"`
+ DNSBypassIP6 string `json:"dnsBypassIp6"`
+ DNSBypassCname string `json:"dnsBypassCname"`
+ DNSBypassTTL string `json:"dnsBypassTtl"`
+ OrgServerFQDN string `json:"orgServerFqdn"`
+ Type string `json:"type"`
+ ProfileName string `json:"profileName"`
+ ProfileDesc string `json:"profileDescription"`
+ CDNName string `json:"cdnName"`
+ CCRDNSTTL string `json:"ccrDnsTtl"`
+ GlobalMaxMBPS string `json:"globalMaxMbps"`
+ GlobalMaxTPS string `json:"globalMaxTps"`
+ LongDesc string `json:"longDesc"`
+ LongDesc1 string `json:"longDesc1"`
+ LongDesc2 string `json:"longDesc2"`
+ MaxDNSAnswers string `json:"maxDnsAnswers"`
+ InfoURL string `json:"infoUrl"`
+ MissLat string `json:"missLat"`
+ MissLong string `json:"missLong"`
+ CheckPath string `json:"checkPath"`
+ LastUpdated string `json:"lastUpdated"`
+ Protocol string `json:"protocol"`
+ IPV6RoutingEnabled bool `json:"ipv6RoutingEnabled"`
+ RangeRequestHandling string `json:"rangeRequestHandling"`
+ HeaderRewrite string `json:"headerRewrite"`
+ EdgeHeaderRewrite string `json:"edgeHeaderRewrite"`
+ MidHeaderRewrite string `json:"midHeaderRewrite"`
+ TRResponseHeaders string `json:"trResponseHeaders"`
+ RegexRemap string `json:"regexRemap"`
+ CacheURL string `json:"cacheurl"`
+ RemapText string `json:"remapText"`
+ MultiSiteOrigin string `json:"multiSiteOrigin"`
+ DisplayName string `json:"displayName"`
+ InitialDispersion string `json:"initialDispersion"`
+ MatchList []DeliveryServiceMatch `json:"matchList,omitempty"`
+}
+
+// DeliveryServiceMatch ...
+type DeliveryServiceMatch struct {
+ Type string `json:"type"`
+ SetNumber string `json:"setNumber"`
+ Pattern string `json:"pattern"`
+}
+
+// DeliveryServiceAlert ...
+type DeliveryServiceAlert struct {
+ Level string `json:"level"`
+ Text string `json:"text"`
+}
+
+// DeliveryServiceStateResponse ...
+type DeliveryServiceStateResponse struct {
+ Response DeliveryServiceState `json:"response"`
+}
+
+// DeliveryServiceState ...
+type DeliveryServiceState struct {
+ Enabled bool `json:"enabled"`
+ Failover DeliveryServiceFailover `json:"failover"`
+}
+
+// DeliveryServiceFailover ...
+type DeliveryServiceFailover struct {
+ Locations []string `json:"locations"`
+ Destination DeliveryServiceDestination `json:"destination"`
+ Configured bool `json:"configured"`
+ Enabled bool `json:"enabled"`
+}
+
+// DeliveryServiceDestination ...
+type DeliveryServiceDestination struct {
+ Location string `json:"location"`
+ Type string `json:"type"`
+}
+
+// DeliveryServiceHealthResponse ...
+type DeliveryServiceHealthResponse struct {
+ Response DeliveryServiceHealth `json:"response"`
+}
+
+// DeliveryServiceHealth ...
+type DeliveryServiceHealth struct {
+ TotalOnline int `json:"totalOnline"`
+ TotalOffline int `json:"totalOffline"`
+ CacheGroups []DeliveryServiceCacheGroup `json:"cacheGroups"`
+}
+
+// DeliveryServiceCacheGroup ...
+type DeliveryServiceCacheGroup struct {
+ Online int `json:"online"`
+ Offline int `json:"offline"`
+ Name string `json:"name"`
+}
+
+// DeliveryServiceCapacityResponse ...
+type DeliveryServiceCapacityResponse struct {
+ Response DeliveryServiceCapacity `json:"response"`
+}
+
+// DeliveryServiceCapacity ...
+type DeliveryServiceCapacity struct {
+ AvailablePercent float64 `json:"availablePercent"`
+ UnavailablePercent float64 `json:"unavailablePercent"`
+ UtilizedPercent float64 `json:"utilizedPercent"`
+ MaintenancePercent float64 `json:"maintenancePercent"`
+}
+
+// DeliveryServiceRoutingResponse ...
+type DeliveryServiceRoutingResponse struct {
+ Response DeliveryServiceRouting `json:"response"`
+}
+
+// DeliveryServiceRouting ...
+type DeliveryServiceRouting struct {
+ StaticRoute int `json:"staticRoute"`
+ Miss int `json:"miss"`
+ Geo float64 `json:"geo"`
+ Err int `json:"err"`
+ CZ float64 `json:"cz"`
+ DSR float64 `json:"dsr"`
+ Fed int `json:"fed"`
+ RegionalAlternate int `json:"regionalAlternate"`
+ RegionalDenied int `json:"regionalDenied"`
+}
+
+// DeliveryServiceServerResponse ...
+type DeliveryServiceServerResponse struct {
+ Response []DeliveryServiceServer `json:"response"`
+ Page int `json:"page"`
+ OrderBy string `json:"orderby"`
+ Limit int `json:"limit"`
+}
+
+// DeliveryServiceServer ...
+type DeliveryServiceServer struct {
+ LastUpdated string `json:"lastUpdated"`
+ Server string `json:"server"`
+ DeliveryService string `json:"deliveryService"`
+}
+
+// DeliveryServiceSSLKeysResponse ...
+type DeliveryServiceSSLKeysResponse struct {
+ Response DeliveryServiceSSLKeys `json:"response"`
+}
+
+// DeliveryServiceSSLKeys ...
+type DeliveryServiceSSLKeys struct {
+ CDN string `json:"cdn"`
+ DeliveryService string `json:"DeliveryService"`
+ BusinessUnit string `json:"businessUnit"`
+ City string `json:"city"`
+ Organization string `json:"organization"`
+ Hostname string `json:"hostname"`
+ Country string `json:"country"`
+ State string `json:"state"`
+ Version string `json:"version"`
+ Certificate DeliveryServiceSSLKeysCertificate `json:"certificate"`
+}
+
+// DeliveryServiceSSLKeysCertificate ...
+type DeliveryServiceSSLKeysCertificate struct {
+ Crt string `json:"crt"`
+ Key string `json:"key"`
+ CSR string `json:"csr"`
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/cachegroup.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/cachegroup.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/cachegroup.go
new file mode 100644
index 0000000..e6bcfd6
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/cachegroup.go
@@ -0,0 +1,35 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package fixtures
+
+import "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+
+// Cachegroups returns a default CacheGroupResponse to be used for testing.
+func Cachegroups() *client.CacheGroupResponse {
+ return &client.CacheGroupResponse{
+ Response: []client.CacheGroup{
+ client.CacheGroup{
+ Name: "edge-philadelphia",
+ ShortName: "phila",
+ Type: "EDGE_LOC",
+ Longitude: 5,
+ Latitude: 55,
+ ParentName: "mid-northeast",
+ LastUpdated: "2014-03-28 15:23:50",
+ },
+ },
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/cdn.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/cdn.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/cdn.go
new file mode 100644
index 0000000..e322ac5
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/cdn.go
@@ -0,0 +1,30 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package fixtures
+
+import "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+
+// CDNs returns a default CDNResponse to be used for testing.
+func CDNs() *client.CDNResponse {
+ return &client.CDNResponse{
+ Response: []client.CDN{
+ client.CDN{
+ Name: "CDN-1",
+ LastUpdated: "2016-03-22 17:00:30",
+ },
+ },
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/delivery_service.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/delivery_service.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/delivery_service.go
new file mode 100644
index 0000000..6c7bf74
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/delivery_service.go
@@ -0,0 +1,194 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package fixtures
+
+import "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+
+// DeliveryServices returns a default DeliveryServiceResponse to be used for testing.
+func DeliveryServices() *client.GetDeliveryServiceResponse {
+ return &client.GetDeliveryServiceResponse{
+ Response: []client.DeliveryService{
+ client.DeliveryService{
+ ID: "001",
+ XMLID: "ds-test",
+ Active: true,
+ DSCP: "40",
+ Signed: false,
+ QStringIgnore: "1",
+ GeoLimit: "0",
+ GeoProvider: "0",
+ DNSBypassTTL: "30",
+ Type: "HTTP",
+ ProfileName: "ds-123",
+ CDNName: "test-cdn",
+ CCRDNSTTL: "3600",
+ GlobalMaxTPS: "0",
+ MaxDNSAnswers: "0",
+ MissLat: "44.654321",
+ MissLong: "-99.123456",
+ Protocol: "0",
+ IPV6RoutingEnabled: true,
+ RangeRequestHandling: "0",
+ TRResponseHeaders: "Access-Control-Allow-Origin: *",
+ MultiSiteOrigin: "0",
+ DisplayName: "Testing",
+ InitialDispersion: "1",
+ },
+ },
+ }
+}
+
+func alerts() []client.DeliveryServiceAlert {
+ return []client.DeliveryServiceAlert{
+ client.DeliveryServiceAlert{
+ Level: "level",
+ Text: "text",
+ },
+ }
+}
+
+// DeliveryService returns a default DeliveryServiceResponse to be used for testing.
+func DeliveryService() *client.DeliveryServiceResponse {
+ return &client.DeliveryServiceResponse{
+ Response: DeliveryServices().Response[0],
+ Alerts: alerts(),
+ }
+}
+
+// DeleteDeliveryService returns a default DeleteDeliveryServiceResponse to be used for testing.
+func DeleteDeliveryService() *client.DeleteDeliveryServiceResponse {
+ return &client.DeleteDeliveryServiceResponse{
+ Alerts: alerts(),
+ }
+}
+
+// DeliveryServiceState returns a default DeliveryServiceStateResponse to be used for testing.
+func DeliveryServiceState() *client.DeliveryServiceStateResponse {
+ dest := client.DeliveryServiceDestination{
+ Location: "someLocation",
+ Type: "DNS",
+ }
+
+ failover := client.DeliveryServiceFailover{
+ Locations: []string{"one", "two"},
+ Destination: dest,
+ Configured: true,
+ Enabled: true,
+ }
+
+ ds := client.DeliveryServiceState{
+ Enabled: true,
+ Failover: failover,
+ }
+
+ return &client.DeliveryServiceStateResponse{
+ Response: ds,
+ }
+}
+
+// DeliveryServiceHealth returns a default DeliveryServiceHealthResponse to be used for testing.
+func DeliveryServiceHealth() *client.DeliveryServiceHealthResponse {
+ cacheGroup := client.DeliveryServiceCacheGroup{
+ Name: "someCacheGroup",
+ Online: 2,
+ Offline: 3,
+ }
+
+ dsh := client.DeliveryServiceHealth{
+ TotalOnline: 2,
+ TotalOffline: 3,
+ CacheGroups: []client.DeliveryServiceCacheGroup{cacheGroup},
+ }
+
+ return &client.DeliveryServiceHealthResponse{
+ Response: dsh,
+ }
+}
+
+// DeliveryServiceCapacity returns a default DeliveryServiceCapacityResponse to be used for testing.
+func DeliveryServiceCapacity() *client.DeliveryServiceCapacityResponse {
+ dsc := client.DeliveryServiceCapacity{
+ AvailablePercent: 90.12345,
+ UnavailablePercent: 90.12345,
+ UtilizedPercent: 90.12345,
+ MaintenancePercent: 90.12345,
+ }
+
+ return &client.DeliveryServiceCapacityResponse{
+ Response: dsc,
+ }
+}
+
+// DeliveryServiceRouting returns a default DeliveryServiceRoutingResponse to be used for testing.
+func DeliveryServiceRouting() *client.DeliveryServiceRoutingResponse {
+ dsr := client.DeliveryServiceRouting{
+ StaticRoute: 1,
+ Miss: 2,
+ Geo: 3.33,
+ Err: 4,
+ CZ: 5.55,
+ DSR: 6.66,
+ Fed: 1,
+ RegionalAlternate: 1,
+ RegionalDenied: 1,
+ }
+
+ return &client.DeliveryServiceRoutingResponse{
+ Response: dsr,
+ }
+}
+
+// DeliveryServiceServer returns a default DeliveryServiceServerResponse to be used for testing.
+func DeliveryServiceServer() *client.DeliveryServiceServerResponse {
+ dss := client.DeliveryServiceServer{
+ LastUpdated: "lastUpdated",
+ Server: "someServer",
+ DeliveryService: "someService",
+ }
+
+ return &client.DeliveryServiceServerResponse{
+ Response: []client.DeliveryServiceServer{dss},
+ Page: 1,
+ OrderBy: "foo",
+ Limit: 1,
+ }
+}
+
+// DeliveryServiceSSLKeys returns a default DeliveryServiceSSLKeysResponse to be used for testing.
+func DeliveryServiceSSLKeys() *client.DeliveryServiceSSLKeysResponse {
+ crt := client.DeliveryServiceSSLKeysCertificate{
+ Crt: "crt",
+ Key: "key",
+ CSR: "someService",
+ }
+
+ sslKeys := client.DeliveryServiceSSLKeys{
+ CDN: "cdn",
+ DeliveryService: "deliveryService",
+ Certificate: crt,
+ BusinessUnit: "businessUnit",
+ City: "city",
+ Organization: "Kabletown",
+ Hostname: "hostname",
+ Country: "country",
+ State: "state",
+ Version: "version",
+ }
+
+ return &client.DeliveryServiceSSLKeysResponse{
+ Response: sslKeys,
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/hardware.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/hardware.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/hardware.go
new file mode 100644
index 0000000..a7069a2
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/hardware.go
@@ -0,0 +1,33 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package fixtures
+
+import "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+
+// Hardware returns a default HardwareResponse to be used for testing.
+func Hardware() *client.HardwareResponse {
+ return &client.HardwareResponse{
+ Response: []client.Hardware{
+ client.Hardware{
+ ID: "18",
+ HostName: "odol-atsmid-cen-09",
+ LastUpdated: "2015-07-16 09:04:20",
+ Value: "1.00",
+ Description: "BACKPLANE FIRMWARE",
+ },
+ },
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/parameter.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/parameter.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/parameter.go
new file mode 100644
index 0000000..f946790
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/parameter.go
@@ -0,0 +1,32 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package fixtures
+
+import "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+
+// Parameters returns a default ParamResponse to be used for testing.
+func Parameters() *client.ParamResponse {
+ return &client.ParamResponse{
+ Response: []client.Parameter{
+ client.Parameter{
+ Name: "location",
+ Value: "/foo/trafficserver/",
+ ConfigFile: "parent.config",
+ LastUpdated: "2012-09-17 15:41:22",
+ },
+ },
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/profile.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/profile.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/profile.go
new file mode 100644
index 0000000..6ef2da5
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/profile.go
@@ -0,0 +1,31 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package fixtures
+
+import "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+
+// Profiles returns a default ProfileResponse to be used for testing.
+func Profiles() *client.ProfileResponse {
+ return &client.ProfileResponse{
+ Response: []client.Profile{
+ client.Profile{
+ Name: "TR_CDN2",
+ Description: "kabletown Content Router",
+ LastUpdated: "2012-10-08 13:34:45",
+ },
+ },
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/server.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/server.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/server.go
new file mode 100644
index 0000000..07c541a
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/server.go
@@ -0,0 +1,151 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package fixtures
+
+import "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+
+// Servers returns a default ServerResponse to be used for testing.
+func Servers() *client.ServerResponse {
+ return &client.ServerResponse{
+ Response: []client.Server{
+ {
+ ID: "001",
+ HostName: "edge-alb-01",
+ DomainName: "albuquerque.nm.albuq.kabletown.com",
+ CDNName: "CDN-1",
+ Type: "EDGE",
+ Profile: "EDGE1_CDN_520",
+ TCPPort: "80",
+ Rack: "F-4/35",
+ PhysLocation: "Albuquerque",
+ Cachegroup: "albuquerque",
+ IP6Address: "2001:558:fe18:7::2/64",
+ IP6Gateway: "2001:558:fe18:7::1",
+ IPAddress: "10.10.10.10",
+ IPGateway: "10.10.10.10",
+ IPNetmask: "255.255.255.252",
+ MgmtIPAddress: "",
+ MgmtIPNetmask: "",
+ MgmtIPGateway: "",
+ Status: "REPORTED",
+ XMPPID: "edge-alb-01",
+ XMPPPasswd: "**********",
+ IloIPAddress: "10.10.10.10",
+ IloUsername: "vssilo",
+ IloPassword: "password",
+ IloIPGateway: "10.10.10.10",
+ IloIPNetmask: "255.255.255.192",
+ InterfaceName: "bond0",
+ InterfaceMtu: "9000",
+ RouterPortName: "TenGigE0/3/0/10\t|\tBundle-Ether1000\t|\tPHY|10G|AGG-MEMBER|dtype:IPCDN-EDGE|rhost:edge-alb-01|rport:eth1|lagg:1000",
+ RouterHostName: "ar01.albuquerque.nm.albuq.kabletown.com",
+ LastUpdated: "2015-03-27 17:00:30",
+ },
+ {
+ ID: "002",
+ HostName: "edge-alb-02",
+ DomainName: "albuquerque.nm.albuq.kabletown.com",
+ CDNName: "CDN-1",
+ Type: "EDGE",
+ Profile: "EDGE1_XCR_520",
+ TCPPort: "80",
+ Rack: "F-4/38",
+ PhysLocation: "Albuquerque",
+ Cachegroup: "us-nm-albuquerque",
+ IP6Address: "2001:558:FE18:8::2/64",
+ IP6Gateway: "2001:558:fe18:8::1",
+ IPAddress: "10.10.10.10",
+ IPGateway: "10.10.10.10",
+ IPNetmask: "255.255.255.252",
+ MgmtIPAddress: "",
+ MgmtIPNetmask: "",
+ MgmtIPGateway: "",
+ Status: "REPORTED",
+ XMPPID: "edge-alb-02",
+ XMPPPasswd: "**********",
+ IloIPAddress: "10.10.10.10",
+ IloUsername: "vssilo",
+ IloPassword: "password",
+ IloIPGateway: "10.10.10.10",
+ IloIPNetmask: "255.255.255.192",
+ InterfaceName: "bond0",
+ InterfaceMtu: "9000",
+ RouterPortName: "TenGigE0/3/0/10\t|\tBundle-Ether1000\t|\tPHY|10G|AGG-MEMBER|dtype:IPCDN-EDGE|rhost:edge-alb-02|rport:eth1|lagg:1000",
+ RouterHostName: "ar02.albuquerque.nm.albuq.kabletown.com",
+ LastUpdated: "2015-03-27 17:00:34",
+ },
+ {
+ ID: "003",
+ HostName: "atlanta-mid-01",
+ DomainName: "ga.atlanta.kabletown.net",
+ CDNName: "CDN-1",
+ Type: "MID",
+ Profile: "MID1",
+ TCPPort: "80",
+ Rack: "F-4/38",
+ PhysLocation: "Denver",
+ Cachegroup: "mid-northeast-group",
+ IP6Address: "2001:558:FE18:8::2/64",
+ IP6Gateway: "2001:558:fe18:8::1",
+ IPAddress: "12.12.12.12",
+ IPGateway: "12.12.12.12",
+ IPNetmask: "255.255.255.252",
+ MgmtIPAddress: "",
+ MgmtIPNetmask: "",
+ MgmtIPGateway: "",
+ Status: "ONLINE",
+ XMPPID: "atlanta-mid-01",
+ XMPPPasswd: "**********",
+ IloIPAddress: "",
+ IloUsername: "",
+ IloPassword: "",
+ IloIPGateway: "1",
+ IloIPNetmask: "",
+ InterfaceName: "bond0",
+ InterfaceMtu: "9000",
+ RouterPortName: "",
+ RouterHostName: "",
+ LastUpdated: "2015-03-27 17:00:34",
+ },
+ },
+ }
+}
+
+// LogstashServers returns a default ServerResponse to be used for testing.
+func LogstashServers() *client.ServerResponse {
+ return &client.ServerResponse{
+ Response: []client.Server{
+ {
+ ID: "004",
+ HostName: "logstash-01",
+ DomainName: "albuquerque.nm.albuq.kabletown.com",
+ CDNName: "CDN-2",
+ Type: "LOGSTASH",
+ Profile: "LOGSTASH_ATS",
+ IPAddress: "10.10.10.10",
+ },
+ {
+ ID: "005",
+ HostName: "logstash-02",
+ DomainName: "albuquerque.nm.albuq.kabletown.com",
+ CDNName: "CDN-2",
+ Type: "LOGSTASH",
+ Profile: "LOGSTASH_ATS",
+ IPAddress: "10.10.10.10",
+ },
+ },
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/stats_summary.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/stats_summary.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/stats_summary.go
new file mode 100644
index 0000000..bcc7470
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/stats_summary.go
@@ -0,0 +1,33 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package fixtures
+
+import "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+
+// StatsSummary returns a default StatsSummaryResponse to be used for testing.
+func StatsSummary() *client.StatsSummaryResponse {
+ return &client.StatsSummaryResponse{
+ Response: []client.StatsSummary{
+ client.StatsSummary{
+ SummaryTime: "2015-05-14 14:39:47",
+ DeliveryService: "test-ds1",
+ StatName: "test-stat",
+ StatValue: "3.1415",
+ CDNName: "test-cdn",
+ },
+ },
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/traffic_monitor_config.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/traffic_monitor_config.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/traffic_monitor_config.go
new file mode 100644
index 0000000..76efc3d
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/traffic_monitor_config.go
@@ -0,0 +1,116 @@
+package fixtures
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+
+// TrafficMonitorConfig returns a default TMConfigResponse to be used for testing.
+func TrafficMonitorConfig() *client.TMConfigResponse {
+ return &client.TMConfigResponse{
+ Response: client.TrafficMonitorConfig{
+ TrafficServers: []client.TrafficServer{
+ client.TrafficServer{
+ Profile: "TR_CDN",
+ IP: "10.10.10.10",
+ Status: "OFFLINE",
+ CacheGroup: "tr-chicago",
+ IP6: "2001:123:abc12:64:22:::17/64",
+ Port: 80,
+ HostName: "tr-chi-05",
+ FQDN: "tr-chi-05.kabletown.com",
+ InterfaceName: "eth0",
+ Type: "TR",
+ HashID: "chi-tr-05",
+ },
+ client.TrafficServer{
+ Profile: "EDGE1_CDN",
+ IP: "3.3.3.3",
+ Status: "OFFLINE",
+ CacheGroup: "philadelphia",
+ IP6: "2009:123:456::2/64",
+ Port: 80,
+ HostName: "edge-test-01",
+ FQDN: "edge-test-01.kabletown.com",
+ InterfaceName: "bond0",
+ Type: "EDGE",
+ HashID: "edge-test-01",
+ },
+ },
+ CacheGroups: []client.TMCacheGroup{
+ client.TMCacheGroup{
+ Name: "philadelphia",
+ Coordinates: client.Coordinates{
+ Longitude: 5,
+ Latitude: 55,
+ },
+ },
+ client.TMCacheGroup{
+ Name: "tr-chicago",
+ Coordinates: client.Coordinates{
+ Longitude: 9,
+ Latitude: 99,
+ },
+ },
+ },
+ Config: map[string]interface{}{
+ "health.event-count": 200,
+ "hack.ttl": 30,
+ "health.threadPool": 4,
+ "peers.polling.interval": 1000,
+ },
+ TrafficMonitors: []client.TrafficMonitor{
+ client.TrafficMonitor{
+ Port: 80,
+ IP6: "",
+ IP: "1.1.1.1",
+ HostName: "traffic-monitor-01",
+ FQDN: "traffic-monitor-01@example.com",
+ Profile: "tm-123",
+ Location: "philadelphia",
+ Status: "ONLINE",
+ },
+ },
+ DeliveryServices: []client.TMDeliveryService{
+ client.TMDeliveryService{
+ XMLID: "ds-05",
+ TotalTPSThreshold: 0,
+ Status: "REPORTED",
+ TotalKbpsThreshold: 0,
+ },
+ },
+ Profiles: []client.TMProfile{
+ client.TMProfile{
+ Name: "tm-123",
+ Type: "TR",
+ Parameters: client.TMParameters{
+ HealthConnectionTimeout: 2000,
+ HealthPollingURL: "http://${hostname}/_astats?application=&inf.name=${interface_name}",
+ HealthThresholdQueryTime: 1000,
+ HistoryCount: 30,
+ HealthThresholdAvailableBandwidthInKbps: ">1750000",
+ HealthThresholdLoadAvg: 25.0,
+ MinFreeKbps: 11500000,
+ },
+ },
+ },
+ },
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/traffic_router_config.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/traffic_router_config.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/traffic_router_config.go
new file mode 100644
index 0000000..b0cac6d
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/traffic_router_config.go
@@ -0,0 +1,162 @@
+package fixtures
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+
+// TrafficRouterConfig returns a default TRConfigResponse to be used for testing.
+func TrafficRouterConfig() *client.TRConfigResponse {
+ return &client.TRConfigResponse{
+ Response: client.TrafficRouterConfig{
+ TrafficServers: []client.TrafficServer{
+ client.TrafficServer{
+ Profile: "TR_CDN",
+ IP: "10.10.10.10",
+ Status: "OFFLINE",
+ CacheGroup: "tr-chicago",
+ IP6: "2001:123:abc12:64:22:::17/64",
+ Port: 80,
+ HostName: "tr-chi-05",
+ FQDN: "tr-chi-05.kabletown.com",
+ InterfaceName: "eth0",
+ Type: "TR",
+ HashID: "chi-tr-05",
+ },
+ client.TrafficServer{
+ Profile: "EDGE1_CDN",
+ IP: "3.3.3.3",
+ Status: "OFFLINE",
+ CacheGroup: "philadelphia",
+ IP6: "2009:123:456::2/64",
+ Port: 80,
+ HostName: "edge-test-01",
+ FQDN: "edge-test-01.kabletown.com",
+ InterfaceName: "bond0",
+ Type: "EDGE",
+ HashID: "edge-test-01",
+ },
+ },
+ TrafficMonitors: []client.TrafficMonitor{
+ client.TrafficMonitor{
+ Port: 80,
+ IP6: "",
+ IP: "1.1.1.1",
+ HostName: "traffic-monitor-01",
+ FQDN: "traffic-monitor-01@example.com",
+ Profile: "tr-123",
+ Location: "philadelphia",
+ Status: "ONLINE",
+ },
+ },
+ CacheGroups: []client.TMCacheGroup{
+ client.TMCacheGroup{
+ Name: "philadelphia",
+ Coordinates: client.Coordinates{
+ Longitude: 88,
+ Latitude: 99,
+ },
+ },
+ client.TMCacheGroup{
+ Name: "tr-chicago",
+ Coordinates: client.Coordinates{
+ Longitude: 9,
+ Latitude: 99,
+ },
+ },
+ },
+ Config: map[string]interface{}{
+ "health.event-count": 200,
+ "hack.ttl": 30,
+ "health.threadPool": 4,
+ "peers.polling.interval": 1000,
+ },
+ Stats: map[string]interface{}{
+ "date": 1459371078,
+ "cdnName": "test-cdn",
+ "trafficOpsHost": "127.0.0.1:3000",
+ "trafficOpsPath": "/api/1.2/cdns/title-vi/configs/routing.json",
+ "trafficOpsVersion": "__VERSION__",
+ "trafficOpsUser": "bob",
+ },
+ TrafficRouters: []client.TrafficRouter{
+ client.TrafficRouter{
+ Port: 6789,
+ IP6: "2345:1234:12:8::2/64",
+ IP: "127.0.0.1",
+ FQDN: "tr-01@ga.atlanta.kabletown.net",
+ Profile: "tr-123",
+ Location: "tr-chicago",
+ Status: "ONLINE",
+ APIPort: 3333,
+ },
+ },
+ DeliveryServices: []client.TRDeliveryService{
+ client.TRDeliveryService{
+ XMLID: "ds-06",
+ Domains: []string{
+ "ga.atlanta.kabletown.net",
+ },
+ MissLocation: client.MissLocation{
+ Latitude: 75,
+ Longitude: 65,
+ },
+ CoverageZoneOnly: true,
+ MatchSets: []client.MatchSet{
+ client.MatchSet{
+ Protocol: "HTTP",
+ MatchList: []client.MatchList{
+ client.MatchList{
+ Regex: ".*\\.ds-06\\..*",
+ MatchType: "HOST",
+ },
+ },
+ },
+ },
+ TTL: 3600,
+ TTLs: client.TTLS{
+ Arecord: 3600,
+ SoaRecord: 86400,
+ NsRecord: 3600,
+ AaaaRecord: 3600,
+ },
+ BypassDestination: client.BypassDestination{
+ Type: "HTTP",
+ },
+ StatcDNSEntries: []client.StaticDNS{
+ client.StaticDNS{
+ Value: "1.1.1.1",
+ TTL: 30,
+ Name: "mm",
+ Type: "A",
+ },
+ },
+ Soa: client.SOA{
+ Admin: "admin",
+ Retry: 7200,
+ Minimum: 30,
+ Refresh: 7200,
+ Expire: 604800,
+ },
+ },
+ },
+ },
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/types.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/types.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/types.go
new file mode 100644
index 0000000..9f74c59
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/types.go
@@ -0,0 +1,30 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package fixtures
+
+import "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+
+// Types returns a default TypeResponse to be used for testing.
+func Types() *client.TypeResponse {
+ return &client.TypeResponse{
+ Response: []client.Type{
+ client.Type{
+ Name: "EDGE",
+ Description: "edge cache",
+ },
+ },
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/user.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/user.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/user.go
new file mode 100644
index 0000000..39bf775
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures/user.go
@@ -0,0 +1,34 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package fixtures
+
+import "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+
+// Users returns a default UserResponse to be used for testing.
+func Users() *client.UserResponse {
+ return &client.UserResponse{
+ Response: []client.User{
+ client.User{
+ Username: "bsmith",
+ PublicSSHKey: "some-ssh-key",
+ Role: "3",
+ RoleName: "operations",
+ Email: "bobsmith@email.com",
+ FullName: "Bob Smith",
+ },
+ },
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/hardware.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/hardware.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/hardware.go
new file mode 100644
index 0000000..939ce12
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/hardware.go
@@ -0,0 +1,50 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package client
+
+import "encoding/json"
+
+// HardwareResponse ...
+type HardwareResponse struct {
+ Version string `json:"version"`
+ Response []Hardware `json:"response"`
+}
+
+// Hardware ...
+type Hardware struct {
+ ID string `json:"serverId"`
+ HostName string `json:"serverHostName"`
+ LastUpdated string `json:"lastUpdated"`
+ Value string `json:"val"`
+ Description string `json:"description"`
+}
+
+// Hardware gets an array of Hardware
+func (to *Session) Hardware() ([]Hardware, error) {
+ url := "/api/1.2/hwinfo.json"
+ resp, err := to.request("GET", url, nil)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+
+ var data HardwareResponse
+ if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
+ return nil, err
+ }
+
+ return data.Response, nil
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/parameter.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/parameter.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/parameter.go
new file mode 100644
index 0000000..937e450
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/parameter.go
@@ -0,0 +1,52 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package client
+
+import (
+ "encoding/json"
+ "fmt"
+)
+
+// ParamResponse ...
+type ParamResponse struct {
+ Version string `json:"version"`
+ Response []Parameter `json:"response"`
+}
+
+// Parameter ...
+type Parameter struct {
+ Name string `json:"name"`
+ ConfigFile string `json:"configFile"`
+ Value string `json:"Value"`
+ LastUpdated string `json:"lastUpdated"`
+}
+
+// Parameters gets an array of parameter structs for the profile given
+func (to *Session) Parameters(profileName string) ([]Parameter, error) {
+ url := fmt.Sprintf("/api/1.2/parameters/profile/%s.json", profileName)
+ resp, err := to.request("GET", url, nil)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+
+ var data ParamResponse
+ if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
+ return nil, err
+ }
+
+ return data.Response, nil
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/profile.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/profile.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/profile.go
new file mode 100644
index 0000000..b417886
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/profile.go
@@ -0,0 +1,48 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package client
+
+import "encoding/json"
+
+// ProfileResponse ...
+type ProfileResponse struct {
+ Version string `json:"version"`
+ Response []Profile `json:"response"`
+}
+
+// Profile ...
+type Profile struct {
+ Name string `json:"name"`
+ Description string `json:"description"`
+ LastUpdated string `json:"lastUpdated"`
+}
+
+// Profiles gets an array of Profiles
+func (to *Session) Profiles() ([]Profile, error) {
+ url := "/api/1.2/profiles.json"
+ resp, err := to.request("GET", url, nil)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+
+ var data ProfileResponse
+ if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
+ return nil, err
+ }
+
+ return data.Response, nil
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/server.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/server.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/server.go
new file mode 100644
index 0000000..93ea9e5
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/server.go
@@ -0,0 +1,139 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package client
+
+import (
+ "encoding/json"
+ "fmt"
+ "net/url"
+ "strings"
+)
+
+// ServerResponse ...
+type ServerResponse struct {
+ Version string `json:"version"`
+ Response []Server `json:"response"`
+}
+
+// Server ...
+type Server struct {
+ DomainName string `json:"domainName"`
+ HostName string `json:"hostName"`
+ ID string `json:"id"`
+ IloIPAddress string `json:"iloIpAddress"`
+ IloIPGateway string `json:"iloIpGateway"`
+ IloIPNetmask string `json:"iloIpNetmask"`
+ IloPassword string `json:"iloPassword"`
+ IloUsername string `json:"iloUsername"`
+ InterfaceMtu string `json:"interfaceMtu"`
+ InterfaceName string `json:"interfaceName"`
+ IP6Address string `json:"ip6Address"`
+ IP6Gateway string `json:"ip6Gateway"`
+ IPAddress string `json:"ipAddress"`
+ IPGateway string `json:"ipGateway"`
+ IPNetmask string `json:"ipNetmask"`
+
+ LastUpdated string `json:"lastUpdated"`
+ Cachegroup string `json:"cachegroup"`
+ MgmtIPAddress string `json:"mgmtIpAddress"`
+ MgmtIPGateway string `json:"mgmtIpGateway"`
+ MgmtIPNetmask string `json:"mgmtIpNetmask"`
+ PhysLocation string `json:"physLocation"`
+ Profile string `json:"profile"`
+ ProfileDesc string `json:"profileDesc"`
+ CDNName string `json:"cdnName"`
+ Rack string `json:"rack"`
+ RouterHostName string `json:"routerHostName"`
+ RouterPortName string `json:"routerPortName"`
+ Status string `json:"status"`
+ TCPPort string `json:"tcpPort"`
+ Type string `json:"type"`
+ XMPPID string `json:"xmppId"`
+ XMPPPasswd string `json:"xmppPasswd"`
+}
+
+// Servers gets an array of servers
+func (to *Session) Servers() ([]Server, error) {
+ url := "/api/1.2/servers.json"
+ resp, err := to.request("GET", url, nil)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+
+ var data ServerResponse
+ if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
+ return nil, err
+ }
+
+ return data.Response, nil
+}
+
+// ServersByType gets an array of serves of a specified type.
+func (to *Session) ServersByType(qparams url.Values) ([]Server, error) {
+ url := fmt.Sprintf("/api/1.2/servers.json?%s", qparams.Encode())
+ resp, err := to.request("GET", url, nil)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+
+ var data ServerResponse
+ if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
+ return nil, err
+ }
+
+ return data.Response, nil
+}
+
+// ServersFqdn returns a the full domain name for the server short name passed in.
+func (to *Session) ServersFqdn(n string) (string, error) {
+ fdn := ""
+ servers, err := to.Servers()
+ if err != nil {
+ return "Error", err
+ }
+
+ for _, server := range servers {
+ if server.HostName == n {
+ fdn = fmt.Sprintf("%s.%s", server.HostName, server.DomainName)
+ }
+ }
+ if fdn == "" {
+ return "Error", fmt.Errorf("No Server %s found", n)
+ }
+ return fdn, nil
+}
+
+// ServersShortNameSearch returns a slice of short server names that match a greedy match.
+func (to *Session) ServersShortNameSearch(shortname string) ([]string, error) {
+ var serverlst []string
+ servers, err := to.Servers()
+ if err != nil {
+ serverlst = append(serverlst, "N/A")
+ return serverlst, err
+ }
+ for _, server := range servers {
+ if strings.Contains(server.HostName, shortname) {
+ serverlst = append(serverlst, server.HostName)
+ }
+ }
+ if len(serverlst) == 0 {
+ serverlst = append(serverlst, "N/A")
+ return serverlst, fmt.Errorf("No Servers Found")
+ }
+ return serverlst, nil
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/stats_summary.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/stats_summary.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/stats_summary.go
new file mode 100644
index 0000000..b68ce4a
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/stats_summary.go
@@ -0,0 +1,127 @@
+/*
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package client
+
+import (
+ "encoding/json"
+ "fmt"
+ "strconv"
+)
+
+// StatsSummaryResponse ...
+type StatsSummaryResponse struct {
+ Version string `json:"version"`
+ Response []StatsSummary `json:"response"`
+}
+
+// StatsSummary ...
+type StatsSummary struct {
+ CDNName string `json:"cdnName"`
+ DeliveryService string `json:"deliveryServiceName"`
+ StatName string `json:"statName"`
+ StatValue string `json:"statValue"`
+ SummaryTime string `json:"summaryTime"`
+ StatDate string `json:"statDate"`
+}
+
+// LastUpdated ...
+type LastUpdated struct {
+ Version string `json:"version"`
+ Response struct {
+ SummaryTime string `json:"summaryTime"`
+ } `json:"response"`
+}
+
+// SummaryStats ...
+func (to *Session) SummaryStats(cdn string, deliveryService string, statName string) ([]StatsSummary, error) {
+ var queryParams []string
+ if len(cdn) > 0 {
+ queryParams = append(queryParams, fmt.Sprintf("cdnName=%s", cdn))
+ }
+ if len(deliveryService) > 0 {
+ queryParams = append(queryParams, fmt.Sprintf("deliveryServiceName=%s", deliveryService))
+ }
+ if len(statName) > 0 {
+ queryParams = append(queryParams, fmt.Sprintf("statName=%s", statName))
+ }
+ queryURL := "/api/1.2/stats_summary.json"
+ queryParamString := "?"
+ if len(queryParams) > 0 {
+ for i, param := range queryParams {
+ if i == 0 {
+ queryParamString += param
+ } else {
+ queryParamString += fmt.Sprintf("&%s", param)
+ }
+ }
+ queryURL += queryParamString
+ }
+
+ resp, err := to.request("GET", queryURL, nil)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+
+ var data StatsSummaryResponse
+ if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
+ return nil, err
+ }
+
+ return data.Response, nil
+}
+
+// SummaryStatsLastUpdated ...
+func (to *Session) SummaryStatsLastUpdated(statName string) (string, error) {
+ queryURL := "/api/1.2/stats_summary.json?lastSummaryDate=true"
+ if len(statName) > 0 {
+ queryURL += fmt.Sprintf("?statName=%s", statName)
+ }
+
+ resp, err := to.request("GET", queryURL, nil)
+ if err != nil {
+ return "", err
+ }
+ defer resp.Body.Close()
+
+ var data LastUpdated
+ if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
+ return "", err
+ }
+
+ if len(data.Response.SummaryTime) > 0 {
+ return data.Response.SummaryTime, nil
+ }
+ t := "1970-01-01 00:00:00"
+ return t, nil
+}
+
+// AddSummaryStats ...
+func (to *Session) AddSummaryStats(statsSummary StatsSummary) error {
+ reqBody, err := json.Marshal(statsSummary)
+ if err != nil {
+ return err
+ }
+
+ url := "/api/1.2/stats_summary/create"
+ resp, err := to.request("POST", url, reqBody)
+ if err != nil {
+ return err
+ }
+ defer resp.Body.Close()
+ if resp.StatusCode != 200 {
+ err := fmt.Errorf("Response code = %s and Status = %s", strconv.Itoa(resp.StatusCode), resp.Status)
+ return err
+ }
+ return nil
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/cachegroup_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/cachegroup_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/cachegroup_test.go
new file mode 100644
index 0000000..aa343a4
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/cachegroup_test.go
@@ -0,0 +1,98 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package test
+
+import (
+ "net/http"
+ "testing"
+
+ "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+ "github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures"
+ "github.com/jheitz200/test_helper"
+)
+
+func TestCacheGroup(t *testing.T) {
+ resp := fixtures.Cachegroups()
+ server := testHelper.ValidHTTPServer(resp)
+ defer server.Close()
+
+ var httpClient http.Client
+ to := client.Session{
+ URL: server.URL,
+ UserAgent: &httpClient,
+ }
+
+ testHelper.Context(t, "Given the need to test a successful Traffic Ops request for CacheGroups")
+
+ cacheGroups, err := to.CacheGroups()
+ if err != nil {
+ testHelper.Error(t, "Should be able to make a request to Traffic Ops")
+ } else {
+ testHelper.Success(t, "Should be able to make a request to Traffic Ops")
+ }
+
+ if len(cacheGroups) != 1 {
+ testHelper.Error(t, "Should get back \"1\" CacheGroups, got: %d", len(cacheGroups))
+ } else {
+ testHelper.Success(t, "Should get back \"1\" CacheGroups")
+ }
+
+ for _, cacheGroup := range cacheGroups {
+ if cacheGroup.Name == "" {
+ testHelper.Error(t, "Should get back \"edge-philadelphia\" for \"Name\", got: %s", cacheGroup.Name)
+ } else {
+ testHelper.Success(t, "Should get back \"edge-philadelphia\" for \"Name\"")
+ }
+
+ if cacheGroup.Longitude != 5 {
+ testHelper.Error(t, "Should get back \"5\" for \"Longitude\", got: %v", cacheGroup.Longitude)
+ } else {
+ testHelper.Success(t, "Should get back \"5\" for \"Longitude\"")
+ }
+
+ if cacheGroup.Latitude != 55 {
+ testHelper.Error(t, "Should get back \"55\" for \"Latitude\", got: %v", cacheGroup.Latitude)
+ } else {
+ testHelper.Success(t, "Should get back \"55\" for \"Latitude\"")
+ }
+
+ if cacheGroup.ParentName != "mid-northeast" {
+ testHelper.Error(t, "Should get back \"mid-northeast\" for \"ParentName\", got: %s", cacheGroup.ParentName)
+ } else {
+ testHelper.Success(t, "Should get back \"mid-northeast\" for \"ParentName\"")
+ }
+ }
+}
+
+func TestCacheGroupsUnauthorized(t *testing.T) {
+ server := testHelper.InvalidHTTPServer(http.StatusUnauthorized)
+ defer server.Close()
+
+ var httpClient http.Client
+ to := client.Session{
+ URL: server.URL,
+ UserAgent: &httpClient,
+ }
+
+ testHelper.Context(t, "Given the need to test a failed Traffic Ops request for CacheGroups")
+
+ _, err := to.CacheGroups()
+ if err == nil {
+ testHelper.Error(t, "Should not be able to make a request to Traffic Ops")
+ } else {
+ testHelper.Success(t, "Should not be able to make a request to Traffic Ops")
+ }
+}