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:35:57 UTC
[01/29] incubator-trafficcontrol git commit: Update vendor with
latest upstream changes to traffic ops
Repository: incubator-trafficcontrol
Updated Branches:
refs/heads/master 12d80e152 -> e3c5b311c
Update vendor with latest upstream changes to traffic ops
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/4b830b4f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/4b830b4f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/4b830b4f
Branch: refs/heads/master
Commit: 4b830b4fd263641534f71dd2633d6776752c53b0
Parents: 926f31e
Author: sbogacz <sb...@zvelo.com>
Authored: Fri Jan 13 14:50:41 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
.../apache/incubator-trafficcontrol/LICENSE | 448 +++++++++++++++++++
.../traffic_ops/client/cachegroup.go | 5 +-
.../traffic_ops/client/cdn.go | 4 +-
.../traffic_ops/client/delivery_service.go | 8 +-
.../client/delivery_service_resources.go | 58 ++-
.../traffic_ops/client/fixtures/cachegroup.go | 4 +-
.../traffic_ops/client/fixtures/cdn.go | 1 +
.../client/fixtures/delivery_service.go | 52 ++-
.../traffic_ops/client/fixtures/hardware.go | 15 +-
.../traffic_ops/client/fixtures/profile.go | 1 +
.../traffic_ops/client/fixtures/server.go | 22 +-
.../traffic_ops/client/fixtures/types.go | 2 +
.../traffic_ops/client/fixtures/user.go | 2 +-
.../traffic_ops/client/hardware.go | 10 +-
.../traffic_ops/client/parameter.go | 1 -
.../traffic_ops/client/profile.go | 2 +-
.../traffic_ops/client/server.go | 7 +-
.../traffic_ops/client/stats_summary.go | 1 -
.../client/traffic_monitor_config.go | 1 -
.../traffic_ops/client/traffic_ops.go | 7 +-
.../traffic_ops/client/traffic_router_config.go | 1 -
.../traffic_ops/client/type.go | 2 +-
.../traffic_ops/client/user.go | 10 +-
23 files changed, 576 insertions(+), 88 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/LICENSE
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/LICENSE b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/LICENSE
index 7da3bb4..db03aa5 100644
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/LICENSE
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/LICENSE
@@ -841,3 +841,451 @@ For the avoidance of doubt, this Public License does not, and shall not be inter
To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
+
+For the NetPacket component:
+
+Copyright (c) 2003-2009 Joel Knight <kn...@gmail.com>
+
+Permission to use, copy, modify, and distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+For the gofmt github hook:
+
+Copyright (c) 2009 The Go Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+For the ssl-bundle.crt:
+
+This is derived from the Mozilla root CA list, which is licensed under
+the MPL, so the ssl-bundle.crt is likewise licensed under the MPL:
+
+Mozilla Public License Version 2.0
+==================================
+
+1. Definitions
+--------------
+
+1.1. "Contributor"
+ means each individual or legal entity that creates, contributes to
+ the creation of, or owns Covered Software.
+
+1.2. "Contributor Version"
+ means the combination of the Contributions of others (if any) used
+ by a Contributor and that particular Contributor's Contribution.
+
+1.3. "Contribution"
+ means Covered Software of a particular Contributor.
+
+1.4. "Covered Software"
+ means Source Code Form to which the initial Contributor has attached
+ the notice in Exhibit A, the Executable Form of such Source Code
+ Form, and Modifications of such Source Code Form, in each case
+ including portions thereof.
+
+1.5. "Incompatible With Secondary Licenses"
+ means
+
+ (a) that the initial Contributor has attached the notice described
+ in Exhibit B to the Covered Software; or
+
+ (b) that the Covered Software was made available under the terms of
+ version 1.1 or earlier of the License, but not also under the
+ terms of a Secondary License.
+
+1.6. "Executable Form"
+ means any form of the work other than Source Code Form.
+
+1.7. "Larger Work"
+ means a work that combines Covered Software with other material, in
+ a separate file or files, that is not Covered Software.
+
+1.8. "License"
+ means this document.
+
+1.9. "Licensable"
+ means having the right to grant, to the maximum extent possible,
+ whether at the time of the initial grant or subsequently, any and
+ all of the rights conveyed by this License.
+
+1.10. "Modifications"
+ means any of the following:
+
+ (a) any file in Source Code Form that results from an addition to,
+ deletion from, or modification of the contents of Covered
+ Software; or
+
+ (b) any new file in Source Code Form that contains any Covered
+ Software.
+
+1.11. "Patent Claims" of a Contributor
+ means any patent claim(s), including without limitation, method,
+ process, and apparatus claims, in any patent Licensable by such
+ Contributor that would be infringed, but for the grant of the
+ License, by the making, using, selling, offering for sale, having
+ made, import, or transfer of either its Contributions or its
+ Contributor Version.
+
+1.12. "Secondary License"
+ means either the GNU General Public License, Version 2.0, the GNU
+ Lesser General Public License, Version 2.1, the GNU Affero General
+ Public License, Version 3.0, or any later versions of those
+ licenses.
+
+1.13. "Source Code Form"
+ means the form of the work preferred for making modifications.
+
+1.14. "You" (or "Your")
+ means an individual or a legal entity exercising rights under this
+ License. For legal entities, "You" includes any entity that
+ controls, is controlled by, or is under common control with You. For
+ purposes of this definition, "control" means (a) the power, direct
+ or indirect, to cause the direction or management of such entity,
+ whether by contract or otherwise, or (b) ownership of more than
+ fifty percent (50%) of the outstanding shares or beneficial
+ ownership of such entity.
+
+2. License Grants and Conditions
+--------------------------------
+
+2.1. Grants
+
+Each Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than patent or trademark)
+ Licensable by such Contributor to use, reproduce, make available,
+ modify, display, perform, distribute, and otherwise exploit its
+ Contributions, either on an unmodified basis, with Modifications, or
+ as part of a Larger Work; and
+
+(b) under Patent Claims of such Contributor to make, use, sell, offer
+ for sale, have made, import, and otherwise transfer either its
+ Contributions or its Contributor Version.
+
+2.2. Effective Date
+
+The licenses granted in Section 2.1 with respect to any Contribution
+become effective for each Contribution on the date the Contributor first
+distributes such Contribution.
+
+2.3. Limitations on Grant Scope
+
+The licenses granted in this Section 2 are the only rights granted under
+this License. No additional rights or licenses will be implied from the
+distribution or licensing of Covered Software under this License.
+Notwithstanding Section 2.1(b) above, no patent license is granted by a
+Contributor:
+
+(a) for any code that a Contributor has removed from Covered Software;
+ or
+
+(b) for infringements caused by: (i) Your and any other third party's
+ modifications of Covered Software, or (ii) the combination of its
+ Contributions with other software (except as part of its Contributor
+ Version); or
+
+(c) under Patent Claims infringed by Covered Software in the absence of
+ its Contributions.
+
+This License does not grant any rights in the trademarks, service marks,
+or logos of any Contributor (except as may be necessary to comply with
+the notice requirements in Section 3.4).
+
+2.4. Subsequent Licenses
+
+No Contributor makes additional grants as a result of Your choice to
+distribute the Covered Software under a subsequent version of this
+License (see Section 10.2) or under the terms of a Secondary License (if
+permitted under the terms of Section 3.3).
+
+2.5. Representation
+
+Each Contributor represents that the Contributor believes its
+Contributions are its original creation(s) or it has sufficient rights
+to grant the rights to its Contributions conveyed by this License.
+
+2.6. Fair Use
+
+This License is not intended to limit any rights You have under
+applicable copyright doctrines of fair use, fair dealing, or other
+equivalents.
+
+2.7. Conditions
+
+Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
+in Section 2.1.
+
+3. Responsibilities
+-------------------
+
+3.1. Distribution of Source Form
+
+All distribution of Covered Software in Source Code Form, including any
+Modifications that You create or to which You contribute, must be under
+the terms of this License. You must inform recipients that the Source
+Code Form of the Covered Software is governed by the terms of this
+License, and how they can obtain a copy of this License. You may not
+attempt to alter or restrict the recipients' rights in the Source Code
+Form.
+
+3.2. Distribution of Executable Form
+
+If You distribute Covered Software in Executable Form then:
+
+(a) such Covered Software must also be made available in Source Code
+ Form, as described in Section 3.1, and You must inform recipients of
+ the Executable Form how they can obtain a copy of such Source Code
+ Form by reasonable means in a timely manner, at a charge no more
+ than the cost of distribution to the recipient; and
+
+(b) You may distribute such Executable Form under the terms of this
+ License, or sublicense it under different terms, provided that the
+ license for the Executable Form does not attempt to limit or alter
+ the recipients' rights in the Source Code Form under this License.
+
+3.3. Distribution of a Larger Work
+
+You may create and distribute a Larger Work under terms of Your choice,
+provided that You also comply with the requirements of this License for
+the Covered Software. If the Larger Work is a combination of Covered
+Software with a work governed by one or more Secondary Licenses, and the
+Covered Software is not Incompatible With Secondary Licenses, this
+License permits You to additionally distribute such Covered Software
+under the terms of such Secondary License(s), so that the recipient of
+the Larger Work may, at their option, further distribute the Covered
+Software under the terms of either this License or such Secondary
+License(s).
+
+3.4. Notices
+
+You may not remove or alter the substance of any license notices
+(including copyright notices, patent notices, disclaimers of warranty,
+or limitations of liability) contained within the Source Code Form of
+the Covered Software, except that You may alter any license notices to
+the extent required to remedy known factual inaccuracies.
+
+3.5. Application of Additional Terms
+
+You may choose to offer, and to charge a fee for, warranty, support,
+indemnity or liability obligations to one or more recipients of Covered
+Software. However, You may do so only on Your own behalf, and not on
+behalf of any Contributor. You must make it absolutely clear that any
+such warranty, support, indemnity, or liability obligation is offered by
+You alone, and You hereby agree to indemnify every Contributor for any
+liability incurred by such Contributor as a result of warranty, support,
+indemnity or liability terms You offer. You may include additional
+disclaimers of warranty and limitations of liability specific to any
+jurisdiction.
+
+4. Inability to Comply Due to Statute or Regulation
+---------------------------------------------------
+
+If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Software due to
+statute, judicial order, or regulation then You must: (a) comply with
+the terms of this License to the maximum extent possible; and (b)
+describe the limitations and the code they affect. Such description must
+be placed in a text file included with all distributions of the Covered
+Software under this License. Except to the extent prohibited by statute
+or regulation, such description must be sufficiently detailed for a
+recipient of ordinary skill to be able to understand it.
+
+5. Termination
+--------------
+
+5.1. The rights granted under this License will terminate automatically
+if You fail to comply with any of its terms. However, if You become
+compliant, then the rights granted under this License from a particular
+Contributor are reinstated (a) provisionally, unless and until such
+Contributor explicitly and finally terminates Your grants, and (b) on an
+ongoing basis, if such Contributor fails to notify You of the
+non-compliance by some reasonable means prior to 60 days after You have
+come back into compliance. Moreover, Your grants from a particular
+Contributor are reinstated on an ongoing basis if such Contributor
+notifies You of the non-compliance by some reasonable means, this is the
+first time You have received notice of non-compliance with this License
+from such Contributor, and You become compliant prior to 30 days after
+Your receipt of the notice.
+
+5.2. If You initiate litigation against any entity by asserting a patent
+infringement claim (excluding declaratory judgment actions,
+counter-claims, and cross-claims) alleging that a Contributor Version
+directly or indirectly infringes any patent, then the rights granted to
+You by any and all Contributors for the Covered Software under Section
+2.1 of this License shall terminate.
+
+5.3. In the event of termination under Sections 5.1 or 5.2 above, all
+end user license agreements (excluding distributors and resellers) which
+have been validly granted by You or Your distributors under this License
+prior to termination shall survive termination.
+
+************************************************************************
+* *
+* 6. Disclaimer of Warranty *
+* ------------------------- *
+* *
+* Covered Software is provided under this License on an "as is" *
+* basis, without warranty of any kind, either expressed, implied, or *
+* statutory, including, without limitation, warranties that the *
+* Covered Software is free of defects, merchantable, fit for a *
+* particular purpose or non-infringing. The entire risk as to the *
+* quality and performance of the Covered Software is with You. *
+* Should any Covered Software prove defective in any respect, You *
+* (not any Contributor) assume the cost of any necessary servicing, *
+* repair, or correction. This disclaimer of warranty constitutes an *
+* essential part of this License. No use of any Covered Software is *
+* authorized under this License except under this disclaimer. *
+* *
+************************************************************************
+
+************************************************************************
+* *
+* 7. Limitation of Liability *
+* -------------------------- *
+* *
+* Under no circumstances and under no legal theory, whether tort *
+* (including negligence), contract, or otherwise, shall any *
+* Contributor, or anyone who distributes Covered Software as *
+* permitted above, be liable to You for any direct, indirect, *
+* special, incidental, or consequential damages of any character *
+* including, without limitation, damages for lost profits, loss of *
+* goodwill, work stoppage, computer failure or malfunction, or any *
+* and all other commercial damages or losses, even if such party *
+* shall have been informed of the possibility of such damages. This *
+* limitation of liability shall not apply to liability for death or *
+* personal injury resulting from such party's negligence to the *
+* extent applicable law prohibits such limitation. Some *
+* jurisdictions do not allow the exclusion or limitation of *
+* incidental or consequential damages, so this exclusion and *
+* limitation may not apply to You. *
+* *
+************************************************************************
+
+8. Litigation
+-------------
+
+Any litigation relating to this License may be brought only in the
+courts of a jurisdiction where the defendant maintains its principal
+place of business and such litigation shall be governed by laws of that
+jurisdiction, without reference to its conflict-of-law provisions.
+Nothing in this Section shall prevent a party's ability to bring
+cross-claims or counter-claims.
+
+9. Miscellaneous
+----------------
+
+This License represents the complete agreement concerning the subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent
+necessary to make it enforceable. Any law or regulation which provides
+that the language of a contract shall be construed against the drafter
+shall not be used to construe this License against a Contributor.
+
+10. Versions of the License
+---------------------------
+
+10.1. New Versions
+
+Mozilla Foundation is the license steward. Except as provided in Section
+10.3, no one other than the license steward has the right to modify or
+publish new versions of this License. Each version will be given a
+distinguishing version number.
+
+10.2. Effect of New Versions
+
+You may distribute the Covered Software under the terms of the version
+of the License under which You originally received the Covered Software,
+or under the terms of any subsequent version published by the license
+steward.
+
+10.3. Modified Versions
+
+If you create software not governed by this License, and you want to
+create a new license for such software, you may create and use a
+modified version of this License if you rename the license and remove
+any references to the name of the license steward (except to note that
+such modified license differs from this License).
+
+10.4. Distributing Source Code Form that is Incompatible With Secondary
+Licenses
+
+If You choose to distribute Source Code Form that is Incompatible With
+Secondary Licenses under the terms of this version of the License, the
+notice described in Exhibit B of this License must be attached.
+
+Exhibit A - Source Code Form License Notice
+-------------------------------------------
+
+ This Source Code Form is subject to the terms of the Mozilla Public
+ License, v. 2.0. If a copy of the MPL was not distributed with this
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+If it is not possible or desirable to put the notice in a particular
+file, then You may include the notice in a location (such as a LICENSE
+file in a relevant directory) where a recipient would be likely to look
+for such a notice.
+
+You may add additional accurate notices of copyright ownership.
+
+Exhibit B - "Incompatible With Secondary Licenses" Notice
+---------------------------------------------------------
+
+ This Source Code Form is "Incompatible With Secondary Licenses", as
+ defined by the Mozilla Public License, v. 2.0.
+
+For the handlebars.js component:
+
+Copyright (C) 2011 by Yehuda Katz
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/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
index 44aadd9..bb21b72 100644
--- 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
@@ -19,7 +19,6 @@ import "encoding/json"
// CacheGroupResponse ...
type CacheGroupResponse struct {
- Version string `json:"version"`
Response []CacheGroup `json:"response"`
}
@@ -27,8 +26,8 @@ type CacheGroupResponse struct {
type CacheGroup struct {
Name string `json:"name"`
ShortName string `json:"shortName"`
- Latitude float64 `json:"latitude,string"`
- Longitude float64 `json:"longitude,string"`
+ Latitude float64 `json:"latitude"`
+ Longitude float64 `json:"longitude"`
ParentName string `json:"parentCachegroupName,omitempty"`
Type string `json:"typeName,omitempty"`
LastUpdated string `json:"lastUpdated,omitempty"`
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/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
index 665382e..187a190 100644
--- 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
@@ -22,12 +22,12 @@ import (
// CDNResponse ...
type CDNResponse struct {
- Version string `json:"version"`
- Response []CDN `json:"response"`
+ Response []CDN `json:"response"`
}
// CDN ...
type CDN struct {
+ ID int `json:"id"`
Name string `json:"name"`
LastUpdated string `json:"lastUpdated"`
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/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
index 58b0df4..db21b17 100644
--- 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
@@ -40,8 +40,8 @@ func (to *Session) DeliveryService(id string) (*DeliveryService, error) {
}
// CreateDeliveryService creates the DeliveryService it's passed
-func (to *Session) CreateDeliveryService(ds *DeliveryService) (*DeliveryServiceResponse, error) {
- var data DeliveryServiceResponse
+func (to *Session) CreateDeliveryService(ds *DeliveryService) (*CreateDeliveryServiceResponse, error) {
+ var data CreateDeliveryServiceResponse
jsonReq, err := json.Marshal(ds)
if err != nil {
return nil, err
@@ -56,8 +56,8 @@ func (to *Session) CreateDeliveryService(ds *DeliveryService) (*DeliveryServiceR
// 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
+func (to *Session) UpdateDeliveryService(id string, ds *DeliveryService) (*UpdateDeliveryServiceResponse, error) {
+ var data UpdateDeliveryServiceResponse
jsonReq, err := json.Marshal(ds)
if err != nil {
return nil, err
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/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
index a65734c..26d64d8 100644
--- 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
@@ -18,10 +18,21 @@ package client
// GetDeliveryServiceResponse ...
type GetDeliveryServiceResponse struct {
- Version string `json:"version"`
Response []DeliveryService `json:"response"`
}
+// CreateDeliveryServiceResponse ...
+type CreateDeliveryServiceResponse struct {
+ Response []DeliveryService `json:"response"`
+ Alerts []DeliveryServiceAlert `json:"alerts"`
+}
+
+// UpdateDeliveryServiceResponse ...
+type UpdateDeliveryServiceResponse struct {
+ Response []DeliveryService `json:"response"`
+ Alerts []DeliveryServiceAlert `json:"alerts"`
+}
+
// DeliveryServiceResponse ...
type DeliveryServiceResponse struct {
Response DeliveryService `json:"response"`
@@ -35,50 +46,55 @@ type DeleteDeliveryServiceResponse struct {
// DeliveryService ...
type DeliveryService struct {
- ID string `json:"id"`
+ ID int `json:"id"`
XMLID string `json:"xmlId"`
Active bool `json:"active"`
- DSCP string `json:"dscp"`
+ DSCP int `json:"dscp"`
Signed bool `json:"signed"`
- QStringIgnore string `json:"qstringIgnore"`
- GeoLimit string `json:"geoLimit"`
- GeoProvider string `json:"geoProvider"`
+ QStringIgnore int `json:"qstringIgnore"`
+ GeoLimit int `json:"geoLimit"`
+ GeoProvider int `json:"geoProvider"`
HTTPBypassFQDN string `json:"httpBypassFqdn"`
DNSBypassIP string `json:"dnsBypassIp"`
DNSBypassIP6 string `json:"dnsBypassIp6"`
DNSBypassCname string `json:"dnsBypassCname"`
- DNSBypassTTL string `json:"dnsBypassTtl"`
+ DNSBypassTTL int `json:"dnsBypassTtl"`
OrgServerFQDN string `json:"orgServerFqdn"`
+ TypeID int `json:"typeId"`
Type string `json:"type"`
+ ProfileID int `json:"profileId"`
ProfileName string `json:"profileName"`
ProfileDesc string `json:"profileDescription"`
CDNName string `json:"cdnName"`
- CCRDNSTTL string `json:"ccrDnsTtl"`
- GlobalMaxMBPS string `json:"globalMaxMbps"`
- GlobalMaxTPS string `json:"globalMaxTps"`
+ CDNID int `json:"cdnId"`
+ CCRDNSTTL int `json:"ccrDnsTtl"`
+ GlobalMaxMBPS int `json:"globalMaxMbps"`
+ GlobalMaxTPS int `json:"globalMaxTps"`
LongDesc string `json:"longDesc"`
LongDesc1 string `json:"longDesc1"`
LongDesc2 string `json:"longDesc2"`
- MaxDNSAnswers string `json:"maxDnsAnswers"`
+ MaxDNSAnswers int `json:"maxDnsAnswers"`
InfoURL string `json:"infoUrl"`
- MissLat string `json:"missLat"`
- MissLong string `json:"missLong"`
+ MissLat float64 `json:"missLat"`
+ MissLong float64 `json:"missLong"`
CheckPath string `json:"checkPath"`
LastUpdated string `json:"lastUpdated"`
- Protocol string `json:"protocol"`
+ Protocol int `json:"protocol"`
IPV6RoutingEnabled bool `json:"ipv6RoutingEnabled"`
- RangeRequestHandling string `json:"rangeRequestHandling"`
- HeaderRewrite string `json:"headerRewrite"`
+ RangeRequestHandling int `json:"rangeRequestHandling"`
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"`
+ MultiSiteOrigin bool `json:"multiSiteOrigin"`
DisplayName string `json:"displayName"`
- InitialDispersion string `json:"initialDispersion"`
+ InitialDispersion int `json:"initialDispersion"`
MatchList []DeliveryServiceMatch `json:"matchList,omitempty"`
+ RegionalGeoBlocking bool `json:"regionalGeoBlocking"`
+ LogsEnabled bool `json:"logsEnabled"`
+ ExampleURLs []string `json:"exampleURLs"`
}
// DeliveryServiceMatch ...
@@ -172,7 +188,7 @@ type DeliveryServiceRouting struct {
// DeliveryServiceServerResponse ...
type DeliveryServiceServerResponse struct {
Response []DeliveryServiceServer `json:"response"`
- Page int `json:"page"`
+ Size int `json:"size"`
OrderBy string `json:"orderby"`
Limit int `json:"limit"`
}
@@ -180,8 +196,8 @@ type DeliveryServiceServerResponse struct {
// DeliveryServiceServer ...
type DeliveryServiceServer struct {
LastUpdated string `json:"lastUpdated"`
- Server string `json:"server"`
- DeliveryService string `json:"deliveryService"`
+ Server int `json:"server"`
+ DeliveryService int `json:"deliveryService"`
}
// DeliveryServiceSSLKeysResponse ...
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/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
index e6bcfd6..ea0fd69 100644
--- 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
@@ -25,8 +25,8 @@ func Cachegroups() *client.CacheGroupResponse {
Name: "edge-philadelphia",
ShortName: "phila",
Type: "EDGE_LOC",
- Longitude: 5,
- Latitude: 55,
+ Longitude: -5.66,
+ Latitude: 55.67,
ParentName: "mid-northeast",
LastUpdated: "2014-03-28 15:23:50",
},
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/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
index e322ac5..0349cbe 100644
--- 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
@@ -22,6 +22,7 @@ func CDNs() *client.CDNResponse {
return &client.CDNResponse{
Response: []client.CDN{
client.CDN{
+ ID: 1,
Name: "CDN-1",
LastUpdated: "2016-03-22 17:00:30",
},
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/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
index 6c7bf74..d48879b 100644
--- 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
@@ -22,30 +22,30 @@ func DeliveryServices() *client.GetDeliveryServiceResponse {
return &client.GetDeliveryServiceResponse{
Response: []client.DeliveryService{
client.DeliveryService{
- ID: "001",
+ ID: 001,
XMLID: "ds-test",
Active: true,
- DSCP: "40",
+ DSCP: 40,
Signed: false,
- QStringIgnore: "1",
- GeoLimit: "0",
- GeoProvider: "0",
- DNSBypassTTL: "30",
+ 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",
+ CCRDNSTTL: 3600,
+ GlobalMaxTPS: 0,
+ MaxDNSAnswers: 0,
+ MissLat: 44.654321,
+ MissLong: -99.123456,
+ Protocol: 0,
IPV6RoutingEnabled: true,
- RangeRequestHandling: "0",
+ RangeRequestHandling: 0,
TRResponseHeaders: "Access-Control-Allow-Origin: *",
- MultiSiteOrigin: "0",
+ MultiSiteOrigin: false,
DisplayName: "Testing",
- InitialDispersion: "1",
+ InitialDispersion: 1,
},
},
}
@@ -68,6 +68,22 @@ func DeliveryService() *client.DeliveryServiceResponse {
}
}
+// CreateDeliveryService returns a default CreateDeliveryServiceResponse to be used for testing.
+func CreateDeliveryService() *client.CreateDeliveryServiceResponse {
+ return &client.CreateDeliveryServiceResponse{
+ Response: DeliveryServices().Response,
+ Alerts: alerts(),
+ }
+}
+
+// UpdateDeliveryService returns a default UpdateDeliveryServiceResponse to be used for testing.
+func UpdateDeliveryService() *client.UpdateDeliveryServiceResponse {
+ return &client.UpdateDeliveryServiceResponse{
+ Response: DeliveryServices().Response,
+ Alerts: alerts(),
+ }
+}
+
// DeleteDeliveryService returns a default DeleteDeliveryServiceResponse to be used for testing.
func DeleteDeliveryService() *client.DeleteDeliveryServiceResponse {
return &client.DeleteDeliveryServiceResponse{
@@ -155,13 +171,13 @@ func DeliveryServiceRouting() *client.DeliveryServiceRoutingResponse {
func DeliveryServiceServer() *client.DeliveryServiceServerResponse {
dss := client.DeliveryServiceServer{
LastUpdated: "lastUpdated",
- Server: "someServer",
- DeliveryService: "someService",
+ Server: 1,
+ DeliveryService: 1,
}
return &client.DeliveryServiceServerResponse{
Response: []client.DeliveryServiceServer{dss},
- Page: 1,
+ Size: 1,
OrderBy: "foo",
Limit: 1,
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/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
index a7069a2..eb5f454 100644
--- 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
@@ -22,11 +22,18 @@ func Hardware() *client.HardwareResponse {
return &client.HardwareResponse{
Response: []client.Hardware{
client.Hardware{
- ID: "18",
- HostName: "odol-atsmid-cen-09",
+ ID: 18,
+ HostName: "edge-den-01",
LastUpdated: "2015-07-16 09:04:20",
- Value: "1.00",
- Description: "BACKPLANE FIRMWARE",
+ Value: "DIS1",
+ Description: "Phys Disk",
+ },
+ client.Hardware{
+ ID: 19,
+ HostName: "edge-den-02",
+ LastUpdated: "2015-07-16 09:04:20",
+ Value: "DIS2",
+ Description: "Physical Disk",
},
},
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/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
index 6ef2da5..8bf6be1 100644
--- 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
@@ -22,6 +22,7 @@ func Profiles() *client.ProfileResponse {
return &client.ProfileResponse{
Response: []client.Profile{
client.Profile{
+ ID: 1,
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/4b830b4f/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
index 07c541a..4184ad1 100644
--- 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
@@ -22,13 +22,13 @@ func Servers() *client.ServerResponse {
return &client.ServerResponse{
Response: []client.Server{
{
- ID: "001",
+ ID: 001,
HostName: "edge-alb-01",
DomainName: "albuquerque.nm.albuq.kabletown.com",
CDNName: "CDN-1",
Type: "EDGE",
Profile: "EDGE1_CDN_520",
- TCPPort: "80",
+ TCPPort: 80,
Rack: "F-4/35",
PhysLocation: "Albuquerque",
Cachegroup: "albuquerque",
@@ -49,19 +49,19 @@ func Servers() *client.ServerResponse {
IloIPGateway: "10.10.10.10",
IloIPNetmask: "255.255.255.192",
InterfaceName: "bond0",
- InterfaceMtu: "9000",
+ 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",
+ ID: 002,
HostName: "edge-alb-02",
DomainName: "albuquerque.nm.albuq.kabletown.com",
CDNName: "CDN-1",
Type: "EDGE",
Profile: "EDGE1_XCR_520",
- TCPPort: "80",
+ TCPPort: 80,
Rack: "F-4/38",
PhysLocation: "Albuquerque",
Cachegroup: "us-nm-albuquerque",
@@ -82,19 +82,19 @@ func Servers() *client.ServerResponse {
IloIPGateway: "10.10.10.10",
IloIPNetmask: "255.255.255.192",
InterfaceName: "bond0",
- InterfaceMtu: "9000",
+ 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",
+ ID: 003,
HostName: "atlanta-mid-01",
DomainName: "ga.atlanta.kabletown.net",
CDNName: "CDN-1",
Type: "MID",
Profile: "MID1",
- TCPPort: "80",
+ TCPPort: 80,
Rack: "F-4/38",
PhysLocation: "Denver",
Cachegroup: "mid-northeast-group",
@@ -115,7 +115,7 @@ func Servers() *client.ServerResponse {
IloIPGateway: "1",
IloIPNetmask: "",
InterfaceName: "bond0",
- InterfaceMtu: "9000",
+ InterfaceMtu: 9000,
RouterPortName: "",
RouterHostName: "",
LastUpdated: "2015-03-27 17:00:34",
@@ -129,7 +129,7 @@ func LogstashServers() *client.ServerResponse {
return &client.ServerResponse{
Response: []client.Server{
{
- ID: "004",
+ ID: 004,
HostName: "logstash-01",
DomainName: "albuquerque.nm.albuq.kabletown.com",
CDNName: "CDN-2",
@@ -138,7 +138,7 @@ func LogstashServers() *client.ServerResponse {
IPAddress: "10.10.10.10",
},
{
- ID: "005",
+ ID: 005,
HostName: "logstash-02",
DomainName: "albuquerque.nm.albuq.kabletown.com",
CDNName: "CDN-2",
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/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
index 9f74c59..ef77346 100644
--- 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
@@ -22,8 +22,10 @@ func Types() *client.TypeResponse {
return &client.TypeResponse{
Response: []client.Type{
client.Type{
+ ID: 1,
Name: "EDGE",
Description: "edge cache",
+ UseInTable: "server",
},
},
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/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
index 39bf775..b70a3e8 100644
--- 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
@@ -24,7 +24,7 @@ func Users() *client.UserResponse {
client.User{
Username: "bsmith",
PublicSSHKey: "some-ssh-key",
- Role: "3",
+ Role: 3,
RoleName: "operations",
Email: "bobsmith@email.com",
FullName: "Bob Smith",
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/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
index 939ce12..1fef498 100644
--- 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
@@ -16,16 +16,17 @@
package client
import "encoding/json"
+import "fmt"
// HardwareResponse ...
type HardwareResponse struct {
- Version string `json:"version"`
+ Limit int `json:"limit"`
Response []Hardware `json:"response"`
}
// Hardware ...
type Hardware struct {
- ID string `json:"serverId"`
+ ID int `json:"serverId"`
HostName string `json:"serverHostName"`
LastUpdated string `json:"lastUpdated"`
Value string `json:"val"`
@@ -33,8 +34,11 @@ type Hardware struct {
}
// Hardware gets an array of Hardware
-func (to *Session) Hardware() ([]Hardware, error) {
+func (to *Session) Hardware(limit int) ([]Hardware, error) {
url := "/api/1.2/hwinfo.json"
+ if limit > 0 {
+ url += fmt.Sprintf("?limit=%v", limit)
+ }
resp, err := to.request("GET", url, nil)
if err != nil {
return nil, err
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/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
index 937e450..34a805e 100644
--- 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
@@ -22,7 +22,6 @@ import (
// ParamResponse ...
type ParamResponse struct {
- Version string `json:"version"`
Response []Parameter `json:"response"`
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/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
index b417886..90f3f4d 100644
--- 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
@@ -19,12 +19,12 @@ import "encoding/json"
// ProfileResponse ...
type ProfileResponse struct {
- Version string `json:"version"`
Response []Profile `json:"response"`
}
// Profile ...
type Profile struct {
+ ID int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
LastUpdated string `json:"lastUpdated"`
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/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
index 93ea9e5..8dd0c1c 100644
--- 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
@@ -24,7 +24,6 @@ import (
// ServerResponse ...
type ServerResponse struct {
- Version string `json:"version"`
Response []Server `json:"response"`
}
@@ -32,13 +31,13 @@ type ServerResponse struct {
type Server struct {
DomainName string `json:"domainName"`
HostName string `json:"hostName"`
- ID string `json:"id"`
+ ID int `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"`
+ InterfaceMtu int `json:"interfaceMtu"`
InterfaceName string `json:"interfaceName"`
IP6Address string `json:"ip6Address"`
IP6Gateway string `json:"ip6Gateway"`
@@ -59,7 +58,7 @@ type Server struct {
RouterHostName string `json:"routerHostName"`
RouterPortName string `json:"routerPortName"`
Status string `json:"status"`
- TCPPort string `json:"tcpPort"`
+ TCPPort int `json:"tcpPort"`
Type string `json:"type"`
XMPPID string `json:"xmppId"`
XMPPPasswd string `json:"xmppPasswd"`
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/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
index b68ce4a..dcdfffa 100644
--- 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
@@ -20,7 +20,6 @@ import (
// StatsSummaryResponse ...
type StatsSummaryResponse struct {
- Version string `json:"version"`
Response []StatsSummary `json:"response"`
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_monitor_config.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_monitor_config.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_monitor_config.go
index 50ec7cd..cf1208b 100644
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_monitor_config.go
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_monitor_config.go
@@ -24,7 +24,6 @@ import (
// TMConfigResponse ...
type TMConfigResponse struct {
- Version string `json:"version"`
Response TrafficMonitorConfig `json:"response"`
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_ops.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_ops.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_ops.go
index 15d8cc8..beb03ff 100644
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_ops.go
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_ops.go
@@ -52,8 +52,7 @@ func (e *HTTPError) Error() string {
// Result {"response":[{"level":"success","text":"Successfully logged in."}],"version":"1.1"}
type Result struct {
- Alerts []Alert
- Version string `json:"version"`
+ Alerts []Alert
}
// Alert ...
@@ -195,14 +194,14 @@ func (to *Session) request(method, path string, body []byte) (*http.Response, er
var req *http.Request
var err error
- if body != nil && method != "GET" {
+ if body != nil {
req, err = http.NewRequest(method, url, bytes.NewBuffer(body))
if err != nil {
return nil, err
}
req.Header.Set("Content-Type", "application/json")
} else {
- req, err = http.NewRequest("GET", url, nil)
+ req, err = http.NewRequest(method, url, nil)
if err != nil {
return nil, err
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_router_config.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_router_config.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_router_config.go
index aecd72d..96064b9 100644
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_router_config.go
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_router_config.go
@@ -22,7 +22,6 @@ import (
// TRConfigResponse ...
type TRConfigResponse struct {
- Version string `json:"version"`
Response TrafficRouterConfig `json:"response"`
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/type.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/type.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/type.go
index f8242f3..688c11d 100644
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/type.go
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/type.go
@@ -22,12 +22,12 @@ import (
// TypeResponse ...
type TypeResponse struct {
- Version string `json:"version"`
Response []Type `json:"response"`
}
// Type contains information about a given Type in Traffic Ops.
type Type struct {
+ ID int `json:"id"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
UseInTable string `json:"useInTable,omitempt"`
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4b830b4f/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/user.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/user.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/user.go
index 2819eab..3534c77 100644
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/user.go
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/user.go
@@ -19,7 +19,6 @@ import "encoding/json"
// UserResponse ...
type UserResponse struct {
- Version string `json:"version"`
Response []User `json:"response"`
}
@@ -27,10 +26,11 @@ type UserResponse struct {
type User struct {
Username string `json:"username,omitempty"`
PublicSSHKey string `json:"publicSshKey,omitempty"`
- Role string `json:"role,omitempty"`
+ Role int `json:"role,omitempty"`
RoleName string `json:"rolename,omitempty"`
- UID string `json:"uid,omitempty"`
- GID string `json:"gid,omitempty"`
+ ID int `json:"id,omitempty"`
+ UID int `json:"uid,omitempty"`
+ GID int `json:"gid,omitempty"`
Company string `json:"company,omitempty"`
Email string `json:"email,omitempty"`
FullName string `json:"fullName,omitempty"`
@@ -48,7 +48,7 @@ func (to *Session) Users() ([]User, error) {
resp.Body.Close()
var data UserResponse
- if err := json.NewDecoder(resp.Body).Decode(&data.Response); err != nil {
+ if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
return nil, err
}
[24/29] incubator-trafficcontrol git commit: Update vendor going more
thoroughly through deps recursively... some cleanup may be called for in a
follow up PR
Posted by ne...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/client_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/client_test.go b/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/client_test.go
deleted file mode 100644
index d27c162..0000000
--- a/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/client_test.go
+++ /dev/null
@@ -1,525 +0,0 @@
-package client
-
-import (
- "encoding/json"
- "net/http"
- "net/http/httptest"
- "reflect"
- "strings"
- "sync"
- "testing"
- "time"
-)
-
-func TestUDPClient_Query(t *testing.T) {
- config := UDPConfig{Addr: "localhost:8089"}
- c, err := NewUDPClient(config)
- if err != nil {
- t.Errorf("unexpected error. expected %v, actual %v", nil, err)
- }
- defer c.Close()
- query := Query{}
- _, err = c.Query(query)
- if err == nil {
- t.Error("Querying UDP client should fail")
- }
-}
-
-func TestUDPClient_Ping(t *testing.T) {
- config := UDPConfig{Addr: "localhost:8089"}
- c, err := NewUDPClient(config)
- if err != nil {
- t.Errorf("unexpected error. expected %v, actual %v", nil, err)
- }
- defer c.Close()
-
- rtt, version, err := c.Ping(0)
- if rtt != 0 || version != "" || err != nil {
- t.Errorf("unexpected error. expected (%v, '%v', %v), actual (%v, '%v', %v)", 0, "", nil, rtt, version, err)
- }
-}
-
-func TestUDPClient_Write(t *testing.T) {
- config := UDPConfig{Addr: "localhost:8089"}
- c, err := NewUDPClient(config)
- if err != nil {
- t.Errorf("unexpected error. expected %v, actual %v", nil, err)
- }
- defer c.Close()
-
- bp, err := NewBatchPoints(BatchPointsConfig{})
- if err != nil {
- t.Errorf("unexpected error. expected %v, actual %v", nil, err)
- }
-
- fields := make(map[string]interface{})
- fields["value"] = 1.0
- pt, _ := NewPoint("cpu", make(map[string]string), fields)
- bp.AddPoint(pt)
-
- err = c.Write(bp)
- if err != nil {
- t.Errorf("unexpected error. expected %v, actual %v", nil, err)
- }
-}
-
-func TestUDPClient_BadAddr(t *testing.T) {
- config := UDPConfig{Addr: "foobar@wahoo"}
- c, err := NewUDPClient(config)
- if err == nil {
- defer c.Close()
- t.Error("Expected resolve error")
- }
-}
-
-func TestUDPClient_Batches(t *testing.T) {
- var logger writeLogger
- var cl udpclient
-
- cl.conn = &logger
- cl.payloadSize = 20 // should allow for two points per batch
-
- // expected point should look like this: "cpu a=1i"
- fields := map[string]interface{}{"a": 1}
-
- p, _ := NewPoint("cpu", nil, fields, time.Time{})
-
- bp, _ := NewBatchPoints(BatchPointsConfig{})
-
- for i := 0; i < 9; i++ {
- bp.AddPoint(p)
- }
-
- if err := cl.Write(bp); err != nil {
- t.Fatalf("Unexpected error during Write: %v", err)
- }
-
- if len(logger.writes) != 5 {
- t.Errorf("Mismatched write count: got %v, exp %v", len(logger.writes), 5)
- }
-}
-
-func TestUDPClient_Split(t *testing.T) {
- var logger writeLogger
- var cl udpclient
-
- cl.conn = &logger
- cl.payloadSize = 1 // force one field per point
-
- fields := map[string]interface{}{"a": 1, "b": 2, "c": 3, "d": 4}
-
- p, _ := NewPoint("cpu", nil, fields, time.Unix(1, 0))
-
- bp, _ := NewBatchPoints(BatchPointsConfig{})
-
- bp.AddPoint(p)
-
- if err := cl.Write(bp); err != nil {
- t.Fatalf("Unexpected error during Write: %v", err)
- }
-
- if len(logger.writes) != len(fields) {
- t.Errorf("Mismatched write count: got %v, exp %v", len(logger.writes), len(fields))
- }
-}
-
-type writeLogger struct {
- writes [][]byte
-}
-
-func (w *writeLogger) Write(b []byte) (int, error) {
- w.writes = append(w.writes, append([]byte(nil), b...))
- return len(b), nil
-}
-
-func (w *writeLogger) Close() error { return nil }
-
-func TestClient_Query(t *testing.T) {
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- var data Response
- w.WriteHeader(http.StatusOK)
- _ = json.NewEncoder(w).Encode(data)
- }))
- defer ts.Close()
-
- config := HTTPConfig{Addr: ts.URL}
- c, _ := NewHTTPClient(config)
- defer c.Close()
-
- query := Query{}
- _, err := c.Query(query)
- if err != nil {
- t.Errorf("unexpected error. expected %v, actual %v", nil, err)
- }
-}
-
-func TestClient_BoundParameters(t *testing.T) {
- var parameterString string
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- var data Response
- r.ParseForm()
- parameterString = r.FormValue("params")
- w.WriteHeader(http.StatusOK)
- _ = json.NewEncoder(w).Encode(data)
- }))
- defer ts.Close()
-
- config := HTTPConfig{Addr: ts.URL}
- c, _ := NewHTTPClient(config)
- defer c.Close()
-
- expectedParameters := map[string]interface{}{
- "testStringParameter": "testStringValue",
- "testNumberParameter": 12.3,
- }
-
- query := Query{
- Parameters: expectedParameters,
- }
-
- _, err := c.Query(query)
- if err != nil {
- t.Errorf("unexpected error. expected %v, actual %v", nil, err)
- }
-
- var actualParameters map[string]interface{}
-
- err = json.Unmarshal([]byte(parameterString), &actualParameters)
- if err != nil {
- t.Errorf("unexpected error. expected %v, actual %v", nil, err)
- }
-
- if !reflect.DeepEqual(expectedParameters, actualParameters) {
- t.Errorf("unexpected parameters. expected %v, actual %v", expectedParameters, actualParameters)
- }
-}
-
-func TestClient_BasicAuth(t *testing.T) {
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- u, p, ok := r.BasicAuth()
-
- if !ok {
- t.Errorf("basic auth error")
- }
- if u != "username" {
- t.Errorf("unexpected username, expected %q, actual %q", "username", u)
- }
- if p != "password" {
- t.Errorf("unexpected password, expected %q, actual %q", "password", p)
- }
- var data Response
- w.WriteHeader(http.StatusOK)
- _ = json.NewEncoder(w).Encode(data)
- }))
- defer ts.Close()
-
- config := HTTPConfig{Addr: ts.URL, Username: "username", Password: "password"}
- c, _ := NewHTTPClient(config)
- defer c.Close()
-
- query := Query{}
- _, err := c.Query(query)
- if err != nil {
- t.Errorf("unexpected error. expected %v, actual %v", nil, err)
- }
-}
-
-func TestClient_Ping(t *testing.T) {
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- var data Response
- w.WriteHeader(http.StatusNoContent)
- _ = json.NewEncoder(w).Encode(data)
- }))
- defer ts.Close()
-
- config := HTTPConfig{Addr: ts.URL}
- c, _ := NewHTTPClient(config)
- defer c.Close()
-
- _, _, err := c.Ping(0)
- if err != nil {
- t.Errorf("unexpected error. expected %v, actual %v", nil, err)
- }
-}
-
-func TestClient_Concurrent_Use(t *testing.T) {
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusOK)
- w.Write([]byte(`{}`))
- }))
- defer ts.Close()
-
- config := HTTPConfig{Addr: ts.URL}
- c, _ := NewHTTPClient(config)
- defer c.Close()
-
- var wg sync.WaitGroup
- wg.Add(3)
- n := 1000
-
- go func() {
- defer wg.Done()
- bp, err := NewBatchPoints(BatchPointsConfig{})
- if err != nil {
- t.Errorf("got error %v", err)
- }
-
- for i := 0; i < n; i++ {
- if err = c.Write(bp); err != nil {
- t.Fatalf("got error %v", err)
- }
- }
- }()
-
- go func() {
- defer wg.Done()
- var q Query
- for i := 0; i < n; i++ {
- if _, err := c.Query(q); err != nil {
- t.Fatalf("got error %v", err)
- }
- }
- }()
-
- go func() {
- defer wg.Done()
- for i := 0; i < n; i++ {
- c.Ping(time.Second)
- }
- }()
- wg.Wait()
-}
-
-func TestClient_Write(t *testing.T) {
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- var data Response
- w.WriteHeader(http.StatusNoContent)
- _ = json.NewEncoder(w).Encode(data)
- }))
- defer ts.Close()
-
- config := HTTPConfig{Addr: ts.URL}
- c, _ := NewHTTPClient(config)
- defer c.Close()
-
- bp, err := NewBatchPoints(BatchPointsConfig{})
- if err != nil {
- t.Errorf("unexpected error. expected %v, actual %v", nil, err)
- }
- err = c.Write(bp)
- if err != nil {
- t.Errorf("unexpected error. expected %v, actual %v", nil, err)
- }
-}
-
-func TestClient_UserAgent(t *testing.T) {
- receivedUserAgent := ""
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- receivedUserAgent = r.UserAgent()
-
- var data Response
- w.WriteHeader(http.StatusOK)
- _ = json.NewEncoder(w).Encode(data)
- }))
- defer ts.Close()
-
- _, err := http.Get(ts.URL)
- if err != nil {
- t.Errorf("unexpected error. expected %v, actual %v", nil, err)
- }
-
- tests := []struct {
- name string
- userAgent string
- expected string
- }{
- {
- name: "Empty user agent",
- userAgent: "",
- expected: "InfluxDBClient",
- },
- {
- name: "Custom user agent",
- userAgent: "Test Influx Client",
- expected: "Test Influx Client",
- },
- }
-
- for _, test := range tests {
-
- config := HTTPConfig{Addr: ts.URL, UserAgent: test.userAgent}
- c, _ := NewHTTPClient(config)
- defer c.Close()
-
- receivedUserAgent = ""
- query := Query{}
- _, err = c.Query(query)
- if err != nil {
- t.Errorf("unexpected error. expected %v, actual %v", nil, err)
- }
- if !strings.HasPrefix(receivedUserAgent, test.expected) {
- t.Errorf("Unexpected user agent. expected %v, actual %v", test.expected, receivedUserAgent)
- }
-
- receivedUserAgent = ""
- bp, _ := NewBatchPoints(BatchPointsConfig{})
- err = c.Write(bp)
- if err != nil {
- t.Errorf("unexpected error. expected %v, actual %v", nil, err)
- }
- if !strings.HasPrefix(receivedUserAgent, test.expected) {
- t.Errorf("Unexpected user agent. expected %v, actual %v", test.expected, receivedUserAgent)
- }
-
- receivedUserAgent = ""
- _, err := c.Query(query)
- if err != nil {
- t.Errorf("unexpected error. expected %v, actual %v", nil, err)
- }
- if receivedUserAgent != test.expected {
- t.Errorf("Unexpected user agent. expected %v, actual %v", test.expected, receivedUserAgent)
- }
- }
-}
-
-func TestClient_PointString(t *testing.T) {
- const shortForm = "2006-Jan-02"
- time1, _ := time.Parse(shortForm, "2013-Feb-03")
- tags := map[string]string{"cpu": "cpu-total"}
- fields := map[string]interface{}{"idle": 10.1, "system": 50.9, "user": 39.0}
- p, _ := NewPoint("cpu_usage", tags, fields, time1)
-
- s := "cpu_usage,cpu=cpu-total idle=10.1,system=50.9,user=39 1359849600000000000"
- if p.String() != s {
- t.Errorf("Point String Error, got %s, expected %s", p.String(), s)
- }
-
- s = "cpu_usage,cpu=cpu-total idle=10.1,system=50.9,user=39 1359849600000"
- if p.PrecisionString("ms") != s {
- t.Errorf("Point String Error, got %s, expected %s",
- p.PrecisionString("ms"), s)
- }
-}
-
-func TestClient_PointWithoutTimeString(t *testing.T) {
- tags := map[string]string{"cpu": "cpu-total"}
- fields := map[string]interface{}{"idle": 10.1, "system": 50.9, "user": 39.0}
- p, _ := NewPoint("cpu_usage", tags, fields)
-
- s := "cpu_usage,cpu=cpu-total idle=10.1,system=50.9,user=39"
- if p.String() != s {
- t.Errorf("Point String Error, got %s, expected %s", p.String(), s)
- }
-
- if p.PrecisionString("ms") != s {
- t.Errorf("Point String Error, got %s, expected %s",
- p.PrecisionString("ms"), s)
- }
-}
-
-func TestClient_PointName(t *testing.T) {
- tags := map[string]string{"cpu": "cpu-total"}
- fields := map[string]interface{}{"idle": 10.1, "system": 50.9, "user": 39.0}
- p, _ := NewPoint("cpu_usage", tags, fields)
-
- exp := "cpu_usage"
- if p.Name() != exp {
- t.Errorf("Error, got %s, expected %s",
- p.Name(), exp)
- }
-}
-
-func TestClient_PointTags(t *testing.T) {
- tags := map[string]string{"cpu": "cpu-total"}
- fields := map[string]interface{}{"idle": 10.1, "system": 50.9, "user": 39.0}
- p, _ := NewPoint("cpu_usage", tags, fields)
-
- if !reflect.DeepEqual(tags, p.Tags()) {
- t.Errorf("Error, got %v, expected %v",
- p.Tags(), tags)
- }
-}
-
-func TestClient_PointUnixNano(t *testing.T) {
- const shortForm = "2006-Jan-02"
- time1, _ := time.Parse(shortForm, "2013-Feb-03")
- tags := map[string]string{"cpu": "cpu-total"}
- fields := map[string]interface{}{"idle": 10.1, "system": 50.9, "user": 39.0}
- p, _ := NewPoint("cpu_usage", tags, fields, time1)
-
- exp := int64(1359849600000000000)
- if p.UnixNano() != exp {
- t.Errorf("Error, got %d, expected %d",
- p.UnixNano(), exp)
- }
-}
-
-func TestClient_PointFields(t *testing.T) {
- tags := map[string]string{"cpu": "cpu-total"}
- fields := map[string]interface{}{"idle": 10.1, "system": 50.9, "user": 39.0}
- p, _ := NewPoint("cpu_usage", tags, fields)
-
- pfields, err := p.Fields()
- if err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(fields, pfields) {
- t.Errorf("Error, got %v, expected %v",
- pfields, fields)
- }
-}
-
-func TestBatchPoints_PrecisionError(t *testing.T) {
- _, err := NewBatchPoints(BatchPointsConfig{Precision: "foobar"})
- if err == nil {
- t.Errorf("Precision: foobar should have errored")
- }
-
- bp, _ := NewBatchPoints(BatchPointsConfig{Precision: "ns"})
- err = bp.SetPrecision("foobar")
- if err == nil {
- t.Errorf("Precision: foobar should have errored")
- }
-}
-
-func TestBatchPoints_SettersGetters(t *testing.T) {
- bp, _ := NewBatchPoints(BatchPointsConfig{
- Precision: "ns",
- Database: "db",
- RetentionPolicy: "rp",
- WriteConsistency: "wc",
- })
- if bp.Precision() != "ns" {
- t.Errorf("Expected: %s, got %s", bp.Precision(), "ns")
- }
- if bp.Database() != "db" {
- t.Errorf("Expected: %s, got %s", bp.Database(), "db")
- }
- if bp.RetentionPolicy() != "rp" {
- t.Errorf("Expected: %s, got %s", bp.RetentionPolicy(), "rp")
- }
- if bp.WriteConsistency() != "wc" {
- t.Errorf("Expected: %s, got %s", bp.WriteConsistency(), "wc")
- }
-
- bp.SetDatabase("db2")
- bp.SetRetentionPolicy("rp2")
- bp.SetWriteConsistency("wc2")
- err := bp.SetPrecision("s")
- if err != nil {
- t.Errorf("Did not expect error: %s", err.Error())
- }
-
- if bp.Precision() != "s" {
- t.Errorf("Expected: %s, got %s", bp.Precision(), "s")
- }
- if bp.Database() != "db2" {
- t.Errorf("Expected: %s, got %s", bp.Database(), "db2")
- }
- if bp.RetentionPolicy() != "rp2" {
- t.Errorf("Expected: %s, got %s", bp.RetentionPolicy(), "rp2")
- }
- if bp.WriteConsistency() != "wc2" {
- t.Errorf("Expected: %s, got %s", bp.WriteConsistency(), "wc2")
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/example_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/example_test.go b/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/example_test.go
deleted file mode 100644
index 68bb24b..0000000
--- a/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/example_test.go
+++ /dev/null
@@ -1,265 +0,0 @@
-package client_test
-
-import (
- "fmt"
- "math/rand"
- "os"
- "time"
-
- "github.com/influxdata/influxdb/client/v2"
-)
-
-// Create a new client
-func ExampleClient() {
- // NOTE: this assumes you've setup a user and have setup shell env variables,
- // namely INFLUX_USER/INFLUX_PWD. If not just omit Username/Password below.
- _, err := client.NewHTTPClient(client.HTTPConfig{
- Addr: "http://localhost:8086",
- Username: os.Getenv("INFLUX_USER"),
- Password: os.Getenv("INFLUX_PWD"),
- })
- if err != nil {
- fmt.Println("Error creating InfluxDB Client: ", err.Error())
- }
-}
-
-// Write a point using the UDP client
-func ExampleClient_uDP() {
- // Make client
- config := client.UDPConfig{Addr: "localhost:8089"}
- c, err := client.NewUDPClient(config)
- if err != nil {
- fmt.Println("Error: ", err.Error())
- }
- defer c.Close()
-
- // Create a new point batch
- bp, _ := client.NewBatchPoints(client.BatchPointsConfig{
- Precision: "s",
- })
-
- // Create a point and add to batch
- tags := map[string]string{"cpu": "cpu-total"}
- fields := map[string]interface{}{
- "idle": 10.1,
- "system": 53.3,
- "user": 46.6,
- }
- pt, err := client.NewPoint("cpu_usage", tags, fields, time.Now())
- if err != nil {
- fmt.Println("Error: ", err.Error())
- }
- bp.AddPoint(pt)
-
- // Write the batch
- c.Write(bp)
-}
-
-// Ping the cluster using the HTTP client
-func ExampleClient_Ping() {
- // Make client
- c, err := client.NewHTTPClient(client.HTTPConfig{
- Addr: "http://localhost:8086",
- })
- if err != nil {
- fmt.Println("Error creating InfluxDB Client: ", err.Error())
- }
- defer c.Close()
-
- _, _, err = c.Ping(0)
- if err != nil {
- fmt.Println("Error pinging InfluxDB Cluster: ", err.Error())
- }
-}
-
-// Write a point using the HTTP client
-func ExampleClient_write() {
- // Make client
- c, err := client.NewHTTPClient(client.HTTPConfig{
- Addr: "http://localhost:8086",
- })
- if err != nil {
- fmt.Println("Error creating InfluxDB Client: ", err.Error())
- }
- defer c.Close()
-
- // Create a new point batch
- bp, _ := client.NewBatchPoints(client.BatchPointsConfig{
- Database: "BumbleBeeTuna",
- Precision: "s",
- })
-
- // Create a point and add to batch
- tags := map[string]string{"cpu": "cpu-total"}
- fields := map[string]interface{}{
- "idle": 10.1,
- "system": 53.3,
- "user": 46.6,
- }
- pt, err := client.NewPoint("cpu_usage", tags, fields, time.Now())
- if err != nil {
- fmt.Println("Error: ", err.Error())
- }
- bp.AddPoint(pt)
-
- // Write the batch
- c.Write(bp)
-}
-
-// Create a batch and add a point
-func ExampleBatchPoints() {
- // Create a new point batch
- bp, _ := client.NewBatchPoints(client.BatchPointsConfig{
- Database: "BumbleBeeTuna",
- Precision: "s",
- })
-
- // Create a point and add to batch
- tags := map[string]string{"cpu": "cpu-total"}
- fields := map[string]interface{}{
- "idle": 10.1,
- "system": 53.3,
- "user": 46.6,
- }
- pt, err := client.NewPoint("cpu_usage", tags, fields, time.Now())
- if err != nil {
- fmt.Println("Error: ", err.Error())
- }
- bp.AddPoint(pt)
-}
-
-// Using the BatchPoints setter functions
-func ExampleBatchPoints_setters() {
- // Create a new point batch
- bp, _ := client.NewBatchPoints(client.BatchPointsConfig{})
- bp.SetDatabase("BumbleBeeTuna")
- bp.SetPrecision("ms")
-
- // Create a point and add to batch
- tags := map[string]string{"cpu": "cpu-total"}
- fields := map[string]interface{}{
- "idle": 10.1,
- "system": 53.3,
- "user": 46.6,
- }
- pt, err := client.NewPoint("cpu_usage", tags, fields, time.Now())
- if err != nil {
- fmt.Println("Error: ", err.Error())
- }
- bp.AddPoint(pt)
-}
-
-// Create a new point with a timestamp
-func ExamplePoint() {
- tags := map[string]string{"cpu": "cpu-total"}
- fields := map[string]interface{}{
- "idle": 10.1,
- "system": 53.3,
- "user": 46.6,
- }
- pt, err := client.NewPoint("cpu_usage", tags, fields, time.Now())
- if err == nil {
- fmt.Println("We created a point: ", pt.String())
- }
-}
-
-// Create a new point without a timestamp
-func ExamplePoint_withoutTime() {
- tags := map[string]string{"cpu": "cpu-total"}
- fields := map[string]interface{}{
- "idle": 10.1,
- "system": 53.3,
- "user": 46.6,
- }
- pt, err := client.NewPoint("cpu_usage", tags, fields)
- if err == nil {
- fmt.Println("We created a point w/o time: ", pt.String())
- }
-}
-
-// Write 1000 points
-func ExampleClient_write1000() {
- sampleSize := 1000
-
- // Make client
- c, err := client.NewHTTPClient(client.HTTPConfig{
- Addr: "http://localhost:8086",
- })
- if err != nil {
- fmt.Println("Error creating InfluxDB Client: ", err.Error())
- }
- defer c.Close()
-
- rand.Seed(42)
-
- bp, _ := client.NewBatchPoints(client.BatchPointsConfig{
- Database: "systemstats",
- Precision: "us",
- })
-
- for i := 0; i < sampleSize; i++ {
- regions := []string{"us-west1", "us-west2", "us-west3", "us-east1"}
- tags := map[string]string{
- "cpu": "cpu-total",
- "host": fmt.Sprintf("host%d", rand.Intn(1000)),
- "region": regions[rand.Intn(len(regions))],
- }
-
- idle := rand.Float64() * 100.0
- fields := map[string]interface{}{
- "idle": idle,
- "busy": 100.0 - idle,
- }
-
- pt, err := client.NewPoint(
- "cpu_usage",
- tags,
- fields,
- time.Now(),
- )
- if err != nil {
- println("Error:", err.Error())
- continue
- }
- bp.AddPoint(pt)
- }
-
- err = c.Write(bp)
- if err != nil {
- fmt.Println("Error: ", err.Error())
- }
-}
-
-// Make a Query
-func ExampleClient_query() {
- // Make client
- c, err := client.NewHTTPClient(client.HTTPConfig{
- Addr: "http://localhost:8086",
- })
- if err != nil {
- fmt.Println("Error creating InfluxDB Client: ", err.Error())
- }
- defer c.Close()
-
- q := client.NewQuery("SELECT count(value) FROM shapes", "square_holes", "ns")
- if response, err := c.Query(q); err == nil && response.Error() == nil {
- fmt.Println(response.Results)
- }
-}
-
-// Create a Database with a query
-func ExampleClient_createDatabase() {
- // Make client
- c, err := client.NewHTTPClient(client.HTTPConfig{
- Addr: "http://localhost:8086",
- })
- if err != nil {
- fmt.Println("Error creating InfluxDB Client: ", err.Error())
- }
- defer c.Close()
-
- q := client.NewQuery("CREATE DATABASE telegraf", "", "")
- if response, err := c.Query(q); err == nil && response.Error() == nil {
- fmt.Println(response.Results)
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/influxdata/influxdb/models/consistency.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/models/consistency.go b/traffic_stats/vendor/github.com/influxdata/influxdb/models/consistency.go
new file mode 100644
index 0000000..2a3269b
--- /dev/null
+++ b/traffic_stats/vendor/github.com/influxdata/influxdb/models/consistency.go
@@ -0,0 +1,48 @@
+package models
+
+import (
+ "errors"
+ "strings"
+)
+
+// ConsistencyLevel represent a required replication criteria before a write can
+// be returned as successful.
+//
+// The consistency level is handled in open-source InfluxDB but only applicable to clusters.
+type ConsistencyLevel int
+
+const (
+ // ConsistencyLevelAny allows for hinted handoff, potentially no write happened yet.
+ ConsistencyLevelAny ConsistencyLevel = iota
+
+ // ConsistencyLevelOne requires at least one data node acknowledged a write.
+ ConsistencyLevelOne
+
+ // ConsistencyLevelQuorum requires a quorum of data nodes to acknowledge a write.
+ ConsistencyLevelQuorum
+
+ // ConsistencyLevelAll requires all data nodes to acknowledge a write.
+ ConsistencyLevelAll
+)
+
+var (
+ // ErrInvalidConsistencyLevel is returned when parsing the string version
+ // of a consistency level.
+ ErrInvalidConsistencyLevel = errors.New("invalid consistency level")
+)
+
+// ParseConsistencyLevel converts a consistency level string to the corresponding ConsistencyLevel const.
+func ParseConsistencyLevel(level string) (ConsistencyLevel, error) {
+ switch strings.ToLower(level) {
+ case "any":
+ return ConsistencyLevelAny, nil
+ case "one":
+ return ConsistencyLevelOne, nil
+ case "quorum":
+ return ConsistencyLevelQuorum, nil
+ case "all":
+ return ConsistencyLevelAll, nil
+ default:
+ return 0, ErrInvalidConsistencyLevel
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/influxdata/influxdb/models/inline_fnv.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/models/inline_fnv.go b/traffic_stats/vendor/github.com/influxdata/influxdb/models/inline_fnv.go
new file mode 100644
index 0000000..1d8ae29
--- /dev/null
+++ b/traffic_stats/vendor/github.com/influxdata/influxdb/models/inline_fnv.go
@@ -0,0 +1,32 @@
+package models
+
+// from stdlib hash/fnv/fnv.go
+const (
+ prime64 = 1099511628211
+ offset64 = 14695981039346656037
+)
+
+// InlineFNV64a is an alloc-free port of the standard library's fnv64a.
+// See https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function.
+type InlineFNV64a uint64
+
+// NewInlineFNV64a returns a new instance of InlineFNV64a.
+func NewInlineFNV64a() InlineFNV64a {
+ return offset64
+}
+
+// Write adds data to the running hash.
+func (s *InlineFNV64a) Write(data []byte) (int, error) {
+ hash := uint64(*s)
+ for _, c := range data {
+ hash ^= uint64(c)
+ hash *= prime64
+ }
+ *s = InlineFNV64a(hash)
+ return len(data), nil
+}
+
+// Sum64 returns the uint64 of the current resulting hash.
+func (s *InlineFNV64a) Sum64() uint64 {
+ return uint64(*s)
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/influxdata/influxdb/models/inline_strconv_parse.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/models/inline_strconv_parse.go b/traffic_stats/vendor/github.com/influxdata/influxdb/models/inline_strconv_parse.go
new file mode 100644
index 0000000..727ce35
--- /dev/null
+++ b/traffic_stats/vendor/github.com/influxdata/influxdb/models/inline_strconv_parse.go
@@ -0,0 +1,38 @@
+package models
+
+import (
+ "reflect"
+ "strconv"
+ "unsafe"
+)
+
+// parseIntBytes is a zero-alloc wrapper around strconv.ParseInt.
+func parseIntBytes(b []byte, base int, bitSize int) (i int64, err error) {
+ s := unsafeBytesToString(b)
+ return strconv.ParseInt(s, base, bitSize)
+}
+
+// parseFloatBytes is a zero-alloc wrapper around strconv.ParseFloat.
+func parseFloatBytes(b []byte, bitSize int) (float64, error) {
+ s := unsafeBytesToString(b)
+ return strconv.ParseFloat(s, bitSize)
+}
+
+// parseBoolBytes is a zero-alloc wrapper around strconv.ParseBool.
+func parseBoolBytes(b []byte) (bool, error) {
+ return strconv.ParseBool(unsafeBytesToString(b))
+}
+
+// unsafeBytesToString converts a []byte to a string without a heap allocation.
+//
+// It is unsafe, and is intended to prepare input to short-lived functions
+// that require strings.
+func unsafeBytesToString(in []byte) string {
+ src := *(*reflect.SliceHeader)(unsafe.Pointer(&in))
+ dst := reflect.StringHeader{
+ Data: src.Data,
+ Len: src.Len,
+ }
+ s := *(*string)(unsafe.Pointer(&dst))
+ return s
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/influxdata/influxdb/models/points.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/models/points.go b/traffic_stats/vendor/github.com/influxdata/influxdb/models/points.go
new file mode 100644
index 0000000..f415e01
--- /dev/null
+++ b/traffic_stats/vendor/github.com/influxdata/influxdb/models/points.go
@@ -0,0 +1,1997 @@
+// Package models implements basic objects used throughout the TICK stack.
+package models
+
+import (
+ "bytes"
+ "encoding/binary"
+ "errors"
+ "fmt"
+ "math"
+ "sort"
+ "strconv"
+ "strings"
+ "time"
+
+ "github.com/influxdata/influxdb/pkg/escape"
+)
+
+var (
+ measurementEscapeCodes = map[byte][]byte{
+ ',': []byte(`\,`),
+ ' ': []byte(`\ `),
+ }
+
+ tagEscapeCodes = map[byte][]byte{
+ ',': []byte(`\,`),
+ ' ': []byte(`\ `),
+ '=': []byte(`\=`),
+ }
+
+ // ErrPointMustHaveAField is returned when operating on a point that does not have any fields.
+ ErrPointMustHaveAField = errors.New("point without fields is unsupported")
+
+ // ErrInvalidNumber is returned when a number is expected but not provided.
+ ErrInvalidNumber = errors.New("invalid number")
+
+ // ErrInvalidPoint is returned when a point cannot be parsed correctly.
+ ErrInvalidPoint = errors.New("point is invalid")
+)
+
+const (
+ // MaxKeyLength is the largest allowed size of the combined measurement and tag keys.
+ MaxKeyLength = 65535
+)
+
+// Point defines the values that will be written to the database.
+type Point interface {
+ // Name return the measurement name for the point.
+ Name() string
+
+ // SetName updates the measurement name for the point.
+ SetName(string)
+
+ // Tags returns the tag set for the point.
+ Tags() Tags
+
+ // AddTag adds or replaces a tag value for a point.
+ AddTag(key, value string)
+
+ // SetTags replaces the tags for the point.
+ SetTags(tags Tags)
+
+ // Fields returns the fields for the point.
+ Fields() (Fields, error)
+
+ // Time return the timestamp for the point.
+ Time() time.Time
+
+ // SetTime updates the timestamp for the point.
+ SetTime(t time.Time)
+
+ // UnixNano returns the timestamp of the point as nanoseconds since Unix epoch.
+ UnixNano() int64
+
+ // HashID returns a non-cryptographic checksum of the point's key.
+ HashID() uint64
+
+ // Key returns the key (measurement joined with tags) of the point.
+ Key() []byte
+
+ // String returns a string representation of the point. If there is a
+ // timestamp associated with the point then it will be specified with the default
+ // precision of nanoseconds.
+ String() string
+
+ // MarshalBinary returns a binary representation of the point.
+ MarshalBinary() ([]byte, error)
+
+ // PrecisionString returns a string representation of the point. If there
+ // is a timestamp associated with the point then it will be specified in the
+ // given unit.
+ PrecisionString(precision string) string
+
+ // RoundedString returns a string representation of the point. If there
+ // is a timestamp associated with the point, then it will be rounded to the
+ // given duration.
+ RoundedString(d time.Duration) string
+
+ // Split will attempt to return multiple points with the same timestamp whose
+ // string representations are no longer than size. Points with a single field or
+ // a point without a timestamp may exceed the requested size.
+ Split(size int) []Point
+
+ // Round will round the timestamp of the point to the given duration.
+ Round(d time.Duration)
+
+ // StringSize returns the length of the string that would be returned by String().
+ StringSize() int
+
+ // AppendString appends the result of String() to the provided buffer and returns
+ // the result, potentially reducing string allocations.
+ AppendString(buf []byte) []byte
+
+ // FieldIterator retuns a FieldIterator that can be used to traverse the
+ // fields of a point without constructing the in-memory map.
+ FieldIterator() FieldIterator
+}
+
+// FieldType represents the type of a field.
+type FieldType int
+
+const (
+ // Integer indicates the field's type is integer.
+ Integer FieldType = iota
+
+ // Float indicates the field's type is float.
+ Float
+
+ // Boolean indicates the field's type is boolean.
+ Boolean
+
+ // String indicates the field's type is string.
+ String
+
+ // Empty is used to indicate that there is no field.
+ Empty
+)
+
+// FieldIterator provides a low-allocation interface to iterate through a point's fields.
+type FieldIterator interface {
+ // Next indicates whether there any fields remaining.
+ Next() bool
+
+ // FieldKey returns the key of the current field.
+ FieldKey() []byte
+
+ // Type returns the FieldType of the current field.
+ Type() FieldType
+
+ // StringValue returns the string value of the current field.
+ StringValue() string
+
+ // IntegerValue returns the integer value of the current field.
+ IntegerValue() (int64, error)
+
+ // BooleanValue returns the boolean value of the current field.
+ BooleanValue() (bool, error)
+
+ // FloatValue returns the float value of the current field.
+ FloatValue() (float64, error)
+
+ // Delete deletes the current field.
+ Delete()
+
+ // Reset resets the iterator to its initial state.
+ Reset()
+}
+
+// Points represents a sortable list of points by timestamp.
+type Points []Point
+
+// Len implements sort.Interface.
+func (a Points) Len() int { return len(a) }
+
+// Less implements sort.Interface.
+func (a Points) Less(i, j int) bool { return a[i].Time().Before(a[j].Time()) }
+
+// Swap implements sort.Interface.
+func (a Points) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
+
+// point is the default implementation of Point.
+type point struct {
+ time time.Time
+
+ // text encoding of measurement and tags
+ // key must always be stored sorted by tags, if the original line was not sorted,
+ // we need to resort it
+ key []byte
+
+ // text encoding of field data
+ fields []byte
+
+ // text encoding of timestamp
+ ts []byte
+
+ // cached version of parsed fields from data
+ cachedFields map[string]interface{}
+
+ // cached version of parsed name from key
+ cachedName string
+
+ // cached version of parsed tags
+ cachedTags Tags
+
+ it fieldIterator
+}
+
+const (
+ // the number of characters for the largest possible int64 (9223372036854775807)
+ maxInt64Digits = 19
+
+ // the number of characters for the smallest possible int64 (-9223372036854775808)
+ minInt64Digits = 20
+
+ // the number of characters required for the largest float64 before a range check
+ // would occur during parsing
+ maxFloat64Digits = 25
+
+ // the number of characters required for smallest float64 before a range check occur
+ // would occur during parsing
+ minFloat64Digits = 27
+)
+
+// ParsePoints returns a slice of Points from a text representation of a point
+// with each point separated by newlines. If any points fail to parse, a non-nil error
+// will be returned in addition to the points that parsed successfully.
+func ParsePoints(buf []byte) ([]Point, error) {
+ return ParsePointsWithPrecision(buf, time.Now().UTC(), "n")
+}
+
+// ParsePointsString is identical to ParsePoints but accepts a string.
+func ParsePointsString(buf string) ([]Point, error) {
+ return ParsePoints([]byte(buf))
+}
+
+// ParseKey returns the measurement name and tags from a point.
+func ParseKey(buf []byte) (string, Tags, error) {
+ // Ignore the error because scanMeasurement returns "missing fields" which we ignore
+ // when just parsing a key
+ state, i, _ := scanMeasurement(buf, 0)
+
+ var tags Tags
+ if state == tagKeyState {
+ tags = parseTags(buf)
+ // scanMeasurement returns the location of the comma if there are tags, strip that off
+ return string(buf[:i-1]), tags, nil
+ }
+ return string(buf[:i]), tags, nil
+}
+
+// ParsePointsWithPrecision is similar to ParsePoints, but allows the
+// caller to provide a precision for time.
+func ParsePointsWithPrecision(buf []byte, defaultTime time.Time, precision string) ([]Point, error) {
+ points := make([]Point, 0, bytes.Count(buf, []byte{'\n'})+1)
+ var (
+ pos int
+ block []byte
+ failed []string
+ )
+ for pos < len(buf) {
+ pos, block = scanLine(buf, pos)
+ pos++
+
+ if len(block) == 0 {
+ continue
+ }
+
+ // lines which start with '#' are comments
+ start := skipWhitespace(block, 0)
+
+ // If line is all whitespace, just skip it
+ if start >= len(block) {
+ continue
+ }
+
+ if block[start] == '#' {
+ continue
+ }
+
+ // strip the newline if one is present
+ if block[len(block)-1] == '\n' {
+ block = block[:len(block)-1]
+ }
+
+ pt, err := parsePoint(block[start:], defaultTime, precision)
+ if err != nil {
+ failed = append(failed, fmt.Sprintf("unable to parse '%s': %v", string(block[start:len(block)]), err))
+ } else {
+ points = append(points, pt)
+ }
+
+ }
+ if len(failed) > 0 {
+ return points, fmt.Errorf("%s", strings.Join(failed, "\n"))
+ }
+ return points, nil
+
+}
+
+func parsePoint(buf []byte, defaultTime time.Time, precision string) (Point, error) {
+ // scan the first block which is measurement[,tag1=value1,tag2=value=2...]
+ pos, key, err := scanKey(buf, 0)
+ if err != nil {
+ return nil, err
+ }
+
+ // measurement name is required
+ if len(key) == 0 {
+ return nil, fmt.Errorf("missing measurement")
+ }
+
+ if len(key) > MaxKeyLength {
+ return nil, fmt.Errorf("max key length exceeded: %v > %v", len(key), MaxKeyLength)
+ }
+
+ // scan the second block is which is field1=value1[,field2=value2,...]
+ pos, fields, err := scanFields(buf, pos)
+ if err != nil {
+ return nil, err
+ }
+
+ // at least one field is required
+ if len(fields) == 0 {
+ return nil, fmt.Errorf("missing fields")
+ }
+
+ // scan the last block which is an optional integer timestamp
+ pos, ts, err := scanTime(buf, pos)
+ if err != nil {
+ return nil, err
+ }
+
+ pt := &point{
+ key: key,
+ fields: fields,
+ ts: ts,
+ }
+
+ if len(ts) == 0 {
+ pt.time = defaultTime
+ pt.SetPrecision(precision)
+ } else {
+ ts, err := parseIntBytes(ts, 10, 64)
+ if err != nil {
+ return nil, err
+ }
+ pt.time, err = SafeCalcTime(ts, precision)
+ if err != nil {
+ return nil, err
+ }
+
+ // Determine if there are illegal non-whitespace characters after the
+ // timestamp block.
+ for pos < len(buf) {
+ if buf[pos] != ' ' {
+ return nil, ErrInvalidPoint
+ }
+ pos++
+ }
+ }
+ return pt, nil
+}
+
+// GetPrecisionMultiplier will return a multiplier for the precision specified.
+func GetPrecisionMultiplier(precision string) int64 {
+ d := time.Nanosecond
+ switch precision {
+ case "u":
+ d = time.Microsecond
+ case "ms":
+ d = time.Millisecond
+ case "s":
+ d = time.Second
+ case "m":
+ d = time.Minute
+ case "h":
+ d = time.Hour
+ }
+ return int64(d)
+}
+
+// scanKey scans buf starting at i for the measurement and tag portion of the point.
+// It returns the ending position and the byte slice of key within buf. If there
+// are tags, they will be sorted if they are not already.
+func scanKey(buf []byte, i int) (int, []byte, error) {
+ start := skipWhitespace(buf, i)
+
+ i = start
+
+ // Determines whether the tags are sort, assume they are
+ sorted := true
+
+ // indices holds the indexes within buf of the start of each tag. For example,
+ // a buf of 'cpu,host=a,region=b,zone=c' would have indices slice of [4,11,20]
+ // which indicates that the first tag starts at buf[4], seconds at buf[11], and
+ // last at buf[20]
+ indices := make([]int, 100)
+
+ // tracks how many commas we've seen so we know how many values are indices.
+ // Since indices is an arbitrarily large slice,
+ // we need to know how many values in the buffer are in use.
+ commas := 0
+
+ // First scan the Point's measurement.
+ state, i, err := scanMeasurement(buf, i)
+ if err != nil {
+ return i, buf[start:i], err
+ }
+
+ // Optionally scan tags if needed.
+ if state == tagKeyState {
+ i, commas, indices, err = scanTags(buf, i, indices)
+ if err != nil {
+ return i, buf[start:i], err
+ }
+ }
+
+ // Now we know where the key region is within buf, and the location of tags, we
+ // need to determine if duplicate tags exist and if the tags are sorted. This iterates
+ // over the list comparing each tag in the sequence with each other.
+ for j := 0; j < commas-1; j++ {
+ // get the left and right tags
+ _, left := scanTo(buf[indices[j]:indices[j+1]-1], 0, '=')
+ _, right := scanTo(buf[indices[j+1]:indices[j+2]-1], 0, '=')
+
+ // If left is greater than right, the tags are not sorted. We do not have to
+ // continue because the short path no longer works.
+ // If the tags are equal, then there are duplicate tags, and we should abort.
+ // If the tags are not sorted, this pass may not find duplicate tags and we
+ // need to do a more exhaustive search later.
+ if cmp := bytes.Compare(left, right); cmp > 0 {
+ sorted = false
+ break
+ } else if cmp == 0 {
+ return i, buf[start:i], fmt.Errorf("duplicate tags")
+ }
+ }
+
+ // If the tags are not sorted, then sort them. This sort is inline and
+ // uses the tag indices we created earlier. The actual buffer is not sorted, the
+ // indices are using the buffer for value comparison. After the indices are sorted,
+ // the buffer is reconstructed from the sorted indices.
+ if !sorted && commas > 0 {
+ // Get the measurement name for later
+ measurement := buf[start : indices[0]-1]
+
+ // Sort the indices
+ indices := indices[:commas]
+ insertionSort(0, commas, buf, indices)
+
+ // Create a new key using the measurement and sorted indices
+ b := make([]byte, len(buf[start:i]))
+ pos := copy(b, measurement)
+ for _, i := range indices {
+ b[pos] = ','
+ pos++
+ _, v := scanToSpaceOr(buf, i, ',')
+ pos += copy(b[pos:], v)
+ }
+
+ // Check again for duplicate tags now that the tags are sorted.
+ for j := 0; j < commas-1; j++ {
+ // get the left and right tags
+ _, left := scanTo(buf[indices[j]:], 0, '=')
+ _, right := scanTo(buf[indices[j+1]:], 0, '=')
+
+ // If the tags are equal, then there are duplicate tags, and we should abort.
+ // If the tags are not sorted, this pass may not find duplicate tags and we
+ // need to do a more exhaustive search later.
+ if bytes.Equal(left, right) {
+ return i, b, fmt.Errorf("duplicate tags")
+ }
+ }
+
+ return i, b, nil
+ }
+
+ return i, buf[start:i], nil
+}
+
+// The following constants allow us to specify which state to move to
+// next, when scanning sections of a Point.
+const (
+ tagKeyState = iota
+ tagValueState
+ fieldsState
+)
+
+// scanMeasurement examines the measurement part of a Point, returning
+// the next state to move to, and the current location in the buffer.
+func scanMeasurement(buf []byte, i int) (int, int, error) {
+ // Check first byte of measurement, anything except a comma is fine.
+ // It can't be a space, since whitespace is stripped prior to this
+ // function call.
+ if i >= len(buf) || buf[i] == ',' {
+ return -1, i, fmt.Errorf("missing measurement")
+ }
+
+ for {
+ i++
+ if i >= len(buf) {
+ // cpu
+ return -1, i, fmt.Errorf("missing fields")
+ }
+
+ if buf[i-1] == '\\' {
+ // Skip character (it's escaped).
+ continue
+ }
+
+ // Unescaped comma; move onto scanning the tags.
+ if buf[i] == ',' {
+ return tagKeyState, i + 1, nil
+ }
+
+ // Unescaped space; move onto scanning the fields.
+ if buf[i] == ' ' {
+ // cpu value=1.0
+ return fieldsState, i, nil
+ }
+ }
+}
+
+// scanTags examines all the tags in a Point, keeping track of and
+// returning the updated indices slice, number of commas and location
+// in buf where to start examining the Point fields.
+func scanTags(buf []byte, i int, indices []int) (int, int, []int, error) {
+ var (
+ err error
+ commas int
+ state = tagKeyState
+ )
+
+ for {
+ switch state {
+ case tagKeyState:
+ // Grow our indices slice if we have too many tags.
+ if commas >= len(indices) {
+ newIndics := make([]int, cap(indices)*2)
+ copy(newIndics, indices)
+ indices = newIndics
+ }
+ indices[commas] = i
+ commas++
+
+ i, err = scanTagsKey(buf, i)
+ state = tagValueState // tag value always follows a tag key
+ case tagValueState:
+ state, i, err = scanTagsValue(buf, i)
+ case fieldsState:
+ indices[commas] = i + 1
+ return i, commas, indices, nil
+ }
+
+ if err != nil {
+ return i, commas, indices, err
+ }
+ }
+}
+
+// scanTagsKey scans each character in a tag key.
+func scanTagsKey(buf []byte, i int) (int, error) {
+ // First character of the key.
+ if i >= len(buf) || buf[i] == ' ' || buf[i] == ',' || buf[i] == '=' {
+ // cpu,{'', ' ', ',', '='}
+ return i, fmt.Errorf("missing tag key")
+ }
+
+ // Examine each character in the tag key until we hit an unescaped
+ // equals (the tag value), or we hit an error (i.e., unescaped
+ // space or comma).
+ for {
+ i++
+
+ // Either we reached the end of the buffer or we hit an
+ // unescaped comma or space.
+ if i >= len(buf) ||
+ ((buf[i] == ' ' || buf[i] == ',') && buf[i-1] != '\\') {
+ // cpu,tag{'', ' ', ','}
+ return i, fmt.Errorf("missing tag value")
+ }
+
+ if buf[i] == '=' && buf[i-1] != '\\' {
+ // cpu,tag=
+ return i + 1, nil
+ }
+ }
+}
+
+// scanTagsValue scans each character in a tag value.
+func scanTagsValue(buf []byte, i int) (int, int, error) {
+ // Tag value cannot be empty.
+ if i >= len(buf) || buf[i] == ',' || buf[i] == ' ' {
+ // cpu,tag={',', ' '}
+ return -1, i, fmt.Errorf("missing tag value")
+ }
+
+ // Examine each character in the tag value until we hit an unescaped
+ // comma (move onto next tag key), an unescaped space (move onto
+ // fields), or we error out.
+ for {
+ i++
+ if i >= len(buf) {
+ // cpu,tag=value
+ return -1, i, fmt.Errorf("missing fields")
+ }
+
+ // An unescaped equals sign is an invalid tag value.
+ if buf[i] == '=' && buf[i-1] != '\\' {
+ // cpu,tag={'=', 'fo=o'}
+ return -1, i, fmt.Errorf("invalid tag format")
+ }
+
+ if buf[i] == ',' && buf[i-1] != '\\' {
+ // cpu,tag=foo,
+ return tagKeyState, i + 1, nil
+ }
+
+ // cpu,tag=foo value=1.0
+ // cpu, tag=foo\= value=1.0
+ if buf[i] == ' ' && buf[i-1] != '\\' {
+ return fieldsState, i, nil
+ }
+ }
+}
+
+func insertionSort(l, r int, buf []byte, indices []int) {
+ for i := l + 1; i < r; i++ {
+ for j := i; j > l && less(buf, indices, j, j-1); j-- {
+ indices[j], indices[j-1] = indices[j-1], indices[j]
+ }
+ }
+}
+
+func less(buf []byte, indices []int, i, j int) bool {
+ // This grabs the tag names for i & j, it ignores the values
+ _, a := scanTo(buf, indices[i], '=')
+ _, b := scanTo(buf, indices[j], '=')
+ return bytes.Compare(a, b) < 0
+}
+
+// scanFields scans buf, starting at i for the fields section of a point. It returns
+// the ending position and the byte slice of the fields within buf.
+func scanFields(buf []byte, i int) (int, []byte, error) {
+ start := skipWhitespace(buf, i)
+ i = start
+ quoted := false
+
+ // tracks how many '=' we've seen
+ equals := 0
+
+ // tracks how many commas we've seen
+ commas := 0
+
+ for {
+ // reached the end of buf?
+ if i >= len(buf) {
+ break
+ }
+
+ // escaped characters?
+ if buf[i] == '\\' && i+1 < len(buf) {
+ i += 2
+ continue
+ }
+
+ // If the value is quoted, scan until we get to the end quote
+ // Only quote values in the field value since quotes are not significant
+ // in the field key
+ if buf[i] == '"' && equals > commas {
+ quoted = !quoted
+ i++
+ continue
+ }
+
+ // If we see an =, ensure that there is at least on char before and after it
+ if buf[i] == '=' && !quoted {
+ equals++
+
+ // check for "... =123" but allow "a\ =123"
+ if buf[i-1] == ' ' && buf[i-2] != '\\' {
+ return i, buf[start:i], fmt.Errorf("missing field key")
+ }
+
+ // check for "...a=123,=456" but allow "a=123,a\,=456"
+ if buf[i-1] == ',' && buf[i-2] != '\\' {
+ return i, buf[start:i], fmt.Errorf("missing field key")
+ }
+
+ // check for "... value="
+ if i+1 >= len(buf) {
+ return i, buf[start:i], fmt.Errorf("missing field value")
+ }
+
+ // check for "... value=,value2=..."
+ if buf[i+1] == ',' || buf[i+1] == ' ' {
+ return i, buf[start:i], fmt.Errorf("missing field value")
+ }
+
+ if isNumeric(buf[i+1]) || buf[i+1] == '-' || buf[i+1] == 'N' || buf[i+1] == 'n' {
+ var err error
+ i, err = scanNumber(buf, i+1)
+ if err != nil {
+ return i, buf[start:i], err
+ }
+ continue
+ }
+ // If next byte is not a double-quote, the value must be a boolean
+ if buf[i+1] != '"' {
+ var err error
+ i, _, err = scanBoolean(buf, i+1)
+ if err != nil {
+ return i, buf[start:i], err
+ }
+ continue
+ }
+ }
+
+ if buf[i] == ',' && !quoted {
+ commas++
+ }
+
+ // reached end of block?
+ if buf[i] == ' ' && !quoted {
+ break
+ }
+ i++
+ }
+
+ if quoted {
+ return i, buf[start:i], fmt.Errorf("unbalanced quotes")
+ }
+
+ // check that all field sections had key and values (e.g. prevent "a=1,b"
+ if equals == 0 || commas != equals-1 {
+ return i, buf[start:i], fmt.Errorf("invalid field format")
+ }
+
+ return i, buf[start:i], nil
+}
+
+// scanTime scans buf, starting at i for the time section of a point. It
+// returns the ending position and the byte slice of the timestamp within buf
+// and and error if the timestamp is not in the correct numeric format.
+func scanTime(buf []byte, i int) (int, []byte, error) {
+ start := skipWhitespace(buf, i)
+ i = start
+
+ for {
+ // reached the end of buf?
+ if i >= len(buf) {
+ break
+ }
+
+ // Reached end of block or trailing whitespace?
+ if buf[i] == '\n' || buf[i] == ' ' {
+ break
+ }
+
+ // Handle negative timestamps
+ if i == start && buf[i] == '-' {
+ i++
+ continue
+ }
+
+ // Timestamps should be integers, make sure they are so we don't need
+ // to actually parse the timestamp until needed.
+ if buf[i] < '0' || buf[i] > '9' {
+ return i, buf[start:i], fmt.Errorf("bad timestamp")
+ }
+ i++
+ }
+ return i, buf[start:i], nil
+}
+
+func isNumeric(b byte) bool {
+ return (b >= '0' && b <= '9') || b == '.'
+}
+
+// scanNumber returns the end position within buf, start at i after
+// scanning over buf for an integer, or float. It returns an
+// error if a invalid number is scanned.
+func scanNumber(buf []byte, i int) (int, error) {
+ start := i
+ var isInt bool
+
+ // Is negative number?
+ if i < len(buf) && buf[i] == '-' {
+ i++
+ // There must be more characters now, as just '-' is illegal.
+ if i == len(buf) {
+ return i, ErrInvalidNumber
+ }
+ }
+
+ // how many decimal points we've see
+ decimal := false
+
+ // indicates the number is float in scientific notation
+ scientific := false
+
+ for {
+ if i >= len(buf) {
+ break
+ }
+
+ if buf[i] == ',' || buf[i] == ' ' {
+ break
+ }
+
+ if buf[i] == 'i' && i > start && !isInt {
+ isInt = true
+ i++
+ continue
+ }
+
+ if buf[i] == '.' {
+ // Can't have more than 1 decimal (e.g. 1.1.1 should fail)
+ if decimal {
+ return i, ErrInvalidNumber
+ }
+ decimal = true
+ }
+
+ // `e` is valid for floats but not as the first char
+ if i > start && (buf[i] == 'e' || buf[i] == 'E') {
+ scientific = true
+ i++
+ continue
+ }
+
+ // + and - are only valid at this point if they follow an e (scientific notation)
+ if (buf[i] == '+' || buf[i] == '-') && (buf[i-1] == 'e' || buf[i-1] == 'E') {
+ i++
+ continue
+ }
+
+ // NaN is an unsupported value
+ if i+2 < len(buf) && (buf[i] == 'N' || buf[i] == 'n') {
+ return i, ErrInvalidNumber
+ }
+
+ if !isNumeric(buf[i]) {
+ return i, ErrInvalidNumber
+ }
+ i++
+ }
+
+ if isInt && (decimal || scientific) {
+ return i, ErrInvalidNumber
+ }
+
+ numericDigits := i - start
+ if isInt {
+ numericDigits--
+ }
+ if decimal {
+ numericDigits--
+ }
+ if buf[start] == '-' {
+ numericDigits--
+ }
+
+ if numericDigits == 0 {
+ return i, ErrInvalidNumber
+ }
+
+ // It's more common that numbers will be within min/max range for their type but we need to prevent
+ // out or range numbers from being parsed successfully. This uses some simple heuristics to decide
+ // if we should parse the number to the actual type. It does not do it all the time because it incurs
+ // extra allocations and we end up converting the type again when writing points to disk.
+ if isInt {
+ // Make sure the last char is an 'i' for integers (e.g. 9i10 is not valid)
+ if buf[i-1] != 'i' {
+ return i, ErrInvalidNumber
+ }
+ // Parse the int to check bounds the number of digits could be larger than the max range
+ // We subtract 1 from the index to remove the `i` from our tests
+ if len(buf[start:i-1]) >= maxInt64Digits || len(buf[start:i-1]) >= minInt64Digits {
+ if _, err := parseIntBytes(buf[start:i-1], 10, 64); err != nil {
+ return i, fmt.Errorf("unable to parse integer %s: %s", buf[start:i-1], err)
+ }
+ }
+ } else {
+ // Parse the float to check bounds if it's scientific or the number of digits could be larger than the max range
+ if scientific || len(buf[start:i]) >= maxFloat64Digits || len(buf[start:i]) >= minFloat64Digits {
+ if _, err := parseFloatBytes(buf[start:i], 10); err != nil {
+ return i, fmt.Errorf("invalid float")
+ }
+ }
+ }
+
+ return i, nil
+}
+
+// scanBoolean returns the end position within buf, start at i after
+// scanning over buf for boolean. Valid values for a boolean are
+// t, T, true, TRUE, f, F, false, FALSE. It returns an error if a invalid boolean
+// is scanned.
+func scanBoolean(buf []byte, i int) (int, []byte, error) {
+ start := i
+
+ if i < len(buf) && (buf[i] != 't' && buf[i] != 'f' && buf[i] != 'T' && buf[i] != 'F') {
+ return i, buf[start:i], fmt.Errorf("invalid boolean")
+ }
+
+ i++
+ for {
+ if i >= len(buf) {
+ break
+ }
+
+ if buf[i] == ',' || buf[i] == ' ' {
+ break
+ }
+ i++
+ }
+
+ // Single char bool (t, T, f, F) is ok
+ if i-start == 1 {
+ return i, buf[start:i], nil
+ }
+
+ // length must be 4 for true or TRUE
+ if (buf[start] == 't' || buf[start] == 'T') && i-start != 4 {
+ return i, buf[start:i], fmt.Errorf("invalid boolean")
+ }
+
+ // length must be 5 for false or FALSE
+ if (buf[start] == 'f' || buf[start] == 'F') && i-start != 5 {
+ return i, buf[start:i], fmt.Errorf("invalid boolean")
+ }
+
+ // Otherwise
+ valid := false
+ switch buf[start] {
+ case 't':
+ valid = bytes.Equal(buf[start:i], []byte("true"))
+ case 'f':
+ valid = bytes.Equal(buf[start:i], []byte("false"))
+ case 'T':
+ valid = bytes.Equal(buf[start:i], []byte("TRUE")) || bytes.Equal(buf[start:i], []byte("True"))
+ case 'F':
+ valid = bytes.Equal(buf[start:i], []byte("FALSE")) || bytes.Equal(buf[start:i], []byte("False"))
+ }
+
+ if !valid {
+ return i, buf[start:i], fmt.Errorf("invalid boolean")
+ }
+
+ return i, buf[start:i], nil
+
+}
+
+// skipWhitespace returns the end position within buf, starting at i after
+// scanning over spaces in tags.
+func skipWhitespace(buf []byte, i int) int {
+ for i < len(buf) {
+ if buf[i] != ' ' && buf[i] != '\t' && buf[i] != 0 {
+ break
+ }
+ i++
+ }
+ return i
+}
+
+// scanLine returns the end position in buf and the next line found within
+// buf.
+func scanLine(buf []byte, i int) (int, []byte) {
+ start := i
+ quoted := false
+ fields := false
+
+ // tracks how many '=' and commas we've seen
+ // this duplicates some of the functionality in scanFields
+ equals := 0
+ commas := 0
+ for {
+ // reached the end of buf?
+ if i >= len(buf) {
+ break
+ }
+
+ // skip past escaped characters
+ if buf[i] == '\\' {
+ i += 2
+ continue
+ }
+
+ if buf[i] == ' ' {
+ fields = true
+ }
+
+ // If we see a double quote, makes sure it is not escaped
+ if fields {
+ if !quoted && buf[i] == '=' {
+ i++
+ equals++
+ continue
+ } else if !quoted && buf[i] == ',' {
+ i++
+ commas++
+ continue
+ } else if buf[i] == '"' && equals > commas {
+ i++
+ quoted = !quoted
+ continue
+ }
+ }
+
+ if buf[i] == '\n' && !quoted {
+ break
+ }
+
+ i++
+ }
+
+ return i, buf[start:i]
+}
+
+// scanTo returns the end position in buf and the next consecutive block
+// of bytes, starting from i and ending with stop byte, where stop byte
+// has not been escaped.
+//
+// If there are leading spaces, they are skipped.
+func scanTo(buf []byte, i int, stop byte) (int, []byte) {
+ start := i
+ for {
+ // reached the end of buf?
+ if i >= len(buf) {
+ break
+ }
+
+ // Reached unescaped stop value?
+ if buf[i] == stop && (i == 0 || buf[i-1] != '\\') {
+ break
+ }
+ i++
+ }
+
+ return i, buf[start:i]
+}
+
+// scanTo returns the end position in buf and the next consecutive block
+// of bytes, starting from i and ending with stop byte. If there are leading
+// spaces, they are skipped.
+func scanToSpaceOr(buf []byte, i int, stop byte) (int, []byte) {
+ start := i
+ if buf[i] == stop || buf[i] == ' ' {
+ return i, buf[start:i]
+ }
+
+ for {
+ i++
+ if buf[i-1] == '\\' {
+ continue
+ }
+
+ // reached the end of buf?
+ if i >= len(buf) {
+ return i, buf[start:i]
+ }
+
+ // reached end of block?
+ if buf[i] == stop || buf[i] == ' ' {
+ return i, buf[start:i]
+ }
+ }
+}
+
+func scanTagValue(buf []byte, i int) (int, []byte) {
+ start := i
+ for {
+ if i >= len(buf) {
+ break
+ }
+
+ if buf[i] == ',' && buf[i-1] != '\\' {
+ break
+ }
+ i++
+ }
+ if i > len(buf) {
+ return i, nil
+ }
+ return i, buf[start:i]
+}
+
+func scanFieldValue(buf []byte, i int) (int, []byte) {
+ start := i
+ quoted := false
+ for i < len(buf) {
+ // Only escape char for a field value is a double-quote and backslash
+ if buf[i] == '\\' && i+1 < len(buf) && (buf[i+1] == '"' || buf[i+1] == '\\') {
+ i += 2
+ continue
+ }
+
+ // Quoted value? (e.g. string)
+ if buf[i] == '"' {
+ i++
+ quoted = !quoted
+ continue
+ }
+
+ if buf[i] == ',' && !quoted {
+ break
+ }
+ i++
+ }
+ return i, buf[start:i]
+}
+
+func escapeMeasurement(in []byte) []byte {
+ for b, esc := range measurementEscapeCodes {
+ in = bytes.Replace(in, []byte{b}, esc, -1)
+ }
+ return in
+}
+
+func unescapeMeasurement(in []byte) []byte {
+ for b, esc := range measurementEscapeCodes {
+ in = bytes.Replace(in, esc, []byte{b}, -1)
+ }
+ return in
+}
+
+func escapeTag(in []byte) []byte {
+ for b, esc := range tagEscapeCodes {
+ if bytes.IndexByte(in, b) != -1 {
+ in = bytes.Replace(in, []byte{b}, esc, -1)
+ }
+ }
+ return in
+}
+
+func unescapeTag(in []byte) []byte {
+ if bytes.IndexByte(in, '\\') == -1 {
+ return in
+ }
+
+ for b, esc := range tagEscapeCodes {
+ if bytes.IndexByte(in, b) != -1 {
+ in = bytes.Replace(in, esc, []byte{b}, -1)
+ }
+ }
+ return in
+}
+
+// escapeStringFieldReplacer replaces double quotes and backslashes
+// with the same character preceded by a backslash.
+// As of Go 1.7 this benchmarked better in allocations and CPU time
+// compared to iterating through a string byte-by-byte and appending to a new byte slice,
+// calling strings.Replace twice, and better than (*Regex).ReplaceAllString.
+var escapeStringFieldReplacer = strings.NewReplacer(`"`, `\"`, `\`, `\\`)
+
+// EscapeStringField returns a copy of in with any double quotes or
+// backslashes with escaped values.
+func EscapeStringField(in string) string {
+ return escapeStringFieldReplacer.Replace(in)
+}
+
+// unescapeStringField returns a copy of in with any escaped double-quotes
+// or backslashes unescaped.
+func unescapeStringField(in string) string {
+ if strings.IndexByte(in, '\\') == -1 {
+ return in
+ }
+
+ var out []byte
+ i := 0
+ for {
+ if i >= len(in) {
+ break
+ }
+ // unescape backslashes
+ if in[i] == '\\' && i+1 < len(in) && in[i+1] == '\\' {
+ out = append(out, '\\')
+ i += 2
+ continue
+ }
+ // unescape double-quotes
+ if in[i] == '\\' && i+1 < len(in) && in[i+1] == '"' {
+ out = append(out, '"')
+ i += 2
+ continue
+ }
+ out = append(out, in[i])
+ i++
+
+ }
+ return string(out)
+}
+
+// NewPoint returns a new point with the given measurement name, tags, fields and timestamp. If
+// an unsupported field value (NaN) or out of range time is passed, this function returns an error.
+func NewPoint(name string, tags Tags, fields Fields, t time.Time) (Point, error) {
+ key, err := pointKey(name, tags, fields, t)
+ if err != nil {
+ return nil, err
+ }
+
+ return &point{
+ key: key,
+ time: t,
+ fields: fields.MarshalBinary(),
+ }, nil
+}
+
+// pointKey checks some basic requirements for valid points, and returns the
+// key, along with an possible error.
+func pointKey(measurement string, tags Tags, fields Fields, t time.Time) ([]byte, error) {
+ if len(fields) == 0 {
+ return nil, ErrPointMustHaveAField
+ }
+
+ if !t.IsZero() {
+ if err := CheckTime(t); err != nil {
+ return nil, err
+ }
+ }
+
+ for key, value := range fields {
+ switch value := value.(type) {
+ case float64:
+ // Ensure the caller validates and handles invalid field values
+ if math.IsNaN(value) {
+ return nil, fmt.Errorf("NaN is an unsupported value for field %s", key)
+ }
+ case float32:
+ // Ensure the caller validates and handles invalid field values
+ if math.IsNaN(float64(value)) {
+ return nil, fmt.Errorf("NaN is an unsupported value for field %s", key)
+ }
+ }
+ if len(key) == 0 {
+ return nil, fmt.Errorf("all fields must have non-empty names")
+ }
+ }
+
+ key := MakeKey([]byte(measurement), tags)
+ if len(key) > MaxKeyLength {
+ return nil, fmt.Errorf("max key length exceeded: %v > %v", len(key), MaxKeyLength)
+ }
+
+ return key, nil
+}
+
+// NewPointFromBytes returns a new Point from a marshalled Point.
+func NewPointFromBytes(b []byte) (Point, error) {
+ p := &point{}
+ if err := p.UnmarshalBinary(b); err != nil {
+ return nil, err
+ }
+ fields, err := p.Fields()
+ if err != nil {
+ return nil, err
+ }
+ if len(fields) == 0 {
+ return nil, ErrPointMustHaveAField
+ }
+ return p, nil
+}
+
+// MustNewPoint returns a new point with the given measurement name, tags, fields and timestamp. If
+// an unsupported field value (NaN) is passed, this function panics.
+func MustNewPoint(name string, tags Tags, fields Fields, time time.Time) Point {
+ pt, err := NewPoint(name, tags, fields, time)
+ if err != nil {
+ panic(err.Error())
+ }
+ return pt
+}
+
+// Key returns the key (measurement joined with tags) of the point.
+func (p *point) Key() []byte {
+ return p.key
+}
+
+func (p *point) name() []byte {
+ _, name := scanTo(p.key, 0, ',')
+ return name
+}
+
+// Name return the measurement name for the point.
+func (p *point) Name() string {
+ if p.cachedName != "" {
+ return p.cachedName
+ }
+ p.cachedName = string(escape.Unescape(p.name()))
+ return p.cachedName
+}
+
+// SetName updates the measurement name for the point.
+func (p *point) SetName(name string) {
+ p.cachedName = ""
+ p.key = MakeKey([]byte(name), p.Tags())
+}
+
+// Time return the timestamp for the point.
+func (p *point) Time() time.Time {
+ return p.time
+}
+
+// SetTime updates the timestamp for the point.
+func (p *point) SetTime(t time.Time) {
+ p.time = t
+}
+
+// Round will round the timestamp of the point to the given duration.
+func (p *point) Round(d time.Duration) {
+ p.time = p.time.Round(d)
+}
+
+// Tags returns the tag set for the point.
+func (p *point) Tags() Tags {
+ if p.cachedTags != nil {
+ return p.cachedTags
+ }
+ p.cachedTags = parseTags(p.key)
+ return p.cachedTags
+}
+
+func parseTags(buf []byte) Tags {
+ if len(buf) == 0 {
+ return nil
+ }
+
+ pos, name := scanTo(buf, 0, ',')
+
+ // it's an empty key, so there are no tags
+ if len(name) == 0 {
+ return nil
+ }
+
+ tags := make(Tags, 0, bytes.Count(buf, []byte(",")))
+ hasEscape := bytes.IndexByte(buf, '\\') != -1
+
+ i := pos + 1
+ var key, value []byte
+ for {
+ if i >= len(buf) {
+ break
+ }
+ i, key = scanTo(buf, i, '=')
+ i, value = scanTagValue(buf, i+1)
+
+ if len(value) == 0 {
+ continue
+ }
+
+ if hasEscape {
+ tags = append(tags, Tag{Key: unescapeTag(key), Value: unescapeTag(value)})
+ } else {
+ tags = append(tags, Tag{Key: key, Value: value})
+ }
+
+ i++
+ }
+
+ return tags
+}
+
+// MakeKey creates a key for a set of tags.
+func MakeKey(name []byte, tags Tags) []byte {
+ // unescape the name and then re-escape it to avoid double escaping.
+ // The key should always be stored in escaped form.
+ return append(escapeMeasurement(unescapeMeasurement(name)), tags.HashKey()...)
+}
+
+// SetTags replaces the tags for the point.
+func (p *point) SetTags(tags Tags) {
+ p.key = MakeKey([]byte(p.Name()), tags)
+ p.cachedTags = tags
+}
+
+// AddTag adds or replaces a tag value for a point.
+func (p *point) AddTag(key, value string) {
+ tags := p.Tags()
+ tags = append(tags, Tag{Key: []byte(key), Value: []byte(value)})
+ sort.Sort(tags)
+ p.cachedTags = tags
+ p.key = MakeKey([]byte(p.Name()), tags)
+}
+
+// Fields returns the fields for the point.
+func (p *point) Fields() (Fields, error) {
+ if p.cachedFields != nil {
+ return p.cachedFields, nil
+ }
+ cf, err := p.unmarshalBinary()
+ if err != nil {
+ return nil, err
+ }
+ p.cachedFields = cf
+ return p.cachedFields, nil
+}
+
+// SetPrecision will round a time to the specified precision.
+func (p *point) SetPrecision(precision string) {
+ switch precision {
+ case "n":
+ case "u":
+ p.SetTime(p.Time().Truncate(time.Microsecond))
+ case "ms":
+ p.SetTime(p.Time().Truncate(time.Millisecond))
+ case "s":
+ p.SetTime(p.Time().Truncate(time.Second))
+ case "m":
+ p.SetTime(p.Time().Truncate(time.Minute))
+ case "h":
+ p.SetTime(p.Time().Truncate(time.Hour))
+ }
+}
+
+// String returns the string representation of the point.
+func (p *point) String() string {
+ if p.Time().IsZero() {
+ return string(p.Key()) + " " + string(p.fields)
+ }
+ return string(p.Key()) + " " + string(p.fields) + " " + strconv.FormatInt(p.UnixNano(), 10)
+}
+
+// AppendString appends the string representation of the point to buf.
+func (p *point) AppendString(buf []byte) []byte {
+ buf = append(buf, p.key...)
+ buf = append(buf, ' ')
+ buf = append(buf, p.fields...)
+
+ if !p.time.IsZero() {
+ buf = append(buf, ' ')
+ buf = strconv.AppendInt(buf, p.UnixNano(), 10)
+ }
+
+ return buf
+}
+
+// StringSize returns the length of the string that would be returned by String().
+func (p *point) StringSize() int {
+ size := len(p.key) + len(p.fields) + 1
+
+ if !p.time.IsZero() {
+ digits := 1 // even "0" has one digit
+ t := p.UnixNano()
+ if t < 0 {
+ // account for negative sign, then negate
+ digits++
+ t = -t
+ }
+ for t > 9 { // already accounted for one digit
+ digits++
+ t /= 10
+ }
+ size += digits + 1 // digits and a space
+ }
+
+ return size
+}
+
+// MarshalBinary returns a binary representation of the point.
+func (p *point) MarshalBinary() ([]byte, error) {
+ if len(p.fields) == 0 {
+ return nil, ErrPointMustHaveAField
+ }
+
+ tb, err := p.time.MarshalBinary()
+ if err != nil {
+ return nil, err
+ }
+
+ b := make([]byte, 8+len(p.key)+len(p.fields)+len(tb))
+ i := 0
+
+ binary.BigEndian.PutUint32(b[i:], uint32(len(p.key)))
+ i += 4
+
+ i += copy(b[i:], p.key)
+
+ binary.BigEndian.PutUint32(b[i:i+4], uint32(len(p.fields)))
+ i += 4
+
+ i += copy(b[i:], p.fields)
+
+ copy(b[i:], tb)
+ return b, nil
+}
+
+// UnmarshalBinary decodes a binary representation of the point into a point struct.
+func (p *point) UnmarshalBinary(b []byte) error {
+ var i int
+ keyLen := int(binary.BigEndian.Uint32(b[:4]))
+ i += int(4)
+
+ p.key = b[i : i+keyLen]
+ i += keyLen
+
+ fieldLen := int(binary.BigEndian.Uint32(b[i : i+4]))
+ i += int(4)
+
+ p.fields = b[i : i+fieldLen]
+ i += fieldLen
+
+ p.time = time.Now()
+ p.time.UnmarshalBinary(b[i:])
+ return nil
+}
+
+// PrecisionString returns a string representation of the point. If there
+// is a timestamp associated with the point then it will be specified in the
+// given unit.
+func (p *point) PrecisionString(precision string) string {
+ if p.Time().IsZero() {
+ return fmt.Sprintf("%s %s", p.Key(), string(p.fields))
+ }
+ return fmt.Sprintf("%s %s %d", p.Key(), string(p.fields),
+ p.UnixNano()/GetPrecisionMultiplier(precision))
+}
+
+// RoundedString returns a string representation of the point. If there
+// is a timestamp associated with the point, then it will be rounded to the
+// given duration.
+func (p *point) RoundedString(d time.Duration) string {
+ if p.Time().IsZero() {
+ return fmt.Sprintf("%s %s", p.Key(), string(p.fields))
+ }
+ return fmt.Sprintf("%s %s %d", p.Key(), string(p.fields),
+ p.time.Round(d).UnixNano())
+}
+
+func (p *point) unmarshalBinary() (Fields, error) {
+ iter := p.FieldIterator()
+ fields := make(Fields, 8)
+ for iter.Next() {
+ if len(iter.FieldKey()) == 0 {
+ continue
+ }
+ switch iter.Type() {
+ case Float:
+ v, err := iter.FloatValue()
+ if err != nil {
+ return nil, fmt.Errorf("unable to unmarshal field %s: %s", string(iter.FieldKey()), err)
+ }
+ fields[string(iter.FieldKey())] = v
+ case Integer:
+ v, err := iter.IntegerValue()
+ if err != nil {
+ return nil, fmt.Errorf("unable to unmarshal field %s: %s", string(iter.FieldKey()), err)
+ }
+ fields[string(iter.FieldKey())] = v
+ case String:
+ fields[string(iter.FieldKey())] = iter.StringValue()
+ case Boolean:
+ v, err := iter.BooleanValue()
+ if err != nil {
+ return nil, fmt.Errorf("unable to unmarshal field %s: %s", string(iter.FieldKey()), err)
+ }
+ fields[string(iter.FieldKey())] = v
+ }
+ }
+ return fields, nil
+}
+
+// HashID returns a non-cryptographic checksum of the point's key.
+func (p *point) HashID() uint64 {
+ h := NewInlineFNV64a()
+ h.Write(p.key)
+ sum := h.Sum64()
+ return sum
+}
+
+// UnixNano returns the timestamp of the point as nanoseconds since Unix epoch.
+func (p *point) UnixNano() int64 {
+ return p.Time().UnixNano()
+}
+
+// Split will attempt to return multiple points with the same timestamp whose
+// string representations are no longer than size. Points with a single field or
+// a point without a timestamp may exceed the requested size.
+func (p *point) Split(size int) []Point {
+ if p.time.IsZero() || len(p.String()) <= size {
+ return []Point{p}
+ }
+
+ // key string, timestamp string, spaces
+ size -= len(p.key) + len(strconv.FormatInt(p.time.UnixNano(), 10)) + 2
+
+ var points []Point
+ var start, cur int
+
+ for cur < len(p.fields) {
+ end, _ := scanTo(p.fields, cur, '=')
+ end, _ = scanFieldValue(p.fields, end+1)
+
+ if cur > start && end-start > size {
+ points = append(points, &point{
+ key: p.key,
+ time: p.time,
+ fields: p.fields[start : cur-1],
+ })
+ start = cur
+ }
+
+ cur = end + 1
+ }
+
+ points = append(points, &point{
+ key: p.key,
+ time: p.time,
+ fields: p.fields[start:],
+ })
+
+ return points
+}
+
+// Tag represents a single key/value tag pair.
+type Tag struct {
+ Key []byte
+ Value []byte
+}
+
+// Tags represents a sorted list of tags.
+type Tags []Tag
+
+// NewTags returns a new Tags from a map.
+func NewTags(m map[string]string) Tags {
+ if len(m) == 0 {
+ return nil
+ }
+ a := make(Tags, 0, len(m))
+ for k, v := range m {
+ a = append(a, Tag{Key: []byte(k), Value: []byte(v)})
+ }
+ sort.Sort(a)
+ return a
+}
+
+// Len implements sort.Interface.
+func (a Tags) Len() int { return len(a) }
+
+// Less implements sort.Interface.
+func (a Tags) Less(i, j int) bool { return bytes.Compare(a[i].Key, a[j].Key) == -1 }
+
+// Swap implements sort.Interface.
+func (a Tags) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
+
+// Get returns the value for a key.
+func (a Tags) Get(key []byte) []byte {
+ // OPTIMIZE: Use sort.Search if tagset is large.
+
+ for _, t := range a {
+ if bytes.Equal(t.Key, key) {
+ return t.Value
+ }
+ }
+ return nil
+}
+
+// GetString returns the string value for a string key.
+func (a Tags) GetString(key string) string {
+ return string(a.Get([]byte(key)))
+}
+
+// Set sets the value for a key.
+func (a *Tags) Set(key, value []byte) {
+ for _, t := range *a {
+ if bytes.Equal(t.Key, key) {
+ t.Value = value
+ return
+ }
+ }
+ *a = append(*a, Tag{Key: key, Value: value})
+ sort.Sort(*a)
+}
+
+// SetString sets the string value for a string key.
+func (a *Tags) SetString(key, value string) {
+ a.Set([]byte(key), []byte(value))
+}
+
+// Delete removes a tag by key.
+func (a *Tags) Delete(key []byte) {
+ for i, t := range *a {
+ if bytes.Equal(t.Key, key) {
+ copy((*a)[i:], (*a)[i+1:])
+ (*a)[len(*a)-1] = Tag{}
+ *a = (*a)[:len(*a)-1]
+ return
+ }
+ }
+}
+
+// Map returns a map representation of the tags.
+func (a Tags) Map() map[string]string {
+ m := make(map[string]string, len(a))
+ for _, t := range a {
+ m[string(t.Key)] = string(t.Value)
+ }
+ return m
+}
+
+// Merge merges the tags combining the two. If both define a tag with the
+// same key, the merged value overwrites the old value.
+// A new map is returned.
+func (a Tags) Merge(other map[string]string) Tags {
+ merged := make(map[string]string, len(a)+len(other))
+ for _, t := range a {
+ merged[string(t.Key)] = string(t.Value)
+ }
+ for k, v := range other {
+ merged[k] = v
+ }
+ return NewTags(merged)
+}
+
+// HashKey hashes all of a tag's keys.
+func (a Tags) HashKey() []byte {
+ // Empty maps marshal to empty bytes.
+ if len(a) == 0 {
+ return nil
+ }
+
+ escaped := make(Tags, 0, len(a))
+ for _, t := range a {
+ ek := escapeTag(t.Key)
+ ev := escapeTag(t.Value)
+
+ if len(ev) > 0 {
+ escaped = append(escaped, Tag{Key: ek, Value: ev})
+ }
+ }
+
+ // Extract keys and determine final size.
+ sz := len(escaped) + (len(escaped) * 2) // separators
+ keys := make([][]byte, len(escaped)+1)
+ for i, t := range escaped {
+ keys[i] = t.Key
+ sz += len(t.Key) + len(t.Value)
+ }
+ keys = keys[:len(escaped)]
+ sort.Sort(byteSlices(keys))
+
+ // Generate marshaled bytes.
+ b := make([]byte, sz)
+ buf := b
+ idx := 0
+ for i, k := range keys {
+ buf[idx] = ','
+ idx++
+ copy(buf[idx:idx+len(k)], k)
+ idx += len(k)
+ buf[idx] = '='
+ idx++
+ v := escaped[i].Value
+ copy(buf[idx:idx+len(v)], v)
+ idx += len(v)
+ }
+ return b[:idx]
+}
+
+// Fields represents a mapping between a Point's field names and their
+// values.
+type Fields map[string]interface{}
+
+func parseNumber(val []byte) (interface{}, error) {
+ if val[len(val)-1] == 'i' {
+ val = val[:len(val)-1]
+ return parseIntBytes(val, 10, 64)
+ }
+ for i := 0; i < len(val); i++ {
+ // If there is a decimal or an N (NaN), I (Inf), parse as float
+ if val[i] == '.' || val[i] == 'N' || val[i] == 'n' || val[i] == 'I' || val[i] == 'i' || val[i] == 'e' {
+ return parseFloatBytes(val, 64)
+ }
+ if val[i] < '0' && val[i] > '9' {
+ return string(val), nil
+ }
+ }
+ return parseFloatBytes(val, 64)
+}
+
+// FieldIterator retuns a FieldIterator that can be used to traverse the
+// fields of a point without constructing the in-memory map.
+func (p *point) FieldIterator() FieldIterator {
+ p.Reset()
+ return p
+}
+
+type fieldIterator struct {
+ start, end int
+ key, keybuf []byte
+ valueBuf []byte
+ fieldType FieldType
+}
+
+// Next indicates whether there any fields remaining.
+func (p *point) Next() bool {
+ p.it.start = p.it.end
+ if p.it.start >= len(p.fields) {
+ return false
+ }
+
+ p.it.end, p.it.key = scanTo(p.fields, p.it.start, '=')
+ if escape.IsEscaped(p.it.key) {
+ p.it.keybuf = escape.AppendUnescaped(p.it.keybuf[:0], p.it.key)
+ p.it.key = p.it.keybuf
+ }
+
+ p.it.end, p.it.valueBuf = scanFieldValue(p.fields, p.it.end+1)
+ p.it.end++
+
+ if len(p.it.valueBuf) == 0 {
+ p.it.fieldType = Empty
+ return true
+ }
+
+ c := p.it.valueBuf[0]
+
+ if c == '"' {
+ p.it.fieldType = String
+ return true
+ }
+
+ if strings.IndexByte(`0123456789-.nNiI`, c) >= 0 {
+ if p.it.valueBuf[len(p.it.valueBuf)-1] == 'i' {
+ p.it.fieldType = Integer
+ p.it.valueBuf = p.it.valueBuf[:len(p.it.valueBuf)-1]
+ } else {
+ p.it.fieldType = Float
+ }
+ return true
+ }
+
+ // to keep the same behavior that currently exists, default to boolean
+ p.it.fieldType = Boolean
+ return true
+}
+
+// FieldKey returns the key of the current field.
+func (p *point) FieldKey() []byte {
+ return p.it.key
+}
+
+// Type returns the FieldType of the current field.
+func (p *point) Type() FieldType {
+ return p.it.fieldType
+}
+
+// StringValue returns the string value of the current field.
+func (p *point) StringValue() string {
+ return unescapeStringField(string(p.it.valueBuf[1 : len(p.it.valueBuf)-1]))
+}
+
+// IntegerValue returns the integer value of the current field.
+func (p *point) IntegerValue() (int64, error) {
+ n, err := parseIntBytes(p.it.valueBuf, 10, 64)
+ if err != nil {
+ return 0, fmt.Errorf("unable to parse integer value %q: %v", p.it.valueBuf, err)
+ }
+ return n, nil
+}
+
+// BooleanValue returns the boolean value of the current field.
+func (p *point) BooleanValue() (bool, error) {
+ b, err := parseBoolBytes(p.it.valueBuf)
+ if err != nil {
+ return false, fmt.Errorf("unable to parse bool value %q: %v", p.it.valueBuf, err)
+ }
+ return b, nil
+}
+
+// FloatValue returns the float value of the current field.
+func (p *point) FloatValue() (float64, error) {
+ f, err := parseFloatBytes(p.it.valueBuf, 64)
+ if err != nil {
+ return 0, fmt.Errorf("unable to parse floating point value %q: %v", p.it.valueBuf, err)
+ }
+ return f, nil
+}
+
+// Delete deletes the current field.
+func (p *point) Delete() {
+ switch {
+ case p.it.end == p.it.start:
+ case p.it.end >= len(p.fields):
+ p.fields = p.fields[:p.it.start]
+ case p.it.start == 0:
+ p.fields = p.fields[p.it.end:]
+ default:
+ p.fields = append(p.fields[:p.it.start], p.fields[p.it.end:]...)
+ }
+
+ p.it.end = p.it.start
+ p.it.key = nil
+ p.it.valueBuf = nil
+ p.it.fieldType = Empty
+}
+
+// Reset resets the iterator to its initial state.
+func (p *point) Reset() {
+ p.it.fieldType = Empty
+ p.it.key = nil
+ p.it.valueBuf = nil
+ p.it.start = 0
+ p.it.end = 0
+}
+
+// MarshalBinary encodes all the fields to their proper type and returns the binary
+// represenation
+// NOTE: uint64 is specifically not supported due to potential overflow when we decode
+// again later to an int64
+// NOTE2: uint is accepted, and may be 64 bits, and is for some reason accepted...
+func (p Fields) MarshalBinary() []byte {
+ var b []byte
+ keys := make([]string, 0, len(p))
+
+ for k := range p {
+ keys = append(keys, k)
+ }
+
+ // Not really necessary, can probably be removed.
+ sort.Strings(keys)
+
+ for i, k := range keys {
+ if i > 0 {
+ b = append(b, ',')
+ }
+ b = appendField(b, k, p[k])
+ }
+
+ return b
+}
+
+func appendField(b []byte, k string, v interface{}) []byte {
+ b = append(b, []byte(escape.String(k))...)
+ b = append(b, '=')
+
+ // check popular types first
+ switch v := v.(type) {
+ case float64:
+ b = strconv.AppendFloat(b, v, 'f', -1, 64)
+ case int64:
+ b = strconv.AppendInt(b, v, 10)
+ b = append(b, 'i')
+ case string:
+ b = append(b, '"')
+ b = append(b, []byte(EscapeStringField(v))...)
+ b = append(b, '"')
+ case bool:
+ b = strconv.AppendBool(b, v)
+ case int32:
+ b = strconv.AppendInt(b, int64(v), 10)
+ b = append(b, 'i')
+ case int16:
+ b = strconv.AppendInt(b, int64(v), 10)
+ b = append(b, 'i')
+ case int8:
+ b = strconv.AppendInt(b, int64(v), 10)
+ b = append(b, 'i')
+ case int:
+ b = strconv.AppendInt(b, int64(v), 10)
+ b = append(b, 'i')
+ case uint32:
+ b = strconv.AppendInt(b, int64(v), 10)
+ b = append(b, 'i')
+ case uint16:
+ b = strconv.AppendInt(b, int64(v), 10)
+ b = append(b, 'i')
+ case uint8:
+ b = strconv.AppendInt(b, int64(v), 10)
+ b = append(b, 'i')
+ // TODO: 'uint' should be considered just as "dangerous" as a uint64,
+ // perhaps the value should be checked and capped at MaxInt64? We could
+ // then include uint64 as an accepted value
+ case uint:
+ b = strconv.AppendInt(b, int64(v), 10)
+ b = append(b, 'i')
+ case float32:
+ b = strconv.AppendFloat(b, float64(v), 'f', -1, 32)
+ case []byte:
+ b = append(b, v...)
+ case nil:
+ // skip
+ default:
+ // Can't determine the type, so convert to string
+ b = append(b, '"')
+ b = append(b, []byte(EscapeStringField(fmt.Sprintf("%v", v)))...)
+ b = append(b, '"')
+
+ }
+
+ return b
+}
+
+type byteSlices [][]byte
+
+func (a byteSlices) Len() int { return len(a) }
+func (a byteSlices) Less(i, j int) bool { return bytes.Compare(a[i], a[j]) == -1 }
+func (a byteSlices) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/influxdata/influxdb/models/rows.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/models/rows.go b/traffic_stats/vendor/github.com/influxdata/influxdb/models/rows.go
new file mode 100644
index 0000000..c087a48
--- /dev/null
+++ b/traffic_stats/vendor/github.com/influxdata/influxdb/models/rows.go
@@ -0,0 +1,62 @@
+package models
+
+import (
+ "sort"
+)
+
+// Row represents a single row returned from the execution of a statement.
+type Row struct {
+ Name string `json:"name,omitempty"`
+ Tags map[string]string `json:"tags,omitempty"`
+ Columns []string `json:"columns,omitempty"`
+ Values [][]interface{} `json:"values,omitempty"`
+ Partial bool `json:"partial,omitempty"`
+}
+
+// SameSeries returns true if r contains values for the same series as o.
+func (r *Row) SameSeries(o *Row) bool {
+ return r.tagsHash() == o.tagsHash() && r.Name == o.Name
+}
+
+// tagsHash returns a hash of tag key/value pairs.
+func (r *Row) tagsHash() uint64 {
+ h := NewInlineFNV64a()
+ keys := r.tagsKeys()
+ for _, k := range keys {
+ h.Write([]byte(k))
+ h.Write([]byte(r.Tags[k]))
+ }
+ return h.Sum64()
+}
+
+// tagKeys returns a sorted list of tag keys.
+func (r *Row) tagsKeys() []string {
+ a := make([]string, 0, len(r.Tags))
+ for k := range r.Tags {
+ a = append(a, k)
+ }
+ sort.Strings(a)
+ return a
+}
+
+// Rows represents a collection of rows. Rows implements sort.Interface.
+type Rows []*Row
+
+// Len implements sort.Interface.
+func (p Rows) Len() int { return len(p) }
+
+// Less implements sort.Interface.
+func (p Rows) Less(i, j int) bool {
+ // Sort by name first.
+ if p[i].Name != p[j].Name {
+ return p[i].Name < p[j].Name
+ }
+
+ // Sort by tag set hash. Tags don't have a meaningful sort order so we
+ // just compute a hash and sort by that instead. This allows the tests
+ // to receive rows in a predictable order every time.
+ return p[i].tagsHash() < p[j].tagsHash()
+}
+
+// Swap implements sort.Interface.
+func (p Rows) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/influxdata/influxdb/models/statistic.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/models/statistic.go b/traffic_stats/vendor/github.com/influxdata/influxdb/models/statistic.go
new file mode 100644
index 0000000..553e9d0
--- /dev/null
+++ b/traffic_stats/vendor/github.com/influxdata/influxdb/models/statistic.go
@@ -0,0 +1,42 @@
+package models
+
+// Statistic is the representation of a statistic used by the monitoring service.
+type Statistic struct {
+ Name string `json:"name"`
+ Tags map[string]string `json:"tags"`
+ Values map[string]interface{} `json:"values"`
+}
+
+// NewStatistic returns an initialized Statistic.
+func NewStatistic(name string) Statistic {
+ return Statistic{
+ Name: name,
+ Tags: make(map[string]string),
+ Values: make(map[string]interface{}),
+ }
+}
+
+// StatisticTags is a map that can be merged with others without causing
+// mutations to either map.
+type StatisticTags map[string]string
+
+// Merge creates a new map containing the merged contents of tags and t.
+// If both tags and the receiver map contain the same key, the value in tags
+// is used in the resulting map.
+//
+// Merge always returns a usable map.
+func (t StatisticTags) Merge(tags map[string]string) map[string]string {
+ // Add everything in tags to the result.
+ out := make(map[string]string, len(tags))
+ for k, v := range tags {
+ out[k] = v
+ }
+
+ // Only add values from t that don't appear in tags.
+ for k, v := range t {
+ if _, ok := tags[k]; !ok {
+ out[k] = v
+ }
+ }
+ return out
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/influxdata/influxdb/models/time.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/models/time.go b/traffic_stats/vendor/github.com/influxdata/influxdb/models/time.go
new file mode 100644
index 0000000..e98f2cb
--- /dev/null
+++ b/traffic_stats/vendor/github.com/influxdata/influxdb/models/time.go
@@ -0,0 +1,74 @@
+package models
+
+// Helper time methods since parsing time can easily overflow and we only support a
+// specific time range.
+
+import (
+ "fmt"
+ "math"
+ "time"
+)
+
+const (
+ // MinNanoTime is the minumum time that can be represented.
+ //
+ // 1677-09-21 00:12:43.145224194 +0000 UTC
+ //
+ // The two lowest minimum integers are used as sentinel values. The
+ // minimum value needs to be used as a value lower than any other value for
+ // comparisons and another separate value is needed to act as a sentinel
+ // default value that is unusable by the user, but usable internally.
+ // Because these two values need to be used for a special purpose, we do
+ // not allow users to write points at these two times.
+ MinNanoTime = int64(math.MinInt64) + 2
+
+ // MaxNanoTime is the maximum time that can be represented.
+ //
+ // 2262-04-11 23:47:16.854775806 +0000 UTC
+ //
+ // The highest time represented by a nanosecond needs to be used for an
+ // exclusive range in the shard group, so the maximum time needs to be one
+ // less than the possible maximum number of nanoseconds representable by an
+ // int64 so that we don't lose a point at that one time.
+ MaxNanoTime = int64(math.MaxInt64) - 1
+)
+
+var (
+ minNanoTime = time.Unix(0, MinNanoTime).UTC()
+ maxNanoTime = time.Unix(0, MaxNanoTime).UTC()
+
+ // ErrTimeOutOfRange gets returned when time is out of the representable range using int64 nanoseconds since the epoch.
+ ErrTimeOutOfRange = fmt.Errorf("time outside range %d - %d", MinNanoTime, MaxNanoTime)
+)
+
+// SafeCalcTime safely calculates the time given. Will return error if the time is outside the
+// supported range.
+func SafeCalcTime(timestamp int64, precision string) (time.Time, error) {
+ mult := GetPrecisionMultiplier(precision)
+ if t, ok := safeSignedMult(timestamp, mult); ok {
+ tme := time.Unix(0, t).UTC()
+ return tme, CheckTime(tme)
+ }
+
+ return time.Time{}, ErrTimeOutOfRange
+}
+
+// CheckTime checks that a time is within the safe range.
+func CheckTime(t time.Time) error {
+ if t.Before(minNanoTime) || t.After(maxNanoTime) {
+ return ErrTimeOutOfRange
+ }
+ return nil
+}
+
+// Perform the multiplication and check to make sure it didn't overflow.
+func safeSignedMult(a, b int64) (int64, bool) {
+ if a == 0 || b == 0 || a == 1 || b == 1 {
+ return a * b, true
+ }
+ if a == MinNanoTime || b == MaxNanoTime {
+ return 0, false
+ }
+ c := a * b
+ return c, c/b == a
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/influxdata/influxdb/pkg/escape/bytes.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/pkg/escape/bytes.go b/traffic_stats/vendor/github.com/influxdata/influxdb/pkg/escape/bytes.go
new file mode 100644
index 0000000..f148d66
--- /dev/null
+++ b/traffic_stats/vendor/github.com/influxdata/influxdb/pkg/escape/bytes.go
@@ -0,0 +1,111 @@
+// Package escape contains utilities for escaping parts of InfluxQL
+// and InfluxDB line protocol.
+package escape
+
+import (
+ "bytes"
+ "strings"
+)
+
+// Codes is a map of bytes to be escaped.
+var Codes = map[byte][]byte{
+ ',': []byte(`\,`),
+ '"': []byte(`\"`),
+ ' ': []byte(`\ `),
+ '=': []byte(`\=`),
+}
+
+// Bytes escapes characters on the input slice, as defined by Codes.
+func Bytes(in []byte) []byte {
+ for b, esc := range Codes {
+ in = bytes.Replace(in, []byte{b}, esc, -1)
+ }
+ return in
+}
+
+const escapeChars = `," =`
+
+// IsEscaped returns whether b has any escaped characters,
+// i.e. whether b seems to have been processed by Bytes.
+func IsEscaped(b []byte) bool {
+ for len(b) > 0 {
+ i := bytes.IndexByte(b, '\\')
+ if i < 0 {
+ return false
+ }
+
+ if i+1 < len(b) && strings.IndexByte(escapeChars, b[i+1]) >= 0 {
+ return true
+ }
+ b = b[i+1:]
+ }
+ return false
+}
+
+// AppendUnescaped appends the unescaped version of src to dst
+// and returns the resulting slice.
+func AppendUnescaped(dst, src []byte) []byte {
+ var pos int
+ for len(src) > 0 {
+ next := bytes.IndexByte(src[pos:], '\\')
+ if next < 0 || pos+next+1 >= len(src) {
+ return append(dst, src...)
+ }
+
+ if pos+next+1 < len(src) && strings.IndexByte(escapeChars, src[pos+next+1]) >= 0 {
+ if pos+next > 0 {
+ dst = append(dst, src[:pos+next]...)
+ }
+ src = src[pos+next+1:]
+ pos = 0
+ } else {
+ pos += next + 1
+ }
+ }
+
+ return dst
+}
+
+// Unescape returns a new slice containing the unescaped version of in.
+func Unescape(in []byte) []byte {
+ if len(in) == 0 {
+ return nil
+ }
+
+ if bytes.IndexByte(in, '\\') == -1 {
+ return in
+ }
+
+ i := 0
+ inLen := len(in)
+ var out []byte
+
+ for {
+ if i >= inLen {
+ break
+ }
+ if in[i] == '\\' && i+1 < inLen {
+ switch in[i+1] {
+ case ',':
+ out = append(out, ',')
+ i += 2
+ continue
+ case '"':
+ out = append(out, '"')
+ i += 2
+ continue
+ case ' ':
+ out = append(out, ' ')
+ i += 2
+ continue
+ case '=':
+ out = append(out, '=')
+ i += 2
+ continue
+ }
+ }
+ out = append(out, in[i])
+ i += 1
+ }
+ return out
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/influxdata/influxdb/pkg/escape/strings.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/pkg/escape/strings.go b/traffic_stats/vendor/github.com/influxdata/influxdb/pkg/escape/strings.go
new file mode 100644
index 0000000..db98033
--- /dev/null
+++ b/traffic_stats/vendor/github.com/influxdata/influxdb/pkg/escape/strings.go
@@ -0,0 +1,21 @@
+package escape
+
+import "strings"
+
+var (
+ escaper = strings.NewReplacer(`,`, `\,`, `"`, `\"`, ` `, `\ `, `=`, `\=`)
+ unescaper = strings.NewReplacer(`\,`, `,`, `\"`, `"`, `\ `, ` `, `\=`, `=`)
+)
+
+// UnescapeString returns unescaped version of in.
+func UnescapeString(in string) string {
+ if strings.IndexByte(in, '\\') == -1 {
+ return in
+ }
+ return unescaper.Replace(in)
+}
+
+// String returns the escaped version of in.
+func String(in string) string {
+ return escaper.Replace(in)
+}
[09/29] incubator-trafficcontrol git commit: Refactor influxdb_tools
to have separate folders for the different executables (so as not to break
the current build script,
in comparison to separate commands on a single cli.App
Posted by ne...@apache.org.
Refactor influxdb_tools to have separate folders for the different executables (so as not to break the current build script, in comparison to separate commands on a single cli.App
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/23292650
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/23292650
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/23292650
Branch: refs/heads/master
Commit: 2329265011edf56d18639140e1cdecee0fc82050
Parents: 8bdb8be
Author: sbogacz <sb...@zvelo.com>
Authored: Fri Jan 6 23:35:59 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
.../create/create_ts_databases.go | 177 +++++++
traffic_stats/influxdb_tools/create/main.go | 37 ++
.../influxdb_tools/create_ts_databases.go | 171 ------
traffic_stats/influxdb_tools/main.go | 48 --
traffic_stats/influxdb_tools/sync/main.go | 37 ++
traffic_stats/influxdb_tools/sync/sync_test.go | 230 +++++++++
.../influxdb_tools/sync/sync_ts_databases.go | 516 +++++++++++++++++++
.../influxdb_tools/sync_ts_databases.go | 483 -----------------
8 files changed, 997 insertions(+), 702 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/23292650/traffic_stats/influxdb_tools/create/create_ts_databases.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/create/create_ts_databases.go b/traffic_stats/influxdb_tools/create/create_ts_databases.go
new file mode 100644
index 0000000..fa1260a
--- /dev/null
+++ b/traffic_stats/influxdb_tools/create/create_ts_databases.go
@@ -0,0 +1,177 @@
+/*
+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.
+*/
+
+package main
+
+import (
+ "fmt"
+
+ influx "github.com/influxdata/influxdb/client/v2"
+ "github.com/pkg/errors"
+ "github.com/urfave/cli"
+)
+
+const (
+ cache = "cache_stats"
+ deliveryService = "deliveryservice_stats"
+ daily = "daily_stats"
+)
+
+func createFlags() []cli.Flag {
+ return []cli.Flag{
+ cli.StringFlag{
+ Name: "url",
+ Usage: "The influxdb url and port",
+ Value: "http://localhost:8086",
+ },
+ cli.IntFlag{
+ Name: "replication",
+ Usage: "The number of nodes in the cluster",
+ Value: 3,
+ },
+ cli.StringFlag{
+ Name: "user",
+ Usage: "The influxdb username used to create DBs",
+ Value: "",
+ },
+ cli.StringFlag{
+ Name: "password",
+ Usage: "The influxdb password used to create DBs",
+ Value: "",
+ },
+ }
+}
+
+func create(c *cli.Context) error {
+ influxURL := c.String("url")
+ replication := c.Int("replication")
+ user := c.String("user")
+ password := c.String("password")
+
+ fmt.Printf("creating datbases for influxUrl: %s with a replication of %d using user %s\n", influxURL, replication, user)
+ client, err := influx.NewHTTPClient(influx.HTTPConfig{
+ Addr: influxURL,
+ Username: user,
+ Password: password,
+ })
+ if err != nil {
+ return errors.Wrap(err, "Error creating influx client")
+ }
+ _, _, err = client.Ping(10)
+ if err != nil {
+ return errors.Wrap(err, "Error creating influx client")
+ }
+
+ createCacheStats(client, replication)
+ createDailyStats(client, replication)
+ createDeliveryServiceStats(client, replication)
+ return nil
+}
+
+// queryDB takes a variadic argument for the target database so as to make
+// passing the variable optional, however, if passed, only the first db passed
+// in will be used
+func queryDB(client influx.Client, cmd string, dbs ...string) (res []influx.Result, err error) {
+ db := ""
+ if len(dbs) > 0 {
+ db = dbs[0]
+ }
+ q := influx.Query{
+ Command: cmd,
+ Database: db,
+ }
+ if response, err := client.Query(q); err == nil {
+ if response.Error() != nil {
+ return res, response.Error()
+ }
+ res = response.Results
+ }
+ return res, nil
+}
+
+func createCacheStats(client influx.Client, replication int) {
+ db := cache
+ createDatabase(client, db)
+ createRetentionPolicy(client, db, "daily", "26h", replication, true)
+ createRetentionPolicy(client, db, "monthly", "30d", replication, false)
+ createRetentionPolicy(client, db, "indefinite", "INF", replication, false)
+ createContinuousQuery(client, "bandwidth_1min", `CREATE CONTINUOUS QUERY bandwidth_1min ON cache_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "cache_stats"."monthly"."bandwidth.1min" FROM "cache_stats"."daily".bandwidth GROUP BY time(1m), * END`)
+ createContinuousQuery(client, "connections_1min", `CREATE CONTINUOUS QUERY connections_1min ON cache_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "cache_stats"."monthly"."connections.1min" FROM "cache_stats"."daily"."ats.proxy.process.http.current_client_connections" GROUP BY time(1m), * END`)
+ createContinuousQuery(client, "bandwidth_cdn_1min", `CREATE CONTINUOUS QUERY bandwidth_cdn_1min ON cache_stats RESAMPLE FOR 5m BEGIN SELECT sum(value) AS "value" INTO "cache_stats"."monthly"."bandwidth.cdn.1min" FROM "cache_stats"."monthly"."bandwidth.1min" GROUP BY time(1m), cdn END`)
+ createContinuousQuery(client, "connections_cdn_1min", `CREATE CONTINUOUS QUERY connections_cdn_1min ON cache_stats RESAMPLE FOR 5m BEGIN SELECT sum(value) AS "value" INTO "cache_stats"."monthly"."connections.cdn.1min" FROM "cache_stats"."monthly"."connections.1min" GROUP BY time(1m), cdn END`)
+ createContinuousQuery(client, "bandwidth_cdn_type_1min", `CREATE CONTINUOUS QUERY bandwidth_cdn_type_1min ON cache_stats RESAMPLE FOR 5m BEGIN SELECT sum(value) AS "value" INTO "cache_stats"."monthly"."bandwidth.cdn.type.1min" FROM "cache_stats"."monthly"."bandwidth.1min" GROUP BY time(1m), cdn, type END`)
+ createContinuousQuery(client, "connections_cdn_type_1min", `CREATE CONTINUOUS QUERY connections_cdn_type_1min ON cache_stats RESAMPLE FOR 5m BEGIN SELECT sum(value) AS "value" INTO "cache_stats"."monthly"."connections.cdn.type.1min" FROM "cache_stats"."monthly"."connections.1min" GROUP BY time(1m), cdn, type END`)
+ createContinuousQuery(client, "maxKbps_1min", `CREATE CONTINUOUS QUERY maxKbps_1min ON cache_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS value INTO cache_stats.monthly."maxkbps.1min" FROM cache_stats.daily.maxKbps GROUP BY time(1m), * END`)
+ createContinuousQuery(client, "maxkbps_cdn_1min", `CREATE CONTINUOUS QUERY maxkbps_cdn_1min ON cache_stats RESAMPLE FOR 5m BEGIN SELECT sum(value) AS value INTO cache_stats.monthly."maxkbps.cdn.1min" FROM cache_stats.monthly."maxkbps.1min" GROUP BY time(1m), cdn END`)
+ createContinuousQuery(client, "wrap_count_vol1_1m", `CREATE CONTINUOUS QUERY wrap_count_vol1_1m ON cache_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS vol1_wrap_count INTO cache_stats.monthly."wrap_count.1min" FROM cache_stats.daily."ats.proxy.process.cache.volume_1.wrap_count" GROUP BY time(1m), * END`)
+ createContinuousQuery(client, "wrap_count_vol2_1m", `CREATE CONTINUOUS QUERY wrap_count_vol2_1m ON cache_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS vol2_wrap_count INTO cache_stats.monthly."wrap_count.1min" FROM cache_stats.daily."ats.proxy.process.cache.volume_2.wrap_count" GROUP BY time(1m), * END`)
+}
+
+func createDeliveryServiceStats(client influx.Client, replication int) {
+ db := deliveryService
+ createDatabase(client, db)
+ createRetentionPolicy(client, db, "daily", "26h", replication, true)
+ createRetentionPolicy(client, db, "monthly", "30d", replication, false)
+ createRetentionPolicy(client, db, "indefinite", "INF", replication, false)
+ createContinuousQuery(client, "tps_2xx_ds_1min", `CREATE CONTINUOUS QUERY tps_2xx_ds_1min ON deliveryservice_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "deliveryservice_stats"."monthly"."tps_2xx.ds.1min" FROM "deliveryservice_stats"."daily".tps_2xx WHERE cachegroup = 'total' GROUP BY time(1m), * END`)
+ createContinuousQuery(client, "tps_3xx_ds_1min", `CREATE CONTINUOUS QUERY tps_3xx_ds_1min ON deliveryservice_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "deliveryservice_stats"."monthly"."tps_3xx.ds.1min" FROM "deliveryservice_stats"."daily".tps_3xx WHERE cachegroup = 'total' GROUP BY time(1m), * END`)
+ createContinuousQuery(client, "tps_4xx_ds_1min", `CREATE CONTINUOUS QUERY tps_4xx_ds_1min ON deliveryservice_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "deliveryservice_stats"."monthly"."tps_4xx.ds.1min" FROM "deliveryservice_stats"."daily".tps_4xx WHERE cachegroup = 'total' GROUP BY time(1m), * END`)
+ createContinuousQuery(client, "tps_5xx_ds_1min", `CREATE CONTINUOUS QUERY tps_5xx_ds_1min ON deliveryservice_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "deliveryservice_stats"."monthly"."tps_5xx.ds.1min" FROM "deliveryservice_stats"."daily".tps_5xx WHERE cachegroup = 'total' GROUP BY time(1m), * END`)
+ createContinuousQuery(client, "tps_total_ds_1min", `CREATE CONTINUOUS QUERY tps_total_ds_1min ON deliveryservice_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "deliveryservice_stats"."monthly"."tps_total.ds.1min" FROM "deliveryservice_stats"."daily".tps_total WHERE cachegroup = 'total' GROUP BY time(1m), * END`)
+ createContinuousQuery(client, "kbps_ds_1min", `CREATE CONTINUOUS QUERY kbps_ds_1min ON deliveryservice_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "deliveryservice_stats"."monthly"."kbps.ds.1min" FROM "deliveryservice_stats"."daily".kbps WHERE cachegroup = 'total' GROUP BY time(1m), * END`)
+ createContinuousQuery(client, "kbps_cg_1min", `CREATE CONTINUOUS QUERY kbps_cg_1min ON deliveryservice_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "deliveryservice_stats"."monthly"."kbps.cg.1min" FROM "deliveryservice_stats"."daily".kbps WHERE cachegroup != 'total' GROUP BY time(1m), * END`)
+ createContinuousQuery(client, "max_kbps_ds_1day", `CREATE CONTINUOUS QUERY max_kbps_ds_1day ON deliveryservice_stats RESAMPLE FOR 2d BEGIN SELECT max(value) AS "value" INTO "deliveryservice_stats"."indefinite"."max.kbps.ds.1day" FROM "deliveryservice_stats"."monthly"."kbps.ds.1min" GROUP BY time(1d), deliveryservice, cdn END`)
+}
+
+func createDailyStats(client influx.Client, replication int) {
+ db := daily
+ createDatabase(client, db)
+ createRetentionPolicy(client, db, "indefinite", "INF", replication, true)
+}
+
+func createDatabase(client influx.Client, db string) {
+ _, err := queryDB(client, fmt.Sprintf("CREATE DATABASE %s", db))
+ if err != nil {
+ fmt.Printf("An error occured creating the %v database: %v\n", db, err)
+ return
+ }
+ fmt.Println("Successfully created database: ", db)
+}
+
+func createRetentionPolicy(client influx.Client, db string, name string, duration string, replication int, isDefault bool) {
+ qString := fmt.Sprintf("CREATE RETENTION POLICY %s ON %s DURATION %s REPLICATION %d", name, db, duration, replication)
+ if isDefault {
+ qString += " DEFAULT"
+ }
+ _, err := queryDB(client, qString)
+ if err != nil {
+ fmt.Printf("An error occured creating the retention policy %s on database: %s: %v\n", name, db, err)
+ return
+ }
+ fmt.Printf("Successfully created retention policy %s for database: %s\n", name, db)
+}
+
+func createContinuousQuery(client influx.Client, name string, query string) {
+ _, err := queryDB(client, query)
+ if err != nil {
+ fmt.Printf("An error occured creating continuous query %s: %v\n", name, err)
+ return
+ }
+ fmt.Println("Successfully created continuous query ", name)
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/23292650/traffic_stats/influxdb_tools/create/main.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/create/main.go b/traffic_stats/influxdb_tools/create/main.go
new file mode 100644
index 0000000..986901b
--- /dev/null
+++ b/traffic_stats/influxdb_tools/create/main.go
@@ -0,0 +1,37 @@
+/*
+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.
+*/
+
+package main
+
+import (
+ "os"
+
+ "github.com/urfave/cli"
+)
+
+func main() {
+ app := cli.NewApp()
+ app.Name = "create_ts_databases"
+ app.Version = "0.1.0"
+ app.Usage = "create_ts_databases provides a cli tool for creating the requisite influxdb databases"
+ app.Flags = createFlags()
+ app.Action = create
+
+ app.Run(os.Args)
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/23292650/traffic_stats/influxdb_tools/create_ts_databases.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/create_ts_databases.go b/traffic_stats/influxdb_tools/create_ts_databases.go
deleted file mode 100644
index 4ee6793..0000000
--- a/traffic_stats/influxdb_tools/create_ts_databases.go
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
-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.
-*/
-
-package main
-
-import (
- "fmt"
-
- influx "github.com/influxdata/influxdb/client/v2"
- "github.com/pkg/errors"
- "github.com/urfave/cli"
-)
-
-func createFlags() []cli.Flag {
- return []cli.Flag{
- cli.StringFlag{
- Name: "url",
- Usage: "The influxdb url and port",
- Value: "http://localhost:8086",
- },
- cli.IntFlag{
- Name: "replication",
- Usage: "The number of nodes in the cluster",
- Value: 3,
- },
- cli.StringFlag{
- Name: "user",
- Usage: "The influxdb username used to create DBs",
- Value: "",
- },
- cli.StringFlag{
- Name: "password",
- Usage: "The influxdb password used to create DBs",
- Value: "",
- },
- }
-}
-
-func create(c *cli.Context) error {
- influxURL := c.String("url")
- replication := c.Int("replication")
- user := c.String("user")
- password := c.String("password")
-
- fmt.Printf("creating datbases for influxUrl: %s with a replication of %d using user %s\n", influxURL, replication, user)
- client, err := influx.NewHTTPClient(influx.HTTPConfig{
- Addr: influxURL,
- Username: user,
- Password: password,
- })
- if err != nil {
- return errors.Wrap(err, "Error creating influx client")
- }
- _, _, err = client.Ping(10)
- if err != nil {
- return errors.Wrap(err, "Error creating influx client")
- }
-
- createCacheStats(client, replication)
- createDailyStats(client, replication)
- createDeliveryServiceStats(client, replication)
- return nil
-}
-
-// queryDB takes a variadic argument for the target database so as to make
-// passing the variable optional, however, if passed, only the first db passed
-// in will be used
-func queryDB(client influx.Client, cmd string, dbs ...string) (res []influx.Result, err error) {
- db := ""
- if len(dbs) > 0 {
- db = dbs[0]
- }
- q := influx.Query{
- Command: cmd,
- Database: db,
- }
- if response, err := client.Query(q); err == nil {
- if response.Error() != nil {
- return res, response.Error()
- }
- res = response.Results
- }
- return res, nil
-}
-
-func createCacheStats(client influx.Client, replication int) {
- db := cache
- createDatabase(client, db)
- createRetentionPolicy(client, db, "daily", "26h", replication, true)
- createRetentionPolicy(client, db, "monthly", "30d", replication, false)
- createRetentionPolicy(client, db, "indefinite", "INF", replication, false)
- createContinuousQuery(client, "bandwidth_1min", `CREATE CONTINUOUS QUERY bandwidth_1min ON cache_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "cache_stats"."monthly"."bandwidth.1min" FROM "cache_stats"."daily".bandwidth GROUP BY time(1m), * END`)
- createContinuousQuery(client, "connections_1min", `CREATE CONTINUOUS QUERY connections_1min ON cache_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "cache_stats"."monthly"."connections.1min" FROM "cache_stats"."daily"."ats.proxy.process.http.current_client_connections" GROUP BY time(1m), * END`)
- createContinuousQuery(client, "bandwidth_cdn_1min", `CREATE CONTINUOUS QUERY bandwidth_cdn_1min ON cache_stats RESAMPLE FOR 5m BEGIN SELECT sum(value) AS "value" INTO "cache_stats"."monthly"."bandwidth.cdn.1min" FROM "cache_stats"."monthly"."bandwidth.1min" GROUP BY time(1m), cdn END`)
- createContinuousQuery(client, "connections_cdn_1min", `CREATE CONTINUOUS QUERY connections_cdn_1min ON cache_stats RESAMPLE FOR 5m BEGIN SELECT sum(value) AS "value" INTO "cache_stats"."monthly"."connections.cdn.1min" FROM "cache_stats"."monthly"."connections.1min" GROUP BY time(1m), cdn END`)
- createContinuousQuery(client, "bandwidth_cdn_type_1min", `CREATE CONTINUOUS QUERY bandwidth_cdn_type_1min ON cache_stats RESAMPLE FOR 5m BEGIN SELECT sum(value) AS "value" INTO "cache_stats"."monthly"."bandwidth.cdn.type.1min" FROM "cache_stats"."monthly"."bandwidth.1min" GROUP BY time(1m), cdn, type END`)
- createContinuousQuery(client, "connections_cdn_type_1min", `CREATE CONTINUOUS QUERY connections_cdn_type_1min ON cache_stats RESAMPLE FOR 5m BEGIN SELECT sum(value) AS "value" INTO "cache_stats"."monthly"."connections.cdn.type.1min" FROM "cache_stats"."monthly"."connections.1min" GROUP BY time(1m), cdn, type END`)
- createContinuousQuery(client, "maxKbps_1min", `CREATE CONTINUOUS QUERY maxKbps_1min ON cache_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS value INTO cache_stats.monthly."maxkbps.1min" FROM cache_stats.daily.maxKbps GROUP BY time(1m), * END`)
- createContinuousQuery(client, "maxkbps_cdn_1min", `CREATE CONTINUOUS QUERY maxkbps_cdn_1min ON cache_stats RESAMPLE FOR 5m BEGIN SELECT sum(value) AS value INTO cache_stats.monthly."maxkbps.cdn.1min" FROM cache_stats.monthly."maxkbps.1min" GROUP BY time(1m), cdn END`)
- createContinuousQuery(client, "wrap_count_vol1_1m", `CREATE CONTINUOUS QUERY wrap_count_vol1_1m ON cache_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS vol1_wrap_count INTO cache_stats.monthly."wrap_count.1min" FROM cache_stats.daily."ats.proxy.process.cache.volume_1.wrap_count" GROUP BY time(1m), * END`)
- createContinuousQuery(client, "wrap_count_vol2_1m", `CREATE CONTINUOUS QUERY wrap_count_vol2_1m ON cache_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS vol2_wrap_count INTO cache_stats.monthly."wrap_count.1min" FROM cache_stats.daily."ats.proxy.process.cache.volume_2.wrap_count" GROUP BY time(1m), * END`)
-}
-
-func createDeliveryServiceStats(client influx.Client, replication int) {
- db := deliveryService
- createDatabase(client, db)
- createRetentionPolicy(client, db, "daily", "26h", replication, true)
- createRetentionPolicy(client, db, "monthly", "30d", replication, false)
- createRetentionPolicy(client, db, "indefinite", "INF", replication, false)
- createContinuousQuery(client, "tps_2xx_ds_1min", `CREATE CONTINUOUS QUERY tps_2xx_ds_1min ON deliveryservice_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "deliveryservice_stats"."monthly"."tps_2xx.ds.1min" FROM "deliveryservice_stats"."daily".tps_2xx WHERE cachegroup = 'total' GROUP BY time(1m), * END`)
- createContinuousQuery(client, "tps_3xx_ds_1min", `CREATE CONTINUOUS QUERY tps_3xx_ds_1min ON deliveryservice_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "deliveryservice_stats"."monthly"."tps_3xx.ds.1min" FROM "deliveryservice_stats"."daily".tps_3xx WHERE cachegroup = 'total' GROUP BY time(1m), * END`)
- createContinuousQuery(client, "tps_4xx_ds_1min", `CREATE CONTINUOUS QUERY tps_4xx_ds_1min ON deliveryservice_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "deliveryservice_stats"."monthly"."tps_4xx.ds.1min" FROM "deliveryservice_stats"."daily".tps_4xx WHERE cachegroup = 'total' GROUP BY time(1m), * END`)
- createContinuousQuery(client, "tps_5xx_ds_1min", `CREATE CONTINUOUS QUERY tps_5xx_ds_1min ON deliveryservice_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "deliveryservice_stats"."monthly"."tps_5xx.ds.1min" FROM "deliveryservice_stats"."daily".tps_5xx WHERE cachegroup = 'total' GROUP BY time(1m), * END`)
- createContinuousQuery(client, "tps_total_ds_1min", `CREATE CONTINUOUS QUERY tps_total_ds_1min ON deliveryservice_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "deliveryservice_stats"."monthly"."tps_total.ds.1min" FROM "deliveryservice_stats"."daily".tps_total WHERE cachegroup = 'total' GROUP BY time(1m), * END`)
- createContinuousQuery(client, "kbps_ds_1min", `CREATE CONTINUOUS QUERY kbps_ds_1min ON deliveryservice_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "deliveryservice_stats"."monthly"."kbps.ds.1min" FROM "deliveryservice_stats"."daily".kbps WHERE cachegroup = 'total' GROUP BY time(1m), * END`)
- createContinuousQuery(client, "kbps_cg_1min", `CREATE CONTINUOUS QUERY kbps_cg_1min ON deliveryservice_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS "value" INTO "deliveryservice_stats"."monthly"."kbps.cg.1min" FROM "deliveryservice_stats"."daily".kbps WHERE cachegroup != 'total' GROUP BY time(1m), * END`)
- createContinuousQuery(client, "max_kbps_ds_1day", `CREATE CONTINUOUS QUERY max_kbps_ds_1day ON deliveryservice_stats RESAMPLE FOR 2d BEGIN SELECT max(value) AS "value" INTO "deliveryservice_stats"."indefinite"."max.kbps.ds.1day" FROM "deliveryservice_stats"."monthly"."kbps.ds.1min" GROUP BY time(1d), deliveryservice, cdn END`)
-}
-
-func createDailyStats(client influx.Client, replication int) {
- db := daily
- createDatabase(client, db)
- createRetentionPolicy(client, db, "indefinite", "INF", replication, true)
-}
-
-func createDatabase(client influx.Client, db string) {
- _, err := queryDB(client, fmt.Sprintf("CREATE DATABASE %s", db))
- if err != nil {
- fmt.Printf("An error occured creating the %v database: %v\n", db, err)
- return
- }
- fmt.Println("Successfully created database: ", db)
-}
-
-func createRetentionPolicy(client influx.Client, db string, name string, duration string, replication int, isDefault bool) {
- qString := fmt.Sprintf("CREATE RETENTION POLICY %s ON %s DURATION %s REPLICATION %d", name, db, duration, replication)
- if isDefault {
- qString += " DEFAULT"
- }
- _, err := queryDB(client, qString)
- if err != nil {
- fmt.Printf("An error occured creating the retention policy %s on database: %s: %v\n", name, db, err)
- return
- }
- fmt.Printf("Successfully created retention policy %s for database: %s\n", name, db)
-}
-
-func createContinuousQuery(client influx.Client, name string, query string) {
- _, err := queryDB(client, query)
- if err != nil {
- fmt.Printf("An error occured creating continuous query %s: %v\n", name, err)
- return
- }
- fmt.Println("Successfully created continuous query ", name)
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/23292650/traffic_stats/influxdb_tools/main.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/main.go b/traffic_stats/influxdb_tools/main.go
deleted file mode 100644
index 06fc3ef..0000000
--- a/traffic_stats/influxdb_tools/main.go
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-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.
-*/
-
-package main
-
-import (
- "os"
-
- "github.com/urfave/cli"
-)
-
-func main() {
- app := cli.NewApp()
- app.Name = "influx-tools"
- app.Version = "0.1.0"
- app.Usage = "influx-tools provides cli methods for creating and syncing the requisite influxdb databases"
- app.Commands = []cli.Command{
- cli.Command{
- Name: "create",
- Usage: "create the influxDB tables",
- Action: create,
- Flags: createFlags(),
- },
- cli.Command{
- Name: "sync",
- Usage: "sync the influxDB tables",
- Action: sync,
- Flags: syncFlags(),
- },
- }
- app.Run(os.Args)
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/23292650/traffic_stats/influxdb_tools/sync/main.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/sync/main.go b/traffic_stats/influxdb_tools/sync/main.go
new file mode 100644
index 0000000..717f655
--- /dev/null
+++ b/traffic_stats/influxdb_tools/sync/main.go
@@ -0,0 +1,37 @@
+/*
+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.
+*/
+
+package main
+
+import (
+ "os"
+
+ "github.com/urfave/cli"
+)
+
+func main() {
+ app := cli.NewApp()
+ app.Name = "sync_ts_databases"
+ app.Version = "0.1.0"
+ app.Usage = "sync_ts_databases provides a cli tool syncing the requisite influxdb databases"
+ app.Flags = syncFlags()
+ app.Action = sync
+
+ app.Run(os.Args)
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/23292650/traffic_stats/influxdb_tools/sync/sync_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/sync/sync_test.go b/traffic_stats/influxdb_tools/sync/sync_test.go
new file mode 100644
index 0000000..943e7a5
--- /dev/null
+++ b/traffic_stats/influxdb_tools/sync/sync_test.go
@@ -0,0 +1,230 @@
+/*
+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.
+*/
+
+package main
+
+import (
+ "encoding/json"
+ "fmt"
+ "testing"
+
+ influx "github.com/influxdata/influxdb/client/v2"
+ "github.com/influxdata/influxdb/models"
+ . "github.com/smartystreets/goconvey/convey"
+)
+
+func TestSync(t *testing.T) {
+ Convey("getDailyStats should work as expected", t, func() {
+ Convey("getDailyStats should work with no results passed", func() {
+ dailyStatsMap := getDailyStats(nil)
+ So(dailyStatsMap, ShouldNotBeNil)
+ So(dailyStatsMap, ShouldBeEmpty)
+ })
+ Convey("getDailyStats should work with empty results passed", func() {
+ results := []influx.Result{}
+ dailyStatsMap := getDailyStats(results)
+ So(dailyStatsMap, ShouldNotBeNil)
+ So(dailyStatsMap, ShouldBeEmpty)
+ })
+ Convey("getDailyStats should work as expected on a slice of results", func() {
+ results := []influx.Result{
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateDailyValues(0),
+ },
+ },
+ },
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateDailyValues(1),
+ },
+ models.Row{
+ Values: generateDailyValues(2),
+ },
+ },
+ },
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateDailyValues(3),
+ },
+ models.Row{
+ Values: generateDailyValues(4),
+ },
+ models.Row{
+ Values: generateDailyValues(5),
+ },
+ },
+ },
+ }
+ dailyStatsMap := getDailyStats(results)
+ So(dailyStatsMap, ShouldNotBeNil)
+ So(dailyStatsMap, ShouldNotBeEmpty)
+ So(len(dailyStatsMap), ShouldEqual, 6) // we get one dailyStats object per Values entry
+ })
+ })
+ Convey("getDeliveryServiceStats should work as expected", t, func() {
+ Convey("getDeliveryServiceStats should work with no results passed", func() {
+ getDeliveryServiceStatsMap := getDeliveryServiceStats(nil)
+ So(getDeliveryServiceStatsMap, ShouldNotBeNil)
+ So(getDeliveryServiceStatsMap, ShouldBeEmpty)
+ })
+ Convey("getDeliveryServiceStats should work with empty results passed", func() {
+ results := []influx.Result{}
+ getDeliveryServiceStatsMap := getDeliveryServiceStats(results)
+ So(getDeliveryServiceStatsMap, ShouldNotBeNil)
+ So(getDeliveryServiceStatsMap, ShouldBeEmpty)
+ })
+ Convey("getDeliveryServiceStats should work as expected on a slice of results", func() {
+ results := []influx.Result{
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateDeliveryServiceValues(0),
+ },
+ },
+ },
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateDeliveryServiceValues(1),
+ },
+ models.Row{
+ Values: generateDeliveryServiceValues(2),
+ },
+ },
+ },
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateDeliveryServiceValues(3),
+ },
+ models.Row{
+ Values: generateDeliveryServiceValues(4),
+ },
+ models.Row{
+ Values: generateDeliveryServiceValues(5),
+ },
+ },
+ },
+ }
+ getDeliveryServiceStatsMap := getDeliveryServiceStats(results)
+ So(getDeliveryServiceStatsMap, ShouldNotBeNil)
+ So(getDeliveryServiceStatsMap, ShouldNotBeEmpty)
+ So(len(getDeliveryServiceStatsMap), ShouldEqual, 6) // we get one dailyStats object per Values entry
+ })
+ })
+ Convey("getCacheStats should work as expected", t, func() {
+ Convey("getCacheStats should work with no results passed", func() {
+ getCacheStatsMap := getCacheStats(nil)
+ So(getCacheStatsMap, ShouldNotBeNil)
+ So(getCacheStatsMap, ShouldBeEmpty)
+ })
+ Convey("getCacheStats should work with empty results passed", func() {
+ results := []influx.Result{}
+ getCacheStatsMap := getCacheStats(results)
+ So(getCacheStatsMap, ShouldNotBeNil)
+ So(getCacheStatsMap, ShouldBeEmpty)
+ })
+ Convey("getCacheStats should work as expected on a slice of results", func() {
+ results := []influx.Result{
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateCacheValues(0),
+ },
+ },
+ },
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateCacheValues(1),
+ },
+ models.Row{
+ Values: generateCacheValues(2),
+ },
+ },
+ },
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateCacheValues(3),
+ },
+ models.Row{
+ Values: generateCacheValues(4),
+ },
+ models.Row{
+ Values: generateCacheValues(5),
+ },
+ },
+ },
+ }
+ getCacheStatsMap := getCacheStats(results)
+ So(getCacheStatsMap, ShouldNotBeNil)
+ So(getCacheStatsMap, ShouldNotBeEmpty)
+ So(len(getCacheStatsMap), ShouldEqual, 6) // we get one dailyStats object per Values entry
+ })
+ })
+}
+
+func generateDailyValues(i int) [][]interface{} {
+ ret := make([][]interface{}, 1)
+ startIdx := i * 4 // this is to have the right amount of difference between the test numbers used
+ for j := startIdx; j < startIdx+3; j++ {
+ n := startIdx + j
+ ret[0] = make([]interface{}, 4)
+ ret[0][0] = fmt.Sprintf("t%d", n)
+ ret[0][1] = fmt.Sprintf("test.cdn-%d", n)
+ ret[0][2] = fmt.Sprintf("testDeliveryService-%d", n)
+ ret[0][3] = json.Number(fmt.Sprintf("%d.%d%d", n, n, n))
+ }
+ return ret
+}
+
+func generateDeliveryServiceValues(i int) [][]interface{} {
+ ret := make([][]interface{}, 1)
+ startIdx := i * 4 // this is to have the right amount of difference between the test numbers used
+ for j := startIdx; j < startIdx+3; j++ {
+ n := startIdx + j
+ ret[0] = make([]interface{}, 5)
+ ret[0][0] = fmt.Sprintf("t%d", n)
+ ret[0][1] = fmt.Sprintf("cache-group%d", n)
+ ret[0][2] = fmt.Sprintf("test.cdn-%d", n)
+ ret[0][3] = fmt.Sprintf("testDeliveryService-%d", n)
+ ret[0][4] = json.Number(fmt.Sprintf("%d.%d%d", n, n, n))
+ }
+ return ret
+}
+
+func generateCacheValues(i int) [][]interface{} {
+ ret := make([][]interface{}, 1)
+ startIdx := i * 4 // this is to have the right amount of difference between the test numbers used
+ for j := startIdx; j < startIdx+3; j++ {
+ n := startIdx + j
+ ret[0] = make([]interface{}, 5)
+ ret[0][0] = fmt.Sprintf("t%d", n)
+ ret[0][1] = fmt.Sprintf("test.cdn-%d", n)
+ ret[0][2] = fmt.Sprintf("test.hostname-%d", n)
+ ret[0][3] = fmt.Sprintf("test.cacheType-%d", n)
+ ret[0][4] = json.Number(fmt.Sprintf("%d.%d%d", n, n, n))
+ }
+ return ret
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/23292650/traffic_stats/influxdb_tools/sync/sync_ts_databases.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/sync/sync_ts_databases.go b/traffic_stats/influxdb_tools/sync/sync_ts_databases.go
new file mode 100644
index 0000000..02a8249
--- /dev/null
+++ b/traffic_stats/influxdb_tools/sync/sync_ts_databases.go
@@ -0,0 +1,516 @@
+/*
+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.
+*/
+
+package main
+
+import (
+ "encoding/json"
+ "fmt"
+ "time"
+
+ influx "github.com/influxdata/influxdb/client/v2"
+ "github.com/pkg/errors"
+ "github.com/urfave/cli"
+)
+
+const (
+ cache = "cache_stats"
+ deliveryService = "deliveryservice_stats"
+ daily = "daily_stats"
+)
+
+type cacheStats struct {
+ t string //time
+ value float64
+ cdn string
+ hostname string
+ cacheType string
+}
+
+type deliveryServiceStats struct {
+ t string //time
+ value float64
+ cdn string
+ deliveryService string
+ cacheGroup string
+}
+type dailyStats struct {
+ t string //time
+ cdn string
+ deliveryService string
+ value float64
+}
+
+func syncFlags() []cli.Flag {
+ return []cli.Flag{
+ cli.StringFlag{
+ Name: "sourceUrl",
+ Usage: "The source influxdb url and port",
+ Value: "http://server1.kabletown.net:8086",
+ },
+ cli.StringFlag{
+ Name: "targetUrl",
+ Usage: "The target influxdb url and port",
+ Value: "http://server2.kabletown.net:8086",
+ },
+ cli.StringFlag{
+ Name: "database",
+ Usage: "Sync a specific database",
+ Value: "all",
+ },
+ cli.IntFlag{
+ Name: "days",
+ Usage: "Number of days in the past to sync (today - x days), 0 is all",
+ Value: 0,
+ },
+ cli.StringFlag{
+ Name: "sourceUser",
+ Usage: "The source influxdb username",
+ Value: "",
+ },
+ cli.StringFlag{
+ Name: "sourcePass",
+ Usage: "The source influxdb password",
+ Value: "",
+ },
+ cli.StringFlag{
+ Name: "targetUser",
+ Usage: "The target influxdb username",
+ Value: "",
+ },
+ cli.StringFlag{
+ Name: "targetPass",
+ Usage: "The target influxdb password",
+ Value: "",
+ },
+ }
+}
+
+func sync(c *cli.Context) error {
+
+ sourceURL := c.String("sourceUrl")
+ targetURL := c.String("targetUrl")
+ database := c.String("database")
+ days := c.Int("days")
+ sourceUser := c.String("sourceUser")
+ sourcePass := c.String("sourcePass")
+ targetUser := c.String("targetUser")
+ targetPass := c.String("targetPass")
+ fmt.Printf("syncing %s to %s for %s database(s) for the past %d day(s)\n", sourceURL, targetURL, database, days)
+ sourceClient, err := influx.NewHTTPClient(influx.HTTPConfig{
+ Addr: sourceURL,
+ Username: sourceUser,
+ Password: sourcePass,
+ })
+ if err != nil {
+ return errors.Wrap(err, "Error creating influx sourceClient")
+ }
+
+ if _, _, err = sourceClient.Ping(10); err != nil {
+ return errors.Wrap(err, "Error creating influx sourceClient")
+ }
+
+ targetClient, err := influx.NewHTTPClient(influx.HTTPConfig{
+ Addr: targetURL,
+ Username: targetUser,
+ Password: targetPass,
+ })
+ if err != nil {
+ return errors.Wrap(err, "Error creating influx targetClient")
+ }
+
+ if _, _, err = targetClient.Ping(10); err != nil {
+ return errors.Wrap(err, "Error creating influx targetClient")
+ }
+
+ chSize := 1
+ if database == "all" {
+ chSize = 3
+ }
+
+ ch := make(chan string)
+
+ switch database {
+ case "all":
+ go syncDailyDb(ch, sourceClient, targetClient, days)
+ go syncCsDb(ch, sourceClient, targetClient, days)
+ go syncDsDb(ch, sourceClient, targetClient, days)
+ case cache:
+ go syncCsDb(ch, sourceClient, targetClient, days)
+ case deliveryService:
+ go syncDsDb(ch, sourceClient, targetClient, days)
+ case daily:
+ go syncDailyDb(ch, sourceClient, targetClient, days)
+ default:
+ return errors.New("No database selected")
+ }
+
+ for i := 1; i <= chSize; i++ {
+ fmt.Println(<-ch)
+ }
+
+ fmt.Println("Traffic Stats have been synced!")
+ return nil
+}
+
+func syncCsDb(ch chan string, sourceClient influx.Client, targetClient influx.Client, days int) {
+ db := cache
+ fmt.Printf("Syncing %s database...\n", db)
+ stats := [...]string{
+ "bandwidth.cdn.1min",
+ "connections.cdn.1min",
+ "connections.cdn.type.1min",
+ "bandwidth.cdn.type.1min",
+ //these take a long time so do them last
+ "bandwidth.1min",
+ "connections.1min",
+ //
+ }
+ for _, statName := range stats {
+ fmt.Printf("Syncing %s database with %s \n", db, statName)
+ syncCacheStat(sourceClient, targetClient, statName, days)
+ fmt.Printf("Done syncing %s\n", statName)
+ }
+ ch <- fmt.Sprintf("Done syncing %s!\n", db)
+}
+
+func syncDsDb(ch chan string, sourceClient influx.Client, targetClient influx.Client, days int) {
+ db := deliveryService
+ fmt.Printf("Syncing %s database...\n", db)
+ stats := [...]string{
+ "kbps.ds.1min",
+ "max.kbps.ds.1day",
+ "kbps.cg.1min",
+ "tps_2xx.ds.1min",
+ "tps_3xx.ds.1min",
+ "tps_4xx.ds.1min",
+ "tps_5xx.ds.1min",
+ "tps_total.ds.1min",
+ }
+ for _, statName := range stats {
+ fmt.Printf("Syncing %s database with %s\n", db, statName)
+ syncDeliveryServiceStat(sourceClient, targetClient, statName, days)
+ }
+ ch <- fmt.Sprintf("Done syncing %s!\n", db)
+}
+
+func syncDailyDb(ch chan string, sourceClient influx.Client, targetClient influx.Client, days int) {
+ db := daily
+ fmt.Printf("Syncing %s database...\n", db)
+ stats := [...]string{
+ "daily_bytesserved",
+ "daily_maxgbps",
+ }
+
+ for _, statName := range stats {
+ fmt.Printf("Syncing %s database with %s\n", db, statName)
+ syncDailyStat(sourceClient, targetClient, statName, days)
+ }
+ ch <- fmt.Sprintf("Done syncing %s!\n", db)
+
+}
+
+func syncCacheStat(sourceClient influx.Client, targetClient influx.Client, statName string, days int) {
+ //get records from source DB
+ db := cache
+ bps, _ := influx.NewBatchPoints(influx.BatchPointsConfig{
+ Database: db,
+ Precision: "ms",
+ RetentionPolicy: "monthly",
+ })
+
+ queryString := fmt.Sprintf("select time, cdn, hostname, type, value from \"monthly\".\"%s\"", statName)
+ if days > 0 {
+ queryString = fmt.Sprintf("%s where time > now() - %dd", queryString, days)
+ }
+ fmt.Println("queryString ", queryString)
+ res, err := queryDB(sourceClient, queryString, db)
+ if err != nil {
+ fmt.Printf("An error occured getting %s records from sourceDb\n", statName)
+ return
+ }
+ sourceStats := getCacheStats(res)
+
+ //get values from target DB
+ targetRes, err := queryDB(targetClient, queryString, db)
+ if err != nil {
+ fmt.Printf("An error occured getting %s record from target db: %v\n", statName, err)
+ return
+ }
+ targetStats := getCacheStats(targetRes)
+
+ for ssKey := range sourceStats {
+ ts := targetStats[ssKey]
+ ss := sourceStats[ssKey]
+ if ts.value > ss.value {
+ //fmt.Printf("target value %v is at least equal to source value %v\n", ts.value, ss.value)
+ continue //target value is bigger so leave it
+ }
+ statTime, _ := time.Parse(time.RFC3339, ss.t)
+ tags := map[string]string{"cdn": ss.cdn}
+ if ss.hostname != "" {
+ tags["hostname"] = ss.hostname
+ }
+ if ss.cacheType != "" {
+ tags["type"] = ss.cacheType
+ }
+ fields := map[string]interface{}{
+ "value": ss.value,
+ }
+ pt, err := influx.NewPoint(
+ statName,
+ tags,
+ fields,
+ statTime,
+ )
+ if err != nil {
+ fmt.Printf("error adding creating point for %v...%v\n", statName, err)
+ continue
+ }
+ bps.AddPoint(pt)
+ }
+ targetClient.Write(bps)
+}
+
+func syncDeliveryServiceStat(sourceClient influx.Client, targetClient influx.Client, statName string, days int) {
+
+ db := deliveryService
+ bps, _ := influx.NewBatchPoints(influx.BatchPointsConfig{
+ Database: db,
+ Precision: "ms",
+ RetentionPolicy: "monthly",
+ })
+
+ queryString := fmt.Sprintf("select time, cachegroup, cdn, deliveryservice, value from \"monthly\".\"%s\"", statName)
+ if days > 0 {
+ queryString = fmt.Sprintf("%s where time > now() - %dd", queryString, days)
+ }
+ fmt.Println("queryString ", queryString)
+ res, err := queryDB(sourceClient, queryString, db)
+ if err != nil {
+ fmt.Printf("An error occured getting %s records from sourceDb: %v\n", statName, err)
+ return
+ }
+ sourceStats := getDeliveryServiceStats(res)
+ // get value from target DB
+ targetRes, err := queryDB(targetClient, queryString, db)
+ if err != nil {
+ fmt.Printf("An error occured getting %s record from target db: %v\n", statName, err)
+ return
+ }
+ targetStats := getDeliveryServiceStats(targetRes)
+
+ for ssKey := range sourceStats {
+ ts := targetStats[ssKey]
+ ss := sourceStats[ssKey]
+ if ts.value > ss.value {
+ //fmt.Printf("target value %v is at least equal to source value %v\n", ts.value, ss.value)
+ continue //target value is bigger so leave it
+ }
+ statTime, _ := time.Parse(time.RFC3339, ss.t)
+ tags := map[string]string{
+ "cdn": ss.cdn,
+ "cachegroup": ss.cacheGroup,
+ "deliveryservice": ss.deliveryService,
+ }
+ fields := map[string]interface{}{
+ "value": ss.value,
+ }
+ pt, err := influx.NewPoint(
+ statName,
+ tags,
+ fields,
+ statTime,
+ )
+ if err != nil {
+ fmt.Printf("error adding creating point for %v...%v\n", statName, err)
+ continue
+ }
+ bps.AddPoint(pt)
+ }
+ targetClient.Write(bps)
+}
+
+func syncDailyStat(sourceClient influx.Client, targetClient influx.Client, statName string, days int) {
+
+ db := daily
+ bps, _ := influx.NewBatchPoints(influx.BatchPointsConfig{
+ Database: db,
+ Precision: "s",
+ })
+ //get records from source DB
+ queryString := fmt.Sprintf("select time, cdn, deliveryservice, value from \"%s\"", statName)
+ if days > 0 {
+ queryString = fmt.Sprintf("%s where time > now() - %dd", queryString, days)
+ }
+ res, err := queryDB(sourceClient, queryString, db)
+ if err != nil {
+ fmt.Printf("An error occured getting %s records from sourceDb: %v\n", statName, err)
+ return
+ }
+ sourceStats := getDailyStats(res)
+ // get value from target DB
+ targetRes, err := queryDB(targetClient, queryString, db)
+ if err != nil {
+ fmt.Printf("An error occured getting %s record from target db: %v\n", statName, err)
+ return
+ }
+ targetStats := getDailyStats(targetRes)
+
+ for ssKey := range sourceStats {
+ ts := targetStats[ssKey]
+ ss := sourceStats[ssKey]
+ if ts.value >= ss.value {
+ //fmt.Printf("target value %v is at least equal to source value %v\n", ts.value, ss.value)
+ continue //target value is bigger or equal so leave it
+ }
+ statTime, _ := time.Parse(time.RFC3339, ss.t)
+ tags := map[string]string{
+ "cdn": ss.cdn,
+ "deliveryservice": ss.deliveryService,
+ }
+ fields := map[string]interface{}{
+ "value": ss.value,
+ }
+ pt, err := influx.NewPoint(
+ statName,
+ tags,
+ fields,
+ statTime,
+ )
+ if err != nil {
+ fmt.Printf("error adding creating point for %v...%v\n", statName, err)
+ continue
+ }
+ bps.AddPoint(pt)
+ }
+ targetClient.Write(bps)
+}
+
+func getCacheStats(res []influx.Result) map[string]cacheStats {
+ response := make(map[string]cacheStats)
+ if len(res) == 0 {
+ return response
+ }
+ for i := range res {
+ for _, row := range res[i].Series {
+ for _, record := range row.Values {
+ data := new(cacheStats)
+ t := record[0].(string)
+ data.t = t
+ data.cdn = record[1].(string)
+ if record[2] != nil {
+ data.hostname = record[2].(string)
+ }
+ if record[3] != nil {
+ data.cacheType = record[3].(string)
+ }
+ var err error
+ data.value, err = record[4].(json.Number).Float64()
+ if err != nil {
+ fmt.Printf("Couldn't parse value from record %v\n", record)
+ continue
+ }
+ key := data.t + data.cdn + data.hostname
+ response[key] = *data
+ }
+ }
+ }
+ return response
+}
+
+func getDeliveryServiceStats(res []influx.Result) map[string]deliveryServiceStats {
+ response := make(map[string]deliveryServiceStats)
+ // if the slice is empty, just return
+ if len(res) == 0 {
+ return response
+ }
+ for i := range res {
+ for _, row := range res[i].Series {
+ for _, record := range row.Values {
+ data := new(deliveryServiceStats)
+ data.t = record[0].(string)
+ if record[1] != nil {
+ data.cacheGroup = record[1].(string)
+ }
+ data.cdn = record[2].(string)
+ if record[3] != nil {
+ data.deliveryService = record[3].(string)
+ }
+ var err error
+ data.value, err = record[4].(json.Number).Float64()
+ if err != nil {
+ fmt.Printf("Couldn't parse value from record %v\n", record)
+ continue
+ }
+ key := data.t + data.cacheGroup + data.cdn + data.deliveryService
+ response[key] = *data
+ }
+ }
+ }
+ return response
+}
+
+func getDailyStats(res []influx.Result) map[string]dailyStats {
+ response := make(map[string]dailyStats)
+ // if the slice is empty, just return
+ if len(res) == 0 {
+ return response
+ }
+ for i := range res {
+ for _, row := range res[i].Series {
+ for _, record := range row.Values {
+ data := new(dailyStats)
+ data.t = record[0].(string)
+ data.cdn = record[1].(string)
+ data.deliveryService = record[2].(string)
+ var err error
+ data.value, err = record[3].(json.Number).Float64()
+ if err != nil {
+ fmt.Printf("Couldn't parse value from record %v\n", record)
+ continue
+ }
+ key := data.t + data.cdn + data.deliveryService
+ response[key] = *data
+ }
+ }
+ }
+ return response
+}
+
+// queryDB takes a variadic argument for the target database so as to make
+// passing the variable optional, however, if passed, only the first db passed
+// in will be used
+func queryDB(client influx.Client, cmd string, dbs ...string) (res []influx.Result, err error) {
+ db := ""
+ if len(dbs) > 0 {
+ db = dbs[0]
+ }
+ q := influx.Query{
+ Command: cmd,
+ Database: db,
+ }
+ if response, err := client.Query(q); err == nil {
+ if response.Error() != nil {
+ return res, response.Error()
+ }
+ res = response.Results
+ }
+ return res, nil
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/23292650/traffic_stats/influxdb_tools/sync_ts_databases.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/sync_ts_databases.go b/traffic_stats/influxdb_tools/sync_ts_databases.go
deleted file mode 100644
index 55e6878..0000000
--- a/traffic_stats/influxdb_tools/sync_ts_databases.go
+++ /dev/null
@@ -1,483 +0,0 @@
-/*
-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.
-*/
-
-package main
-
-import (
- "encoding/json"
- "fmt"
- "time"
-
- influx "github.com/influxdata/influxdb/client/v2"
- "github.com/pkg/errors"
- "github.com/urfave/cli"
-)
-
-const (
- cache = "cache_stats"
- deliveryService = "deliveryservice_stats"
- daily = "daily_stats"
-)
-
-type cacheStats struct {
- t string //time
- value float64
- cdn string
- hostname string
- cacheType string
-}
-type deliveryServiceStats struct {
- t string //time
- value float64
- cdn string
- deliveryService string
- cacheGroup string
-}
-type dailyStats struct {
- t string //time
- cdn string
- deliveryService string
- value float64
-}
-
-func syncFlags() []cli.Flag {
- return []cli.Flag{
- cli.StringFlag{
- Name: "sourceUrl",
- Usage: "The source influxdb url and port",
- Value: "http://server1.kabletown.net:8086",
- },
- cli.StringFlag{
- Name: "targetUrl",
- Usage: "The target influxdb url and port",
- Value: "http://server2.kabletown.net:8086",
- },
- cli.StringFlag{
- Name: "database",
- Usage: "Sync a specific database",
- Value: "all",
- },
- cli.IntFlag{
- Name: "days",
- Usage: "Number of days in the past to sync (today - x days), 0 is all",
- Value: 0,
- },
- cli.StringFlag{
- Name: "sourceUser",
- Usage: "The source influxdb username",
- Value: "",
- },
- cli.StringFlag{
- Name: "sourcePass",
- Usage: "The source influxdb password",
- Value: "",
- },
- cli.StringFlag{
- Name: "targetUser",
- Usage: "The target influxdb username",
- Value: "",
- },
- cli.StringFlag{
- Name: "targetPass",
- Usage: "The target influxdb password",
- Value: "",
- },
- }
-}
-
-func sync(c *cli.Context) error {
-
- sourceURL := c.String("sourceUrl")
- targetURL := c.String("targetUrl")
- database := c.String("database")
- days := c.Int("days")
- sourceUser := c.String("sourceUser")
- sourcePass := c.String("sourcePass")
- targetUser := c.String("targetUser")
- targetPass := c.String("targetPass")
- fmt.Printf("syncing %s to %s for %s database(s) for the past %d day(s)\n", sourceURL, targetURL, database, days)
- sourceClient, err := influx.NewHTTPClient(influx.HTTPConfig{
- Addr: sourceURL,
- Username: sourceUser,
- Password: sourcePass,
- })
- if err != nil {
- return errors.Wrap(err, "Error creating influx sourceClient")
- }
-
- if _, _, err = sourceClient.Ping(10); err != nil {
- return errors.Wrap(err, "Error creating influx sourceClient")
- }
-
- targetClient, err := influx.NewHTTPClient(influx.HTTPConfig{
- Addr: targetURL,
- Username: targetUser,
- Password: targetPass,
- })
- if err != nil {
- return errors.Wrap(err, "Error creating influx targetClient")
- }
-
- if _, _, err = targetClient.Ping(10); err != nil {
- return errors.Wrap(err, "Error creating influx targetClient")
- }
-
- chSize := 1
- if database == "all" {
- chSize = 3
- }
-
- ch := make(chan string)
-
- switch database {
- case "all":
- go syncDailyDb(ch, sourceClient, targetClient, days)
- go syncCsDb(ch, sourceClient, targetClient, days)
- go syncDsDb(ch, sourceClient, targetClient, days)
- case cache:
- go syncCsDb(ch, sourceClient, targetClient, days)
- case deliveryService:
- go syncDsDb(ch, sourceClient, targetClient, days)
- case daily:
- go syncDailyDb(ch, sourceClient, targetClient, days)
- default:
- return errors.New("No database selected")
- }
-
- for i := 1; i <= chSize; i++ {
- fmt.Println(<-ch)
- }
-
- fmt.Println("Traffic Stats have been synced!")
- return nil
-}
-
-func syncCsDb(ch chan string, sourceClient influx.Client, targetClient influx.Client, days int) {
- db := cache
- fmt.Printf("Syncing %s database...\n", db)
- stats := [...]string{
- "bandwidth.cdn.1min",
- "connections.cdn.1min",
- "connections.cdn.type.1min",
- "bandwidth.cdn.type.1min",
- //these take a long time so do them last
- "bandwidth.1min",
- "connections.1min",
- //
- }
- for _, statName := range stats {
- fmt.Printf("Syncing %s database with %s \n", db, statName)
- syncCacheStat(sourceClient, targetClient, statName, days)
- fmt.Printf("Done syncing %s\n", statName)
- }
- ch <- fmt.Sprintf("Done syncing %s!\n", db)
-}
-
-func syncDsDb(ch chan string, sourceClient influx.Client, targetClient influx.Client, days int) {
- db := deliveryService
- fmt.Printf("Syncing %s database...\n", db)
- stats := [...]string{
- "kbps.ds.1min",
- "max.kbps.ds.1day",
- "kbps.cg.1min",
- "tps_2xx.ds.1min",
- "tps_3xx.ds.1min",
- "tps_4xx.ds.1min",
- "tps_5xx.ds.1min",
- "tps_total.ds.1min",
- }
- for _, statName := range stats {
- fmt.Printf("Syncing %s database with %s\n", db, statName)
- syncDeliveryServiceStat(sourceClient, targetClient, statName, days)
- }
- ch <- fmt.Sprintf("Done syncing %s!\n", db)
-}
-
-func syncDailyDb(ch chan string, sourceClient influx.Client, targetClient influx.Client, days int) {
- db := daily
- fmt.Printf("Syncing %s database...\n", db)
- stats := [...]string{
- "daily_bytesserved",
- "daily_maxgbps",
- }
-
- for _, statName := range stats {
- fmt.Printf("Syncing %s database with %s\n", db, statName)
- syncDailyStat(sourceClient, targetClient, statName, days)
- }
- ch <- fmt.Sprintf("Done syncing %s!\n", db)
-
-}
-
-func syncCacheStat(sourceClient influx.Client, targetClient influx.Client, statName string, days int) {
- //get records from source DB
- db := cache
- bps, _ := influx.NewBatchPoints(influx.BatchPointsConfig{
- Database: db,
- Precision: "ms",
- RetentionPolicy: "monthly",
- })
-
- queryString := fmt.Sprintf("select time, cdn, hostname, type, value from \"monthly\".\"%s\"", statName)
- if days > 0 {
- queryString = fmt.Sprintf("%s where time > now() - %dd", queryString, days)
- }
- fmt.Println("queryString ", queryString)
- res, err := queryDB(sourceClient, queryString, db)
- if err != nil {
- fmt.Printf("An error occured getting %s records from sourceDb\n", statName)
- return
- }
- sourceStats := getCacheStats(res)
-
- //get values from target DB
- targetRes, err := queryDB(targetClient, queryString, db)
- if err != nil {
- fmt.Printf("An error occured getting %s record from target db: %v\n", statName, err)
- return
- }
- targetStats := getCacheStats(targetRes)
-
- for ssKey := range sourceStats {
- ts := targetStats[ssKey]
- ss := sourceStats[ssKey]
- if ts.value > ss.value {
- //fmt.Printf("target value %v is at least equal to source value %v\n", ts.value, ss.value)
- continue //target value is bigger so leave it
- }
- statTime, _ := time.Parse(time.RFC3339, ss.t)
- tags := map[string]string{"cdn": ss.cdn}
- if ss.hostname != "" {
- tags["hostname"] = ss.hostname
- }
- if ss.cacheType != "" {
- tags["type"] = ss.cacheType
- }
- fields := map[string]interface{}{
- "value": ss.value,
- }
- pt, err := influx.NewPoint(
- statName,
- tags,
- fields,
- statTime,
- )
- if err != nil {
- fmt.Printf("error adding creating point for %v...%v\n", statName, err)
- continue
- }
- bps.AddPoint(pt)
- }
- targetClient.Write(bps)
-}
-
-func syncDeliveryServiceStat(sourceClient influx.Client, targetClient influx.Client, statName string, days int) {
-
- db := deliveryService
- bps, _ := influx.NewBatchPoints(influx.BatchPointsConfig{
- Database: db,
- Precision: "ms",
- RetentionPolicy: "monthly",
- })
-
- queryString := fmt.Sprintf("select time, cachegroup, cdn, deliveryservice, value from \"monthly\".\"%s\"", statName)
- if days > 0 {
- queryString = fmt.Sprintf("%s where time > now() - %dd", queryString, days)
- }
- fmt.Println("queryString ", queryString)
- res, err := queryDB(sourceClient, queryString, db)
- if err != nil {
- fmt.Printf("An error occured getting %s records from sourceDb: %v\n", statName, err)
- return
- }
- sourceStats := getDeliveryServiceStats(res)
- // get value from target DB
- targetRes, err := queryDB(targetClient, queryString, db)
- if err != nil {
- fmt.Printf("An error occured getting %s record from target db: %v\n", statName, err)
- return
- }
- targetStats := getDeliveryServiceStats(targetRes)
-
- for ssKey := range sourceStats {
- ts := targetStats[ssKey]
- ss := sourceStats[ssKey]
- if ts.value > ss.value {
- //fmt.Printf("target value %v is at least equal to source value %v\n", ts.value, ss.value)
- continue //target value is bigger so leave it
- }
- statTime, _ := time.Parse(time.RFC3339, ss.t)
- tags := map[string]string{
- "cdn": ss.cdn,
- "cachegroup": ss.cacheGroup,
- "deliveryservice": ss.deliveryService,
- }
- fields := map[string]interface{}{
- "value": ss.value,
- }
- pt, err := influx.NewPoint(
- statName,
- tags,
- fields,
- statTime,
- )
- if err != nil {
- fmt.Printf("error adding creating point for %v...%v\n", statName, err)
- continue
- }
- bps.AddPoint(pt)
- }
- targetClient.Write(bps)
-}
-
-func syncDailyStat(sourceClient influx.Client, targetClient influx.Client, statName string, days int) {
-
- db := daily
- bps, _ := influx.NewBatchPoints(influx.BatchPointsConfig{
- Database: db,
- Precision: "s",
- })
- //get records from source DB
- queryString := fmt.Sprintf("select time, cdn, deliveryservice, value from \"%s\"", statName)
- if days > 0 {
- queryString = fmt.Sprintf("%s where time > now() - %dd", queryString, days)
- }
- res, err := queryDB(sourceClient, queryString, db)
- if err != nil {
- fmt.Printf("An error occured getting %s records from sourceDb: %v\n", statName, err)
- return
- }
- sourceStats := getDailyStats(res)
- // get value from target DB
- targetRes, err := queryDB(targetClient, queryString, db)
- if err != nil {
- fmt.Printf("An error occured getting %s record from target db: %v\n", statName, err)
- return
- }
- targetStats := getDailyStats(targetRes)
-
- for ssKey := range sourceStats {
- ts := targetStats[ssKey]
- ss := sourceStats[ssKey]
- if ts.value >= ss.value {
- //fmt.Printf("target value %v is at least equal to source value %v\n", ts.value, ss.value)
- continue //target value is bigger or equal so leave it
- }
- statTime, _ := time.Parse(time.RFC3339, ss.t)
- tags := map[string]string{
- "cdn": ss.cdn,
- "deliveryservice": ss.deliveryService,
- }
- fields := map[string]interface{}{
- "value": ss.value,
- }
- pt, err := influx.NewPoint(
- statName,
- tags,
- fields,
- statTime,
- )
- if err != nil {
- fmt.Printf("error adding creating point for %v...%v\n", statName, err)
- continue
- }
- bps.AddPoint(pt)
- }
- targetClient.Write(bps)
-}
-
-func getCacheStats(res []influx.Result) map[string]cacheStats {
- response := make(map[string]cacheStats)
- if res != nil && len(res[0].Series) > 0 {
- for _, row := range res[0].Series {
- for _, record := range row.Values {
- data := new(cacheStats)
- t := record[0].(string)
- data.t = t
- data.cdn = record[1].(string)
- if record[2] != nil {
- data.hostname = record[2].(string)
- }
- if record[3] != nil {
- data.cacheType = record[3].(string)
- }
- var err error
- data.value, err = record[4].(json.Number).Float64()
- if err != nil {
- fmt.Printf("Couldn't parse value from record %v\n", record)
- continue
- }
- key := data.t + data.cdn + data.hostname
- response[key] = *data
- }
- }
- }
- return response
-}
-
-func getDeliveryServiceStats(res []influx.Result) map[string]deliveryServiceStats {
- response := make(map[string]deliveryServiceStats)
- if len(res[0].Series) > 0 {
- for _, row := range res[0].Series {
- for _, record := range row.Values {
- data := new(deliveryServiceStats)
- data.t = record[0].(string)
- if record[1] != nil {
- data.cacheGroup = record[1].(string)
- }
- data.cdn = record[2].(string)
- if record[3] != nil {
- data.deliveryService = record[3].(string)
- }
- var err error
- data.value, err = record[4].(json.Number).Float64()
- if err != nil {
- fmt.Printf("Couldn't parse value from record %v\n", record)
- continue
- }
- key := data.t + data.cacheGroup + data.cdn + data.deliveryService
- response[key] = *data
- }
- }
- }
- return response
-}
-
-func getDailyStats(res []influx.Result) map[string]dailyStats {
- response := make(map[string]dailyStats)
- if len(res) > 0 && len(res[0].Series) > 0 {
- for _, row := range res[0].Series {
- for _, record := range row.Values {
- data := new(dailyStats)
- data.t = record[0].(string)
- data.cdn = record[1].(string)
- data.deliveryService = record[2].(string)
- var err error
- data.value, err = record[3].(json.Number).Float64()
- if err != nil {
- fmt.Printf("Couldn't parse value from record %v\n", record)
- continue
- }
- key := data.t + data.cdn + data.deliveryService
- response[key] = *data
- }
- }
- }
- return response
-}
[28/29] incubator-trafficcontrol git commit: Fix build script to
point to no longer expect ...tools/sync/main.go
Posted by ne...@apache.org.
Fix build script to point to no longer expect ...tools/sync/main.go
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/4436753d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/4436753d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/4436753d
Branch: refs/heads/master
Commit: 4436753d438466bb4912669b649d76d66858c034
Parents: d11ddc2
Author: sbogacz <sb...@zvelo.com>
Authored: Wed Jan 11 22:44:57 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
traffic_stats/build/traffic_stats.spec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4436753d/traffic_stats/build/traffic_stats.spec
----------------------------------------------------------------------
diff --git a/traffic_stats/build/traffic_stats.spec b/traffic_stats/build/traffic_stats.spec
index 2a971c3..cd814ef 100644
--- a/traffic_stats/build/traffic_stats.spec
+++ b/traffic_stats/build/traffic_stats.spec
@@ -75,7 +75,7 @@ godir=src/github.com/apache/incubator-trafficcontrol/traffic_stats/influxdb_tool
( mkdir -p "$godir" && \
cd "$godir" && \
cp -r "$TC_DIR"/traffic_stats/influxdb_tools/* . && \
- go build sync/sync_ts_databases.go sync/main.go
+ go build sync/sync_ts_databases.go
go build create/create_ts_databases.go
) || { echo "Could not build go program at $(pwd): $!"; exit 1; }
[06/29] incubator-trafficcontrol git commit: Refactor influxdb_tools
to be a go buildable executable (e.g. go build -o influxtools) with create
and sync commands. By reducing to a single main function in the package,
we also allow for package level tests
Posted by ne...@apache.org.
Refactor influxdb_tools to be a go buildable executable (e.g. go build -o influxtools) with create and sync commands. By reducing to a single main function in the package, we also allow for package level tests to get the coverage up
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/cae0dd08
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/cae0dd08
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/cae0dd08
Branch: refs/heads/master
Commit: cae0dd086019b16e2f030eea4308bf9b4ec444cf
Parents: 07c1077
Author: sbogacz <sb...@zvelo.com>
Authored: Fri Jan 6 19:10:50 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
.../influxdb_tools/create_ts_databases.go | 82 ++++++----
traffic_stats/influxdb_tools/main.go | 48 ++++++
.../influxdb_tools/sync_ts_databases.go | 150 ++++++++++++-------
3 files changed, 197 insertions(+), 83 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/cae0dd08/traffic_stats/influxdb_tools/create_ts_databases.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/create_ts_databases.go b/traffic_stats/influxdb_tools/create_ts_databases.go
index e065b30..4ee6793 100644
--- a/traffic_stats/influxdb_tools/create_ts_databases.go
+++ b/traffic_stats/influxdb_tools/create_ts_databases.go
@@ -20,45 +20,75 @@ under the License.
package main
import (
- "flag"
"fmt"
- "os"
influx "github.com/influxdata/influxdb/client/v2"
+ "github.com/pkg/errors"
+ "github.com/urfave/cli"
)
-func main() {
+func createFlags() []cli.Flag {
+ return []cli.Flag{
+ cli.StringFlag{
+ Name: "url",
+ Usage: "The influxdb url and port",
+ Value: "http://localhost:8086",
+ },
+ cli.IntFlag{
+ Name: "replication",
+ Usage: "The number of nodes in the cluster",
+ Value: 3,
+ },
+ cli.StringFlag{
+ Name: "user",
+ Usage: "The influxdb username used to create DBs",
+ Value: "",
+ },
+ cli.StringFlag{
+ Name: "password",
+ Usage: "The influxdb password used to create DBs",
+ Value: "",
+ },
+ }
+}
- influxURL := flag.String("url", "http://localhost:8086", "The influxdb url and port")
- replication := flag.String("replication", "3", "The number of nodes in the cluster")
- user := flag.String("user", "", "The influxdb username used to create DBs")
- password := flag.String("password", "", "The influxdb password used to create DBs")
- flag.Parse()
- fmt.Printf("creating datbases for influxUrl: %v with a replication of %v using user %s\n", *influxURL, *replication, *user)
+func create(c *cli.Context) error {
+ influxURL := c.String("url")
+ replication := c.Int("replication")
+ user := c.String("user")
+ password := c.String("password")
+
+ fmt.Printf("creating datbases for influxUrl: %s with a replication of %d using user %s\n", influxURL, replication, user)
client, err := influx.NewHTTPClient(influx.HTTPConfig{
- Addr: *influxURL,
- Username: *user,
- Password: *password,
+ Addr: influxURL,
+ Username: user,
+ Password: password,
})
if err != nil {
- fmt.Printf("Error creating influx client: %v\n", err)
- os.Exit(1)
+ return errors.Wrap(err, "Error creating influx client")
}
_, _, err = client.Ping(10)
if err != nil {
- fmt.Printf("Error creating influx client: %v\n", err)
- os.Exit(1)
+ return errors.Wrap(err, "Error creating influx client")
}
createCacheStats(client, replication)
createDailyStats(client, replication)
createDeliveryServiceStats(client, replication)
+ return nil
}
-func queryDB(client influx.Client, cmd string) (res []influx.Result, err error) {
+// queryDB takes a variadic argument for the target database so as to make
+// passing the variable optional, however, if passed, only the first db passed
+// in will be used
+func queryDB(client influx.Client, cmd string, dbs ...string) (res []influx.Result, err error) {
+ db := ""
+ if len(dbs) > 0 {
+ db = dbs[0]
+ }
q := influx.Query{
Command: cmd,
- Database: "",
+ Database: db,
}
if response, err := client.Query(q); err == nil {
if response.Error() != nil {
@@ -69,8 +99,8 @@ func queryDB(client influx.Client, cmd string) (res []influx.Result, err error)
return res, nil
}
-func createCacheStats(client influx.Client, replication *string) {
- db := "cache_stats"
+func createCacheStats(client influx.Client, replication int) {
+ db := cache
createDatabase(client, db)
createRetentionPolicy(client, db, "daily", "26h", replication, true)
createRetentionPolicy(client, db, "monthly", "30d", replication, false)
@@ -87,8 +117,8 @@ func createCacheStats(client influx.Client, replication *string) {
createContinuousQuery(client, "wrap_count_vol2_1m", `CREATE CONTINUOUS QUERY wrap_count_vol2_1m ON cache_stats RESAMPLE FOR 2m BEGIN SELECT mean(value) AS vol2_wrap_count INTO cache_stats.monthly."wrap_count.1min" FROM cache_stats.daily."ats.proxy.process.cache.volume_2.wrap_count" GROUP BY time(1m), * END`)
}
-func createDeliveryServiceStats(client influx.Client, replication *string) {
- db := "deliveryservice_stats"
+func createDeliveryServiceStats(client influx.Client, replication int) {
+ db := deliveryService
createDatabase(client, db)
createRetentionPolicy(client, db, "daily", "26h", replication, true)
createRetentionPolicy(client, db, "monthly", "30d", replication, false)
@@ -103,8 +133,8 @@ func createDeliveryServiceStats(client influx.Client, replication *string) {
createContinuousQuery(client, "max_kbps_ds_1day", `CREATE CONTINUOUS QUERY max_kbps_ds_1day ON deliveryservice_stats RESAMPLE FOR 2d BEGIN SELECT max(value) AS "value" INTO "deliveryservice_stats"."indefinite"."max.kbps.ds.1day" FROM "deliveryservice_stats"."monthly"."kbps.ds.1min" GROUP BY time(1d), deliveryservice, cdn END`)
}
-func createDailyStats(client influx.Client, replication *string) {
- db := "daily_stats"
+func createDailyStats(client influx.Client, replication int) {
+ db := daily
createDatabase(client, db)
createRetentionPolicy(client, db, "indefinite", "INF", replication, true)
}
@@ -118,8 +148,8 @@ func createDatabase(client influx.Client, db string) {
fmt.Println("Successfully created database: ", db)
}
-func createRetentionPolicy(client influx.Client, db string, name string, duration string, replication *string, isDefault bool) {
- qString := fmt.Sprintf("CREATE RETENTION POLICY %s ON %s DURATION %s REPLICATION %s", name, db, duration, *replication)
+func createRetentionPolicy(client influx.Client, db string, name string, duration string, replication int, isDefault bool) {
+ qString := fmt.Sprintf("CREATE RETENTION POLICY %s ON %s DURATION %s REPLICATION %d", name, db, duration, replication)
if isDefault {
qString += " DEFAULT"
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/cae0dd08/traffic_stats/influxdb_tools/main.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/main.go b/traffic_stats/influxdb_tools/main.go
new file mode 100644
index 0000000..06fc3ef
--- /dev/null
+++ b/traffic_stats/influxdb_tools/main.go
@@ -0,0 +1,48 @@
+/*
+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.
+*/
+
+package main
+
+import (
+ "os"
+
+ "github.com/urfave/cli"
+)
+
+func main() {
+ app := cli.NewApp()
+ app.Name = "influx-tools"
+ app.Version = "0.1.0"
+ app.Usage = "influx-tools provides cli methods for creating and syncing the requisite influxdb databases"
+ app.Commands = []cli.Command{
+ cli.Command{
+ Name: "create",
+ Usage: "create the influxDB tables",
+ Action: create,
+ Flags: createFlags(),
+ },
+ cli.Command{
+ Name: "sync",
+ Usage: "sync the influxDB tables",
+ Action: sync,
+ Flags: syncFlags(),
+ },
+ }
+ app.Run(os.Args)
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/cae0dd08/traffic_stats/influxdb_tools/sync_ts_databases.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/sync_ts_databases.go b/traffic_stats/influxdb_tools/sync_ts_databases.go
index 50096ec..29f8083 100644
--- a/traffic_stats/influxdb_tools/sync_ts_databases.go
+++ b/traffic_stats/influxdb_tools/sync_ts_databases.go
@@ -21,12 +21,12 @@ package main
import (
"encoding/json"
- "flag"
"fmt"
- "os"
"time"
influx "github.com/influxdata/influxdb/client/v2"
+ "github.com/pkg/errors"
+ "github.com/urfave/cli"
)
const (
@@ -58,80 +58,116 @@ type dailyStats struct {
var errorMessage string
-func main() {
-
- sourceURL := flag.String("sourceUrl", "http://server1.kabletown.net:8086", "The influxdb url and port")
- targetURL := flag.String("targetUrl", "http://server2.kabletown.net:8086", "The influxdb url and port")
- database := flag.String("database", "all", "Sync a specific database")
- days := flag.Int("days", 0, "Number of days in the past to sync (today - x days), 0 is all")
- sourceUser := flag.String("sourceUser", "", "The source influxdb username")
- sourcePass := flag.String("sourcePass", "", "The source influxdb password")
- targetUser := flag.String("targetUser", "", "The target influxdb username")
- targetPass := flag.String("targetPass", "", "The target influxdb password")
- flag.Parse()
- fmt.Printf("syncing %v to %v for %v database(s) for the past %v day(s)\n", *sourceURL, *targetURL, *database, *days)
+func syncFlags() []cli.Flag {
+ return []cli.Flag{
+ cli.StringFlag{
+ Name: "sourceUrl",
+ Usage: "The source influxdb url and port",
+ Value: "http://server1.kabletown.net:8086",
+ },
+ cli.StringFlag{
+ Name: "targetUrl",
+ Usage: "The target influxdb url and port",
+ Value: "http://server2.kabletown.net:8086",
+ },
+ cli.StringFlag{
+ Name: "database",
+ Usage: "Sync a specific database",
+ Value: "all",
+ },
+ cli.IntFlag{
+ Name: "days",
+ Usage: "Number of days in the past to sync (today - x days), 0 is all",
+ Value: 0,
+ },
+ cli.StringFlag{
+ Name: "sourceUser",
+ Usage: "The source influxdb username",
+ Value: "",
+ },
+ cli.StringFlag{
+ Name: "sourcePass",
+ Usage: "The source influxdb password",
+ Value: "",
+ },
+ cli.StringFlag{
+ Name: "targetUser",
+ Usage: "The target influxdb username",
+ Value: "",
+ },
+ cli.StringFlag{
+ Name: "targetPass",
+ Usage: "The target influxdb password",
+ Value: "",
+ },
+ }
+}
+
+func sync(c *cli.Context) error {
+
+ sourceURL := c.String("sourceUrl")
+ targetURL := c.String("targetUrl")
+ database := c.String("database")
+ days := c.Int("days")
+ sourceUser := c.String("sourceUser")
+ sourcePass := c.String("sourcePass")
+ targetUser := c.String("targetUser")
+ targetPass := c.String("targetPass")
+ fmt.Printf("syncing %s to %s for %s database(s) for the past %d day(s)\n", sourceURL, targetURL, database, days)
sourceClient, err := influx.NewHTTPClient(influx.HTTPConfig{
- Addr: *sourceURL,
- Username: *sourceUser,
- Password: *sourcePass,
+ Addr: sourceURL,
+ Username: sourceUser,
+ Password: sourcePass,
})
if err != nil {
- errorMessage = fmt.Sprintf("Error creating influx sourceClient: %v\n", err)
- fmt.Println(errorMessage)
- os.Exit(1)
+ return errors.Wrap(err, "Error creating influx sourceClient")
}
- _, _, err = sourceClient.Ping(10)
- if err != nil {
- errorMessage = fmt.Sprintf("Error creating influx sourceClient: %v\n", err)
- fmt.Println(errorMessage)
- os.Exit(1)
+
+ if _, _, err = sourceClient.Ping(10); err != nil {
+ return errors.Wrap(err, "Error creating influx sourceClient")
}
+
targetClient, err := influx.NewHTTPClient(influx.HTTPConfig{
- Addr: *targetURL,
- Username: *targetUser,
- Password: *targetPass,
+ Addr: targetURL,
+ Username: targetUser,
+ Password: targetPass,
})
if err != nil {
- errorMessage = fmt.Sprintf("Error creating influx targetClient: %v\n", err)
- fmt.Println(errorMessage)
- os.Exit(1)
+ return errors.Wrap(err, "Error creating influx targetClient")
}
- _, _, err = targetClient.Ping(10)
- if err != nil {
- errorMessage = fmt.Sprintf("Error creating influx targetClient: %v\n", err)
- fmt.Println(errorMessage)
- os.Exit(1)
+
+ if _, _, err = targetClient.Ping(10); err != nil {
+ return errors.Wrap(err, "Error creating influx targetClient")
}
+
chSize := 1
- if *database == "all" {
+ if database == "all" {
chSize = 3
}
ch := make(chan string)
- switch *database {
+ switch database {
case "all":
- go syncDailyDb(ch, sourceClient, targetClient, *days)
- go syncCsDb(ch, sourceClient, targetClient, *days)
- go syncDsDb(ch, sourceClient, targetClient, *days)
+ go syncDailyDb(ch, sourceClient, targetClient, days)
+ go syncCsDb(ch, sourceClient, targetClient, days)
+ go syncDsDb(ch, sourceClient, targetClient, days)
case cache:
- go syncCsDb(ch, sourceClient, targetClient, *days)
+ go syncCsDb(ch, sourceClient, targetClient, days)
case deliveryService:
- go syncDsDb(ch, sourceClient, targetClient, *days)
+ go syncDsDb(ch, sourceClient, targetClient, days)
case daily:
- go syncDailyDb(ch, sourceClient, targetClient, *days)
+ go syncDailyDb(ch, sourceClient, targetClient, days)
+ default:
+ return errors.New("No database selected")
}
for i := 1; i <= chSize; i++ {
fmt.Println(<-ch)
}
- if errorMessage != "" {
- fmt.Println(errorMessage)
- return
- }
-
- fmt.Println("Traffic Stats has been synced!")
+ fmt.Println("Traffic Stats have been synced!")
+ return nil
}
func syncCsDb(ch chan string, sourceClient influx.Client, targetClient influx.Client, days int) {
@@ -191,7 +227,7 @@ func syncDailyDb(ch chan string, sourceClient influx.Client, targetClient influx
}
-func queryDB(client influx.Client, cmd string, db string) (res []influx.Result, err error) {
+func queryDb2(client influx.Client, cmd string, db string) (res []influx.Result, err error) {
q := influx.Query{
Command: cmd,
Database: db,
@@ -219,7 +255,7 @@ func syncCacheStat(sourceClient influx.Client, targetClient influx.Client, statN
queryString = fmt.Sprintf("%s where time > now() - %dd", queryString, days)
}
fmt.Println("queryString ", queryString)
- res, err := queryDB(sourceClient, queryString, db)
+ res, err := queryDb2(sourceClient, queryString, db)
if err != nil {
fmt.Printf("An error occured getting %s records from sourceDb\n", statName)
return
@@ -227,7 +263,7 @@ func syncCacheStat(sourceClient influx.Client, targetClient influx.Client, statN
sourceStats := getCacheStats(res)
//get values from target DB
- targetRes, err := queryDB(targetClient, queryString, db)
+ targetRes, err := queryDb2(targetClient, queryString, db)
if err != nil {
errorMessage = fmt.Sprintf("An error occured getting %s record from target db: %v\n", statName, err)
fmt.Println(errorMessage)
@@ -282,7 +318,7 @@ func syncDeliveryServiceStat(sourceClient influx.Client, targetClient influx.Cli
queryString = fmt.Sprintf("%s where time > now() - %dd", queryString, days)
}
fmt.Println("queryString ", queryString)
- res, err := queryDB(sourceClient, queryString, db)
+ res, err := queryDb2(sourceClient, queryString, db)
if err != nil {
errorMessage = fmt.Sprintf("An error occured getting %s records from sourceDb: %v\n", statName, err)
fmt.Println(errorMessage)
@@ -290,7 +326,7 @@ func syncDeliveryServiceStat(sourceClient influx.Client, targetClient influx.Cli
}
sourceStats := getDeliveryServiceStats(res)
// get value from target DB
- targetRes, err := queryDB(targetClient, queryString, db)
+ targetRes, err := queryDb2(targetClient, queryString, db)
if err != nil {
errorMessage = fmt.Sprintf("An error occured getting %s record from target db: %v\n", statName, err)
fmt.Println(errorMessage)
@@ -341,7 +377,7 @@ func syncDailyStat(sourceClient influx.Client, targetClient influx.Client, statN
if days > 0 {
queryString = fmt.Sprintf("%s where time > now() - %dd", queryString, days)
}
- res, err := queryDB(sourceClient, queryString, db)
+ res, err := queryDb2(sourceClient, queryString, db)
if err != nil {
errorMessage = fmt.Sprintf("An error occured getting %s records from sourceDb: %v\n", statName, err)
fmt.Println(errorMessage)
@@ -349,7 +385,7 @@ func syncDailyStat(sourceClient influx.Client, targetClient influx.Client, statN
}
sourceStats := getDailyStats(res)
// get value from target DB
- targetRes, err := queryDB(targetClient, queryString, db)
+ targetRes, err := queryDb2(targetClient, queryString, db)
if err != nil {
errorMessage = fmt.Sprintf("An error occured getting %s record from target db: %v\n", statName, err)
fmt.Println(errorMessage)
[17/29] incubator-trafficcontrol git commit: Add vendor directory
with current dependencies
Posted by ne...@apache.org.
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")
+ }
+}
[02/29] incubator-trafficcontrol git commit: Remove go get line for
influx now that we are vendoring
Posted by ne...@apache.org.
Remove go get line for influx now that we are vendoring
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/926f31e8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/926f31e8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/926f31e8
Branch: refs/heads/master
Commit: 926f31e8bdc85743b5fcef696232610a54384a81
Parents: 4df63f3
Author: sbogacz <sb...@zvelo.com>
Authored: Fri Jan 13 14:05:12 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
traffic_stats/build/traffic_stats.spec | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/926f31e8/traffic_stats/build/traffic_stats.spec
----------------------------------------------------------------------
diff --git a/traffic_stats/build/traffic_stats.spec b/traffic_stats/build/traffic_stats.spec
index cd814ef..24f75d5 100644
--- a/traffic_stats/build/traffic_stats.spec
+++ b/traffic_stats/build/traffic_stats.spec
@@ -66,7 +66,6 @@ oldpwd=$(pwd)
cd "$godir" && \
cp -r "$TC_DIR"/traffic_stats/* . && \
go get -d -v && \
- go_get_version "$oldpwd"/src/github.com/influxdata/influxdb v1.0.1 && \
go install -v \
) || { echo "Could not build go program at $(pwd): $!"; exit 1; }
[26/29] incubator-trafficcontrol git commit: Update vendor going more
thoroughly through deps recursively... some cleanup may be called for in a
follow up PR
Posted by ne...@apache.org.
Update vendor going more thoroughly through deps recursively... some cleanup may be called for in a follow up PR
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/4df63f3a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/4df63f3a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/4df63f3a
Branch: refs/heads/master
Commit: 4df63f3a04703ffb688da1281529dcb2661cdfe0
Parents: 4436753
Author: sbogacz <sb...@zvelo.com>
Authored: Fri Jan 13 12:24:00 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
.../apache/incubator-trafficcontrol/DISCLAIMER | 1 +
.../apache/incubator-trafficcontrol/LICENSE | 843 ++
.../apache/incubator-trafficcontrol/NOTICE | 14 +
.../client/delivery_service_endpoints_test.go | 130 -
.../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 -
.../github.com/influxdata/influxdb/LICENSE | 20 +
.../influxdb/LICENSE_OF_DEPENDENCIES.md | 25 +
.../influxdata/influxdb/client/v2/client.go | 2 +-
.../influxdb/client/v2/client_test.go | 525 -
.../influxdb/client/v2/example_test.go | 265 -
.../influxdata/influxdb/models/consistency.go | 48 +
.../influxdata/influxdb/models/inline_fnv.go | 32 +
.../influxdb/models/inline_strconv_parse.go | 38 +
.../influxdata/influxdb/models/points.go | 1997 ++++
.../influxdata/influxdb/models/rows.go | 62 +
.../influxdata/influxdb/models/statistic.go | 42 +
.../influxdata/influxdb/models/time.go | 74 +
.../influxdata/influxdb/pkg/escape/bytes.go | 111 +
.../influxdata/influxdb/pkg/escape/strings.go | 21 +
.../github.com/jheitz200/test_helper/http.go | 44 +
.../github.com/jheitz200/test_helper/test.go | 66 +
.../vendor/github.com/juju/go4/LICENSE | 202 +
.../vendor/github.com/juju/go4/lock/.gitignore | 1 +
.../vendor/github.com/juju/go4/lock/lock.go | 186 +
.../github.com/juju/go4/lock/lock_appengine.go | 32 +
.../juju/go4/lock/lock_darwin_amd64.go | 67 +
.../github.com/juju/go4/lock/lock_freebsd.go | 66 +
.../juju/go4/lock/lock_linux_amd64.go | 67 +
.../github.com/juju/go4/lock/lock_linux_arm.go | 68 +
.../github.com/juju/go4/lock/lock_plan9.go | 41 +
.../github.com/juju/go4/lock/lock_sigzero.go | 26 +
.../juju/persistent-cookiejar/LICENSE | 27 +
.../juju/persistent-cookiejar/README.md | 120 +
.../juju/persistent-cookiejar/dependencies.tsv | 4 +
.../github.com/juju/persistent-cookiejar/jar.go | 680 ++
.../juju/persistent-cookiejar/punycode.go | 159 +
.../juju/persistent-cookiejar/serialize.go | 152 +
.../vendor/github.com/pkg/errors/.gitignore | 24 +
.../vendor/github.com/pkg/errors/.travis.yml | 11 +
.../vendor/github.com/pkg/errors/LICENSE | 23 +
.../vendor/github.com/pkg/errors/README.md | 52 +
.../vendor/github.com/pkg/errors/appveyor.yml | 32 +
.../vendor/github.com/pkg/errors/errors.go | 269 +
.../vendor/github.com/pkg/errors/stack.go | 178 +
traffic_stats/vendor/golang.org/x/net/LICENSE | 27 +
traffic_stats/vendor/golang.org/x/net/PATENTS | 22 +
.../vendor/golang.org/x/net/publicsuffix/gen.go | 713 ++
.../golang.org/x/net/publicsuffix/list.go | 135 +
.../golang.org/x/net/publicsuffix/table.go | 9074 ++++++++++++++++++
traffic_stats/vendor/gopkg.in/errgo.v1/LICENSE | 26 +
.../vendor/gopkg.in/errgo.v1/README.md | 259 +
.../vendor/gopkg.in/errgo.v1/errors.go | 389 +
traffic_stats/vendor/gopkg.in/retry.v1/LICENSE | 186 +
.../vendor/gopkg.in/retry.v1/README.md | 202 +
traffic_stats/vendor/gopkg.in/retry.v1/clock.go | 23 +
traffic_stats/vendor/gopkg.in/retry.v1/exp.go | 50 +
.../vendor/gopkg.in/retry.v1/regular.go | 65 +
traffic_stats/vendor/gopkg.in/retry.v1/retry.go | 156 +
.../vendor/gopkg.in/retry.v1/strategy.go | 60 +
72 files changed, 17313 insertions(+), 3176 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/DISCLAIMER
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/DISCLAIMER b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/DISCLAIMER
new file mode 100644
index 0000000..0c91830
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/DISCLAIMER
@@ -0,0 +1 @@
+Apache Traffic Control is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/LICENSE
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/LICENSE b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/LICENSE
new file mode 100644
index 0000000..7da3bb4
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/LICENSE
@@ -0,0 +1,843 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
+
+APACHE TRAFFICCONTROL SUBCOMPONENTS:
+
+Apache TrafficControl includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+For the sphinx_rtd_theme component:
+
+The MIT License (MIT)
+
+Copyright (c) 2013 Dave Snider
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+For the fontawesome component:
+
+/*
+ * Font Awesome 4.2.0 by @davegandy - http://fontawesome.io - @fontawesome
+ * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
+ */
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
+
+
+For the bootstrap component:
+
+/*!
+ * Bootstrap v3.2.0 (http://getbootstrap.com)
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ */
+
+The MIT License (MIT)
+
+Copyright (c) 2011-2016 Twitter, Inc.
+Copyright (c) 2011-2016 The Bootstrap Authors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+For the sorttable component:
+
+/*
+ SortTable
+ version 2
+ 7th April 2007
+ Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
+
+ Instructions:
+ Download this file
+ Add <script src="sorttable.js"></script> to your HTML
+ Add class="sortable" to any table you'd like to make sortable
+ Click on the headers to sort
+
+ Thanks to many, many people for contributions and suggestions.
+ Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
+ This basically means: do what you want with it.
+*/
+
+The MIT Licence, for code from kryogenix.org
+
+Code downloaded from the Browser Experiments section of kryogenix.org is licenced under the so-called MIT licence. The licence is below.
+
+Copyright (c) 1997-date Stuart Langridge
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+For the jquery component:
+
+Copyright jQuery Foundation and other contributors, https://jquery.org/
+
+This software consists of voluntary contributions made by many
+individuals. For exact contribution history, see the revision history
+available at https://github.com/jquery/jquery-ui
+
+The following license applies to all parts of this software except as
+documented below:
+
+====
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+====
+
+Copyright and related rights for sample code are waived via CC0. Sample
+code is defined as all source code contained within the demos directory.
+
+CC0: http://creativecommons.org/publicdomain/zero/1.0/
+
+====
+
+All files located in the node_modules and external directories are
+externally maintained libraries used by this software which have their
+own licenses; we recommend you read them, as their terms may differ from
+the terms above.
+
+For the jMenu component:
+
+/************************************************************************
+*************************************************************************
+@Name : jMenu - jQuery Plugin
+@Revison : 2.0
+@Date : 08/2013
+@Author : ALPIXEL - (www.myjqueryplugins.com - www.alpixel.fr)
+@Support : FF, IE7, IE8, MAC Firefox, MAC Safari
+@License : Open Source - MIT License : http://www.opensource.org/licenses/mit-license.php
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+**************************************************************************
+*************************************************************************/
+
+For the crossfilter component:
+
+Copyright 2012 Square, Inc.
+
+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.
+
+For the DataTables component:
+
+/**
+ * @summary DataTables
+ * @description Paginate, search and order HTML tables
+ * @version 1.10.4
+ * @file jquery.dataTables.js
+ * @author SpryMedia Ltd (www.sprymedia.co.uk)
+ * @contact www.sprymedia.co.uk/contact
+ * @copyright Copyright 2008-2014 SpryMedia Ltd.
+ *
+ * This source file is free software, available under the following license:
+ * MIT license - http://datatables.net/license
+ *
+ * This source file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
+ *
+ * For details please refer to: http://www.datatables.net
+ */
+
+Copyright (c) 2008-2015 SpryMedia Limited
+http://datatables.net
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+
+For the percentagebar component:
+
+/* WebAppers Progress Bar, version 0.2
+* (c) 2007 Ray Cheung
+*
+* WebAppers Progress Bar is freely distributable under the terms of an Creative Commons license.
+* For details, see the WebAppers web site: http://wwww.Webappers.com/
+*
+/*--------------------------------------------------------------------------*/
+
+For the ng-map component:
+
+/**
+ * AngularJS Google Maps Ver. 1.17.3
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2014, 2015, 1016 Allen Kim
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+For the underscore component:
+
+// Underscore.js 1.8.3
+// http://underscorejs.org
+// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+// Underscore may be freely distributed under the MIT license.
+
+Copyright (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative
+Reporters & Editors
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For the selenium component:
+
+Copyright (c) 2012-2016 Miki Tebeka <mi...@gmail.com>.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+For the gmx component:
+
+Copyright (c) 2012, David Cheney
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+Redistributions in binary form must reproduce the above copyright notice, this
+list of conditions and the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+For the stoppableListener component:
+
+Copyright (c) 2014, Eric Urban
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.Copyright
+(c) 2012 The Go Authors. All rights reserved.
+
+
+For the fsnotify component:
+
+Copyright (c) 2012 fsnotify Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+For the jwt-go component:
+
+Copyright (c) 2012 Dave Grijalva
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+For the pq component:
+
+Copyright (c) 2011-2013, 'pq' Contributors
+Portions Copyright (C) 2011 Blake Mizerany
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+For the MaxMind DB GeoLite2 Database:
+Creative Commons Attribution-ShareAlike 4.0 International Public License
+
+By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
+
+Section 1 \u2013 Definitions.
+
+Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
+Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
+BY-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License.
+Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
+Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
+Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
+License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution and ShareAlike.
+Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
+Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
+Licensor means the individual(s) or entity(ies) granting rights under this Public License.
+Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
+Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
+You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
+Section 2 \u2013 Scope.
+
+License grant.
+Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
+reproduce and Share the Licensed Material, in whole or in part; and
+produce, reproduce, and Share Adapted Material.
+Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
+Term. The term of this Public License is specified in Section 6(a).
+Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
+Downstream recipients.
+Offer from the Licensor \u2013 Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
+Additional offer from the Licensor \u2013 Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter\u2019s License You apply.
+No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
+No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
+Other rights.
+
+Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
+Patent and trademark rights are not licensed under this Public License.
+To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties.
+Section 3 \u2013 License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the following conditions.
+
+Attribution.
+
+If You Share the Licensed Material (including in modified form), You must:
+
+retain the following if it is supplied by the Licensor with the Licensed Material:
+identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
+a copyright notice;
+a notice that refers to this Public License;
+a notice that refers to the disclaimer of warranties;
+a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
+indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
+indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
+You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
+If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
+ShareAlike.
+In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
+
+The Adapter\u2019s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-SA Compatible License.
+You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
+You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
+Section 4 \u2013 Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
+
+for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database;
+if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
+You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
+For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
+Section 5 \u2013 Disclaimer of Warranties and Limitation of Liability.
+
+Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
+To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
+The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
+Section 6 \u2013 Term and Termination.
+
+This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
+Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
+
+automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
+upon express reinstatement by the Licensor.
+For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
+For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
+Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
+Section 7 \u2013 Other Terms and Conditions.
+
+The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
+Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
+Section 8 \u2013 Interpretation.
+
+For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
+To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
+No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
+Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/NOTICE
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/NOTICE b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/NOTICE
new file mode 100644
index 0000000..49bd157
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/NOTICE
@@ -0,0 +1,14 @@
+Apache Traffic Control (incubating)
+Copyright 2016 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Portions of this software were developed at
+Comcast (http://www.comcast.com/).
+
+Portions of this software were developed at
+Cisco Systems, Inc. (http://www.cisco.com)
+
+This product includes GeoLite2 data created by MaxMind, available from
+<a href="http://www.maxmind.com">http://www.maxmind.com</a>.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/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
deleted file mode 100644
index f698b72..0000000
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/delivery_service_endpoints_test.go
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-
- 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/4df63f3a/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
deleted file mode 100644
index aa343a4..0000000
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/cachegroup_test.go
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
-
- 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")
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/cdn_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/cdn_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/cdn_test.go
deleted file mode 100644
index bec59a0..0000000
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/cdn_test.go
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-
- 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 TestCDNs(t *testing.T) {
- resp := fixtures.CDNs()
- 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 CDNs")
-
- cdns, err := to.CDNs()
- 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")
- }
-
- for _, cdn := range cdns {
- if cdn.Name != "CDN-1" {
- testHelper.Error(t, "Should get back \"CDN-1\" for \"name\", got %s", cdn.Name)
- } else {
- testHelper.Success(t, "Should get back \"CDN-1\" for \"name\"")
- }
-
- if cdn.LastUpdated != "2016-03-22 17:00:30" {
- testHelper.Error(t, "Should get back \"2016-03-22 17:00:30\" for \"LastUpdated\", got %s", cdn.LastUpdated)
- } else {
- testHelper.Success(t, "Should get back \"2016-03-22 17:00:30\" for \"LastUpdated\"")
- }
- }
-}
-
-func TestCDNsUnauthorized(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 CDNs")
-
- _, err := to.CDNs()
- 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")
- }
-}
-
-func TestCDNName(t *testing.T) {
- resp := fixtures.CDNs()
- server := testHelper.ValidHTTPServer(resp)
- defer server.Close()
-
- var httpClient http.Client
- to := client.Session{
- URL: server.URL,
- UserAgent: &httpClient,
- }
-
- cdn := "CDN-1"
- testHelper.Context(t, "Given the need to test a successful Traffic Ops request for CDN: \"%s\"", cdn)
-
- cdns, err := to.CDNName(cdn)
- 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")
- }
-
- for _, cdn := range cdns {
- if cdn.Name != "CDN-1" {
- testHelper.Error(t, "Should get back \"CDN-1\" for \"name\", got %s", cdn.Name)
- } else {
- testHelper.Success(t, "Should get back \"CDN-1\" for \"name\"")
- }
-
- if cdn.LastUpdated != "2016-03-22 17:00:30" {
- testHelper.Error(t, "Should get back \"2016-03-22 17:00:30\" for \"LastUpdated\", got %s", cdn.LastUpdated)
- } else {
- testHelper.Success(t, "Should get back \"2016-03-22 17:00:30\" for \"LastUpdated\"")
- }
- }
-}
-
-func TestCDNNameUnauthorized(t *testing.T) {
- server := testHelper.InvalidHTTPServer(http.StatusUnauthorized)
- defer server.Close()
-
- var httpClient http.Client
- to := client.Session{
- URL: server.URL,
- UserAgent: &httpClient,
- }
-
- cdn := "CDN-1"
- testHelper.Context(t, "Given the need to test a failed Traffic Ops request for CDN: \"%s\"", cdn)
-
- _, err := to.CDNName(cdn)
- 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")
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/conf/seelog.xml.test
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/conf/seelog.xml.test b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/conf/seelog.xml.test
deleted file mode 100644
index 08facaf..0000000
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/conf/seelog.xml.test
+++ /dev/null
@@ -1,9 +0,0 @@
-<seelog>
- <outputs formatid="main">
- <file path="logs/test.log" />
- </outputs>
-
- <formats>
- <format id="main" format="[%Level] %Date(2006/01/02 15:04:05.0000) %File:%Line %FuncShort: %Msg%n"/>
- </formats>
-</seelog>
[05/29] incubator-trafficcontrol git commit: Clean up linter warnings,
and use only one method of string concatenation per line
Posted by ne...@apache.org.
Clean up linter warnings, and use only one method of string concatenation per line
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/07c1077a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/07c1077a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/07c1077a
Branch: refs/heads/master
Commit: 07c1077ac3ce5925ab554c865eaf2f70273fe311
Parents: 12d80e1
Author: sbogacz <sb...@zvelo.com>
Authored: Fri Jan 6 17:06:43 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
.../influxdb_tools/sync_ts_databases.go | 31 ++++++++++++--------
1 file changed, 19 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/07c1077a/traffic_stats/influxdb_tools/sync_ts_databases.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/sync_ts_databases.go b/traffic_stats/influxdb_tools/sync_ts_databases.go
index 739478a..50096ec 100644
--- a/traffic_stats/influxdb_tools/sync_ts_databases.go
+++ b/traffic_stats/influxdb_tools/sync_ts_databases.go
@@ -29,6 +29,12 @@ import (
influx "github.com/influxdata/influxdb/client/v2"
)
+const (
+ cache = "cache_stats"
+ deliveryService = "deliveryservice_stats"
+ daily = "daily_stats"
+)
+
type cacheStats struct {
t string //time
value float64
@@ -108,11 +114,11 @@ func main() {
go syncDailyDb(ch, sourceClient, targetClient, *days)
go syncCsDb(ch, sourceClient, targetClient, *days)
go syncDsDb(ch, sourceClient, targetClient, *days)
- case "cache_stats":
+ case cache:
go syncCsDb(ch, sourceClient, targetClient, *days)
- case "deliveryservice_stats":
+ case deliveryService:
go syncDsDb(ch, sourceClient, targetClient, *days)
- case "daily_stats":
+ case daily:
go syncDailyDb(ch, sourceClient, targetClient, *days)
}
@@ -129,7 +135,7 @@ func main() {
}
func syncCsDb(ch chan string, sourceClient influx.Client, targetClient influx.Client, days int) {
- db := "cache_stats"
+ db := cache
fmt.Printf("Syncing %s database...\n", db)
stats := [...]string{
"bandwidth.cdn.1min",
@@ -150,7 +156,7 @@ func syncCsDb(ch chan string, sourceClient influx.Client, targetClient influx.Cl
}
func syncDsDb(ch chan string, sourceClient influx.Client, targetClient influx.Client, days int) {
- db := "deliveryservice_stats"
+ db := deliveryService
fmt.Printf("Syncing %s database...\n", db)
stats := [...]string{
"kbps.ds.1min",
@@ -170,7 +176,7 @@ func syncDsDb(ch chan string, sourceClient influx.Client, targetClient influx.Cl
}
func syncDailyDb(ch chan string, sourceClient influx.Client, targetClient influx.Client, days int) {
- db := "daily_stats"
+ db := daily
fmt.Printf("Syncing %s database...\n", db)
stats := [...]string{
"daily_bytesserved",
@@ -201,7 +207,7 @@ func queryDB(client influx.Client, cmd string, db string) (res []influx.Result,
func syncCacheStat(sourceClient influx.Client, targetClient influx.Client, statName string, days int) {
//get records from source DB
- db := "cache_stats"
+ db := cache
bps, _ := influx.NewBatchPoints(influx.BatchPointsConfig{
Database: db,
Precision: "ms",
@@ -210,7 +216,7 @@ func syncCacheStat(sourceClient influx.Client, targetClient influx.Client, statN
queryString := fmt.Sprintf("select time, cdn, hostname, type, value from \"monthly\".\"%s\"", statName)
if days > 0 {
- queryString += fmt.Sprintf(" where time > now() - %dd", days)
+ queryString = fmt.Sprintf("%s where time > now() - %dd", queryString, days)
}
fmt.Println("queryString ", queryString)
res, err := queryDB(sourceClient, queryString, db)
@@ -264,7 +270,7 @@ func syncCacheStat(sourceClient influx.Client, targetClient influx.Client, statN
func syncDeliveryServiceStat(sourceClient influx.Client, targetClient influx.Client, statName string, days int) {
- db := "deliveryservice_stats"
+ db := deliveryService
bps, _ := influx.NewBatchPoints(influx.BatchPointsConfig{
Database: db,
Precision: "ms",
@@ -273,7 +279,7 @@ func syncDeliveryServiceStat(sourceClient influx.Client, targetClient influx.Cli
queryString := fmt.Sprintf("select time, cachegroup, cdn, deliveryservice, value from \"monthly\".\"%s\"", statName)
if days > 0 {
- queryString += fmt.Sprintf(" where time > now() - %dd", days)
+ queryString = fmt.Sprintf("%s where time > now() - %dd", queryString, days)
}
fmt.Println("queryString ", queryString)
res, err := queryDB(sourceClient, queryString, db)
@@ -322,9 +328,10 @@ func syncDeliveryServiceStat(sourceClient influx.Client, targetClient influx.Cli
}
targetClient.Write(bps)
}
+
func syncDailyStat(sourceClient influx.Client, targetClient influx.Client, statName string, days int) {
- db := "daily_stats"
+ db := daily
bps, _ := influx.NewBatchPoints(influx.BatchPointsConfig{
Database: db,
Precision: "s",
@@ -332,7 +339,7 @@ func syncDailyStat(sourceClient influx.Client, targetClient influx.Client, statN
//get records from source DB
queryString := fmt.Sprintf("select time, cdn, deliveryservice, value from \"%s\"", statName)
if days > 0 {
- queryString += fmt.Sprintf(" where time > now() - %dd", days)
+ queryString = fmt.Sprintf("%s where time > now() - %dd", queryString, days)
}
res, err := queryDB(sourceClient, queryString, db)
if err != nil {
[16/29] incubator-trafficcontrol git commit: Add vendor directory
with current dependencies
Posted by ne...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/cdn_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/cdn_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/cdn_test.go
new file mode 100644
index 0000000..bec59a0
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/cdn_test.go
@@ -0,0 +1,137 @@
+/*
+
+ 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 TestCDNs(t *testing.T) {
+ resp := fixtures.CDNs()
+ 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 CDNs")
+
+ cdns, err := to.CDNs()
+ 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")
+ }
+
+ for _, cdn := range cdns {
+ if cdn.Name != "CDN-1" {
+ testHelper.Error(t, "Should get back \"CDN-1\" for \"name\", got %s", cdn.Name)
+ } else {
+ testHelper.Success(t, "Should get back \"CDN-1\" for \"name\"")
+ }
+
+ if cdn.LastUpdated != "2016-03-22 17:00:30" {
+ testHelper.Error(t, "Should get back \"2016-03-22 17:00:30\" for \"LastUpdated\", got %s", cdn.LastUpdated)
+ } else {
+ testHelper.Success(t, "Should get back \"2016-03-22 17:00:30\" for \"LastUpdated\"")
+ }
+ }
+}
+
+func TestCDNsUnauthorized(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 CDNs")
+
+ _, err := to.CDNs()
+ 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")
+ }
+}
+
+func TestCDNName(t *testing.T) {
+ resp := fixtures.CDNs()
+ server := testHelper.ValidHTTPServer(resp)
+ defer server.Close()
+
+ var httpClient http.Client
+ to := client.Session{
+ URL: server.URL,
+ UserAgent: &httpClient,
+ }
+
+ cdn := "CDN-1"
+ testHelper.Context(t, "Given the need to test a successful Traffic Ops request for CDN: \"%s\"", cdn)
+
+ cdns, err := to.CDNName(cdn)
+ 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")
+ }
+
+ for _, cdn := range cdns {
+ if cdn.Name != "CDN-1" {
+ testHelper.Error(t, "Should get back \"CDN-1\" for \"name\", got %s", cdn.Name)
+ } else {
+ testHelper.Success(t, "Should get back \"CDN-1\" for \"name\"")
+ }
+
+ if cdn.LastUpdated != "2016-03-22 17:00:30" {
+ testHelper.Error(t, "Should get back \"2016-03-22 17:00:30\" for \"LastUpdated\", got %s", cdn.LastUpdated)
+ } else {
+ testHelper.Success(t, "Should get back \"2016-03-22 17:00:30\" for \"LastUpdated\"")
+ }
+ }
+}
+
+func TestCDNNameUnauthorized(t *testing.T) {
+ server := testHelper.InvalidHTTPServer(http.StatusUnauthorized)
+ defer server.Close()
+
+ var httpClient http.Client
+ to := client.Session{
+ URL: server.URL,
+ UserAgent: &httpClient,
+ }
+
+ cdn := "CDN-1"
+ testHelper.Context(t, "Given the need to test a failed Traffic Ops request for CDN: \"%s\"", cdn)
+
+ _, err := to.CDNName(cdn)
+ 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")
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/conf/seelog.xml.test
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/conf/seelog.xml.test b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/conf/seelog.xml.test
new file mode 100644
index 0000000..08facaf
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/conf/seelog.xml.test
@@ -0,0 +1,9 @@
+<seelog>
+ <outputs formatid="main">
+ <file path="logs/test.log" />
+ </outputs>
+
+ <formats>
+ <format id="main" format="[%Level] %Date(2006/01/02 15:04:05.0000) %File:%Line %FuncShort: %Msg%n"/>
+ </formats>
+</seelog>
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/delivery_service_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/delivery_service_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/delivery_service_test.go
new file mode 100644
index 0000000..d8691b5
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/delivery_service_test.go
@@ -0,0 +1,666 @@
+/*
+
+ 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 TestDeliveryServices(t *testing.T) {
+ resp := fixtures.DeliveryServices()
+ 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 DeliveryServices")
+
+ ds, err := to.DeliveryServices()
+ 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(ds) != 1 {
+ testHelper.Error(t, "Should get back \"1\" DeliveryService, got: %d", len(ds))
+ } else {
+ testHelper.Success(t, "Should get back \"1\" DeliveryService")
+ }
+
+ for _, s := range ds {
+ if s.XMLID != "ds-test" {
+ testHelper.Error(t, "Should get back \"ds-test\" for \"XMLID\", got: %s", s.XMLID)
+ } else {
+ testHelper.Success(t, "Should get back \"ds-test\" for \"XMLID\"")
+ }
+
+ if s.MissLong != "-99.123456" {
+ testHelper.Error(t, "Should get back \"-99.123456\" for \"MissLong\", got: %s", s.MissLong)
+ } else {
+ testHelper.Success(t, "Should get back \"-99.123456\" for \"MissLong\"")
+ }
+ }
+}
+
+func TestDeliveryServicesUnauthorized(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 DeliveryServices")
+
+ _, err := to.DeliveryServices()
+ 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")
+ }
+}
+
+func TestDeliveryService(t *testing.T) {
+ resp := fixtures.DeliveryServices()
+ 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 a DeliveryService")
+
+ ds, err := to.DeliveryService("123")
+ 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 ds.XMLID != "ds-test" {
+ testHelper.Error(t, "Should get back \"ds-test\" for \"XMLID\", got: %s", ds.XMLID)
+ } else {
+ testHelper.Success(t, "Should get back \"ds-test\" for \"XMLID\"")
+ }
+
+ if ds.MissLong != "-99.123456" {
+ testHelper.Error(t, "Should get back \"-99.123456\" for \"MissLong\", got: %s", ds.MissLong)
+ } else {
+ testHelper.Success(t, "Should get back \"-99.123456\" for \"MissLong\"")
+ }
+}
+
+func TestDeliveryServiceUnauthorized(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 a DeliveryService")
+
+ _, err := to.DeliveryService("123")
+ 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")
+ }
+}
+
+func TestCreateDeliveryService(t *testing.T) {
+ resp := fixtures.DeliveryService()
+ 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 to create a DeliveryService")
+
+ ds, err := to.CreateDeliveryService(&client.DeliveryService{})
+ 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")
+ }
+
+ actual := ds.Response.ID
+ if actual != "001" {
+ testHelper.Error(t, "Should get back \"001\" for \"Response.ID\", got: %s", actual)
+ } else {
+ testHelper.Success(t, "Should get back \"0001\" for \"Response.ID\"")
+ }
+}
+
+func TestCreateDeliveryServiceUnauthorized(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 to create a DeliveryService")
+
+ _, err := to.CreateDeliveryService(&client.DeliveryService{})
+ 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")
+ }
+}
+
+func TestUpdateDeliveryService(t *testing.T) {
+ resp := fixtures.DeliveryService()
+ 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 to update a DeliveryService")
+
+ ds, err := to.UpdateDeliveryService("123", &client.DeliveryService{})
+ 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")
+ }
+
+ actual := ds.Response.ID
+ if actual != "001" {
+ testHelper.Error(t, "Should get back \"001\" for \"Response.ID\", got: %s", actual)
+ } else {
+ testHelper.Success(t, "Should get back \"0001\" for \"Response.ID\"")
+ }
+}
+
+func TestUpdateDeliveryServiceUnauthorized(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 to update a DeliveryService")
+
+ _, err := to.UpdateDeliveryService("123", &client.DeliveryService{})
+ 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")
+ }
+}
+
+func TestDeleteDeliveryService(t *testing.T) {
+ resp := fixtures.DeleteDeliveryService()
+ 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 to delete a DeliveryService")
+
+ ds, err := to.DeleteDeliveryService("123")
+ 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")
+ }
+
+ actual := ds.Alerts[0].Text
+ if actual != "text" {
+ testHelper.Error(t, "Should get back \"text\" for \"Alerts[0].Text\", got: %s", actual)
+ } else {
+ testHelper.Success(t, "Should get back \"text\" for \"Alerts[0].Text\"")
+ }
+}
+
+func TestDeleteDeliveryServiceUnauthorized(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 to delete a DeliveryService")
+
+ _, err := to.DeleteDeliveryService("123")
+ 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")
+ }
+}
+
+func TestDeliveryServiceState(t *testing.T) {
+ resp := fixtures.DeliveryServiceState()
+ 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 a DeliveryServiceState")
+
+ state, err := to.DeliveryServiceState("123")
+ 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 state.Failover.Destination.Location != "someLocation" {
+ testHelper.Error(t, "Should get back \"someLocation\" for \"Failover.Destination.Location\", got: %s", state.Failover.Destination.Location)
+ } else {
+ testHelper.Success(t, "Should get back \"someLocation\" for \"Failover.Destination.Location\"")
+ }
+
+ if state.Enabled != true {
+ testHelper.Error(t, "Should get back \"true\" for \"Enabled\", got: %s", state.Enabled)
+ } else {
+ testHelper.Success(t, "Should get back \"true\" for \"Enabled\"")
+ }
+}
+
+func TestDeliveryServiceStateUnauthorized(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 a DeliveryServiceState")
+
+ _, err := to.DeliveryServiceState("123")
+ 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")
+ }
+}
+
+func TestDeliveryServiceHealth(t *testing.T) {
+ resp := fixtures.DeliveryServiceHealth()
+ 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 a DeliveryServiceHealth")
+
+ health, err := to.DeliveryServiceHealth("123")
+ 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 health.TotalOnline != 2 {
+ testHelper.Error(t, "Should get back \"2\" for \"TotalOnline\", got: %s", health.TotalOnline)
+ } else {
+ testHelper.Success(t, "Should get back \"2\" for \"TotalOnline\"")
+ }
+
+ if health.TotalOffline != 3 {
+ testHelper.Error(t, "Should get back \"3\" for \"TotalOffline\", got: %s", health.TotalOffline)
+ } else {
+ testHelper.Success(t, "Should get back \"2\" for \"TotalOffline\"")
+ }
+
+ if health.CacheGroups[0].Name != "someCacheGroup" {
+ testHelper.Error(t, "Should get back \"someCacheGroup\" for \"CacheGroups[0].Name\", got: %s", health.CacheGroups[0].Name)
+ } else {
+ testHelper.Success(t, "Should get back \"someCacheGroup\" for \"CacheGroups[0].Name\"")
+ }
+}
+
+func TestDeliveryServiceHealthUnauthorized(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 a DeliveryServiceHealth")
+
+ _, err := to.DeliveryServiceHealth("123")
+ 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")
+ }
+}
+
+func TestDeliveryServiceCapacity(t *testing.T) {
+ resp := fixtures.DeliveryServiceCapacity()
+ 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 a DeliveryServiceCapacity")
+
+ capacity, err := to.DeliveryServiceCapacity("123")
+ 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 capacity.AvailablePercent != 90.12345 {
+ testHelper.Error(t, "Should get back \"90.12345\" for \"AvailablePercent\", got: %s", capacity.AvailablePercent)
+ } else {
+ testHelper.Success(t, "Should get back \"90.12345\" for \"AvailablePercent\"")
+ }
+
+ if capacity.UnavailablePercent != 90.12345 {
+ testHelper.Error(t, "Should get back \"90.12345\" for \"UnavailablePercent\", got: %s", capacity.UnavailablePercent)
+ } else {
+ testHelper.Success(t, "Should get back \"90.12345\" for \"UnavailablePercent\"")
+ }
+
+ if capacity.UtilizedPercent != 90.12345 {
+ testHelper.Error(t, "Should get back \"90.12345\" for \"UtilizedPercent\", got: %s", capacity.UtilizedPercent)
+ } else {
+ testHelper.Success(t, "Should get back \"90.12345\" for \"UtilizedPercent\"")
+ }
+}
+
+func TestDeliveryServiceCapacityUnauthorized(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 a DeliveryServiceCapacity")
+
+ _, err := to.DeliveryServiceCapacity("123")
+ 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")
+ }
+}
+
+func TestDeliveryServiceRouting(t *testing.T) {
+ resp := fixtures.DeliveryServiceRouting()
+ 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 a DeliveryServiceRouting")
+
+ routing, err := to.DeliveryServiceRouting("123")
+ 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 routing.StaticRoute != 1 {
+ testHelper.Error(t, "Should get back \"1\" for \"StaticRoute\", got: %s", routing.StaticRoute)
+ } else {
+ testHelper.Success(t, "Should get back \"1\" for \"StaticRoute\"")
+ }
+}
+
+func TestDeliveryServiceRoutingUnauthorized(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 a DeliveryServiceRouting")
+
+ _, err := to.DeliveryServiceRouting("123")
+ 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")
+ }
+}
+
+func TestDeliveryServiceServer(t *testing.T) {
+ resp := fixtures.DeliveryServiceServer()
+ 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 a DeliveryServiceServer")
+
+ s, err := to.DeliveryServiceServer("1", "1")
+ 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 s[0].LastUpdated != "lastUpdated" {
+ testHelper.Error(t, "Should get back \"lastUpdated\" for \"LastUpdated\", got: %s", s[0].LastUpdated)
+ } else {
+ testHelper.Success(t, "Should get back \"lastUpdated\" for \"LastUpdated\"")
+ }
+
+ if s[0].Server != "someServer" {
+ testHelper.Error(t, "Should get back \"someServer\" for \"Server\", got: %s", s[0].Server)
+ } else {
+ testHelper.Success(t, "Should get back \"someServer\" for \"Server\"")
+ }
+
+ if s[0].DeliveryService != "someService" {
+ testHelper.Error(t, "Should get back \"someService\" for \"DeliveryService\", got: %s", s[0].DeliveryService)
+ } else {
+ testHelper.Success(t, "Should get back \"someService\" for \"DeliveryService\"")
+ }
+}
+
+func TestDeliveryServiceServerUnauthorized(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 a DeliveryServiceServer")
+
+ _, err := to.DeliveryServiceServer("1", "1")
+ 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")
+ }
+}
+
+func TestDeliveryServiceSSLKeysByID(t *testing.T) {
+ resp := fixtures.DeliveryServiceSSLKeys()
+ 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 a DeliveryServiceSSLKeysByID")
+
+ ssl, err := to.DeliveryServiceSSLKeysByID("123")
+ 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 ssl.Certificate.Crt != "crt" {
+ testHelper.Error(t, "Should get back \"crt\" for \"Certificte.Crt\", got: %s", ssl.Certificate.Crt)
+ } else {
+ testHelper.Success(t, "Should get back \"crt\" for \"Certificate.Crt\"")
+ }
+
+ if ssl.Organization != "Kabletown" {
+ testHelper.Error(t, "Should get back \"Kabletown\" for \"Organization\", got: %s", ssl.Organization)
+ } else {
+ testHelper.Success(t, "Should get back \"Kabletown\" for \"Organization\"")
+ }
+}
+
+func TestDeliveryServiceSSLKeysByIDUnauthorized(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 a DeliveryServiceSSLKeysByID")
+
+ _, err := to.DeliveryServiceSSLKeysByID("123")
+ 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")
+ }
+}
+
+func TestDeliveryServiceSSLKeysByHostname(t *testing.T) {
+ resp := fixtures.DeliveryServiceSSLKeys()
+ 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 a DeliveryServiceSSLKeysByHostname")
+
+ ssl, err := to.DeliveryServiceSSLKeysByHostname("hostname")
+ 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 ssl.Certificate.Crt != "crt" {
+ testHelper.Error(t, "Should get back \"crt\" for \"Certificte.Crt\", got: %s", ssl.Certificate.Crt)
+ } else {
+ testHelper.Success(t, "Should get back \"crt\" for \"Certificate.Crt\"")
+ }
+
+ if ssl.Organization != "Kabletown" {
+ testHelper.Error(t, "Should get back \"Kabletown\" for \"Organization\", got: %s", ssl.Organization)
+ } else {
+ testHelper.Success(t, "Should get back \"Kabletown\" for \"Organization\"")
+ }
+}
+
+func TestDeliveryServiceSSLKeysByHostnameUnauthorized(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 a DeliveryServiceSSLKeysByHostname")
+
+ _, err := to.DeliveryServiceSSLKeysByHostname("hostname")
+ 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")
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/hardware_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/hardware_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/hardware_test.go
new file mode 100644
index 0000000..140601a
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/hardware_test.go
@@ -0,0 +1,92 @@
+/*
+
+ 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 TestHardware(t *testing.T) {
+ resp := fixtures.Hardware()
+ 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 Hardware")
+
+ hardware, err := to.Hardware()
+ 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(hardware) != 1 {
+ testHelper.Error(t, "Should get back \"1\" Hardware, got: %d", len(hardware))
+ } else {
+ testHelper.Success(t, "Should get back \"1\" Hardware")
+ }
+
+ for _, h := range hardware {
+ if h.HostName != "odol-atsmid-cen-09" {
+ testHelper.Error(t, "Should get back \"odol-atsmid-cen-09\" for \"Hostname\", got: %s", h.HostName)
+ } else {
+ testHelper.Success(t, "Should get back \"odol-atsmid-cen-09\" for \"Hostname\"")
+ }
+
+ if h.Value != "1.00" {
+ testHelper.Error(t, "Should get back \"1.00\" for \"Value\", got: %s", h.Value)
+ } else {
+ testHelper.Success(t, "Should get back \"1.00\" for \"Value\"")
+ }
+
+ if h.Description != "BACKPLANE FIRMWARE" {
+ testHelper.Error(t, "Should get back \"BACKPLANE FIRMWARE\" for \"Description\", got: %s", h.Description)
+ } else {
+ testHelper.Success(t, "Should get back \"BACKPLANE FIRMWARE\" for \"Description\"")
+ }
+ }
+}
+
+func TestHardwareUnauthorized(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 Hardware")
+
+ _, err := to.Hardware()
+ 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")
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/parameter_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/parameter_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/parameter_test.go
new file mode 100644
index 0000000..f837445
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/parameter_test.go
@@ -0,0 +1,92 @@
+/*
+
+ 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 TestParameters(t *testing.T) {
+ resp := fixtures.Parameters()
+ 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 Parameters")
+
+ parameters, err := to.Parameters("test")
+ 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(parameters) != 1 {
+ testHelper.Error(t, "Should get back \"1\" Parameter, got: %d", len(parameters))
+ } else {
+ testHelper.Success(t, "Should get back \"1\" Parameter")
+ }
+
+ for _, param := range parameters {
+ if param.Name != "location" {
+ testHelper.Error(t, "Should get back \"location\" for \"Name\", got: %s", param.Name)
+ } else {
+ testHelper.Success(t, "Should get back \"location\" for \"Name\"")
+ }
+
+ if param.Value != "/foo/trafficserver/" {
+ testHelper.Error(t, "Should get back \"/foo/trafficserver/\" for \"Value\", got: %s", param.Value)
+ } else {
+ testHelper.Success(t, "Should get back \"/foo/trafficserver/\" for \"Value\"")
+ }
+
+ if param.ConfigFile != "parent.config" {
+ testHelper.Error(t, "Should get back \"parent.config\" for \"ConfigFile\", got: %s", param.ConfigFile)
+ } else {
+ testHelper.Success(t, "Should get back \"parent.config\" for \"ConfigFile\"")
+ }
+ }
+}
+
+func TestParametersUnauthorized(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 Parameters")
+
+ _, err := to.Parameters("test")
+ 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")
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/profile_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/profile_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/profile_test.go
new file mode 100644
index 0000000..3b9cc7f
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/profile_test.go
@@ -0,0 +1,86 @@
+/*
+
+ 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 TestProfile(t *testing.T) {
+ resp := fixtures.Profiles()
+ 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 Profiles")
+
+ profiles, err := to.Profiles()
+ 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(profiles) != 1 {
+ testHelper.Error(t, "Should get back \"1\" Profile, got: %d", len(profiles))
+ } else {
+ testHelper.Success(t, "Should get back \"1\" Profile")
+ }
+
+ for _, p := range profiles {
+ if p.Name != "TR_CDN2" {
+ testHelper.Error(t, "Should get back \"TR_CDN2\" for \"Name\", got: %s", p.Name)
+ } else {
+ testHelper.Success(t, "Should get back \"TR_CDN2\" for \"Name\"")
+ }
+
+ if p.Description != "kabletown Content Router" {
+ testHelper.Error(t, "Should get back \"kabletown Content Router\" for \"Description\", got: %s", p.Description)
+ } else {
+ testHelper.Success(t, "Should get back \"kabletown Content Router\" for \"Description\"")
+ }
+ }
+}
+
+func TestProfilesUnauthorized(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 Profiles")
+
+ _, err := to.Profiles()
+ 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")
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/server_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/server_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/server_test.go
new file mode 100644
index 0000000..793c34c
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/server_test.go
@@ -0,0 +1,310 @@
+/*
+
+ 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"
+ "net/url"
+ "testing"
+
+ "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+ "github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures"
+ "github.com/jheitz200/test_helper"
+)
+
+func TestServer(t *testing.T) {
+ resp := fixtures.Servers()
+ 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 Servers")
+
+ servers, err := to.Servers()
+ 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(servers) != 3 {
+ testHelper.Error(t, "Should get back \"3\" Server, got: %d", len(servers))
+ } else {
+ testHelper.Success(t, "Should get back \"3\" Server")
+ }
+
+ if servers[0].HostName != "edge-alb-01" {
+ testHelper.Error(t, "Should get \"edge-alb-01\" for \"HostName\", got: %s", servers[0].HostName)
+ } else {
+ testHelper.Success(t, "Should get \"edge-alb-01\" for \"HostName\"")
+ }
+
+ if servers[0].DomainName != "albuquerque.nm.albuq.kabletown.com" {
+ testHelper.Error(t, "Should get \"albuquerque.nm.albuq.kabletown.com\" for \"DomainName\", got: %s", servers[0].DomainName)
+ } else {
+ testHelper.Success(t, "Should get \"albuquerque.nm.albuq.kabletown.com\" for \"DomainName\"")
+ }
+
+ if servers[0].Type != "EDGE" {
+ testHelper.Error(t, "Should get \"EDGE\" for \"Type\", got: %s", servers[0].Type)
+ } else {
+ testHelper.Success(t, "Should get \"EDGE\" for \"Type\"")
+ }
+}
+
+func TestServersUnauthorized(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 Servers")
+
+ _, err := to.Servers()
+ 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")
+ }
+}
+
+func TestServerFQDN(t *testing.T) {
+ resp := fixtures.Servers()
+ server := testHelper.ValidHTTPServer(resp)
+ defer server.Close()
+
+ var httpClient http.Client
+ to := client.Session{
+ URL: server.URL,
+ UserAgent: &httpClient,
+ }
+
+ shortName := "edge-alb-01"
+ testHelper.Context(t, "Given the need to test a successful Traffic Ops request for the FQDN of Server: \"%s\"", shortName)
+
+ s, err := to.ServersFqdn("edge-alb-01")
+ 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 s != "edge-alb-01.albuquerque.nm.albuq.kabletown.com" {
+ testHelper.Error(t, "Should get back \"edge-alb-01.albuquerque.nm.albuq.kabletown.com\", got: %s", s)
+ } else {
+ testHelper.Success(t, "Should get back \"edge-alb-01.albuquerque.nm.albuq.kabletown.com\"")
+ }
+}
+
+func TestServerFQDNError(t *testing.T) {
+ var resp client.ServerResponse
+ server := testHelper.ValidHTTPServer(resp)
+ defer server.Close()
+
+ var httpClient http.Client
+ to := client.Session{
+ URL: server.URL,
+ UserAgent: &httpClient,
+ }
+
+ shortName := "edge-alb-01"
+ testHelper.Context(t, "Given the need to test a failed Traffic Ops request for the FQDN of Server: \"%s\"", shortName)
+
+ _, err := to.ServersFqdn(shortName)
+ 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")
+ }
+}
+
+func TestServerFQDNUnauthorized(t *testing.T) {
+ server := testHelper.InvalidHTTPServer(http.StatusUnauthorized)
+ defer server.Close()
+
+ var httpClient http.Client
+ to := client.Session{
+ URL: server.URL,
+ UserAgent: &httpClient,
+ }
+
+ shortName := "edge-alb-01"
+ testHelper.Context(t, "Given the need to test a failed Traffic Ops request for the FQDN of Server: \"%s\"", shortName)
+
+ _, err := to.ServersFqdn(shortName)
+ 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")
+ }
+}
+
+func TestServerShortName(t *testing.T) {
+ resp := fixtures.Servers()
+ server := testHelper.ValidHTTPServer(resp)
+ defer server.Close()
+
+ var httpClient http.Client
+ to := client.Session{
+ URL: server.URL,
+ UserAgent: &httpClient,
+ }
+
+ pattern := "edge"
+ testHelper.Context(t, "Given the need to test a successful Traffic Ops request for servers that match Short Name: \"%s\"", pattern)
+
+ servers, err := to.ServersShortNameSearch(pattern)
+ 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 servers[0] != "edge-alb-01" {
+ testHelper.Error(t, "Should get back \"edge-alb-01\", got: %s", servers[0])
+ } else {
+ testHelper.Success(t, "Should get back \"edge-alb-01\"")
+ }
+
+ if servers[1] != "edge-alb-02" {
+ testHelper.Error(t, "Should get back \"edge-alb-02\", got: %s", servers[1])
+ } else {
+ testHelper.Success(t, "Should get back \"edge-alb-02\"")
+ }
+}
+
+func TestServerShortNameError(t *testing.T) {
+ var resp client.ServerResponse
+ server := testHelper.ValidHTTPServer(resp)
+ defer server.Close()
+
+ var httpClient http.Client
+ to := client.Session{
+ URL: server.URL,
+ UserAgent: &httpClient,
+ }
+
+ pattern := "edge"
+ testHelper.Context(t, "Given the need to test a failed Traffic Ops request for servers that match Short Name: \"%s\"", pattern)
+
+ _, err := to.ServersShortNameSearch(pattern)
+ 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")
+ }
+}
+
+func TestServerShortNameUnauthorized(t *testing.T) {
+ server := testHelper.InvalidHTTPServer(http.StatusUnauthorized)
+ defer server.Close()
+
+ var httpClient http.Client
+ to := client.Session{
+ URL: server.URL,
+ UserAgent: &httpClient,
+ }
+
+ pattern := "edge"
+ testHelper.Context(t, "Given the need to test a failed Traffic Ops request for servers that match Short Name: \"%s\"", pattern)
+
+ _, err := to.ServersShortNameSearch(pattern)
+ 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")
+ }
+}
+
+func TestServerByType(t *testing.T) {
+ resp := fixtures.LogstashServers()
+ 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 \"Logstash\" Servers")
+
+ params := make(url.Values)
+ params.Add("type", "Logstash")
+
+ servers, err := to.ServersByType(params)
+ 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(servers) != 2 {
+ testHelper.Error(t, "Should get back \"2\" Server, got: %d", len(servers))
+ } else {
+ testHelper.Success(t, "Should get back \"2\" Server")
+ }
+
+ if servers[0].HostName != "logstash-01" {
+ testHelper.Error(t, "Should get \"logstash-01\" for \"HostName\", got: %s", servers[0].HostName)
+ } else {
+ testHelper.Success(t, "Should get \"logstash-01\" for \"HostName\"")
+ }
+
+ if servers[0].DomainName != "albuquerque.nm.albuq.kabletown.com" {
+ testHelper.Error(t, "Should get \"albuquerque.nm.albuq.kabletown.com\" for \"DomainName\", got: %s", servers[0].DomainName)
+ } else {
+ testHelper.Success(t, "Should get \"albuquerque.nm.albuq.kabletown.com\" for \"DomainName\"")
+ }
+
+ if servers[0].Type != "LOGSTASH" {
+ testHelper.Error(t, "Should get \"LOGSTASH\" for \"Type\", got: %s", servers[0].Type)
+ } else {
+ testHelper.Success(t, "Should get \"LOGSTASH\" for \"Type\"")
+ }
+}
+
+func TestServerByTypeUnauthorized(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 \"Logstash\" servers")
+
+ params := make(url.Values)
+ params.Add("type", "Logstash")
+
+ _, err := to.ServersByType(params)
+ 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")
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/stats_summary_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/stats_summary_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/stats_summary_test.go
new file mode 100644
index 0000000..7e677a3
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/stats_summary_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 TestStatsSummary(t *testing.T) {
+ resp := fixtures.StatsSummary()
+ 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 Stats Summary")
+
+ stats, err := to.SummaryStats("test-cdn", "test-ds1", "test-stat")
+ 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(stats) != 1 {
+ testHelper.Error(t, "Should get back \"1\" Parameter, got: %d", len(stats))
+ } else {
+ testHelper.Success(t, "Should get back \"1\" Parameter")
+ }
+
+ for _, s := range stats {
+ if s.StatName != "test-stat" {
+ testHelper.Error(t, "Should get back \"test-stat\" for \"StatName\", got: %s", s.StatName)
+ } else {
+ testHelper.Success(t, "Should get back \"test-stat\" for \"StatName\"")
+ }
+
+ if s.DeliveryService != "test-ds1" {
+ testHelper.Error(t, "Should get back \"test-ds1\" for \"DeliveryService\", got: %s", s.DeliveryService)
+ } else {
+ testHelper.Success(t, "Should get back \"test-ds1\" for \"DeliveryService\"")
+ }
+
+ if s.StatValue != "3.1415" {
+ testHelper.Error(t, "Should get back \"3.1415\" for \"StatValue\", got: %s", s.StatValue)
+ } else {
+ testHelper.Success(t, "Should get back \"3.1415\" for \"StatValue\"")
+ }
+
+ if s.CDNName != "test-cdn" {
+ testHelper.Error(t, "Should get back \"test-cdn\" for \"CDNName\", got: %s", s.CDNName)
+ } else {
+ testHelper.Success(t, "Should get back \"test-cdn\" for \"CDNName\"")
+ }
+ }
+}
+
+func TestStatsSummaryUnauthorized(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 Stats Summary")
+
+ _, err := to.SummaryStats("test-cdn", "test-ds1", "test-stat")
+ 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")
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_monitor_config_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_monitor_config_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_monitor_config_test.go
new file mode 100644
index 0000000..fd792a8
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_monitor_config_test.go
@@ -0,0 +1,200 @@
+/*
+
+ 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 TestTMConfig(t *testing.T) {
+ resp := fixtures.TrafficMonitorConfig()
+ 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 TM Config")
+
+ tm, err := to.TrafficMonitorConfigMap("test-cdn")
+ 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")
+ }
+
+ testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TM Config - Traffic Server")
+
+ ts := tm.TrafficServer
+ if len(ts) != 2 {
+ testHelper.Error(t, "Should get back \"2\" Traffic Servers, got: %d", len(ts))
+ } else {
+ testHelper.Success(t, "Should get back \"2\" Traffic Servers")
+ }
+
+ hashID := "tr-chi-05"
+ if val, ok := ts[hashID]; ok {
+ testHelper.Success(t, "Should get back map entry for \"%s\"", hashID)
+
+ if val.IP != "10.10.10.10" {
+ testHelper.Error(t, "Should get back \"10.10.10.10\" for \"IP\", got: %s", val.IP)
+ } else {
+ testHelper.Success(t, "Should get back \"10.10.10.10\" for \"IP\"")
+ }
+
+ } else {
+ testHelper.Error(t, "Should get back map entry for \"%s\"", hashID)
+ }
+
+ hashID = "edge-test-01"
+ if val, ok := ts[hashID]; ok {
+ testHelper.Success(t, "Should get back map entry for for \"%s\"", hashID)
+
+ if val.Type != "EDGE" {
+ testHelper.Error(t, "Should get back \"EDGE\" for \"%s\" \"Type\", got: %s", hashID, ts[hashID].Type)
+ } else {
+ testHelper.Success(t, "Should get back \"EDGE\" for \"%s\" \"Type\"", hashID)
+ }
+
+ } else {
+ testHelper.Error(t, "Should get back map entry for \"%s\"", hashID)
+ }
+
+ testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TR Config - Traffic Monitor")
+
+ m := tm.TrafficMonitor
+ if len(m) != 1 {
+ testHelper.Error(t, "Should get back \"1\" Traffic Servers, got: %d", len(m))
+ } else {
+ testHelper.Success(t, "Should get back \"1\" Traffic Servers")
+ }
+
+ hostName := "traffic-monitor-01"
+ if val, ok := m[hostName]; ok {
+ testHelper.Success(t, "Should get back map entry for \"%s\"", hostName)
+
+ if val.Status != "ONLINE" {
+ testHelper.Error(t, "Should get back \"ONLINE\" for \"Status\", got: %s", val.Status)
+ } else {
+ testHelper.Success(t, "Should get back \"ONLINE\" for \"Status\"")
+ }
+
+ } else {
+ testHelper.Error(t, "Should get back map entry for \"%s\"", hostName)
+ }
+
+ testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TM Config - CacheGroups")
+
+ c := tm.CacheGroup
+ if len(c) != 2 {
+ testHelper.Error(t, "Should get back \"2\" Traffic Servers, got: %d", len(c))
+ } else {
+ testHelper.Success(t, "Should get back \"2\" Traffic Servers")
+ }
+
+ name := "philadelphia"
+ if val, ok := c[name]; ok {
+ testHelper.Success(t, "Should get back map entry for \"%s\"", name)
+
+ if val.Coordinates.Latitude != 55 {
+ testHelper.Error(t, "Should get back \"55\" for \"Coordinates.Latitude\", got: %s", val.Coordinates.Latitude)
+ } else {
+ testHelper.Success(t, "Should get back \"55\" for \"Coordinates.Latitude\"")
+ }
+
+ } else {
+ testHelper.Error(t, "Should get back map entry for \"%s\"", name)
+ }
+
+ name = "tr-chicago"
+ if val, ok := c[name]; ok {
+ testHelper.Success(t, "Should get back map entry for \"%s\"", name)
+
+ if val.Coordinates.Longitude != 9 {
+ testHelper.Error(t, "Should get back \"9\" for \"Coordinates.Longitude\", got: %s", val.Coordinates.Longitude)
+ } else {
+ testHelper.Success(t, "Should get back \"9\" for \"Coordinates.Longitude\"")
+ }
+
+ } else {
+ testHelper.Error(t, "Should get back map entry for \"%s\"", name)
+ }
+
+ testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TM Config - Delivery Services")
+
+ ds := tm.DeliveryService
+ if len(ds) != 1 {
+ testHelper.Error(t, "Should get back \"1\" TM Delivery Service, got: %d", len(ds))
+ } else {
+ testHelper.Success(t, "Should get back \"1\" TM Delivery Service")
+ }
+
+ xmlID := "ds-05"
+ if val, ok := ds[xmlID]; ok {
+ testHelper.Success(t, "Should get back map entry for \"%s\"", xmlID)
+
+ if val.Status != "REPORTED" {
+ testHelper.Error(t, "Should get back \"REPORTED\" for \"Status\", got: %s", val.Status)
+ } else {
+ testHelper.Success(t, "Should get back \"REPORTED\" for \"Status\"")
+ }
+
+ } else {
+ testHelper.Error(t, "Should get back map entry for \"%s\"", xmlID)
+ }
+
+ testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TM Config - TM Profiles")
+
+ p := tm.Profile
+ if len(p) != 1 {
+ testHelper.Error(t, "Should get back \"1\" TM Profie, got: %d", len(p))
+ } else {
+ testHelper.Success(t, "Should get back \"1\" TM Profile")
+ }
+
+ name = "tm-123"
+ if val, ok := p[name]; ok {
+ testHelper.Success(t, "Should get back map entry for \"%s\"", name)
+
+ if val.Parameters.HealthConnectionTimeout != 2000 {
+ testHelper.Error(t, "Should get back \"2000\" for \"Parameters.HealthConnectionTimeout\", got: %v", val.Parameters.HealthConnectionTimeout)
+ } else {
+ testHelper.Success(t, "Should get back \"2000\" for \"Parameters.HealthConnectionTimeout\"")
+ }
+
+ } else {
+ testHelper.Error(t, "Should get back map entry for \"%s\"", name)
+ }
+
+ testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TM Config - Config")
+
+ conf := tm.Config
+ if _, ok := conf["peers.polling.interval"]; ok {
+ if conf["peers.polling.interval"] != float64(1000) {
+ testHelper.Error(t, "Should get back \"1000\" for map entry for \"peers.polling.interval\", got: \"%v\"", conf["peers.polling.interval"])
+ } else {
+ testHelper.Success(t, "Should get back \"1000\" for map entry for \"peers.polling.interval\"")
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_ops_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_ops_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_ops_test.go
new file mode 100644
index 0000000..a9dae06
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_ops_test.go
@@ -0,0 +1,78 @@
+/*
+
+ 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/jheitz200/test_helper"
+)
+
+func TestLogin(t *testing.T) {
+ resp := client.Result{
+ Alerts: []client.Alert{
+ client.Alert{
+ Level: "success",
+ Text: "Successfully logged in.",
+ },
+ },
+ }
+
+ server := testHelper.ValidHTTPServer(resp)
+
+ testHelper.Context(t, "Given the need to test a successful login to Traffic Ops")
+
+ session, err := client.Login(server.URL, "test", "password", true)
+ if err != nil {
+ testHelper.Error(t, "Should be able to login")
+ } else {
+ testHelper.Success(t, "Should be able to login")
+ }
+
+ if session.UserName != "test" {
+ testHelper.Error(t, "Should get back \"test\" for \"UserName\", got %s", session.UserName)
+ } else {
+ testHelper.Success(t, "Should get back \"test\" for \"UserName\"")
+ }
+
+ if session.Password != "password" {
+ testHelper.Error(t, "Should get back \"password\" for \"Password\", got %s", session.Password)
+ } else {
+ testHelper.Success(t, "Should get back \"password\" for \"Password\"")
+ }
+
+ if session.URL != server.URL {
+ testHelper.Error(t, "Should get back \"%s\" for \"URL\", got %s", server.URL, session.URL)
+ } else {
+ testHelper.Success(t, "Should get back \"%s\" for \"URL\"", server.URL)
+ }
+}
+
+func TestLoginUnauthorized(t *testing.T) {
+ server := testHelper.InvalidHTTPServer(http.StatusUnauthorized)
+ defer server.Close()
+
+ testHelper.Context(t, "Given the need to test an unsuccessful login to Traffic Ops")
+
+ _, err := client.Login(server.URL, "test", "password", true)
+ if err == nil {
+ testHelper.Error(t, "Should not be able to login")
+ } else {
+ testHelper.Success(t, "Should not be able to login")
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_router_config_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_router_config_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_router_config_test.go
new file mode 100644
index 0000000..ea34581
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_router_config_test.go
@@ -0,0 +1,211 @@
+/*
+
+ 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 TestTRConfig(t *testing.T) {
+ resp := fixtures.TrafficRouterConfig()
+ 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 TR Config")
+
+ tr, err := to.TrafficRouterConfigMap("title-vi")
+ 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")
+ }
+
+ testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TR Config - Traffic Server")
+
+ ts := tr.TrafficServer
+ if len(ts) != 2 {
+ testHelper.Error(t, "Should get back \"2\" Traffic Servers, got: %d", len(ts))
+ } else {
+ testHelper.Success(t, "Should get back \"2\" Traffic Servers")
+ }
+
+ hashID := "tr-chi-05"
+ if val, ok := ts[hashID]; ok {
+ testHelper.Success(t, "Should get back map entry for \"%s\"", hashID)
+
+ if val.IP != "10.10.10.10" {
+ testHelper.Error(t, "Should get back \"10.10.10.10\" for \"IP\", got: %s", val.IP)
+ } else {
+ testHelper.Success(t, "Should get back \"10.10.10.10\" for \"IP\"")
+ }
+
+ } else {
+ testHelper.Error(t, "Should get back map entry for \"%s\"", hashID)
+ }
+
+ hashID = "edge-test-01"
+ if val, ok := ts[hashID]; ok {
+ testHelper.Success(t, "Should get back map entry for for \"%s\"", hashID)
+
+ if val.Type != "EDGE" {
+ testHelper.Error(t, "Should get back \"EDGE\" for \"%s\" \"Type\", got: %s", hashID, ts[hashID].Type)
+ } else {
+ testHelper.Success(t, "Should get back \"EDGE\" for \"%s\" \"Type\"", hashID)
+ }
+
+ } else {
+ testHelper.Error(t, "Should get back map entry for \"%s\"", hashID)
+ }
+
+ testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TR Config - Traffic Monitor")
+
+ tm := tr.TrafficMonitor
+ if len(tm) != 1 {
+ testHelper.Error(t, "Should get back \"1\" Traffic Servers, got: %d", len(tm))
+ } else {
+ testHelper.Success(t, "Should get back \"1\" Traffic Servers")
+ }
+
+ hostname := "traffic-monitor-01"
+ if val, ok := tm[hostname]; ok {
+ testHelper.Success(t, "Should get back map entry for \"%s\"", hostname)
+
+ if val.Profile != "tr-123" {
+ testHelper.Error(t, "Should get back \"tr-123\" for \"Profile\", got: %s", val.Profile)
+ } else {
+ testHelper.Success(t, "Should get back \"tr-123\" for \"Profile\"")
+ }
+
+ } else {
+ testHelper.Error(t, "Should get back map entry for \"%s\"", hostname)
+ }
+
+ testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TR Config - Traffic Router")
+
+ r := tr.TrafficRouter
+ if len(r) != 1 {
+ testHelper.Error(t, "Should get back \"1\" Traffic Servers, got: %d", len(r))
+ } else {
+ testHelper.Success(t, "Should get back \"1\" Traffic Servers")
+ }
+
+ fqdn := "tr-01@ga.atlanta.kabletown.net"
+ if val, ok := r[fqdn]; ok {
+ testHelper.Success(t, "Should get back map entry for \"%s\"", fqdn)
+
+ if val.Location != "tr-chicago" {
+ testHelper.Error(t, "Should get back \"tr-chicago\" for \"Location\", got: %s", val.Location)
+ } else {
+ testHelper.Success(t, "Should get back \"tr-chicago\" for \"Location\"")
+ }
+
+ } else {
+ testHelper.Error(t, "Should get back map entry for \"%s\"", fqdn)
+ }
+
+ testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TR Config - CacheGroups")
+
+ c := tr.CacheGroup
+ if len(c) != 2 {
+ testHelper.Error(t, "Should get back \"2\" Traffic Servers, got: %d", len(c))
+ } else {
+ testHelper.Success(t, "Should get back \"2\" Traffic Servers")
+ }
+
+ name := "philadelphia"
+ if val, ok := c[name]; ok {
+ testHelper.Success(t, "Should get back map entry for \"%s\"", name)
+
+ if val.Coordinates.Latitude != 99 {
+ testHelper.Error(t, "Should get back \"99\" for \"Coordinates.Latitude\", got: %v", val.Coordinates.Latitude)
+ } else {
+ testHelper.Success(t, "Should get back \"99\" for \"Coordinates.Latitude\"")
+ }
+
+ } else {
+ testHelper.Error(t, "Should get back map entry for \"%s\"", name)
+ }
+
+ name = "tr-chicago"
+ if val, ok := c[name]; ok {
+ testHelper.Success(t, "Should get back map entry for \"%s\"", name)
+
+ if val.Coordinates.Longitude != 9 {
+ testHelper.Error(t, "Should get back \"9\" for \"Coordinates.Longitude\", got: %v", val.Coordinates.Longitude)
+ } else {
+ testHelper.Success(t, "Should get back \"9\" for \"Coordinates.Longitude\"")
+ }
+
+ } else {
+ testHelper.Error(t, "Should get back map entry for \"%s\"", name)
+ }
+
+ testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TR Config - Delivery Services")
+
+ ds := tr.DeliveryService
+ if len(ds) != 1 {
+ testHelper.Error(t, "Should get back \"1\" TR Delivery Service, got: %d", len(ds))
+ } else {
+ testHelper.Success(t, "Should get back \"1\" TR Delivery Service")
+ }
+
+ xmlID := "ds-06"
+ if val, ok := ds[xmlID]; ok {
+ testHelper.Success(t, "Should get back map entry for \"%s\"", xmlID)
+
+ if val.TTL != 3600 {
+ testHelper.Error(t, "Should get back \"3600\" for \"TTL\", got: %d", val.TTL)
+ } else {
+ testHelper.Success(t, "Should get back \"3600\" for \"TTL\"")
+ }
+
+ } else {
+ testHelper.Error(t, "Should get back map entry for \"%s\"", xmlID)
+ }
+
+ testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TR Config - Config")
+
+ conf := tr.Config
+ if _, ok := conf["peers.polling.interval"]; ok {
+ if conf["peers.polling.interval"] != float64(1000) {
+ testHelper.Error(t, "Should get back \"1000\" for map entry for \"peers.polling.interval\", got: \"%v\"", conf["peers.polling.interval"])
+ } else {
+ testHelper.Success(t, "Should get back \"1000\" for map entry for \"peers.polling.interval\"")
+ }
+ }
+
+ testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TR Config - Stats")
+
+ stats := tr.Stat
+ if _, ok := stats["cdnName"]; ok {
+ if stats["cdnName"] != "test-cdn" {
+ testHelper.Error(t, "Should get back \"test-cdn\" for map entry for \"cdnName\", got: \"%s\"", stats["cdnName"])
+ } else {
+ testHelper.Success(t, "Should get back \"test-cdn\" for map entry for \"cdnName\"")
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/type_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/type_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/type_test.go
new file mode 100644
index 0000000..e4d8a43
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/type_test.go
@@ -0,0 +1,80 @@
+/*
+
+ 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 TestTypes(t *testing.T) {
+ resp := fixtures.Types()
+ 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 Types")
+
+ types, err := to.Types()
+ 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")
+ }
+
+ for _, n := range types {
+ if n.Name != "EDGE" {
+ testHelper.Error(t, "Should get back \"EDGE\" for \"Name\", got %s", n.Name)
+ } else {
+ testHelper.Success(t, "Should get back \"EDGE\" for \"Name\"")
+ }
+
+ if n.Description != "edge cache" {
+ testHelper.Error(t, "Should get back \"edge cache\" for \"Description\", got %s", n.Description)
+ } else {
+ testHelper.Success(t, "Should get back \"edge cache\" for \"Description\"")
+ }
+ }
+}
+
+func TestTypesUnauthorized(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 Types")
+
+ _, err := to.Types()
+ 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")
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/user_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/user_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/user_test.go
new file mode 100644
index 0000000..d684770
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/user_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 TestUsers(t *testing.T) {
+ resp := fixtures.Users()
+ server := testHelper.ValidHTTPServer(resp.Response)
+ 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 Users")
+
+ users, err := to.Users()
+ 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")
+ }
+
+ for _, u := range users {
+ if u.FullName != "Bob Smith" {
+ testHelper.Error(t, "Should get back \"Bob Smith\" for \"FullName\", got %s", u.FullName)
+ } else {
+ testHelper.Success(t, "Should get back \"Bob Smith\" for \"FullName\"")
+ }
+
+ if u.PublicSSHKey != "some-ssh-key" {
+ testHelper.Error(t, "Should get back \"some-ssh-key\" for \"PublicSSHKey\", got %s", u.PublicSSHKey)
+ } else {
+ testHelper.Success(t, "Should get back \"some-ssh-key\" for \"PublicSSHKey\"")
+ }
+
+ if u.Role != "3" {
+ testHelper.Error(t, "Should get back \"3\" for \"Role\", got %s", u.Role)
+ } else {
+ testHelper.Success(t, "Should get back \"3\" for \"Role\"")
+ }
+
+ if u.Email != "bobsmith@email.com" {
+ testHelper.Error(t, "Should get back \"bobsmith@email.com\" for \"Email\", got %s", u.Email)
+ } else {
+ testHelper.Success(t, "Should get back \"bobsmith@email.com\" for \"Email\"")
+ }
+
+ if u.Username != "bsmith" {
+ testHelper.Error(t, "Should get back \"bsmith\" for \"Username\", got %s", u.Username)
+ } else {
+ testHelper.Success(t, "Should get back \"bsmith\" for \"Username\"")
+ }
+ }
+}
+
+func TestUsersUnauthorized(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 Users")
+
+ _, err := to.Users()
+ 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")
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_monitor_config.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_monitor_config.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_monitor_config.go
new file mode 100644
index 0000000..50ec7cd
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_monitor_config.go
@@ -0,0 +1,162 @@
+/*
+
+ 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"
+ "strings"
+)
+
+// TMConfigResponse ...
+type TMConfigResponse struct {
+ Version string `json:"version"`
+ Response TrafficMonitorConfig `json:"response"`
+}
+
+// TrafficMonitorConfig ...
+type TrafficMonitorConfig struct {
+ TrafficServers []TrafficServer `json:"trafficServers,omitempty"`
+ CacheGroups []TMCacheGroup `json:"cacheGroups,omitempty"`
+ Config map[string]interface{} `json:"config,omitempty"`
+ TrafficMonitors []TrafficMonitor `json:"trafficMonitors,omitempty"`
+ DeliveryServices []TMDeliveryService `json:"deliveryServices,omitempty"`
+ Profiles []TMProfile `json:"profiles,omitempty"`
+}
+
+// TrafficMonitorConfigMap ...
+type TrafficMonitorConfigMap struct {
+ TrafficServer map[string]TrafficServer
+ CacheGroup map[string]TMCacheGroup
+ Config map[string]interface{}
+ TrafficMonitor map[string]TrafficMonitor
+ DeliveryService map[string]TMDeliveryService
+ Profile map[string]TMProfile
+}
+
+// TrafficMonitor ...
+type TrafficMonitor struct {
+ Port int `json:"port"`
+ IP6 string `json:"ip6"`
+ IP string `json:"ip"`
+ HostName string `json:"hostName"`
+ FQDN string `json:"fqdn"`
+ Profile string `json:"profile"`
+ Location string `json:"location"`
+ Status string `json:"status"`
+}
+
+// TMDeliveryService ...
+type TMDeliveryService struct {
+ XMLID string `json:"xmlId"`
+ TotalTPSThreshold int64 `json:"TotalTpsThreshold"`
+ Status string `json:"status"`
+ TotalKbpsThreshold int64 `json:"TotalKbpsThreshold"`
+}
+
+// TMProfile ...
+type TMProfile struct {
+ Parameters TMParameters `json:"parameters"`
+ Name string `json:"name"`
+ Type string `json:"type"`
+}
+
+// TMParameters ...
+type TMParameters struct {
+ HealthConnectionTimeout int `json:"health.connection.timeout"`
+ HealthPollingURL string `json:"health.polling.url"`
+ HealthThresholdQueryTime int `json:"health.threshold.queryTime"`
+ HistoryCount int `json:"history.count"`
+ HealthThresholdAvailableBandwidthInKbps string `json:"health.threshold.availableBandwidthInKbps"`
+ HealthThresholdLoadAvg float64 `json:"health.threshold.loadavg,string"`
+ MinFreeKbps int64
+}
+
+// TrafficMonitorConfigMap ...
+func (to *Session) TrafficMonitorConfigMap(cdn string) (*TrafficMonitorConfigMap, error) {
+ tmConfig, err := to.TrafficMonitorConfig(cdn)
+ if err != nil {
+ return nil, err
+ }
+ tmConfigMap, err := trafficMonitorTransformToMap(tmConfig)
+ if err != nil {
+ return nil, err
+ }
+ return tmConfigMap, nil
+}
+
+// TrafficMonitorConfig ...
+func (to *Session) TrafficMonitorConfig(cdn string) (*TrafficMonitorConfig, error) {
+ url := fmt.Sprintf("/api/1.2/cdns/%s/configs/monitoring.json", cdn)
+ resp, err := to.request("GET", url, nil)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+
+ var data TMConfigResponse
+ if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
+ return nil, err
+ }
+
+ return &data.Response, nil
+}
+
+func trafficMonitorTransformToMap(tmConfig *TrafficMonitorConfig) (*TrafficMonitorConfigMap, error) {
+ var tm TrafficMonitorConfigMap
+
+ tm.TrafficServer = make(map[string]TrafficServer)
+ tm.CacheGroup = make(map[string]TMCacheGroup)
+ tm.Config = make(map[string]interface{})
+ tm.TrafficMonitor = make(map[string]TrafficMonitor)
+ tm.DeliveryService = make(map[string]TMDeliveryService)
+ tm.Profile = make(map[string]TMProfile)
+
+ for _, trafficServer := range tmConfig.TrafficServers {
+ tm.TrafficServer[trafficServer.HostName] = trafficServer
+ }
+
+ for _, cacheGroup := range tmConfig.CacheGroups {
+ tm.CacheGroup[cacheGroup.Name] = cacheGroup
+ }
+
+ for parameterKey, parameterVal := range tmConfig.Config {
+ tm.Config[parameterKey] = parameterVal
+ }
+
+ for _, trafficMonitor := range tmConfig.TrafficMonitors {
+ tm.TrafficMonitor[trafficMonitor.HostName] = trafficMonitor
+ }
+
+ for _, deliveryService := range tmConfig.DeliveryServices {
+ tm.DeliveryService[deliveryService.XMLID] = deliveryService
+ }
+
+ for _, profile := range tmConfig.Profiles {
+ bwThresholdString := profile.Parameters.HealthThresholdAvailableBandwidthInKbps
+ if strings.HasPrefix(bwThresholdString, ">") {
+ var err error
+ profile.Parameters.MinFreeKbps, err = strconv.ParseInt(bwThresholdString[1:len(bwThresholdString)], 10, 64)
+ if err != nil {
+ return nil, err
+ }
+ }
+ tm.Profile[profile.Name] = profile
+ }
+
+ return &tm, nil
+}
[08/29] incubator-trafficcontrol git commit: Remove unnecessary
global errorMessage variable, use fmt.Printf() instead
Posted by ne...@apache.org.
Remove unnecessary global errorMessage variable, use fmt.Printf() instead
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/8bdb8bee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/8bdb8bee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/8bdb8bee
Branch: refs/heads/master
Commit: 8bdb8beea4e1317b5acd9947915379c93d37358f
Parents: 29c3206
Author: sbogacz <sb...@zvelo.com>
Authored: Fri Jan 6 19:25:38 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
traffic_stats/influxdb_tools/sync_ts_databases.go | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/8bdb8bee/traffic_stats/influxdb_tools/sync_ts_databases.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/sync_ts_databases.go b/traffic_stats/influxdb_tools/sync_ts_databases.go
index ca6b845..55e6878 100644
--- a/traffic_stats/influxdb_tools/sync_ts_databases.go
+++ b/traffic_stats/influxdb_tools/sync_ts_databases.go
@@ -56,8 +56,6 @@ type dailyStats struct {
value float64
}
-var errorMessage string
-
func syncFlags() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
@@ -251,8 +249,7 @@ func syncCacheStat(sourceClient influx.Client, targetClient influx.Client, statN
//get values from target DB
targetRes, err := queryDB(targetClient, queryString, db)
if err != nil {
- errorMessage = fmt.Sprintf("An error occured getting %s record from target db: %v\n", statName, err)
- fmt.Println(errorMessage)
+ fmt.Printf("An error occured getting %s record from target db: %v\n", statName, err)
return
}
targetStats := getCacheStats(targetRes)
@@ -306,16 +303,14 @@ func syncDeliveryServiceStat(sourceClient influx.Client, targetClient influx.Cli
fmt.Println("queryString ", queryString)
res, err := queryDB(sourceClient, queryString, db)
if err != nil {
- errorMessage = fmt.Sprintf("An error occured getting %s records from sourceDb: %v\n", statName, err)
- fmt.Println(errorMessage)
+ fmt.Printf("An error occured getting %s records from sourceDb: %v\n", statName, err)
return
}
sourceStats := getDeliveryServiceStats(res)
// get value from target DB
targetRes, err := queryDB(targetClient, queryString, db)
if err != nil {
- errorMessage = fmt.Sprintf("An error occured getting %s record from target db: %v\n", statName, err)
- fmt.Println(errorMessage)
+ fmt.Printf("An error occured getting %s record from target db: %v\n", statName, err)
return
}
targetStats := getDeliveryServiceStats(targetRes)
@@ -365,16 +360,14 @@ func syncDailyStat(sourceClient influx.Client, targetClient influx.Client, statN
}
res, err := queryDB(sourceClient, queryString, db)
if err != nil {
- errorMessage = fmt.Sprintf("An error occured getting %s records from sourceDb: %v\n", statName, err)
- fmt.Println(errorMessage)
+ fmt.Printf("An error occured getting %s records from sourceDb: %v\n", statName, err)
return
}
sourceStats := getDailyStats(res)
// get value from target DB
targetRes, err := queryDB(targetClient, queryString, db)
if err != nil {
- errorMessage = fmt.Sprintf("An error occured getting %s record from target db: %v\n", statName, err)
- fmt.Println(errorMessage)
+ fmt.Printf("An error occured getting %s record from target db: %v\n", statName, err)
return
}
targetStats := getDailyStats(targetRes)
[13/29] incubator-trafficcontrol git commit: Make create_ts_databases
use flag package again, and the new influxdb package
Posted by ne...@apache.org.
Make create_ts_databases use flag package again, and the new influxdb package
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/4290ea5f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/4290ea5f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/4290ea5f
Branch: refs/heads/master
Commit: 4290ea5f1f178fe13abf8bc263ab2984389da238
Parents: 3d95afa
Author: sbogacz <sb...@zvelo.com>
Authored: Tue Jan 10 19:45:24 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
.../create/create_ts_databases.go | 82 ++++----------------
traffic_stats/influxdb_tools/create/main.go | 37 ---------
2 files changed, 15 insertions(+), 104 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4290ea5f/traffic_stats/influxdb_tools/create/create_ts_databases.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/create/create_ts_databases.go b/traffic_stats/influxdb_tools/create/create_ts_databases.go
index fa1260a..64d1de4 100644
--- a/traffic_stats/influxdb_tools/create/create_ts_databases.go
+++ b/traffic_stats/influxdb_tools/create/create_ts_databases.go
@@ -20,11 +20,11 @@ under the License.
package main
import (
+ "flag"
"fmt"
+ "github.com/apache/incubator-trafficcontrol/traffic_stats/influxdb"
influx "github.com/influxdata/influxdb/client/v2"
- "github.com/pkg/errors"
- "github.com/urfave/cli"
)
const (
@@ -33,76 +33,24 @@ const (
daily = "daily_stats"
)
-func createFlags() []cli.Flag {
- return []cli.Flag{
- cli.StringFlag{
- Name: "url",
- Usage: "The influxdb url and port",
- Value: "http://localhost:8086",
- },
- cli.IntFlag{
- Name: "replication",
- Usage: "The number of nodes in the cluster",
- Value: 3,
- },
- cli.StringFlag{
- Name: "user",
- Usage: "The influxdb username used to create DBs",
- Value: "",
- },
- cli.StringFlag{
- Name: "password",
- Usage: "The influxdb password used to create DBs",
- Value: "",
- },
- }
-}
+func main() {
+ // get influx db flags
+ config := &influxdb.Config{}
+ config.Flags("")
+ var replication int
+ flag.IntVar(&replication, "replication", 3, "The number of nodes in the cluster")
-func create(c *cli.Context) error {
- influxURL := c.String("url")
- replication := c.Int("replication")
- user := c.String("user")
- password := c.String("password")
-
- fmt.Printf("creating datbases for influxUrl: %s with a replication of %d using user %s\n", influxURL, replication, user)
- client, err := influx.NewHTTPClient(influx.HTTPConfig{
- Addr: influxURL,
- Username: user,
- Password: password,
- })
+ fmt.Printf("creating datbases for influxUrl: %s with a replication of %d using user %s\n", config.URL, replication, config.User)
+ client, err := config.NewHTTPClient()
if err != nil {
- return errors.Wrap(err, "Error creating influx client")
- }
- _, _, err = client.Ping(10)
- if err != nil {
- return errors.Wrap(err, "Error creating influx client")
+ fmt.Printf("Unable to run create_ts_datases command, failed to get influxdb client: %v\n", err)
+ return
}
createCacheStats(client, replication)
createDailyStats(client, replication)
createDeliveryServiceStats(client, replication)
- return nil
-}
-// queryDB takes a variadic argument for the target database so as to make
-// passing the variable optional, however, if passed, only the first db passed
-// in will be used
-func queryDB(client influx.Client, cmd string, dbs ...string) (res []influx.Result, err error) {
- db := ""
- if len(dbs) > 0 {
- db = dbs[0]
- }
- q := influx.Query{
- Command: cmd,
- Database: db,
- }
- if response, err := client.Query(q); err == nil {
- if response.Error() != nil {
- return res, response.Error()
- }
- res = response.Results
- }
- return res, nil
}
func createCacheStats(client influx.Client, replication int) {
@@ -146,7 +94,7 @@ func createDailyStats(client influx.Client, replication int) {
}
func createDatabase(client influx.Client, db string) {
- _, err := queryDB(client, fmt.Sprintf("CREATE DATABASE %s", db))
+ err := influxdb.Create(client, fmt.Sprintf("CREATE DATABASE %s", db))
if err != nil {
fmt.Printf("An error occured creating the %v database: %v\n", db, err)
return
@@ -159,7 +107,7 @@ func createRetentionPolicy(client influx.Client, db string, name string, duratio
if isDefault {
qString += " DEFAULT"
}
- _, err := queryDB(client, qString)
+ err := influxdb.Create(client, qString)
if err != nil {
fmt.Printf("An error occured creating the retention policy %s on database: %s: %v\n", name, db, err)
return
@@ -168,7 +116,7 @@ func createRetentionPolicy(client influx.Client, db string, name string, duratio
}
func createContinuousQuery(client influx.Client, name string, query string) {
- _, err := queryDB(client, query)
+ err := influxdb.Create(client, query)
if err != nil {
fmt.Printf("An error occured creating continuous query %s: %v\n", name, err)
return
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4290ea5f/traffic_stats/influxdb_tools/create/main.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/create/main.go b/traffic_stats/influxdb_tools/create/main.go
deleted file mode 100644
index 986901b..0000000
--- a/traffic_stats/influxdb_tools/create/main.go
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-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.
-*/
-
-package main
-
-import (
- "os"
-
- "github.com/urfave/cli"
-)
-
-func main() {
- app := cli.NewApp()
- app.Name = "create_ts_databases"
- app.Version = "0.1.0"
- app.Usage = "create_ts_databases provides a cli tool for creating the requisite influxdb databases"
- app.Flags = createFlags()
- app.Action = create
-
- app.Run(os.Args)
-}
[20/29] incubator-trafficcontrol git commit: Update vendor going more
thoroughly through deps recursively... some cleanup may be called for in a
follow up PR
Posted by ne...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/errgo.v1/LICENSE
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/errgo.v1/LICENSE b/traffic_stats/vendor/gopkg.in/errgo.v1/LICENSE
new file mode 100644
index 0000000..e44c4cc
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/errgo.v1/LICENSE
@@ -0,0 +1,26 @@
+Copyright � 2013, Roger Peppe
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of this project nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/errgo.v1/README.md
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/errgo.v1/README.md b/traffic_stats/vendor/gopkg.in/errgo.v1/README.md
new file mode 100644
index 0000000..49e1c15
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/errgo.v1/README.md
@@ -0,0 +1,259 @@
+# errgo
+--
+ import "gopkg.in/errgo.v1"
+
+The errgo package provides a way to create and diagnose errors. It is compatible
+with the usual Go error idioms but adds a way to wrap errors so that they record
+source location information while retaining a consistent way for code to inspect
+errors to find out particular problems.
+
+## Usage
+
+#### func Any
+
+```go
+func Any(error) bool
+```
+Any returns true. It can be used as an argument to Mask to allow any diagnosis
+to pass through to the wrapped error.
+
+#### func Cause
+
+```go
+func Cause(err error) error
+```
+Cause returns the cause of the given error. If err does not implement Causer or
+its Cause method returns nil, it returns err itself.
+
+Cause is the usual way to diagnose errors that may have been wrapped by Mask or
+NoteMask.
+
+#### func Details
+
+```go
+func Details(err error) string
+```
+Details returns information about the stack of underlying errors wrapped by err,
+in the format:
+
+ [{filename:99: error one} {otherfile:55: cause of error one}]
+
+The details are found by type-asserting the error to the Locationer, Causer and
+Wrapper interfaces. Details of the underlying stack are found by recursively
+calling Underlying when the underlying error implements Wrapper.
+
+#### func Is
+
+```go
+func Is(err error) func(error) bool
+```
+Is returns a function that returns whether the an error is equal to the given
+error. It is intended to be used as a "pass" argument to Mask and friends; for
+example:
+
+ return errgo.Mask(err, errgo.Is(http.ErrNoCookie))
+
+would return an error with an http.ErrNoCookie cause only if that was err's
+diagnosis; otherwise the diagnosis would be itself.
+
+#### func Mask
+
+```go
+func Mask(underlying error, pass ...func(error) bool) error
+```
+Mask returns an Err that wraps the given underyling error. The error message is
+unchanged, but the error location records the caller of Mask.
+
+If err is nil, Mask returns nil.
+
+By default Mask conceals the cause of the wrapped error, but if pass(Cause(err))
+returns true for any of the provided pass functions, the cause of the returned
+error will be Cause(err).
+
+For example, the following code will return an error whose cause is the error
+from the os.Open call when (and only when) the file does not exist.
+
+ f, err := os.Open("non-existent-file")
+ if err != nil {
+ return errgo.Mask(err, os.IsNotExist)
+ }
+
+In order to add context to returned errors, it is conventional to call Mask when
+returning any error received from elsewhere.
+
+#### func MaskFunc
+
+```go
+func MaskFunc(allow ...func(error) bool) func(error, ...func(error) bool) error
+```
+MaskFunc returns an equivalent of Mask that always allows the specified causes
+in addition to any causes specified when the returned function is called.
+
+It is defined for convenience, for example when all calls to Mask in a given
+package wish to allow the same set of causes to be returned.
+
+#### func New
+
+```go
+func New(s string) error
+```
+New returns a new error with the given error message and no cause. It is a
+drop-in replacement for errors.New from the standard library.
+
+#### func Newf
+
+```go
+func Newf(f string, a ...interface{}) error
+```
+Newf returns a new error with the given printf-formatted error message and no
+cause.
+
+#### func NoteMask
+
+```go
+func NoteMask(underlying error, msg string, pass ...func(error) bool) error
+```
+NoteMask returns an Err that has the given underlying error, with the given
+message added as context, and allowing the cause of the underlying error to pass
+through into the result if allowed by the specific pass functions (see Mask for
+an explanation of the pass parameter).
+
+#### func Notef
+
+```go
+func Notef(underlying error, f string, a ...interface{}) error
+```
+Notef returns an Error that wraps the given underlying error and adds the given
+formatted context message. The returned error has no cause (use NoteMask or
+WithCausef to add a message while retaining a cause).
+
+#### func WithCausef
+
+```go
+func WithCausef(underlying, cause error, f string, a ...interface{}) error
+```
+WithCausef returns a new Error that wraps the given (possibly nil) underlying
+error and associates it with the given cause. The given formatted message
+context will also be added.
+
+#### type Causer
+
+```go
+type Causer interface {
+ Cause() error
+}
+```
+
+Causer is the type of an error that may provide an error cause for error
+diagnosis. Cause may return nil if there is no cause (for example because the
+cause has been masked).
+
+#### type Err
+
+```go
+type Err struct {
+ // Message_ holds the text of the error message. It may be empty
+ // if Underlying is set.
+ Message_ string
+
+ // Cause_ holds the cause of the error as returned
+ // by the Cause method.
+ Cause_ error
+
+ // Underlying holds the underlying error, if any.
+ Underlying_ error
+
+ // File and Line identify the source code location where the error was
+ // created.
+ File string
+ Line int
+}
+```
+
+Err holds a description of an error along with information about where the error
+was created.
+
+It may be embedded in custom error types to add extra information that this
+errors package can understand.
+
+#### func (*Err) Cause
+
+```go
+func (e *Err) Cause() error
+```
+Cause implements Causer.
+
+#### func (*Err) Error
+
+```go
+func (e *Err) Error() string
+```
+Error implements error.Error.
+
+#### func (*Err) GoString
+
+```go
+func (e *Err) GoString() string
+```
+GoString returns the details of the receiving error message, so that printing an
+error with %#v will produce useful information.
+
+#### func (*Err) Location
+
+```go
+func (e *Err) Location() (file string, line int)
+```
+Location implements Locationer.
+
+#### func (*Err) Message
+
+```go
+func (e *Err) Message() string
+```
+Message returns the top level error message.
+
+#### func (*Err) SetLocation
+
+```go
+func (e *Err) SetLocation(callDepth int)
+```
+Locate records the source location of the error by setting e.Location, at
+callDepth stack frames above the call.
+
+#### func (*Err) Underlying
+
+```go
+func (e *Err) Underlying() error
+```
+Underlying returns the underlying error if any.
+
+#### type Locationer
+
+```go
+type Locationer interface {
+ // Location returns the name of the file and the line
+ // number associated with an error.
+ Location() (file string, line int)
+}
+```
+
+Locationer can be implemented by any error type that wants to expose the source
+location of an error.
+
+#### type Wrapper
+
+```go
+type Wrapper interface {
+ // Message returns the top level error message,
+ // not including the message from the underlying
+ // error.
+ Message() string
+
+ // Underlying returns the underlying error, or nil
+ // if there is none.
+ Underlying() error
+}
+```
+
+Wrapper is the type of an error that wraps another error. It is exposed so that
+external types may implement it, but should in general not be used otherwise.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/errgo.v1/errors.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/errgo.v1/errors.go b/traffic_stats/vendor/gopkg.in/errgo.v1/errors.go
new file mode 100644
index 0000000..a1f2308
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/errgo.v1/errors.go
@@ -0,0 +1,389 @@
+// Copyright 2014 Roger Peppe.
+// See LICENCE file for details.
+
+// The errgo package provides a way to create
+// and diagnose errors. It is compatible with
+// the usual Go error idioms but adds a way to wrap errors
+// so that they record source location information
+// while retaining a consistent way for code to
+// inspect errors to find out particular problems.
+//
+package errgo
+
+import (
+ "bytes"
+ "fmt"
+ "log"
+ "runtime"
+)
+
+const debug = false
+
+// Err holds a description of an error along with information about
+// where the error was created.
+//
+// It may be embedded in custom error types to add
+// extra information that this errors package can
+// understand.
+type Err struct {
+ // Message_ holds the text of the error message. It may be empty
+ // if Underlying is set.
+ Message_ string
+
+ // Cause_ holds the cause of the error as returned
+ // by the Cause method.
+ Cause_ error
+
+ // Underlying holds the underlying error, if any.
+ Underlying_ error
+
+ // File and Line identify the source code location where the error was
+ // created.
+ File string
+ Line int
+}
+
+// Location implements Locationer.
+func (e *Err) Location() (file string, line int) {
+ return e.File, e.Line
+}
+
+// Underlying returns the underlying error if any.
+func (e *Err) Underlying() error {
+ return e.Underlying_
+}
+
+// Cause implements Causer.
+func (e *Err) Cause() error {
+ return e.Cause_
+}
+
+// Message returns the top level error message.
+func (e *Err) Message() string {
+ return e.Message_
+}
+
+// Error implements error.Error.
+func (e *Err) Error() string {
+ switch {
+ case e.Message_ == "" && e.Underlying_ == nil:
+ return "<no error>"
+ case e.Message_ == "":
+ return e.Underlying_.Error()
+ case e.Underlying_ == nil:
+ return e.Message_
+ }
+ return fmt.Sprintf("%s: %v", e.Message_, e.Underlying_)
+}
+
+// GoString returns the details of the receiving error
+// message, so that printing an error with %#v will
+// produce useful information.
+func (e *Err) GoString() string {
+ return Details(e)
+}
+
+// Causer is the type of an error that may provide
+// an error cause for error diagnosis. Cause may return
+// nil if there is no cause (for example because the
+// cause has been masked).
+type Causer interface {
+ Cause() error
+}
+
+// Wrapper is the type of an error that wraps another error. It is
+// exposed so that external types may implement it, but should in
+// general not be used otherwise.
+type Wrapper interface {
+ // Message returns the top level error message,
+ // not including the message from the underlying
+ // error.
+ Message() string
+
+ // Underlying returns the underlying error, or nil
+ // if there is none.
+ Underlying() error
+}
+
+// Locationer can be implemented by any error type
+// that wants to expose the source location of an error.
+type Locationer interface {
+ // Location returns the name of the file and the line
+ // number associated with an error.
+ Location() (file string, line int)
+}
+
+// Details returns information about the stack of
+// underlying errors wrapped by err, in the format:
+//
+// [{filename:99: error one} {otherfile:55: cause of error one}]
+//
+// The details are found by type-asserting the error to
+// the Locationer, Causer and Wrapper interfaces.
+// Details of the underlying stack are found by
+// recursively calling Underlying when the
+// underlying error implements Wrapper.
+func Details(err error) string {
+ if err == nil {
+ return "[]"
+ }
+ var s []byte
+ s = append(s, '[')
+ for {
+ s = append(s, '{')
+ if err, ok := err.(Locationer); ok {
+ file, line := err.Location()
+ if file != "" {
+ s = append(s, fmt.Sprintf("%s:%d", file, line)...)
+ s = append(s, ": "...)
+ }
+ }
+ if cerr, ok := err.(Wrapper); ok {
+ s = append(s, cerr.Message()...)
+ err = cerr.Underlying()
+ } else {
+ s = append(s, err.Error()...)
+ err = nil
+ }
+ if debug {
+ if err, ok := err.(Causer); ok {
+ if cause := err.Cause(); cause != nil {
+ s = append(s, fmt.Sprintf("=%T", cause)...)
+ s = append(s, Details(cause)...)
+ }
+ }
+ }
+ s = append(s, '}')
+ if err == nil {
+ break
+ }
+ s = append(s, ' ')
+ }
+ s = append(s, ']')
+ return string(s)
+}
+
+// Locate records the source location of the error by setting
+// e.Location, at callDepth stack frames above the call.
+func (e *Err) SetLocation(callDepth int) {
+ _, file, line, _ := runtime.Caller(callDepth + 1)
+ e.File, e.Line = file, line
+}
+
+func setLocation(err error, callDepth int) {
+ if e, _ := err.(*Err); e != nil {
+ e.SetLocation(callDepth + 1)
+ }
+}
+
+// New returns a new error with the given error message and no cause. It
+// is a drop-in replacement for errors.New from the standard library.
+func New(s string) error {
+ err := &Err{Message_: s}
+ err.SetLocation(1)
+ return err
+}
+
+// Newf returns a new error with the given printf-formatted error
+// message and no cause.
+func Newf(f string, a ...interface{}) error {
+ err := &Err{Message_: fmt.Sprintf(f, a...)}
+ err.SetLocation(1)
+ return err
+}
+
+// match returns whether any of the given
+// functions returns true when called with err as an
+// argument.
+func match(err error, pass ...func(error) bool) bool {
+ for _, f := range pass {
+ if f(err) {
+ return true
+ }
+ }
+ return false
+}
+
+// Is returns a function that returns whether the
+// an error is equal to the given error.
+// It is intended to be used as a "pass" argument
+// to Mask and friends; for example:
+//
+// return errgo.Mask(err, errgo.Is(http.ErrNoCookie))
+//
+// would return an error with an http.ErrNoCookie cause
+// only if that was err's diagnosis; otherwise the diagnosis
+// would be itself.
+func Is(err error) func(error) bool {
+ return func(err1 error) bool {
+ return err == err1
+ }
+}
+
+// Any returns true. It can be used as an argument to Mask
+// to allow any diagnosis to pass through to the wrapped
+// error.
+func Any(error) bool {
+ return true
+}
+
+// NoteMask returns an Err that has the given underlying error,
+// with the given message added as context, and allowing
+// the cause of the underlying error to pass through into
+// the result if allowed by the specific pass functions
+// (see Mask for an explanation of the pass parameter).
+func NoteMask(underlying error, msg string, pass ...func(error) bool) error {
+ err := noteMask(underlying, msg, pass...)
+ setLocation(err, 1)
+ return err
+}
+
+// noteMask is exactly like NoteMask except it doesn't set the location
+// of the returned error, so that we can avoid setting it twice
+// when it's used in other functions.
+func noteMask(underlying error, msg string, pass ...func(error) bool) error {
+ newErr := &Err{
+ Underlying_: underlying,
+ Message_: msg,
+ }
+ if len(pass) > 0 {
+ if cause := Cause(underlying); match(cause, pass...) {
+ newErr.Cause_ = cause
+ }
+ }
+ if debug {
+ if newd, oldd := newErr.Cause_, Cause(underlying); newd != oldd {
+ log.Printf("Mask cause %[1]T(%[1]v)->%[2]T(%[2]v)", oldd, newd)
+ log.Printf("call stack: %s", callers(0, 20))
+ log.Printf("len(allow) == %d", len(pass))
+ log.Printf("old error %#v", underlying)
+ log.Printf("new error %#v", newErr)
+ }
+ }
+ newErr.SetLocation(1)
+ return newErr
+}
+
+// Mask returns an Err that wraps the given underyling error. The error
+// message is unchanged, but the error location records the caller of
+// Mask.
+//
+// If err is nil, Mask returns nil.
+//
+// By default Mask conceals the cause of the wrapped error, but if
+// pass(Cause(err)) returns true for any of the provided pass functions,
+// the cause of the returned error will be Cause(err).
+//
+// For example, the following code will return an error whose cause is
+// the error from the os.Open call when (and only when) the file does
+// not exist.
+//
+// f, err := os.Open("non-existent-file")
+// if err != nil {
+// return errgo.Mask(err, os.IsNotExist)
+// }
+//
+// In order to add context to returned errors, it
+// is conventional to call Mask when returning any
+// error received from elsewhere.
+//
+func Mask(underlying error, pass ...func(error) bool) error {
+ if underlying == nil {
+ return nil
+ }
+ err := noteMask(underlying, "", pass...)
+ setLocation(err, 1)
+ return err
+}
+
+// Notef returns an Error that wraps the given underlying
+// error and adds the given formatted context message.
+// The returned error has no cause (use NoteMask
+// or WithCausef to add a message while retaining a cause).
+func Notef(underlying error, f string, a ...interface{}) error {
+ err := noteMask(underlying, fmt.Sprintf(f, a...))
+ setLocation(err, 1)
+ return err
+}
+
+// MaskFunc returns an equivalent of Mask that always allows the
+// specified causes in addition to any causes specified when the
+// returned function is called.
+//
+// It is defined for convenience, for example when all calls to Mask in
+// a given package wish to allow the same set of causes to be returned.
+func MaskFunc(allow ...func(error) bool) func(error, ...func(error) bool) error {
+ return func(err error, allow1 ...func(error) bool) error {
+ var allowEither []func(error) bool
+ if len(allow1) > 0 {
+ // This is more efficient than using a function literal,
+ // because the compiler knows that it doesn't escape.
+ allowEither = make([]func(error) bool, len(allow)+len(allow1))
+ copy(allowEither, allow)
+ copy(allowEither[len(allow):], allow1)
+ } else {
+ allowEither = allow
+ }
+ err = Mask(err, allowEither...)
+ setLocation(err, 1)
+ return err
+ }
+}
+
+// WithCausef returns a new Error that wraps the given
+// (possibly nil) underlying error and associates it with
+// the given cause. The given formatted message context
+// will also be added. If underlying is nil and f is empty and has no arguments,
+// the message will be the same as the cause.
+func WithCausef(underlying, cause error, f string, a ...interface{}) error {
+ var msg string
+ if underlying == nil && f == "" && len(a) == 0 && cause != nil {
+ msg = cause.Error()
+ } else {
+ msg = fmt.Sprintf(f, a...)
+ }
+ err := &Err{
+ Underlying_: underlying,
+ Cause_: cause,
+ Message_: msg,
+ }
+ err.SetLocation(1)
+ return err
+}
+
+// Cause returns the cause of the given error. If err does not
+// implement Causer or its Cause method returns nil, it returns err itself.
+//
+// Cause is the usual way to diagnose errors that may have
+// been wrapped by Mask or NoteMask.
+func Cause(err error) error {
+ var diag error
+ if err, ok := err.(Causer); ok {
+ diag = err.Cause()
+ }
+ if diag != nil {
+ return diag
+ }
+ return err
+}
+
+// callers returns the stack trace of the goroutine that called it,
+// starting n entries above the caller of callers, as a space-separated list
+// of filename:line-number pairs with no new lines.
+func callers(n, max int) []byte {
+ var b bytes.Buffer
+ prev := false
+ for i := 0; i < max; i++ {
+ _, file, line, ok := runtime.Caller(n + 1)
+ if !ok {
+ return b.Bytes()
+ }
+ if prev {
+ fmt.Fprintf(&b, " ")
+ }
+ fmt.Fprintf(&b, "%s:%d", file, line)
+ n++
+ prev = true
+ }
+ return b.Bytes()
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/retry.v1/LICENSE
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/retry.v1/LICENSE b/traffic_stats/vendor/gopkg.in/retry.v1/LICENSE
new file mode 100644
index 0000000..f9bb84d
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/retry.v1/LICENSE
@@ -0,0 +1,186 @@
+Copyright (C) 2011-2015 Canonical Ltd.
+This software is licensed under the LGPLv3, included below.
+
+As a special exception to the GNU Lesser General Public License version 3
+("LGPL3"), the copyright holders of this Library give you permission to
+convey to a third party a Combined Work that links statically or dynamically
+to this Library without providing any Minimal Corresponding Source or
+Minimal Application Code as set out in 4d or providing the installation
+information set out in section 4e, provided that you comply with the other
+provisions of LGPL3 and provided that you meet, for the Application the
+terms and conditions of the license(s) which apply to the Application.
+
+Except as stated in this special exception, the provisions of LGPL3 will
+continue to comply in full to this Library. If you modify this Library, you
+may apply this exception to your version of this Library, but you are not
+obliged to do so. If you do not wish to do so, delete this exception
+statement from your version. This exception does not (and cannot) modify any
+license terms which apply to the Application, with which you must still
+comply.
+
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/retry.v1/README.md
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/retry.v1/README.md b/traffic_stats/vendor/gopkg.in/retry.v1/README.md
new file mode 100644
index 0000000..885a6a6
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/retry.v1/README.md
@@ -0,0 +1,202 @@
+# retry
+--
+ import "gopkg.in/retry.v1"
+
+Package retry provides a framework for retrying actions. It does not itself
+invoke the action to be retried, but is intended to be used in a retry loop.
+
+The basic usage is as follows:
+
+ for a := someStrategy.Start(); a.Next(); {
+ try()
+ }
+
+See examples for details of suggested usage.
+
+## Usage
+
+#### type Attempt
+
+```go
+type Attempt struct {
+}
+```
+
+Attempt represents a running retry attempt.
+
+#### func Start
+
+```go
+func Start(strategy Strategy, clk Clock) *Attempt
+```
+Start begins a new sequence of attempts for the given strategy using the given
+Clock implementation for time keeping. If clk is nil, the time package will be
+used to keep time.
+
+#### func StartWithCancel
+
+```go
+func StartWithCancel(strategy Strategy, clk Clock, stop <-chan struct{}) *Attempt
+```
+StartWithCancel is like Start except that if a value is received on stop while
+waiting, the attempt will be aborted.
+
+#### func (*Attempt) Count
+
+```go
+func (a *Attempt) Count() int
+```
+Count returns the current attempt count number, starting at 1. It returns 0 if
+called before Next is called. When the loop has terminated, it holds the total
+number of retries made.
+
+#### func (*Attempt) More
+
+```go
+func (a *Attempt) More() bool
+```
+More reports whether there are more retry attempts to be made. It does not
+sleep.
+
+If More returns false, Next will return false. If More returns true, Next will
+return true except when the attempt has been explicitly stopped via the stop
+channel.
+
+#### func (*Attempt) Next
+
+```go
+func (a *Attempt) Next() bool
+```
+Next reports whether another attempt should be made, waiting as necessary until
+it's time for the attempt. It always returns true the first time it is called
+unless a value is received on the stop channel - we are guaranteed to make at
+least one attempt unless stopped.
+
+#### func (*Attempt) Stopped
+
+```go
+func (a *Attempt) Stopped() bool
+```
+Stopped reports whether the attempt has terminated because a value was received
+on the stop channel.
+
+#### type Clock
+
+```go
+type Clock interface {
+ Now() time.Time
+ After(time.Duration) <-chan time.Time
+}
+```
+
+Clock represents a virtual clock interface that can be replaced for testing.
+
+#### type Exponential
+
+```go
+type Exponential struct {
+ // Initial holds the initial delay.
+ Initial time.Duration
+ // Factor holds the factor that the delay time will be multiplied
+ // by on each iteration.
+ Factor float64
+ // MaxDelay holds the maximum delay between the start
+ // of attempts. If this is zero, there is no maximum delay.
+ MaxDelay time.Duration
+}
+```
+
+Exponential represents an exponential backoff retry strategy. To limit the
+number of attempts or their overall duration, wrap this in LimitCount or
+LimitDuration.
+
+#### func (Exponential) NewTimer
+
+```go
+func (r Exponential) NewTimer(now time.Time) Timer
+```
+NewTimer implements Strategy.NewTimer.
+
+#### type Regular
+
+```go
+type Regular struct {
+ // Total specifies the total duration of the attempt.
+ Total time.Duration
+
+ // Delay specifies the interval between the start of each try
+ // in the burst. If an try takes longer than Delay, the
+ // next try will happen immediately.
+ Delay time.Duration
+
+ // Min holds the minimum number of retries. It overrides Total.
+ // To limit the maximum number of retries, use LimitCount.
+ Min int
+}
+```
+
+Regular represents a strategy that repeats at regular intervals.
+
+#### func (Regular) NewTimer
+
+```go
+func (r Regular) NewTimer(now time.Time) Timer
+```
+NewTimer implements Strategy.NewTimer.
+
+#### func (Regular) Start
+
+```go
+func (r Regular) Start(clk Clock) *Attempt
+```
+Start is short for Start(r, clk, nil)
+
+#### type Strategy
+
+```go
+type Strategy interface {
+ // NewTimer is called when the strategy is started - it is
+ // called with the time that the strategy is started and returns
+ // an object that is used to find out how long to sleep before
+ // each retry attempt.
+ NewTimer(now time.Time) Timer
+}
+```
+
+Strategy is implemented by types that represent a retry strategy.
+
+Note: You probably won't need to implement a new strategy - the existing types
+and functions are intended to be sufficient for most purposes.
+
+#### func LimitCount
+
+```go
+func LimitCount(n int, strategy Strategy) Strategy
+```
+LimitCount limits the number of attempts that the given strategy will perform to
+n. Note that all strategies will allow at least one attempt.
+
+#### func LimitTime
+
+```go
+func LimitTime(limit time.Duration, strategy Strategy) Strategy
+```
+LimitTime limits the given strategy such that no attempt will made after the
+given duration has elapsed.
+
+#### type Timer
+
+```go
+type Timer interface {
+ // NextSleep is called with the time that Next or More has been
+ // called and returns the length of time to sleep before the
+ // next retry. If no more attempts should be made it should
+ // return false, and the returned duration will be ignored.
+ //
+ // Note that NextSleep is called once after each iteration has
+ // completed, assuming the retry loop is continuing.
+ NextSleep(now time.Time) (time.Duration, bool)
+}
+```
+
+Timer represents a source of timing events for a retry strategy.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/retry.v1/clock.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/retry.v1/clock.go b/traffic_stats/vendor/gopkg.in/retry.v1/clock.go
new file mode 100644
index 0000000..5b195cd
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/retry.v1/clock.go
@@ -0,0 +1,23 @@
+package retry
+
+import "time"
+
+// Clock represents a virtual clock interface that
+// can be replaced for testing.
+type Clock interface {
+ Now() time.Time
+ After(time.Duration) <-chan time.Time
+}
+
+// WallClock exposes wall-clock time as returned by time.Now.
+type wallClock struct{}
+
+// Now implements Clock.Now.
+func (wallClock) Now() time.Time {
+ return time.Now()
+}
+
+// After implements Clock.After.
+func (wallClock) After(d time.Duration) <-chan time.Time {
+ return time.After(d)
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/retry.v1/exp.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/retry.v1/exp.go b/traffic_stats/vendor/gopkg.in/retry.v1/exp.go
new file mode 100644
index 0000000..94449f4
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/retry.v1/exp.go
@@ -0,0 +1,50 @@
+package retry
+
+import (
+ "time"
+)
+
+// Exponential represents an exponential backoff retry strategy.
+// To limit the number of attempts or their overall duration, wrap
+// this in LimitCount or LimitDuration.
+type Exponential struct {
+ // Initial holds the initial delay.
+ Initial time.Duration
+ // Factor holds the factor that the delay time will be multiplied
+ // by on each iteration.
+ Factor float64
+ // MaxDelay holds the maximum delay between the start
+ // of attempts. If this is zero, there is no maximum delay.
+ MaxDelay time.Duration
+}
+
+type exponentialTimer struct {
+ strategy Exponential
+ start time.Time
+ end time.Time
+ delay time.Duration
+}
+
+// NewTimer implements Strategy.NewTimer.
+func (r Exponential) NewTimer(now time.Time) Timer {
+ return &exponentialTimer{
+ strategy: r,
+ start: now,
+ delay: r.Initial,
+ }
+}
+
+// NextSleep implements Timer.NextSleep.
+func (a *exponentialTimer) NextSleep(now time.Time) (time.Duration, bool) {
+ sleep := a.delay - now.Sub(a.start)
+ if sleep <= 0 {
+ sleep = 0
+ }
+ // Set the start of the next try.
+ a.start = now.Add(sleep)
+ a.delay = time.Duration(float64(a.delay) * a.strategy.Factor)
+ if a.strategy.MaxDelay > 0 && a.delay > a.strategy.MaxDelay {
+ a.delay = a.strategy.MaxDelay
+ }
+ return sleep, true
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/retry.v1/regular.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/retry.v1/regular.go b/traffic_stats/vendor/gopkg.in/retry.v1/regular.go
new file mode 100644
index 0000000..471df43
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/retry.v1/regular.go
@@ -0,0 +1,65 @@
+// Copyright 2016 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+package retry
+
+import (
+ "time"
+)
+
+// Regular represents a strategy that repeats at regular intervals.
+type Regular struct {
+ // Total specifies the total duration of the attempt.
+ Total time.Duration
+
+ // Delay specifies the interval between the start of each try
+ // in the burst. If an try takes longer than Delay, the
+ // next try will happen immediately.
+ Delay time.Duration
+
+ // Min holds the minimum number of retries. It overrides Total.
+ // To limit the maximum number of retries, use LimitCount.
+ Min int
+}
+
+// regularTimer holds a running instantiation of the Regular timer.
+type regularTimer struct {
+ strategy Regular
+ count int
+ // start holds when the current try started.
+ start time.Time
+ end time.Time
+}
+
+// Start is short for Start(r, clk, nil)
+func (r Regular) Start(clk Clock) *Attempt {
+ return Start(r, clk)
+}
+
+// NewTimer implements Strategy.NewTimer.
+func (r Regular) NewTimer(now time.Time) Timer {
+ return ®ularTimer{
+ strategy: r,
+ start: now,
+ end: now.Add(r.Total),
+ }
+}
+
+// NextSleep implements Timer.NextSleep.
+func (a *regularTimer) NextSleep(now time.Time) (time.Duration, bool) {
+ sleep := a.strategy.Delay - now.Sub(a.start)
+ if sleep <= 0 {
+ sleep = 0
+ }
+ a.count++
+ // Set the start of the next try.
+ a.start = now.Add(sleep)
+ if a.count < a.strategy.Min {
+ return sleep, true
+ }
+ // The next try is after the end - no more attempts.
+ if a.start.After(a.end) {
+ return 0, false
+ }
+ return sleep, true
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/retry.v1/retry.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/retry.v1/retry.go b/traffic_stats/vendor/gopkg.in/retry.v1/retry.go
new file mode 100644
index 0000000..e5d9f12
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/retry.v1/retry.go
@@ -0,0 +1,156 @@
+// Copyright 2016 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+// Package retry provides a framework for retrying actions.
+// It does not itself invoke the action to be retried, but
+// is intended to be used in a retry loop.
+//
+// The basic usage is as follows:
+//
+// for a := someStrategy.Start(); a.Next(); {
+// try()
+// }
+//
+// See examples for details of suggested usage.
+package retry
+
+import (
+ "time"
+)
+
+// Strategy is implemented by types that represent a retry strategy.
+//
+// Note: You probably won't need to implement a new strategy - the existing types
+// and functions are intended to be sufficient for most purposes.
+type Strategy interface {
+ // NewTimer is called when the strategy is started - it is
+ // called with the time that the strategy is started and returns
+ // an object that is used to find out how long to sleep before
+ // each retry attempt.
+ NewTimer(now time.Time) Timer
+}
+
+// Timer represents a source of timing events for a retry strategy.
+type Timer interface {
+ // NextSleep is called with the time that Next or More has been
+ // called and returns the length of time to sleep before the
+ // next retry. If no more attempts should be made it should
+ // return false, and the returned duration will be ignored.
+ //
+ // Note that NextSleep is called once after each iteration has
+ // completed, assuming the retry loop is continuing.
+ NextSleep(now time.Time) (time.Duration, bool)
+}
+
+// Attempt represents a running retry attempt.
+type Attempt struct {
+ clock Clock
+ stop <-chan struct{}
+ timer Timer
+
+ // next holds when the next attempt should start.
+ // It is valid only when known is true.
+ next time.Time
+
+ // count holds the iteration count.
+ count int
+
+ // known holds whether next and running are known.
+ known bool
+
+ // running holds whether the attempt is still going.
+ running bool
+
+ // stopped holds whether the attempt has been stopped.
+ stopped bool
+}
+
+// Start begins a new sequence of attempts for the given strategy using
+// the given Clock implementation for time keeping. If clk is
+// nil, the time package will be used to keep time.
+func Start(strategy Strategy, clk Clock) *Attempt {
+ return StartWithCancel(strategy, clk, nil)
+}
+
+// StartWithCancel is like Start except that if a value
+// is received on stop while waiting, the attempt will be aborted.
+func StartWithCancel(strategy Strategy, clk Clock, stop <-chan struct{}) *Attempt {
+ if clk == nil {
+ clk = wallClock{}
+ }
+ now := clk.Now()
+ return &Attempt{
+ clock: clk,
+ stop: stop,
+ timer: strategy.NewTimer(now),
+ known: true,
+ running: true,
+ next: now,
+ }
+}
+
+// Next reports whether another attempt should be made, waiting as
+// necessary until it's time for the attempt. It always returns true the
+// first time it is called unless a value is received on the stop
+// channel - we are guaranteed to make at least one attempt unless
+// stopped.
+func (a *Attempt) Next() bool {
+ if !a.More() {
+ return false
+ }
+ sleep := a.next.Sub(a.clock.Now())
+ if sleep <= 0 {
+ // We're not going to sleep for any length of time,
+ // so guarantee that we respect the stop channel. This
+ // ensures that we make no attempts if Next is called
+ // with a value available on the stop channel.
+ select {
+ case <-a.stop:
+ a.stopped = true
+ a.running = false
+ return false
+ default:
+ a.known = false
+ a.count++
+ return true
+ }
+ }
+ select {
+ case <-a.clock.After(sleep):
+ a.known = false
+ a.count++
+ case <-a.stop:
+ a.running = false
+ a.stopped = true
+ }
+ return a.running
+}
+
+// More reports whether there are more retry attempts to be made. It
+// does not sleep.
+//
+// If More returns false, Next will return false. If More returns true,
+// Next will return true except when the attempt has been explicitly
+// stopped via the stop channel.
+func (a *Attempt) More() bool {
+ if !a.known {
+ now := a.clock.Now()
+ sleepDuration, running := a.timer.NextSleep(now)
+ a.next, a.running, a.known = now.Add(sleepDuration), running, true
+ }
+ return a.running
+}
+
+// Stopped reports whether the attempt has terminated because
+// a value was received on the stop channel.
+func (a *Attempt) Stopped() bool {
+ return a.stopped
+}
+
+// Count returns the current attempt count number, starting at 1.
+// It returns 0 if called before Next is called.
+// When the loop has terminated, it holds the total number
+// of retries made.
+func (a *Attempt) Count() int {
+ return a.count
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/retry.v1/strategy.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/retry.v1/strategy.go b/traffic_stats/vendor/gopkg.in/retry.v1/strategy.go
new file mode 100644
index 0000000..a6f134d
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/retry.v1/strategy.go
@@ -0,0 +1,60 @@
+package retry
+
+import (
+ "time"
+)
+
+type strategyFunc func(now time.Time) Timer
+
+// NewTimer implements Strategy.NewTimer.
+func (f strategyFunc) NewTimer(now time.Time) Timer {
+ return f(now)
+}
+
+// LimitCount limits the number of attempts that the given
+// strategy will perform to n. Note that all strategies
+// will allow at least one attempt.
+func LimitCount(n int, strategy Strategy) Strategy {
+ return strategyFunc(func(now time.Time) Timer {
+ return &countLimitTimer{
+ timer: strategy.NewTimer(now),
+ remain: n,
+ }
+ })
+}
+
+type countLimitTimer struct {
+ timer Timer
+ remain int
+}
+
+func (t *countLimitTimer) NextSleep(now time.Time) (time.Duration, bool) {
+ if t.remain--; t.remain <= 0 {
+ return 0, false
+ }
+ return t.timer.NextSleep(now)
+}
+
+// LimitTime limits the given strategy such that no attempt will
+// made after the given duration has elapsed.
+func LimitTime(limit time.Duration, strategy Strategy) Strategy {
+ return strategyFunc(func(now time.Time) Timer {
+ return &timeLimitTimer{
+ timer: strategy.NewTimer(now),
+ end: now.Add(limit),
+ }
+ })
+}
+
+type timeLimitTimer struct {
+ timer Timer
+ end time.Time
+}
+
+func (t *timeLimitTimer) NextSleep(now time.Time) (time.Duration, bool) {
+ sleep, ok := t.timer.NextSleep(now)
+ if ok && now.Add(sleep).After(t.end) {
+ return 0, false
+ }
+ return sleep, ok
+}
[23/29] incubator-trafficcontrol git commit: Update vendor going more
thoroughly through deps recursively... some cleanup may be called for in a
follow up PR
Posted by ne...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/jheitz200/test_helper/http.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/jheitz200/test_helper/http.go b/traffic_stats/vendor/github.com/jheitz200/test_helper/http.go
new file mode 100644
index 0000000..808414f
--- /dev/null
+++ b/traffic_stats/vendor/github.com/jheitz200/test_helper/http.go
@@ -0,0 +1,44 @@
+/*
+ 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 testHelper
+
+import (
+ "encoding/json"
+ "net/http"
+ "net/http/httptest"
+)
+
+// ValidHTTPServer starts and returns a new test server. Always
+// responds with a statusCode of 200 and the specified payload.
+func ValidHTTPServer(resp interface{}) *httptest.Server {
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(http.StatusOK)
+ w.Header().Set("Content-Type", "application/json")
+ json.NewEncoder(w).Encode(resp)
+ }))
+ return server
+}
+
+// InvalidHTTPServer starts and returns a new test server.
+// Responds with the specified statusCode.
+func InvalidHTTPServer(statusCode int) *httptest.Server {
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(statusCode)
+ w.Header().Set("Content-Type", "application/json")
+ }))
+ return server
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/jheitz200/test_helper/test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/jheitz200/test_helper/test.go b/traffic_stats/vendor/github.com/jheitz200/test_helper/test.go
new file mode 100644
index 0000000..a314059
--- /dev/null
+++ b/traffic_stats/vendor/github.com/jheitz200/test_helper/test.go
@@ -0,0 +1,66 @@
+/*
+ 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 testHelper
+
+import (
+ "fmt"
+ "testing"
+
+ "github.com/cihub/seelog"
+)
+
+// Succeed is the Unicode codepoint for a check mark.
+const Succeed = "\u2713"
+
+// Failed is the Unicode codepoint for an X mark.
+const Failed = "\u2717"
+
+func init() {
+ // An example seelog.xml is located at conf/seelog.xml
+ // If you want to use this config - copy it to your project
+ seelogConfig := "conf/seelog.xml.test"
+ logger, err := seelog.LoggerFromConfigAsFile(seelogConfig)
+ if err != nil {
+ err := fmt.Errorf("FOO Error creating Logger from seelog file: %s", seelogConfig)
+ seelog.Error(err)
+ }
+ defer seelog.Flush()
+ seelog.ReplaceLogger(logger)
+}
+
+// Context is a summary of the test being run.
+func Context(t *testing.T, msg string, args ...interface{}) {
+ t.Log(fmt.Sprintf(msg, args...))
+}
+
+// Fatal contains details of a failed test and stops its execution.
+func Fatal(t *testing.T, msg string, args ...interface{}) {
+ m := fmt.Sprintf(msg, args...)
+ t.Fatal(fmt.Sprintf("\t %-80s", m), Failed)
+}
+
+// Error contails details of a failed test and continues execution.
+func Error(t *testing.T, msg string, args ...interface{}) {
+ m := fmt.Sprintf(msg, args...)
+ t.Error(fmt.Sprintf("\t %-80s", m), Failed)
+}
+
+// Success contains details of a successful test.
+func Success(t *testing.T, msg string, args ...interface{}) {
+ m := fmt.Sprintf(msg, args...)
+ t.Log(fmt.Sprintf("\t %-80s", m), Succeed)
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/juju/go4/LICENSE
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/juju/go4/LICENSE b/traffic_stats/vendor/github.com/juju/go4/LICENSE
new file mode 100644
index 0000000..8f71f43
--- /dev/null
+++ b/traffic_stats/vendor/github.com/juju/go4/LICENSE
@@ -0,0 +1,202 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ 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.
+
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/juju/go4/lock/.gitignore
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/juju/go4/lock/.gitignore b/traffic_stats/vendor/github.com/juju/go4/lock/.gitignore
new file mode 100644
index 0000000..b25c15b
--- /dev/null
+++ b/traffic_stats/vendor/github.com/juju/go4/lock/.gitignore
@@ -0,0 +1 @@
+*~
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/juju/go4/lock/lock.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/juju/go4/lock/lock.go b/traffic_stats/vendor/github.com/juju/go4/lock/lock.go
new file mode 100644
index 0000000..a9fb802
--- /dev/null
+++ b/traffic_stats/vendor/github.com/juju/go4/lock/lock.go
@@ -0,0 +1,186 @@
+/*
+Copyright 2013 The Go Authors
+
+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 lock is a file locking library.
+package lock
+
+import (
+ "encoding/json"
+ "fmt"
+ "io"
+ "os"
+ "path/filepath"
+ "sync"
+)
+
+// Lock locks the given file, creating the file if necessary. If the
+// file already exists, it must have zero size or an error is returned.
+// The lock is an exclusive lock (a write lock), but locked files
+// should neither be read from nor written to. Such files should have
+// zero size and only exist to co-ordinate ownership across processes.
+//
+// A nil Closer is returned if an error occurred. Otherwise, close that
+// Closer to release the lock.
+//
+// On Linux, FreeBSD and OSX, a lock has the same semantics as fcntl(2)'s
+// advisory locks. In particular, closing any other file descriptor for the
+// same file will release the lock prematurely.
+//
+// Attempting to lock a file that is already locked by the current process
+// has undefined behavior.
+//
+// On other operating systems, lock will fallback to using the presence and
+// content of a file named name + '.lock' to implement locking behavior.
+func Lock(name string) (io.Closer, error) {
+ abs, err := filepath.Abs(name)
+ if err != nil {
+ return nil, err
+ }
+ lockmu.Lock()
+ defer lockmu.Unlock()
+ if locked[abs] {
+ return nil, fmt.Errorf("file %q already locked", abs)
+ }
+
+ c, err := lockFn(abs)
+ if err != nil {
+ return nil, fmt.Errorf("cannot acquire lock: %v", err)
+ }
+ locked[abs] = true
+ return c, nil
+}
+
+var lockFn = lockPortable
+
+// lockPortable is a portable version not using fcntl. Doesn't handle crashes as gracefully,
+// since it can leave stale lock files.
+func lockPortable(name string) (io.Closer, error) {
+ fi, err := os.Stat(name)
+ if err == nil && fi.Size() > 0 {
+ st := portableLockStatus(name)
+ switch st {
+ case statusLocked:
+ return nil, fmt.Errorf("file %q already locked", name)
+ case statusStale:
+ os.Remove(name)
+ case statusInvalid:
+ return nil, fmt.Errorf("can't Lock file %q: has invalid contents", name)
+ }
+ }
+ f, err := os.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_TRUNC|os.O_EXCL, 0666)
+ if err != nil {
+ return nil, fmt.Errorf("failed to create lock file %s %v", name, err)
+ }
+ if err := json.NewEncoder(f).Encode(&pidLockMeta{OwnerPID: os.Getpid()}); err != nil {
+ return nil, fmt.Errorf("cannot write owner pid: %v", err)
+ }
+ return &unlocker{
+ f: f,
+ abs: name,
+ portable: true,
+ }, nil
+}
+
+type lockStatus int
+
+const (
+ statusInvalid lockStatus = iota
+ statusLocked
+ statusUnlocked
+ statusStale
+)
+
+type pidLockMeta struct {
+ OwnerPID int
+}
+
+func portableLockStatus(path string) lockStatus {
+ f, err := os.Open(path)
+ if err != nil {
+ return statusUnlocked
+ }
+ defer f.Close()
+ var meta pidLockMeta
+ if json.NewDecoder(f).Decode(&meta) != nil {
+ return statusInvalid
+ }
+ if meta.OwnerPID == 0 {
+ return statusInvalid
+ }
+ p, err := os.FindProcess(meta.OwnerPID)
+ if err != nil {
+ // e.g. on Windows
+ return statusStale
+ }
+ // On unix, os.FindProcess always is true, so we have to send
+ // it a signal to see if it's alive.
+ if signalZero != nil {
+ if p.Signal(signalZero) != nil {
+ return statusStale
+ }
+ }
+ return statusLocked
+}
+
+var signalZero os.Signal // nil or set by lock_sigzero.go
+
+var (
+ lockmu sync.Mutex
+ locked = map[string]bool{} // abs path -> true
+)
+
+type unlocker struct {
+ portable bool
+ f *os.File
+ abs string
+ // once guards the close method call.
+ once sync.Once
+ // err holds the error returned by Close.
+ err error
+}
+
+func (u *unlocker) Close() error {
+ u.once.Do(u.close)
+ return u.err
+}
+
+func (u *unlocker) close() {
+ lockmu.Lock()
+ defer lockmu.Unlock()
+ delete(locked, u.abs)
+
+ if u.portable {
+ // In the portable lock implementation, it's
+ // important to close before removing because
+ // Windows won't allow us to remove an open
+ // file.
+ if err := u.f.Close(); err != nil {
+ u.err = err
+ }
+ if err := os.Remove(u.abs); err != nil {
+ // Note that if both Close and Remove fail,
+ // we care more about the latter than the former
+ // so we'll return that error.
+ u.err = err
+ }
+ return
+ }
+ // In other implementatioons, it's nice for us to clean up.
+ // If we do do this, though, it needs to be before the
+ // u.f.Close below.
+ os.Remove(u.abs)
+ u.err = u.f.Close()
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/juju/go4/lock/lock_appengine.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/juju/go4/lock/lock_appengine.go b/traffic_stats/vendor/github.com/juju/go4/lock/lock_appengine.go
new file mode 100644
index 0000000..ab4cad6
--- /dev/null
+++ b/traffic_stats/vendor/github.com/juju/go4/lock/lock_appengine.go
@@ -0,0 +1,32 @@
+// +build appengine
+
+/*
+Copyright 2013 The Go Authors
+
+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 lock
+
+import (
+ "errors"
+ "io"
+)
+
+func init() {
+ lockFn = lockAppEngine
+}
+
+func lockAppEngine(name string) (io.Closer, error) {
+ return nil, errors.New("Lock not available on App Engine")
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/juju/go4/lock/lock_darwin_amd64.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/juju/go4/lock/lock_darwin_amd64.go b/traffic_stats/vendor/github.com/juju/go4/lock/lock_darwin_amd64.go
new file mode 100644
index 0000000..35f5787
--- /dev/null
+++ b/traffic_stats/vendor/github.com/juju/go4/lock/lock_darwin_amd64.go
@@ -0,0 +1,67 @@
+// +build darwin,amd64
+// +build !appengine
+
+/*
+Copyright 2013 The Go Authors
+
+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 lock
+
+import (
+ "fmt"
+ "io"
+ "os"
+ "syscall"
+ "unsafe"
+)
+
+func init() {
+ lockFn = lockFcntl
+}
+
+func lockFcntl(name string) (io.Closer, error) {
+ fi, err := os.Stat(name)
+ if err == nil && fi.Size() > 0 {
+ return nil, fmt.Errorf("can't Lock file %q: has non-zero size", name)
+ }
+
+ f, err := os.Create(name)
+ if err != nil {
+ return nil, fmt.Errorf("Lock Create of %s failed: %v", name, err)
+ }
+
+ // This type matches C's "struct flock" defined in /usr/include/sys/fcntl.h.
+ // TODO: move this into the standard syscall package.
+ k := struct {
+ Start uint64 // sizeof(off_t): 8
+ Len uint64 // sizeof(off_t): 8
+ Pid uint32 // sizeof(pid_t): 4
+ Type uint16 // sizeof(short): 2
+ Whence uint16 // sizeof(short): 2
+ }{
+ Type: syscall.F_WRLCK,
+ Whence: uint16(os.SEEK_SET),
+ Start: 0,
+ Len: 0, // 0 means to lock the entire file.
+ Pid: uint32(os.Getpid()),
+ }
+
+ _, _, errno := syscall.Syscall(syscall.SYS_FCNTL, f.Fd(), uintptr(syscall.F_SETLK), uintptr(unsafe.Pointer(&k)))
+ if errno != 0 {
+ f.Close()
+ return nil, errno
+ }
+ return &unlocker{f: f, abs: name}, nil
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/juju/go4/lock/lock_freebsd.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/juju/go4/lock/lock_freebsd.go b/traffic_stats/vendor/github.com/juju/go4/lock/lock_freebsd.go
new file mode 100644
index 0000000..ee2767a
--- /dev/null
+++ b/traffic_stats/vendor/github.com/juju/go4/lock/lock_freebsd.go
@@ -0,0 +1,66 @@
+/*
+Copyright 2013 The Go Authors
+
+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 lock
+
+import (
+ "fmt"
+ "io"
+ "os"
+ "syscall"
+ "unsafe"
+)
+
+func init() {
+ lockFn = lockFcntl
+}
+
+func lockFcntl(name string) (io.Closer, error) {
+ fi, err := os.Stat(name)
+ if err == nil && fi.Size() > 0 {
+ return nil, fmt.Errorf("can't Lock file %q: has non-zero size", name)
+ }
+
+ f, err := os.Create(name)
+ if err != nil {
+ return nil, err
+ }
+
+ // This type matches C's "struct flock" defined in /usr/include/fcntl.h.
+ // TODO: move this into the standard syscall package.
+ k := struct {
+ Start int64 /* off_t starting offset */
+ Len int64 /* off_t len = 0 means until end of file */
+ Pid int32 /* pid_t lock owner */
+ Type int16 /* short lock type: read/write, etc. */
+ Whence int16 /* short type of l_start */
+ Sysid int32 /* int remote system id or zero for local */
+ }{
+ Start: 0,
+ Len: 0, // 0 means to lock the entire file.
+ Pid: int32(os.Getpid()),
+ Type: syscall.F_WRLCK,
+ Whence: int16(os.SEEK_SET),
+ Sysid: 0,
+ }
+
+ _, _, errno := syscall.Syscall(syscall.SYS_FCNTL, f.Fd(), uintptr(syscall.F_SETLK), uintptr(unsafe.Pointer(&k)))
+ if errno != 0 {
+ f.Close()
+ return nil, errno
+ }
+ return &unlocker{f: f, abs: name}, nil
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/juju/go4/lock/lock_linux_amd64.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/juju/go4/lock/lock_linux_amd64.go b/traffic_stats/vendor/github.com/juju/go4/lock/lock_linux_amd64.go
new file mode 100644
index 0000000..08b3aae
--- /dev/null
+++ b/traffic_stats/vendor/github.com/juju/go4/lock/lock_linux_amd64.go
@@ -0,0 +1,67 @@
+// +build linux,amd64
+// +build !appengine
+
+/*
+Copyright 2013 The Go Authors
+
+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 lock
+
+import (
+ "fmt"
+ "io"
+ "os"
+ "syscall"
+ "unsafe"
+)
+
+func init() {
+ lockFn = lockFcntl
+}
+
+func lockFcntl(name string) (io.Closer, error) {
+ fi, err := os.Stat(name)
+ if err == nil && fi.Size() > 0 {
+ return nil, fmt.Errorf("can't Lock file %q: has non-zero size", name)
+ }
+
+ f, err := os.Create(name)
+ if err != nil {
+ return nil, err
+ }
+
+ // This type matches C's "struct flock" defined in /usr/include/bits/fcntl.h.
+ // TODO: move this into the standard syscall package.
+ k := struct {
+ Type uint32
+ Whence uint32
+ Start uint64
+ Len uint64
+ Pid uint32
+ }{
+ Type: syscall.F_WRLCK,
+ Whence: uint32(os.SEEK_SET),
+ Start: 0,
+ Len: 0, // 0 means to lock the entire file.
+ Pid: uint32(os.Getpid()),
+ }
+
+ _, _, errno := syscall.Syscall(syscall.SYS_FCNTL, f.Fd(), uintptr(syscall.F_SETLK), uintptr(unsafe.Pointer(&k)))
+ if errno != 0 {
+ f.Close()
+ return nil, errno
+ }
+ return &unlocker{f: f, abs: name}, nil
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/juju/go4/lock/lock_linux_arm.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/juju/go4/lock/lock_linux_arm.go b/traffic_stats/vendor/github.com/juju/go4/lock/lock_linux_arm.go
new file mode 100644
index 0000000..ebf87bd
--- /dev/null
+++ b/traffic_stats/vendor/github.com/juju/go4/lock/lock_linux_arm.go
@@ -0,0 +1,68 @@
+// +build linux,arm
+// +build !appengine
+
+/*
+Copyright 2013 The Go Authors
+
+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 lock
+
+import (
+ "fmt"
+ "io"
+ "os"
+ "syscall"
+ "unsafe"
+)
+
+func init() {
+ lockFn = lockFcntl
+}
+
+func lockFcntl(name string) (io.Closer, error) {
+ fi, err := os.Stat(name)
+ if err == nil && fi.Size() > 0 {
+ return nil, fmt.Errorf("can't Lock file %q: has non-zero size", name)
+ }
+
+ f, err := os.Create(name)
+ if err != nil {
+ return nil, err
+ }
+
+ // This type matches C's "struct flock" defined in /usr/include/bits/fcntl.h.
+ // TODO: move this into the standard syscall package.
+ k := struct {
+ Type uint16
+ Whence uint16
+ Start uint32
+ Len uint32
+ Pid uint32
+ }{
+ Type: syscall.F_WRLCK,
+ Whence: uint16(os.SEEK_SET),
+ Start: 0,
+ Len: 0, // 0 means to lock the entire file.
+ Pid: uint32(os.Getpid()),
+ }
+
+ const F_SETLK = 6 // actual value. syscall package is wrong: golang.org/issue/7059
+ _, _, errno := syscall.Syscall(syscall.SYS_FCNTL, f.Fd(), uintptr(F_SETLK), uintptr(unsafe.Pointer(&k)))
+ if errno != 0 {
+ f.Close()
+ return nil, errno
+ }
+ return &unlocker{f: f, abs: name}, nil
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/juju/go4/lock/lock_plan9.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/juju/go4/lock/lock_plan9.go b/traffic_stats/vendor/github.com/juju/go4/lock/lock_plan9.go
new file mode 100644
index 0000000..d841c27
--- /dev/null
+++ b/traffic_stats/vendor/github.com/juju/go4/lock/lock_plan9.go
@@ -0,0 +1,41 @@
+/*
+Copyright 2013 The Go Authors
+
+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 lock
+
+import (
+ "fmt"
+ "io"
+ "os"
+)
+
+func init() {
+ lockFn = lockPlan9
+}
+
+func lockPlan9(name string) (io.Closer, error) {
+ fi, err := os.Stat(name)
+ if err == nil && fi.Size() > 0 {
+ return nil, fmt.Errorf("can't Lock file %q: has non-zero size", name)
+ }
+
+ f, err := os.OpenFile(name, os.O_RDWR|os.O_CREATE, os.ModeExclusive|0644)
+ if err != nil {
+ return nil, fmt.Errorf("Lock Create of %s failed: %v", name, err)
+ }
+
+ return &unlocker{f: f, abs: name}, nil
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/juju/go4/lock/lock_sigzero.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/juju/go4/lock/lock_sigzero.go b/traffic_stats/vendor/github.com/juju/go4/lock/lock_sigzero.go
new file mode 100644
index 0000000..fd3ba2d
--- /dev/null
+++ b/traffic_stats/vendor/github.com/juju/go4/lock/lock_sigzero.go
@@ -0,0 +1,26 @@
+// +build !appengine
+// +build linux darwin freebsd openbsd netbsd dragonfly
+
+/*
+Copyright 2013 The Go Authors
+
+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 lock
+
+import "syscall"
+
+func init() {
+ signalZero = syscall.Signal(0)
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/juju/persistent-cookiejar/LICENSE
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/juju/persistent-cookiejar/LICENSE b/traffic_stats/vendor/github.com/juju/persistent-cookiejar/LICENSE
new file mode 100644
index 0000000..7448756
--- /dev/null
+++ b/traffic_stats/vendor/github.com/juju/persistent-cookiejar/LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2012 The Go Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/juju/persistent-cookiejar/README.md
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/juju/persistent-cookiejar/README.md b/traffic_stats/vendor/github.com/juju/persistent-cookiejar/README.md
new file mode 100644
index 0000000..f0c8c56
--- /dev/null
+++ b/traffic_stats/vendor/github.com/juju/persistent-cookiejar/README.md
@@ -0,0 +1,120 @@
+# cookiejar
+--
+ import "github.com/juju/persistent-cookiejar"
+
+Package cookiejar implements an in-memory RFC 6265-compliant http.CookieJar.
+
+This implementation is a fork of net/http/cookiejar which also implements
+methods for dumping the cookies to persistent storage and retrieving them.
+
+## Usage
+
+#### func DefaultCookieFile
+
+```go
+func DefaultCookieFile() string
+```
+DefaultCookieFile returns the default cookie file to use for persisting cookie
+data. The following names will be used in decending order of preference:
+
+ - the value of the $GOCOOKIES environment variable.
+ - $HOME/.go-cookies
+
+#### type Jar
+
+```go
+type Jar struct {
+}
+```
+
+Jar implements the http.CookieJar interface from the net/http package.
+
+#### func New
+
+```go
+func New(o *Options) (*Jar, error)
+```
+New returns a new cookie jar. A nil *Options is equivalent to a zero Options.
+
+New will return an error if the cookies could not be loaded from the file for
+any reason than if the file does not exist.
+
+#### func (*Jar) Cookies
+
+```go
+func (j *Jar) Cookies(u *url.URL) (cookies []*http.Cookie)
+```
+Cookies implements the Cookies method of the http.CookieJar interface.
+
+It returns an empty slice if the URL's scheme is not HTTP or HTTPS.
+
+#### func (*Jar) Save
+
+```go
+func (j *Jar) Save() error
+```
+Save saves the cookies to the persistent cookie file. Before the file is
+written, it reads any cookies that have been stored from it and merges them into
+j.
+
+#### func (*Jar) SetCookies
+
+```go
+func (j *Jar) SetCookies(u *url.URL, cookies []*http.Cookie)
+```
+SetCookies implements the SetCookies method of the http.CookieJar interface.
+
+It does nothing if the URL's scheme is not HTTP or HTTPS.
+
+#### type Options
+
+```go
+type Options struct {
+ // PublicSuffixList is the public suffix list that determines whether
+ // an HTTP server can set a cookie for a domain.
+ //
+ // If this is nil, the public suffix list implementation in golang.org/x/net/publicsuffix
+ // is used.
+ PublicSuffixList PublicSuffixList
+
+ // Filename holds the file to use for storage of the cookies.
+ // If it is empty, the value of DefaultCookieFile will be used.
+ Filename string
+}
+```
+
+Options are the options for creating a new Jar.
+
+#### type PublicSuffixList
+
+```go
+type PublicSuffixList interface {
+ // PublicSuffix returns the public suffix of domain.
+ //
+ // TODO: specify which of the caller and callee is responsible for IP
+ // addresses, for leading and trailing dots, for case sensitivity, and
+ // for IDN/Punycode.
+ PublicSuffix(domain string) string
+
+ // String returns a description of the source of this public suffix
+ // list. The description will typically contain something like a time
+ // stamp or version number.
+ String() string
+}
+```
+
+PublicSuffixList provides the public suffix of a domain. For example:
+
+ - the public suffix of "example.com" is "com",
+ - the public suffix of "foo1.foo2.foo3.co.uk" is "co.uk", and
+ - the public suffix of "bar.pvt.k12.ma.us" is "pvt.k12.ma.us".
+
+Implementations of PublicSuffixList must be safe for concurrent use by multiple
+goroutines.
+
+An implementation that always returns "" is valid and may be useful for testing
+but it is not secure: it means that the HTTP server for foo.com can set a cookie
+for bar.com.
+
+A public suffix list implementation is in the package
+golang.org/x/net/publicsuffix.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/juju/persistent-cookiejar/dependencies.tsv
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/juju/persistent-cookiejar/dependencies.tsv b/traffic_stats/vendor/github.com/juju/persistent-cookiejar/dependencies.tsv
new file mode 100644
index 0000000..2f722be
--- /dev/null
+++ b/traffic_stats/vendor/github.com/juju/persistent-cookiejar/dependencies.tsv
@@ -0,0 +1,4 @@
+github.com/juju/go4 git 40d72ab9641a2a8c36a9c46a51e28367115c8e59 2016-02-22T16:32:58Z
+golang.org/x/net git b6d7b1396ec874c3b00f6c84cd4301a17c56c8ed 2016-02-17T01:13:48Z
+gopkg.in/errgo.v1 git 66cb46252b94c1f3d65646f54ee8043ab38d766c 2015-10-07T15:31:57Z
+gopkg.in/retry.v1 git c09f6b86ba4d5d2cf5bdf0665364aec9fd4815db 2016-10-25T18:14:30Z
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/juju/persistent-cookiejar/jar.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/juju/persistent-cookiejar/jar.go b/traffic_stats/vendor/github.com/juju/persistent-cookiejar/jar.go
new file mode 100644
index 0000000..0a4df82
--- /dev/null
+++ b/traffic_stats/vendor/github.com/juju/persistent-cookiejar/jar.go
@@ -0,0 +1,680 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package cookiejar implements an in-memory RFC 6265-compliant http.CookieJar.
+//
+// This implementation is a fork of net/http/cookiejar which also
+// implements methods for dumping the cookies to persistent
+// storage and retrieving them.
+package cookiejar
+
+import (
+ "errors"
+ "fmt"
+ "net"
+ "net/http"
+ "net/url"
+ "os"
+ "path/filepath"
+ "runtime"
+ "sort"
+ "strings"
+ "sync"
+ "time"
+
+ "golang.org/x/net/publicsuffix"
+ "gopkg.in/errgo.v1"
+)
+
+// PublicSuffixList provides the public suffix of a domain. For example:
+// - the public suffix of "example.com" is "com",
+// - the public suffix of "foo1.foo2.foo3.co.uk" is "co.uk", and
+// - the public suffix of "bar.pvt.k12.ma.us" is "pvt.k12.ma.us".
+//
+// Implementations of PublicSuffixList must be safe for concurrent use by
+// multiple goroutines.
+//
+// An implementation that always returns "" is valid and may be useful for
+// testing but it is not secure: it means that the HTTP server for foo.com can
+// set a cookie for bar.com.
+//
+// A public suffix list implementation is in the package
+// golang.org/x/net/publicsuffix.
+type PublicSuffixList interface {
+ // PublicSuffix returns the public suffix of domain.
+ //
+ // TODO: specify which of the caller and callee is responsible for IP
+ // addresses, for leading and trailing dots, for case sensitivity, and
+ // for IDN/Punycode.
+ PublicSuffix(domain string) string
+
+ // String returns a description of the source of this public suffix
+ // list. The description will typically contain something like a time
+ // stamp or version number.
+ String() string
+}
+
+// Options are the options for creating a new Jar.
+type Options struct {
+ // PublicSuffixList is the public suffix list that determines whether
+ // an HTTP server can set a cookie for a domain.
+ //
+ // If this is nil, the public suffix list implementation in golang.org/x/net/publicsuffix
+ // is used.
+ PublicSuffixList PublicSuffixList
+
+ // Filename holds the file to use for storage of the cookies.
+ // If it is empty, the value of DefaultCookieFile will be used.
+ Filename string
+}
+
+// Jar implements the http.CookieJar interface from the net/http package.
+type Jar struct {
+ // filename holds the file that the cookies were loaded from.
+ filename string
+
+ psList PublicSuffixList
+
+ // mu locks the remaining fields.
+ mu sync.Mutex
+
+ // entries is a set of entries, keyed by their eTLD+1 and subkeyed by
+ // their name/domain/path.
+ entries map[string]map[string]entry
+}
+
+var noOptions Options
+
+// New returns a new cookie jar. A nil *Options is equivalent to a zero
+// Options.
+//
+// New will return an error if the cookies could not be loaded
+// from the file for any reason than if the file does not exist.
+func New(o *Options) (*Jar, error) {
+ return newAtTime(o, time.Now())
+}
+
+// newAtTime is like New but takes the current time as a parameter.
+func newAtTime(o *Options, now time.Time) (*Jar, error) {
+ jar := &Jar{
+ entries: make(map[string]map[string]entry),
+ }
+ if o == nil {
+ o = &noOptions
+ }
+ if jar.psList = o.PublicSuffixList; jar.psList == nil {
+ jar.psList = publicsuffix.List
+ }
+ if jar.filename = o.Filename; jar.filename == "" {
+ jar.filename = DefaultCookieFile()
+ }
+ if err := jar.load(); err != nil {
+ return nil, errgo.Notef(err, "cannot load cookies")
+ }
+ jar.deleteExpired(now)
+ return jar, nil
+}
+
+// homeDir returns the OS-specific home path as specified in the environment.
+func homeDir() string {
+ if runtime.GOOS == "windows" {
+ return filepath.Join(os.Getenv("HOMEDRIVE"), os.Getenv("HOMEPATH"))
+ }
+ return os.Getenv("HOME")
+}
+
+// entry is the internal representation of a cookie.
+//
+// This struct type is not used outside of this package per se, but the exported
+// fields are those of RFC 6265.
+// Note that this structure is marshaled to JSON, so backward-compatibility
+// should be preserved.
+type entry struct {
+ Name string
+ Value string
+ Domain string
+ Path string
+ Secure bool
+ HttpOnly bool
+ Persistent bool
+ HostOnly bool
+ Expires time.Time
+ Creation time.Time
+ LastAccess time.Time
+
+ // Updated records when the cookie was updated.
+ // This is different from creation time because a cookie
+ // can be changed without updating the creation time.
+ Updated time.Time
+
+ // CanonicalHost stores the original canonical host name
+ // that the cookie was associated with. We store this
+ // so that even if the public suffix list changes (for example
+ // when storing/loading cookies) we can still get the correct
+ // jar keys.
+ CanonicalHost string
+}
+
+// id returns the domain;path;name triple of e as an id.
+func (e *entry) id() string {
+ return id(e.Domain, e.Path, e.Name)
+}
+
+// id returns the domain;path;name triple as an id.
+func id(domain, path, name string) string {
+ return fmt.Sprintf("%s;%s;%s", domain, path, name)
+}
+
+// shouldSend determines whether e's cookie qualifies to be included in a
+// request to host/path. It is the caller's responsibility to check if the
+// cookie is expired.
+func (e *entry) shouldSend(https bool, host, path string) bool {
+ return e.domainMatch(host) && e.pathMatch(path) && (https || !e.Secure)
+}
+
+// domainMatch implements "domain-match" of RFC 6265 section 5.1.3.
+func (e *entry) domainMatch(host string) bool {
+ if e.Domain == host {
+ return true
+ }
+ return !e.HostOnly && hasDotSuffix(host, e.Domain)
+}
+
+// pathMatch implements "path-match" according to RFC 6265 section 5.1.4.
+func (e *entry) pathMatch(requestPath string) bool {
+ if requestPath == e.Path {
+ return true
+ }
+ if strings.HasPrefix(requestPath, e.Path) {
+ if e.Path[len(e.Path)-1] == '/' {
+ return true // The "/any/" matches "/any/path" case.
+ } else if requestPath[len(e.Path)] == '/' {
+ return true // The "/any" matches "/any/path" case.
+ }
+ }
+ return false
+}
+
+// hasDotSuffix reports whether s ends in "."+suffix.
+func hasDotSuffix(s, suffix string) bool {
+ return len(s) > len(suffix) && s[len(s)-len(suffix)-1] == '.' && s[len(s)-len(suffix):] == suffix
+}
+
+type byCanonicalHost struct {
+ byPathLength
+}
+
+func (s byCanonicalHost) Less(i, j int) bool {
+ e0, e1 := &s.byPathLength[i], &s.byPathLength[j]
+ if e0.CanonicalHost != e1.CanonicalHost {
+ return e0.CanonicalHost < e1.CanonicalHost
+ }
+ return s.byPathLength.Less(i, j)
+}
+
+// byPathLength is a []entry sort.Interface that sorts according to RFC 6265
+// section 5.4 point 2: by longest path and then by earliest creation time.
+type byPathLength []entry
+
+func (s byPathLength) Len() int { return len(s) }
+
+func (s byPathLength) Less(i, j int) bool {
+ e0, e1 := &s[i], &s[j]
+ if len(e0.Path) != len(e1.Path) {
+ return len(e0.Path) > len(e1.Path)
+ }
+ if !e0.Creation.Equal(e1.Creation) {
+ return e0.Creation.Before(e1.Creation)
+ }
+ // The following are not strictly necessary
+ // but are useful for providing deterministic
+ // behaviour in tests.
+ if e0.Name != e1.Name {
+ return e0.Name < e1.Name
+ }
+ return e0.Value < e1.Value
+}
+
+func (s byPathLength) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
+
+// Cookies implements the Cookies method of the http.CookieJar interface.
+//
+// It returns an empty slice if the URL's scheme is not HTTP or HTTPS.
+func (j *Jar) Cookies(u *url.URL) (cookies []*http.Cookie) {
+ return j.cookies(u, time.Now())
+}
+
+// cookies is like Cookies but takes the current time as a parameter.
+func (j *Jar) cookies(u *url.URL, now time.Time) (cookies []*http.Cookie) {
+ if u.Scheme != "http" && u.Scheme != "https" {
+ return cookies
+ }
+ host, err := canonicalHost(u.Host)
+ if err != nil {
+ return cookies
+ }
+ key := jarKey(host, j.psList)
+
+ j.mu.Lock()
+ defer j.mu.Unlock()
+
+ submap := j.entries[key]
+ if submap == nil {
+ return cookies
+ }
+
+ https := u.Scheme == "https"
+ path := u.Path
+ if path == "" {
+ path = "/"
+ }
+
+ var selected []entry
+ for id, e := range submap {
+ if !e.Expires.After(now) {
+ // Save some space by deleting the value when the cookie
+ // expires. We can't delete the cookie itself because then
+ // we wouldn't know that the cookie had expired when
+ // we merge with another cookie jar.
+ if e.Value != "" {
+ e.Value = ""
+ submap[id] = e
+ }
+ continue
+ }
+ if !e.shouldSend(https, host, path) {
+ continue
+ }
+ e.LastAccess = now
+ submap[id] = e
+ selected = append(selected, e)
+ }
+
+ sort.Sort(byPathLength(selected))
+ for _, e := range selected {
+ cookies = append(cookies, &http.Cookie{Name: e.Name, Value: e.Value})
+ }
+
+ return cookies
+}
+
+// AllCookies returns all cookies in the jar. The returned cookies will
+// have Domain, Expires, HttpOnly, Name, Secure, Path, and Value filled
+// out. Expired cookies will not be returned. This function does not
+// modify the cookie jar.
+func (j *Jar) AllCookies() (cookies []*http.Cookie) {
+ return j.allCookies(time.Now())
+}
+
+// allCookies is like AllCookies but takes the current time as a parameter.
+func (j *Jar) allCookies(now time.Time) []*http.Cookie {
+ var selected []entry
+ j.mu.Lock()
+ defer j.mu.Unlock()
+ for _, submap := range j.entries {
+ for _, e := range submap {
+ if !e.Expires.After(now) {
+ // Do not return expired cookies.
+ continue
+ }
+ selected = append(selected, e)
+ }
+ }
+
+ sort.Sort(byCanonicalHost{byPathLength(selected)})
+ cookies := make([]*http.Cookie, len(selected))
+ for i, e := range selected {
+ // Note: The returned cookies do not contain sufficient
+ // information to recreate the database.
+ cookies[i] = &http.Cookie{
+ Name: e.Name,
+ Value: e.Value,
+ Path: e.Path,
+ Domain: e.Domain,
+ Expires: e.Expires,
+ Secure: e.Secure,
+ HttpOnly: e.HttpOnly,
+ }
+ }
+
+ return cookies
+}
+
+// RemoveCookie removes the cookie matching the name, domain and path
+// specified by c.
+func (j *Jar) RemoveCookie(c *http.Cookie) {
+ j.mu.Lock()
+ defer j.mu.Unlock()
+ id := id(c.Domain, c.Path, c.Name)
+ key := jarKey(c.Domain, j.psList)
+ if e, ok := j.entries[key][id]; ok {
+ e.Value = ""
+ e.Expires = time.Now().Add(-1 * time.Second)
+ j.entries[key][id] = e
+ }
+}
+
+// merge merges all the given entries into j. More recently changed
+// cookies take precedence over older ones.
+func (j *Jar) merge(entries []entry) {
+ for _, e := range entries {
+ if e.CanonicalHost == "" {
+ continue
+ }
+ key := jarKey(e.CanonicalHost, j.psList)
+ id := e.id()
+ submap := j.entries[key]
+ if submap == nil {
+ j.entries[key] = map[string]entry{
+ id: e,
+ }
+ continue
+ }
+ oldEntry, ok := submap[id]
+ if !ok || e.Updated.After(oldEntry.Updated) {
+ submap[id] = e
+ }
+ }
+}
+
+var expiryRemovalDuration = 24 * time.Hour
+
+// deleteExpired deletes all entries that have expired for long enough
+// that we can actually expect there to be no external copies of it that
+// might resurrect the dead cookie.
+func (j *Jar) deleteExpired(now time.Time) {
+ for tld, submap := range j.entries {
+ for id, e := range submap {
+ if !e.Expires.After(now) && !e.Updated.Add(expiryRemovalDuration).After(now) {
+ delete(submap, id)
+ }
+ }
+ if len(submap) == 0 {
+ delete(j.entries, tld)
+ }
+ }
+}
+
+// RemoveAllHost removes any cookies from the jar that were set for the given host.
+func (j *Jar) RemoveAllHost(host string) {
+ host, err := canonicalHost(host)
+ if err != nil {
+ return
+ }
+ key := jarKey(host, j.psList)
+
+ j.mu.Lock()
+ defer j.mu.Unlock()
+
+ expired := time.Now().Add(-1 * time.Second)
+ submap := j.entries[key]
+ for id, e := range submap {
+ if e.CanonicalHost == host {
+ // Save some space by deleting the value when the cookie
+ // expires. We can't delete the cookie itself because then
+ // we wouldn't know that the cookie had expired when
+ // we merge with another cookie jar.
+ e.Value = ""
+ e.Expires = expired
+ submap[id] = e
+ }
+ }
+}
+
+// SetCookies implements the SetCookies method of the http.CookieJar interface.
+//
+// It does nothing if the URL's scheme is not HTTP or HTTPS.
+func (j *Jar) SetCookies(u *url.URL, cookies []*http.Cookie) {
+ j.setCookies(u, cookies, time.Now())
+}
+
+// setCookies is like SetCookies but takes the current time as parameter.
+func (j *Jar) setCookies(u *url.URL, cookies []*http.Cookie, now time.Time) {
+ if len(cookies) == 0 {
+ return
+ }
+ if u.Scheme != "http" && u.Scheme != "https" {
+ // TODO is this really correct? It might be nice to send
+ // cookies to websocket connections, for example.
+ return
+ }
+ host, err := canonicalHost(u.Host)
+ if err != nil {
+ return
+ }
+ key := jarKey(host, j.psList)
+ defPath := defaultPath(u.Path)
+
+ j.mu.Lock()
+ defer j.mu.Unlock()
+
+ submap := j.entries[key]
+ for _, cookie := range cookies {
+ e, err := j.newEntry(cookie, now, defPath, host)
+ if err != nil {
+ continue
+ }
+ e.CanonicalHost = host
+ id := e.id()
+ if submap == nil {
+ submap = make(map[string]entry)
+ j.entries[key] = submap
+ }
+ if old, ok := submap[id]; ok {
+ e.Creation = old.Creation
+ } else {
+ e.Creation = now
+ }
+ e.Updated = now
+ e.LastAccess = now
+ submap[id] = e
+ }
+}
+
+// canonicalHost strips port from host if present and returns the canonicalized
+// host name.
+func canonicalHost(host string) (string, error) {
+ var err error
+ host = strings.ToLower(host)
+ if hasPort(host) {
+ host, _, err = net.SplitHostPort(host)
+ if err != nil {
+ return "", err
+ }
+ }
+ if strings.HasSuffix(host, ".") {
+ // Strip trailing dot from fully qualified domain names.
+ host = host[:len(host)-1]
+ }
+ return toASCII(host)
+}
+
+// hasPort reports whether host contains a port number. host may be a host
+// name, an IPv4 or an IPv6 address.
+func hasPort(host string) bool {
+ colons := strings.Count(host, ":")
+ if colons == 0 {
+ return false
+ }
+ if colons == 1 {
+ return true
+ }
+ return host[0] == '[' && strings.Contains(host, "]:")
+}
+
+// jarKey returns the key to use for a jar.
+func jarKey(host string, psl PublicSuffixList) string {
+ if isIP(host) {
+ return host
+ }
+
+ var i int
+ if psl == nil {
+ i = strings.LastIndex(host, ".")
+ if i == -1 {
+ return host
+ }
+ } else {
+ suffix := psl.PublicSuffix(host)
+ if suffix == host {
+ return host
+ }
+ i = len(host) - len(suffix)
+ if i <= 0 || host[i-1] != '.' {
+ // The provided public suffix list psl is broken.
+ // Storing cookies under host is a safe stopgap.
+ return host
+ }
+ }
+ prevDot := strings.LastIndex(host[:i-1], ".")
+ return host[prevDot+1:]
+}
+
+// isIP reports whether host is an IP address.
+func isIP(host string) bool {
+ return net.ParseIP(host) != nil
+}
+
+// defaultPath returns the directory part of an URL's path according to
+// RFC 6265 section 5.1.4.
+func defaultPath(path string) string {
+ if len(path) == 0 || path[0] != '/' {
+ return "/" // Path is empty or malformed.
+ }
+
+ i := strings.LastIndex(path, "/") // Path starts with "/", so i != -1.
+ if i == 0 {
+ return "/" // Path has the form "/abc".
+ }
+ return path[:i] // Path is either of form "/abc/xyz" or "/abc/xyz/".
+}
+
+// newEntry creates an entry from a http.Cookie c. now is the current
+// time and is compared to c.Expires to determine deletion of c. defPath
+// and host are the default-path and the canonical host name of the URL
+// c was received from.
+//
+// The returned entry should be removed if its expiry time is in the
+// past. In this case, e may be incomplete, but it will be valid to call
+// e.id (which depends on e's Name, Domain and Path).
+//
+// A malformed c.Domain will result in an error.
+func (j *Jar) newEntry(c *http.Cookie, now time.Time, defPath, host string) (e entry, err error) {
+ e.Name = c.Name
+ if c.Path == "" || c.Path[0] != '/' {
+ e.Path = defPath
+ } else {
+ e.Path = c.Path
+ }
+
+ e.Domain, e.HostOnly, err = j.domainAndType(host, c.Domain)
+ if err != nil {
+ return e, err
+ }
+ // MaxAge takes precedence over Expires.
+ if c.MaxAge != 0 {
+ e.Persistent = true
+ e.Expires = now.Add(time.Duration(c.MaxAge) * time.Second)
+ if c.MaxAge < 0 {
+ return e, nil
+ }
+ } else if c.Expires.IsZero() {
+ e.Expires = endOfTime
+ } else {
+ e.Persistent = true
+ e.Expires = c.Expires
+ if !c.Expires.After(now) {
+ return e, nil
+ }
+ }
+
+ e.Value = c.Value
+ e.Secure = c.Secure
+ e.HttpOnly = c.HttpOnly
+
+ return e, nil
+}
+
+var (
+ errIllegalDomain = errors.New("cookiejar: illegal cookie domain attribute")
+ errMalformedDomain = errors.New("cookiejar: malformed cookie domain attribute")
+ errNoHostname = errors.New("cookiejar: no host name available (IP only)")
+)
+
+// endOfTime is the time when session (non-persistent) cookies expire.
+// This instant is representable in most date/time formats (not just
+// Go's time.Time) and should be far enough in the future.
+var endOfTime = time.Date(9999, 12, 31, 23, 59, 59, 0, time.UTC)
+
+// domainAndType determines the cookie's domain and hostOnly attribute.
+func (j *Jar) domainAndType(host, domain string) (string, bool, error) {
+ if domain == "" {
+ // No domain attribute in the SetCookie header indicates a
+ // host cookie.
+ return host, true, nil
+ }
+
+ if isIP(host) {
+ // According to RFC 6265 domain-matching includes not being
+ // an IP address.
+ // TODO: This might be relaxed as in common browsers.
+ return "", false, errNoHostname
+ }
+
+ // From here on: If the cookie is valid, it is a domain cookie (with
+ // the one exception of a public suffix below).
+ // See RFC 6265 section 5.2.3.
+ if domain[0] == '.' {
+ domain = domain[1:]
+ }
+
+ if len(domain) == 0 || domain[0] == '.' {
+ // Received either "Domain=." or "Domain=..some.thing",
+ // both are illegal.
+ return "", false, errMalformedDomain
+ }
+ domain = strings.ToLower(domain)
+
+ if domain[len(domain)-1] == '.' {
+ // We received stuff like "Domain=www.example.com.".
+ // Browsers do handle such stuff (actually differently) but
+ // RFC 6265 seems to be clear here (e.g. section 4.1.2.3) in
+ // requiring a reject. 4.1.2.3 is not normative, but
+ // "Domain Matching" (5.1.3) and "Canonicalized Host Names"
+ // (5.1.2) are.
+ return "", false, errMalformedDomain
+ }
+
+ // See RFC 6265 section 5.3 #5.
+ if j.psList != nil {
+ if ps := j.psList.PublicSuffix(domain); ps != "" && !hasDotSuffix(domain, ps) {
+ if host == domain {
+ // This is the one exception in which a cookie
+ // with a domain attribute is a host cookie.
+ return host, true, nil
+ }
+ return "", false, errIllegalDomain
+ }
+ }
+
+ // The domain must domain-match host: www.mycompany.com cannot
+ // set cookies for .ourcompetitors.com.
+ if host != domain && !hasDotSuffix(host, domain) {
+ return "", false, errIllegalDomain
+ }
+
+ return domain, false, nil
+}
+
+// DefaultCookieFile returns the default cookie file to use
+// for persisting cookie data.
+// The following names will be used in decending order of preference:
+// - the value of the $GOCOOKIES environment variable.
+// - $HOME/.go-cookies
+func DefaultCookieFile() string {
+ if f := os.Getenv("GOCOOKIES"); f != "" {
+ return f
+ }
+ return filepath.Join(homeDir(), ".go-cookies")
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/juju/persistent-cookiejar/punycode.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/juju/persistent-cookiejar/punycode.go b/traffic_stats/vendor/github.com/juju/persistent-cookiejar/punycode.go
new file mode 100644
index 0000000..ea7ceb5
--- /dev/null
+++ b/traffic_stats/vendor/github.com/juju/persistent-cookiejar/punycode.go
@@ -0,0 +1,159 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cookiejar
+
+// This file implements the Punycode algorithm from RFC 3492.
+
+import (
+ "fmt"
+ "strings"
+ "unicode/utf8"
+)
+
+// These parameter values are specified in section 5.
+//
+// All computation is done with int32s, so that overflow behavior is identical
+// regardless of whether int is 32-bit or 64-bit.
+const (
+ base int32 = 36
+ damp int32 = 700
+ initialBias int32 = 72
+ initialN int32 = 128
+ skew int32 = 38
+ tmax int32 = 26
+ tmin int32 = 1
+)
+
+// encode encodes a string as specified in section 6.3 and prepends prefix to
+// the result.
+//
+// The "while h < length(input)" line in the specification becomes "for
+// remaining != 0" in the Go code, because len(s) in Go is in bytes, not runes.
+func encode(prefix, s string) (string, error) {
+ output := make([]byte, len(prefix), len(prefix)+1+2*len(s))
+ copy(output, prefix)
+ delta, n, bias := int32(0), initialN, initialBias
+ b, remaining := int32(0), int32(0)
+ for _, r := range s {
+ if r < 0x80 {
+ b++
+ output = append(output, byte(r))
+ } else {
+ remaining++
+ }
+ }
+ h := b
+ if b > 0 {
+ output = append(output, '-')
+ }
+ for remaining != 0 {
+ m := int32(0x7fffffff)
+ for _, r := range s {
+ if m > r && r >= n {
+ m = r
+ }
+ }
+ delta += (m - n) * (h + 1)
+ if delta < 0 {
+ return "", fmt.Errorf("cookiejar: invalid label %q", s)
+ }
+ n = m
+ for _, r := range s {
+ if r < n {
+ delta++
+ if delta < 0 {
+ return "", fmt.Errorf("cookiejar: invalid label %q", s)
+ }
+ continue
+ }
+ if r > n {
+ continue
+ }
+ q := delta
+ for k := base; ; k += base {
+ t := k - bias
+ if t < tmin {
+ t = tmin
+ } else if t > tmax {
+ t = tmax
+ }
+ if q < t {
+ break
+ }
+ output = append(output, encodeDigit(t+(q-t)%(base-t)))
+ q = (q - t) / (base - t)
+ }
+ output = append(output, encodeDigit(q))
+ bias = adapt(delta, h+1, h == b)
+ delta = 0
+ h++
+ remaining--
+ }
+ delta++
+ n++
+ }
+ return string(output), nil
+}
+
+func encodeDigit(digit int32) byte {
+ switch {
+ case 0 <= digit && digit < 26:
+ return byte(digit + 'a')
+ case 26 <= digit && digit < 36:
+ return byte(digit + ('0' - 26))
+ }
+ panic("cookiejar: internal error in punycode encoding")
+}
+
+// adapt is the bias adaptation function specified in section 6.1.
+func adapt(delta, numPoints int32, firstTime bool) int32 {
+ if firstTime {
+ delta /= damp
+ } else {
+ delta /= 2
+ }
+ delta += delta / numPoints
+ k := int32(0)
+ for delta > ((base-tmin)*tmax)/2 {
+ delta /= base - tmin
+ k += base
+ }
+ return k + (base-tmin+1)*delta/(delta+skew)
+}
+
+// Strictly speaking, the remaining code below deals with IDNA (RFC 5890 and
+// friends) and not Punycode (RFC 3492) per se.
+
+// acePrefix is the ASCII Compatible Encoding prefix.
+const acePrefix = "xn--"
+
+// toASCII converts a domain or domain label to its ASCII form. For example,
+// toASCII("b�cher.example.com") is "xn--bcher-kva.example.com", and
+// toASCII("golang") is "golang".
+func toASCII(s string) (string, error) {
+ if ascii(s) {
+ return s, nil
+ }
+ labels := strings.Split(s, ".")
+ for i, label := range labels {
+ if !ascii(label) {
+ a, err := encode(acePrefix, label)
+ if err != nil {
+ return "", err
+ }
+ labels[i] = a
+ }
+ }
+ return strings.Join(labels, "."), nil
+}
+
+func ascii(s string) bool {
+ for i := 0; i < len(s); i++ {
+ if s[i] >= utf8.RuneSelf {
+ return false
+ }
+ }
+ return true
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/juju/persistent-cookiejar/serialize.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/juju/persistent-cookiejar/serialize.go b/traffic_stats/vendor/github.com/juju/persistent-cookiejar/serialize.go
new file mode 100644
index 0000000..534f73e
--- /dev/null
+++ b/traffic_stats/vendor/github.com/juju/persistent-cookiejar/serialize.go
@@ -0,0 +1,152 @@
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cookiejar
+
+import (
+ "encoding/json"
+ "io"
+ "log"
+ "os"
+ "sort"
+ "time"
+
+ "gopkg.in/retry.v1"
+
+ filelock "github.com/juju/go4/lock"
+ "gopkg.in/errgo.v1"
+)
+
+// Save saves the cookies to the persistent cookie file.
+// Before the file is written, it reads any cookies that
+// have been stored from it and merges them into j.
+func (j *Jar) Save() error {
+ return j.save(time.Now())
+}
+
+// save is like Save but takes the current time as a parameter.
+func (j *Jar) save(now time.Time) error {
+ locked, err := lockFile(lockFileName(j.filename))
+ if err != nil {
+ return errgo.Mask(err)
+ }
+ defer locked.Close()
+ f, err := os.OpenFile(j.filename, os.O_RDWR|os.O_CREATE, 0600)
+ if err != nil {
+ return errgo.Mask(err)
+ }
+ defer f.Close()
+ // TODO optimization: if the file hasn't changed since we
+ // loaded it, don't bother with the merge step.
+
+ j.mu.Lock()
+ defer j.mu.Unlock()
+ if err := j.mergeFrom(f); err != nil {
+ // The cookie file is probably corrupt.
+ log.Printf("cannot read cookie file to merge it; ignoring it: %v", err)
+ }
+ j.deleteExpired(now)
+ if err := f.Truncate(0); err != nil {
+ return errgo.Notef(err, "cannot truncate file")
+ }
+ if _, err := f.Seek(0, 0); err != nil {
+ return errgo.Mask(err)
+ }
+ return j.writeTo(f)
+}
+
+// load loads the cookies from j.filename. If the file does not exist,
+// no error will be returned and no cookies will be loaded.
+func (j *Jar) load() error {
+ locked, err := lockFile(lockFileName(j.filename))
+ if err != nil {
+ return errgo.Mask(err)
+ }
+ defer locked.Close()
+ f, err := os.Open(j.filename)
+ if err != nil {
+ if os.IsNotExist(err) {
+ return nil
+ }
+ return err
+ }
+ defer f.Close()
+ if err := j.mergeFrom(f); err != nil {
+ return errgo.Mask(err)
+ }
+ return nil
+}
+
+// mergeFrom reads all the cookies from r and stores them in the Jar.
+func (j *Jar) mergeFrom(r io.Reader) error {
+ decoder := json.NewDecoder(r)
+ // Cope with old cookiejar format by just discarding
+ // cookies, but still return an error if it's invalid JSON.
+ var data json.RawMessage
+ if err := decoder.Decode(&data); err != nil {
+ if err == io.EOF {
+ // Empty file.
+ return nil
+ }
+ return err
+ }
+ var entries []entry
+ if err := json.Unmarshal(data, &entries); err != nil {
+ log.Printf("warning: discarding cookies in invalid format (error: %v)", err)
+ return nil
+ }
+ j.merge(entries)
+ return nil
+}
+
+// writeTo writes all the cookies in the jar to w
+// as a JSON array.
+func (j *Jar) writeTo(w io.Writer) error {
+ encoder := json.NewEncoder(w)
+ entries := j.allPersistentEntries()
+ if err := encoder.Encode(entries); err != nil {
+ return err
+ }
+ return nil
+}
+
+// allPersistentEntries returns all the entries in the jar, sorted by primarly by canonical host
+// name and secondarily by path length.
+func (j *Jar) allPersistentEntries() []entry {
+ var entries []entry
+ for _, submap := range j.entries {
+ for _, e := range submap {
+ if e.Persistent {
+ entries = append(entries, e)
+ }
+ }
+ }
+ sort.Sort(byCanonicalHost{entries})
+ return entries
+}
+
+// lockFileName returns the name of the lock file associated with
+// the given path.
+func lockFileName(path string) string {
+ return path + ".lock"
+}
+
+var attempt = retry.LimitTime(3*time.Second, retry.Exponential{
+ Initial: 100 * time.Microsecond,
+ Factor: 1.5,
+ MaxDelay: 100 * time.Millisecond,
+})
+
+func lockFile(path string) (io.Closer, error) {
+ for a := retry.Start(attempt, nil); a.Next(); {
+ locker, err := filelock.Lock(path)
+ if err == nil {
+ return locker, nil
+ }
+ if !a.More() {
+ return nil, errgo.Notef(err, "file locked for too long; giving up")
+ }
+ }
+ panic("unreachable")
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/pkg/errors/.gitignore
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/pkg/errors/.gitignore b/traffic_stats/vendor/github.com/pkg/errors/.gitignore
new file mode 100644
index 0000000..daf913b
--- /dev/null
+++ b/traffic_stats/vendor/github.com/pkg/errors/.gitignore
@@ -0,0 +1,24 @@
+# Compiled Object files, Static and Dynamic libs (Shared Objects)
+*.o
+*.a
+*.so
+
+# Folders
+_obj
+_test
+
+# Architecture specific extensions/prefixes
+*.[568vq]
+[568vq].out
+
+*.cgo1.go
+*.cgo2.c
+_cgo_defun.c
+_cgo_gotypes.go
+_cgo_export.*
+
+_testmain.go
+
+*.exe
+*.test
+*.prof
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/pkg/errors/.travis.yml
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/pkg/errors/.travis.yml b/traffic_stats/vendor/github.com/pkg/errors/.travis.yml
new file mode 100644
index 0000000..567ccdb
--- /dev/null
+++ b/traffic_stats/vendor/github.com/pkg/errors/.travis.yml
@@ -0,0 +1,11 @@
+language: go
+go_import_path: github.com/pkg/errors
+go:
+ - 1.4.3
+ - 1.5.4
+ - 1.6.3
+ - 1.7.3
+ - tip
+
+script:
+ - go test -v ./...
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/pkg/errors/LICENSE
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/pkg/errors/LICENSE b/traffic_stats/vendor/github.com/pkg/errors/LICENSE
new file mode 100644
index 0000000..835ba3e
--- /dev/null
+++ b/traffic_stats/vendor/github.com/pkg/errors/LICENSE
@@ -0,0 +1,23 @@
+Copyright (c) 2015, Dave Cheney <da...@cheney.net>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/pkg/errors/README.md
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/pkg/errors/README.md b/traffic_stats/vendor/github.com/pkg/errors/README.md
new file mode 100644
index 0000000..273db3c
--- /dev/null
+++ b/traffic_stats/vendor/github.com/pkg/errors/README.md
@@ -0,0 +1,52 @@
+# errors [](https://travis-ci.org/pkg/errors) [](https://ci.appveyor.com/project/davecheney/errors/branch/master) [](http://godoc.org/github.com/pkg/errors) [](https://goreportcard.com/report/github.com/pkg/errors)
+
+Package errors provides simple error handling primitives.
+
+`go get github.com/pkg/errors`
+
+The traditional error handling idiom in Go is roughly akin to
+```go
+if err != nil {
+ return err
+}
+```
+which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error.
+
+## Adding context to an error
+
+The errors.Wrap function returns a new error that adds context to the original error. For example
+```go
+_, err := ioutil.ReadAll(r)
+if err != nil {
+ return errors.Wrap(err, "read failed")
+}
+```
+## Retrieving the cause of an error
+
+Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`.
+```go
+type causer interface {
+ Cause() error
+}
+```
+`errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example:
+```go
+switch err := errors.Cause(err).(type) {
+case *MyError:
+ // handle specifically
+default:
+ // unknown error
+}
+```
+
+[Read the package documentation for more information](https://godoc.org/github.com/pkg/errors).
+
+## Contributing
+
+We welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high.
+
+Before proposing a change, please discuss your change by raising an issue.
+
+## Licence
+
+BSD-2-Clause
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/pkg/errors/appveyor.yml
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/pkg/errors/appveyor.yml b/traffic_stats/vendor/github.com/pkg/errors/appveyor.yml
new file mode 100644
index 0000000..a932ead
--- /dev/null
+++ b/traffic_stats/vendor/github.com/pkg/errors/appveyor.yml
@@ -0,0 +1,32 @@
+version: build-{build}.{branch}
+
+clone_folder: C:\gopath\src\github.com\pkg\errors
+shallow_clone: true # for startup speed
+
+environment:
+ GOPATH: C:\gopath
+
+platform:
+ - x64
+
+# http://www.appveyor.com/docs/installed-software
+install:
+ # some helpful output for debugging builds
+ - go version
+ - go env
+ # pre-installed MinGW at C:\MinGW is 32bit only
+ # but MSYS2 at C:\msys64 has mingw64
+ - set PATH=C:\msys64\mingw64\bin;%PATH%
+ - gcc --version
+ - g++ --version
+
+build_script:
+ - go install -v ./...
+
+test_script:
+ - set PATH=C:\gopath\bin;%PATH%
+ - go test -v ./...
+
+#artifacts:
+# - path: '%GOPATH%\bin\*.exe'
+deploy: off
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/pkg/errors/errors.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/pkg/errors/errors.go b/traffic_stats/vendor/github.com/pkg/errors/errors.go
new file mode 100644
index 0000000..842ee80
--- /dev/null
+++ b/traffic_stats/vendor/github.com/pkg/errors/errors.go
@@ -0,0 +1,269 @@
+// Package errors provides simple error handling primitives.
+//
+// The traditional error handling idiom in Go is roughly akin to
+//
+// if err != nil {
+// return err
+// }
+//
+// which applied recursively up the call stack results in error reports
+// without context or debugging information. The errors package allows
+// programmers to add context to the failure path in their code in a way
+// that does not destroy the original value of the error.
+//
+// Adding context to an error
+//
+// The errors.Wrap function returns a new error that adds context to the
+// original error by recording a stack trace at the point Wrap is called,
+// and the supplied message. For example
+//
+// _, err := ioutil.ReadAll(r)
+// if err != nil {
+// return errors.Wrap(err, "read failed")
+// }
+//
+// If additional control is required the errors.WithStack and errors.WithMessage
+// functions destructure errors.Wrap into its component operations of annotating
+// an error with a stack trace and an a message, respectively.
+//
+// Retrieving the cause of an error
+//
+// Using errors.Wrap constructs a stack of errors, adding context to the
+// preceding error. Depending on the nature of the error it may be necessary
+// to reverse the operation of errors.Wrap to retrieve the original error
+// for inspection. Any error value which implements this interface
+//
+// type causer interface {
+// Cause() error
+// }
+//
+// can be inspected by errors.Cause. errors.Cause will recursively retrieve
+// the topmost error which does not implement causer, which is assumed to be
+// the original cause. For example:
+//
+// switch err := errors.Cause(err).(type) {
+// case *MyError:
+// // handle specifically
+// default:
+// // unknown error
+// }
+//
+// causer interface is not exported by this package, but is considered a part
+// of stable public API.
+//
+// Formatted printing of errors
+//
+// All error values returned from this package implement fmt.Formatter and can
+// be formatted by the fmt package. The following verbs are supported
+//
+// %s print the error. If the error has a Cause it will be
+// printed recursively
+// %v see %s
+// %+v extended format. Each Frame of the error's StackTrace will
+// be printed in detail.
+//
+// Retrieving the stack trace of an error or wrapper
+//
+// New, Errorf, Wrap, and Wrapf record a stack trace at the point they are
+// invoked. This information can be retrieved with the following interface.
+//
+// type stackTracer interface {
+// StackTrace() errors.StackTrace
+// }
+//
+// Where errors.StackTrace is defined as
+//
+// type StackTrace []Frame
+//
+// The Frame type represents a call site in the stack trace. Frame supports
+// the fmt.Formatter interface that can be used for printing information about
+// the stack trace of this error. For example:
+//
+// if err, ok := err.(stackTracer); ok {
+// for _, f := range err.StackTrace() {
+// fmt.Printf("%+s:%d", f)
+// }
+// }
+//
+// stackTracer interface is not exported by this package, but is considered a part
+// of stable public API.
+//
+// See the documentation for Frame.Format for more details.
+package errors
+
+import (
+ "fmt"
+ "io"
+)
+
+// New returns an error with the supplied message.
+// New also records the stack trace at the point it was called.
+func New(message string) error {
+ return &fundamental{
+ msg: message,
+ stack: callers(),
+ }
+}
+
+// Errorf formats according to a format specifier and returns the string
+// as a value that satisfies error.
+// Errorf also records the stack trace at the point it was called.
+func Errorf(format string, args ...interface{}) error {
+ return &fundamental{
+ msg: fmt.Sprintf(format, args...),
+ stack: callers(),
+ }
+}
+
+// fundamental is an error that has a message and a stack, but no caller.
+type fundamental struct {
+ msg string
+ *stack
+}
+
+func (f *fundamental) Error() string { return f.msg }
+
+func (f *fundamental) Format(s fmt.State, verb rune) {
+ switch verb {
+ case 'v':
+ if s.Flag('+') {
+ io.WriteString(s, f.msg)
+ f.stack.Format(s, verb)
+ return
+ }
+ fallthrough
+ case 's':
+ io.WriteString(s, f.msg)
+ case 'q':
+ fmt.Fprintf(s, "%q", f.msg)
+ }
+}
+
+// WithStack annotates err with a stack trace at the point WithStack was called.
+// If err is nil, WithStack returns nil.
+func WithStack(err error) error {
+ if err == nil {
+ return nil
+ }
+ return &withStack{
+ err,
+ callers(),
+ }
+}
+
+type withStack struct {
+ error
+ *stack
+}
+
+func (w *withStack) Cause() error { return w.error }
+
+func (w *withStack) Format(s fmt.State, verb rune) {
+ switch verb {
+ case 'v':
+ if s.Flag('+') {
+ fmt.Fprintf(s, "%+v", w.Cause())
+ w.stack.Format(s, verb)
+ return
+ }
+ fallthrough
+ case 's':
+ io.WriteString(s, w.Error())
+ case 'q':
+ fmt.Fprintf(s, "%q", w.Error())
+ }
+}
+
+// Wrap returns an error annotating err with a stack trace
+// at the point Wrap is called, and the supplied message.
+// If err is nil, Wrap returns nil.
+func Wrap(err error, message string) error {
+ if err == nil {
+ return nil
+ }
+ err = &withMessage{
+ cause: err,
+ msg: message,
+ }
+ return &withStack{
+ err,
+ callers(),
+ }
+}
+
+// Wrapf returns an error annotating err with a stack trace
+// at the point Wrapf is call, and the format specifier.
+// If err is nil, Wrapf returns nil.
+func Wrapf(err error, format string, args ...interface{}) error {
+ if err == nil {
+ return nil
+ }
+ err = &withMessage{
+ cause: err,
+ msg: fmt.Sprintf(format, args...),
+ }
+ return &withStack{
+ err,
+ callers(),
+ }
+}
+
+// WithMessage annotates err with a new message.
+// If err is nil, WithMessage returns nil.
+func WithMessage(err error, message string) error {
+ if err == nil {
+ return nil
+ }
+ return &withMessage{
+ cause: err,
+ msg: message,
+ }
+}
+
+type withMessage struct {
+ cause error
+ msg string
+}
+
+func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() }
+func (w *withMessage) Cause() error { return w.cause }
+
+func (w *withMessage) Format(s fmt.State, verb rune) {
+ switch verb {
+ case 'v':
+ if s.Flag('+') {
+ fmt.Fprintf(s, "%+v\n", w.Cause())
+ io.WriteString(s, w.msg)
+ return
+ }
+ fallthrough
+ case 's', 'q':
+ io.WriteString(s, w.Error())
+ }
+}
+
+// Cause returns the underlying cause of the error, if possible.
+// An error value has a cause if it implements the following
+// interface:
+//
+// type causer interface {
+// Cause() error
+// }
+//
+// If the error does not implement Cause, the original error will
+// be returned. If the error is nil, nil will be returned without further
+// investigation.
+func Cause(err error) error {
+ type causer interface {
+ Cause() error
+ }
+
+ for err != nil {
+ cause, ok := err.(causer)
+ if !ok {
+ break
+ }
+ err = cause.Cause()
+ }
+ return err
+}
[27/29] incubator-trafficcontrol git commit: Remove traffic stats
test file, the previous tests were only a placeholder, and not worth keeping
Posted by ne...@apache.org.
Remove traffic stats test file, the previous tests were only a placeholder, and not worth keeping
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/5b72a490
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/5b72a490
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/5b72a490
Branch: refs/heads/master
Commit: 5b72a490789db18d1a5b5e0fd0684092236f7015
Parents: b678410
Author: sbogacz <sb...@zvelo.com>
Authored: Wed Jan 11 22:08:08 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
traffic_stats/traffic_stats_test.go | 34 --------------------------------
1 file changed, 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5b72a490/traffic_stats/traffic_stats_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/traffic_stats_test.go b/traffic_stats/traffic_stats_test.go
deleted file mode 100644
index 02a387d..0000000
--- a/traffic_stats/traffic_stats_test.go
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-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.
-*/
-
-package main
-
-import (
- "testing"
-
- . "github.com/smartystreets/goconvey/convey"
-)
-
-func TestMain(t *testing.T) {
- Convey("Constants should be right", t, func() {
- So(FATAL, ShouldEqual, 0)
- So(ERROR, ShouldEqual, 1)
- So(WARN, ShouldEqual, 2)
- })
-}
[12/29] incubator-trafficcontrol git commit: Add license statement to
influxdb file heads
Posted by ne...@apache.org.
Add license statement to influxdb file heads
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/e3a4d6d4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/e3a4d6d4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/e3a4d6d4
Branch: refs/heads/master
Commit: e3a4d6d4c1747a284502dcf0d96dc767437d59be
Parents: 4290ea5
Author: sbogacz <sb...@zvelo.com>
Authored: Tue Jan 10 19:50:37 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
traffic_stats/influxdb/config.go | 19 +++++++++++++++++++
traffic_stats/influxdb/query.go | 19 +++++++++++++++++++
2 files changed, 38 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e3a4d6d4/traffic_stats/influxdb/config.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb/config.go b/traffic_stats/influxdb/config.go
index 376d4f5..072419c 100644
--- a/traffic_stats/influxdb/config.go
+++ b/traffic_stats/influxdb/config.go
@@ -1,3 +1,22 @@
+/*
+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.
+*/
+
package influxdb
import (
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e3a4d6d4/traffic_stats/influxdb/query.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb/query.go b/traffic_stats/influxdb/query.go
index d1afa76..1c78f5a 100644
--- a/traffic_stats/influxdb/query.go
+++ b/traffic_stats/influxdb/query.go
@@ -1,3 +1,22 @@
+/*
+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.
+*/
+
package influxdb
import (
[18/29] incubator-trafficcontrol git commit: Add some helper
functions to make it easier to write tests
Posted by ne...@apache.org.
Add some helper functions to make it easier to write tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/b678410c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/b678410c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/b678410c
Branch: refs/heads/master
Commit: b678410cccc6c93940a597b797b8363b66eda66a
Parents: 4563a04
Author: sbogacz <sb...@zvelo.com>
Authored: Wed Jan 11 22:06:53 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
traffic_stats/assert/testhelpers.go | 109 +++++++++++++++++++++++++++++++
1 file changed, 109 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/b678410c/traffic_stats/assert/testhelpers.go
----------------------------------------------------------------------
diff --git a/traffic_stats/assert/testhelpers.go b/traffic_stats/assert/testhelpers.go
new file mode 100644
index 0000000..cc5f1e1
--- /dev/null
+++ b/traffic_stats/assert/testhelpers.go
@@ -0,0 +1,109 @@
+/*
+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.
+*/
+
+package assert
+
+import (
+ "reflect"
+ "testing"
+)
+
+// NotNil takes a value, and checks whether that value is not nil, failing the test
+// if not
+func NotNil(t *testing.T, a interface{}) {
+ if a == nil {
+ t.Errorf("expected %v to be non-nil, but it is", a)
+ }
+}
+
+// Nil takes a value, and checks whether that value is nil, failing the test
+// if not
+func Nil(t *testing.T, a interface{}) {
+ if a != nil {
+ t.Errorf("expected %v to be nil, but it's not", a)
+ }
+}
+
+// Equal takes two values, checks whether they are equal (using a deep equal
+// check) and fails the test if not
+func Equal(t *testing.T, a, b interface{}) {
+ if !reflect.DeepEqual(a, b) {
+ t.Errorf("expected %v to equal %v, but it does not", a, b)
+ }
+}
+
+// Empty takes a value and checks whether it is empty for the given type
+// supports slices, arrays, channels, strings, and maps
+func Empty(t *testing.T, a interface{}) {
+ val := reflect.ValueOf(a)
+ switch val.Kind() {
+ case reflect.Slice:
+ if val.Len() != 0 {
+ t.Errorf("expected %v to be empty, but it is not", a)
+ }
+ case reflect.Array:
+ if val.Len() != 0 {
+ t.Errorf("expected %v to be empty, but it is not", a)
+ }
+ case reflect.Chan:
+ if val.Len() != 0 {
+ t.Errorf("expected %v to be empty, but it is not", a)
+ }
+ case reflect.String:
+ if val.Len() != 0 {
+ t.Errorf("expected %v to be empty, but it is not", a)
+ }
+ case reflect.Map:
+ if val.Len() != 0 {
+ t.Errorf("expected %v to be empty, but it is not", a)
+ }
+ default:
+ t.Errorf("can't check that %v of type %T is empty", a, a)
+ }
+}
+
+// NotEmpty takes a value and checks whether it isvnot empty for the given type
+// supports slices, arrays, channels, strings, and maps
+func NotEmpty(t *testing.T, a interface{}) {
+ val := reflect.ValueOf(a)
+ switch val.Kind() {
+ case reflect.Slice:
+ if val.Len() == 0 {
+ t.Errorf("expected %v to not be empty, but it is", a)
+ }
+ case reflect.Array:
+ if val.Len() == 0 {
+ t.Errorf("expected %v to not be empty, but it is", a)
+ }
+ case reflect.Chan:
+ if val.Len() == 0 {
+ t.Errorf("expected %v to not be empty, but it is", a)
+ }
+ case reflect.String:
+ if val.Len() == 0 {
+ t.Errorf("expected %v to not be empty, but it is", a)
+ }
+ case reflect.Map:
+ if val.Len() == 0 {
+ t.Errorf("expected %v to not be empty, but it is", a)
+ }
+ default:
+ t.Errorf("can't check that %v of type %T is not empty", a, a)
+ }
+}
[10/29] incubator-trafficcontrol git commit: Add influxdb config
object, Flags(), QueryDB(), and Create() methods
Posted by ne...@apache.org.
Add influxdb config object, Flags(), QueryDB(), and Create() methods
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/3d95afa4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/3d95afa4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/3d95afa4
Branch: refs/heads/master
Commit: 3d95afa4a3de560e293fe85bad26d426e75ebacb
Parents: 9d913ed
Author: sbogacz <sb...@zvelo.com>
Authored: Tue Jan 10 19:42:48 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
traffic_stats/influxdb/config.go | 51 +++++++++++++++++++++++++++++++++++
traffic_stats/influxdb/query.go | 33 +++++++++++++++++++++++
2 files changed, 84 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/3d95afa4/traffic_stats/influxdb/config.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb/config.go b/traffic_stats/influxdb/config.go
new file mode 100644
index 0000000..376d4f5
--- /dev/null
+++ b/traffic_stats/influxdb/config.go
@@ -0,0 +1,51 @@
+package influxdb
+
+import (
+ "flag"
+ "fmt"
+ "strings"
+
+ influx "github.com/influxdata/influxdb/client/v2"
+ "github.com/pkg/errors"
+)
+
+// Config holds the requisite information to connect to an influx db instance
+// prefix is an optional variable that is set via the Flags method, so as to
+// distinguish between flags for different influxdb instances
+type Config struct {
+ prefix string
+ User string
+ Password string
+ URL string
+}
+
+// Flags configures the cli flags for the config. If more than one config is
+// present for a program, it should be differentiated by a different prefix, so
+// that the flag names don't collide
+func (c *Config) Flags(prefix string) {
+ c.prefix = prefix
+ flag.StringVar(&c.URL, flagName(c.prefix, "url"), "http://localhost:8086", "The influxdb url and port")
+ flag.StringVar(&c.User, flagName(c.prefix, "user"), "", "The influxdb username to connect to the db")
+ flag.StringVar(&c.Password, flagName(c.prefix, "password"), "", "The influxdb password to connect to the db")
+}
+
+// NewHTTPClient tries to use the given configuration to
+func (c *Config) NewHTTPClient() (influx.Client, error) {
+ client, err := influx.NewHTTPClient(influx.HTTPConfig{
+ Addr: c.URL,
+ Username: c.User,
+ Password: c.Password,
+ })
+ if err != nil {
+ return nil, errors.Wrap(err, "Error creating influx client")
+ }
+ _, _, err = client.Ping(10)
+ return client, errors.Wrap(err, "Error creating influx client")
+}
+
+func flagName(prefix, name string) string {
+ if prefix != "" {
+ prefix = fmt.Sprintf("%s-", prefix)
+ }
+ return strings.ToLower(fmt.Sprintf("%s%s", prefix, name))
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/3d95afa4/traffic_stats/influxdb/query.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb/query.go b/traffic_stats/influxdb/query.go
new file mode 100644
index 0000000..d1afa76
--- /dev/null
+++ b/traffic_stats/influxdb/query.go
@@ -0,0 +1,33 @@
+package influxdb
+
+import (
+ influx "github.com/influxdata/influxdb/client/v2"
+ "github.com/pkg/errors"
+)
+
+// QueryDB takes an influx client interface, cmd, and db strings. It tries to
+// execute the query on the given client, and returns a slice of influx.Result,
+// and an error, if any were present
+func QueryDB(client influx.Client, cmd, db string) (res []influx.Result, err error) {
+ q := influx.Query{
+ Command: cmd,
+ Database: db,
+ }
+ response, err := client.Query(q)
+ if err != nil {
+ return res, errors.Wrapf(err, "failed to execute cmd: %s on db %s", cmd, db)
+ }
+ if response.Error() != nil {
+ return res, errors.Wrapf(response.Error(), "got error in query response for cmd: %s on db %s", cmd, db)
+ }
+ res = response.Results
+
+ return res, err
+}
+
+// Create takes an influx.Client, and a create cmd in order to create objects
+// in the influx db (it doesn't require a db argument like QueryDB)
+func Create(client influx.Client, cmd string) (err error) {
+ _, err = QueryDB(client, cmd, "")
+ return err
+}
[04/29] incubator-trafficcontrol git commit: When using iota in a
cons() block, it need only be called once
Posted by ne...@apache.org.
When using iota in a cons() block, it need only be called once
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/9d913ed0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/9d913ed0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/9d913ed0
Branch: refs/heads/master
Commit: 9d913ed04837a6f2efec5a383b7dc5334b893f7a
Parents: f7061c1
Author: sbogacz <sb...@zvelo.com>
Authored: Sat Jan 7 00:16:34 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
.../influxdb_tools/sync/sync_ts_databases.go | 1 +
traffic_stats/traffic_stats.go | 4 +--
traffic_stats/traffic_stats_test.go | 34 ++++++++++++++++++++
3 files changed, 37 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/9d913ed0/traffic_stats/influxdb_tools/sync/sync_ts_databases.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/sync/sync_ts_databases.go b/traffic_stats/influxdb_tools/sync/sync_ts_databases.go
index 02a8249..00cd13b 100644
--- a/traffic_stats/influxdb_tools/sync/sync_ts_databases.go
+++ b/traffic_stats/influxdb_tools/sync/sync_ts_databases.go
@@ -50,6 +50,7 @@ type deliveryServiceStats struct {
deliveryService string
cacheGroup string
}
+
type dailyStats struct {
t string //time
cdn string
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/9d913ed0/traffic_stats/traffic_stats.go
----------------------------------------------------------------------
diff --git a/traffic_stats/traffic_stats.go b/traffic_stats/traffic_stats.go
index 4f720c1..18419ca 100644
--- a/traffic_stats/traffic_stats.go
+++ b/traffic_stats/traffic_stats.go
@@ -44,9 +44,9 @@ const (
// FATAL will exit after printing error
FATAL = iota
// ERROR will just keep going, print error
- ERROR = iota
+ ERROR
// WARN will keep going and print a warning
- WARN = iota
+ WARN
)
const (
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/9d913ed0/traffic_stats/traffic_stats_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/traffic_stats_test.go b/traffic_stats/traffic_stats_test.go
new file mode 100644
index 0000000..02a387d
--- /dev/null
+++ b/traffic_stats/traffic_stats_test.go
@@ -0,0 +1,34 @@
+/*
+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.
+*/
+
+package main
+
+import (
+ "testing"
+
+ . "github.com/smartystreets/goconvey/convey"
+)
+
+func TestMain(t *testing.T) {
+ Convey("Constants should be right", t, func() {
+ So(FATAL, ShouldEqual, 0)
+ So(ERROR, ShouldEqual, 1)
+ So(WARN, ShouldEqual, 2)
+ })
+}
[21/29] incubator-trafficcontrol git commit: Update vendor going more
thoroughly through deps recursively... some cleanup may be called for in a
follow up PR
Posted by ne...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/golang.org/x/net/publicsuffix/table.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/golang.org/x/net/publicsuffix/table.go b/traffic_stats/vendor/golang.org/x/net/publicsuffix/table.go
new file mode 100644
index 0000000..bf20c03
--- /dev/null
+++ b/traffic_stats/vendor/golang.org/x/net/publicsuffix/table.go
@@ -0,0 +1,9074 @@
+// generated by go run gen.go; DO NOT EDIT
+
+package publicsuffix
+
+const version = "publicsuffix.org's public_suffix_list.dat, git revision 915565885d0fbd25caf7d8b339cd3478f558da94 (2016-10-19T08:16:09Z)"
+
+const (
+ nodesBitsChildren = 9
+ nodesBitsICANN = 1
+ nodesBitsTextOffset = 15
+ nodesBitsTextLength = 6
+
+ childrenBitsWildcard = 1
+ childrenBitsNodeType = 2
+ childrenBitsHi = 14
+ childrenBitsLo = 14
+)
+
+const (
+ nodeTypeNormal = 0
+ nodeTypeException = 1
+ nodeTypeParentOnly = 2
+)
+
+// numTLD is the number of top level domains.
+const numTLD = 1553
+
+// Text is the combined text of all labels.
+const text = "biellaakesvuemieleccebieszczadygeyachimatainaircraftraeumtgerade" +
+ "alstahaugesunderseaportsinfolldalaskanittedallasalleasinglesango" +
+ "ppdalinzaintuitateshinanomachintaifun-dnsaliaskimitsubatamicable" +
+ "-modembetsukuinuyamanouchikuhokuryugasakitaurayasudabievatmallor" +
+ "cadaquesanjotateyamabifukagawalmartatsunobihorologyuzhno-sakhali" +
+ "nskaszubybikedagestangebilbaogakievenesannaninomiyakonojoshkar-o" +
+ "lawabillustrationirasakinvestmentsannohelplfinancialipetskatowic" +
+ "ebiobirdartcenterprisesakikuchikuseikarugapartmentsanokatsushika" +
+ "beeldengeluidunloppacificasinore-og-uvdalivornobirkenesoddtangen" +
+ "ovarabirthplacebjarkoybjerkreimdbalatinorddalillyonagoyastronomy" +
+ "asustor-elvdalwaysdatabaseballangenoamishirasatochigiessenebakke" +
+ "shibechambagriculturennebudapest-a-la-masionativeamericanantique" +
+ "s3-ap-northeast-2bjugnieznordlandunsantabarbarablockbusternidupo" +
+ "ntariobloombergbauernrtattoolsztynsettlersantacruzsantafedextras" +
+ "pace-to-rentalstomakomaibarabloxcmsanukis-a-candidatebluedaplier" +
+ "neustarhubalestrandabergamoarekeymachineues3-us-west-1bmoattachm" +
+ "entsaotomeloyalistjordalshalsenishiazais-a-catererbmsapodhalewis" +
+ "millerbmweirbnpparibaselburgloppenzaogashimadachicagoboatsapporo" +
+ "bnrwfarmsteadurbanamexhibitionishigotsukisosakitagawabomloanswat" +
+ "ch-and-clockerbondurhamburgmbhartiffanybonnishiharabookingminaka" +
+ "michiharabootsaratovalleaostatoilomzaporizhzheguris-a-celticsfan" +
+ "ishiizunazukis-a-chefarsundvrcambridgestonewyorkshirecreationish" +
+ "ikatakayamatsuzakis-a-conservativefsncfdvrdnsiskinkyotobetsumida" +
+ "tlanticateringebudejjuedischesapeakebayernurembergmodenakanotodd" +
+ "enishikatsuragithubusercontentaxihuanishikawazukanazawaboschaeff" +
+ "lerdalorenskogmxfinitybostikatsuyamaseratis-a-cpadoval-daostaval" +
+ "leybostonakijinsekikogentingrimstadwgripebotanicalgardenishimera" +
+ "botanicgardenishinomiyashironobotanybouncemerckmsdnipropetrovskl" +
+ "eppalmspringsakerbounty-fullensakerrypropertiesardegnamsosnowiec" +
+ "atholicheltenham-radio-openair-traffic-controlleyboutiquebecngri" +
+ "wataraidyndns-ipamperedchefashionishinoomotegovtgorybozentsujiie" +
+ "bradescorporationishinoshimatta-varjjatjeldsundyndns-mailotenkaw" +
+ "abrandywinevalleybrasiliabresciabrindisibenikebristolgaulardalot" +
+ "tebritishcolumbialowiezaganquannefrankfurtjmaxxxjaworznowtvalled" +
+ "-aostavangerbroadcastleclerchelyabinskypescaravantaabroadwaybrok" +
+ "e-itjometlifeinsurancebrokerbronnoysundyndns-office-on-the-webca" +
+ "mpobassociatesardiniabrothermesaverdeatnuorockartuzybrowsersafet" +
+ "ymarketsarlottokorozawabrumunddalouvreitjxn--0trq7p7nnishiokoppe" +
+ "gardyndns-picsarpsborgroks-thisayamanashiibaghdadultkmaxxn--11b4" +
+ "c3dyndns-remotegildeskalmykiabrunelblagdenesnaaseralingenkainana" +
+ "ejrietisalatinabenoboribetsucksarufutsunomiyawakasaikaitakoelnis" +
+ "hitosashimizunaminamiashigarabrusselsasayamabruxellesaseboknowsi" +
+ "tallowiczest-le-patrondheimperiabryanskodjeepostfoldnavyatkakami" +
+ "gaharabrynewhampshirebungoonordreisa-geekaufenishiwakis-a-cubicl" +
+ "e-slavellinotteroybuskerudinewhollandyndns-servercellikes-piedmo" +
+ "ntblancomeeresaskatchewanggouvicenzabuzenissandnessjoenissayokos" +
+ "hibahikariwanumatakazakis-a-democratmpanamabuzzgradyndns-weberli" +
+ "ncolnissedalucaniabwhalingrondarbzhitomirkutskydivingrongacomput" +
+ "erhistoryofscience-fictioncomsecuritytacticschulezajskddielddanu" +
+ "orrikuzentakatajirissagamiharacondoshichinohealth-carereformitak" +
+ "eharaconferenceconstructionconsuladoharuhrconsultanthropologycon" +
+ "sultingvollutskfhappoumuenchencontactoyotomiyazakis-a-geekgalaxy" +
+ "contemporaryarteducationalchikugojomedio-campidano-mediocampidan" +
+ "omediocontractorskenconventureshinodesashibetsuikinderoycookingc" +
+ "hannelveruminamibosogndaluxembourgujolstercoolkuszippodlasiellak" +
+ "asamatsudovre-eikercoopencraftoyotsukaidownloadcopenhagencyclope" +
+ "dichernovtsykkylvenetogakushimotoganewmexicoldwarmiamiastalowa-w" +
+ "oladbrokesassaris-a-designerimarumorimachidacorsicagliaridagawal" +
+ "tercorvettenrightathomegoodschwarzgwangjuifminamidaitomangotemba" +
+ "ixadacosenzamamibuilderschmidtre-gauldaluxurycostumedizinhistori" +
+ "scheschweizjcbnluzerncouchpotatofriesciencecentersciencehistoryc" +
+ "ouncilvivano-frankivskhabarovskhakassiacouponscientistockholmest" +
+ "randcoursescjohnsoncq-acranbrookuwanalyticscotlandcreditcardcred" +
+ "itunioncremonashorokanaiecrewiiheyaizuwakamatsubushikusakadogawa" +
+ "cricketrzyncrimeacrotonewspapercrownprovidercrsvparaglidingulenc" +
+ "ruisescrapper-sitecryptonomichigangwoncuisinellajollamericanexpr" +
+ "essexyculturalcentertainmentoyouracuneocupcakecxn--1ctwolominama" +
+ "takkofuefukihabororostrowwlkpmgunmarnardalcymruovatoystre-slidre" +
+ "ttozawacyonabarussiacyouthdfcbankzlguovdageaidnufcfanfieldfiguer" +
+ "estaurantozsdefilateliafilminamiechizenfinalfinancefineartservef" +
+ "tparisor-fronfinlandfinnoyfirebaseapparliamentranbyfirenzefirest" +
+ "onexus-east-1firmdaleirfjordfishingolffanservegame-serverisignfi" +
+ "tjarqhachiojiyahikobeatservehalflifestylefitnessettlementrani-an" +
+ "dria-barletta-trani-andriafjalerflesbergflickragerotikamakurazak" +
+ "irkeneservehttparmaflightservehumourflirumansionserveirchiryukyu" +
+ "ragifuchukotkakegawassamukawataricohdavvenjargausdaluccapitalone" +
+ "wjerseyflogintogurafloraflorencefloridafloristanohatakaharulvikh" +
+ "arkovalledaostavernflorokunohealthcareerserveminecraftraniandria" +
+ "barlettatraniandriaflowerservemp3utilitiesquarezzoologicalvinkle" +
+ "in-addrammenuernbergdyniabogadocscbggfareastcoastaldefence-burgj" +
+ "emnes3-ap-northeast-1kappleaseating-organicbcg12000emmafanconaga" +
+ "wakayamadridvagsoyericsson-aptibleangaviikadenaamesjevuemielno-i" +
+ "p6flynnhubalsfjordiscountysnes3-us-west-2fndfoodnetworkshoppingf" +
+ "or-ourfor-someetnedalfor-theaterforexrothruheredstoneforgotdnser" +
+ "vep2parocherkasyzrankoshigayaltaijis-a-greenforli-cesena-forlice" +
+ "senaforlikescandyndns-at-workinggrouparservepicservequakeforsale" +
+ "irvikhersonforsandasuoloftranoyfortmissoulan-udefenseljordfortwo" +
+ "rthachirogatakamoriokamikitayamatotakadaforuminamifuranofosneser" +
+ "vesarcasmatartanddesignfotaruis-a-gurunzenfoxfordegreefreeboxost" +
+ "rowiechitachinakagawatchandclockazimierz-dolnyfreemasonryfreibur" +
+ "gfreightcmwildlifedjejuegoshikiminokamoenairlinedre-eikerfreseni" +
+ "uscountryestateofdelawaredumbrellanbibaidarfribourgfriuli-v-giul" +
+ "iafriuli-ve-giuliafriuli-vegiuliafriuli-venezia-giuliafriuli-ven" +
+ "eziagiuliafriuli-vgiuliafriuliv-giuliafriulive-giuliafriulivegiu" +
+ "liafriulivenezia-giuliafriuliveneziagiuliafriulivgiuliafrlfrogan" +
+ "servicesettsurgeonshalloffamemergencyberlevagangaviikanonjis-a-h" +
+ "ard-workerfrognfrolandfrom-akrehamnfrom-alfrom-arfrom-azpartis-a" +
+ "-hunterfrom-capebretonamiasakuchinotsuchiurakawarszawashingtondc" +
+ "lkhmelnitskiyamasfjordenfrom-collectionfrom-ctransportransurlfro" +
+ "m-dchitosetogitsuldalucernefrom-dell-ogliastrakhanawafrom-flande" +
+ "rsevastopolefrom-gafrom-higashiagatsumagoirminamiiselectrapaniim" +
+ "imatakatoris-a-knightpointtokamachippubetsubetsugaruslivinghisto" +
+ "ryfrom-iafrom-idfrom-ilfrom-incheonfrom-ksevenassisicilyfrom-kyo" +
+ "wariasahikawafrom-lancashireggio-calabriafrom-manxn--1qqw23afrom" +
+ "-mdfrom-meguromskoguchikuzenfrom-microsoftbankhmelnytskyivallee-" +
+ "aosteroyfrom-mnfrom-mochizukirovogradoyfrom-msewilliamhillfrom-m" +
+ "tnfrom-nchloefrom-ndfrom-nefrom-nhktravelchannelfrom-njcpartners" +
+ "franziskanerdpolicefrom-nminamiizukamitondabayashiogamagoriziafr" +
+ "om-nvalleeaosteigenfrom-nyfrom-ohkurafrom-oketohmaorivnefrom-orf" +
+ "rom-paderbornfrom-pratohnoshoooshikamaishimofusartshangrilangeva" +
+ "grarboretumbriafrom-ris-a-landscaperugiafrom-schoenbrunnfrom-sdf" +
+ "rom-tnfrom-txn--2m4a15efrom-utazuerichardlillehammerfest-mon-blo" +
+ "gueurovisionfrom-vaksdalfrom-vtravelersinsurancefrom-wafrom-wiel" +
+ "unnerfrom-wvanylvenicefrom-wyfrosinonefrostalbansharis-a-lawyerf" +
+ "royahabadajozoraholtalenvironmentalconservationfstavropolitienda" +
+ "fujiiderafujikawaguchikonefujiminohtawaramotoineppubolognakaniik" +
+ "awatanagurafujinomiyadafujiokayamapartsharpartyfujisatoshonairpo" +
+ "rtland-4-salernogatagajobojis-a-liberalfujisawafujishiroishidaka" +
+ "biratoridellogliastraderfujitsurugashimamateramodalenfujixeroxn-" +
+ "-30rr7yfujiyoshidafukayabeardubaiduckdnshomebuiltrdfukuchiyamada" +
+ "fukudominichocolatemasekazofukuis-a-libertarianfukumitsubishigak" +
+ "iryuohadanoshiroomurafukuokazakisarazurewebsiteshikagamiishibuka" +
+ "wafukuroishikarikaturindalfukusakishiwadafukuyamagatakahashimama" +
+ "kisofukushimarburgfunabashiriuchinadafunagatakahatakaishimoichin" +
+ "osekigaharafunahashikamiamakusatsumasendaisennangonohejis-a-linu" +
+ "x-useranishiaritabashikaoizumizakitchenfundaciofuoiskujukuriyama" +
+ "rcheapasadenaklodzkodairafuosskoczowinbaltimore-og-romsdalimited" +
+ "iscoveryonaguniversityoriikashibatakashimarylhurstjohnaval-d-aos" +
+ "ta-valleyukibestadishakotankashiharaukraanghkepnord-frontierepai" +
+ "rbusantiquest-a-la-maisondre-landebusinessebyklefrakkestadds3-ap" +
+ "-southeast-2furnitureggio-emilia-romagnakanojohanamakinoharafuru" +
+ "biraquarellebesbyglandfurudonostiafurukawairtelecityeatshawaiiji" +
+ "marugame-hostingfusodegaurafussaintlouis-a-anarchistoireggiocala" +
+ "briafutabayamaguchinomigawafutboldlygoingnowhere-for-moregontrai" +
+ "lroadfuttsurugiminamimakis-a-llamarylandfuturemailingfvgfyis-a-m" +
+ "usicianfylkesbiblackfridayfyresdalhannanmokuizumodernhannovarese" +
+ "rveblogspotrentino-a-adigehanyuzenhapmirhareidsbergenharstadharv" +
+ "estcelebrationhasamarahasaminami-alpssells-itrentino-aadigehashb" +
+ "anghasudahasura-appassenger-associationhasviklabudhabikinokawaba" +
+ "rthaebaruminamiminowahatogayahoohatoyamazakitahiroshimarriottren" +
+ "tino-alto-adigehatsukaichikaiseis-a-painteractivegarsheis-a-pats" +
+ "fanhattfjelldalhayashimamotobuildinghazuminobusellsyourhomeipavi" +
+ "ancargodaddyndns-at-homednshimonosekikawahboehringerikehelsinkit" +
+ "akamiizumisanofidelitysvardollshimosuwalkis-a-personaltrainerhem" +
+ "bygdsforbundhemneshimotsukehemsedalhepforgeherokussldheroyhgtvsh" +
+ "imotsumahigashichichibungotakadatinghigashihiroshimanehigashiizu" +
+ "mozakitakatakanezawahigashikagawahigashikagurasoedahigashikawaki" +
+ "taaikitakyushuaiahigashikurumeiwamarshallstatebankmpspbamblebtim" +
+ "netz-2higashimatsushimarinehigashimatsuyamakitaakitadaitoigawahi" +
+ "gashimurayamalatvuopmidoris-a-photographerokuappfizerhigashinaru" +
+ "sembokukitamidsundhigashinehigashiomihachimanchesterhigashiosaka" +
+ "sayamamotorcycleshinichinanhigashishirakawamatakaokamikoaniikapp" +
+ "ugliahigashisumiyoshikawaminamiaikitamotosumitakaginankokubunjis" +
+ "-a-playerhigashitsunotogawahigashiurausukitanakagusukumoduminami" +
+ "ogunicomcastresistancehigashiyamatokoriyamanakakogawahigashiyodo" +
+ "gawahigashiyoshinogaris-a-republicancerresearchaeologicalifornia" +
+ "hiraizumisatohobby-sitehirakatashinagawahiranairtraffichofunator" +
+ "ientexpressatxn--1ck2e1balsanagochihayaakasakawaharavennagasakik" +
+ "onaikawachinaganoharamcoalaheadjudaicaaarborteaches-yogasawaraci" +
+ "ngroks-theatreemersongdalenviknakamuratakahamannortonsbergladelm" +
+ "enhorstackspacekitagataiwanairguardigitalimanowarudaugustowadaeg" +
+ "ubs3-ap-southeast-1hirarahiratsukagawahirayaitakarazukamiminersh" +
+ "injournalismailillesandefjordhistorichouseshinjukumanohitachiomi" +
+ "yaginowaniihamatamakawajimaritimodellinghitachiotagooglecodespot" +
+ "rentino-altoadigehitoyoshimifunehitradinghjartdalhjelmelandholec" +
+ "kobierzyceholidayhomelinuxn--32vp30hagakhanamigawahomesecurityma" +
+ "ceratakasagoperaunitextileitungsenhomesecuritypccwindmillhomesen" +
+ "seminehomeunixn--3bst00minamisanrikubetsupplyhondahoneywellbeing" +
+ "zonehongorgehonjyoitakasakitashiobarahornindalhorseoulminamitane" +
+ "hortendofinternetrentino-s-tirollagrigentomologyhoteleshinkamigo" +
+ "toyohashimototalhotmailhoyangerhoylandetroitskokonoehumanitieshi" +
+ "nshinotsurgeryhurdalhurumajis-a-rockstarachowicehyllestadhyogori" +
+ "s-a-socialistmeindianapolis-a-bloggerhyugawarahyundaiwafunehzcho" +
+ "nanbugattipschlesischesaudajgorajlchoshibuyachiyodavvesiidazaifu" +
+ "daigodoesntexistanbullensvanguardyndns-wikindleikangerjlljmpharm" +
+ "acienshiojirishirifujiedajnjelenia-gorajoyentrentino-sued-tirolj" +
+ "oyokaichibahcavuotnagaraumalselvendrelljpmorganjpnchoyodobashich" +
+ "ikashukujitawarajprshioyamemorialjuniperjurkristiansundkrodshera" +
+ "dkrokstadelvaldaostarnbergkryminamiyamashirokawanabelgorodeokuma" +
+ "torinokumejimassa-carrara-massacarraramassabunkyonanaoshimageand" +
+ "soundandvisionkumenanyokkaichirurgiens-dentistes-en-francekunisa" +
+ "kis-an-artistcgroupgfoggiakunitachiarailwaykunitomigusukumamotoy" +
+ "amasoykunneppulawykunstsammlungkunstunddesignkuokgrouphdkureisen" +
+ "kurgankurobelaudibleborkdalkurogimilitarykuroisoftwarendalenugku" +
+ "romatsunais-an-engineeringkurotakikawasakis-an-entertainerkursko" +
+ "mmunalforbundkushirogawakustanais-bykusupplieshiranukaniepcekutc" +
+ "hanelkutnokuzbassnillfjordkuzumakis-certifiedogawarabikomaezakir" +
+ "unorthwesternmutualkvafjordkvalsundkvamfamberkeleykvanangenkvine" +
+ "sdalkvinnheradkviteseidskogkvitsoykwpspjelkavikommunemitourismol" +
+ "anciamitoyoakemiuramiyazumiyotamanomjondalenmlbfanmonmouthagebos" +
+ "tadmonstermonticellombardiamondshiraois-into-carshintomikasahara" +
+ "montrealestatefarmequipmentrentino-suedtirolmonza-brianzaporizhz" +
+ "hiamonza-e-della-brianzapposhiraokanmakiyokawaramonzabrianzaptok" +
+ "yotangotpantheonsitemonzaebrianzaramonzaedellabrianzamoparachuti" +
+ "ngmordoviajessheiminanomoriyamatsunomoriyoshiokamitsuemormoneymo" +
+ "royamatsusakahoginozawaonsenmortgagemoscowindowshiratakahagivest" +
+ "bytomaritimekeepingmoseushistorymosjoenmoskeneshishikuis-into-ca" +
+ "rtoonshinyoshitomiokaneyamaxunusualpersonmosshisognemosvikomorot" +
+ "sukamisunagawamoviemovistargardmtpchristmasakikugawatchesauherad" +
+ "yndns-workisboringrossetouchijiwadeloittevadsoccertificationissh" +
+ "ingugemtranakatsugawamuenstermugithubcloudusercontentrentinoa-ad" +
+ "igemuikamogawamukochikushinonsenergymulhouservebeermunakatanemun" +
+ "cieszynmuosattemuphiladelphiaareadmyblogsitemurmanskomvuxn--3ds4" +
+ "43gmurotorcraftrentinoaadigemusashimurayamatsushigemusashinohara" +
+ "museetrentinoalto-adigemuseumverenigingmutsuzawamutuellevangermy" +
+ "dissentrentinoaltoadigemydrobofagemydshisuifuelmyeffectrentinos-" +
+ "tirolmyfritzwinnershitaramamyftphilatelymykolaivarggatrentinosti" +
+ "rolmymediapchromedicaltanissettaishinomakimobetsuliguriamyokoham" +
+ "amatsudamypepsonyoursidedyn-o-saurecipesaro-urbino-pesarourbinop" +
+ "esaromamurogawawioshizukuishimogosenmypetshizuokannamiharumyphot" +
+ "oshibahccavuotnagareyamalvikongsbergmypsxn--3e0b707emysecurityca" +
+ "merakermyshopblockshoujis-into-gamessinashikiwakunigamihamadamyt" +
+ "is-a-bookkeepermincommbankomonomyvnchryslerpictetrentinosud-tiro" +
+ "lpictureshowtimeteorapphoenixn--3oq18vl8pn36apiemontepilotshrira" +
+ "mlidlugolekagaminogiftsienaplesigdalpimientaketomisatomskongsvin" +
+ "gerpinkoninjamisonpioneerpippuphonefosshowapiszpittsburghofastly" +
+ "piwatepizzapkonskowolayangroupharmacyshirahamatonbetsurgutsiracu" +
+ "saitoshimaplanetariuminnesotaketakatsukis-foundationplantationpl" +
+ "antsilkonsulatrobeepilepsydneyplatformintelligenceplaystationpla" +
+ "zaplchungbukazunoplombardyndns-blogdnsimbirskonyvelolplumbingopm" +
+ "npodzonepohlpoivronpokerpokrovskooris-a-techietis-a-soxfanpolkow" +
+ "icepoltavalle-aostarostwodzislawitdkopervikomforbananarepublicar" +
+ "toonartdecoffeedbackplaneappalacemreviewskrakoweddinglassassinat" +
+ "ionalheritagematsubarakawagoeu-1pomorzeszowithgoogleapisa-hockey" +
+ "nutrentinosudtirolpordenonepornporsangerporsanguideltajimicrolig" +
+ "htingporsgrunnanpoznanpraxis-a-bruinsfanprdpreservationpresidiop" +
+ "rgmrprimelhusgardenprincipeprivatizehealthinsuranceprochowicepro" +
+ "ductionsimple-urlprofauskedsmokorsetagayasells-for-ulsandoyprogr" +
+ "essivegasiaprojectrentinosued-tirolpromombetsurfbsbxn--1lqs03npr" +
+ "opertyprotectionprotonetrentinosuedtirolprudentialpruszkowithyou" +
+ "tubeneventoeidsvollprzeworskogptplusterptzpvtrentoyonakagyokutoy" +
+ "akokamishihoronobeokaminoyamatsuris-leetrentino-stirolpwchungnam" +
+ "dalseidfjordynnsavannahgapzqldqponqslgbtrevisohughesirdalquicksy" +
+ "teslingqvchurchaseljeffersoniyodogawastoragestordalstorenburgsto" +
+ "rfjordstpetersburgstreamsterdamnserverbaniastudiostudyndns-homef" +
+ "tpaccessnoasakakinokiastuff-4-salestufftoread-booksnesnzstuttgar" +
+ "trogstadsurreysusakis-not-certifieducatorahimeshimakanegasakinko" +
+ "bayashikshacknethnologysusonosuzakanrasuzukanumazurysuzukis-save" +
+ "dunetbankolobrzegersundsvalbardudinkakudamatsuesveiosvelvikoseis" +
+ "-a-therapistoiasvizzeraswedenswidnicarrierswiebodzindianmarketin" +
+ "gswiftcoveronaritakurashikis-slickomaganeswinoujscienceandhistor" +
+ "yswisshikis-uberleetrentino-sud-tirolturystykarasjohkamiokaminok" +
+ "awanishiaizubangetuscanytushuissier-justicetuvalle-daostatichuva" +
+ "shiatuxfamilyversicherungvestfoldvestnesolutionslupskoryolasitev" +
+ "estre-slidreamhostersomavestre-totennishiawakuravestvagoyvevelst" +
+ "advibo-valentiavibovalentiavideovillaskoyabearalvahkijobserverda" +
+ "lvdalcesomnarashinovinnicartiervinnytsiavipsinaapphotographysiov" +
+ "irginiavirtualvirtueeldomeindustriesteambulancevirtuelvisakegawa" +
+ "vistaprinternationalfirearmsooviterboltromsakatakinouevivoldavla" +
+ "dikavkazanvladimirvladivostokaizukarasuyamazoevlogoipiagetmyiphi" +
+ "lipsyvolkenkundenvolkswagentsopotritonvologdanskoshunantokonameg" +
+ "atakasugais-an-accountantshinshirovolvolgogradvolyngdalvoronezhy" +
+ "tomyrvossevangenvotevotingvotoyonezawavrnworldworse-thanggliding" +
+ "wowiwatsukiyonowruzhgorodoywritesthisblogsytewroclawloclawekostr" +
+ "omahachijorpelandwtcirclegnicafederationwtfbx-oslodingenwuozuwww" +
+ "mflabsor-odalwzmiuwajimaxn--4gq48lf9jeonnamerikawauexn--4it168dx" +
+ "n--4it797kotohiradomainsurehabmerxn--4pvxsor-varangerxn--54b7fta" +
+ "0ccitichernigovernmentoyookanzakiyosatokigawaxn--55qw42gxn--55qx" +
+ "5dxn--5js045dxn--5rtp49civilaviationxn--5rtq34kotouraxn--5su34j9" +
+ "36bgsgxn--5tzm5gxn--6btw5axn--6frz82gxn--6orx2rxn--6qq986b3xlxn-" +
+ "-7t0a264civilisationxn--80adxhksorfoldxn--80ao21axn--80aqecdr1ax" +
+ "n--80asehdbarclaycardsakuraibigawaurskog-holandroverhalla-spezia" +
+ "grocerybnikahokutobishimaizurubtsovskiervaapsteiermarkariyakumol" +
+ "dev-myqnapcloudcontrolappagefrontappagespeedmobilizerobiraeropor" +
+ "talabamagasakishimabarackmaze12xn--80aswgxn--80audnedalnxn--8ltr" +
+ "62kouhokutamakis-an-actorxn--8pvr4uxn--8y0a063axn--90a3academyac" +
+ "tivedirectoryazannakadomari-elasticbeanstalkounosunndalxn--90ais" +
+ "hobaraomoriguchiharahkkeravjudygarlandxn--90azhaibarakitahatakan" +
+ "abeautydalxn--9dbhblg6dietcimmobilienxn--9dbq2axn--9et52uxn--9kr" +
+ "t00axn--andy-iraxn--aroport-byanagawaxn--asky-iraxn--aurskog-hla" +
+ "nd-jnbarclaysakyotanabellunordkappgafanpachigasakidsmynasushioba" +
+ "ragusaarlandiskstationavigationavuotnakayamatsuuraustevollavagis" +
+ "kebinagisochildrensgardenaturalhistorymuseumcenterepbodyndns-fre" +
+ "ebox-oskolegokasells-for-less3-eu-central-1xn--avery-yuasakuhokk" +
+ "aidontexisteingeekouyamashikis-an-actresshintokushimaxn--b-5gaxn" +
+ "--b4w605ferdxn--bck1b9a5dre4civilizationxn--bdddj-mrabdxn--beara" +
+ "lvhki-y4axn--berlevg-jxaxn--bhcavuotna-s4axn--bhccavuotna-k7axn-" +
+ "-bidr-5nachikatsuuraxn--bievt-0qa2xn--bjarky-fyanaizuxn--bjddar-" +
+ "ptamayufuettertdasnetzxn--blt-elabourxn--bmlo-graingerxn--bod-2n" +
+ "aroyxn--brnny-wuaccident-investigationjukudoyamagadancebetsukuba" +
+ "bia-goracleaningatlantabusebastopologyeonggiehtavuoatnadexeterim" +
+ "o-i-ranagahamaroygardendoftheinternetflixilovecollegefantasyleag" +
+ "uernseyxn--brnnysund-m8accident-preventionlineat-urlxn--brum-voa" +
+ "gatromsojavald-aostaplesokanoyakagexn--btsfjord-9zaxn--c1avgxn--" +
+ "c2br7gxn--c3s14misasaguris-into-animelbournexn--cck2b3barefootba" +
+ "llooningliwiceventsalangenayoroddaustinnaturalsciencesnaturelles" +
+ "3-eu-west-1xn--cg4bkis-very-badaddjamalborkangerxn--ciqpnxn--clc" +
+ "hc0ea0b2g2a9gcdn77-sslattumisawaxn--comunicaes-v6a2oxn--correios" +
+ "-e-telecomunicaes-ghc29axn--czr694bargainstitutelemarkashiwaraus" +
+ "traliaisondriodejaneirochestereportarantours3-external-1xn--czrs" +
+ "0trusteexn--czru2dxn--czrw28barreauctionflfanfshostrodawaraustrh" +
+ "eimatunduhrennesoyokotebinorilskarlsoyokozebizenakamagayachts3-e" +
+ "xternal-2xn--d1acj3barrel-of-knowledgeologyukuhashimojibmditchyo" +
+ "uripalanakhodkanagawauthordalandroidgcahcesuolocalhistoryggeelvi" +
+ "nckarmoyomitanobninskarpaczeladz-1xn--d1alfaromeoxn--d1atrvbarce" +
+ "lonagasukeu-2xn--d5qv7z876civilwarmanagementoyosatoyokawaxn--dav" +
+ "venjrga-y4axn--djrs72d6uyxn--djty4kouzushimashikokuchuoxn--dnna-" +
+ "grajewolterskluwerxn--drbak-wuaxn--dyry-iraxn--e1a4claimsaves-th" +
+ "e-whalessandria-trani-barletta-andriatranibarlettaandriaxn--eckv" +
+ "dtc9dxn--efvn9sorreisahayakawakamiichikawamisatottoris-lostre-to" +
+ "teneis-a-studentalxn--efvy88hair-surveillancexn--ehqz56nxn--elqq" +
+ "16hakatanotaireshimokawaxn--estv75gxn--eveni-0qa01gaxn--f6qx53ax" +
+ "n--fct429kozagawaxn--fhbeiarnxn--finny-yuaxn--fiq228c5hsortlandx" +
+ "n--fiq64barrell-of-knowledgeometre-experts-comptablesalondonetsk" +
+ "ashiwazakiyosemiteverbankasukabedzin-the-bandaioiraseeklogesuran" +
+ "certmgretachikawakkanaibetsubamericanfamilydscloudcontrolledekaf" +
+ "jordivtasvuodnagatorogersaltdalimoliserniautomotivecodynaliascol" +
+ "i-picenoipirangamvikaruizawamusementaobaokinawashirosatochiokino" +
+ "shimakeupowiathletajimabariakembuchikumagayagawakuyabukihokumako" +
+ "gengerdalipayekaterinburgjerdrumckinseyokosukareliance164xn--fiq" +
+ "s8sorumisakis-gonexn--fiqz9southcarolinazawaxn--fjord-lraxn--fjq" +
+ "720axn--fl-ziaxn--flor-jraxn--flw351exn--fpcrj9c3dxn--frde-grand" +
+ "rapidsouthwestfalenxn--frna-woaraisaijosoyrovigorlicexn--frya-hr" +
+ "axn--fzc2c9e2clickchristiansburgroundhandlingroznyxn--fzys8d69uv" +
+ "gmailxn--g2xx48clinichernihivanovosibirskautokeinoxn--gckr3f0fbx" +
+ "ostrolekaluganskharkivgucciprianiigataitogliattirescrappingushik" +
+ "amifuranosegawaxn--gecrj9cliniquenoharaxn--ggaviika-8ya47hakodat" +
+ "exn--gildeskl-g0axn--givuotna-8yandexn--3pxu8kosugexn--gjvik-wua" +
+ "xn--gk3at1exn--gls-elacaixaxn--gmq050is-very-evillagexn--gmqw5ax" +
+ "n--h-2failxn--h1aeghakonexn--h2brj9clintonoshoesavonamsskoganeis" +
+ "-a-doctorayxn--hbmer-xqaxn--hcesuolo-7ya35bashkiriautoscanadaeje" +
+ "onbukarumaifarmerseinextdirectargets-itargivingjesdalavangenatur" +
+ "bruksgymnaturhistorisches3-fips-us-gov-west-1xn--hery-iraxn--hge" +
+ "bostad-g3axn--hmmrfeasta-s4acctrysiljan-mayenxn--hnefoss-q1axn--" +
+ "hobl-iraxn--holtlen-hxaxn--hpmir-xqaxn--hxt814exn--hyanger-q1axn" +
+ "--hylandet-54axn--i1b6b1a6a2exn--imr513nxn--indery-fyaotsurnadal" +
+ "xn--io0a7is-very-goodhandsonxn--j1aefermobilyxn--j1amhakubankhva" +
+ "olbia-tempio-olbiatempioolbialystokkemerovodkagoshimalopolskanla" +
+ "ndxn--j6w193gxn--jlq61u9w7basilicataniaveroykeniwaizumiotsukumiy" +
+ "amazonawsabaerobaticketsaritsynologyeongnamegawakeisenbahnatuurw" +
+ "etenschappenaumburgjovikasaokamisatokashikiwienaustdalazioceanog" +
+ "raphics3-sa-east-1xn--jlster-byaroslavlaanderenxn--jrpeland-54ax" +
+ "n--jvr189misconfusedxn--k7yn95exn--karmy-yuaxn--kbrq7oxn--kcrx77" +
+ "d1x4axn--kfjord-iuaxn--klbu-woaxn--klt787dxn--kltp7dxn--kltx9axn" +
+ "--klty5xn--42c2d9axn--koluokta-7ya57hakuis-a-nascarfanxn--kprw13" +
+ "dxn--kpry57dxn--kpu716ferraraxn--kput3is-very-nicexn--krager-gya" +
+ "sakaiminatoyonoxn--kranghke-b0axn--krdsherad-m8axn--krehamn-dxax" +
+ "n--krjohka-hwab49jetztrentino-sudtirolxn--ksnes-uuaxn--kvfjord-n" +
+ "xaxn--kvitsy-fyasugis-very-sweetpepperxn--kvnangen-k0axn--l-1fai" +
+ "rwindsowaxn--l1accentureklamborghiniizaxn--laheadju-7yasuokarate" +
+ "xn--langevg-jxaxn--lcvr32dxn--ldingen-q1axn--leagaviika-52basket" +
+ "ballfinanzgoravocatanzarowebhopocznoceanographiquehimeji234xn--l" +
+ "esund-huaxn--lgbbat1ad8jevnakershuscultureggioemiliaromagnakasat" +
+ "sunais-a-teacherkassymantechnologyxn--lgrd-poacoachampionshiphop" +
+ "tobamagazinebraskaunjargallupinbatodayurihonjournalisteinkjerusa" +
+ "lembroideryusuharavoues3-us-gov-west-1xn--lhppi-xqaxn--linds-pra" +
+ "mericanartulansokndalxn--lns-qlanxesspreadbettingxn--loabt-0qaxn" +
+ "--lrdal-sraxn--lrenskog-54axn--lt-liaclothingrpanasonichernivtsi" +
+ "ciliaxn--lten-granexn--lury-iraxn--mely-iraxn--merker-kuaxn--mgb" +
+ "2ddespydebergxn--mgb9awbferrarittogoldpoint2thisamitsukexn--mgba" +
+ "3a3ejtunesolarssonxn--mgba3a4f16axn--mgba3a4franamizuholdingsmil" +
+ "eksvikozakis-an-anarchistoricalsocietyumenxn--mgba7c0bbn0axn--mg" +
+ "baakc7dvferreroticanonoichinomiyakexn--mgbaam7a8hakusandiegoodye" +
+ "arthadselfipassagenshellaspeziaxn--mgbab2bdxn--mgbai9a5eva00bats" +
+ "fjordivttasvuotnaharimaniwakuratexascolipicenord-aurdalpha-myqna" +
+ "pcloudappspotagerhcloudfunctionsalvadordalibabaikaliszczytnord-o" +
+ "dalindasdaburyatiaarpaleomutashinaiinetarnobrzegyptianhlfanhsalz" +
+ "burglobalashovhachinohedmarkasumigaurawa-mazowszexboxenapponazur" +
+ "e-mobilevje-og-hornnesamegawaxasnesoddenmarkhangelskjervoyagemol" +
+ "ogicallyngenglanddnskingjerstadotsuruokamchatkameokameyamashinat" +
+ "sukigatakamatsukawaetnagaivuotnagaokakyotambabydgoszczecinemagen" +
+ "tositelekommunikationthewifiat-band-campaniamallamaintenanceobih" +
+ "irosakikamijimattelefonicarbonia-iglesias-carboniaiglesiascarbon" +
+ "iabruzzoologyeongbuk-uralsk12xn--mgbai9azgqp6jewelryxn--mgbayh7g" +
+ "paduaxn--mgbb9fbpobanazawaxn--mgbbh1a71exn--mgbc0a9azcgxn--mgbca" +
+ "7dzdoxn--mgberp4a5d4a87gxn--mgberp4a5d4arxn--mgbi4ecexposedxn--m" +
+ "gbpl2fhskpnxn--mgbqly7c0a67fbcloudnsdojoetsuwanouchikujogaszkola" +
+ "hppiacenzakopanerairforcexn--mgbqly7cvafredrikstadtverranzanxn--" +
+ "mgbt3dhdxn--mgbtf8flatangerxn--mgbtx2bauhausposts-and-telecommun" +
+ "icationsnasadodgeorgeorgiaxn--mgbx4cd0abbottunkosherbrookegawaxn" +
+ "--mix082fetsundxn--mix891fgxn--1lqs71dxn--mjndalen-64axn--mk0axi" +
+ "nfinitis-with-thebandoomdnsfor-better-thandaxn--mk1bu44cnsaxoxn-" +
+ "-mkru45isleofmandalxn--mlatvuopmi-s4axn--mli-tlapyatigorskppspie" +
+ "gelxn--mlselv-iuaxn--moreke-juaxn--mori-qsakuragawaxn--mosjen-ey" +
+ "atominamiawajikissmarterthanyoustkarasjokomakiyosumycdn77-secure" +
+ "chtrainingxn--mot-tlaquilancasterxn--mre-og-romsdal-qqbbcasadela" +
+ "monedatsunanjoburglobodoes-itvedestrandiyusuisserveexchangexn--m" +
+ "sy-ula0haldenxn--mtta-vrjjat-k7afamilycompanycntoyotaris-a-finan" +
+ "cialadvisor-aurdalukowhoswhokksundynv6xn--muost-0qaxn--mxtq1mish" +
+ "imatsumaebashimodatexn--ngbc5azdxn--ngbe9e0axn--ngbrxn--45brj9ci" +
+ "rcus-2xn--nit225krasnodarxn--nmesjevuemie-tcbajddarchaeologyxn--" +
+ "nnx388axn--nodexn--nqv7fs00emaxn--nry-yla5gxn--ntso0iqx3axn--nts" +
+ "q17gxn--nttery-byaeservecounterstrikexn--nvuotna-hwaxn--nyqy26ax" +
+ "n--o1achattanooganorfolkebiblegallocus-1xn--o3cw4halsaitamatsuku" +
+ "ris-a-nurservebbshimokitayamaxn--od0algxn--od0aq3bbtarumizusawax" +
+ "n--ogbpf8flekkefjordxn--oppegrd-ixaxn--ostery-fyatsukaratsuginam" +
+ "ikatagamihoboleslawiecolonialwilliamsburgruexn--osyro-wuaxn--p1a" +
+ "cfhvalerxn--p1aiwchoseirouterxn--pbt977coloradoplateaudioxn--pgb" +
+ "s0dhlxn--porsgu-sta26fidonnakaiwamizawaxn--pssu33lxn--pssy2uxn--" +
+ "q9jyb4columbusheyxn--qcka1pmcdonaldsrlxn--qqqt11missilelxn--qxam" +
+ "urskjakdnepropetrovskiptveterinairealtorlandxn--rady-iraxn--rdal" +
+ "-poaxn--rde-ularvikrasnoyarskomitamamuraxn--rdy-0nabarixn--renne" +
+ "sy-v1axn--rhkkervju-01aflakstadaokagakibichuoxn--rholt-mragowood" +
+ "sidexn--rhqv96gxn--rht27zxn--rht3dxn--rht61exn--risa-5narusawaxn" +
+ "--risr-iraxn--rland-uuaxn--rlingen-mxaxn--rmskog-byatsushiroxn--" +
+ "rny31hammarfeastafricapetownnews-stagingxn--rovu88bbvacationsupd" +
+ "atelevisionikiitatebayashijonawatexn--rros-granvindafjordxn--rsk" +
+ "og-uuaxn--rst-0narutomobellevuelosangelesjaguarchitecturealtychy" +
+ "attorneyagawalbrzycharternopilawalesundxn--rsta-francaiseharaxn-" +
+ "-ryken-vuaxn--ryrvik-byawaraxn--s-1faitheguardianxn--s9brj9commu" +
+ "nitysfjordyroyrvikinguitarsbschokoladenxn--sandnessjen-ogbizhevs" +
+ "kredirectmeldalxn--sandy-yuaxn--seral-lraxn--ses554gxn--sgne-gra" +
+ "tangenxn--skierv-utazaskvolloabathsbcomobaraxn--skjervy-v1axn--s" +
+ "kjk-soaxn--sknit-yqaxn--sknland-fxaxn--slat-5narviikananporovnox" +
+ "n--slt-elabbvieeexn--smla-hraxn--smna-gratis-a-bulls-fanxn--snas" +
+ "e-nraxn--sndre-land-0cbremangerxn--snes-poaxn--snsa-roaxn--sr-au" +
+ "rdal-l8axn--sr-fron-q1axn--sr-odal-q1axn--sr-varanger-ggbentleyu" +
+ "uconnectatamotorsamnangerxn--srfold-byawatahamaxn--srreisa-q1axn" +
+ "--srum-grazxn--stfold-9xaxn--stjrdal-s1axn--stjrdalshalsen-sqbep" +
+ "publishproxyzgorzeleccolognewportlligatewayuzawaxn--stre-toten-z" +
+ "cbsrtroandinosaurlandesmolenskosaigawaxn--t60b56axn--tckweatherc" +
+ "hannelxn--tiq49xqyjewishartgalleryxn--tjme-hraxn--tn0agrinet-fre" +
+ "aksrvaroyxn--tnsberg-q1axn--tor131oxn--trany-yuaxn--trgstad-r1ax" +
+ "n--trna-woaxn--troms-zuaxn--tysvr-vraxn--uc0atvdonskoshimizumaki" +
+ "zunokunimilanoxn--uc0ay4axn--uist22hamurakamigoriginshimonitayan" +
+ "agitlaborxn--uisz3gxn--unjrga-rtambovenneslaskerrylogisticsologn" +
+ "exn--unup4yxn--uuwu58axn--vads-jraxn--vard-jraxn--vegrshei-c0axn" +
+ "--vermgensberater-ctberndnpalermomasvuotnakatombetsupportatarsta" +
+ "nikkoebenhavnikolaevennodessaikiraxn--vermgensberatung-pwbeskidy" +
+ "nathomedepotenzachpomorskienikonantanangerxn--vestvgy-ixa6oxn--v" +
+ "g-yiabcn-north-1xn--vgan-qoaxn--vgsy-qoa0jfkomatsushimashikexn--" +
+ "vgu402comparemarkerryhotelscholarshipschooluroyxn--vhquversaille" +
+ "solundbeckosakaerodromegalsacechirealminamiuonumasudaxn--vler-qo" +
+ "axn--vre-eiker-k8axn--vrggt-xqadxn--vry-yla5gxn--vuq861bestbuysh" +
+ "ousesamsclubindalindesnesamsunglogowegroweibolzanordre-landrange" +
+ "dalinkasuyakutiaxn--w4r85el8fhu5dnraxn--w4rs40lxn--wcvs22dxn--wg" +
+ "bh1compute-1xn--wgbl6axn--xhq521betainaboxfusejnynysagaeroclubme" +
+ "decincinnationwidealerxn--xkc2al3hye2axn--xkc2dl3a5ee0hangoutsys" +
+ "temscloudfrontdoorxn--y9a3aquariumisugitokuyamatsumotofukexn--ye" +
+ "r-znarvikristiansandcatshirakoenigxn--yfro4i67oxn--ygarden-p1axn" +
+ "--ygbi2ammxn--45q11citadeliveryokamikawanehonbetsurutaharaxn--ys" +
+ "tre-slidre-ujbieigersundrivelandrobaknoluoktaikicks-assedicaseih" +
+ "ichisobetsuitaipeiheijiiyamanobeauxartsandcraftsandvikcoromantov" +
+ "alle-d-aostathellexusdecorativeartsanfranciscofreakunemurorangei" +
+ "seiyoichiropracticasertairaxn--zbx025dxn--zf0ao64axn--zf0avxn--4" +
+ "gbriminingxn--zfr164bielawallonieruchomoscienceandindustryninohe" +
+ "kinannestadrudmurtiaxperiaxz"
+
+// nodes is the list of nodes. Each node is represented as a uint32, which
+// encodes the node's children, wildcard bit and node type (as an index into
+// the children array), ICANN bit and text.
+//
+// If the table was generated with the -comments flag, there is a //-comment
+// after each node's data. In it is the nodes-array indexes of the children,
+// formatted as (n0x1234-n0x1256), with * denoting the wildcard bit. The
+// nodeType is printed as + for normal, ! for exception, and o for parent-only
+// nodes that have children but don't match a domain label in their own right.
+// An I denotes an ICANN domain.
+//
+// The layout within the uint32, from MSB to LSB, is:
+// [ 1 bits] unused
+// [ 9 bits] children index
+// [ 1 bits] ICANN bit
+// [15 bits] text index
+// [ 6 bits] text length
+var nodes = [...]uint32{
+ 0x29e943,
+ 0x364444,
+ 0x28af46,
+ 0x371983,
+ 0x371986,
+ 0x394246,
+ 0x3a4103,
+ 0x202f04,
+ 0x24f607,
+ 0x28ab88,
+ 0x1a00882,
+ 0x309dc7,
+ 0x3533c9,
+ 0x2fb3ca,
+ 0x2fb3cb,
+ 0x22fe43,
+ 0x28cac6,
+ 0x2352c5,
+ 0x1e00702,
+ 0x211ac4,
+ 0x2c7a83,
+ 0x226bc5,
+ 0x2200d42,
+ 0x2a0f43,
+ 0x2707e44,
+ 0x368485,
+ 0x2a00c42,
+ 0x3797ce,
+ 0x24a483,
+ 0x38b406,
+ 0x2e04642,
+ 0x2a5907,
+ 0x237d46,
+ 0x3200a42,
+ 0x2ae043,
+ 0x2ae044,
+ 0x280f86,
+ 0x36f448,
+ 0x283a46,
+ 0x386144,
+ 0x3601002,
+ 0x326a09,
+ 0x363a07,
+ 0x3351c6,
+ 0x355049,
+ 0x293988,
+ 0x367104,
+ 0x3a6606,
+ 0x20e306,
+ 0x3a02e02,
+ 0x241d0f,
+ 0x33174e,
+ 0x212484,
+ 0x2bb945,
+ 0x202e05,
+ 0x2ea589,
+ 0x23e889,
+ 0x325747,
+ 0x221646,
+ 0x26b083,
+ 0x3e056c2,
+ 0x346fc3,
+ 0x207a4a,
+ 0x211e83,
+ 0x250585,
+ 0x2040c2,
+ 0x2830c9,
+ 0x4204802,
+ 0x209084,
+ 0x29e486,
+ 0x284b45,
+ 0x34c904,
+ 0x4a74a04,
+ 0x204803,
+ 0x234304,
+ 0x4e01842,
+ 0x364184,
+ 0x52e41c4,
+ 0x22410a,
+ 0x56009c2,
+ 0x334307,
+ 0x38e008,
+ 0x6201182,
+ 0x322847,
+ 0x2b7344,
+ 0x2b7347,
+ 0x383d05,
+ 0x370a47,
+ 0x325506,
+ 0x332a44,
+ 0x340c85,
+ 0x28df47,
+ 0x72046c2,
+ 0x349183,
+ 0x218782,
+ 0x366703,
+ 0x76108c2,
+ 0x2798c5,
+ 0x7a02d42,
+ 0x368ac4,
+ 0x277785,
+ 0x2123c7,
+ 0x2ddc0e,
+ 0x330a44,
+ 0x244744,
+ 0x20ca03,
+ 0x326ec9,
+ 0x30528b,
+ 0x30e148,
+ 0x31cd88,
+ 0x320888,
+ 0x20a588,
+ 0x354e8a,
+ 0x370947,
+ 0x217906,
+ 0x7e9c3c2,
+ 0x377d83,
+ 0x380c43,
+ 0x38bc84,
+ 0x250ac3,
+ 0x3a4143,
+ 0x1713b02,
+ 0x8203182,
+ 0x2484c5,
+ 0x30c046,
+ 0x2c9bc4,
+ 0x396e07,
+ 0x22eec6,
+ 0x280304,
+ 0x3a7dc7,
+ 0x203183,
+ 0x86bdb82,
+ 0x8a4f882,
+ 0x8e13702,
+ 0x213706,
+ 0x9200002,
+ 0x37f645,
+ 0x315043,
+ 0x205244,
+ 0x2dbe44,
+ 0x2dbe45,
+ 0x207043,
+ 0x9723ac3,
+ 0x9a093c2,
+ 0x2873c5,
+ 0x2873cb,
+ 0x22d086,
+ 0x20cbcb,
+ 0x26ff44,
+ 0x20d189,
+ 0x20ed44,
+ 0x9e0fd82,
+ 0x210c83,
+ 0x211183,
+ 0x1611302,
+ 0x23c343,
+ 0x21130a,
+ 0xa211d42,
+ 0x211d45,
+ 0x28ea8a,
+ 0x2cd704,
+ 0x212d43,
+ 0x213384,
+ 0x213cc3,
+ 0x213cc4,
+ 0x213cc7,
+ 0x214245,
+ 0x218dc5,
+ 0x219586,
+ 0x21a0c6,
+ 0x21aa43,
+ 0x21dc48,
+ 0x258e83,
+ 0xa615802,
+ 0x21f008,
+ 0x21580b,
+ 0x222d08,
+ 0x223586,
+ 0x224547,
+ 0x229748,
+ 0xb279a82,
+ 0xb693f02,
+ 0x20b608,
+ 0x2ad0c7,
+ 0x23b405,
+ 0x23b408,
+ 0x281888,
+ 0x2ada03,
+ 0x22eac4,
+ 0x38bcc2,
+ 0xba2f482,
+ 0xbe051c2,
+ 0xc62f802,
+ 0x22f803,
+ 0xca02ec2,
+ 0x202ec3,
+ 0x2fe704,
+ 0x21abc3,
+ 0x3670c4,
+ 0x24edcb,
+ 0x215743,
+ 0x2d2f86,
+ 0x223f84,
+ 0x29b84e,
+ 0x360445,
+ 0x38b508,
+ 0x24bd87,
+ 0x24bd8a,
+ 0x222a83,
+ 0x222a87,
+ 0x305445,
+ 0x231c84,
+ 0x24d886,
+ 0x24d887,
+ 0x2beb44,
+ 0x2f6607,
+ 0x377e04,
+ 0x3afe84,
+ 0x3afe86,
+ 0x267544,
+ 0x208606,
+ 0x210ac3,
+ 0x217188,
+ 0x21cfc8,
+ 0x244703,
+ 0x23c303,
+ 0x395544,
+ 0x39a003,
+ 0xce00482,
+ 0xd304e82,
+ 0x2004c3,
+ 0x2072c6,
+ 0x369e83,
+ 0x263584,
+ 0xd616942,
+ 0x244c43,
+ 0x216943,
+ 0x21b182,
+ 0xda008c2,
+ 0x2b9fc6,
+ 0x235fc7,
+ 0x2e9345,
+ 0x367a44,
+ 0x27e045,
+ 0x2026c7,
+ 0x26a205,
+ 0x2c6889,
+ 0x2cf2c6,
+ 0x2d48c8,
+ 0x2e9246,
+ 0xde06c02,
+ 0x33b648,
+ 0x2fe4c6,
+ 0x3b1a45,
+ 0x3ae4c7,
+ 0x301084,
+ 0x301085,
+ 0x283c04,
+ 0x283c08,
+ 0xe20cc82,
+ 0xe6131c2,
+ 0x329cc6,
+ 0x318208,
+ 0x339345,
+ 0x33a3c6,
+ 0x33c648,
+ 0x35b948,
+ 0xeac8945,
+ 0xefa8204,
+ 0x3aae87,
+ 0xf20e802,
+ 0xf61dec2,
+ 0x10a16582,
+ 0x357b85,
+ 0x2a3e05,
+ 0x2de246,
+ 0x319b87,
+ 0x399547,
+ 0x1122d183,
+ 0x29a147,
+ 0x2d4488,
+ 0x38fec9,
+ 0x379987,
+ 0x3a5187,
+ 0x22fe88,
+ 0x230686,
+ 0x231786,
+ 0x2323cc,
+ 0x232f4a,
+ 0x233787,
+ 0x23518b,
+ 0x235e07,
+ 0x235e0e,
+ 0x236a84,
+ 0x2374c4,
+ 0x239b07,
+ 0x25b087,
+ 0x23d9c6,
+ 0x23d9c7,
+ 0x23e107,
+ 0x14600bc2,
+ 0x23ec86,
+ 0x23ec8a,
+ 0x23ef0b,
+ 0x240007,
+ 0x2407c5,
+ 0x240b03,
+ 0x240fc6,
+ 0x240fc7,
+ 0x230a83,
+ 0x14a0b382,
+ 0x24198a,
+ 0x14f54502,
+ 0x152a6c02,
+ 0x15642b82,
+ 0x15a37e42,
+ 0x243a85,
+ 0x244504,
+ 0x16200682,
+ 0x364205,
+ 0x226b83,
+ 0x317c85,
+ 0x20a484,
+ 0x20ec44,
+ 0x291786,
+ 0x378106,
+ 0x2875c3,
+ 0x261f84,
+ 0x281e43,
+ 0x16600f82,
+ 0x200f84,
+ 0x3ab406,
+ 0x200f85,
+ 0x258c06,
+ 0x3ae5c8,
+ 0x263804,
+ 0x2c7848,
+ 0x2e0c45,
+ 0x22e708,
+ 0x32c306,
+ 0x2b49c7,
+ 0x239504,
+ 0x239506,
+ 0x307003,
+ 0x384083,
+ 0x2be608,
+ 0x30c584,
+ 0x2a0887,
+ 0x30a106,
+ 0x30a109,
+ 0x252448,
+ 0x27efc8,
+ 0x280444,
+ 0x378983,
+ 0x22aa02,
+ 0x16ab1d82,
+ 0x16e2cf42,
+ 0x3a1603,
+ 0x17219c42,
+ 0x24f744,
+ 0x3400c6,
+ 0x371305,
+ 0x23fe83,
+ 0x232884,
+ 0x300447,
+ 0x367783,
+ 0x2379c8,
+ 0x3af5c5,
+ 0x36fc43,
+ 0x277705,
+ 0x277844,
+ 0x208306,
+ 0x20c804,
+ 0x20cf06,
+ 0x212306,
+ 0x2512c4,
+ 0x215683,
+ 0x21a883,
+ 0x1767e402,
+ 0x360fc5,
+ 0x215dc3,
+ 0x17a00442,
+ 0x232383,
+ 0x331e85,
+ 0x2343c3,
+ 0x2343c9,
+ 0x17e08042,
+ 0x18614b42,
+ 0x286b45,
+ 0x21ba46,
+ 0x29f387,
+ 0x2c9786,
+ 0x2b83c8,
+ 0x2b83cb,
+ 0x20730b,
+ 0x22aac5,
+ 0x2d02c5,
+ 0x2bf489,
+ 0x1600ec2,
+ 0x251488,
+ 0x20ce04,
+ 0x18e00202,
+ 0x24ea03,
+ 0x1965b246,
+ 0x330e88,
+ 0x19a031c2,
+ 0x228108,
+ 0x19e00d82,
+ 0x27008a,
+ 0x20f043,
+ 0x31d346,
+ 0x330448,
+ 0x378cc8,
+ 0x32f8c6,
+ 0x36dd07,
+ 0x241f07,
+ 0x20de8a,
+ 0x2cd784,
+ 0x33f184,
+ 0x352f49,
+ 0x38f8c5,
+ 0x2f31c6,
+ 0x2138c3,
+ 0x247984,
+ 0x212104,
+ 0x3412c7,
+ 0x21e687,
+ 0x2d7e84,
+ 0x20ddc5,
+ 0x2de308,
+ 0x35d607,
+ 0x360207,
+ 0x1a206ac2,
+ 0x369684,
+ 0x28f388,
+ 0x384544,
+ 0x2455c4,
+ 0x2459c5,
+ 0x245b07,
+ 0x206ac9,
+ 0x246684,
+ 0x246e89,
+ 0x247348,
+ 0x247704,
+ 0x247707,
+ 0x1a647f83,
+ 0x248a47,
+ 0x16475c2,
+ 0x17a4a82,
+ 0x249a06,
+ 0x24a4c7,
+ 0x24a904,
+ 0x24c9c7,
+ 0x24e4c7,
+ 0x252083,
+ 0x23aa82,
+ 0x201682,
+ 0x252b03,
+ 0x252b04,
+ 0x252b0b,
+ 0x31ce88,
+ 0x258b44,
+ 0x253805,
+ 0x255e47,
+ 0x257a05,
+ 0x2d9a8a,
+ 0x258a83,
+ 0x1aa21842,
+ 0x258d84,
+ 0x25ae49,
+ 0x25edc3,
+ 0x25ee87,
+ 0x3ac249,
+ 0x280d08,
+ 0x200c83,
+ 0x276607,
+ 0x276d49,
+ 0x202883,
+ 0x27d9c4,
+ 0x282309,
+ 0x2856c6,
+ 0x286e03,
+ 0x2038c2,
+ 0x233e83,
+ 0x39b6c7,
+ 0x37f785,
+ 0x3585c6,
+ 0x247b84,
+ 0x2d37c5,
+ 0x207a03,
+ 0x21ac86,
+ 0x20d382,
+ 0x390e04,
+ 0x227982,
+ 0x2db883,
+ 0x1ae007c2,
+ 0x244a43,
+ 0x21a544,
+ 0x21a547,
+ 0x3713c6,
+ 0x2499c2,
+ 0x1b22d642,
+ 0x325e44,
+ 0x1b626b02,
+ 0x1ba0acc2,
+ 0x2d6484,
+ 0x2d6485,
+ 0x2c3e85,
+ 0x341a46,
+ 0x1be01e02,
+ 0x29fe45,
+ 0x2ded05,
+ 0x201e03,
+ 0x3650c6,
+ 0x378445,
+ 0x213682,
+ 0x33a005,
+ 0x213684,
+ 0x217c43,
+ 0x219343,
+ 0x1c20c502,
+ 0x28e147,
+ 0x35d884,
+ 0x35d889,
+ 0x247884,
+ 0x22b603,
+ 0x346449,
+ 0x360e88,
+ 0x2a3c84,
+ 0x2a3c86,
+ 0x201f83,
+ 0x212883,
+ 0x21eb03,
+ 0x1c6e1102,
+ 0x2e9182,
+ 0x1ca0b2c2,
+ 0x316b88,
+ 0x34afc8,
+ 0x394986,
+ 0x2549c5,
+ 0x21a905,
+ 0x306007,
+ 0x255805,
+ 0x21c2c2,
+ 0x1ce61e82,
+ 0x1614b82,
+ 0x38fa48,
+ 0x33b585,
+ 0x2c8084,
+ 0x2e0b85,
+ 0x390507,
+ 0x258884,
+ 0x23a882,
+ 0x1d204c42,
+ 0x32c704,
+ 0x213507,
+ 0x3abd87,
+ 0x370a04,
+ 0x28ea43,
+ 0x244644,
+ 0x244648,
+ 0x231ac6,
+ 0x24d70a,
+ 0x206984,
+ 0x28edc8,
+ 0x253ac4,
+ 0x224646,
+ 0x290e84,
+ 0x357e86,
+ 0x35db49,
+ 0x259187,
+ 0x33a683,
+ 0x1d605e82,
+ 0x26a843,
+ 0x20ff82,
+ 0x1da04d42,
+ 0x2dfe86,
+ 0x35ed48,
+ 0x2a5287,
+ 0x3a30c9,
+ 0x23a4c9,
+ 0x2a5c85,
+ 0x2a6e49,
+ 0x2a7b45,
+ 0x2a7c89,
+ 0x2a8b85,
+ 0x284244,
+ 0x1de84247,
+ 0x2957c3,
+ 0x2a9c07,
+ 0x3a5546,
+ 0x2aa407,
+ 0x2a2945,
+ 0x2aba83,
+ 0x1e232a02,
+ 0x392844,
+ 0x1e63a3c2,
+ 0x25a183,
+ 0x1ea0f1c2,
+ 0x2e8b86,
+ 0x38df85,
+ 0x2acb87,
+ 0x324d83,
+ 0x250a44,
+ 0x206f83,
+ 0x20b343,
+ 0x1ee082c2,
+ 0x1f600042,
+ 0x394344,
+ 0x23aa43,
+ 0x364885,
+ 0x25fcc5,
+ 0x1fa05602,
+ 0x20200942,
+ 0x276946,
+ 0x209744,
+ 0x30c6c4,
+ 0x30c6ca,
+ 0x20a00a82,
+ 0x2f768a,
+ 0x372fc8,
+ 0x20e01604,
+ 0x201d83,
+ 0x216c03,
+ 0x3209c9,
+ 0x223349,
+ 0x300546,
+ 0x21202243,
+ 0x2da985,
+ 0x2f81cd,
+ 0x202246,
+ 0x2065cb,
+ 0x21606382,
+ 0x333208,
+ 0x21a0bf02,
+ 0x21e00b42,
+ 0x2af285,
+ 0x222074c2,
+ 0x264c47,
+ 0x2a2247,
+ 0x2103c3,
+ 0x2ae348,
+ 0x22601982,
+ 0x203a04,
+ 0x3786c3,
+ 0x332c05,
+ 0x3833c3,
+ 0x38da46,
+ 0x31b204,
+ 0x23c2c3,
+ 0x26ad83,
+ 0x22a095c2,
+ 0x22aa44,
+ 0x351445,
+ 0x36bb47,
+ 0x274643,
+ 0x2ad803,
+ 0x2aed83,
+ 0x1621a82,
+ 0x2aee43,
+ 0x2af643,
+ 0x22e04282,
+ 0x2f5d44,
+ 0x378306,
+ 0x204283,
+ 0x2af9c3,
+ 0x232b09c2,
+ 0x2b09c8,
+ 0x2b1404,
+ 0x25a546,
+ 0x2b1847,
+ 0x22ba06,
+ 0x230d44,
+ 0x30e001c2,
+ 0x3a540b,
+ 0x39fb4e,
+ 0x21c80f,
+ 0x233383,
+ 0x31633e42,
+ 0x1604ec2,
+ 0x31a02b82,
+ 0x227683,
+ 0x202b83,
+ 0x235c06,
+ 0x2aea46,
+ 0x27d807,
+ 0x34aa44,
+ 0x31e1bb82,
+ 0x32229e82,
+ 0x228e45,
+ 0x3a4ac7,
+ 0x371b86,
+ 0x326436c2,
+ 0x2436c4,
+ 0x36e203,
+ 0x32a09682,
+ 0x32f508c3,
+ 0x391004,
+ 0x2b6b49,
+ 0x16bc882,
+ 0x33216c82,
+ 0x216c85,
+ 0x33644802,
+ 0x33a00102,
+ 0x33e507,
+ 0x239049,
+ 0x35364b,
+ 0x241cc5,
+ 0x377609,
+ 0x2bcfc6,
+ 0x22d0c7,
+ 0x33e0c744,
+ 0x305ac9,
+ 0x35a787,
+ 0x201b47,
+ 0x209883,
+ 0x209886,
+ 0x2da2c7,
+ 0x206003,
+ 0x271e46,
+ 0x34605642,
+ 0x34a34642,
+ 0x21fa43,
+ 0x250645,
+ 0x222547,
+ 0x281b86,
+ 0x37f705,
+ 0x311244,
+ 0x3b1405,
+ 0x2e8904,
+ 0x34e02102,
+ 0x3210c7,
+ 0x2d6044,
+ 0x223244,
+ 0x22324d,
+ 0x248809,
+ 0x2e0f48,
+ 0x22cd04,
+ 0x209b05,
+ 0x27ee47,
+ 0x332784,
+ 0x22ef87,
+ 0x3a8405,
+ 0x353a9084,
+ 0x2fa005,
+ 0x25da84,
+ 0x265d46,
+ 0x319985,
+ 0x35636b42,
+ 0x212e04,
+ 0x212e05,
+ 0x213206,
+ 0x37f845,
+ 0x256584,
+ 0x2dbc83,
+ 0x32fd86,
+ 0x220f45,
+ 0x225285,
+ 0x319a84,
+ 0x206a03,
+ 0x206a0c,
+ 0x35a86002,
+ 0x35e01042,
+ 0x3620b402,
+ 0x332683,
+ 0x332684,
+ 0x366061c2,
+ 0x3a6088,
+ 0x358685,
+ 0x236604,
+ 0x23b9c6,
+ 0x36a0a242,
+ 0x36e09bc2,
+ 0x37200982,
+ 0x2d8845,
+ 0x251186,
+ 0x341204,
+ 0x2814c6,
+ 0x3340c6,
+ 0x203483,
+ 0x3772788a,
+ 0x23ad85,
+ 0x274803,
+ 0x225046,
+ 0x2efe09,
+ 0x225047,
+ 0x28bd48,
+ 0x293849,
+ 0x219888,
+ 0x36a346,
+ 0x20b203,
+ 0x37a9a1c2,
+ 0x3856c3,
+ 0x3856c9,
+ 0x3357c8,
+ 0x37e09782,
+ 0x38206742,
+ 0x2348c3,
+ 0x2cf145,
+ 0x253304,
+ 0x31c8c9,
+ 0x25f6c4,
+ 0x2b1648,
+ 0x206743,
+ 0x24f244,
+ 0x326b83,
+ 0x21ba88,
+ 0x223187,
+ 0x38643742,
+ 0x269d42,
+ 0x238c45,
+ 0x268849,
+ 0x211003,
+ 0x278184,
+ 0x2da944,
+ 0x202c03,
+ 0x278cca,
+ 0x38b72e82,
+ 0x38e12dc2,
+ 0x2bdb03,
+ 0x3751c3,
+ 0x164f202,
+ 0x250d03,
+ 0x39250042,
+ 0x39603042,
+ 0x39b07b04,
+ 0x366086,
+ 0x3469c6,
+ 0x276b84,
+ 0x25a943,
+ 0x27be43,
+ 0x2e4983,
+ 0x23f286,
+ 0x2c2e45,
+ 0x2be0c7,
+ 0x22cf89,
+ 0x2c1d45,
+ 0x2c2d86,
+ 0x2c3708,
+ 0x2c3906,
+ 0x238744,
+ 0x29718b,
+ 0x2c6383,
+ 0x2c6385,
+ 0x2c64c8,
+ 0x21e442,
+ 0x33e802,
+ 0x39e43b02,
+ 0x3a20e842,
+ 0x21bbc3,
+ 0x3a600e02,
+ 0x269fc3,
+ 0x2c67c4,
+ 0x2c8183,
+ 0x3ae25682,
+ 0x3b2cc5c6,
+ 0x2bb346,
+ 0x2ccc08,
+ 0x3b6cad42,
+ 0x3ba111c2,
+ 0x3be19382,
+ 0x3c209f82,
+ 0x3c614882,
+ 0x3ca00ac2,
+ 0x228343,
+ 0x318d45,
+ 0x209c86,
+ 0x3ce12444,
+ 0x3ab20a,
+ 0x310606,
+ 0x22ad04,
+ 0x27e943,
+ 0x3da06bc2,
+ 0x205902,
+ 0x24dbc3,
+ 0x3de38483,
+ 0x2ee087,
+ 0x319887,
+ 0x3f252c07,
+ 0x20f007,
+ 0x215a43,
+ 0x22c6ca,
+ 0x240584,
+ 0x341504,
+ 0x34150a,
+ 0x247045,
+ 0x3f601642,
+ 0x24d483,
+ 0x3fa01dc2,
+ 0x201f43,
+ 0x26a803,
+ 0x40201942,
+ 0x29a0c4,
+ 0x220a84,
+ 0x3a36c5,
+ 0x2d7205,
+ 0x22da06,
+ 0x22dd86,
+ 0x40608382,
+ 0x40a025c2,
+ 0x2eb445,
+ 0x2bb052,
+ 0x29fbc6,
+ 0x21ce83,
+ 0x2fd346,
+ 0x221d85,
+ 0x1611342,
+ 0x48e0d502,
+ 0x2ed8c3,
+ 0x212043,
+ 0x265603,
+ 0x49203382,
+ 0x379ac3,
+ 0x49602182,
+ 0x204a03,
+ 0x2f5d88,
+ 0x223b43,
+ 0x223b46,
+ 0x333a07,
+ 0x2d84c6,
+ 0x2d84cb,
+ 0x22ac47,
+ 0x392644,
+ 0x49e02602,
+ 0x3a6505,
+ 0x215a03,
+ 0x22fd83,
+ 0x31aa03,
+ 0x31aa06,
+ 0x2d038a,
+ 0x26d703,
+ 0x21d5c4,
+ 0x318146,
+ 0x3b1e46,
+ 0x4a2264c3,
+ 0x250907,
+ 0x29cf8d,
+ 0x39eb87,
+ 0x296ec5,
+ 0x237806,
+ 0x220f83,
+ 0x4bb65303,
+ 0x4be07a82,
+ 0x307604,
+ 0x21e3cc,
+ 0x35bb89,
+ 0x36f307,
+ 0x246045,
+ 0x255904,
+ 0x26ae08,
+ 0x274885,
+ 0x274a85,
+ 0x3612c9,
+ 0x335283,
+ 0x2a6b84,
+ 0x4c206d42,
+ 0x206d43,
+ 0x4c690942,
+ 0x295bc6,
+ 0x16b5482,
+ 0x4ca95782,
+ 0x2d8748,
+ 0x2b6d43,
+ 0x2f9f47,
+ 0x2d7785,
+ 0x295785,
+ 0x2f6c4b,
+ 0x2d1f06,
+ 0x2f6e46,
+ 0x2f9d06,
+ 0x226284,
+ 0x2d4ac6,
+ 0x2d5048,
+ 0x234b03,
+ 0x252ec3,
+ 0x252ec4,
+ 0x2d70c4,
+ 0x2d7487,
+ 0x2d8185,
+ 0x4ced82c2,
+ 0x4d206a42,
+ 0x209285,
+ 0x2990c4,
+ 0x2dac8b,
+ 0x2dbd48,
+ 0x2e6804,
+ 0x243702,
+ 0x4da80b82,
+ 0x2b0c03,
+ 0x2dc204,
+ 0x2dc4c5,
+ 0x272d87,
+ 0x2e06c4,
+ 0x22ab04,
+ 0x4de07442,
+ 0x359f49,
+ 0x2e1585,
+ 0x241f85,
+ 0x2e2105,
+ 0x4e21bd03,
+ 0x2e2f44,
+ 0x2e2f4b,
+ 0x2e3444,
+ 0x2e3ecb,
+ 0x2e48c5,
+ 0x21c94a,
+ 0x2e4f88,
+ 0x2e518a,
+ 0x2e5a03,
+ 0x2e5a0a,
+ 0x4e626402,
+ 0x4ea41542,
+ 0x265903,
+ 0x4eee7d82,
+ 0x2e7d83,
+ 0x4f35d142,
+ 0x4f7157c2,
+ 0x2e8784,
+ 0x21dd86,
+ 0x281205,
+ 0x2e91c3,
+ 0x29ef06,
+ 0x21d445,
+ 0x21e104,
+ 0x4fa08782,
+ 0x2ca784,
+ 0x2bf10a,
+ 0x386847,
+ 0x38ddc6,
+ 0x2d0847,
+ 0x21e503,
+ 0x253b48,
+ 0x25b5cb,
+ 0x300645,
+ 0x2b6e85,
+ 0x2b6e86,
+ 0x225904,
+ 0x335b88,
+ 0x20b4c3,
+ 0x20e204,
+ 0x20e207,
+ 0x280ec6,
+ 0x321746,
+ 0x29b68a,
+ 0x244fc4,
+ 0x244fca,
+ 0x2de886,
+ 0x2de887,
+ 0x253887,
+ 0x26f884,
+ 0x26f889,
+ 0x24b7c5,
+ 0x23a30b,
+ 0x26ddc3,
+ 0x20d0c3,
+ 0x21a943,
+ 0x231e84,
+ 0x4fe04b42,
+ 0x254186,
+ 0x2ab805,
+ 0x2b2dc5,
+ 0x3324c6,
+ 0x279384,
+ 0x502013c2,
+ 0x240b44,
+ 0x50607982,
+ 0x232984,
+ 0x227783,
+ 0x50a12082,
+ 0x349f83,
+ 0x24ae86,
+ 0x50e01bc2,
+ 0x30f108,
+ 0x224ec4,
+ 0x224ec6,
+ 0x305546,
+ 0x255f04,
+ 0x32fd05,
+ 0x3a8108,
+ 0x3a8607,
+ 0x3b0bc7,
+ 0x3b0bcf,
+ 0x28f286,
+ 0x210d03,
+ 0x210d04,
+ 0x2251c4,
+ 0x229103,
+ 0x224784,
+ 0x373e44,
+ 0x51226442,
+ 0x287303,
+ 0x390683,
+ 0x51617642,
+ 0x222a43,
+ 0x24f803,
+ 0x218e4a,
+ 0x23b5c7,
+ 0x3a568c,
+ 0x3a5946,
+ 0x230ac6,
+ 0x23a6c7,
+ 0x2302c7,
+ 0x23e289,
+ 0x21f144,
+ 0x23ea84,
+ 0x51a0a442,
+ 0x51e01402,
+ 0x29ba46,
+ 0x250704,
+ 0x376e86,
+ 0x230748,
+ 0x330cc4,
+ 0x264c86,
+ 0x2c9745,
+ 0x25f008,
+ 0x207503,
+ 0x266a45,
+ 0x269b43,
+ 0x242083,
+ 0x242084,
+ 0x26afc3,
+ 0x522e1202,
+ 0x52602482,
+ 0x26dc89,
+ 0x274985,
+ 0x283dc4,
+ 0x3614c5,
+ 0x210804,
+ 0x2ed107,
+ 0x33fac5,
+ 0x252dc4,
+ 0x252dc8,
+ 0x2d3486,
+ 0x2d5204,
+ 0x2d5208,
+ 0x2d5e87,
+ 0x52a015c2,
+ 0x2da0c4,
+ 0x2d3904,
+ 0x201d47,
+ 0x52e41384,
+ 0x22dc82,
+ 0x53201882,
+ 0x202b43,
+ 0x216b84,
+ 0x222903,
+ 0x222905,
+ 0x5362c082,
+ 0x2e9085,
+ 0x210fc2,
+ 0x376445,
+ 0x35ef05,
+ 0x53a168c2,
+ 0x2168c4,
+ 0x53e08d82,
+ 0x2c7b06,
+ 0x2ac106,
+ 0x268988,
+ 0x2b7b88,
+ 0x2e8b04,
+ 0x35e245,
+ 0x2f39c9,
+ 0x29f484,
+ 0x2d0344,
+ 0x2513c3,
+ 0x5420dfc5,
+ 0x374f07,
+ 0x2881c4,
+ 0x35a90d,
+ 0x35b202,
+ 0x3858c3,
+ 0x39a083,
+ 0x54601082,
+ 0x3886c5,
+ 0x31b447,
+ 0x20f0c4,
+ 0x20f0c7,
+ 0x293a49,
+ 0x2bf249,
+ 0x214687,
+ 0x24fa83,
+ 0x2b52c8,
+ 0x23dd09,
+ 0x2e9947,
+ 0x2e9cc5,
+ 0x2ea486,
+ 0x2eaac6,
+ 0x2eac45,
+ 0x248905,
+ 0x54a01282,
+ 0x228685,
+ 0x2b9988,
+ 0x2a79c6,
+ 0x3a1c87,
+ 0x2e4b04,
+ 0x2ab1c7,
+ 0x2edd06,
+ 0x54e00242,
+ 0x212f06,
+ 0x2f004a,
+ 0x2f1045,
+ 0x552d29c2,
+ 0x55638282,
+ 0x2da606,
+ 0x3574c8,
+ 0x55babf47,
+ 0x55e00602,
+ 0x20a503,
+ 0x3b0306,
+ 0x30aa04,
+ 0x3338c6,
+ 0x341746,
+ 0x3971ca,
+ 0x3a1e05,
+ 0x20d586,
+ 0x218743,
+ 0x218744,
+ 0x207282,
+ 0x2fe483,
+ 0x56253e82,
+ 0x2dd843,
+ 0x2f7904,
+ 0x2dca04,
+ 0x35760a,
+ 0x245483,
+ 0x283b08,
+ 0x36a40a,
+ 0x278447,
+ 0x2f4846,
+ 0x2c79c4,
+ 0x22abc2,
+ 0x200e42,
+ 0x56609202,
+ 0x244603,
+ 0x253647,
+ 0x29f1c7,
+ 0x38f98b,
+ 0x3643c4,
+ 0x349447,
+ 0x272e86,
+ 0x213807,
+ 0x2ad204,
+ 0x33bb85,
+ 0x2a96c5,
+ 0x56a10442,
+ 0x221a46,
+ 0x2259c3,
+ 0x226cc2,
+ 0x226cc6,
+ 0x56e0d942,
+ 0x57203e42,
+ 0x203e45,
+ 0x57624982,
+ 0x57a06ec2,
+ 0x358845,
+ 0x2c0f45,
+ 0x20d645,
+ 0x264183,
+ 0x340185,
+ 0x2d1fc7,
+ 0x2aa2c5,
+ 0x3219c5,
+ 0x38b604,
+ 0x379bc6,
+ 0x243c84,
+ 0x57e00cc2,
+ 0x276485,
+ 0x2a4887,
+ 0x377088,
+ 0x26a8c6,
+ 0x26a8cd,
+ 0x270789,
+ 0x270792,
+ 0x322045,
+ 0x326e03,
+ 0x58a019c2,
+ 0x2e6004,
+ 0x2022c3,
+ 0x35e145,
+ 0x2f2605,
+ 0x58e21e42,
+ 0x290f03,
+ 0x59242d42,
+ 0x59694082,
+ 0x59a18882,
+ 0x346e05,
+ 0x2a1003,
+ 0x397008,
+ 0x59e011c2,
+ 0x5a203282,
+ 0x29a086,
+ 0x27f30a,
+ 0x204983,
+ 0x256503,
+ 0x2f3c43,
+ 0x5ae06202,
+ 0x692033c2,
+ 0x69a04cc2,
+ 0x203dc2,
+ 0x38bd09,
+ 0x2bbcc4,
+ 0x2ae648,
+ 0x69ee9202,
+ 0x6a205882,
+ 0x2e4105,
+ 0x2355c8,
+ 0x247d88,
+ 0x2f334c,
+ 0x23a183,
+ 0x25d442,
+ 0x6a62d742,
+ 0x2c21c6,
+ 0x2f56c5,
+ 0x30f5c3,
+ 0x3903c6,
+ 0x2f5806,
+ 0x22fc43,
+ 0x2f6a03,
+ 0x2f6fc6,
+ 0x2f7d84,
+ 0x270186,
+ 0x2c6545,
+ 0x2f800a,
+ 0x23d184,
+ 0x2f8d84,
+ 0x34b94a,
+ 0x6aa6cd42,
+ 0x347a45,
+ 0x2fa44a,
+ 0x2fb885,
+ 0x2fc404,
+ 0x2fc506,
+ 0x2fc684,
+ 0x366dc6,
+ 0x6ae00282,
+ 0x38d706,
+ 0x38e7c5,
+ 0x204707,
+ 0x239f46,
+ 0x22d584,
+ 0x22d587,
+ 0x3277c6,
+ 0x212f45,
+ 0x2c6c87,
+ 0x39ae07,
+ 0x39ae0e,
+ 0x223ec6,
+ 0x22ee45,
+ 0x279a07,
+ 0x2deb83,
+ 0x2deb87,
+ 0x3a8a05,
+ 0x211204,
+ 0x2120c2,
+ 0x37a547,
+ 0x34aac4,
+ 0x2ae9c4,
+ 0x269bcb,
+ 0x2201c3,
+ 0x2c3a47,
+ 0x2201c4,
+ 0x2ce307,
+ 0x238943,
+ 0x32914d,
+ 0x388f08,
+ 0x252cc4,
+ 0x252cc5,
+ 0x2fca45,
+ 0x2fd003,
+ 0x6b224dc2,
+ 0x2fe443,
+ 0x2fea03,
+ 0x365c44,
+ 0x276e45,
+ 0x2193c7,
+ 0x2187c6,
+ 0x372f83,
+ 0x226e0b,
+ 0x29d34b,
+ 0x267c4b,
+ 0x276f4a,
+ 0x2a734b,
+ 0x2cae0b,
+ 0x2d2a0c,
+ 0x2d5711,
+ 0x33d90a,
+ 0x34e1cb,
+ 0x37bd0b,
+ 0x3ae28a,
+ 0x3b2eca,
+ 0x2ff60d,
+ 0x300d4e,
+ 0x301b4b,
+ 0x301e0a,
+ 0x302d51,
+ 0x30318a,
+ 0x30368b,
+ 0x303bce,
+ 0x30450c,
+ 0x30498b,
+ 0x304c4e,
+ 0x304fcc,
+ 0x3087ca,
+ 0x3098cc,
+ 0x6b709bca,
+ 0x30adc9,
+ 0x30c94a,
+ 0x30cbca,
+ 0x30ce4b,
+ 0x312f8e,
+ 0x313311,
+ 0x31bcc9,
+ 0x31bf0a,
+ 0x31cb0b,
+ 0x31e2ca,
+ 0x31ee56,
+ 0x32060b,
+ 0x321e0a,
+ 0x32220a,
+ 0x32424b,
+ 0x326889,
+ 0x329ac9,
+ 0x32ae0d,
+ 0x32c48b,
+ 0x32d60b,
+ 0x32dfcb,
+ 0x32e449,
+ 0x32ea8e,
+ 0x32efca,
+ 0x335e4a,
+ 0x33648a,
+ 0x336e4b,
+ 0x33768b,
+ 0x33794d,
+ 0x33904d,
+ 0x339c90,
+ 0x33a14b,
+ 0x33ac8c,
+ 0x33c3cb,
+ 0x33e00b,
+ 0x33f64b,
+ 0x34490b,
+ 0x34538f,
+ 0x34574b,
+ 0x34600a,
+ 0x346709,
+ 0x346b49,
+ 0x34808b,
+ 0x34834e,
+ 0x34bfcb,
+ 0x34cd8f,
+ 0x34ed8b,
+ 0x34f04b,
+ 0x34f30b,
+ 0x34f74a,
+ 0x353249,
+ 0x35624f,
+ 0x35ce4c,
+ 0x35d34c,
+ 0x35de0e,
+ 0x35e48f,
+ 0x35e84e,
+ 0x35fa90,
+ 0x35fe8f,
+ 0x3608ce,
+ 0x3617cc,
+ 0x361ad2,
+ 0x36b751,
+ 0x36bd0e,
+ 0x36c14e,
+ 0x36c68e,
+ 0x36ca0f,
+ 0x36cdce,
+ 0x36d153,
+ 0x36d611,
+ 0x36da4e,
+ 0x36decc,
+ 0x36e2d3,
+ 0x36f650,
+ 0x36ff0c,
+ 0x37020c,
+ 0x3706cb,
+ 0x37168e,
+ 0x371f8b,
+ 0x3723cb,
+ 0x373b0c,
+ 0x37acca,
+ 0x37b50c,
+ 0x37b80c,
+ 0x37bb09,
+ 0x37cf0b,
+ 0x37d1c8,
+ 0x37d3c9,
+ 0x37d3cf,
+ 0x37ed0b,
+ 0x37fa0a,
+ 0x380fcc,
+ 0x382e49,
+ 0x383208,
+ 0x38374b,
+ 0x383e4b,
+ 0x384c8a,
+ 0x384f0b,
+ 0x38544c,
+ 0x385e08,
+ 0x38910b,
+ 0x38ba0b,
+ 0x38fc4b,
+ 0x391a4b,
+ 0x39a98b,
+ 0x39ac49,
+ 0x39b18d,
+ 0x3a004a,
+ 0x3a0f97,
+ 0x3a2898,
+ 0x3a5bc9,
+ 0x3a7b4b,
+ 0x3a9414,
+ 0x3a990b,
+ 0x3a9e8a,
+ 0x3aa30a,
+ 0x3aa58b,
+ 0x3ab590,
+ 0x3ab991,
+ 0x3ac48a,
+ 0x3ad88d,
+ 0x3adf8d,
+ 0x3b328b,
+ 0x3b4506,
+ 0x221b43,
+ 0x6bb99283,
+ 0x323dc6,
+ 0x28b6c5,
+ 0x2c55c7,
+ 0x33d7c6,
+ 0x1617982,
+ 0x2b0d49,
+ 0x29ed04,
+ 0x2cfe48,
+ 0x242743,
+ 0x2e5f47,
+ 0x230902,
+ 0x2acbc3,
+ 0x6be006c2,
+ 0x2c0586,
+ 0x2c17c4,
+ 0x307c84,
+ 0x236c43,
+ 0x236c45,
+ 0x6c6ff382,
+ 0x6caa8004,
+ 0x26f7c7,
+ 0x16ce2c2,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x211003,
+ 0x238483,
+ 0x2264c3,
+ 0x2025c3,
+ 0x200882,
+ 0x880c8,
+ 0x216582,
+ 0x21eb03,
+ 0x211003,
+ 0x238483,
+ 0x2264c3,
+ 0x217643,
+ 0x317416,
+ 0x31a5d3,
+ 0x3492c9,
+ 0x3aad88,
+ 0x3a6389,
+ 0x2fa5c6,
+ 0x32c750,
+ 0x21d6d3,
+ 0x200b08,
+ 0x25aa47,
+ 0x274ec7,
+ 0x29cb4a,
+ 0x2f7989,
+ 0x3336c9,
+ 0x28a70b,
+ 0x325506,
+ 0x31cf8a,
+ 0x223586,
+ 0x29e903,
+ 0x28e085,
+ 0x217188,
+ 0x2c7bcd,
+ 0x357c4c,
+ 0x38e487,
+ 0x3025cd,
+ 0x3a8204,
+ 0x23214a,
+ 0x232a8a,
+ 0x232f4a,
+ 0x21d9c7,
+ 0x23cfc7,
+ 0x23f644,
+ 0x239506,
+ 0x3258c4,
+ 0x2ec848,
+ 0x25f709,
+ 0x2b83c6,
+ 0x2b83c8,
+ 0x2423cd,
+ 0x2bf489,
+ 0x378cc8,
+ 0x241f07,
+ 0x2fe78a,
+ 0x24a4c6,
+ 0x25a047,
+ 0x2cdac4,
+ 0x240d07,
+ 0x30130a,
+ 0x3397ce,
+ 0x255805,
+ 0x2fcd4b,
+ 0x277a09,
+ 0x223349,
+ 0x2a2087,
+ 0x358b0a,
+ 0x201c87,
+ 0x39fc89,
+ 0x358108,
+ 0x369c4b,
+ 0x2cf145,
+ 0x2e0e0a,
+ 0x2a37c9,
+ 0x30f54a,
+ 0x2c1dcb,
+ 0x240c0b,
+ 0x28a495,
+ 0x2d5d45,
+ 0x241f85,
+ 0x2e2f4a,
+ 0x215cca,
+ 0x310c47,
+ 0x220683,
+ 0x29b9c8,
+ 0x2cb14a,
+ 0x224ec6,
+ 0x23db49,
+ 0x25f008,
+ 0x2d5204,
+ 0x22fb09,
+ 0x2b7b88,
+ 0x32c247,
+ 0x276486,
+ 0x2a4887,
+ 0x28fd87,
+ 0x23f085,
+ 0x25564c,
+ 0x252cc5,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x238483,
+ 0x2264c3,
+ 0x216582,
+ 0x22d183,
+ 0x238483,
+ 0x2025c3,
+ 0x2264c3,
+ 0x22d183,
+ 0x238483,
+ 0x223b43,
+ 0x2264c3,
+ 0x880c8,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x211003,
+ 0x238483,
+ 0x2264c3,
+ 0x880c8,
+ 0x216582,
+ 0x201a42,
+ 0x233182,
+ 0x201982,
+ 0x204c02,
+ 0x293d42,
+ 0x462d183,
+ 0x2343c3,
+ 0x211cc3,
+ 0x21eb03,
+ 0x202243,
+ 0x211003,
+ 0x238483,
+ 0x2264c3,
+ 0x20b443,
+ 0x880c8,
+ 0x335d44,
+ 0x24f007,
+ 0x251fc3,
+ 0x231404,
+ 0x214bc3,
+ 0x282343,
+ 0x21eb03,
+ 0x16e747,
+ 0x200882,
+ 0x123ac3,
+ 0x5a16582,
+ 0x86a0d,
+ 0x233182,
+ 0x1604,
+ 0x201502,
+ 0x5e01508,
+ 0xe26c4,
+ 0x880c8,
+ 0x140de82,
+ 0x14fa2c6,
+ 0x230983,
+ 0x316403,
+ 0x662d183,
+ 0x232144,
+ 0x6a343c3,
+ 0x6e1eb03,
+ 0x2082c2,
+ 0x201604,
+ 0x238483,
+ 0x212ec3,
+ 0x202282,
+ 0x2264c3,
+ 0x21ed42,
+ 0x2e86c3,
+ 0x201bc2,
+ 0x29c743,
+ 0x22d743,
+ 0x204702,
+ 0x880c8,
+ 0x230983,
+ 0x212ec3,
+ 0x202282,
+ 0x2e86c3,
+ 0x201bc2,
+ 0x29c743,
+ 0x22d743,
+ 0x204702,
+ 0x2e86c3,
+ 0x201bc2,
+ 0x29c743,
+ 0x22d743,
+ 0x204702,
+ 0x22d183,
+ 0x323ac3,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x201604,
+ 0x202243,
+ 0x211003,
+ 0x212444,
+ 0x238483,
+ 0x2264c3,
+ 0x202002,
+ 0x21bd03,
+ 0x880c8,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x211003,
+ 0x238483,
+ 0x2264c3,
+ 0x323ac3,
+ 0x216582,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x201604,
+ 0x238483,
+ 0x2264c3,
+ 0x2e9cc5,
+ 0x221e42,
+ 0x200882,
+ 0x880c8,
+ 0x1462d48,
+ 0x21eb03,
+ 0x225b41,
+ 0x20fd41,
+ 0x20c401,
+ 0x20c041,
+ 0x226fc1,
+ 0x26f541,
+ 0x252041,
+ 0x225c41,
+ 0x2d5901,
+ 0x2ff8c1,
+ 0x200141,
+ 0x200001,
+ 0x880c8,
+ 0x200481,
+ 0x200741,
+ 0x200081,
+ 0x200c81,
+ 0x2007c1,
+ 0x200901,
+ 0x200041,
+ 0x204281,
+ 0x2001c1,
+ 0x2000c1,
+ 0x200341,
+ 0x200ac1,
+ 0x201501,
+ 0x2014c1,
+ 0x204101,
+ 0x200b81,
+ 0x200241,
+ 0x200a01,
+ 0x2002c1,
+ 0x200281,
+ 0x204701,
+ 0x20dec1,
+ 0x200781,
+ 0x200641,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x238483,
+ 0x2264c3,
+ 0x216582,
+ 0x22d183,
+ 0x2343c3,
+ 0x201502,
+ 0x2264c3,
+ 0x16e747,
+ 0x131ac7,
+ 0x1e1c6,
+ 0x1736ca,
+ 0x85c48,
+ 0x53188,
+ 0x53547,
+ 0x50d06,
+ 0xce6c5,
+ 0x51f05,
+ 0x161186,
+ 0x155646,
+ 0x224104,
+ 0x322707,
+ 0x880c8,
+ 0x22d684,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x238483,
+ 0x2264c3,
+ 0x22d183,
+ 0x2343c3,
+ 0x211cc3,
+ 0x21eb03,
+ 0x202243,
+ 0x211003,
+ 0x238483,
+ 0x2264c3,
+ 0x221e42,
+ 0x2be043,
+ 0x2f5003,
+ 0x20b283,
+ 0x202e02,
+ 0x248083,
+ 0x204803,
+ 0x206e83,
+ 0x200001,
+ 0x207043,
+ 0x26ff44,
+ 0x324dc3,
+ 0x30c683,
+ 0x21dec3,
+ 0x379b43,
+ 0xaa2d183,
+ 0x2374c4,
+ 0x21de83,
+ 0x232383,
+ 0x2343c3,
+ 0x234103,
+ 0x208143,
+ 0x2a3ec3,
+ 0x30c603,
+ 0x228103,
+ 0x212103,
+ 0x24c1c4,
+ 0x23aa82,
+ 0x252a43,
+ 0x2585c3,
+ 0x272bc3,
+ 0x250b43,
+ 0x24f8c3,
+ 0x21eb03,
+ 0x2db983,
+ 0x220883,
+ 0x201603,
+ 0x210483,
+ 0x2f2903,
+ 0xaefe5c3,
+ 0x385d43,
+ 0x200983,
+ 0x2348c3,
+ 0x211003,
+ 0x21e442,
+ 0x286fc3,
+ 0x238483,
+ 0x16025c3,
+ 0x217e83,
+ 0x21da43,
+ 0x29af43,
+ 0x2264c3,
+ 0x30e803,
+ 0x21bd03,
+ 0x2ad283,
+ 0x2f6a83,
+ 0x2e8883,
+ 0x21d445,
+ 0x215cc3,
+ 0x2e88c3,
+ 0x39c083,
+ 0x218744,
+ 0x25b343,
+ 0x22e8c3,
+ 0x277c03,
+ 0x20b443,
+ 0x221e42,
+ 0x23a183,
+ 0x2f9b84,
+ 0x2ae9c4,
+ 0x244843,
+ 0x880c8,
+ 0x882,
+ 0x1002,
+ 0x2e02,
+ 0x1482,
+ 0x2d42,
+ 0x4c2,
+ 0x44682,
+ 0x202,
+ 0x1f82,
+ 0x982,
+ 0x43742,
+ 0xe842,
+ 0xe02,
+ 0x7a82,
+ 0x93d42,
+ 0x6d42,
+ 0x26282,
+ 0x7442,
+ 0x1f882,
+ 0x8b02,
+ 0x4b42,
+ 0x1c882,
+ 0x13c2,
+ 0x17642,
+ 0x1402,
+ 0xdfc2,
+ 0x6ec2,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x238483,
+ 0x2264c3,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x238483,
+ 0x2264c3,
+ 0x216582,
+ 0x2264c3,
+ 0xc22d183,
+ 0x21eb03,
+ 0x211003,
+ 0x223b42,
+ 0x880c8,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x238483,
+ 0x2264c3,
+ 0x6c2,
+ 0x202f02,
+ 0x223f42,
+ 0x880c8,
+ 0x16582,
+ 0x235f82,
+ 0x203142,
+ 0x23e682,
+ 0x201642,
+ 0x208382,
+ 0x51f05,
+ 0x2029c2,
+ 0x202282,
+ 0x203382,
+ 0x205d02,
+ 0x206d42,
+ 0x385542,
+ 0x201882,
+ 0x227642,
+ 0x16e747,
+ 0x119d4d,
+ 0xeafc9,
+ 0x47b8b,
+ 0xd1e88,
+ 0x13bc89,
+ 0x21eb03,
+ 0x880c8,
+ 0x880c8,
+ 0x53e06,
+ 0x200882,
+ 0x224104,
+ 0x216582,
+ 0x22d183,
+ 0x201a42,
+ 0x2343c3,
+ 0x201f82,
+ 0x22d684,
+ 0x202243,
+ 0x209782,
+ 0x238483,
+ 0x201502,
+ 0x2264c3,
+ 0x241f86,
+ 0x30d40f,
+ 0x6fef43,
+ 0x880c8,
+ 0x216582,
+ 0x211cc3,
+ 0x21eb03,
+ 0x211003,
+ 0x1568ecb,
+ 0x16e747,
+ 0x216582,
+ 0x22d183,
+ 0x21eb03,
+ 0x238483,
+ 0x200882,
+ 0x201102,
+ 0x2093c2,
+ 0xfa2d183,
+ 0x23e4c2,
+ 0x2343c3,
+ 0x2475c2,
+ 0x227982,
+ 0x21eb03,
+ 0x21c2c2,
+ 0x301dc2,
+ 0x2a7fc2,
+ 0x201142,
+ 0x289f82,
+ 0x206982,
+ 0x200902,
+ 0x205e82,
+ 0x26a242,
+ 0x204d42,
+ 0x2ad802,
+ 0x230cc2,
+ 0x225a02,
+ 0x228f02,
+ 0x211003,
+ 0x203042,
+ 0x238483,
+ 0x2425c2,
+ 0x267c02,
+ 0x2264c3,
+ 0x248102,
+ 0x217642,
+ 0x20a442,
+ 0x202482,
+ 0x2168c2,
+ 0x2d29c2,
+ 0x210442,
+ 0x242d42,
+ 0x221bc2,
+ 0x301e0a,
+ 0x34600a,
+ 0x38074a,
+ 0x3b4682,
+ 0x20d802,
+ 0x23c282,
+ 0xff49009,
+ 0x103a418a,
+ 0x1042fe87,
+ 0xc002,
+ 0x1a418a,
+ 0x245dc4,
+ 0x10e2d183,
+ 0x2343c3,
+ 0x247344,
+ 0x21eb03,
+ 0x201604,
+ 0x202243,
+ 0x211003,
+ 0x238483,
+ 0x2025c3,
+ 0x2264c3,
+ 0x215cc3,
+ 0x223ec3,
+ 0x880c8,
+ 0x1450c84,
+ 0x50505,
+ 0x4e80a,
+ 0x109842,
+ 0x18b406,
+ 0x162d51,
+ 0x11749009,
+ 0x163187,
+ 0x4802,
+ 0x1aa80a,
+ 0xdb7c7,
+ 0x880c8,
+ 0xfd948,
+ 0xe707,
+ 0x1281c44b,
+ 0x15802,
+ 0x1a6707,
+ 0x1b1a4a,
+ 0x10728f,
+ 0x131b4f,
+ 0x1dec2,
+ 0x16582,
+ 0xa3e08,
+ 0xea70a,
+ 0x167408,
+ 0xf82,
+ 0x10700f,
+ 0x124e4b,
+ 0x2988,
+ 0x16e847,
+ 0x16a8a,
+ 0xae14b,
+ 0x112089,
+ 0x173507,
+ 0xf424c,
+ 0x10ec87,
+ 0xd060a,
+ 0x132d48,
+ 0x8e28e,
+ 0x553ce,
+ 0xdb60b,
+ 0x110d8b,
+ 0xead0b,
+ 0x1e1c9,
+ 0x1fb8b,
+ 0x2398d,
+ 0x260cb,
+ 0x2708d,
+ 0x2c90d,
+ 0x2ec8a,
+ 0xae80b,
+ 0xc6fcb,
+ 0xe82c5,
+ 0x10a710,
+ 0x8128f,
+ 0xb74f,
+ 0x2a24d,
+ 0x6fd50,
+ 0xd82,
+ 0x12fa2488,
+ 0x131948,
+ 0x132e4bc5,
+ 0x4668b,
+ 0x52088,
+ 0x110f4a,
+ 0x58d89,
+ 0x60587,
+ 0x608c7,
+ 0x60a87,
+ 0x611c7,
+ 0x629c7,
+ 0x62f47,
+ 0x636c7,
+ 0x63d47,
+ 0x64307,
+ 0x644c7,
+ 0x66087,
+ 0x66247,
+ 0x66407,
+ 0x665c7,
+ 0x668c7,
+ 0x66e07,
+ 0x67a47,
+ 0x67f07,
+ 0x68707,
+ 0x69207,
+ 0x693c7,
+ 0x699c7,
+ 0x69e87,
+ 0x6a087,
+ 0x6a347,
+ 0x6a507,
+ 0x6a6c7,
+ 0x6ac07,
+ 0x6b4c7,
+ 0x6bf87,
+ 0x6c687,
+ 0x6c947,
+ 0x6ce07,
+ 0x6cfc7,
+ 0x6d347,
+ 0x6e3c7,
+ 0x6ea07,
+ 0x6ee07,
+ 0x6efc7,
+ 0x6f187,
+ 0x6f5c7,
+ 0x70307,
+ 0x70607,
+ 0x70c07,
+ 0x70dc7,
+ 0x71147,
+ 0x71587,
+ 0xd382,
+ 0x33d8a,
+ 0xf9dc7,
+ 0x134c87cb,
+ 0x14c87d6,
+ 0x18351,
+ 0xdfb8a,
+ 0xa3c8a,
+ 0x53e06,
+ 0xc114b,
+ 0xb2c2,
+ 0x31ad1,
+ 0x959c9,
+ 0x90ac9,
+ 0x5e82,
+ 0x9c34a,
+ 0xa5449,
+ 0xa5c8f,
+ 0xa688e,
+ 0xa7188,
+ 0xf1c2,
+ 0x169a89,
+ 0x8498e,
+ 0xac64c,
+ 0xd400f,
+ 0x194a8e,
+ 0x1098c,
+ 0x15309,
+ 0x16451,
+ 0x19a48,
+ 0x2bd52,
+ 0x2e5cd,
+ 0x393cd,
+ 0x13ff8b,
+ 0x179d95,
+ 0x33c49,
+ 0x5488a,
+ 0x58749,
+ 0x5fe90,
+ 0x60f0b,
+ 0x6e54f,
+ 0x71d0b,
+ 0x756cc,
+ 0x787d0,
+ 0x8660a,
+ 0x86e8d,
+ 0x14ea0e,
+ 0x18004a,
+ 0x8c7cc,
+ 0x8fa54,
+ 0x95651,
+ 0x98f8b,
+ 0x9b54f,
+ 0xab6cd,
+ 0xabfce,
+ 0x12c10c,
+ 0x15710c,
+ 0xdc8cb,
+ 0xeef8e,
+ 0xfb250,
+ 0x10938b,
+ 0x11270d,
+ 0x15f28f,
+ 0xb504c,
+ 0xb824e,
+ 0xb8a51,
+ 0xba84c,
+ 0x1362c7,
+ 0x11c60d,
+ 0xbe94c,
+ 0xc4d90,
+ 0xd35cd,
+ 0xe7847,
+ 0xec4d0,
+ 0xf0688,
+ 0xf124b,
+ 0x17318f,
+ 0x2b848,
+ 0xdfd8d,
+ 0x1763d0,
+ 0x13aaf9c6,
+ 0xb0bc3,
+ 0x9682,
+ 0x2cd09,
+ 0x551ca,
+ 0xf9bc6,
+ 0x13cd5389,
+ 0x124c3,
+ 0x109f11,
+ 0x9f89,
+ 0xcd5c7,
+ 0x10710b,
+ 0xd2d10,
+ 0xd31cc,
+ 0xd47c5,
+ 0x11ab08,
+ 0x19be4a,
+ 0x122b07,
+ 0x25c2,
+ 0x5160a,
+ 0x1694c9,
+ 0xa62ca,
+ 0x1abe8f,
+ 0x4084b,
+ 0x10760c,
+ 0x1078d2,
+ 0xb5485,
+ 0x15d98a,
+ 0x142e1fc5,
+ 0x19900c,
+ 0x1157c3,
+ 0x185542,
+ 0xe8e4a,
+ 0x108548,
+ 0x163407,
+ 0x4b42,
+ 0x7982,
+ 0x1bc2,
+ 0x129e10,
+ 0x1402,
+ 0x3074f,
+ 0x161186,
+ 0x1113ce,
+ 0xe3a4b,
+ 0x180248,
+ 0xc9a89,
+ 0x17e4d2,
+ 0x178b8d,
+ 0x45e88,
+ 0x47a49,
+ 0x485cd,
+ 0x4a189,
+ 0x4a64b,
+ 0x4ac08,
+ 0x4e648,
+ 0x53f48,
+ 0x559c9,
+ 0x55bca,
+ 0x57f4c,
+ 0xe31ca,
+ 0xf6ac7,
+ 0xdfcd,
+ 0xeb88b,
+ 0x9eb0c,
+ 0x18b610,
+ 0x3282,
+ 0xc570d,
+ 0x6202,
+ 0x33c2,
+ 0xf6a0a,
+ 0xdfa8a,
+ 0xe5e4b,
+ 0xc718c,
+ 0xfd6ce,
+ 0x165d0d,
+ 0xf3dc8,
+ 0x6c2,
+ 0x11a0c0ce,
+ 0x11c2fe87,
+ 0x121aa0c9,
+ 0x11583,
+ 0x127117cc,
+ 0xc002,
+ 0x50111,
+ 0xc011,
+ 0xa1091,
+ 0x81ed1,
+ 0x11170f,
+ 0x11dfcc,
+ 0x121acd,
+ 0x123f0d,
+ 0x142615,
+ 0x14b18c,
+ 0x159590,
+ 0xfa8c,
+ 0x5274c,
+ 0x47109,
+ 0xc002,
+ 0x501ce,
+ 0xc0ce,
+ 0xa114e,
+ 0x81f8e,
+ 0x1117cc,
+ 0x11e089,
+ 0x14b249,
+ 0x14280d,
+ 0xfb49,
+ 0x52809,
+ 0x1267c3,
+ 0x940c3,
+ 0xc002,
+ 0x162d45,
+ 0x1aa804,
+ 0xdf704,
+ 0x127244,
+ 0x17f904,
+ 0x17c084,
+ 0x163184,
+ 0x144bdc3,
+ 0x140de83,
+ 0x19fd04,
+ 0x1573dc3,
+ 0xd82,
+ 0x165d03,
+ 0x200882,
+ 0x216582,
+ 0x201a42,
+ 0x206ac2,
+ 0x201f82,
+ 0x201502,
+ 0x201bc2,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x201603,
+ 0x238483,
+ 0x2264c3,
+ 0x880c8,
+ 0x22d183,
+ 0x2343c3,
+ 0x238483,
+ 0x2264c3,
+ 0x1d003,
+ 0x21eb03,
+ 0x200882,
+ 0x323ac3,
+ 0x15e2d183,
+ 0x330d47,
+ 0x21eb03,
+ 0x332683,
+ 0x212444,
+ 0x238483,
+ 0x2264c3,
+ 0x24690a,
+ 0x241f85,
+ 0x21bd03,
+ 0x203e42,
+ 0x880c8,
+ 0x880c8,
+ 0x16582,
+ 0x113682,
+ 0x1a6845,
+ 0x880c8,
+ 0x2d183,
+ 0x77947,
+ 0x1161cf,
+ 0xf9c44,
+ 0x11220a,
+ 0xac287,
+ 0xf78a,
+ 0x93e8a,
+ 0xa660a,
+ 0xf9bc6,
+ 0x27ca,
+ 0xccd,
+ 0x123ac3,
+ 0x880c8,
+ 0x16582,
+ 0x47344,
+ 0x67683,
+ 0xe9cc5,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x238483,
+ 0x2264c3,
+ 0x204803,
+ 0x22d183,
+ 0x2343c3,
+ 0x211cc3,
+ 0x21eb03,
+ 0x211003,
+ 0x238483,
+ 0x2264c3,
+ 0x290c83,
+ 0x223ec3,
+ 0x204803,
+ 0x224104,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x238483,
+ 0x2264c3,
+ 0x232dc3,
+ 0x22d183,
+ 0x2343c3,
+ 0x206ac3,
+ 0x211cc3,
+ 0x21eb03,
+ 0x201604,
+ 0x36b683,
+ 0x2348c3,
+ 0x211003,
+ 0x238483,
+ 0x2264c3,
+ 0x21bd03,
+ 0x3b0343,
+ 0x1822d183,
+ 0x2343c3,
+ 0x244d43,
+ 0x21eb03,
+ 0x275803,
+ 0x2348c3,
+ 0x2264c3,
+ 0x207443,
+ 0x27f5c4,
+ 0x880c8,
+ 0x18a2d183,
+ 0x2343c3,
+ 0x2a7243,
+ 0x21eb03,
+ 0x211003,
+ 0x212444,
+ 0x238483,
+ 0x2264c3,
+ 0x220703,
+ 0x880c8,
+ 0x1922d183,
+ 0x2343c3,
+ 0x211cc3,
+ 0x2025c3,
+ 0x2264c3,
+ 0x880c8,
+ 0x142fe87,
+ 0x323ac3,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x201604,
+ 0x212444,
+ 0x238483,
+ 0x2264c3,
+ 0x16e747,
+ 0x176c84,
+ 0x1462d48,
+ 0xa7dcd,
+ 0x3256c5,
+ 0x880c8,
+ 0x742,
+ 0x35bc3,
+ 0xe6786,
+ 0x307e48,
+ 0x3afd07,
+ 0x224104,
+ 0x355346,
+ 0x359446,
+ 0x880c8,
+ 0x301043,
+ 0x20b149,
+ 0x2b46d5,
+ 0xb46df,
+ 0x22d183,
+ 0x32f8d2,
+ 0xfea86,
+ 0x13af45,
+ 0x110f4a,
+ 0x58d89,
+ 0x32f68f,
+ 0x22d684,
+ 0x331145,
+ 0x2f26d0,
+ 0x3aaf87,
+ 0x2025c3,
+ 0x32d208,
+ 0x2aeeca,
+ 0x2014c4,
+ 0x2e1a03,
+ 0x241f86,
+ 0x203e42,
+ 0x38660b,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x211003,
+ 0x238483,
+ 0x2264c3,
+ 0x2e6a83,
+ 0x216582,
+ 0x238483,
+ 0x2264c3,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x211003,
+ 0x2264c3,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x332683,
+ 0x203043,
+ 0x2264c3,
+ 0x216582,
+ 0x22d183,
+ 0x2343c3,
+ 0x238483,
+ 0x2264c3,
+ 0x200882,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x238483,
+ 0x2264c3,
+ 0x224104,
+ 0x22d183,
+ 0x2343c3,
+ 0x307b04,
+ 0x238483,
+ 0x2264c3,
+ 0x880c8,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x238483,
+ 0x2264c3,
+ 0x22d183,
+ 0x2343c3,
+ 0x211cc3,
+ 0x220883,
+ 0x211003,
+ 0x238483,
+ 0x2264c3,
+ 0x216582,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x238483,
+ 0x2264c3,
+ 0x880c8,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x251283,
+ 0x2efc3,
+ 0x132683,
+ 0x238483,
+ 0x2264c3,
+ 0x301e0a,
+ 0x31ec09,
+ 0x33e6cb,
+ 0x33ed4a,
+ 0x34600a,
+ 0x3543cb,
+ 0x372d8a,
+ 0x37acca,
+ 0x38074a,
+ 0x3809cb,
+ 0x39bb89,
+ 0x39d94a,
+ 0x39e38b,
+ 0x3a9bcb,
+ 0x3b2c8a,
+ 0x22d183,
+ 0x2343c3,
+ 0x211cc3,
+ 0x211003,
+ 0x238483,
+ 0x2264c3,
+ 0x37549,
+ 0x880c8,
+ 0x22d183,
+ 0x260584,
+ 0x214a02,
+ 0x212444,
+ 0x226bc5,
+ 0x204803,
+ 0x224104,
+ 0x22d183,
+ 0x2374c4,
+ 0x2343c3,
+ 0x247344,
+ 0x22d684,
+ 0x201604,
+ 0x2348c3,
+ 0x238483,
+ 0x2264c3,
+ 0x28fb85,
+ 0x232dc3,
+ 0x21bd03,
+ 0x25b743,
+ 0x252dc4,
+ 0x250bc4,
+ 0x26dfc5,
+ 0x880c8,
+ 0x2f88c4,
+ 0x208606,
+ 0x283c04,
+ 0x216582,
+ 0x360307,
+ 0x249c07,
+ 0x2455c4,
+ 0x257a05,
+ 0x2d37c5,
+ 0x2a9c05,
+ 0x201604,
+ 0x318348,
+ 0x36ed86,
+ 0x2dbb08,
+ 0x236f45,
+ 0x2cf145,
+ 0x240584,
+ 0x2264c3,
+ 0x2e26c4,
+ 0x353586,
+ 0x242083,
+ 0x252dc4,
+ 0x262c45,
+ 0x2cfbc4,
+ 0x365b84,
+ 0x203e42,
+ 0x245206,
+ 0x392446,
+ 0x2f56c5,
+ 0x200882,
+ 0x323ac3,
+ 0x1f216582,
+ 0x2358c4,
+ 0x201f82,
+ 0x211003,
+ 0x209f82,
+ 0x238483,
+ 0x201502,
+ 0x217643,
+ 0x223ec3,
+ 0x880c8,
+ 0x880c8,
+ 0x21eb03,
+ 0x200882,
+ 0x1fe16582,
+ 0x21eb03,
+ 0x266383,
+ 0x36b683,
+ 0x31f984,
+ 0x238483,
+ 0x2264c3,
+ 0x880c8,
+ 0x200882,
+ 0x20616582,
+ 0x22d183,
+ 0x238483,
+ 0x2264c3,
+ 0x4b42,
+ 0x2019c2,
+ 0x221e42,
+ 0x332683,
+ 0x2db083,
+ 0x200882,
+ 0x880c8,
+ 0x16e747,
+ 0x216582,
+ 0x2343c3,
+ 0x247344,
+ 0x208f43,
+ 0x21eb03,
+ 0x220883,
+ 0x211003,
+ 0x238483,
+ 0x21ab43,
+ 0x2264c3,
+ 0x220683,
+ 0x1244d3,
+ 0x12f214,
+ 0x16e747,
+ 0x15686,
+ 0x1e1c6,
+ 0x52fc7,
+ 0x9f049,
+ 0x2654a,
+ 0x85b0d,
+ 0x119a4c,
+ 0x29e8a,
+ 0x51f05,
+ 0x18bec8,
+ 0x161186,
+ 0x155646,
+ 0x200d82,
+ 0xde40c,
+ 0x1aa9c7,
+ 0x24d11,
+ 0x22d183,
+ 0xd0585,
+ 0x1b4284,
+ 0x18346,
+ 0x19f046,
+ 0x8a24a,
+ 0xacec3,
+ 0x9f005,
+ 0xce83,
+ 0xc120c,
+ 0xe5408,
+ 0x1ad408,
+ 0xa0288,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x211003,
+ 0x238483,
+ 0x2264c3,
+ 0x200882,
+ 0x216582,
+ 0x21eb03,
+ 0x2082c2,
+ 0x238483,
+ 0x2264c3,
+ 0x217643,
+ 0x35e48f,
+ 0x35e84e,
+ 0x880c8,
+ 0x22d183,
+ 0x429c7,
+ 0x2343c3,
+ 0x21eb03,
+ 0x202243,
+ 0x238483,
+ 0x2264c3,
+ 0x220003,
+ 0x36b047,
+ 0x204642,
+ 0x2a9849,
+ 0x201002,
+ 0x32a10b,
+ 0x28c14a,
+ 0x2a4209,
+ 0x201902,
+ 0x250e06,
+ 0x248f95,
+ 0x32a255,
+ 0x24de93,
+ 0x32a7d3,
+ 0x2056c2,
+ 0x214605,
+ 0x27ff4c,
+ 0x219e0b,
+ 0x269005,
+ 0x201482,
+ 0x2040c2,
+ 0x377506,
+ 0x204802,
+ 0x24eb06,
+ 0x332ecd,
+ 0x36288c,
+ 0x30a784,
+ 0x2009c2,
+ 0x219f02,
+ 0x22c108,
+ 0x202d42,
+ 0x29d5c6,
+ 0x3345c4,
+ 0x249155,
+ 0x24e013,
+ 0x20a583,
+ 0x34868a,
+ 0x30e547,
+ 0x2e6089,
+ 0x20f507,
+ 0x24f882,
+ 0x200002,
+ 0x200006,
+ 0x202f42,
+ 0x880c8,
+ 0x211302,
+ 0x211d42,
+ 0x273cc7,
+ 0x3a8ac7,
+ 0x21ed05,
+ 0x215802,
+ 0x220647,
+ 0x220808,
+ 0x279a82,
+ 0x293f02,
+ 0x22f802,
+ 0x202ec2,
+ 0x239c48,
+ 0x21abc3,
+ 0x267848,
+ 0x2cf4cd,
+ 0x215743,
+ 0x369908,
+ 0x234a4f,
+ 0x234e0e,
+ 0x223f8a,
+ 0x36a611,
+ 0x36aa90,
+ 0x2b348d,
+ 0x2b37cc,
+ 0x3b2447,
+ 0x348807,
+ 0x355409,
+ 0x23c302,
+ 0x2004c2,
+ 0x254c8c,
+ 0x254f8b,
+ 0x2008c2,
+ 0x2dca86,
+ 0x206c02,
+ 0x2131c2,
+ 0x21dec2,
+ 0x216582,
+ 0x392904,
+ 0x23b147,
+ 0x200bc2,
+ 0x23f1c7,
+ 0x240447,
+ 0x214ec2,
+ 0x230542,
+ 0x242885,
+ 0x200682,
+ 0x26380e,
+ 0x27620d,
+ 0x2343c3,
+ 0x28268e,
+ 0x356b8d,
+ 0x2de803,
+ 0x2058c2,
+ 0x27cac4,
+ 0x2446c2,
+ 0x20ddc2,
+ 0x346905,
+ 0x34f587,
+ 0x372642,
+ 0x206ac2,
+ 0x246cc7,
+ 0x24c608,
+ 0x23aa82,
+ 0x2b5506,
+ 0x254b0c,
+ 0x254e4b,
+ 0x221842,
+ 0x25bccf,
+ 0x25c090,
+ 0x25c48f,
+ 0x25c855,
+ 0x25cd94,
+ 0x25d28e,
+ 0x25d60e,
+ 0x25d98f,
+ 0x25dd4e,
+ 0x25e0d4,
+ 0x25e5d3,
+ 0x25ea8d,
+ 0x271749,
+ 0x286d43,
+ 0x2007c2,
+ 0x20a805,
+ 0x208f46,
+ 0x201f82,
+ 0x26bdc7,
+ 0x21eb03,
+ 0x20b2c2,
+ 0x2c7448,
+ 0x36a851,
+ 0x36ac90,
+ 0x200942,
+ 0x22a647,
+ 0x2074c2,
+ 0x3328c7,
+ 0x209682,
+ 0x305dc9,
+ 0x3774c7,
+ 0x3615c8,
+ 0x228246,
+ 0x2daf83,
+ 0x34ad45,
+ 0x234642,
+ 0x200402,
+ 0x200405,
+ 0x399485,
+ 0x202102,
+ 0x24a503,
+ 0x2cfc47,
+ 0x208a07,
+ 0x203f42,
+ 0x2fec04,
+ 0x214803,
+ 0x2be489,
+ 0x2db488,
+ 0x20b402,
+ 0x2061c2,
+ 0x22f2c7,
+ 0x24bcc5,
+ 0x2a5f88,
+ 0x3b0e87,
+ 0x2047c3,
+ 0x27df86,
+ 0x2b330d,
+ 0x2b368c,
+ 0x276a06,
+ 0x203142,
+ 0x29a1c2,
+ 0x206742,
+ 0x2348cf,
+ 0x234cce,
+ 0x2d3847,
+ 0x200342,
+ 0x39e205,
+ 0x39e206,
+ 0x250042,
+ 0x203042,
+ 0x217c86,
+ 0x2a9a83,
+ 0x332806,
+ 0x2bfb05,
+ 0x2bfb0d,
+ 0x2c00d5,
+ 0x2c0c0c,
+ 0x2c150d,
+ 0x2c18d2,
+ 0x20e842,
+ 0x200e02,
+ 0x200ac2,
+ 0x2d6646,
+ 0x2ac506,
+ 0x2025c2,
+ 0x208fc6,
+ 0x203382,
+ 0x2249c5,
+ 0x204c02,
+ 0x263949,
+ 0x34700c,
+ 0x34734b,
+ 0x201502,
+ 0x24ca48,
+ 0x2042c2,
+ 0x207a82,
+ 0x219bc6,
+ 0x36c005,
+ 0x3a1687,
+ 0x24a385,
+ 0x28df05,
+ 0x242a42,
+ 0x202042,
+ 0x206d42,
+ 0x26e847,
+ 0x2d094d,
+ 0x2d0ccc,
+ 0x2229c7,
+ 0x2b5482,
+ 0x226282,
+ 0x36f088,
+ 0x22ce88,
+ 0x2d5b48,
+ 0x2dfd44,
+ 0x2ef207,
+ 0x2dbf83,
+ 0x280b82,
+ 0x2014c2,
+ 0x2e0489,
+ 0x3a3247,
+ 0x207442,
+ 0x26d485,
+ 0x241542,
+ 0x22ff42,
+ 0x297fc3,
+ 0x297fc6,
+ 0x2e6a82,
+ 0x2e8642,
+ 0x200c02,
+ 0x30f006,
+ 0x29dc87,
+ 0x200b82,
+ 0x208782,
+ 0x26768f,
+ 0x2824cd,
+ 0x284d8e,
+ 0x356a0c,
+ 0x20d342,
+ 0x207482,
+ 0x228085,
+ 0x3b3086,
+ 0x212182,
+ 0x208b02,
+ 0x204b42,
+ 0x282844,
+ 0x2cf344,
+ 0x338a86,
+ 0x201bc2,
+ 0x275247,
+ 0x214343,
+ 0x21cb88,
+ 0x224348,
+ 0x239247,
+ 0x33fbc6,
+ 0x2015c2,
+ 0x239bc3,
+ 0x35bf87,
+ 0x266c86,
+ 0x2d6585,
+ 0x2d8e88,
+ 0x208d82,
+ 0x3211c7,
+ 0x20dfc2,
+ 0x35b202,
+ 0x20ad82,
+ 0x2bf8c9,
+ 0x200242,
+ 0x200a02,
+ 0x222c43,
+ 0x321887,
+ 0x201a02,
+ 0x34718c,
+ 0x34748b,
+ 0x276a86,
+ 0x20cdc5,
+ 0x224982,
+ 0x206ec2,
+ 0x2b3006,
+ 0x229083,
+ 0x340d07,
+ 0x246002,
+ 0x200cc2,
+ 0x248e15,
+ 0x32a415,
+ 0x24dd53,
+ 0x32a953,
+ 0x264dc7,
+ 0x288288,
+ 0x288290,
+ 0x289b0f,
+ 0x28bf13,
+ 0x2a3fd2,
+ 0x2a9410,
+ 0x2e79cf,
+ 0x2f14d2,
+ 0x351551,
+ 0x2afb13,
+ 0x2bf692,
+ 0x2c8d0f,
+ 0x2cb38e,
+ 0x2cc152,
+ 0x2cd191,
+ 0x2cdd8f,
+ 0x2ced4e,
+ 0x2d4c11,
+ 0x2e0090,
+ 0x2e4452,
+ 0x2e55d1,
+ 0x2e6b06,
+ 0x2e89c7,
+ 0x2f77c7,
+ 0x201582,
+ 0x27a485,
+ 0x2f2447,
+ 0x221e42,
+ 0x203c42,
+ 0x22c605,
+ 0x221303,
+ 0x26e246,
+ 0x2d0b0d,
+ 0x2d0e4c,
+ 0x203dc2,
+ 0x27fdcb,
+ 0x219cca,
+ 0x31b28a,
+ 0x2b22c9,
+ 0x2dd20b,
+ 0x3b0fcd,
+ 0x2f2b4c,
+ 0x2144ca,
+ 0x221e8c,
+ 0x24d10b,
+ 0x268e4c,
+ 0x26c10b,
+ 0x346f83,
+ 0x287e86,
+ 0x326e82,
+ 0x2e9202,
+ 0x208943,
+ 0x205882,
+ 0x205883,
+ 0x238406,
+ 0x25ca07,
+ 0x271406,
+ 0x2ea8c8,
+ 0x22cb88,
+ 0x2f0206,
+ 0x22d742,
+ 0x2f508d,
+ 0x2f53cc,
+ 0x22d747,
+ 0x2f8787,
+ 0x2156c2,
+ 0x21bf02,
+ 0x21eb82,
+ 0x24b982,
+ 0x216582,
+ 0x238483,
+ 0x2264c3,
+ 0x22d183,
+ 0x2343c3,
+ 0x21eb03,
+ 0x211003,
+ 0x212444,
+ 0x238483,
+ 0x2264c3,
+ 0x217643,
+ 0x200882,
+ 0x200702,
+ 0x2368c545,
+ 0x23a03985,
+ 0x23f0b146,
+ 0x880c8,
+ 0x242b0185,
+ 0x216582,
+ 0x201a42,
+ 0x24755c45,
+ 0x24a786c5,
+ 0x24e79547,
+ 0x2527b109,
+ 0x2564b084,
+ 0x201f82,
+ 0x20b2c2,
+ 0x25a43785,
+ 0x25e8bb89,
+ 0x26311f08,
+ 0x266abe45,
+ 0x26b0bc07,
+ 0x26e18948,
+ 0x272d8045,
+ 0x27604606,
+ 0x27b47b09,
+ 0x27f25348,
+ 0x282b8888,
+ 0x2869310a,
+ 0x28a48444,
+ 0x28ec9405,
+ 0x292b5dc8,
+ 0x29616c85,
+ 0x21ac42,
+ 0x29a00343,
+ 0x29ea2f86,
+ 0x2a233a88,
+ 0x2a69e2c6,
+ 0x2aa9ddc8,
+ 0x2ae09c86,
+ 0x2b2f6284,
+ 0x205902,
+ 0x2b73b7c7,
+ 0x2baa8444,
+ 0x2be746c7,
+ 0x2c333a07,
+ 0x201502,
+ 0x2c696ec5,
+ 0x2ca31504,
+ 0x2cf7fd07,
+ 0x2d211e47,
+ 0x2d67c906,
+ 0x2da29585,
+ 0x2de91bc7,
+ 0x2e2d1a48,
+ 0x2e60ab87,
+ 0x2eb12b09,
+ 0x2eec0f45,
+ 0x2f32bb87,
+ 0x2f68b886,
+ 0x2fa51008,
+ 0x225a4d,
+ 0x242bc9,
+ 0x2e4ccb,
+ 0x3726cb,
+ 0x26f30b,
+ 0x2a564b,
+ 0x2ffd0b,
+ 0x2fffcb,
+ 0x300849,
+ 0x30208b,
+ 0x30234b,
+ 0x30290b,
+ 0x30340a,
+ 0x30394a,
+ 0x303f4c,
+ 0x308e0b,
+ 0x30964a,
+ 0x31c18a,
+ 0x32734e,
+ 0x3282ce,
+ 0x32864a,
+ 0x32b14a,
+ 0x32cb4b,
+ 0x32ce0b,
+ 0x32dd0b,
+ 0x34c50b,
+ 0x34cb0a,
+ 0x34d7cb,
+ 0x34da8a,
+ 0x34dd0a,
+ 0x34df8a,
+ 0x373f4b,
+ 0x37c18b,
+ 0x37dace,
+ 0x37de4b,
+ 0x3849cb,
+ 0x38598b,
+ 0x3893ca,
+ 0x389649,
+ 0x38988a,
+ 0x38af0a,
+ 0x39c60b,
+ 0x39e64b,
+ 0x39f24a,
+ 0x3a02cb,
+ 0x3a4f0b,
+ 0x3b26cb,
+ 0x2fe7ab48,
+ 0x30285289,
+ 0x30626809,
+ 0x30acfe48,
+ 0x338805,
+ 0x203443,
+ 0x204204,
+ 0x327145,
+ 0x24adc6,
+ 0x259145,
+ 0x284404,
+ 0x26bcc8,
+ 0x3739c5,
+ 0x28d904,
+ 0x3b3f87,
+ 0x2996ca,
+ 0x3605ca,
+ 0x336947,
+ 0x203347,
+ 0x2f10c7,
+ 0x362607,
+ 0x2b9d05,
+ 0x306d46,
+ 0x2fb0c7,
+ 0x3a2784,
+ 0x376b06,
+ 0x376a06,
+ 0x3a3745,
+ 0x280584,
+ 0x2d3d46,
+ 0x298387,
+ 0x225d46,
+ 0x2c7ec7,
+ 0x28d6c3,
+ 0x268446,
+ 0x2328c5,
+ 0x279647,
+ 0x266fca,
+ 0x263204,
+ 0x2180c8,
+ 0x2fb649,
+ 0x2ce487,
+ 0x3aed06,
+ 0x29f988,
+ 0x306409,
+ 0x2e6244,
+ 0x35d804,
+ 0x2f9685,
+ 0x2fadc8,
+ 0x2bd1c7,
+ 0x2aa009,
+ 0x327c48,
+ 0x2fc706,
+ 0x379bc6,
+ 0x2943c8,
+ 0x375fc6,
+ 0x203985,
+ 0x27c9c6,
+ 0x274bc8,
+ 0x2347c6,
+ 0x25708b,
+ 0x233406,
+ 0x295d4d,
+ 0x358a45,
+ 0x2a8306,
+ 0x218a05,
+ 0x297c89,
+ 0x2f1d07,
+ 0x382048,
+ 0x2db2c6,
+ 0x294ac9,
+ 0x3a6246,
+ 0x266f45,
+ 0x29c1c6,
+ 0x2a8e86,
+ 0x2c2909,
+ 0x306206,
+ 0x279247,
+ 0x33cf05,
+ 0x205703,
+ 0x257205,
+ 0x296007,
+ 0x323446,
+ 0x358949,
+ 0x30b146,
+ 0x27cc06,
+ 0x365389,
+ 0x27c3c9,
+ 0x29ca07,
+ 0x369fc8,
+ 0x39ee89,
+ 0x27a108,
+ 0x31f686,
+ 0x2cc9c5,
+ 0x30a44a,
+ 0x27cc86,
+ 0x330bc6,
+ 0x2a3145,
+ 0x24d588,
+ 0x206847,
+ 0x2318ca,
+ 0x247786,
+ 0x243005,
+ 0x2a0e06,
+ 0x265b47,
+ 0x3aebc7,
+ 0x2bacc5,
+ 0x267105,
+ 0x2acf46,
+ 0x383446,
+ 0x2ad886,
+ 0x328cc4,
+ 0x27b489,
+ 0x286146,
+ 0x2a5a0a,
+ 0x214048,
+ 0x32b888,
+ 0x3605ca,
+ 0x202145,
+ 0x2982c5,
+ 0x323c48,
+ 0x2c9188,
+ 0x320d47,
+ 0x265146,
+ 0x315308,
+ 0x202b87,
+ 0x279788,
+ 0x35f146,
+ 0x27dd08,
+ 0x2b3b86,
+ 0x2370c7,
+ 0x295506,
+ 0x2d3d46,
+ 0x23628a,
+ 0x392986,
+ 0x2cc9c9,
+ 0x2b0486,
+ 0x2d238a,
+ 0x2f6289,
+ 0x2f0306,
+ 0x37c504,
+ 0x20a8cd,
+ 0x285507,
+ 0x317906,
+ 0x2b8745,
+ 0x3a62c5,
+ 0x305546,
+ 0x26d9c9,
+ 0x3ad5c7,
+ 0x275cc6,
+ 0x2cd946,
+ 0x284489,
+ 0x212a44,
+ 0x228dc4,
+ 0x204308,
+ 0x2387c6,
+ 0x26d548,
+ 0x2d6b88,
+ 0x203ac7,
+ 0x200849,
+ 0x2ada87,
+ 0x2b004a,
+ 0x22decf,
+ 0x2377ca,
+ 0x227e85,
+ 0x274e05,
+ 0x216005,
+ 0x334507,
+ 0x277283,
+ 0x36a1c8,
+ 0x334d86,
+ 0x334e89,
+ 0x2c6a06,
+ 0x2c2747,
+ 0x294889,
+ 0x381f48,
+ 0x2a3207,
+ 0x2fee83,
+ 0x338885,
+ 0x3b2005,
+ 0x328b0b,
+ 0x216d44,
+ 0x2c5044,
+ 0x273486,
+ 0x2ff447,
+ 0x39794a,
+ 0x245807,
+ 0x3b0407,
+ 0x2786c5,
+ 0x205285,
+ 0x2196c9,
+ 0x2d3d46,
+ 0x24568d,
+ 0x358045,
+ 0x2a2d43,
+ 0x205d03,
+ 0x349205,
+ 0x350005,
+ 0x29f988,
+ 0x276707,
+ 0x228b46,
+ 0x29a646,
+ 0x22d905,
+ 0x234687,
+ 0x2035c7,
+ 0x36ec47,
+ 0x2c948a,
+ 0x268508,
+ 0x328cc4,
+ 0x2ade47,
+ 0x277cc7,
+ 0x32d086,
+ 0x264607,
+ 0x2b2a08,
+ 0x226708,
+ 0x26b786,
+ 0x367f08,
+ 0x2c32c4,
+ 0x2fb0c6,
+ 0x3a9146,
+ 0x2c0a86,
+ 0x349c06,
+ 0x29abc4,
+ 0x3626c6,
+ 0x2b76c6,
+ 0x293606,
+ 0x2293c6,
+ 0x205bc6,
+ 0x2b2846,
+ 0x228a48,
+ 0x39de08,
+ 0x2c9cc8,
+ 0x259348,
+ 0x323bc6,
+ 0x210785,
+ 0x275386,
+ 0x2abec5,
+ 0x388807,
+ 0x28ae45,
+ 0x213d43,
+ 0x364605,
+ 0x22fd84,
+ 0x205d05,
+ 0x210143,
+ 0x39a7c7,
+ 0x31c448,
+ 0x2c7f86,
+ 0x2c514d,
+ 0x274dc6,
+ 0x292b85,
+ 0x2afd43,
+ 0x2b5789,
+ 0x212bc6,
+ 0x231246,
+ 0x29c2c4,
+ 0x237747,
+ 0x235b06,
+ 0x243245,
+ 0x216ec3,
+ 0x378a44,
+ 0x277e86,
+ 0x2b15c4,
+ 0x30d748,
+ 0x324a89,
+ 0x2f2209,
+ 0x29c0ca,
+ 0x23f88d,
+ 0x29da47,
+ 0x330a46,
+ 0x20ec44,
+ 0x27b109,
+ 0x283588,
+ 0x285106,
+ 0x263bc6,
+ 0x264607,
+ 0x2c3c06,
+ 0x21b606,
+ 0x38c346,
+ 0x333a8a,
+ 0x218948,
+ 0x22bc45,
+ 0x27d649,
+ 0x279c8a,
+ 0x2c54c8,
+ 0x2979c8,
+ 0x292108,
+ 0x2a864c,
+ 0x2dc7c5,
+ 0x29a8c8,
+ 0x39e106,
+ 0x2d1d06,
+ 0x37af07,
+ 0x245705,
+ 0x27cb45,
+ 0x2f20c9,
+ 0x212747,
+ 0x2b2ec5,
+ 0x21e9c7,
+ 0x205d03,
+ 0x2bd705,
+ 0x366548,
+ 0x2d1687,
+ 0x297889,
+ 0x2d7985,
+ 0x2f4504,
+ 0x2a1788,
+ 0x2cf787,
+ 0x2a33c8,
+ 0x2740c8,
+ 0x32c005,
+ 0x334c86,
+ 0x257706,
+ 0x2e7649,
+ 0x315b87,
+ 0x2ac986,
+ 0x30e947,
+ 0x217d43,
+ 0x24b084,
+ 0x298c45,
+ 0x2ae0c4,
+ 0x236844,
+ 0x27adc7,
+ 0x3affc7,
+ 0x239a04,
+ 0x2976d0,
+ 0x3056c7,
+ 0x205285,
+ 0x22ae8c,
+ 0x2018c4,
+ 0x2bee08,
+ 0x236fc9,
+ 0x2ffb86,
+ 0x2a03c8,
+ 0x25a7c4,
+ 0x25a7c8,
+ 0x231ec6,
+ 0x229248,
+ 0x298946,
+ 0x2c828b,
+ 0x205705,
+ 0x2c3248,
+ 0x21a3c4,
+ 0x27c04a,
+ 0x297889,
+ 0x2e0d06,
+ 0x2160c8,
+ 0x258645,
+ 0x301944,
+ 0x2bed06,
+ 0x36eb08,
+ 0x27ab48,
+ 0x345d06,
+ 0x31d6c4,
+ 0x30a3c6,
+ 0x2adb07,
+ 0x2745c7,
+ 0x26460f,
+ 0x2074c7,
+ 0x2f03c7,
+ 0x2d1bc5,
+ 0x2ed845,
+ 0x29c6c9,
+ 0x28ae86,
+ 0x278fc5,
+ 0x27c6c7,
+ 0x37b188,
+ 0x293705,
+ 0x295506,
+ 0x213e88,
+ 0x29e2ca,
+ 0x282988,
+ 0x287947,
+ 0x22e306,
+ 0x27d606,
+ 0x21f283,
+ 0x2042c3,
+ 0x279e49,
+ 0x39ed09,
+ 0x2bec06,
+ 0x2d7985,
+ 0x2a84c8,
+ 0x2160c8,
+ 0x387808,
+ 0x38c3cb,
+ 0x2c5387,
+ 0x2fd189,
+ 0x264888,
+ 0x33c7c4,
+ 0x2c2a08,
+ 0x2895c9,
+ 0x2acc85,
+ 0x334407,
+ 0x24b105,
+ 0x27aa48,
+ 0x28c3cb,
+ 0x291910,
+ 0x2a8105,
+ 0x21a30c,
+ 0x228d05,
+ 0x2032c3,
+ 0x2a2c06,
+ 0x2b6e04,
+ 0x231606,
+ 0x298387,
+ 0x213f04,
+ 0x2415c8,
+ 0x36a08d,
+ 0x2d9685,
+ 0x23fd84,
+ 0x219904,
+ 0x27d0c9,
+ 0x297408,
+ 0x30afc7,
+ 0x231f48,
+ 0x27b548,
+ 0x275fc5,
+ 0x331547,
+ 0x275f47,
+ 0x20af07,
+ 0x267109,
+ 0x235989,
+ 0x23f346,
+ 0x2b39c6,
+ 0x264846,
+ 0x25b8c5,
+ 0x3af344,
+ 0x204506,
+ 0x204a46,
+ 0x276008,
+ 0x26580b,
+ 0x2630c7,
+ 0x20ec44,
+ 0x317d86,
+ 0x203107,
+ 0x348b45,
+ 0x318f05,
+ 0x201e84,
+ 0x235906,
+ 0x204588,
+ 0x27b109,
+ 0x257c86,
+ 0x282f08,
+ 0x243306,
+ 0x33ce48,
+ 0x2d8a8c,
+ 0x275e86,
+ 0x29284d,
+ 0x292ccb,
+ 0x279305,
+ 0x203707,
+ 0x306306,
+ 0x3aea88,
+ 0x23f3c9,
+ 0x2e7288,
+ 0x205285,
+ 0x2ecc07,
+ 0x27a208,
+ 0x384789,
+ 0x2a05c6,
+ 0x33bfca,
+ 0x3ae808,
+ 0x2e70cb,
+ 0x2c608c,
+ 0x25a8c8,
+ 0x277506,
+ 0x334708,
+ 0x29df47,
+ 0x2cfa09,
+ 0x28ba8d,
+ 0x2961c6,
+ 0x3017c8,
+ 0x39dcc9,
+ 0x2b6188,
+ 0x27de08,
+ 0x2b7f8c,
+ 0x2b9347,
+ 0x2b9f07,
+ 0x266f45,
+ 0x3a4d47,
+ 0x37b048,
+ 0x2bed86,
+ 0x257b0c,
+ 0x2e4988,
+ 0x2c44c8,
+ 0x24b5c6,
+ 0x3b1d87,
+ 0x23f544,
+ 0x259348,
+ 0x356e4c,
+ 0x3a1a0c,
+ 0x227f05,
+ 0x393d47,
+ 0x31d646,
+ 0x3b1d06,
+ 0x297e48,
+ 0x38c284,
+ 0x225d4b,
+ 0x22844b,
+ 0x22e306,
+ 0x369f07,
+ 0x307d45,
+ 0x26ca85,
+ 0x225e86,
+ 0x258605,
+ 0x216d05,
+ 0x3accc7,
+ 0x273a89,
+ 0x233504,
+ 0x2722c5,
+ 0x2d7645,
+ 0x254448,
+ 0x22b4c5,
+ 0x2a7809,
+ 0x2af2c7,
+ 0x2af2cb,
+ 0x2d1046,
+ 0x228789,
+ 0x2804c8,
+ 0x271c05,
+ 0x20b008,
+ 0x2359c8,
+ 0x207ec7,
+ 0x27d4c7,
+ 0x27ae49,
+ 0x229187,
+ 0x32d3c9,
+ 0x2aaf4c,
+ 0x312a08,
+ 0x2b9b49,
+ 0x2be7c7,
+ 0x27b609,
+ 0x3b0107,
+ 0x2c6188,
+ 0x3afac5,
+ 0x2fb046,
+ 0x2b8788,
+ 0x2f8b88,
+ 0x279b49,
+ 0x216d47,
+ 0x26cb45,
+ 0x20e3c9,
+ 0x2c4086,
+ 0x28b884,
+ 0x2e6f46,
+ 0x233908,
+ 0x2426c7,
+ 0x265a08,
+ 0x367fc9,
+ 0x261a47,
+ 0x299886,
+ 0x2037c4,
+ 0x364689,
+ 0x3313c8,
+ 0x24b487,
+ 0x306e46,
+ 0x3b20c6,
+ 0x330b44,
+ 0x27f886,
+ 0x205c83,
+ 0x308149,
+ 0x2056c6,
+ 0x2a61c5,
+ 0x29a646,
+ 0x2a3505,
+ 0x27a688,
+ 0x25a607,
+ 0x362446,
+ 0x355c86,
+ 0x32b888,
+ 0x29c847,
+ 0x296205,
+ 0x29ab48,
+ 0x39ea48,
+ 0x3ae808,
+ 0x228bc5,
+ 0x2fb0c6,
+ 0x2f1fc9,
+ 0x257584,
+ 0x3760cb,
+ 0x21b30b,
+ 0x22bb49,
+ 0x205d03,
+ 0x256385,
+ 0x205986,
+ 0x229908,
+ 0x22de44,
+ 0x2c7f86,
+ 0x2c95c9,
+ 0x2c5b05,
+ 0x3acc06,
+ 0x2cf786,
+ 0x2160c4,
+ 0x2a1b4a,
+ 0x2a6108,
+ 0x2f8b86,
+ 0x368a05,
+ 0x204887,
+ 0x301547,
+ 0x334c84,
+ 0x21b547,
+ 0x2b0044,
+ 0x2c0a06,
+ 0x202e03,
+ 0x267105,
+ 0x373445,
+ 0x207708,
+ 0x2ae005,
+ 0x275bc9,
+ 0x259187,
+ 0x25918b,
+ 0x2a2d8c,
+ 0x2a3a0a,
+ 0x30bc07,
+ 0x200a83,
+ 0x2d3948,
+ 0x228d85,
+ 0x293785,
+ 0x338944,
+ 0x2c6086,
+ 0x236fc6,
+ 0x27f8c7,
+ 0x3656cb,
+ 0x29abc4,
+ 0x3821c4,
+ 0x26b904,
+ 0x2c25c6,
+ 0x213f04,
+ 0x2faec8,
+ 0x338745,
+ 0x23fec5,
+ 0x387747,
+ 0x203809,
+ 0x350005,
+ 0x375a4a,
+ 0x37b2c9,
+ 0x290f8a,
+ 0x333bc9,
+ 0x353144,
+ 0x2cda05,
+ 0x2c3d08,
+ 0x37fdcb,
+ 0x2f9685,
+ 0x38d4c6,
+ 0x2159c4,
+ 0x276106,
+ 0x2618c9,
+ 0x317e47,
+ 0x30b308,
+ 0x23fc06,
+ 0x2ada87,
+ 0x27ab48,
+ 0x38f586,
+ 0x280204,
+ 0x35eb87,
+ 0x34e905,
+ 0x360c07,
+ 0x204604,
+ 0x306286,
+ 0x218bc8,
+ 0x292e88,
+ 0x3a4ac7,
+ 0x217d88,
+ 0x2b3c45,
+ 0x205b44,
+ 0x3604c8,
+ 0x217e84,
+ 0x207ec5,
+ 0x2ed984,
+ 0x202c87,
+ 0x286207,
+ 0x27b748,
+ 0x2a3546,
+ 0x2adf85,
+ 0x2759c8,
+ 0x282b88,
+ 0x29c009,
+ 0x21b606,
+ 0x231948,
+ 0x27beca,
+ 0x348bc8,
+ 0x2d8045,
+ 0x275586,
+ 0x26d888,
+ 0x2eccca,
+ 0x341107,
+ 0x283985,
+ 0x28ef48,
+ 0x2b1184,
+ 0x24d606,
+ 0x2ba688,
+ 0x205bc6,
+ 0x380dc8,
+ 0x2573c7,
+ 0x3b3e86,
+ 0x37c504,
+ 0x29ce07,
+ 0x2fac04,
+ 0x261887,
+ 0x23108d,
+ 0x22bbc5,
+ 0x2d148b,
+ 0x298a46,
+ 0x24cb48,
+ 0x241584,
+ 0x272086,
+ 0x277e86,
+ 0x334a47,
+ 0x29250d,
+ 0x25fd07,
+ 0x300248,
+ 0x29fb05,
+ 0x284008,
+ 0x2bd146,
+ 0x2b3cc8,
+ 0x20e886,
+ 0x367707,
+ 0x368189,
+ 0x33f9c7,
+ 0x2853c8,
+ 0x26f705,
+ 0x21ed88,
+ 0x3b1c45,
+ 0x23b2c5,
+ 0x333e45,
+ 0x226743,
+ 0x27ca44,
+ 0x27d645,
+ 0x347b09,
+ 0x31b646,
+ 0x2b2b08,
+ 0x2ecec5,
+ 0x312447,
+ 0x249dca,
+ 0x3acb49,
+ 0x2a8d8a,
+ 0x2c9d48,
+ 0x21e80c,
+ 0x27c74d,
+ 0x2f86c3,
+ 0x380cc8,
+ 0x378a05,
+ 0x29e086,
+ 0x381dc6,
+ 0x2e3985,
+ 0x30ea49,
+ 0x310045,
+ 0x2759c8,
+ 0x279146,
+ 0x33f4c6,
+ 0x2a1649,
+ 0x38ed87,
+ 0x28c686,
+ 0x249d48,
+ 0x2c0988,
+ 0x2d0047,
+ 0x2293ce,
+ 0x2bd385,
+ 0x384685,
+ 0x205ac8,
+ 0x322d07,
+ 0x214782,
+ 0x2b7b04,
+ 0x23150a,
+ 0x24b548,
+ 0x203206,
+ 0x2949c8,
+ 0x257706,
+ 0x335988,
+ 0x2ac988,
+ 0x23b284,
+ 0x328945,
+ 0x683c04,
+ 0x683c04,
+ 0x683c04,
+ 0x203983,
+ 0x3b1f46,
+ 0x275e86,
+ 0x29924c,
+ 0x205b03,
+ 0x279c86,
+ 0x213f84,
+ 0x212b48,
+ 0x2c9405,
+ 0x231606,
+ 0x2b5ec8,
+ 0x2cb0c6,
+ 0x3623c6,
+ 0x29f788,
+ 0x298cc7,
+ 0x228f49,
+ 0x2e96ca,
+ 0x20abc4,
+ 0x28ae45,
+ 0x2a9fc5,
+ 0x2128c6,
+ 0x29da86,
+ 0x299c86,
+ 0x2ec386,
+ 0x229084,
+ 0x22908b,
+ 0x233904,
+ 0x204905,
+ 0x2ab5c5,
+ 0x203b86,
+ 0x359288,
+ 0x27c607,
+ 0x30b0c4,
+ 0x259cc3,
+ 0x2b0c85,
+ 0x2e6e07,
+ 0x2a4449,
+ 0x27c50b,
+ 0x27f8c7,
+ 0x207607,
+ 0x2b5dc8,
+ 0x312587,
+ 0x2a4686,
+ 0x242e88,
+ 0x299e8b,
+ 0x327086,
+ 0x213a89,
+ 0x29a005,
+ 0x2fee83,
+ 0x3acc06,
+ 0x2572c8,
+ 0x20e943,
+ 0x2e6f03,
+ 0x27ab46,
+ 0x257706,
+ 0x38ac8a,
+ 0x277545,
+ 0x277ccb,
+ 0x29a58b,
+ 0x240a03,
+ 0x20f943,
+ 0x2affc4,
+ 0x367b47,
+ 0x257344,
+ 0x2039c4,
+ 0x39df84,
+ 0x348ec8,
+ 0x368948,
+ 0x30e389,
+ 0x2c0fc8,
+ 0x3065c7,
+ 0x2293c6,
+ 0x2b274f,
+ 0x2bd4c6,
+ 0x2c9384,
+ 0x36878a,
+ 0x2e6d07,
+ 0x3a37c6,
+ 0x28b8c9,
+ 0x30e305,
+ 0x207845,
+ 0x30e446,
+ 0x21eec3,
+ 0x2b11c9,
+ 0x218ac6,
+ 0x367d89,
+ 0x397946,
+ 0x267105,
+ 0x228305,
+ 0x2074c3,
+ 0x367c88,
+ 0x2df587,
+ 0x334d84,
+ 0x2129c8,
+ 0x2d3ac4,
+ 0x2d4646,
+ 0x2a2c06,
+ 0x23e7c6,
+ 0x2c3109,
+ 0x293705,
+ 0x2d3d46,
+ 0x264ac9,
+ 0x3ac846,
+ 0x2b2846,
+ 0x387c46,
+ 0x2119c5,
+ 0x2ed986,
+ 0x367704,
+ 0x3afac5,
+ 0x2b8784,
+ 0x309246,
+ 0x358004,
+ 0x202c83,
+ 0x283645,
+ 0x2356c8,
+ 0x21e007,
+ 0x2b4549,
+ 0x283888,
+ 0x294191,
+ 0x2cf80a,
+ 0x22e247,
+ 0x2ee8c6,
+ 0x213f84,
+ 0x2b8888,
+ 0x239748,
+ 0x29434a,
+ 0x2a75cd,
+ 0x29c1c6,
+ 0x29f886,
+ 0x29cec6,
+ 0x2bab47,
+ 0x300305,
+ 0x250ec7,
+ 0x212a85,
+ 0x2af404,
+ 0x2a7006,
+ 0x27f707,
+ 0x2b0ecd,
+ 0x26d7c7,
+ 0x26bbc8,
+ 0x275cc9,
+ 0x275486,
+ 0x2a0545,
+ 0x210184,
+ 0x233a06,
+ 0x334b86,
+ 0x24b6c6,
+ 0x297088,
+ 0x211883,
+ 0x203b43,
+ 0x323585,
+ 0x3112c6,
+ 0x2ac945,
+ 0x23fe08,
+ 0x29854a,
+ 0x2f5cc4,
+ 0x212b48,
+ 0x292108,
+ 0x2039c7,
+ 0x2ecf89,
+ 0x2b5ac8,
+ 0x27b187,
+ 0x264fc6,
+ 0x205bca,
+ 0x233a88,
+ 0x2c5ec9,
+ 0x2974c8,
+ 0x21adc9,
+ 0x2e7387,
+ 0x2d9005,
+ 0x226986,
+ 0x2bec08,
+ 0x24ccc8,
+ 0x30bec8,
+ 0x22e408,
+ 0x204905,
+ 0x200884,
+ 0x2df288,
+ 0x20bdc4,
+ 0x3339c4,
+ 0x267105,
+ 0x28d947,
+ 0x2035c9,
+ 0x334847,
+ 0x231985,
+ 0x273686,
+ 0x346d46,
+ 0x213bc4,
+ 0x2a1986,
+ 0x2addc4,
+ 0x283f06,
+ 0x3b0586,
+ 0x2150c6,
+ 0x205285,
+ 0x23fcc7,
+ 0x200a83,
+ 0x3334c9,
+ 0x32b688,
+ 0x2129c4,
+ 0x27b00d,
+ 0x292f88,
+ 0x2f0848,
+ 0x2c5e46,
+ 0x368289,
+ 0x3acb49,
+ 0x2615c5,
+ 0x29864a,
+ 0x2863ca,
+ 0x28b24c,
+ 0x28b3c6,
+ 0x274446,
+ 0x2bd646,
+ 0x269509,
+ 0x29e2c6,
+ 0x250f06,
+ 0x310106,
+ 0x259348,
+ 0x217d86,
+ 0x2c344b,
+ 0x28dac5,
+ 0x23fec5,
+ 0x2746c5,
+ 0x202606,
+ 0x205b83,
+ 0x23e746,
+ 0x26d747,
+ 0x2b8745,
+ 0x379c85,
+ 0x3a62c5,
+ 0x2eb2c6,
+ 0x261684,
+ 0x311e06,
+ 0x28f789,
+ 0x20248c,
+ 0x2af148,
+ 0x28f8c4,
+ 0x2ed746,
+ 0x298b46,
+ 0x2572c8,
+ 0x2160c8,
+ 0x202389,
+ 0x204887,
+ 0x238509,
+ 0x24c346,
+ 0x22f904,
+ 0x20edc4,
+ 0x27a944,
+ 0x27ab48,
+ 0x20340a,
+ 0x34ff86,
+ 0x353d47,
+ 0x2c7687,
+ 0x228885,
+ 0x2a9f84,
+ 0x289586,
+ 0x300346,
+ 0x235bc3,
+ 0x32b4c7,
+ 0x273fc8,
+ 0x26170a,
+ 0x30fa88,
+ 0x29ddc8,
+ 0x358045,
+ 0x279405,
+ 0x2631c5,
+ 0x228c46,
+ 0x229d06,
+ 0x3aff05,
+ 0x308389,
+ 0x2a9d8c,
+ 0x263287,
+ 0x2943c8,
+ 0x258945,
+ 0x683c04,
+ 0x2e3d84,
+ 0x2d17c4,
+ 0x214b06,
+ 0x29b10e,
+ 0x2078c7,
+ 0x2bad45,
+ 0x25750c,
+ 0x2c0847,
+ 0x27f687,
+ 0x2806c9,
+ 0x218189,
+ 0x283985,
+ 0x32b688,
+ 0x2f1fc9,
+ 0x2f3d05,
+ 0x2b8688,
+ 0x2c2c06,
+ 0x360746,
+ 0x2f6284,
+ 0x33c1c8,
+ 0x248283,
+ 0x3630c4,
+ 0x2b0d05,
+ 0x305547,
+ 0x201ec5,
+ 0x27bd89,
+ 0x38040d,
+ 0x2a1f86,
+ 0x2e9644,
+ 0x2650c8,
+ 0x2738ca,
+ 0x21fe87,
+ 0x23a245,
+ 0x203c43,
+ 0x29a74e,
+ 0x25770c,
+ 0x2f99c7,
+ 0x29b2c7,
+ 0x204643,
+ 0x29e305,
+ 0x2d17c5,
+ 0x294d88,
+ 0x291f49,
+ 0x36e986,
+ 0x257344,
+ 0x22e186,
+ 0x32ffcb,
+ 0x3a694c,
+ 0x35dc47,
+ 0x2c90c5,
+ 0x39e948,
+ 0x2cfe05,
+ 0x368787,
+ 0x33b7c7,
+ 0x248285,
+ 0x205b83,
+ 0x371284,
+ 0x2041c5,
+ 0x383505,
+ 0x383506,
+ 0x28e848,
+ 0x27f707,
+ 0x3820c6,
+ 0x200a06,
+ 0x333d86,
+ 0x265689,
+ 0x331647,
+ 0x378186,
+ 0x3a6ac6,
+ 0x248346,
+ 0x2a8405,
+ 0x399a86,
+ 0x398f45,
+ 0x22b548,
+ 0x29154b,
+ 0x289386,
+ 0x2c76c4,
+ 0x2eca89,
+ 0x259184,
+ 0x2c2b88,
+ 0x2aab47,
+ 0x27dd04,
+ 0x2b4e88,
+ 0x2b9904,
+ 0x2a8444,
+ 0x3a26c5,
+ 0x2d96c6,
+ 0x348e07,
+ 0x23fd43,
+ 0x299945,
+ 0x316144,
+ 0x3846c6,
+ 0x261648,
+ 0x323ac5,
+ 0x28d3c9,
+ 0x20e5c5,
+ 0x2d6288,
+ 0x34a5c7,
+ 0x388948,
+ 0x2b4387,
+ 0x2f0489,
+ 0x362546,
+ 0x336186,
+ 0x310104,
+ 0x264f05,
+ 0x2f490c,
+ 0x2746c7,
+ 0x274cc7,
+ 0x2c7548,
+ 0x2a1f86,
+ 0x26d684,
+ 0x31b184,
+ 0x27acc9,
+ 0x2bd746,
+ 0x219747,
+ 0x349b84,
+ 0x31b746,
+ 0x27f285,
+ 0x2a3087,
+ 0x2c33c6,
+ 0x33be89,
+ 0x28b087,
+ 0x264607,
+ 0x2a14c6,
+ 0x23f785,
+ 0x278e48,
+ 0x218948,
+ 0x23acc6,
+ 0x323b05,
+ 0x251a46,
+ 0x206583,
+ 0x294c09,
+ 0x299a0e,
+ 0x2b3188,
+ 0x2d3bc8,
+ 0x23aacb,
+ 0x28d606,
+ 0x209c84,
+ 0x27c344,
+ 0x299b0a,
+ 0x21a207,
+ 0x378245,
+ 0x213a89,
+ 0x2b7785,
+ 0x333a07,
+ 0x2ff984,
+ 0x324c07,
+ 0x2d6a88,
+ 0x2ce546,
+ 0x34a889,
+ 0x2b5bca,
+ 0x21a186,
+ 0x292ac6,
+ 0x2ab545,
+ 0x37e405,
+ 0x3261c7,
+ 0x244208,
+ 0x27f1c8,
+ 0x23b286,
+ 0x228385,
+ 0x29d80e,
+ 0x328cc4,
+ 0x23ac45,
+ 0x273009,
+ 0x28ac88,
+ 0x287886,
+ 0x296d0c,
+ 0x298150,
+ 0x29ad4f,
+ 0x29c5c8,
+ 0x30bc07,
+ 0x205285,
+ 0x27d645,
+ 0x348c89,
+ 0x28f149,
+ 0x30a4c6,
+ 0x2f9707,
+ 0x393cc5,
+ 0x320d49,
+ 0x32d106,
+ 0x29e10d,
+ 0x27a809,
+ 0x2039c4,
+ 0x2b2f08,
+ 0x2df349,
+ 0x350146,
+ 0x273785,
+ 0x336186,
+ 0x30b1c9,
+ 0x38e148,
+ 0x210785,
+ 0x27bfc4,
+ 0x296ecb,
+ 0x350005,
+ 0x226786,
+ 0x27ca86,
+ 0x25f1c6,
+ 0x38c5cb,
+ 0x28d4c9,
+ 0x3b0245,
+ 0x388707,
+ 0x2cf786,
+ 0x231346,
+ 0x27bc48,
+ 0x2d97c9,
+ 0x26b98c,
+ 0x2e6c08,
+ 0x350246,
+ 0x345d03,
+ 0x334606,
+ 0x27d305,
+ 0x278008,
+ 0x227d86,
+ 0x2a32c8,
+ 0x245885,
+ 0x294505,
+ 0x2a1d48,
+ 0x301687,
+ 0x381d07,
+ 0x27f8c7,
+ 0x2a03c8,
+ 0x30bd48,
+ 0x262286,
+ 0x309087,
+ 0x24af47,
+ 0x27d1ca,
+ 0x24c243,
+ 0x202606,
+ 0x203545,
+ 0x231504,
+ 0x275cc9,
+ 0x2f0404,
+ 0x21e084,
+ 0x2989c4,
+ 0x29b2cb,
+ 0x2df4c7,
+ 0x29da45,
+ 0x2913c8,
+ 0x273686,
+ 0x273688,
+ 0x277486,
+ 0x287d45,
+ 0x288685,
+ 0x28a0c6,
+ 0x28b548,
+ 0x28b808,
+ 0x275e86,
+ 0x29120f,
+ 0x2946d0,
+ 0x358a45,
+ 0x200a83,
+ 0x24a985,
+ 0x2fd0c8,
+ 0x28f049,
+ 0x3ae808,
+ 0x34a708,
+ 0x330608,
+ 0x2df587,
+ 0x273349,
+ 0x2a34c8,
+ 0x2785c4,
+ 0x298848,
+ 0x254509,
+ 0x30aac7,
+ 0x296144,
+ 0x334908,
+ 0x23fa8a,
+ 0x2c2446,
+ 0x29c1c6,
+ 0x21b4c9,
+ 0x298387,
+ 0x2c2f88,
+ 0x332348,
+ 0x349a08,
+ 0x353885,
+ 0x37f385,
+ 0x23fec5,
+ 0x2d1785,
+ 0x371dc7,
+ 0x205b85,
+ 0x2b8745,
+ 0x36fd86,
+ 0x3ae747,
+ 0x37fd07,
+ 0x23fd86,
+ 0x2ca285,
+ 0x226786,
+ 0x25a685,
+ 0x2c06c8,
+ 0x31b5c4,
+ 0x3ac8c6,
+ 0x358844,
+ 0x301948,
+ 0x22534a,
+ 0x27670c,
+ 0x3658c5,
+ 0x2bac06,
+ 0x26bb46,
+ 0x323946,
+ 0x2fd2c4,
+ 0x27f545,
+ 0x2772c7,
+ 0x298409,
+ 0x2a4547,
+ 0x683c04,
+ 0x683c04,
+ 0x30af45,
+ 0x20f5c4,
+ 0x2966ca,
+ 0x273506,
+ 0x2e7044,
+ 0x3a3745,
+ 0x2eee85,
+ 0x300244,
+ 0x27c6c7,
+ 0x20e547,
+ 0x2c25c8,
+ 0x319188,
+ 0x210789,
+ 0x2994c8,
+ 0x29688b,
+ 0x2128c4,
+ 0x35d745,
+ 0x279045,
+ 0x27f849,
+ 0x2d97c9,
+ 0x2ec988,
+ 0x327ac8,
+ 0x203b84,
+ 0x298b85,
+ 0x203443,
+ 0x212885,
+ 0x2d3dc6,
+ 0x291d8c,
+ 0x2189c6,
+ 0x25a6c6,
+ 0x287b05,
+ 0x
<TRUNCATED>
[29/29] incubator-trafficcontrol git commit: This closes #167
Posted by ne...@apache.org.
This closes #167
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/e3c5b311
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/e3c5b311
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/e3c5b311
Branch: refs/heads/master
Commit: e3c5b311c8245be0a67f9f781645996bf9beabb6
Parents: 4b830b4
Author: David Neuman <da...@gmail.com>
Authored: Fri Jan 13 23:34:50 2017 +0000
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:34:50 2017 +0000
----------------------------------------------------------------------
----------------------------------------------------------------------
[11/29] incubator-trafficcontrol git commit: Have sync script use the
new config object for flags and client creation.
Posted by ne...@apache.org.
Have sync script use the new config object for flags and client creation.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/d11ddc20
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/d11ddc20
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/d11ddc20
Branch: refs/heads/master
Commit: d11ddc20f1d99dd6fac79fec366addb3ce53e669
Parents: ab22b38
Author: sbogacz <sb...@zvelo.com>
Authored: Wed Jan 11 22:36:39 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
.../create/create_ts_databases.go | 1 +
traffic_stats/influxdb_tools/sync/main.go | 37 -------
.../influxdb_tools/sync/sync_ts_databases.go | 102 +++++--------------
3 files changed, 25 insertions(+), 115 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d11ddc20/traffic_stats/influxdb_tools/create/create_ts_databases.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/create/create_ts_databases.go b/traffic_stats/influxdb_tools/create/create_ts_databases.go
index 64d1de4..72a3a01 100644
--- a/traffic_stats/influxdb_tools/create/create_ts_databases.go
+++ b/traffic_stats/influxdb_tools/create/create_ts_databases.go
@@ -39,6 +39,7 @@ func main() {
config.Flags("")
var replication int
flag.IntVar(&replication, "replication", 3, "The number of nodes in the cluster")
+ flag.Parse()
fmt.Printf("creating datbases for influxUrl: %s with a replication of %d using user %s\n", config.URL, replication, config.User)
client, err := config.NewHTTPClient()
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d11ddc20/traffic_stats/influxdb_tools/sync/main.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/sync/main.go b/traffic_stats/influxdb_tools/sync/main.go
deleted file mode 100644
index 717f655..0000000
--- a/traffic_stats/influxdb_tools/sync/main.go
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-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.
-*/
-
-package main
-
-import (
- "os"
-
- "github.com/urfave/cli"
-)
-
-func main() {
- app := cli.NewApp()
- app.Name = "sync_ts_databases"
- app.Version = "0.1.0"
- app.Usage = "sync_ts_databases provides a cli tool syncing the requisite influxdb databases"
- app.Flags = syncFlags()
- app.Action = sync
-
- app.Run(os.Args)
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d11ddc20/traffic_stats/influxdb_tools/sync/sync_ts_databases.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/sync/sync_ts_databases.go b/traffic_stats/influxdb_tools/sync/sync_ts_databases.go
index 00cd13b..122ff86 100644
--- a/traffic_stats/influxdb_tools/sync/sync_ts_databases.go
+++ b/traffic_stats/influxdb_tools/sync/sync_ts_databases.go
@@ -21,12 +21,12 @@ package main
import (
"encoding/json"
+ "flag"
"fmt"
"time"
+ "github.com/apache/incubator-trafficcontrol/traffic_stats/influxdb"
influx "github.com/influxdata/influxdb/client/v2"
- "github.com/pkg/errors"
- "github.com/urfave/cli"
)
const (
@@ -58,86 +58,32 @@ type dailyStats struct {
value float64
}
-func syncFlags() []cli.Flag {
- return []cli.Flag{
- cli.StringFlag{
- Name: "sourceUrl",
- Usage: "The source influxdb url and port",
- Value: "http://server1.kabletown.net:8086",
- },
- cli.StringFlag{
- Name: "targetUrl",
- Usage: "The target influxdb url and port",
- Value: "http://server2.kabletown.net:8086",
- },
- cli.StringFlag{
- Name: "database",
- Usage: "Sync a specific database",
- Value: "all",
- },
- cli.IntFlag{
- Name: "days",
- Usage: "Number of days in the past to sync (today - x days), 0 is all",
- Value: 0,
- },
- cli.StringFlag{
- Name: "sourceUser",
- Usage: "The source influxdb username",
- Value: "",
- },
- cli.StringFlag{
- Name: "sourcePass",
- Usage: "The source influxdb password",
- Value: "",
- },
- cli.StringFlag{
- Name: "targetUser",
- Usage: "The target influxdb username",
- Value: "",
- },
- cli.StringFlag{
- Name: "targetPass",
- Usage: "The target influxdb password",
- Value: "",
- },
- }
-}
+func main() {
+ // get influx db flags for source influxdb
+ sourceConfig := &influxdb.Config{}
+ sourceConfig.Flags("source")
-func sync(c *cli.Context) error {
-
- sourceURL := c.String("sourceUrl")
- targetURL := c.String("targetUrl")
- database := c.String("database")
- days := c.Int("days")
- sourceUser := c.String("sourceUser")
- sourcePass := c.String("sourcePass")
- targetUser := c.String("targetUser")
- targetPass := c.String("targetPass")
- fmt.Printf("syncing %s to %s for %s database(s) for the past %d day(s)\n", sourceURL, targetURL, database, days)
- sourceClient, err := influx.NewHTTPClient(influx.HTTPConfig{
- Addr: sourceURL,
- Username: sourceUser,
- Password: sourcePass,
- })
- if err != nil {
- return errors.Wrap(err, "Error creating influx sourceClient")
- }
+ // get influx db flags for source influxdb
+ targetConfig := &influxdb.Config{}
+ targetConfig.Flags("target")
- if _, _, err = sourceClient.Ping(10); err != nil {
- return errors.Wrap(err, "Error creating influx sourceClient")
- }
+ var days int
+ var database string
+ flag.IntVar(&days, "days", 0, "Number of days in the past to sync (today - x days), 0 is all")
+ flag.StringVar(&database, "database", "all", "Sync a specific database")
+ flag.Parse()
- targetClient, err := influx.NewHTTPClient(influx.HTTPConfig{
- Addr: targetURL,
- Username: targetUser,
- Password: targetPass,
- })
+ fmt.Printf("syncing %s to %s for %s database(s) for the past %d day(s)\n", sourceConfig.URL, targetConfig.URL, database, days)
+ sourceClient, err := sourceConfig.NewHTTPClient()
if err != nil {
- return errors.Wrap(err, "Error creating influx targetClient")
+ fmt.Printf("Error creating influx sourceClient: %v\n", err)
+ return
}
- if _, _, err = targetClient.Ping(10); err != nil {
- return errors.Wrap(err, "Error creating influx targetClient")
+ targetClient, err := targetConfig.NewHTTPClient()
+ if err != nil {
+ fmt.Printf("Error creating influx targetClient: %v\n", err)
+ return
}
chSize := 1
@@ -159,7 +105,7 @@ func sync(c *cli.Context) error {
case daily:
go syncDailyDb(ch, sourceClient, targetClient, days)
default:
- return errors.New("No database selected")
+ fmt.Println("No database selected")
}
for i := 1; i <= chSize; i++ {
@@ -167,7 +113,7 @@ func sync(c *cli.Context) error {
}
fmt.Println("Traffic Stats have been synced!")
- return nil
+ return
}
func syncCsDb(ch chan string, sourceClient influx.Client, targetClient influx.Client, days int) {
[07/29] incubator-trafficcontrol git commit: Recycle the queryDB
function from the create code in the sync code
Posted by ne...@apache.org.
Recycle the queryDB function from the create code in the sync code
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/29c32061
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/29c32061
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/29c32061
Branch: refs/heads/master
Commit: 29c320610255f41a56e56ed7237a6349d8307fa7
Parents: cae0dd0
Author: sbogacz <sb...@zvelo.com>
Authored: Fri Jan 6 19:13:42 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
.../influxdb_tools/sync_ts_databases.go | 26 +++++---------------
1 file changed, 6 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/29c32061/traffic_stats/influxdb_tools/sync_ts_databases.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/sync_ts_databases.go b/traffic_stats/influxdb_tools/sync_ts_databases.go
index 29f8083..ca6b845 100644
--- a/traffic_stats/influxdb_tools/sync_ts_databases.go
+++ b/traffic_stats/influxdb_tools/sync_ts_databases.go
@@ -227,20 +227,6 @@ func syncDailyDb(ch chan string, sourceClient influx.Client, targetClient influx
}
-func queryDb2(client influx.Client, cmd string, db string) (res []influx.Result, err error) {
- q := influx.Query{
- Command: cmd,
- Database: db,
- }
- if response, err := client.Query(q); err == nil {
- if response.Error() != nil {
- return res, response.Error()
- }
- res = response.Results
- }
- return res, nil
-}
-
func syncCacheStat(sourceClient influx.Client, targetClient influx.Client, statName string, days int) {
//get records from source DB
db := cache
@@ -255,7 +241,7 @@ func syncCacheStat(sourceClient influx.Client, targetClient influx.Client, statN
queryString = fmt.Sprintf("%s where time > now() - %dd", queryString, days)
}
fmt.Println("queryString ", queryString)
- res, err := queryDb2(sourceClient, queryString, db)
+ res, err := queryDB(sourceClient, queryString, db)
if err != nil {
fmt.Printf("An error occured getting %s records from sourceDb\n", statName)
return
@@ -263,7 +249,7 @@ func syncCacheStat(sourceClient influx.Client, targetClient influx.Client, statN
sourceStats := getCacheStats(res)
//get values from target DB
- targetRes, err := queryDb2(targetClient, queryString, db)
+ targetRes, err := queryDB(targetClient, queryString, db)
if err != nil {
errorMessage = fmt.Sprintf("An error occured getting %s record from target db: %v\n", statName, err)
fmt.Println(errorMessage)
@@ -318,7 +304,7 @@ func syncDeliveryServiceStat(sourceClient influx.Client, targetClient influx.Cli
queryString = fmt.Sprintf("%s where time > now() - %dd", queryString, days)
}
fmt.Println("queryString ", queryString)
- res, err := queryDb2(sourceClient, queryString, db)
+ res, err := queryDB(sourceClient, queryString, db)
if err != nil {
errorMessage = fmt.Sprintf("An error occured getting %s records from sourceDb: %v\n", statName, err)
fmt.Println(errorMessage)
@@ -326,7 +312,7 @@ func syncDeliveryServiceStat(sourceClient influx.Client, targetClient influx.Cli
}
sourceStats := getDeliveryServiceStats(res)
// get value from target DB
- targetRes, err := queryDb2(targetClient, queryString, db)
+ targetRes, err := queryDB(targetClient, queryString, db)
if err != nil {
errorMessage = fmt.Sprintf("An error occured getting %s record from target db: %v\n", statName, err)
fmt.Println(errorMessage)
@@ -377,7 +363,7 @@ func syncDailyStat(sourceClient influx.Client, targetClient influx.Client, statN
if days > 0 {
queryString = fmt.Sprintf("%s where time > now() - %dd", queryString, days)
}
- res, err := queryDb2(sourceClient, queryString, db)
+ res, err := queryDB(sourceClient, queryString, db)
if err != nil {
errorMessage = fmt.Sprintf("An error occured getting %s records from sourceDb: %v\n", statName, err)
fmt.Println(errorMessage)
@@ -385,7 +371,7 @@ func syncDailyStat(sourceClient influx.Client, targetClient influx.Client, statN
}
sourceStats := getDailyStats(res)
// get value from target DB
- targetRes, err := queryDb2(targetClient, queryString, db)
+ targetRes, err := queryDB(targetClient, queryString, db)
if err != nil {
errorMessage = fmt.Sprintf("An error occured getting %s record from target db: %v\n", statName, err)
fmt.Println(errorMessage)
[25/29] incubator-trafficcontrol git commit: Update vendor going more
thoroughly through deps recursively... some cleanup may be called for in a
follow up PR
Posted by ne...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/delivery_service_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/delivery_service_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/delivery_service_test.go
deleted file mode 100644
index d8691b5..0000000
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/delivery_service_test.go
+++ /dev/null
@@ -1,666 +0,0 @@
-/*
-
- 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 TestDeliveryServices(t *testing.T) {
- resp := fixtures.DeliveryServices()
- 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 DeliveryServices")
-
- ds, err := to.DeliveryServices()
- 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(ds) != 1 {
- testHelper.Error(t, "Should get back \"1\" DeliveryService, got: %d", len(ds))
- } else {
- testHelper.Success(t, "Should get back \"1\" DeliveryService")
- }
-
- for _, s := range ds {
- if s.XMLID != "ds-test" {
- testHelper.Error(t, "Should get back \"ds-test\" for \"XMLID\", got: %s", s.XMLID)
- } else {
- testHelper.Success(t, "Should get back \"ds-test\" for \"XMLID\"")
- }
-
- if s.MissLong != "-99.123456" {
- testHelper.Error(t, "Should get back \"-99.123456\" for \"MissLong\", got: %s", s.MissLong)
- } else {
- testHelper.Success(t, "Should get back \"-99.123456\" for \"MissLong\"")
- }
- }
-}
-
-func TestDeliveryServicesUnauthorized(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 DeliveryServices")
-
- _, err := to.DeliveryServices()
- 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")
- }
-}
-
-func TestDeliveryService(t *testing.T) {
- resp := fixtures.DeliveryServices()
- 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 a DeliveryService")
-
- ds, err := to.DeliveryService("123")
- 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 ds.XMLID != "ds-test" {
- testHelper.Error(t, "Should get back \"ds-test\" for \"XMLID\", got: %s", ds.XMLID)
- } else {
- testHelper.Success(t, "Should get back \"ds-test\" for \"XMLID\"")
- }
-
- if ds.MissLong != "-99.123456" {
- testHelper.Error(t, "Should get back \"-99.123456\" for \"MissLong\", got: %s", ds.MissLong)
- } else {
- testHelper.Success(t, "Should get back \"-99.123456\" for \"MissLong\"")
- }
-}
-
-func TestDeliveryServiceUnauthorized(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 a DeliveryService")
-
- _, err := to.DeliveryService("123")
- 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")
- }
-}
-
-func TestCreateDeliveryService(t *testing.T) {
- resp := fixtures.DeliveryService()
- 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 to create a DeliveryService")
-
- ds, err := to.CreateDeliveryService(&client.DeliveryService{})
- 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")
- }
-
- actual := ds.Response.ID
- if actual != "001" {
- testHelper.Error(t, "Should get back \"001\" for \"Response.ID\", got: %s", actual)
- } else {
- testHelper.Success(t, "Should get back \"0001\" for \"Response.ID\"")
- }
-}
-
-func TestCreateDeliveryServiceUnauthorized(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 to create a DeliveryService")
-
- _, err := to.CreateDeliveryService(&client.DeliveryService{})
- 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")
- }
-}
-
-func TestUpdateDeliveryService(t *testing.T) {
- resp := fixtures.DeliveryService()
- 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 to update a DeliveryService")
-
- ds, err := to.UpdateDeliveryService("123", &client.DeliveryService{})
- 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")
- }
-
- actual := ds.Response.ID
- if actual != "001" {
- testHelper.Error(t, "Should get back \"001\" for \"Response.ID\", got: %s", actual)
- } else {
- testHelper.Success(t, "Should get back \"0001\" for \"Response.ID\"")
- }
-}
-
-func TestUpdateDeliveryServiceUnauthorized(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 to update a DeliveryService")
-
- _, err := to.UpdateDeliveryService("123", &client.DeliveryService{})
- 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")
- }
-}
-
-func TestDeleteDeliveryService(t *testing.T) {
- resp := fixtures.DeleteDeliveryService()
- 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 to delete a DeliveryService")
-
- ds, err := to.DeleteDeliveryService("123")
- 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")
- }
-
- actual := ds.Alerts[0].Text
- if actual != "text" {
- testHelper.Error(t, "Should get back \"text\" for \"Alerts[0].Text\", got: %s", actual)
- } else {
- testHelper.Success(t, "Should get back \"text\" for \"Alerts[0].Text\"")
- }
-}
-
-func TestDeleteDeliveryServiceUnauthorized(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 to delete a DeliveryService")
-
- _, err := to.DeleteDeliveryService("123")
- 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")
- }
-}
-
-func TestDeliveryServiceState(t *testing.T) {
- resp := fixtures.DeliveryServiceState()
- 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 a DeliveryServiceState")
-
- state, err := to.DeliveryServiceState("123")
- 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 state.Failover.Destination.Location != "someLocation" {
- testHelper.Error(t, "Should get back \"someLocation\" for \"Failover.Destination.Location\", got: %s", state.Failover.Destination.Location)
- } else {
- testHelper.Success(t, "Should get back \"someLocation\" for \"Failover.Destination.Location\"")
- }
-
- if state.Enabled != true {
- testHelper.Error(t, "Should get back \"true\" for \"Enabled\", got: %s", state.Enabled)
- } else {
- testHelper.Success(t, "Should get back \"true\" for \"Enabled\"")
- }
-}
-
-func TestDeliveryServiceStateUnauthorized(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 a DeliveryServiceState")
-
- _, err := to.DeliveryServiceState("123")
- 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")
- }
-}
-
-func TestDeliveryServiceHealth(t *testing.T) {
- resp := fixtures.DeliveryServiceHealth()
- 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 a DeliveryServiceHealth")
-
- health, err := to.DeliveryServiceHealth("123")
- 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 health.TotalOnline != 2 {
- testHelper.Error(t, "Should get back \"2\" for \"TotalOnline\", got: %s", health.TotalOnline)
- } else {
- testHelper.Success(t, "Should get back \"2\" for \"TotalOnline\"")
- }
-
- if health.TotalOffline != 3 {
- testHelper.Error(t, "Should get back \"3\" for \"TotalOffline\", got: %s", health.TotalOffline)
- } else {
- testHelper.Success(t, "Should get back \"2\" for \"TotalOffline\"")
- }
-
- if health.CacheGroups[0].Name != "someCacheGroup" {
- testHelper.Error(t, "Should get back \"someCacheGroup\" for \"CacheGroups[0].Name\", got: %s", health.CacheGroups[0].Name)
- } else {
- testHelper.Success(t, "Should get back \"someCacheGroup\" for \"CacheGroups[0].Name\"")
- }
-}
-
-func TestDeliveryServiceHealthUnauthorized(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 a DeliveryServiceHealth")
-
- _, err := to.DeliveryServiceHealth("123")
- 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")
- }
-}
-
-func TestDeliveryServiceCapacity(t *testing.T) {
- resp := fixtures.DeliveryServiceCapacity()
- 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 a DeliveryServiceCapacity")
-
- capacity, err := to.DeliveryServiceCapacity("123")
- 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 capacity.AvailablePercent != 90.12345 {
- testHelper.Error(t, "Should get back \"90.12345\" for \"AvailablePercent\", got: %s", capacity.AvailablePercent)
- } else {
- testHelper.Success(t, "Should get back \"90.12345\" for \"AvailablePercent\"")
- }
-
- if capacity.UnavailablePercent != 90.12345 {
- testHelper.Error(t, "Should get back \"90.12345\" for \"UnavailablePercent\", got: %s", capacity.UnavailablePercent)
- } else {
- testHelper.Success(t, "Should get back \"90.12345\" for \"UnavailablePercent\"")
- }
-
- if capacity.UtilizedPercent != 90.12345 {
- testHelper.Error(t, "Should get back \"90.12345\" for \"UtilizedPercent\", got: %s", capacity.UtilizedPercent)
- } else {
- testHelper.Success(t, "Should get back \"90.12345\" for \"UtilizedPercent\"")
- }
-}
-
-func TestDeliveryServiceCapacityUnauthorized(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 a DeliveryServiceCapacity")
-
- _, err := to.DeliveryServiceCapacity("123")
- 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")
- }
-}
-
-func TestDeliveryServiceRouting(t *testing.T) {
- resp := fixtures.DeliveryServiceRouting()
- 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 a DeliveryServiceRouting")
-
- routing, err := to.DeliveryServiceRouting("123")
- 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 routing.StaticRoute != 1 {
- testHelper.Error(t, "Should get back \"1\" for \"StaticRoute\", got: %s", routing.StaticRoute)
- } else {
- testHelper.Success(t, "Should get back \"1\" for \"StaticRoute\"")
- }
-}
-
-func TestDeliveryServiceRoutingUnauthorized(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 a DeliveryServiceRouting")
-
- _, err := to.DeliveryServiceRouting("123")
- 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")
- }
-}
-
-func TestDeliveryServiceServer(t *testing.T) {
- resp := fixtures.DeliveryServiceServer()
- 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 a DeliveryServiceServer")
-
- s, err := to.DeliveryServiceServer("1", "1")
- 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 s[0].LastUpdated != "lastUpdated" {
- testHelper.Error(t, "Should get back \"lastUpdated\" for \"LastUpdated\", got: %s", s[0].LastUpdated)
- } else {
- testHelper.Success(t, "Should get back \"lastUpdated\" for \"LastUpdated\"")
- }
-
- if s[0].Server != "someServer" {
- testHelper.Error(t, "Should get back \"someServer\" for \"Server\", got: %s", s[0].Server)
- } else {
- testHelper.Success(t, "Should get back \"someServer\" for \"Server\"")
- }
-
- if s[0].DeliveryService != "someService" {
- testHelper.Error(t, "Should get back \"someService\" for \"DeliveryService\", got: %s", s[0].DeliveryService)
- } else {
- testHelper.Success(t, "Should get back \"someService\" for \"DeliveryService\"")
- }
-}
-
-func TestDeliveryServiceServerUnauthorized(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 a DeliveryServiceServer")
-
- _, err := to.DeliveryServiceServer("1", "1")
- 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")
- }
-}
-
-func TestDeliveryServiceSSLKeysByID(t *testing.T) {
- resp := fixtures.DeliveryServiceSSLKeys()
- 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 a DeliveryServiceSSLKeysByID")
-
- ssl, err := to.DeliveryServiceSSLKeysByID("123")
- 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 ssl.Certificate.Crt != "crt" {
- testHelper.Error(t, "Should get back \"crt\" for \"Certificte.Crt\", got: %s", ssl.Certificate.Crt)
- } else {
- testHelper.Success(t, "Should get back \"crt\" for \"Certificate.Crt\"")
- }
-
- if ssl.Organization != "Kabletown" {
- testHelper.Error(t, "Should get back \"Kabletown\" for \"Organization\", got: %s", ssl.Organization)
- } else {
- testHelper.Success(t, "Should get back \"Kabletown\" for \"Organization\"")
- }
-}
-
-func TestDeliveryServiceSSLKeysByIDUnauthorized(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 a DeliveryServiceSSLKeysByID")
-
- _, err := to.DeliveryServiceSSLKeysByID("123")
- 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")
- }
-}
-
-func TestDeliveryServiceSSLKeysByHostname(t *testing.T) {
- resp := fixtures.DeliveryServiceSSLKeys()
- 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 a DeliveryServiceSSLKeysByHostname")
-
- ssl, err := to.DeliveryServiceSSLKeysByHostname("hostname")
- 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 ssl.Certificate.Crt != "crt" {
- testHelper.Error(t, "Should get back \"crt\" for \"Certificte.Crt\", got: %s", ssl.Certificate.Crt)
- } else {
- testHelper.Success(t, "Should get back \"crt\" for \"Certificate.Crt\"")
- }
-
- if ssl.Organization != "Kabletown" {
- testHelper.Error(t, "Should get back \"Kabletown\" for \"Organization\", got: %s", ssl.Organization)
- } else {
- testHelper.Success(t, "Should get back \"Kabletown\" for \"Organization\"")
- }
-}
-
-func TestDeliveryServiceSSLKeysByHostnameUnauthorized(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 a DeliveryServiceSSLKeysByHostname")
-
- _, err := to.DeliveryServiceSSLKeysByHostname("hostname")
- 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")
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/hardware_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/hardware_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/hardware_test.go
deleted file mode 100644
index 140601a..0000000
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/hardware_test.go
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-
- 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 TestHardware(t *testing.T) {
- resp := fixtures.Hardware()
- 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 Hardware")
-
- hardware, err := to.Hardware()
- 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(hardware) != 1 {
- testHelper.Error(t, "Should get back \"1\" Hardware, got: %d", len(hardware))
- } else {
- testHelper.Success(t, "Should get back \"1\" Hardware")
- }
-
- for _, h := range hardware {
- if h.HostName != "odol-atsmid-cen-09" {
- testHelper.Error(t, "Should get back \"odol-atsmid-cen-09\" for \"Hostname\", got: %s", h.HostName)
- } else {
- testHelper.Success(t, "Should get back \"odol-atsmid-cen-09\" for \"Hostname\"")
- }
-
- if h.Value != "1.00" {
- testHelper.Error(t, "Should get back \"1.00\" for \"Value\", got: %s", h.Value)
- } else {
- testHelper.Success(t, "Should get back \"1.00\" for \"Value\"")
- }
-
- if h.Description != "BACKPLANE FIRMWARE" {
- testHelper.Error(t, "Should get back \"BACKPLANE FIRMWARE\" for \"Description\", got: %s", h.Description)
- } else {
- testHelper.Success(t, "Should get back \"BACKPLANE FIRMWARE\" for \"Description\"")
- }
- }
-}
-
-func TestHardwareUnauthorized(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 Hardware")
-
- _, err := to.Hardware()
- 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")
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/parameter_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/parameter_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/parameter_test.go
deleted file mode 100644
index f837445..0000000
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/parameter_test.go
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-
- 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 TestParameters(t *testing.T) {
- resp := fixtures.Parameters()
- 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 Parameters")
-
- parameters, err := to.Parameters("test")
- 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(parameters) != 1 {
- testHelper.Error(t, "Should get back \"1\" Parameter, got: %d", len(parameters))
- } else {
- testHelper.Success(t, "Should get back \"1\" Parameter")
- }
-
- for _, param := range parameters {
- if param.Name != "location" {
- testHelper.Error(t, "Should get back \"location\" for \"Name\", got: %s", param.Name)
- } else {
- testHelper.Success(t, "Should get back \"location\" for \"Name\"")
- }
-
- if param.Value != "/foo/trafficserver/" {
- testHelper.Error(t, "Should get back \"/foo/trafficserver/\" for \"Value\", got: %s", param.Value)
- } else {
- testHelper.Success(t, "Should get back \"/foo/trafficserver/\" for \"Value\"")
- }
-
- if param.ConfigFile != "parent.config" {
- testHelper.Error(t, "Should get back \"parent.config\" for \"ConfigFile\", got: %s", param.ConfigFile)
- } else {
- testHelper.Success(t, "Should get back \"parent.config\" for \"ConfigFile\"")
- }
- }
-}
-
-func TestParametersUnauthorized(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 Parameters")
-
- _, err := to.Parameters("test")
- 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")
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/profile_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/profile_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/profile_test.go
deleted file mode 100644
index 3b9cc7f..0000000
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/profile_test.go
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-
- 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 TestProfile(t *testing.T) {
- resp := fixtures.Profiles()
- 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 Profiles")
-
- profiles, err := to.Profiles()
- 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(profiles) != 1 {
- testHelper.Error(t, "Should get back \"1\" Profile, got: %d", len(profiles))
- } else {
- testHelper.Success(t, "Should get back \"1\" Profile")
- }
-
- for _, p := range profiles {
- if p.Name != "TR_CDN2" {
- testHelper.Error(t, "Should get back \"TR_CDN2\" for \"Name\", got: %s", p.Name)
- } else {
- testHelper.Success(t, "Should get back \"TR_CDN2\" for \"Name\"")
- }
-
- if p.Description != "kabletown Content Router" {
- testHelper.Error(t, "Should get back \"kabletown Content Router\" for \"Description\", got: %s", p.Description)
- } else {
- testHelper.Success(t, "Should get back \"kabletown Content Router\" for \"Description\"")
- }
- }
-}
-
-func TestProfilesUnauthorized(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 Profiles")
-
- _, err := to.Profiles()
- 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")
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/server_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/server_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/server_test.go
deleted file mode 100644
index 793c34c..0000000
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/server_test.go
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
-
- 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"
- "net/url"
- "testing"
-
- "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
- "github.com/apache/incubator-trafficcontrol/traffic_ops/client/fixtures"
- "github.com/jheitz200/test_helper"
-)
-
-func TestServer(t *testing.T) {
- resp := fixtures.Servers()
- 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 Servers")
-
- servers, err := to.Servers()
- 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(servers) != 3 {
- testHelper.Error(t, "Should get back \"3\" Server, got: %d", len(servers))
- } else {
- testHelper.Success(t, "Should get back \"3\" Server")
- }
-
- if servers[0].HostName != "edge-alb-01" {
- testHelper.Error(t, "Should get \"edge-alb-01\" for \"HostName\", got: %s", servers[0].HostName)
- } else {
- testHelper.Success(t, "Should get \"edge-alb-01\" for \"HostName\"")
- }
-
- if servers[0].DomainName != "albuquerque.nm.albuq.kabletown.com" {
- testHelper.Error(t, "Should get \"albuquerque.nm.albuq.kabletown.com\" for \"DomainName\", got: %s", servers[0].DomainName)
- } else {
- testHelper.Success(t, "Should get \"albuquerque.nm.albuq.kabletown.com\" for \"DomainName\"")
- }
-
- if servers[0].Type != "EDGE" {
- testHelper.Error(t, "Should get \"EDGE\" for \"Type\", got: %s", servers[0].Type)
- } else {
- testHelper.Success(t, "Should get \"EDGE\" for \"Type\"")
- }
-}
-
-func TestServersUnauthorized(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 Servers")
-
- _, err := to.Servers()
- 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")
- }
-}
-
-func TestServerFQDN(t *testing.T) {
- resp := fixtures.Servers()
- server := testHelper.ValidHTTPServer(resp)
- defer server.Close()
-
- var httpClient http.Client
- to := client.Session{
- URL: server.URL,
- UserAgent: &httpClient,
- }
-
- shortName := "edge-alb-01"
- testHelper.Context(t, "Given the need to test a successful Traffic Ops request for the FQDN of Server: \"%s\"", shortName)
-
- s, err := to.ServersFqdn("edge-alb-01")
- 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 s != "edge-alb-01.albuquerque.nm.albuq.kabletown.com" {
- testHelper.Error(t, "Should get back \"edge-alb-01.albuquerque.nm.albuq.kabletown.com\", got: %s", s)
- } else {
- testHelper.Success(t, "Should get back \"edge-alb-01.albuquerque.nm.albuq.kabletown.com\"")
- }
-}
-
-func TestServerFQDNError(t *testing.T) {
- var resp client.ServerResponse
- server := testHelper.ValidHTTPServer(resp)
- defer server.Close()
-
- var httpClient http.Client
- to := client.Session{
- URL: server.URL,
- UserAgent: &httpClient,
- }
-
- shortName := "edge-alb-01"
- testHelper.Context(t, "Given the need to test a failed Traffic Ops request for the FQDN of Server: \"%s\"", shortName)
-
- _, err := to.ServersFqdn(shortName)
- 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")
- }
-}
-
-func TestServerFQDNUnauthorized(t *testing.T) {
- server := testHelper.InvalidHTTPServer(http.StatusUnauthorized)
- defer server.Close()
-
- var httpClient http.Client
- to := client.Session{
- URL: server.URL,
- UserAgent: &httpClient,
- }
-
- shortName := "edge-alb-01"
- testHelper.Context(t, "Given the need to test a failed Traffic Ops request for the FQDN of Server: \"%s\"", shortName)
-
- _, err := to.ServersFqdn(shortName)
- 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")
- }
-}
-
-func TestServerShortName(t *testing.T) {
- resp := fixtures.Servers()
- server := testHelper.ValidHTTPServer(resp)
- defer server.Close()
-
- var httpClient http.Client
- to := client.Session{
- URL: server.URL,
- UserAgent: &httpClient,
- }
-
- pattern := "edge"
- testHelper.Context(t, "Given the need to test a successful Traffic Ops request for servers that match Short Name: \"%s\"", pattern)
-
- servers, err := to.ServersShortNameSearch(pattern)
- 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 servers[0] != "edge-alb-01" {
- testHelper.Error(t, "Should get back \"edge-alb-01\", got: %s", servers[0])
- } else {
- testHelper.Success(t, "Should get back \"edge-alb-01\"")
- }
-
- if servers[1] != "edge-alb-02" {
- testHelper.Error(t, "Should get back \"edge-alb-02\", got: %s", servers[1])
- } else {
- testHelper.Success(t, "Should get back \"edge-alb-02\"")
- }
-}
-
-func TestServerShortNameError(t *testing.T) {
- var resp client.ServerResponse
- server := testHelper.ValidHTTPServer(resp)
- defer server.Close()
-
- var httpClient http.Client
- to := client.Session{
- URL: server.URL,
- UserAgent: &httpClient,
- }
-
- pattern := "edge"
- testHelper.Context(t, "Given the need to test a failed Traffic Ops request for servers that match Short Name: \"%s\"", pattern)
-
- _, err := to.ServersShortNameSearch(pattern)
- 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")
- }
-}
-
-func TestServerShortNameUnauthorized(t *testing.T) {
- server := testHelper.InvalidHTTPServer(http.StatusUnauthorized)
- defer server.Close()
-
- var httpClient http.Client
- to := client.Session{
- URL: server.URL,
- UserAgent: &httpClient,
- }
-
- pattern := "edge"
- testHelper.Context(t, "Given the need to test a failed Traffic Ops request for servers that match Short Name: \"%s\"", pattern)
-
- _, err := to.ServersShortNameSearch(pattern)
- 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")
- }
-}
-
-func TestServerByType(t *testing.T) {
- resp := fixtures.LogstashServers()
- 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 \"Logstash\" Servers")
-
- params := make(url.Values)
- params.Add("type", "Logstash")
-
- servers, err := to.ServersByType(params)
- 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(servers) != 2 {
- testHelper.Error(t, "Should get back \"2\" Server, got: %d", len(servers))
- } else {
- testHelper.Success(t, "Should get back \"2\" Server")
- }
-
- if servers[0].HostName != "logstash-01" {
- testHelper.Error(t, "Should get \"logstash-01\" for \"HostName\", got: %s", servers[0].HostName)
- } else {
- testHelper.Success(t, "Should get \"logstash-01\" for \"HostName\"")
- }
-
- if servers[0].DomainName != "albuquerque.nm.albuq.kabletown.com" {
- testHelper.Error(t, "Should get \"albuquerque.nm.albuq.kabletown.com\" for \"DomainName\", got: %s", servers[0].DomainName)
- } else {
- testHelper.Success(t, "Should get \"albuquerque.nm.albuq.kabletown.com\" for \"DomainName\"")
- }
-
- if servers[0].Type != "LOGSTASH" {
- testHelper.Error(t, "Should get \"LOGSTASH\" for \"Type\", got: %s", servers[0].Type)
- } else {
- testHelper.Success(t, "Should get \"LOGSTASH\" for \"Type\"")
- }
-}
-
-func TestServerByTypeUnauthorized(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 \"Logstash\" servers")
-
- params := make(url.Values)
- params.Add("type", "Logstash")
-
- _, err := to.ServersByType(params)
- 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")
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/stats_summary_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/stats_summary_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/stats_summary_test.go
deleted file mode 100644
index 7e677a3..0000000
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/stats_summary_test.go
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
-
- 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 TestStatsSummary(t *testing.T) {
- resp := fixtures.StatsSummary()
- 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 Stats Summary")
-
- stats, err := to.SummaryStats("test-cdn", "test-ds1", "test-stat")
- 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(stats) != 1 {
- testHelper.Error(t, "Should get back \"1\" Parameter, got: %d", len(stats))
- } else {
- testHelper.Success(t, "Should get back \"1\" Parameter")
- }
-
- for _, s := range stats {
- if s.StatName != "test-stat" {
- testHelper.Error(t, "Should get back \"test-stat\" for \"StatName\", got: %s", s.StatName)
- } else {
- testHelper.Success(t, "Should get back \"test-stat\" for \"StatName\"")
- }
-
- if s.DeliveryService != "test-ds1" {
- testHelper.Error(t, "Should get back \"test-ds1\" for \"DeliveryService\", got: %s", s.DeliveryService)
- } else {
- testHelper.Success(t, "Should get back \"test-ds1\" for \"DeliveryService\"")
- }
-
- if s.StatValue != "3.1415" {
- testHelper.Error(t, "Should get back \"3.1415\" for \"StatValue\", got: %s", s.StatValue)
- } else {
- testHelper.Success(t, "Should get back \"3.1415\" for \"StatValue\"")
- }
-
- if s.CDNName != "test-cdn" {
- testHelper.Error(t, "Should get back \"test-cdn\" for \"CDNName\", got: %s", s.CDNName)
- } else {
- testHelper.Success(t, "Should get back \"test-cdn\" for \"CDNName\"")
- }
- }
-}
-
-func TestStatsSummaryUnauthorized(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 Stats Summary")
-
- _, err := to.SummaryStats("test-cdn", "test-ds1", "test-stat")
- 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")
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_monitor_config_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_monitor_config_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_monitor_config_test.go
deleted file mode 100644
index fd792a8..0000000
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_monitor_config_test.go
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
-
- 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 TestTMConfig(t *testing.T) {
- resp := fixtures.TrafficMonitorConfig()
- 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 TM Config")
-
- tm, err := to.TrafficMonitorConfigMap("test-cdn")
- 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")
- }
-
- testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TM Config - Traffic Server")
-
- ts := tm.TrafficServer
- if len(ts) != 2 {
- testHelper.Error(t, "Should get back \"2\" Traffic Servers, got: %d", len(ts))
- } else {
- testHelper.Success(t, "Should get back \"2\" Traffic Servers")
- }
-
- hashID := "tr-chi-05"
- if val, ok := ts[hashID]; ok {
- testHelper.Success(t, "Should get back map entry for \"%s\"", hashID)
-
- if val.IP != "10.10.10.10" {
- testHelper.Error(t, "Should get back \"10.10.10.10\" for \"IP\", got: %s", val.IP)
- } else {
- testHelper.Success(t, "Should get back \"10.10.10.10\" for \"IP\"")
- }
-
- } else {
- testHelper.Error(t, "Should get back map entry for \"%s\"", hashID)
- }
-
- hashID = "edge-test-01"
- if val, ok := ts[hashID]; ok {
- testHelper.Success(t, "Should get back map entry for for \"%s\"", hashID)
-
- if val.Type != "EDGE" {
- testHelper.Error(t, "Should get back \"EDGE\" for \"%s\" \"Type\", got: %s", hashID, ts[hashID].Type)
- } else {
- testHelper.Success(t, "Should get back \"EDGE\" for \"%s\" \"Type\"", hashID)
- }
-
- } else {
- testHelper.Error(t, "Should get back map entry for \"%s\"", hashID)
- }
-
- testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TR Config - Traffic Monitor")
-
- m := tm.TrafficMonitor
- if len(m) != 1 {
- testHelper.Error(t, "Should get back \"1\" Traffic Servers, got: %d", len(m))
- } else {
- testHelper.Success(t, "Should get back \"1\" Traffic Servers")
- }
-
- hostName := "traffic-monitor-01"
- if val, ok := m[hostName]; ok {
- testHelper.Success(t, "Should get back map entry for \"%s\"", hostName)
-
- if val.Status != "ONLINE" {
- testHelper.Error(t, "Should get back \"ONLINE\" for \"Status\", got: %s", val.Status)
- } else {
- testHelper.Success(t, "Should get back \"ONLINE\" for \"Status\"")
- }
-
- } else {
- testHelper.Error(t, "Should get back map entry for \"%s\"", hostName)
- }
-
- testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TM Config - CacheGroups")
-
- c := tm.CacheGroup
- if len(c) != 2 {
- testHelper.Error(t, "Should get back \"2\" Traffic Servers, got: %d", len(c))
- } else {
- testHelper.Success(t, "Should get back \"2\" Traffic Servers")
- }
-
- name := "philadelphia"
- if val, ok := c[name]; ok {
- testHelper.Success(t, "Should get back map entry for \"%s\"", name)
-
- if val.Coordinates.Latitude != 55 {
- testHelper.Error(t, "Should get back \"55\" for \"Coordinates.Latitude\", got: %s", val.Coordinates.Latitude)
- } else {
- testHelper.Success(t, "Should get back \"55\" for \"Coordinates.Latitude\"")
- }
-
- } else {
- testHelper.Error(t, "Should get back map entry for \"%s\"", name)
- }
-
- name = "tr-chicago"
- if val, ok := c[name]; ok {
- testHelper.Success(t, "Should get back map entry for \"%s\"", name)
-
- if val.Coordinates.Longitude != 9 {
- testHelper.Error(t, "Should get back \"9\" for \"Coordinates.Longitude\", got: %s", val.Coordinates.Longitude)
- } else {
- testHelper.Success(t, "Should get back \"9\" for \"Coordinates.Longitude\"")
- }
-
- } else {
- testHelper.Error(t, "Should get back map entry for \"%s\"", name)
- }
-
- testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TM Config - Delivery Services")
-
- ds := tm.DeliveryService
- if len(ds) != 1 {
- testHelper.Error(t, "Should get back \"1\" TM Delivery Service, got: %d", len(ds))
- } else {
- testHelper.Success(t, "Should get back \"1\" TM Delivery Service")
- }
-
- xmlID := "ds-05"
- if val, ok := ds[xmlID]; ok {
- testHelper.Success(t, "Should get back map entry for \"%s\"", xmlID)
-
- if val.Status != "REPORTED" {
- testHelper.Error(t, "Should get back \"REPORTED\" for \"Status\", got: %s", val.Status)
- } else {
- testHelper.Success(t, "Should get back \"REPORTED\" for \"Status\"")
- }
-
- } else {
- testHelper.Error(t, "Should get back map entry for \"%s\"", xmlID)
- }
-
- testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TM Config - TM Profiles")
-
- p := tm.Profile
- if len(p) != 1 {
- testHelper.Error(t, "Should get back \"1\" TM Profie, got: %d", len(p))
- } else {
- testHelper.Success(t, "Should get back \"1\" TM Profile")
- }
-
- name = "tm-123"
- if val, ok := p[name]; ok {
- testHelper.Success(t, "Should get back map entry for \"%s\"", name)
-
- if val.Parameters.HealthConnectionTimeout != 2000 {
- testHelper.Error(t, "Should get back \"2000\" for \"Parameters.HealthConnectionTimeout\", got: %v", val.Parameters.HealthConnectionTimeout)
- } else {
- testHelper.Success(t, "Should get back \"2000\" for \"Parameters.HealthConnectionTimeout\"")
- }
-
- } else {
- testHelper.Error(t, "Should get back map entry for \"%s\"", name)
- }
-
- testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TM Config - Config")
-
- conf := tm.Config
- if _, ok := conf["peers.polling.interval"]; ok {
- if conf["peers.polling.interval"] != float64(1000) {
- testHelper.Error(t, "Should get back \"1000\" for map entry for \"peers.polling.interval\", got: \"%v\"", conf["peers.polling.interval"])
- } else {
- testHelper.Success(t, "Should get back \"1000\" for map entry for \"peers.polling.interval\"")
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_ops_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_ops_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_ops_test.go
deleted file mode 100644
index a9dae06..0000000
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_ops_test.go
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-
- 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/jheitz200/test_helper"
-)
-
-func TestLogin(t *testing.T) {
- resp := client.Result{
- Alerts: []client.Alert{
- client.Alert{
- Level: "success",
- Text: "Successfully logged in.",
- },
- },
- }
-
- server := testHelper.ValidHTTPServer(resp)
-
- testHelper.Context(t, "Given the need to test a successful login to Traffic Ops")
-
- session, err := client.Login(server.URL, "test", "password", true)
- if err != nil {
- testHelper.Error(t, "Should be able to login")
- } else {
- testHelper.Success(t, "Should be able to login")
- }
-
- if session.UserName != "test" {
- testHelper.Error(t, "Should get back \"test\" for \"UserName\", got %s", session.UserName)
- } else {
- testHelper.Success(t, "Should get back \"test\" for \"UserName\"")
- }
-
- if session.Password != "password" {
- testHelper.Error(t, "Should get back \"password\" for \"Password\", got %s", session.Password)
- } else {
- testHelper.Success(t, "Should get back \"password\" for \"Password\"")
- }
-
- if session.URL != server.URL {
- testHelper.Error(t, "Should get back \"%s\" for \"URL\", got %s", server.URL, session.URL)
- } else {
- testHelper.Success(t, "Should get back \"%s\" for \"URL\"", server.URL)
- }
-}
-
-func TestLoginUnauthorized(t *testing.T) {
- server := testHelper.InvalidHTTPServer(http.StatusUnauthorized)
- defer server.Close()
-
- testHelper.Context(t, "Given the need to test an unsuccessful login to Traffic Ops")
-
- _, err := client.Login(server.URL, "test", "password", true)
- if err == nil {
- testHelper.Error(t, "Should not be able to login")
- } else {
- testHelper.Success(t, "Should not be able to login")
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_router_config_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_router_config_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_router_config_test.go
deleted file mode 100644
index ea34581..0000000
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/traffic_router_config_test.go
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
-
- 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 TestTRConfig(t *testing.T) {
- resp := fixtures.TrafficRouterConfig()
- 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 TR Config")
-
- tr, err := to.TrafficRouterConfigMap("title-vi")
- 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")
- }
-
- testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TR Config - Traffic Server")
-
- ts := tr.TrafficServer
- if len(ts) != 2 {
- testHelper.Error(t, "Should get back \"2\" Traffic Servers, got: %d", len(ts))
- } else {
- testHelper.Success(t, "Should get back \"2\" Traffic Servers")
- }
-
- hashID := "tr-chi-05"
- if val, ok := ts[hashID]; ok {
- testHelper.Success(t, "Should get back map entry for \"%s\"", hashID)
-
- if val.IP != "10.10.10.10" {
- testHelper.Error(t, "Should get back \"10.10.10.10\" for \"IP\", got: %s", val.IP)
- } else {
- testHelper.Success(t, "Should get back \"10.10.10.10\" for \"IP\"")
- }
-
- } else {
- testHelper.Error(t, "Should get back map entry for \"%s\"", hashID)
- }
-
- hashID = "edge-test-01"
- if val, ok := ts[hashID]; ok {
- testHelper.Success(t, "Should get back map entry for for \"%s\"", hashID)
-
- if val.Type != "EDGE" {
- testHelper.Error(t, "Should get back \"EDGE\" for \"%s\" \"Type\", got: %s", hashID, ts[hashID].Type)
- } else {
- testHelper.Success(t, "Should get back \"EDGE\" for \"%s\" \"Type\"", hashID)
- }
-
- } else {
- testHelper.Error(t, "Should get back map entry for \"%s\"", hashID)
- }
-
- testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TR Config - Traffic Monitor")
-
- tm := tr.TrafficMonitor
- if len(tm) != 1 {
- testHelper.Error(t, "Should get back \"1\" Traffic Servers, got: %d", len(tm))
- } else {
- testHelper.Success(t, "Should get back \"1\" Traffic Servers")
- }
-
- hostname := "traffic-monitor-01"
- if val, ok := tm[hostname]; ok {
- testHelper.Success(t, "Should get back map entry for \"%s\"", hostname)
-
- if val.Profile != "tr-123" {
- testHelper.Error(t, "Should get back \"tr-123\" for \"Profile\", got: %s", val.Profile)
- } else {
- testHelper.Success(t, "Should get back \"tr-123\" for \"Profile\"")
- }
-
- } else {
- testHelper.Error(t, "Should get back map entry for \"%s\"", hostname)
- }
-
- testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TR Config - Traffic Router")
-
- r := tr.TrafficRouter
- if len(r) != 1 {
- testHelper.Error(t, "Should get back \"1\" Traffic Servers, got: %d", len(r))
- } else {
- testHelper.Success(t, "Should get back \"1\" Traffic Servers")
- }
-
- fqdn := "tr-01@ga.atlanta.kabletown.net"
- if val, ok := r[fqdn]; ok {
- testHelper.Success(t, "Should get back map entry for \"%s\"", fqdn)
-
- if val.Location != "tr-chicago" {
- testHelper.Error(t, "Should get back \"tr-chicago\" for \"Location\", got: %s", val.Location)
- } else {
- testHelper.Success(t, "Should get back \"tr-chicago\" for \"Location\"")
- }
-
- } else {
- testHelper.Error(t, "Should get back map entry for \"%s\"", fqdn)
- }
-
- testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TR Config - CacheGroups")
-
- c := tr.CacheGroup
- if len(c) != 2 {
- testHelper.Error(t, "Should get back \"2\" Traffic Servers, got: %d", len(c))
- } else {
- testHelper.Success(t, "Should get back \"2\" Traffic Servers")
- }
-
- name := "philadelphia"
- if val, ok := c[name]; ok {
- testHelper.Success(t, "Should get back map entry for \"%s\"", name)
-
- if val.Coordinates.Latitude != 99 {
- testHelper.Error(t, "Should get back \"99\" for \"Coordinates.Latitude\", got: %v", val.Coordinates.Latitude)
- } else {
- testHelper.Success(t, "Should get back \"99\" for \"Coordinates.Latitude\"")
- }
-
- } else {
- testHelper.Error(t, "Should get back map entry for \"%s\"", name)
- }
-
- name = "tr-chicago"
- if val, ok := c[name]; ok {
- testHelper.Success(t, "Should get back map entry for \"%s\"", name)
-
- if val.Coordinates.Longitude != 9 {
- testHelper.Error(t, "Should get back \"9\" for \"Coordinates.Longitude\", got: %v", val.Coordinates.Longitude)
- } else {
- testHelper.Success(t, "Should get back \"9\" for \"Coordinates.Longitude\"")
- }
-
- } else {
- testHelper.Error(t, "Should get back map entry for \"%s\"", name)
- }
-
- testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TR Config - Delivery Services")
-
- ds := tr.DeliveryService
- if len(ds) != 1 {
- testHelper.Error(t, "Should get back \"1\" TR Delivery Service, got: %d", len(ds))
- } else {
- testHelper.Success(t, "Should get back \"1\" TR Delivery Service")
- }
-
- xmlID := "ds-06"
- if val, ok := ds[xmlID]; ok {
- testHelper.Success(t, "Should get back map entry for \"%s\"", xmlID)
-
- if val.TTL != 3600 {
- testHelper.Error(t, "Should get back \"3600\" for \"TTL\", got: %d", val.TTL)
- } else {
- testHelper.Success(t, "Should get back \"3600\" for \"TTL\"")
- }
-
- } else {
- testHelper.Error(t, "Should get back map entry for \"%s\"", xmlID)
- }
-
- testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TR Config - Config")
-
- conf := tr.Config
- if _, ok := conf["peers.polling.interval"]; ok {
- if conf["peers.polling.interval"] != float64(1000) {
- testHelper.Error(t, "Should get back \"1000\" for map entry for \"peers.polling.interval\", got: \"%v\"", conf["peers.polling.interval"])
- } else {
- testHelper.Success(t, "Should get back \"1000\" for map entry for \"peers.polling.interval\"")
- }
- }
-
- testHelper.Context(t, "Given the need to test a successful Traffic Ops request for TR Config - Stats")
-
- stats := tr.Stat
- if _, ok := stats["cdnName"]; ok {
- if stats["cdnName"] != "test-cdn" {
- testHelper.Error(t, "Should get back \"test-cdn\" for map entry for \"cdnName\", got: \"%s\"", stats["cdnName"])
- } else {
- testHelper.Success(t, "Should get back \"test-cdn\" for map entry for \"cdnName\"")
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/type_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/type_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/type_test.go
deleted file mode 100644
index e4d8a43..0000000
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/type_test.go
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-
- 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 TestTypes(t *testing.T) {
- resp := fixtures.Types()
- 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 Types")
-
- types, err := to.Types()
- 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")
- }
-
- for _, n := range types {
- if n.Name != "EDGE" {
- testHelper.Error(t, "Should get back \"EDGE\" for \"Name\", got %s", n.Name)
- } else {
- testHelper.Success(t, "Should get back \"EDGE\" for \"Name\"")
- }
-
- if n.Description != "edge cache" {
- testHelper.Error(t, "Should get back \"edge cache\" for \"Description\", got %s", n.Description)
- } else {
- testHelper.Success(t, "Should get back \"edge cache\" for \"Description\"")
- }
- }
-}
-
-func TestTypesUnauthorized(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 Types")
-
- _, err := to.Types()
- 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")
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/user_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/user_test.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/user_test.go
deleted file mode 100644
index d684770..0000000
--- a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/tests/user_test.go
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
-
- 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 TestUsers(t *testing.T) {
- resp := fixtures.Users()
- server := testHelper.ValidHTTPServer(resp.Response)
- 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 Users")
-
- users, err := to.Users()
- 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")
- }
-
- for _, u := range users {
- if u.FullName != "Bob Smith" {
- testHelper.Error(t, "Should get back \"Bob Smith\" for \"FullName\", got %s", u.FullName)
- } else {
- testHelper.Success(t, "Should get back \"Bob Smith\" for \"FullName\"")
- }
-
- if u.PublicSSHKey != "some-ssh-key" {
- testHelper.Error(t, "Should get back \"some-ssh-key\" for \"PublicSSHKey\", got %s", u.PublicSSHKey)
- } else {
- testHelper.Success(t, "Should get back \"some-ssh-key\" for \"PublicSSHKey\"")
- }
-
- if u.Role != "3" {
- testHelper.Error(t, "Should get back \"3\" for \"Role\", got %s", u.Role)
- } else {
- testHelper.Success(t, "Should get back \"3\" for \"Role\"")
- }
-
- if u.Email != "bobsmith@email.com" {
- testHelper.Error(t, "Should get back \"bobsmith@email.com\" for \"Email\", got %s", u.Email)
- } else {
- testHelper.Success(t, "Should get back \"bobsmith@email.com\" for \"Email\"")
- }
-
- if u.Username != "bsmith" {
- testHelper.Error(t, "Should get back \"bsmith\" for \"Username\", got %s", u.Username)
- } else {
- testHelper.Success(t, "Should get back \"bsmith\" for \"Username\"")
- }
- }
-}
-
-func TestUsersUnauthorized(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 Users")
-
- _, err := to.Users()
- 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")
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/influxdata/influxdb/LICENSE
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/LICENSE b/traffic_stats/vendor/github.com/influxdata/influxdb/LICENSE
new file mode 100644
index 0000000..63cef79
--- /dev/null
+++ b/traffic_stats/vendor/github.com/influxdata/influxdb/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2013-2016 Errplane Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/influxdata/influxdb/LICENSE_OF_DEPENDENCIES.md
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/LICENSE_OF_DEPENDENCIES.md b/traffic_stats/vendor/github.com/influxdata/influxdb/LICENSE_OF_DEPENDENCIES.md
new file mode 100644
index 0000000..1228079
--- /dev/null
+++ b/traffic_stats/vendor/github.com/influxdata/influxdb/LICENSE_OF_DEPENDENCIES.md
@@ -0,0 +1,25 @@
+# List
+- bootstrap 3.3.5 [MIT LICENSE](https://github.com/twbs/bootstrap/blob/master/LICENSE)
+- collectd.org [ISC LICENSE](https://github.com/collectd/go-collectd/blob/master/LICENSE)
+- github.com/BurntSushi/toml [WTFPL LICENSE](https://github.com/BurntSushi/toml/blob/master/COPYING)
+- github.com/bmizerany/pat [MIT LICENSE](https://github.com/bmizerany/pat#license)
+- github.com/boltdb/bolt [MIT LICENSE](https://github.com/boltdb/bolt/blob/master/LICENSE)
+- github.com/cespare/xxhash [MIT LICENSE](https://github.com/cespare/xxhash/blob/master/LICENSE.txt)
+- github.com/davecgh/go-spew/spew [ISC LICENSE](https://github.com/davecgh/go-spew/blob/master/LICENSE)
+- github.com/dgrijalva/jwt-go [MIT LICENSE](https://github.com/dgrijalva/jwt-go/blob/master/LICENSE)
+- github.com/dgryski/go-bits [MIT LICENSE](https://github.com/dgryski/go-bits/blob/master/LICENSE)
+- github.com/dgryski/go-bitstream [MIT LICENSE](https://github.com/dgryski/go-bitstream/blob/master/LICENSE)
+- github.com/gogo/protobuf/proto [BSD LICENSE](https://github.com/gogo/protobuf/blob/master/LICENSE)
+- github.com/golang/snappy [BSD LICENSE](https://github.com/golang/snappy/blob/master/LICENSE)
+- github.com/influxdata/usage-client [MIT LICENSE](https://github.com/influxdata/usage-client/blob/master/LICENSE.txt)
+- github.com/jwilder/encoding [MIT LICENSE](https://github.com/jwilder/encoding/blob/master/LICENSE)
+- github.com/paulbellamy/ratecounter [MIT LICENSE](https://github.com/paulbellamy/ratecounter/blob/master/LICENSE)
+- github.com/peterh/liner [MIT LICENSE](https://github.com/peterh/liner/blob/master/COPYING)
+- github.com/rakyll/statik [APACHE LICENSE](https://github.com/rakyll/statik/blob/master/LICENSE)
+- github.com/retailnext/hllpp [BSD LICENSE](https://github.com/retailnext/hllpp/blob/master/LICENSE)
+- github.com/uber-go/atomic [MIT LICENSE](https://github.com/uber-go/atomic/blob/master/LICENSE.txt)
+- github.com/uber-go/zap [MIT LICENSE](https://github.com/uber-go/zap/blob/master/LICENSE.txt)
+- glyphicons [LICENSE](http://glyphicons.com/license/)
+- golang.org/x/crypto [BSD LICENSE](https://github.com/golang/crypto/blob/master/LICENSE)
+- jquery 2.1.4 [MIT LICENSE](https://github.com/jquery/jquery/blob/master/LICENSE.txt)
+- react 0.13.3 [BSD LICENSE](https://github.com/facebook/react/blob/master/LICENSE)
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/client.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/client.go b/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/client.go
index 4d0ce60..66c210d 100644
--- a/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/client.go
+++ b/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/client.go
@@ -1,5 +1,5 @@
// Package client (v2) is the current official Go client for InfluxDB.
-package client // import "github.com/influxdata/influxdb/client/v2"
+package client
import (
"bytes"
[15/29] incubator-trafficcontrol git commit: Add vendor directory
with current dependencies
Posted by ne...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_ops.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_ops.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_ops.go
new file mode 100644
index 0000000..15d8cc8
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_ops.go
@@ -0,0 +1,306 @@
+/*
+
+ 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 (
+ "bytes"
+ "crypto/tls"
+ "encoding/json"
+ "fmt"
+ "io/ioutil"
+ "net/http"
+ "strings"
+ "time"
+
+ "github.com/juju/persistent-cookiejar"
+ "golang.org/x/net/publicsuffix"
+)
+
+// Session ...
+type Session struct {
+ UserName string
+ Password string
+ URL string
+ UserAgent *http.Client
+ Cache map[string]CacheEntry
+}
+
+// HTTPError is returned on Update Session failure.
+type HTTPError struct {
+ HTTPStatusCode int
+ HTTPStatus string
+ URL string
+}
+
+// Error implements the error interface for our customer error type.
+func (e *HTTPError) Error() string {
+ return fmt.Sprintf("%s[%d] - Error requesting Traffic Ops %s", e.HTTPStatus, e.HTTPStatusCode, e.URL)
+}
+
+// Result {"response":[{"level":"success","text":"Successfully logged in."}],"version":"1.1"}
+type Result struct {
+ Alerts []Alert
+ Version string `json:"version"`
+}
+
+// Alert ...
+type Alert struct {
+ Level string `json:"level"`
+ Text string `json:"text"`
+}
+
+// CacheEntry ...
+type CacheEntry struct {
+ Entered int64
+ Bytes []byte
+}
+
+// Credentials contains Traffic Ops login credentials
+type Credentials struct {
+ Username string `json:"u"`
+ Password string `json:"p"`
+}
+
+// TODO JvD
+const tmPollingInterval = 60
+
+// loginCreds gathers login credentials for Traffic Ops.
+func loginCreds(toUser string, toPasswd string) ([]byte, error) {
+ credentials := Credentials{
+ Username: toUser,
+ Password: toPasswd,
+ }
+
+ js, err := json.Marshal(credentials)
+ if err != nil {
+ err := fmt.Errorf("Error creating login json: %v", err)
+ return nil, err
+ }
+ return js, nil
+}
+
+func ResumeSession(toURL string, insecure bool) (*Session, error) {
+ options := cookiejar.Options{
+ PublicSuffixList: publicsuffix.List,
+ }
+
+ jar, err := cookiejar.New(&options)
+
+ if err != nil {
+ return nil, err
+ }
+
+ to := Session{
+ UserAgent: &http.Client{
+ Transport: &http.Transport{
+ TLSClientConfig: &tls.Config{InsecureSkipVerify: insecure},
+ },
+ Jar: jar,
+ },
+ URL: toURL,
+ Cache: make(map[string]CacheEntry),
+ }
+
+ resp, err := to.request("GET", "/api/1.2/user/current.json", nil)
+
+ if err != nil {
+ return nil, err
+ }
+
+ jar.Save()
+ fmt.Printf("Traffic Ops Session Resumed (%s)\n", resp.Status)
+
+ return &to, nil
+}
+
+// Login to traffic_ops, the response should set the cookie for this session
+// automatically. Start with
+// to := traffic_ops.Login("user", "passwd", true)
+// subsequent calls like to.GetData("datadeliveryservice") will be authenticated.
+func Login(toURL string, toUser string, toPasswd string, insecure bool) (*Session, error) {
+ credentials, err := loginCreds(toUser, toPasswd)
+ if err != nil {
+ return nil, err
+ }
+
+ options := cookiejar.Options{
+ PublicSuffixList: publicsuffix.List,
+ }
+
+ jar, err := cookiejar.New(&options)
+ if err != nil {
+ return nil, err
+ }
+
+ to := Session{
+ UserAgent: &http.Client{
+ Transport: &http.Transport{
+ TLSClientConfig: &tls.Config{InsecureSkipVerify: insecure},
+ },
+ Jar: jar,
+ },
+ URL: toURL,
+ UserName: toUser,
+ Password: toPasswd,
+ Cache: make(map[string]CacheEntry),
+ }
+
+ path := "/api/1.2/user/login"
+ resp, err := to.request("POST", path, credentials)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+
+ var result Result
+ if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
+ return nil, err
+ }
+
+ success := false
+ for _, alert := range result.Alerts {
+ if alert.Level == "success" && alert.Text == "Successfully logged in." {
+ success = true
+ break
+ }
+ }
+
+ if !success {
+ err := fmt.Errorf("Login failed, result string: %+v", result)
+ return nil, err
+ }
+
+ jar.Save()
+
+ return &to, nil
+}
+
+// request performs the actual HTTP request to Traffic Ops
+func (to *Session) request(method, path string, body []byte) (*http.Response, error) {
+ url := fmt.Sprintf("%s%s", to.URL, path)
+
+ var req *http.Request
+ var err error
+
+ if body != nil && method != "GET" {
+ req, err = http.NewRequest(method, url, bytes.NewBuffer(body))
+ if err != nil {
+ return nil, err
+ }
+ req.Header.Set("Content-Type", "application/json")
+ } else {
+ req, err = http.NewRequest("GET", url, nil)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ resp, err := to.UserAgent.Do(req)
+ if err != nil {
+ return nil, err
+ }
+
+ if resp.StatusCode != http.StatusOK {
+ e := HTTPError{
+ HTTPStatus: resp.Status,
+ HTTPStatusCode: resp.StatusCode,
+ URL: url,
+ }
+ return nil, &e
+ }
+
+ return resp, nil
+}
+
+type CacheHitStatus string
+
+const CacheHitStatusHit = CacheHitStatus("hit")
+const CacheHitStatusExpired = CacheHitStatus("expired")
+const CacheHitStatusMiss = CacheHitStatus("miss")
+const CacheHitStatusInvalid = CacheHitStatus("")
+
+func (s CacheHitStatus) String() string {
+ return string(s)
+}
+
+func StringToCacheHitStatus(s string) CacheHitStatus {
+ s = strings.ToLower(s)
+ switch s {
+ case "hit":
+ return CacheHitStatusHit
+ case "expired":
+ return CacheHitStatusExpired
+ case "miss":
+ return CacheHitStatusMiss
+ default:
+ return CacheHitStatusInvalid
+ }
+}
+
+// getBytesWithTTL - get the path, and cache in the session
+// return from cache is found and the ttl isn't expired, otherwise get it and
+// store it in cache
+func (to *Session) getBytesWithTTL(path string, ttl int64) ([]byte, CacheHitStatus, error) {
+ var body []byte
+ var err error
+ var cacheHitStatus CacheHitStatus
+ getFresh := false
+ if cacheEntry, ok := to.Cache[path]; ok {
+ if cacheEntry.Entered > time.Now().Unix()-ttl {
+ cacheHitStatus = CacheHitStatusHit
+ body = cacheEntry.Bytes
+ } else {
+ cacheHitStatus = CacheHitStatusExpired
+ getFresh = true
+ }
+ } else {
+ to.Cache = make(map[string]CacheEntry)
+ cacheHitStatus = CacheHitStatusMiss
+ getFresh = true
+ }
+
+ if getFresh {
+ body, err = to.getBytes(path)
+ if err != nil {
+ return nil, CacheHitStatusInvalid, err
+ }
+
+ newEntry := CacheEntry{
+ Entered: time.Now().Unix(),
+ Bytes: body,
+ }
+ to.Cache[path] = newEntry
+ }
+
+ return body, cacheHitStatus, nil
+}
+
+// GetBytes - get []bytes array for a certain path on the to session.
+// returns the raw body
+func (to *Session) getBytes(path string) ([]byte, error) {
+ resp, err := to.request("GET", path, nil)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+
+ body, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return nil, err
+ }
+
+ return body, nil
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_router_config.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_router_config.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_router_config.go
new file mode 100644
index 0000000..aecd72d
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/traffic_router_config.go
@@ -0,0 +1,237 @@
+/*
+
+ 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"
+)
+
+// TRConfigResponse ...
+type TRConfigResponse struct {
+ Version string `json:"version"`
+ Response TrafficRouterConfig `json:"response"`
+}
+
+// TrafficRouterConfig is the json unmarshalled without any changes
+// note all structs are local to this file _except_ the TrafficRouterConfig struct.
+type TrafficRouterConfig struct {
+ TrafficServers []TrafficServer `json:"trafficServers,omitempty"`
+ TrafficMonitors []TrafficMonitor `json:"trafficMonitors,omitempty"`
+ TrafficRouters []TrafficRouter `json:"trafficRouters,omitempty"`
+ CacheGroups []TMCacheGroup `json:"cacheGroups,omitempty"`
+ DeliveryServices []TRDeliveryService `json:"deliveryServices,omitempty"`
+ Stats map[string]interface{} `json:"stats,omitempty"`
+ Config map[string]interface{} `json:"config,omitempty"`
+}
+
+// TrafficRouterConfigMap ...
+type TrafficRouterConfigMap struct {
+ TrafficServer map[string]TrafficServer
+ TrafficMonitor map[string]TrafficMonitor
+ TrafficRouter map[string]TrafficRouter
+ CacheGroup map[string]TMCacheGroup
+ DeliveryService map[string]TRDeliveryService
+ Config map[string]interface{}
+ Stat map[string]interface{}
+}
+
+// TrafficServer ...
+type TrafficServer struct {
+ Profile string `json:"profile"`
+ IP string `json:"ip"`
+ Status string `json:"status"`
+ CacheGroup string `json:"cacheGroup"`
+ IP6 string `json:"ip6"`
+ Port int `json:"port"`
+ HostName string `json:"hostName"`
+ FQDN string `json:"fqdn"`
+ InterfaceName string `json:"interfaceName"`
+ Type string `json:"type"`
+ HashID string `json:"hashId"`
+ DeliveryServices []tsdeliveryService `json:"deliveryServices,omitempty"` // the deliveryServices key does not exist on mids
+}
+
+type tsdeliveryService struct {
+ Xmlid string `json:"xmlId"`
+ Remaps []string `json:"remaps"`
+}
+
+// TrafficRouter ...
+type TrafficRouter struct {
+ Port int `json:"port"`
+ IP6 string `json:"ip6"`
+ IP string `json:"ip"`
+ FQDN string `json:"fqdn"`
+ Profile string `json:"profile"`
+ Location string `json:"location"`
+ Status string `json:"status"`
+ APIPort int `json:"apiPort"`
+}
+
+// TMCacheGroup ...
+// !!! Note the lowercase!!! this is local to this file, there's a CacheGroup definition in cachegroup.go!
+type TMCacheGroup struct {
+ Name string `json:"name"`
+ Coordinates Coordinates `json:"coordinates"`
+}
+
+// Coordinates ...
+type Coordinates struct {
+ Latitude float64 `json:"latitude"`
+ Longitude float64 `json:"longitude"`
+}
+
+// TRDeliveryService ...
+// TODO JvD: move to deliveryservice.go ??
+type TRDeliveryService struct {
+ XMLID string `json:"xmlId"`
+ Domains []string `json:"domains"`
+ MissLocation MissLocation `json:"missCoordinates"`
+ CoverageZoneOnly bool `json:"coverageZoneOnly"`
+ MatchSets []MatchSet `json:"matchSets"`
+ TTL int `json:"ttl"`
+ TTLs TTLS `json:"ttls"`
+ BypassDestination BypassDestination `json:"bypassDestination"`
+ StatcDNSEntries []StaticDNS `json:"statitDnsEntries"`
+ Soa SOA `json:"soa"`
+}
+
+// MissLocation ...
+type MissLocation struct {
+ Latitude float64 `json:"latitude"`
+ Longitude float64 `json:"longitudef"`
+}
+
+// MatchSet ...
+type MatchSet struct {
+ Protocol string `json:"protocol"`
+ MatchList []MatchList `json:"matchList"`
+}
+
+// MatchList ...
+type MatchList struct {
+ Regex string `json:"regex"`
+ MatchType string `json:"matchType"`
+}
+
+// BypassDestination ...
+type BypassDestination struct {
+ FQDN string `json:"fqdn"`
+ Type string `json:"type"`
+ Port int `json:"Port"`
+}
+
+// TTLS ...
+type TTLS struct {
+ Arecord int `json:"A"`
+ SoaRecord int `json:"SOA"`
+ NsRecord int `json:"NS"`
+ AaaaRecord int `json:"AAAA"`
+}
+
+// StaticDNS ...
+type StaticDNS struct {
+ Value string `json:"value"`
+ TTL int `json:"ttl"`
+ Name string `json:"name"`
+ Type string `json:"type"`
+}
+
+// SOA ...
+type SOA struct {
+ Admin string `json:"admin"`
+ Retry int `json:"retry"`
+ Minimum int `json:"minimum"`
+ Refresh int `json:"refresh"`
+ Expire int `json:"expire"`
+}
+
+// TrafficRouterConfigMap Deprecated: use GetTrafficRouterConfigMap instead.
+func (to *Session) TrafficRouterConfigMap(cdn string) (*TrafficRouterConfigMap, error) {
+ cfg, _, err := to.GetTrafficRouterConfigMap(cdn)
+ return cfg, err
+}
+
+// TrafficRouterConfigMap gets a bunch of maps
+func (to *Session) GetTrafficRouterConfigMap(cdn string) (*TrafficRouterConfigMap, CacheHitStatus, error) {
+ trConfig, cacheHitStatus, err := to.GetTrafficRouterConfig(cdn)
+ if err != nil {
+ return nil, CacheHitStatusInvalid, err
+ }
+
+ trConfigMap := TRTransformToMap(*trConfig)
+ return &trConfigMap, cacheHitStatus, nil
+}
+
+// TrafficRouterConfig Deprecated: use GetTrafficRouterConfig instead.
+func (to *Session) TrafficRouterConfig(cdn string) (*TrafficRouterConfig, error) {
+ cfg, _, err := to.GetTrafficRouterConfig(cdn)
+ return cfg, err
+}
+
+// GetTrafficRouterConfig gets the json arrays
+func (to *Session) GetTrafficRouterConfig(cdn string) (*TrafficRouterConfig, CacheHitStatus, error) {
+ url := fmt.Sprintf("/api/1.2/cdns/%s/configs/routing.json", cdn)
+ body, cacheHitStatus, err := to.getBytesWithTTL(url, tmPollingInterval)
+ if err != nil {
+ return nil, CacheHitStatusInvalid, err
+ }
+
+ var data TRConfigResponse
+ if err := json.Unmarshal(body, &data); err != nil {
+ return nil, CacheHitStatusInvalid, err
+ }
+ return &data.Response, cacheHitStatus, nil
+}
+
+// TRTransformToMap ...
+func TRTransformToMap(trConfig TrafficRouterConfig) TrafficRouterConfigMap {
+ var tr TrafficRouterConfigMap
+ tr.TrafficServer = make(map[string]TrafficServer)
+ tr.TrafficMonitor = make(map[string]TrafficMonitor)
+ tr.TrafficRouter = make(map[string]TrafficRouter)
+ tr.CacheGroup = make(map[string]TMCacheGroup)
+ tr.DeliveryService = make(map[string]TRDeliveryService)
+ tr.Config = make(map[string]interface{})
+ tr.Stat = make(map[string]interface{})
+
+ for _, trServer := range trConfig.TrafficServers {
+ tr.TrafficServer[trServer.HostName] = trServer
+ }
+ for _, trMonitor := range trConfig.TrafficMonitors {
+ tr.TrafficMonitor[trMonitor.HostName] = trMonitor
+ }
+ for _, trServer := range trConfig.TrafficServers {
+ tr.TrafficServer[trServer.HostName] = trServer
+ }
+ for _, trRouter := range trConfig.TrafficRouters {
+ tr.TrafficRouter[trRouter.FQDN] = trRouter
+ }
+ for _, trCacheGroup := range trConfig.CacheGroups {
+ tr.CacheGroup[trCacheGroup.Name] = trCacheGroup
+ }
+ for _, trDeliveryService := range trConfig.DeliveryServices {
+ tr.DeliveryService[trDeliveryService.XMLID] = trDeliveryService
+ }
+ for trSettingKey, trSettingVal := range trConfig.Config {
+ tr.Config[trSettingKey] = trSettingVal
+ }
+ for trStatKey, trStatVal := range trConfig.Stats {
+ tr.Stat[trStatKey] = trStatVal
+ }
+ return tr
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/type.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/type.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/type.go
new file mode 100644
index 0000000..f8242f3
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/type.go
@@ -0,0 +1,68 @@
+/*
+
+ 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"
+ "errors"
+)
+
+// TypeResponse ...
+type TypeResponse struct {
+ Version string `json:"version"`
+ Response []Type `json:"response"`
+}
+
+// Type contains information about a given Type in Traffic Ops.
+type Type struct {
+ Name string `json:"name,omitempty"`
+ Description string `json:"description,omitempty"`
+ UseInTable string `json:"useInTable,omitempt"`
+}
+
+// Types gets an array of Types.
+// optional parameter: userInTable
+func (to *Session) Types(useInTable ...string) ([]Type, error) {
+
+ if len(useInTable) > 1 {
+ return nil, errors.New("Please pass in a single value for the 'useInTable' parameter")
+ }
+
+ url := "/api/1.2/types.json"
+ resp, err := to.request("GET", url, nil)
+ if err != nil {
+ return nil, err
+ }
+ resp.Body.Close()
+
+ var data TypeResponse
+ if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
+ return nil, err
+ }
+
+ var types []Type
+ for _, d := range data.Response {
+ if useInTable != nil {
+ if d.UseInTable == useInTable[0] {
+ types = append(types, d)
+ }
+ } else {
+ types = append(types, d)
+ }
+ }
+
+ return types, nil
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/user.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/user.go b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/user.go
new file mode 100644
index 0000000..2819eab
--- /dev/null
+++ b/traffic_stats/vendor/github.com/apache/incubator-trafficcontrol/traffic_ops/client/user.go
@@ -0,0 +1,56 @@
+/*
+
+ 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"
+
+// UserResponse ...
+type UserResponse struct {
+ Version string `json:"version"`
+ Response []User `json:"response"`
+}
+
+// User contains information about a given user in Traffic Ops.
+type User struct {
+ Username string `json:"username,omitempty"`
+ PublicSSHKey string `json:"publicSshKey,omitempty"`
+ Role string `json:"role,omitempty"`
+ RoleName string `json:"rolename,omitempty"`
+ UID string `json:"uid,omitempty"`
+ GID string `json:"gid,omitempty"`
+ Company string `json:"company,omitempty"`
+ Email string `json:"email,omitempty"`
+ FullName string `json:"fullName,omitempty"`
+ NewUser bool `json:"newUser,omitempty"`
+ LastUpdated string `json:"lastUpdated,omitempty"`
+}
+
+// Users gets an array of Users.
+func (to *Session) Users() ([]User, error) {
+ url := "/api/1.2/users.json"
+ resp, err := to.request("GET", url, nil)
+ if err != nil {
+ return nil, err
+ }
+ resp.Body.Close()
+
+ var data UserResponse
+ if err := json.NewDecoder(resp.Body).Decode(&data.Response); 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/cihub/seelog
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/cihub/seelog b/traffic_stats/vendor/github.com/cihub/seelog
new file mode 160000
index 0000000..175e6e3
--- /dev/null
+++ b/traffic_stats/vendor/github.com/cihub/seelog
@@ -0,0 +1 @@
+Subproject commit 175e6e3d439fe2e1cee7ab652b12eb546c145a13
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/client.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/client.go b/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/client.go
new file mode 100644
index 0000000..4d0ce60
--- /dev/null
+++ b/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/client.go
@@ -0,0 +1,526 @@
+// Package client (v2) is the current official Go client for InfluxDB.
+package client // import "github.com/influxdata/influxdb/client/v2"
+
+import (
+ "bytes"
+ "crypto/tls"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "io/ioutil"
+ "net/http"
+ "net/url"
+ "time"
+
+ "github.com/influxdata/influxdb/models"
+)
+
+// HTTPConfig is the config data needed to create an HTTP Client.
+type HTTPConfig struct {
+ // Addr should be of the form "http://host:port"
+ // or "http://[ipv6-host%zone]:port".
+ Addr string
+
+ // Username is the influxdb username, optional.
+ Username string
+
+ // Password is the influxdb password, optional.
+ Password string
+
+ // UserAgent is the http User Agent, defaults to "InfluxDBClient".
+ UserAgent string
+
+ // Timeout for influxdb writes, defaults to no timeout.
+ Timeout time.Duration
+
+ // InsecureSkipVerify gets passed to the http client, if true, it will
+ // skip https certificate verification. Defaults to false.
+ InsecureSkipVerify bool
+
+ // TLSConfig allows the user to set their own TLS config for the HTTP
+ // Client. If set, this option overrides InsecureSkipVerify.
+ TLSConfig *tls.Config
+}
+
+// BatchPointsConfig is the config data needed to create an instance of the BatchPoints struct.
+type BatchPointsConfig struct {
+ // Precision is the write precision of the points, defaults to "ns".
+ Precision string
+
+ // Database is the database to write points to.
+ Database string
+
+ // RetentionPolicy is the retention policy of the points.
+ RetentionPolicy string
+
+ // Write consistency is the number of servers required to confirm write.
+ WriteConsistency string
+}
+
+// Client is a client interface for writing & querying the database.
+type Client interface {
+ // Ping checks that status of cluster, and will always return 0 time and no
+ // error for UDP clients.
+ Ping(timeout time.Duration) (time.Duration, string, error)
+
+ // Write takes a BatchPoints object and writes all Points to InfluxDB.
+ Write(bp BatchPoints) error
+
+ // Query makes an InfluxDB Query on the database. This will fail if using
+ // the UDP client.
+ Query(q Query) (*Response, error)
+
+ // Close releases any resources a Client may be using.
+ Close() error
+}
+
+// NewHTTPClient returns a new Client from the provided config.
+// Client is safe for concurrent use by multiple goroutines.
+func NewHTTPClient(conf HTTPConfig) (Client, error) {
+ if conf.UserAgent == "" {
+ conf.UserAgent = "InfluxDBClient"
+ }
+
+ u, err := url.Parse(conf.Addr)
+ if err != nil {
+ return nil, err
+ } else if u.Scheme != "http" && u.Scheme != "https" {
+ m := fmt.Sprintf("Unsupported protocol scheme: %s, your address"+
+ " must start with http:// or https://", u.Scheme)
+ return nil, errors.New(m)
+ }
+
+ tr := &http.Transport{
+ TLSClientConfig: &tls.Config{
+ InsecureSkipVerify: conf.InsecureSkipVerify,
+ },
+ }
+ if conf.TLSConfig != nil {
+ tr.TLSClientConfig = conf.TLSConfig
+ }
+ return &client{
+ url: *u,
+ username: conf.Username,
+ password: conf.Password,
+ useragent: conf.UserAgent,
+ httpClient: &http.Client{
+ Timeout: conf.Timeout,
+ Transport: tr,
+ },
+ transport: tr,
+ }, nil
+}
+
+// Ping will check to see if the server is up with an optional timeout on waiting for leader.
+// Ping returns how long the request took, the version of the server it connected to, and an error if one occurred.
+func (c *client) Ping(timeout time.Duration) (time.Duration, string, error) {
+ now := time.Now()
+ u := c.url
+ u.Path = "ping"
+
+ req, err := http.NewRequest("GET", u.String(), nil)
+ if err != nil {
+ return 0, "", err
+ }
+
+ req.Header.Set("User-Agent", c.useragent)
+
+ if c.username != "" {
+ req.SetBasicAuth(c.username, c.password)
+ }
+
+ if timeout > 0 {
+ params := req.URL.Query()
+ params.Set("wait_for_leader", fmt.Sprintf("%.0fs", timeout.Seconds()))
+ req.URL.RawQuery = params.Encode()
+ }
+
+ resp, err := c.httpClient.Do(req)
+ if err != nil {
+ return 0, "", err
+ }
+ defer resp.Body.Close()
+
+ body, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return 0, "", err
+ }
+
+ if resp.StatusCode != http.StatusNoContent {
+ var err = fmt.Errorf(string(body))
+ return 0, "", err
+ }
+
+ version := resp.Header.Get("X-Influxdb-Version")
+ return time.Since(now), version, nil
+}
+
+// Close releases the client's resources.
+func (c *client) Close() error {
+ c.transport.CloseIdleConnections()
+ return nil
+}
+
+// client is safe for concurrent use as the fields are all read-only
+// once the client is instantiated.
+type client struct {
+ // N.B - if url.UserInfo is accessed in future modifications to the
+ // methods on client, you will need to syncronise access to url.
+ url url.URL
+ username string
+ password string
+ useragent string
+ httpClient *http.Client
+ transport *http.Transport
+}
+
+// BatchPoints is an interface into a batched grouping of points to write into
+// InfluxDB together. BatchPoints is NOT thread-safe, you must create a separate
+// batch for each goroutine.
+type BatchPoints interface {
+ // AddPoint adds the given point to the Batch of points.
+ AddPoint(p *Point)
+ // AddPoints adds the given points to the Batch of points.
+ AddPoints(ps []*Point)
+ // Points lists the points in the Batch.
+ Points() []*Point
+
+ // Precision returns the currently set precision of this Batch.
+ Precision() string
+ // SetPrecision sets the precision of this batch.
+ SetPrecision(s string) error
+
+ // Database returns the currently set database of this Batch.
+ Database() string
+ // SetDatabase sets the database of this Batch.
+ SetDatabase(s string)
+
+ // WriteConsistency returns the currently set write consistency of this Batch.
+ WriteConsistency() string
+ // SetWriteConsistency sets the write consistency of this Batch.
+ SetWriteConsistency(s string)
+
+ // RetentionPolicy returns the currently set retention policy of this Batch.
+ RetentionPolicy() string
+ // SetRetentionPolicy sets the retention policy of this Batch.
+ SetRetentionPolicy(s string)
+}
+
+// NewBatchPoints returns a BatchPoints interface based on the given config.
+func NewBatchPoints(conf BatchPointsConfig) (BatchPoints, error) {
+ if conf.Precision == "" {
+ conf.Precision = "ns"
+ }
+ if _, err := time.ParseDuration("1" + conf.Precision); err != nil {
+ return nil, err
+ }
+ bp := &batchpoints{
+ database: conf.Database,
+ precision: conf.Precision,
+ retentionPolicy: conf.RetentionPolicy,
+ writeConsistency: conf.WriteConsistency,
+ }
+ return bp, nil
+}
+
+type batchpoints struct {
+ points []*Point
+ database string
+ precision string
+ retentionPolicy string
+ writeConsistency string
+}
+
+func (bp *batchpoints) AddPoint(p *Point) {
+ bp.points = append(bp.points, p)
+}
+
+func (bp *batchpoints) AddPoints(ps []*Point) {
+ bp.points = append(bp.points, ps...)
+}
+
+func (bp *batchpoints) Points() []*Point {
+ return bp.points
+}
+
+func (bp *batchpoints) Precision() string {
+ return bp.precision
+}
+
+func (bp *batchpoints) Database() string {
+ return bp.database
+}
+
+func (bp *batchpoints) WriteConsistency() string {
+ return bp.writeConsistency
+}
+
+func (bp *batchpoints) RetentionPolicy() string {
+ return bp.retentionPolicy
+}
+
+func (bp *batchpoints) SetPrecision(p string) error {
+ if _, err := time.ParseDuration("1" + p); err != nil {
+ return err
+ }
+ bp.precision = p
+ return nil
+}
+
+func (bp *batchpoints) SetDatabase(db string) {
+ bp.database = db
+}
+
+func (bp *batchpoints) SetWriteConsistency(wc string) {
+ bp.writeConsistency = wc
+}
+
+func (bp *batchpoints) SetRetentionPolicy(rp string) {
+ bp.retentionPolicy = rp
+}
+
+// Point represents a single data point.
+type Point struct {
+ pt models.Point
+}
+
+// NewPoint returns a point with the given timestamp. If a timestamp is not
+// given, then data is sent to the database without a timestamp, in which case
+// the server will assign local time upon reception. NOTE: it is recommended to
+// send data with a timestamp.
+func NewPoint(
+ name string,
+ tags map[string]string,
+ fields map[string]interface{},
+ t ...time.Time,
+) (*Point, error) {
+ var T time.Time
+ if len(t) > 0 {
+ T = t[0]
+ }
+
+ pt, err := models.NewPoint(name, models.NewTags(tags), fields, T)
+ if err != nil {
+ return nil, err
+ }
+ return &Point{
+ pt: pt,
+ }, nil
+}
+
+// String returns a line-protocol string of the Point.
+func (p *Point) String() string {
+ return p.pt.String()
+}
+
+// PrecisionString returns a line-protocol string of the Point,
+// with the timestamp formatted for the given precision.
+func (p *Point) PrecisionString(precison string) string {
+ return p.pt.PrecisionString(precison)
+}
+
+// Name returns the measurement name of the point.
+func (p *Point) Name() string {
+ return p.pt.Name()
+}
+
+// Tags returns the tags associated with the point.
+func (p *Point) Tags() map[string]string {
+ return p.pt.Tags().Map()
+}
+
+// Time return the timestamp for the point.
+func (p *Point) Time() time.Time {
+ return p.pt.Time()
+}
+
+// UnixNano returns timestamp of the point in nanoseconds since Unix epoch.
+func (p *Point) UnixNano() int64 {
+ return p.pt.UnixNano()
+}
+
+// Fields returns the fields for the point.
+func (p *Point) Fields() (map[string]interface{}, error) {
+ return p.pt.Fields()
+}
+
+// NewPointFrom returns a point from the provided models.Point.
+func NewPointFrom(pt models.Point) *Point {
+ return &Point{pt: pt}
+}
+
+func (c *client) Write(bp BatchPoints) error {
+ var b bytes.Buffer
+
+ for _, p := range bp.Points() {
+ if _, err := b.WriteString(p.pt.PrecisionString(bp.Precision())); err != nil {
+ return err
+ }
+
+ if err := b.WriteByte('\n'); err != nil {
+ return err
+ }
+ }
+
+ u := c.url
+ u.Path = "write"
+ req, err := http.NewRequest("POST", u.String(), &b)
+ if err != nil {
+ return err
+ }
+ req.Header.Set("Content-Type", "")
+ req.Header.Set("User-Agent", c.useragent)
+ if c.username != "" {
+ req.SetBasicAuth(c.username, c.password)
+ }
+
+ params := req.URL.Query()
+ params.Set("db", bp.Database())
+ params.Set("rp", bp.RetentionPolicy())
+ params.Set("precision", bp.Precision())
+ params.Set("consistency", bp.WriteConsistency())
+ req.URL.RawQuery = params.Encode()
+
+ resp, err := c.httpClient.Do(req)
+ if err != nil {
+ return err
+ }
+ defer resp.Body.Close()
+
+ body, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return err
+ }
+
+ if resp.StatusCode != http.StatusNoContent && resp.StatusCode != http.StatusOK {
+ var err = fmt.Errorf(string(body))
+ return err
+ }
+
+ return nil
+}
+
+// Query defines a query to send to the server.
+type Query struct {
+ Command string
+ Database string
+ Precision string
+ Parameters map[string]interface{}
+}
+
+// NewQuery returns a query object.
+// The database and precision arguments can be empty strings if they are not needed for the query.
+func NewQuery(command, database, precision string) Query {
+ return Query{
+ Command: command,
+ Database: database,
+ Precision: precision,
+ Parameters: make(map[string]interface{}),
+ }
+}
+
+// NewQueryWithParameters returns a query object.
+// The database and precision arguments can be empty strings if they are not needed for the query.
+// parameters is a map of the parameter names used in the command to their values.
+func NewQueryWithParameters(command, database, precision string, parameters map[string]interface{}) Query {
+ return Query{
+ Command: command,
+ Database: database,
+ Precision: precision,
+ Parameters: parameters,
+ }
+}
+
+// Response represents a list of statement results.
+type Response struct {
+ Results []Result
+ Err string `json:"error,omitempty"`
+}
+
+// Error returns the first error from any statement.
+// It returns nil if no errors occurred on any statements.
+func (r *Response) Error() error {
+ if r.Err != "" {
+ return fmt.Errorf(r.Err)
+ }
+ for _, result := range r.Results {
+ if result.Err != "" {
+ return fmt.Errorf(result.Err)
+ }
+ }
+ return nil
+}
+
+// Message represents a user message.
+type Message struct {
+ Level string
+ Text string
+}
+
+// Result represents a resultset returned from a single statement.
+type Result struct {
+ Series []models.Row
+ Messages []*Message
+ Err string `json:"error,omitempty"`
+}
+
+// Query sends a command to the server and returns the Response.
+func (c *client) Query(q Query) (*Response, error) {
+ u := c.url
+ u.Path = "query"
+
+ jsonParameters, err := json.Marshal(q.Parameters)
+
+ if err != nil {
+ return nil, err
+ }
+
+ req, err := http.NewRequest("POST", u.String(), nil)
+ if err != nil {
+ return nil, err
+ }
+
+ req.Header.Set("Content-Type", "")
+ req.Header.Set("User-Agent", c.useragent)
+
+ if c.username != "" {
+ req.SetBasicAuth(c.username, c.password)
+ }
+
+ params := req.URL.Query()
+ params.Set("q", q.Command)
+ params.Set("db", q.Database)
+ params.Set("params", string(jsonParameters))
+
+ if q.Precision != "" {
+ params.Set("epoch", q.Precision)
+ }
+ req.URL.RawQuery = params.Encode()
+
+ resp, err := c.httpClient.Do(req)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+
+ var response Response
+ dec := json.NewDecoder(resp.Body)
+ dec.UseNumber()
+ decErr := dec.Decode(&response)
+
+ // ignore this error if we got an invalid status code
+ if decErr != nil && decErr.Error() == "EOF" && resp.StatusCode != http.StatusOK {
+ decErr = nil
+ }
+ // If we got a valid decode error, send that back
+ if decErr != nil {
+ return nil, fmt.Errorf("unable to decode json: received status code %d err: %s", resp.StatusCode, decErr)
+ }
+ // If we don't have an error in our json response, and didn't get statusOK
+ // then send back an error
+ if resp.StatusCode != http.StatusOK && response.Error() == nil {
+ return &response, fmt.Errorf("received status code %d from server",
+ resp.StatusCode)
+ }
+ return &response, nil
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/client_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/client_test.go b/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/client_test.go
new file mode 100644
index 0000000..d27c162
--- /dev/null
+++ b/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/client_test.go
@@ -0,0 +1,525 @@
+package client
+
+import (
+ "encoding/json"
+ "net/http"
+ "net/http/httptest"
+ "reflect"
+ "strings"
+ "sync"
+ "testing"
+ "time"
+)
+
+func TestUDPClient_Query(t *testing.T) {
+ config := UDPConfig{Addr: "localhost:8089"}
+ c, err := NewUDPClient(config)
+ if err != nil {
+ t.Errorf("unexpected error. expected %v, actual %v", nil, err)
+ }
+ defer c.Close()
+ query := Query{}
+ _, err = c.Query(query)
+ if err == nil {
+ t.Error("Querying UDP client should fail")
+ }
+}
+
+func TestUDPClient_Ping(t *testing.T) {
+ config := UDPConfig{Addr: "localhost:8089"}
+ c, err := NewUDPClient(config)
+ if err != nil {
+ t.Errorf("unexpected error. expected %v, actual %v", nil, err)
+ }
+ defer c.Close()
+
+ rtt, version, err := c.Ping(0)
+ if rtt != 0 || version != "" || err != nil {
+ t.Errorf("unexpected error. expected (%v, '%v', %v), actual (%v, '%v', %v)", 0, "", nil, rtt, version, err)
+ }
+}
+
+func TestUDPClient_Write(t *testing.T) {
+ config := UDPConfig{Addr: "localhost:8089"}
+ c, err := NewUDPClient(config)
+ if err != nil {
+ t.Errorf("unexpected error. expected %v, actual %v", nil, err)
+ }
+ defer c.Close()
+
+ bp, err := NewBatchPoints(BatchPointsConfig{})
+ if err != nil {
+ t.Errorf("unexpected error. expected %v, actual %v", nil, err)
+ }
+
+ fields := make(map[string]interface{})
+ fields["value"] = 1.0
+ pt, _ := NewPoint("cpu", make(map[string]string), fields)
+ bp.AddPoint(pt)
+
+ err = c.Write(bp)
+ if err != nil {
+ t.Errorf("unexpected error. expected %v, actual %v", nil, err)
+ }
+}
+
+func TestUDPClient_BadAddr(t *testing.T) {
+ config := UDPConfig{Addr: "foobar@wahoo"}
+ c, err := NewUDPClient(config)
+ if err == nil {
+ defer c.Close()
+ t.Error("Expected resolve error")
+ }
+}
+
+func TestUDPClient_Batches(t *testing.T) {
+ var logger writeLogger
+ var cl udpclient
+
+ cl.conn = &logger
+ cl.payloadSize = 20 // should allow for two points per batch
+
+ // expected point should look like this: "cpu a=1i"
+ fields := map[string]interface{}{"a": 1}
+
+ p, _ := NewPoint("cpu", nil, fields, time.Time{})
+
+ bp, _ := NewBatchPoints(BatchPointsConfig{})
+
+ for i := 0; i < 9; i++ {
+ bp.AddPoint(p)
+ }
+
+ if err := cl.Write(bp); err != nil {
+ t.Fatalf("Unexpected error during Write: %v", err)
+ }
+
+ if len(logger.writes) != 5 {
+ t.Errorf("Mismatched write count: got %v, exp %v", len(logger.writes), 5)
+ }
+}
+
+func TestUDPClient_Split(t *testing.T) {
+ var logger writeLogger
+ var cl udpclient
+
+ cl.conn = &logger
+ cl.payloadSize = 1 // force one field per point
+
+ fields := map[string]interface{}{"a": 1, "b": 2, "c": 3, "d": 4}
+
+ p, _ := NewPoint("cpu", nil, fields, time.Unix(1, 0))
+
+ bp, _ := NewBatchPoints(BatchPointsConfig{})
+
+ bp.AddPoint(p)
+
+ if err := cl.Write(bp); err != nil {
+ t.Fatalf("Unexpected error during Write: %v", err)
+ }
+
+ if len(logger.writes) != len(fields) {
+ t.Errorf("Mismatched write count: got %v, exp %v", len(logger.writes), len(fields))
+ }
+}
+
+type writeLogger struct {
+ writes [][]byte
+}
+
+func (w *writeLogger) Write(b []byte) (int, error) {
+ w.writes = append(w.writes, append([]byte(nil), b...))
+ return len(b), nil
+}
+
+func (w *writeLogger) Close() error { return nil }
+
+func TestClient_Query(t *testing.T) {
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ var data Response
+ w.WriteHeader(http.StatusOK)
+ _ = json.NewEncoder(w).Encode(data)
+ }))
+ defer ts.Close()
+
+ config := HTTPConfig{Addr: ts.URL}
+ c, _ := NewHTTPClient(config)
+ defer c.Close()
+
+ query := Query{}
+ _, err := c.Query(query)
+ if err != nil {
+ t.Errorf("unexpected error. expected %v, actual %v", nil, err)
+ }
+}
+
+func TestClient_BoundParameters(t *testing.T) {
+ var parameterString string
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ var data Response
+ r.ParseForm()
+ parameterString = r.FormValue("params")
+ w.WriteHeader(http.StatusOK)
+ _ = json.NewEncoder(w).Encode(data)
+ }))
+ defer ts.Close()
+
+ config := HTTPConfig{Addr: ts.URL}
+ c, _ := NewHTTPClient(config)
+ defer c.Close()
+
+ expectedParameters := map[string]interface{}{
+ "testStringParameter": "testStringValue",
+ "testNumberParameter": 12.3,
+ }
+
+ query := Query{
+ Parameters: expectedParameters,
+ }
+
+ _, err := c.Query(query)
+ if err != nil {
+ t.Errorf("unexpected error. expected %v, actual %v", nil, err)
+ }
+
+ var actualParameters map[string]interface{}
+
+ err = json.Unmarshal([]byte(parameterString), &actualParameters)
+ if err != nil {
+ t.Errorf("unexpected error. expected %v, actual %v", nil, err)
+ }
+
+ if !reflect.DeepEqual(expectedParameters, actualParameters) {
+ t.Errorf("unexpected parameters. expected %v, actual %v", expectedParameters, actualParameters)
+ }
+}
+
+func TestClient_BasicAuth(t *testing.T) {
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ u, p, ok := r.BasicAuth()
+
+ if !ok {
+ t.Errorf("basic auth error")
+ }
+ if u != "username" {
+ t.Errorf("unexpected username, expected %q, actual %q", "username", u)
+ }
+ if p != "password" {
+ t.Errorf("unexpected password, expected %q, actual %q", "password", p)
+ }
+ var data Response
+ w.WriteHeader(http.StatusOK)
+ _ = json.NewEncoder(w).Encode(data)
+ }))
+ defer ts.Close()
+
+ config := HTTPConfig{Addr: ts.URL, Username: "username", Password: "password"}
+ c, _ := NewHTTPClient(config)
+ defer c.Close()
+
+ query := Query{}
+ _, err := c.Query(query)
+ if err != nil {
+ t.Errorf("unexpected error. expected %v, actual %v", nil, err)
+ }
+}
+
+func TestClient_Ping(t *testing.T) {
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ var data Response
+ w.WriteHeader(http.StatusNoContent)
+ _ = json.NewEncoder(w).Encode(data)
+ }))
+ defer ts.Close()
+
+ config := HTTPConfig{Addr: ts.URL}
+ c, _ := NewHTTPClient(config)
+ defer c.Close()
+
+ _, _, err := c.Ping(0)
+ if err != nil {
+ t.Errorf("unexpected error. expected %v, actual %v", nil, err)
+ }
+}
+
+func TestClient_Concurrent_Use(t *testing.T) {
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(http.StatusOK)
+ w.Write([]byte(`{}`))
+ }))
+ defer ts.Close()
+
+ config := HTTPConfig{Addr: ts.URL}
+ c, _ := NewHTTPClient(config)
+ defer c.Close()
+
+ var wg sync.WaitGroup
+ wg.Add(3)
+ n := 1000
+
+ go func() {
+ defer wg.Done()
+ bp, err := NewBatchPoints(BatchPointsConfig{})
+ if err != nil {
+ t.Errorf("got error %v", err)
+ }
+
+ for i := 0; i < n; i++ {
+ if err = c.Write(bp); err != nil {
+ t.Fatalf("got error %v", err)
+ }
+ }
+ }()
+
+ go func() {
+ defer wg.Done()
+ var q Query
+ for i := 0; i < n; i++ {
+ if _, err := c.Query(q); err != nil {
+ t.Fatalf("got error %v", err)
+ }
+ }
+ }()
+
+ go func() {
+ defer wg.Done()
+ for i := 0; i < n; i++ {
+ c.Ping(time.Second)
+ }
+ }()
+ wg.Wait()
+}
+
+func TestClient_Write(t *testing.T) {
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ var data Response
+ w.WriteHeader(http.StatusNoContent)
+ _ = json.NewEncoder(w).Encode(data)
+ }))
+ defer ts.Close()
+
+ config := HTTPConfig{Addr: ts.URL}
+ c, _ := NewHTTPClient(config)
+ defer c.Close()
+
+ bp, err := NewBatchPoints(BatchPointsConfig{})
+ if err != nil {
+ t.Errorf("unexpected error. expected %v, actual %v", nil, err)
+ }
+ err = c.Write(bp)
+ if err != nil {
+ t.Errorf("unexpected error. expected %v, actual %v", nil, err)
+ }
+}
+
+func TestClient_UserAgent(t *testing.T) {
+ receivedUserAgent := ""
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ receivedUserAgent = r.UserAgent()
+
+ var data Response
+ w.WriteHeader(http.StatusOK)
+ _ = json.NewEncoder(w).Encode(data)
+ }))
+ defer ts.Close()
+
+ _, err := http.Get(ts.URL)
+ if err != nil {
+ t.Errorf("unexpected error. expected %v, actual %v", nil, err)
+ }
+
+ tests := []struct {
+ name string
+ userAgent string
+ expected string
+ }{
+ {
+ name: "Empty user agent",
+ userAgent: "",
+ expected: "InfluxDBClient",
+ },
+ {
+ name: "Custom user agent",
+ userAgent: "Test Influx Client",
+ expected: "Test Influx Client",
+ },
+ }
+
+ for _, test := range tests {
+
+ config := HTTPConfig{Addr: ts.URL, UserAgent: test.userAgent}
+ c, _ := NewHTTPClient(config)
+ defer c.Close()
+
+ receivedUserAgent = ""
+ query := Query{}
+ _, err = c.Query(query)
+ if err != nil {
+ t.Errorf("unexpected error. expected %v, actual %v", nil, err)
+ }
+ if !strings.HasPrefix(receivedUserAgent, test.expected) {
+ t.Errorf("Unexpected user agent. expected %v, actual %v", test.expected, receivedUserAgent)
+ }
+
+ receivedUserAgent = ""
+ bp, _ := NewBatchPoints(BatchPointsConfig{})
+ err = c.Write(bp)
+ if err != nil {
+ t.Errorf("unexpected error. expected %v, actual %v", nil, err)
+ }
+ if !strings.HasPrefix(receivedUserAgent, test.expected) {
+ t.Errorf("Unexpected user agent. expected %v, actual %v", test.expected, receivedUserAgent)
+ }
+
+ receivedUserAgent = ""
+ _, err := c.Query(query)
+ if err != nil {
+ t.Errorf("unexpected error. expected %v, actual %v", nil, err)
+ }
+ if receivedUserAgent != test.expected {
+ t.Errorf("Unexpected user agent. expected %v, actual %v", test.expected, receivedUserAgent)
+ }
+ }
+}
+
+func TestClient_PointString(t *testing.T) {
+ const shortForm = "2006-Jan-02"
+ time1, _ := time.Parse(shortForm, "2013-Feb-03")
+ tags := map[string]string{"cpu": "cpu-total"}
+ fields := map[string]interface{}{"idle": 10.1, "system": 50.9, "user": 39.0}
+ p, _ := NewPoint("cpu_usage", tags, fields, time1)
+
+ s := "cpu_usage,cpu=cpu-total idle=10.1,system=50.9,user=39 1359849600000000000"
+ if p.String() != s {
+ t.Errorf("Point String Error, got %s, expected %s", p.String(), s)
+ }
+
+ s = "cpu_usage,cpu=cpu-total idle=10.1,system=50.9,user=39 1359849600000"
+ if p.PrecisionString("ms") != s {
+ t.Errorf("Point String Error, got %s, expected %s",
+ p.PrecisionString("ms"), s)
+ }
+}
+
+func TestClient_PointWithoutTimeString(t *testing.T) {
+ tags := map[string]string{"cpu": "cpu-total"}
+ fields := map[string]interface{}{"idle": 10.1, "system": 50.9, "user": 39.0}
+ p, _ := NewPoint("cpu_usage", tags, fields)
+
+ s := "cpu_usage,cpu=cpu-total idle=10.1,system=50.9,user=39"
+ if p.String() != s {
+ t.Errorf("Point String Error, got %s, expected %s", p.String(), s)
+ }
+
+ if p.PrecisionString("ms") != s {
+ t.Errorf("Point String Error, got %s, expected %s",
+ p.PrecisionString("ms"), s)
+ }
+}
+
+func TestClient_PointName(t *testing.T) {
+ tags := map[string]string{"cpu": "cpu-total"}
+ fields := map[string]interface{}{"idle": 10.1, "system": 50.9, "user": 39.0}
+ p, _ := NewPoint("cpu_usage", tags, fields)
+
+ exp := "cpu_usage"
+ if p.Name() != exp {
+ t.Errorf("Error, got %s, expected %s",
+ p.Name(), exp)
+ }
+}
+
+func TestClient_PointTags(t *testing.T) {
+ tags := map[string]string{"cpu": "cpu-total"}
+ fields := map[string]interface{}{"idle": 10.1, "system": 50.9, "user": 39.0}
+ p, _ := NewPoint("cpu_usage", tags, fields)
+
+ if !reflect.DeepEqual(tags, p.Tags()) {
+ t.Errorf("Error, got %v, expected %v",
+ p.Tags(), tags)
+ }
+}
+
+func TestClient_PointUnixNano(t *testing.T) {
+ const shortForm = "2006-Jan-02"
+ time1, _ := time.Parse(shortForm, "2013-Feb-03")
+ tags := map[string]string{"cpu": "cpu-total"}
+ fields := map[string]interface{}{"idle": 10.1, "system": 50.9, "user": 39.0}
+ p, _ := NewPoint("cpu_usage", tags, fields, time1)
+
+ exp := int64(1359849600000000000)
+ if p.UnixNano() != exp {
+ t.Errorf("Error, got %d, expected %d",
+ p.UnixNano(), exp)
+ }
+}
+
+func TestClient_PointFields(t *testing.T) {
+ tags := map[string]string{"cpu": "cpu-total"}
+ fields := map[string]interface{}{"idle": 10.1, "system": 50.9, "user": 39.0}
+ p, _ := NewPoint("cpu_usage", tags, fields)
+
+ pfields, err := p.Fields()
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !reflect.DeepEqual(fields, pfields) {
+ t.Errorf("Error, got %v, expected %v",
+ pfields, fields)
+ }
+}
+
+func TestBatchPoints_PrecisionError(t *testing.T) {
+ _, err := NewBatchPoints(BatchPointsConfig{Precision: "foobar"})
+ if err == nil {
+ t.Errorf("Precision: foobar should have errored")
+ }
+
+ bp, _ := NewBatchPoints(BatchPointsConfig{Precision: "ns"})
+ err = bp.SetPrecision("foobar")
+ if err == nil {
+ t.Errorf("Precision: foobar should have errored")
+ }
+}
+
+func TestBatchPoints_SettersGetters(t *testing.T) {
+ bp, _ := NewBatchPoints(BatchPointsConfig{
+ Precision: "ns",
+ Database: "db",
+ RetentionPolicy: "rp",
+ WriteConsistency: "wc",
+ })
+ if bp.Precision() != "ns" {
+ t.Errorf("Expected: %s, got %s", bp.Precision(), "ns")
+ }
+ if bp.Database() != "db" {
+ t.Errorf("Expected: %s, got %s", bp.Database(), "db")
+ }
+ if bp.RetentionPolicy() != "rp" {
+ t.Errorf("Expected: %s, got %s", bp.RetentionPolicy(), "rp")
+ }
+ if bp.WriteConsistency() != "wc" {
+ t.Errorf("Expected: %s, got %s", bp.WriteConsistency(), "wc")
+ }
+
+ bp.SetDatabase("db2")
+ bp.SetRetentionPolicy("rp2")
+ bp.SetWriteConsistency("wc2")
+ err := bp.SetPrecision("s")
+ if err != nil {
+ t.Errorf("Did not expect error: %s", err.Error())
+ }
+
+ if bp.Precision() != "s" {
+ t.Errorf("Expected: %s, got %s", bp.Precision(), "s")
+ }
+ if bp.Database() != "db2" {
+ t.Errorf("Expected: %s, got %s", bp.Database(), "db2")
+ }
+ if bp.RetentionPolicy() != "rp2" {
+ t.Errorf("Expected: %s, got %s", bp.RetentionPolicy(), "rp2")
+ }
+ if bp.WriteConsistency() != "wc2" {
+ t.Errorf("Expected: %s, got %s", bp.WriteConsistency(), "wc2")
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/example_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/example_test.go b/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/example_test.go
new file mode 100644
index 0000000..68bb24b
--- /dev/null
+++ b/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/example_test.go
@@ -0,0 +1,265 @@
+package client_test
+
+import (
+ "fmt"
+ "math/rand"
+ "os"
+ "time"
+
+ "github.com/influxdata/influxdb/client/v2"
+)
+
+// Create a new client
+func ExampleClient() {
+ // NOTE: this assumes you've setup a user and have setup shell env variables,
+ // namely INFLUX_USER/INFLUX_PWD. If not just omit Username/Password below.
+ _, err := client.NewHTTPClient(client.HTTPConfig{
+ Addr: "http://localhost:8086",
+ Username: os.Getenv("INFLUX_USER"),
+ Password: os.Getenv("INFLUX_PWD"),
+ })
+ if err != nil {
+ fmt.Println("Error creating InfluxDB Client: ", err.Error())
+ }
+}
+
+// Write a point using the UDP client
+func ExampleClient_uDP() {
+ // Make client
+ config := client.UDPConfig{Addr: "localhost:8089"}
+ c, err := client.NewUDPClient(config)
+ if err != nil {
+ fmt.Println("Error: ", err.Error())
+ }
+ defer c.Close()
+
+ // Create a new point batch
+ bp, _ := client.NewBatchPoints(client.BatchPointsConfig{
+ Precision: "s",
+ })
+
+ // Create a point and add to batch
+ tags := map[string]string{"cpu": "cpu-total"}
+ fields := map[string]interface{}{
+ "idle": 10.1,
+ "system": 53.3,
+ "user": 46.6,
+ }
+ pt, err := client.NewPoint("cpu_usage", tags, fields, time.Now())
+ if err != nil {
+ fmt.Println("Error: ", err.Error())
+ }
+ bp.AddPoint(pt)
+
+ // Write the batch
+ c.Write(bp)
+}
+
+// Ping the cluster using the HTTP client
+func ExampleClient_Ping() {
+ // Make client
+ c, err := client.NewHTTPClient(client.HTTPConfig{
+ Addr: "http://localhost:8086",
+ })
+ if err != nil {
+ fmt.Println("Error creating InfluxDB Client: ", err.Error())
+ }
+ defer c.Close()
+
+ _, _, err = c.Ping(0)
+ if err != nil {
+ fmt.Println("Error pinging InfluxDB Cluster: ", err.Error())
+ }
+}
+
+// Write a point using the HTTP client
+func ExampleClient_write() {
+ // Make client
+ c, err := client.NewHTTPClient(client.HTTPConfig{
+ Addr: "http://localhost:8086",
+ })
+ if err != nil {
+ fmt.Println("Error creating InfluxDB Client: ", err.Error())
+ }
+ defer c.Close()
+
+ // Create a new point batch
+ bp, _ := client.NewBatchPoints(client.BatchPointsConfig{
+ Database: "BumbleBeeTuna",
+ Precision: "s",
+ })
+
+ // Create a point and add to batch
+ tags := map[string]string{"cpu": "cpu-total"}
+ fields := map[string]interface{}{
+ "idle": 10.1,
+ "system": 53.3,
+ "user": 46.6,
+ }
+ pt, err := client.NewPoint("cpu_usage", tags, fields, time.Now())
+ if err != nil {
+ fmt.Println("Error: ", err.Error())
+ }
+ bp.AddPoint(pt)
+
+ // Write the batch
+ c.Write(bp)
+}
+
+// Create a batch and add a point
+func ExampleBatchPoints() {
+ // Create a new point batch
+ bp, _ := client.NewBatchPoints(client.BatchPointsConfig{
+ Database: "BumbleBeeTuna",
+ Precision: "s",
+ })
+
+ // Create a point and add to batch
+ tags := map[string]string{"cpu": "cpu-total"}
+ fields := map[string]interface{}{
+ "idle": 10.1,
+ "system": 53.3,
+ "user": 46.6,
+ }
+ pt, err := client.NewPoint("cpu_usage", tags, fields, time.Now())
+ if err != nil {
+ fmt.Println("Error: ", err.Error())
+ }
+ bp.AddPoint(pt)
+}
+
+// Using the BatchPoints setter functions
+func ExampleBatchPoints_setters() {
+ // Create a new point batch
+ bp, _ := client.NewBatchPoints(client.BatchPointsConfig{})
+ bp.SetDatabase("BumbleBeeTuna")
+ bp.SetPrecision("ms")
+
+ // Create a point and add to batch
+ tags := map[string]string{"cpu": "cpu-total"}
+ fields := map[string]interface{}{
+ "idle": 10.1,
+ "system": 53.3,
+ "user": 46.6,
+ }
+ pt, err := client.NewPoint("cpu_usage", tags, fields, time.Now())
+ if err != nil {
+ fmt.Println("Error: ", err.Error())
+ }
+ bp.AddPoint(pt)
+}
+
+// Create a new point with a timestamp
+func ExamplePoint() {
+ tags := map[string]string{"cpu": "cpu-total"}
+ fields := map[string]interface{}{
+ "idle": 10.1,
+ "system": 53.3,
+ "user": 46.6,
+ }
+ pt, err := client.NewPoint("cpu_usage", tags, fields, time.Now())
+ if err == nil {
+ fmt.Println("We created a point: ", pt.String())
+ }
+}
+
+// Create a new point without a timestamp
+func ExamplePoint_withoutTime() {
+ tags := map[string]string{"cpu": "cpu-total"}
+ fields := map[string]interface{}{
+ "idle": 10.1,
+ "system": 53.3,
+ "user": 46.6,
+ }
+ pt, err := client.NewPoint("cpu_usage", tags, fields)
+ if err == nil {
+ fmt.Println("We created a point w/o time: ", pt.String())
+ }
+}
+
+// Write 1000 points
+func ExampleClient_write1000() {
+ sampleSize := 1000
+
+ // Make client
+ c, err := client.NewHTTPClient(client.HTTPConfig{
+ Addr: "http://localhost:8086",
+ })
+ if err != nil {
+ fmt.Println("Error creating InfluxDB Client: ", err.Error())
+ }
+ defer c.Close()
+
+ rand.Seed(42)
+
+ bp, _ := client.NewBatchPoints(client.BatchPointsConfig{
+ Database: "systemstats",
+ Precision: "us",
+ })
+
+ for i := 0; i < sampleSize; i++ {
+ regions := []string{"us-west1", "us-west2", "us-west3", "us-east1"}
+ tags := map[string]string{
+ "cpu": "cpu-total",
+ "host": fmt.Sprintf("host%d", rand.Intn(1000)),
+ "region": regions[rand.Intn(len(regions))],
+ }
+
+ idle := rand.Float64() * 100.0
+ fields := map[string]interface{}{
+ "idle": idle,
+ "busy": 100.0 - idle,
+ }
+
+ pt, err := client.NewPoint(
+ "cpu_usage",
+ tags,
+ fields,
+ time.Now(),
+ )
+ if err != nil {
+ println("Error:", err.Error())
+ continue
+ }
+ bp.AddPoint(pt)
+ }
+
+ err = c.Write(bp)
+ if err != nil {
+ fmt.Println("Error: ", err.Error())
+ }
+}
+
+// Make a Query
+func ExampleClient_query() {
+ // Make client
+ c, err := client.NewHTTPClient(client.HTTPConfig{
+ Addr: "http://localhost:8086",
+ })
+ if err != nil {
+ fmt.Println("Error creating InfluxDB Client: ", err.Error())
+ }
+ defer c.Close()
+
+ q := client.NewQuery("SELECT count(value) FROM shapes", "square_holes", "ns")
+ if response, err := c.Query(q); err == nil && response.Error() == nil {
+ fmt.Println(response.Results)
+ }
+}
+
+// Create a Database with a query
+func ExampleClient_createDatabase() {
+ // Make client
+ c, err := client.NewHTTPClient(client.HTTPConfig{
+ Addr: "http://localhost:8086",
+ })
+ if err != nil {
+ fmt.Println("Error creating InfluxDB Client: ", err.Error())
+ }
+ defer c.Close()
+
+ q := client.NewQuery("CREATE DATABASE telegraf", "", "")
+ if response, err := c.Query(q); err == nil && response.Error() == nil {
+ fmt.Println(response.Results)
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4563a049/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/udp.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/udp.go b/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/udp.go
new file mode 100644
index 0000000..779a28b
--- /dev/null
+++ b/traffic_stats/vendor/github.com/influxdata/influxdb/client/v2/udp.go
@@ -0,0 +1,112 @@
+package client
+
+import (
+ "fmt"
+ "io"
+ "net"
+ "time"
+)
+
+const (
+ // UDPPayloadSize is a reasonable default payload size for UDP packets that
+ // could be travelling over the internet.
+ UDPPayloadSize = 512
+)
+
+// UDPConfig is the config data needed to create a UDP Client.
+type UDPConfig struct {
+ // Addr should be of the form "host:port"
+ // or "[ipv6-host%zone]:port".
+ Addr string
+
+ // PayloadSize is the maximum size of a UDP client message, optional
+ // Tune this based on your network. Defaults to UDPPayloadSize.
+ PayloadSize int
+}
+
+// NewUDPClient returns a client interface for writing to an InfluxDB UDP
+// service from the given config.
+func NewUDPClient(conf UDPConfig) (Client, error) {
+ var udpAddr *net.UDPAddr
+ udpAddr, err := net.ResolveUDPAddr("udp", conf.Addr)
+ if err != nil {
+ return nil, err
+ }
+
+ conn, err := net.DialUDP("udp", nil, udpAddr)
+ if err != nil {
+ return nil, err
+ }
+
+ payloadSize := conf.PayloadSize
+ if payloadSize == 0 {
+ payloadSize = UDPPayloadSize
+ }
+
+ return &udpclient{
+ conn: conn,
+ payloadSize: payloadSize,
+ }, nil
+}
+
+// Close releases the udpclient's resources.
+func (uc *udpclient) Close() error {
+ return uc.conn.Close()
+}
+
+type udpclient struct {
+ conn io.WriteCloser
+ payloadSize int
+}
+
+func (uc *udpclient) Write(bp BatchPoints) error {
+ var b = make([]byte, 0, uc.payloadSize) // initial buffer size, it will grow as needed
+ var d, _ = time.ParseDuration("1" + bp.Precision())
+
+ var delayedError error
+
+ var checkBuffer = func(n int) {
+ if len(b) > 0 && len(b)+n > uc.payloadSize {
+ if _, err := uc.conn.Write(b); err != nil {
+ delayedError = err
+ }
+ b = b[:0]
+ }
+ }
+
+ for _, p := range bp.Points() {
+ p.pt.Round(d)
+ pointSize := p.pt.StringSize() + 1 // include newline in size
+ //point := p.pt.RoundedString(d) + "\n"
+
+ checkBuffer(pointSize)
+
+ if p.Time().IsZero() || pointSize <= uc.payloadSize {
+ b = p.pt.AppendString(b)
+ b = append(b, '\n')
+ continue
+ }
+
+ points := p.pt.Split(uc.payloadSize - 1) // account for newline character
+ for _, sp := range points {
+ checkBuffer(sp.StringSize() + 1)
+ b = sp.AppendString(b)
+ b = append(b, '\n')
+ }
+ }
+
+ if len(b) > 0 {
+ if _, err := uc.conn.Write(b); err != nil {
+ return err
+ }
+ }
+ return delayedError
+}
+
+func (uc *udpclient) Query(q Query) (*Response, error) {
+ return nil, fmt.Errorf("Querying via UDP is not supported")
+}
+
+func (uc *udpclient) Ping(timeout time.Duration) (time.Duration, string, error) {
+ return 0, "", nil
+}
[14/29] incubator-trafficcontrol git commit: Modify build script to
reflect new create build command
Posted by ne...@apache.org.
Modify build script to reflect new create build command
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/0ebd6a12
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/0ebd6a12
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/0ebd6a12
Branch: refs/heads/master
Commit: 0ebd6a1206bdf6fba3cad7832714d15b3e712548
Parents: e3a4d6d
Author: sbogacz <sb...@zvelo.com>
Authored: Tue Jan 10 19:50:55 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
traffic_stats/build/traffic_stats.spec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/0ebd6a12/traffic_stats/build/traffic_stats.spec
----------------------------------------------------------------------
diff --git a/traffic_stats/build/traffic_stats.spec b/traffic_stats/build/traffic_stats.spec
index b23135a..2a971c3 100644
--- a/traffic_stats/build/traffic_stats.spec
+++ b/traffic_stats/build/traffic_stats.spec
@@ -76,7 +76,7 @@ godir=src/github.com/apache/incubator-trafficcontrol/traffic_stats/influxdb_tool
cd "$godir" && \
cp -r "$TC_DIR"/traffic_stats/influxdb_tools/* . && \
go build sync/sync_ts_databases.go sync/main.go
- go build create/create_ts_databases.go create/main.go
+ go build create/create_ts_databases.go
) || { echo "Could not build go program at $(pwd): $!"; exit 1; }
%install
[22/29] incubator-trafficcontrol git commit: Update vendor going more
thoroughly through deps recursively... some cleanup may be called for in a
follow up PR
Posted by ne...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/github.com/pkg/errors/stack.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/github.com/pkg/errors/stack.go b/traffic_stats/vendor/github.com/pkg/errors/stack.go
new file mode 100644
index 0000000..6b1f289
--- /dev/null
+++ b/traffic_stats/vendor/github.com/pkg/errors/stack.go
@@ -0,0 +1,178 @@
+package errors
+
+import (
+ "fmt"
+ "io"
+ "path"
+ "runtime"
+ "strings"
+)
+
+// Frame represents a program counter inside a stack frame.
+type Frame uintptr
+
+// pc returns the program counter for this frame;
+// multiple frames may have the same PC value.
+func (f Frame) pc() uintptr { return uintptr(f) - 1 }
+
+// file returns the full path to the file that contains the
+// function for this Frame's pc.
+func (f Frame) file() string {
+ fn := runtime.FuncForPC(f.pc())
+ if fn == nil {
+ return "unknown"
+ }
+ file, _ := fn.FileLine(f.pc())
+ return file
+}
+
+// line returns the line number of source code of the
+// function for this Frame's pc.
+func (f Frame) line() int {
+ fn := runtime.FuncForPC(f.pc())
+ if fn == nil {
+ return 0
+ }
+ _, line := fn.FileLine(f.pc())
+ return line
+}
+
+// Format formats the frame according to the fmt.Formatter interface.
+//
+// %s source file
+// %d source line
+// %n function name
+// %v equivalent to %s:%d
+//
+// Format accepts flags that alter the printing of some verbs, as follows:
+//
+// %+s path of source file relative to the compile time GOPATH
+// %+v equivalent to %+s:%d
+func (f Frame) Format(s fmt.State, verb rune) {
+ switch verb {
+ case 's':
+ switch {
+ case s.Flag('+'):
+ pc := f.pc()
+ fn := runtime.FuncForPC(pc)
+ if fn == nil {
+ io.WriteString(s, "unknown")
+ } else {
+ file, _ := fn.FileLine(pc)
+ fmt.Fprintf(s, "%s\n\t%s", fn.Name(), file)
+ }
+ default:
+ io.WriteString(s, path.Base(f.file()))
+ }
+ case 'd':
+ fmt.Fprintf(s, "%d", f.line())
+ case 'n':
+ name := runtime.FuncForPC(f.pc()).Name()
+ io.WriteString(s, funcname(name))
+ case 'v':
+ f.Format(s, 's')
+ io.WriteString(s, ":")
+ f.Format(s, 'd')
+ }
+}
+
+// StackTrace is stack of Frames from innermost (newest) to outermost (oldest).
+type StackTrace []Frame
+
+func (st StackTrace) Format(s fmt.State, verb rune) {
+ switch verb {
+ case 'v':
+ switch {
+ case s.Flag('+'):
+ for _, f := range st {
+ fmt.Fprintf(s, "\n%+v", f)
+ }
+ case s.Flag('#'):
+ fmt.Fprintf(s, "%#v", []Frame(st))
+ default:
+ fmt.Fprintf(s, "%v", []Frame(st))
+ }
+ case 's':
+ fmt.Fprintf(s, "%s", []Frame(st))
+ }
+}
+
+// stack represents a stack of program counters.
+type stack []uintptr
+
+func (s *stack) Format(st fmt.State, verb rune) {
+ switch verb {
+ case 'v':
+ switch {
+ case st.Flag('+'):
+ for _, pc := range *s {
+ f := Frame(pc)
+ fmt.Fprintf(st, "\n%+v", f)
+ }
+ }
+ }
+}
+
+func (s *stack) StackTrace() StackTrace {
+ f := make([]Frame, len(*s))
+ for i := 0; i < len(f); i++ {
+ f[i] = Frame((*s)[i])
+ }
+ return f
+}
+
+func callers() *stack {
+ const depth = 32
+ var pcs [depth]uintptr
+ n := runtime.Callers(3, pcs[:])
+ var st stack = pcs[0:n]
+ return &st
+}
+
+// funcname removes the path prefix component of a function's name reported by func.Name().
+func funcname(name string) string {
+ i := strings.LastIndex(name, "/")
+ name = name[i+1:]
+ i = strings.Index(name, ".")
+ return name[i+1:]
+}
+
+func trimGOPATH(name, file string) string {
+ // Here we want to get the source file path relative to the compile time
+ // GOPATH. As of Go 1.6.x there is no direct way to know the compiled
+ // GOPATH at runtime, but we can infer the number of path segments in the
+ // GOPATH. We note that fn.Name() returns the function name qualified by
+ // the import path, which does not include the GOPATH. Thus we can trim
+ // segments from the beginning of the file path until the number of path
+ // separators remaining is one more than the number of path separators in
+ // the function name. For example, given:
+ //
+ // GOPATH /home/user
+ // file /home/user/src/pkg/sub/file.go
+ // fn.Name() pkg/sub.Type.Method
+ //
+ // We want to produce:
+ //
+ // pkg/sub/file.go
+ //
+ // From this we can easily see that fn.Name() has one less path separator
+ // than our desired output. We count separators from the end of the file
+ // path until it finds two more than in the function name and then move
+ // one character forward to preserve the initial path segment without a
+ // leading separator.
+ const sep = "/"
+ goal := strings.Count(name, sep) + 2
+ i := len(file)
+ for n := 0; n < goal; n++ {
+ i = strings.LastIndex(file[:i], sep)
+ if i == -1 {
+ // not enough separators found, set i so that the slice expression
+ // below leaves file unmodified
+ i = -len(sep)
+ break
+ }
+ }
+ // get back to 0 or trim the leading separator
+ file = file[i+len(sep):]
+ return file
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/golang.org/x/net/LICENSE
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/golang.org/x/net/LICENSE b/traffic_stats/vendor/golang.org/x/net/LICENSE
new file mode 100644
index 0000000..6a66aea
--- /dev/null
+++ b/traffic_stats/vendor/golang.org/x/net/LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2009 The Go Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/golang.org/x/net/PATENTS
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/golang.org/x/net/PATENTS b/traffic_stats/vendor/golang.org/x/net/PATENTS
new file mode 100644
index 0000000..7330990
--- /dev/null
+++ b/traffic_stats/vendor/golang.org/x/net/PATENTS
@@ -0,0 +1,22 @@
+Additional IP Rights Grant (Patents)
+
+"This implementation" means the copyrightable works distributed by
+Google as part of the Go project.
+
+Google hereby grants to You a perpetual, worldwide, non-exclusive,
+no-charge, royalty-free, irrevocable (except as stated in this section)
+patent license to make, have made, use, offer to sell, sell, import,
+transfer and otherwise run, modify and propagate the contents of this
+implementation of Go, where such license applies only to those patent
+claims, both currently owned or controlled by Google and acquired in
+the future, licensable by Google that are necessarily infringed by this
+implementation of Go. This grant does not include claims that would be
+infringed only as a consequence of further modification of this
+implementation. If you or your agent or exclusive licensee institute or
+order or agree to the institution of patent litigation against any
+entity (including a cross-claim or counterclaim in a lawsuit) alleging
+that this implementation of Go or any code incorporated within this
+implementation of Go constitutes direct or contributory patent
+infringement, or inducement of patent infringement, then any patent
+rights granted to you under this License for this implementation of Go
+shall terminate as of the date such litigation is filed.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/golang.org/x/net/publicsuffix/gen.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/golang.org/x/net/publicsuffix/gen.go b/traffic_stats/vendor/golang.org/x/net/publicsuffix/gen.go
new file mode 100644
index 0000000..a2d4995
--- /dev/null
+++ b/traffic_stats/vendor/golang.org/x/net/publicsuffix/gen.go
@@ -0,0 +1,713 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build ignore
+
+package main
+
+// This program generates table.go and table_test.go based on the authoritative
+// public suffix list at https://publicsuffix.org/list/effective_tld_names.dat
+//
+// The version is derived from
+// https://api.github.com/repos/publicsuffix/list/commits?path=public_suffix_list.dat
+// and a human-readable form is at
+// https://github.com/publicsuffix/list/commits/master/public_suffix_list.dat
+//
+// To fetch a particular git revision, such as 5c70ccd250, pass
+// -url "https://raw.githubusercontent.com/publicsuffix/list/5c70ccd250/public_suffix_list.dat"
+// and -version "an explicit version string".
+
+import (
+ "bufio"
+ "bytes"
+ "flag"
+ "fmt"
+ "go/format"
+ "io"
+ "io/ioutil"
+ "net/http"
+ "os"
+ "regexp"
+ "sort"
+ "strings"
+
+ "golang.org/x/net/idna"
+)
+
+const (
+ // These sum of these four values must be no greater than 32.
+ nodesBitsChildren = 9
+ nodesBitsICANN = 1
+ nodesBitsTextOffset = 15
+ nodesBitsTextLength = 6
+
+ // These sum of these four values must be no greater than 32.
+ childrenBitsWildcard = 1
+ childrenBitsNodeType = 2
+ childrenBitsHi = 14
+ childrenBitsLo = 14
+)
+
+var (
+ maxChildren int
+ maxTextOffset int
+ maxTextLength int
+ maxHi uint32
+ maxLo uint32
+)
+
+func max(a, b int) int {
+ if a < b {
+ return b
+ }
+ return a
+}
+
+func u32max(a, b uint32) uint32 {
+ if a < b {
+ return b
+ }
+ return a
+}
+
+const (
+ nodeTypeNormal = 0
+ nodeTypeException = 1
+ nodeTypeParentOnly = 2
+ numNodeType = 3
+)
+
+func nodeTypeStr(n int) string {
+ switch n {
+ case nodeTypeNormal:
+ return "+"
+ case nodeTypeException:
+ return "!"
+ case nodeTypeParentOnly:
+ return "o"
+ }
+ panic("unreachable")
+}
+
+const (
+ defaultURL = "https://publicsuffix.org/list/effective_tld_names.dat"
+ gitCommitURL = "https://api.github.com/repos/publicsuffix/list/commits?path=public_suffix_list.dat"
+)
+
+var (
+ labelEncoding = map[string]uint32{}
+ labelsList = []string{}
+ labelsMap = map[string]bool{}
+ rules = []string{}
+
+ // validSuffixRE is used to check that the entries in the public suffix
+ // list are in canonical form (after Punycode encoding). Specifically,
+ // capital letters are not allowed.
+ validSuffixRE = regexp.MustCompile(`^[a-z0-9_\!\*\-\.]+$`)
+
+ shaRE = regexp.MustCompile(`"sha":"([^"]+)"`)
+ dateRE = regexp.MustCompile(`"committer":{[^{]+"date":"([^"]+)"`)
+
+ comments = flag.Bool("comments", false, "generate table.go comments, for debugging")
+ subset = flag.Bool("subset", false, "generate only a subset of the full table, for debugging")
+ url = flag.String("url", defaultURL, "URL of the publicsuffix.org list. If empty, stdin is read instead")
+ v = flag.Bool("v", false, "verbose output (to stderr)")
+ version = flag.String("version", "", "the effective_tld_names.dat version")
+)
+
+func main() {
+ if err := main1(); err != nil {
+ fmt.Fprintln(os.Stderr, err)
+ os.Exit(1)
+ }
+}
+
+func main1() error {
+ flag.Parse()
+ if nodesBitsTextLength+nodesBitsTextOffset+nodesBitsICANN+nodesBitsChildren > 32 {
+ return fmt.Errorf("not enough bits to encode the nodes table")
+ }
+ if childrenBitsLo+childrenBitsHi+childrenBitsNodeType+childrenBitsWildcard > 32 {
+ return fmt.Errorf("not enough bits to encode the children table")
+ }
+ if *version == "" {
+ if *url != defaultURL {
+ return fmt.Errorf("-version was not specified, and the -url is not the default one")
+ }
+ sha, date, err := gitCommit()
+ if err != nil {
+ return err
+ }
+ *version = fmt.Sprintf("publicsuffix.org's public_suffix_list.dat, git revision %s (%s)", sha, date)
+ }
+ var r io.Reader = os.Stdin
+ if *url != "" {
+ res, err := http.Get(*url)
+ if err != nil {
+ return err
+ }
+ if res.StatusCode != http.StatusOK {
+ return fmt.Errorf("bad GET status for %s: %d", *url, res.Status)
+ }
+ r = res.Body
+ defer res.Body.Close()
+ }
+
+ var root node
+ icann := false
+ br := bufio.NewReader(r)
+ for {
+ s, err := br.ReadString('\n')
+ if err != nil {
+ if err == io.EOF {
+ break
+ }
+ return err
+ }
+ s = strings.TrimSpace(s)
+ if strings.Contains(s, "BEGIN ICANN DOMAINS") {
+ icann = true
+ continue
+ }
+ if strings.Contains(s, "END ICANN DOMAINS") {
+ icann = false
+ continue
+ }
+ if s == "" || strings.HasPrefix(s, "//") {
+ continue
+ }
+ s, err = idna.ToASCII(s)
+ if err != nil {
+ return err
+ }
+ if !validSuffixRE.MatchString(s) {
+ return fmt.Errorf("bad publicsuffix.org list data: %q", s)
+ }
+
+ if *subset {
+ switch {
+ case s == "ac.jp" || strings.HasSuffix(s, ".ac.jp"):
+ case s == "ak.us" || strings.HasSuffix(s, ".ak.us"):
+ case s == "ao" || strings.HasSuffix(s, ".ao"):
+ case s == "ar" || strings.HasSuffix(s, ".ar"):
+ case s == "arpa" || strings.HasSuffix(s, ".arpa"):
+ case s == "cy" || strings.HasSuffix(s, ".cy"):
+ case s == "dyndns.org" || strings.HasSuffix(s, ".dyndns.org"):
+ case s == "jp":
+ case s == "kobe.jp" || strings.HasSuffix(s, ".kobe.jp"):
+ case s == "kyoto.jp" || strings.HasSuffix(s, ".kyoto.jp"):
+ case s == "om" || strings.HasSuffix(s, ".om"):
+ case s == "uk" || strings.HasSuffix(s, ".uk"):
+ case s == "uk.com" || strings.HasSuffix(s, ".uk.com"):
+ case s == "tw" || strings.HasSuffix(s, ".tw"):
+ case s == "zw" || strings.HasSuffix(s, ".zw"):
+ case s == "xn--p1ai" || strings.HasSuffix(s, ".xn--p1ai"):
+ // xn--p1ai is Russian-Cyrillic "\u0440\u0444".
+ default:
+ continue
+ }
+ }
+
+ rules = append(rules, s)
+
+ nt, wildcard := nodeTypeNormal, false
+ switch {
+ case strings.HasPrefix(s, "*."):
+ s, nt = s[2:], nodeTypeParentOnly
+ wildcard = true
+ case strings.HasPrefix(s, "!"):
+ s, nt = s[1:], nodeTypeException
+ }
+ labels := strings.Split(s, ".")
+ for n, i := &root, len(labels)-1; i >= 0; i-- {
+ label := labels[i]
+ n = n.child(label)
+ if i == 0 {
+ if nt != nodeTypeParentOnly && n.nodeType == nodeTypeParentOnly {
+ n.nodeType = nt
+ }
+ n.icann = n.icann && icann
+ n.wildcard = n.wildcard || wildcard
+ }
+ labelsMap[label] = true
+ }
+ }
+ labelsList = make([]string, 0, len(labelsMap))
+ for label := range labelsMap {
+ labelsList = append(labelsList, label)
+ }
+ sort.Strings(labelsList)
+
+ if err := generate(printReal, &root, "table.go"); err != nil {
+ return err
+ }
+ if err := generate(printTest, &root, "table_test.go"); err != nil {
+ return err
+ }
+ return nil
+}
+
+func generate(p func(io.Writer, *node) error, root *node, filename string) error {
+ buf := new(bytes.Buffer)
+ if err := p(buf, root); err != nil {
+ return err
+ }
+ b, err := format.Source(buf.Bytes())
+ if err != nil {
+ return err
+ }
+ return ioutil.WriteFile(filename, b, 0644)
+}
+
+func gitCommit() (sha, date string, retErr error) {
+ res, err := http.Get(gitCommitURL)
+ if err != nil {
+ return "", "", err
+ }
+ if res.StatusCode != http.StatusOK {
+ return "", "", fmt.Errorf("bad GET status for %s: %d", gitCommitURL, res.Status)
+ }
+ defer res.Body.Close()
+ b, err := ioutil.ReadAll(res.Body)
+ if err != nil {
+ return "", "", err
+ }
+ if m := shaRE.FindSubmatch(b); m != nil {
+ sha = string(m[1])
+ }
+ if m := dateRE.FindSubmatch(b); m != nil {
+ date = string(m[1])
+ }
+ if sha == "" || date == "" {
+ retErr = fmt.Errorf("could not find commit SHA and date in %s", gitCommitURL)
+ }
+ return sha, date, retErr
+}
+
+func printTest(w io.Writer, n *node) error {
+ fmt.Fprintf(w, "// generated by go run gen.go; DO NOT EDIT\n\n")
+ fmt.Fprintf(w, "package publicsuffix\n\nvar rules = [...]string{\n")
+ for _, rule := range rules {
+ fmt.Fprintf(w, "%q,\n", rule)
+ }
+ fmt.Fprintf(w, "}\n\nvar nodeLabels = [...]string{\n")
+ if err := n.walk(w, printNodeLabel); err != nil {
+ return err
+ }
+ fmt.Fprintf(w, "}\n")
+ return nil
+}
+
+func printReal(w io.Writer, n *node) error {
+ const header = `// generated by go run gen.go; DO NOT EDIT
+
+package publicsuffix
+
+const version = %q
+
+const (
+ nodesBitsChildren = %d
+ nodesBitsICANN = %d
+ nodesBitsTextOffset = %d
+ nodesBitsTextLength = %d
+
+ childrenBitsWildcard = %d
+ childrenBitsNodeType = %d
+ childrenBitsHi = %d
+ childrenBitsLo = %d
+)
+
+const (
+ nodeTypeNormal = %d
+ nodeTypeException = %d
+ nodeTypeParentOnly = %d
+)
+
+// numTLD is the number of top level domains.
+const numTLD = %d
+
+`
+ fmt.Fprintf(w, header, *version,
+ nodesBitsChildren, nodesBitsICANN, nodesBitsTextOffset, nodesBitsTextLength,
+ childrenBitsWildcard, childrenBitsNodeType, childrenBitsHi, childrenBitsLo,
+ nodeTypeNormal, nodeTypeException, nodeTypeParentOnly, len(n.children))
+
+ text := combineText(labelsList)
+ if text == "" {
+ return fmt.Errorf("internal error: makeText returned no text")
+ }
+ for _, label := range labelsList {
+ offset, length := strings.Index(text, label), len(label)
+ if offset < 0 {
+ return fmt.Errorf("internal error: could not find %q in text %q", label, text)
+ }
+ maxTextOffset, maxTextLength = max(maxTextOffset, offset), max(maxTextLength, length)
+ if offset >= 1<<nodesBitsTextOffset {
+ return fmt.Errorf("text offset %d is too large, or nodeBitsTextOffset is too small", offset)
+ }
+ if length >= 1<<nodesBitsTextLength {
+ return fmt.Errorf("text length %d is too large, or nodeBitsTextLength is too small", length)
+ }
+ labelEncoding[label] = uint32(offset)<<nodesBitsTextLength | uint32(length)
+ }
+ fmt.Fprintf(w, "// Text is the combined text of all labels.\nconst text = ")
+ for len(text) > 0 {
+ n, plus := len(text), ""
+ if n > 64 {
+ n, plus = 64, " +"
+ }
+ fmt.Fprintf(w, "%q%s\n", text[:n], plus)
+ text = text[n:]
+ }
+
+ if err := n.walk(w, assignIndexes); err != nil {
+ return err
+ }
+
+ fmt.Fprintf(w, `
+
+// nodes is the list of nodes. Each node is represented as a uint32, which
+// encodes the node's children, wildcard bit and node type (as an index into
+// the children array), ICANN bit and text.
+//
+// If the table was generated with the -comments flag, there is a //-comment
+// after each node's data. In it is the nodes-array indexes of the children,
+// formatted as (n0x1234-n0x1256), with * denoting the wildcard bit. The
+// nodeType is printed as + for normal, ! for exception, and o for parent-only
+// nodes that have children but don't match a domain label in their own right.
+// An I denotes an ICANN domain.
+//
+// The layout within the uint32, from MSB to LSB, is:
+// [%2d bits] unused
+// [%2d bits] children index
+// [%2d bits] ICANN bit
+// [%2d bits] text index
+// [%2d bits] text length
+var nodes = [...]uint32{
+`,
+ 32-nodesBitsChildren-nodesBitsICANN-nodesBitsTextOffset-nodesBitsTextLength,
+ nodesBitsChildren, nodesBitsICANN, nodesBitsTextOffset, nodesBitsTextLength)
+ if err := n.walk(w, printNode); err != nil {
+ return err
+ }
+ fmt.Fprintf(w, `}
+
+// children is the list of nodes' children, the parent's wildcard bit and the
+// parent's node type. If a node has no children then their children index
+// will be in the range [0, 6), depending on the wildcard bit and node type.
+//
+// The layout within the uint32, from MSB to LSB, is:
+// [%2d bits] unused
+// [%2d bits] wildcard bit
+// [%2d bits] node type
+// [%2d bits] high nodes index (exclusive) of children
+// [%2d bits] low nodes index (inclusive) of children
+var children=[...]uint32{
+`,
+ 32-childrenBitsWildcard-childrenBitsNodeType-childrenBitsHi-childrenBitsLo,
+ childrenBitsWildcard, childrenBitsNodeType, childrenBitsHi, childrenBitsLo)
+ for i, c := range childrenEncoding {
+ s := "---------------"
+ lo := c & (1<<childrenBitsLo - 1)
+ hi := (c >> childrenBitsLo) & (1<<childrenBitsHi - 1)
+ if lo != hi {
+ s = fmt.Sprintf("n0x%04x-n0x%04x", lo, hi)
+ }
+ nodeType := int(c>>(childrenBitsLo+childrenBitsHi)) & (1<<childrenBitsNodeType - 1)
+ wildcard := c>>(childrenBitsLo+childrenBitsHi+childrenBitsNodeType) != 0
+ if *comments {
+ fmt.Fprintf(w, "0x%08x, // c0x%04x (%s)%s %s\n",
+ c, i, s, wildcardStr(wildcard), nodeTypeStr(nodeType))
+ } else {
+ fmt.Fprintf(w, "0x%x,\n", c)
+ }
+ }
+ fmt.Fprintf(w, "}\n\n")
+ fmt.Fprintf(w, "// max children %d (capacity %d)\n", maxChildren, 1<<nodesBitsChildren-1)
+ fmt.Fprintf(w, "// max text offset %d (capacity %d)\n", maxTextOffset, 1<<nodesBitsTextOffset-1)
+ fmt.Fprintf(w, "// max text length %d (capacity %d)\n", maxTextLength, 1<<nodesBitsTextLength-1)
+ fmt.Fprintf(w, "// max hi %d (capacity %d)\n", maxHi, 1<<childrenBitsHi-1)
+ fmt.Fprintf(w, "// max lo %d (capacity %d)\n", maxLo, 1<<childrenBitsLo-1)
+ return nil
+}
+
+type node struct {
+ label string
+ nodeType int
+ icann bool
+ wildcard bool
+ // nodesIndex and childrenIndex are the index of this node in the nodes
+ // and the index of its children offset/length in the children arrays.
+ nodesIndex, childrenIndex int
+ // firstChild is the index of this node's first child, or zero if this
+ // node has no children.
+ firstChild int
+ // children are the node's children, in strictly increasing node label order.
+ children []*node
+}
+
+func (n *node) walk(w io.Writer, f func(w1 io.Writer, n1 *node) error) error {
+ if err := f(w, n); err != nil {
+ return err
+ }
+ for _, c := range n.children {
+ if err := c.walk(w, f); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+// child returns the child of n with the given label. The child is created if
+// it did not exist beforehand.
+func (n *node) child(label string) *node {
+ for _, c := range n.children {
+ if c.label == label {
+ return c
+ }
+ }
+ c := &node{
+ label: label,
+ nodeType: nodeTypeParentOnly,
+ icann: true,
+ }
+ n.children = append(n.children, c)
+ sort.Sort(byLabel(n.children))
+ return c
+}
+
+type byLabel []*node
+
+func (b byLabel) Len() int { return len(b) }
+func (b byLabel) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
+func (b byLabel) Less(i, j int) bool { return b[i].label < b[j].label }
+
+var nextNodesIndex int
+
+// childrenEncoding are the encoded entries in the generated children array.
+// All these pre-defined entries have no children.
+var childrenEncoding = []uint32{
+ 0 << (childrenBitsLo + childrenBitsHi), // Without wildcard bit, nodeTypeNormal.
+ 1 << (childrenBitsLo + childrenBitsHi), // Without wildcard bit, nodeTypeException.
+ 2 << (childrenBitsLo + childrenBitsHi), // Without wildcard bit, nodeTypeParentOnly.
+ 4 << (childrenBitsLo + childrenBitsHi), // With wildcard bit, nodeTypeNormal.
+ 5 << (childrenBitsLo + childrenBitsHi), // With wildcard bit, nodeTypeException.
+ 6 << (childrenBitsLo + childrenBitsHi), // With wildcard bit, nodeTypeParentOnly.
+}
+
+var firstCallToAssignIndexes = true
+
+func assignIndexes(w io.Writer, n *node) error {
+ if len(n.children) != 0 {
+ // Assign nodesIndex.
+ n.firstChild = nextNodesIndex
+ for _, c := range n.children {
+ c.nodesIndex = nextNodesIndex
+ nextNodesIndex++
+ }
+
+ // The root node's children is implicit.
+ if firstCallToAssignIndexes {
+ firstCallToAssignIndexes = false
+ return nil
+ }
+
+ // Assign childrenIndex.
+ maxChildren = max(maxChildren, len(childrenEncoding))
+ if len(childrenEncoding) >= 1<<nodesBitsChildren {
+ return fmt.Errorf("children table size %d is too large, or nodeBitsChildren is too small", len(childrenEncoding))
+ }
+ n.childrenIndex = len(childrenEncoding)
+ lo := uint32(n.firstChild)
+ hi := lo + uint32(len(n.children))
+ maxLo, maxHi = u32max(maxLo, lo), u32max(maxHi, hi)
+ if lo >= 1<<childrenBitsLo {
+ return fmt.Errorf("children lo %d is too large, or childrenBitsLo is too small", lo)
+ }
+ if hi >= 1<<childrenBitsHi {
+ return fmt.Errorf("children hi %d is too large, or childrenBitsHi is too small", hi)
+ }
+ enc := hi<<childrenBitsLo | lo
+ enc |= uint32(n.nodeType) << (childrenBitsLo + childrenBitsHi)
+ if n.wildcard {
+ enc |= 1 << (childrenBitsLo + childrenBitsHi + childrenBitsNodeType)
+ }
+ childrenEncoding = append(childrenEncoding, enc)
+ } else {
+ n.childrenIndex = n.nodeType
+ if n.wildcard {
+ n.childrenIndex += numNodeType
+ }
+ }
+ return nil
+}
+
+func printNode(w io.Writer, n *node) error {
+ for _, c := range n.children {
+ s := "---------------"
+ if len(c.children) != 0 {
+ s = fmt.Sprintf("n0x%04x-n0x%04x", c.firstChild, c.firstChild+len(c.children))
+ }
+ encoding := labelEncoding[c.label]
+ if c.icann {
+ encoding |= 1 << (nodesBitsTextLength + nodesBitsTextOffset)
+ }
+ encoding |= uint32(c.childrenIndex) << (nodesBitsTextLength + nodesBitsTextOffset + nodesBitsICANN)
+ if *comments {
+ fmt.Fprintf(w, "0x%08x, // n0x%04x c0x%04x (%s)%s %s %s %s\n",
+ encoding, c.nodesIndex, c.childrenIndex, s, wildcardStr(c.wildcard),
+ nodeTypeStr(c.nodeType), icannStr(c.icann), c.label,
+ )
+ } else {
+ fmt.Fprintf(w, "0x%x,\n", encoding)
+ }
+ }
+ return nil
+}
+
+func printNodeLabel(w io.Writer, n *node) error {
+ for _, c := range n.children {
+ fmt.Fprintf(w, "%q,\n", c.label)
+ }
+ return nil
+}
+
+func icannStr(icann bool) string {
+ if icann {
+ return "I"
+ }
+ return " "
+}
+
+func wildcardStr(wildcard bool) string {
+ if wildcard {
+ return "*"
+ }
+ return " "
+}
+
+// combineText combines all the strings in labelsList to form one giant string.
+// Overlapping strings will be merged: "arpa" and "parliament" could yield
+// "arparliament".
+func combineText(labelsList []string) string {
+ beforeLength := 0
+ for _, s := range labelsList {
+ beforeLength += len(s)
+ }
+
+ text := crush(removeSubstrings(labelsList))
+ if *v {
+ fmt.Fprintf(os.Stderr, "crushed %d bytes to become %d bytes\n", beforeLength, len(text))
+ }
+ return text
+}
+
+type byLength []string
+
+func (s byLength) Len() int { return len(s) }
+func (s byLength) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
+func (s byLength) Less(i, j int) bool { return len(s[i]) < len(s[j]) }
+
+// removeSubstrings returns a copy of its input with any strings removed
+// that are substrings of other provided strings.
+func removeSubstrings(input []string) []string {
+ // Make a copy of input.
+ ss := append(make([]string, 0, len(input)), input...)
+ sort.Sort(byLength(ss))
+
+ for i, shortString := range ss {
+ // For each string, only consider strings higher than it in sort order, i.e.
+ // of equal length or greater.
+ for _, longString := range ss[i+1:] {
+ if strings.Contains(longString, shortString) {
+ ss[i] = ""
+ break
+ }
+ }
+ }
+
+ // Remove the empty strings.
+ sort.Strings(ss)
+ for len(ss) > 0 && ss[0] == "" {
+ ss = ss[1:]
+ }
+ return ss
+}
+
+// crush combines a list of strings, taking advantage of overlaps. It returns a
+// single string that contains each input string as a substring.
+func crush(ss []string) string {
+ maxLabelLen := 0
+ for _, s := range ss {
+ if maxLabelLen < len(s) {
+ maxLabelLen = len(s)
+ }
+ }
+
+ for prefixLen := maxLabelLen; prefixLen > 0; prefixLen-- {
+ prefixes := makePrefixMap(ss, prefixLen)
+ for i, s := range ss {
+ if len(s) <= prefixLen {
+ continue
+ }
+ mergeLabel(ss, i, prefixLen, prefixes)
+ }
+ }
+
+ return strings.Join(ss, "")
+}
+
+// mergeLabel merges the label at ss[i] with the first available matching label
+// in prefixMap, where the last "prefixLen" characters in ss[i] match the first
+// "prefixLen" characters in the matching label.
+// It will merge ss[i] repeatedly until no more matches are available.
+// All matching labels merged into ss[i] are replaced by "".
+func mergeLabel(ss []string, i, prefixLen int, prefixes prefixMap) {
+ s := ss[i]
+ suffix := s[len(s)-prefixLen:]
+ for _, j := range prefixes[suffix] {
+ // Empty strings mean "already used." Also avoid merging with self.
+ if ss[j] == "" || i == j {
+ continue
+ }
+ if *v {
+ fmt.Fprintf(os.Stderr, "%d-length overlap at (%4d,%4d): %q and %q share %q\n",
+ prefixLen, i, j, ss[i], ss[j], suffix)
+ }
+ ss[i] += ss[j][prefixLen:]
+ ss[j] = ""
+ // ss[i] has a new suffix, so merge again if possible.
+ // Note: we only have to merge again at the same prefix length. Shorter
+ // prefix lengths will be handled in the next iteration of crush's for loop.
+ // Can there be matches for longer prefix lengths, introduced by the merge?
+ // I believe that any such matches would by necessity have been eliminated
+ // during substring removal or merged at a higher prefix length. For
+ // instance, in crush("abc", "cde", "bcdef"), combining "abc" and "cde"
+ // would yield "abcde", which could be merged with "bcdef." However, in
+ // practice "cde" would already have been elimintated by removeSubstrings.
+ mergeLabel(ss, i, prefixLen, prefixes)
+ return
+ }
+}
+
+// prefixMap maps from a prefix to a list of strings containing that prefix. The
+// list of strings is represented as indexes into a slice of strings stored
+// elsewhere.
+type prefixMap map[string][]int
+
+// makePrefixMap constructs a prefixMap from a slice of strings.
+func makePrefixMap(ss []string, prefixLen int) prefixMap {
+ prefixes := make(prefixMap)
+ for i, s := range ss {
+ // We use < rather than <= because if a label matches on a prefix equal to
+ // its full length, that's actually a substring match handled by
+ // removeSubstrings.
+ if prefixLen < len(s) {
+ prefix := s[:prefixLen]
+ prefixes[prefix] = append(prefixes[prefix], i)
+ }
+ }
+
+ return prefixes
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/golang.org/x/net/publicsuffix/list.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/golang.org/x/net/publicsuffix/list.go b/traffic_stats/vendor/golang.org/x/net/publicsuffix/list.go
new file mode 100644
index 0000000..217b743
--- /dev/null
+++ b/traffic_stats/vendor/golang.org/x/net/publicsuffix/list.go
@@ -0,0 +1,135 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:generate go run gen.go
+
+// Package publicsuffix provides a public suffix list based on data from
+// http://publicsuffix.org/. A public suffix is one under which Internet users
+// can directly register names.
+package publicsuffix
+
+// TODO: specify case sensitivity and leading/trailing dot behavior for
+// func PublicSuffix and func EffectiveTLDPlusOne.
+
+import (
+ "fmt"
+ "net/http/cookiejar"
+ "strings"
+)
+
+// List implements the cookiejar.PublicSuffixList interface by calling the
+// PublicSuffix function.
+var List cookiejar.PublicSuffixList = list{}
+
+type list struct{}
+
+func (list) PublicSuffix(domain string) string {
+ ps, _ := PublicSuffix(domain)
+ return ps
+}
+
+func (list) String() string {
+ return version
+}
+
+// PublicSuffix returns the public suffix of the domain using a copy of the
+// publicsuffix.org database compiled into the library.
+//
+// icann is whether the public suffix is managed by the Internet Corporation
+// for Assigned Names and Numbers. If not, the public suffix is privately
+// managed. For example, foo.org and foo.co.uk are ICANN domains,
+// foo.dyndns.org and foo.blogspot.co.uk are private domains.
+//
+// Use cases for distinguishing ICANN domains like foo.com from private
+// domains like foo.appspot.com can be found at
+// https://wiki.mozilla.org/Public_Suffix_List/Use_Cases
+func PublicSuffix(domain string) (publicSuffix string, icann bool) {
+ lo, hi := uint32(0), uint32(numTLD)
+ s, suffix, wildcard := domain, len(domain), false
+loop:
+ for {
+ dot := strings.LastIndex(s, ".")
+ if wildcard {
+ suffix = 1 + dot
+ }
+ if lo == hi {
+ break
+ }
+ f := find(s[1+dot:], lo, hi)
+ if f == notFound {
+ break
+ }
+
+ u := nodes[f] >> (nodesBitsTextOffset + nodesBitsTextLength)
+ icann = u&(1<<nodesBitsICANN-1) != 0
+ u >>= nodesBitsICANN
+ u = children[u&(1<<nodesBitsChildren-1)]
+ lo = u & (1<<childrenBitsLo - 1)
+ u >>= childrenBitsLo
+ hi = u & (1<<childrenBitsHi - 1)
+ u >>= childrenBitsHi
+ switch u & (1<<childrenBitsNodeType - 1) {
+ case nodeTypeNormal:
+ suffix = 1 + dot
+ case nodeTypeException:
+ suffix = 1 + len(s)
+ break loop
+ }
+ u >>= childrenBitsNodeType
+ wildcard = u&(1<<childrenBitsWildcard-1) != 0
+
+ if dot == -1 {
+ break
+ }
+ s = s[:dot]
+ }
+ if suffix == len(domain) {
+ // If no rules match, the prevailing rule is "*".
+ return domain[1+strings.LastIndex(domain, "."):], icann
+ }
+ return domain[suffix:], icann
+}
+
+const notFound uint32 = 1<<32 - 1
+
+// find returns the index of the node in the range [lo, hi) whose label equals
+// label, or notFound if there is no such node. The range is assumed to be in
+// strictly increasing node label order.
+func find(label string, lo, hi uint32) uint32 {
+ for lo < hi {
+ mid := lo + (hi-lo)/2
+ s := nodeLabel(mid)
+ if s < label {
+ lo = mid + 1
+ } else if s == label {
+ return mid
+ } else {
+ hi = mid
+ }
+ }
+ return notFound
+}
+
+// nodeLabel returns the label for the i'th node.
+func nodeLabel(i uint32) string {
+ x := nodes[i]
+ length := x & (1<<nodesBitsTextLength - 1)
+ x >>= nodesBitsTextLength
+ offset := x & (1<<nodesBitsTextOffset - 1)
+ return text[offset : offset+length]
+}
+
+// EffectiveTLDPlusOne returns the effective top level domain plus one more
+// label. For example, the eTLD+1 for "foo.bar.golang.org" is "golang.org".
+func EffectiveTLDPlusOne(domain string) (string, error) {
+ suffix, _ := PublicSuffix(domain)
+ if len(domain) <= len(suffix) {
+ return "", fmt.Errorf("publicsuffix: cannot derive eTLD+1 for domain %q", domain)
+ }
+ i := len(domain) - len(suffix) - 1
+ if domain[i] != '.' {
+ return "", fmt.Errorf("publicsuffix: invalid public suffix %q for domain %q", suffix, domain)
+ }
+ return domain[1+strings.LastIndex(domain[:i], "."):], nil
+}
[03/29] incubator-trafficcontrol git commit: Rewrite current sync
tests to use the new test helper functions, and eliminate goconvey dependency
Posted by ne...@apache.org.
Rewrite current sync tests to use the new test helper functions, and eliminate goconvey dependency
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/ab22b385
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/ab22b385
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/ab22b385
Branch: refs/heads/master
Commit: ab22b3859552bb3e240d6a266e7f163f47e30cb4
Parents: 5b72a49
Author: sbogacz <sb...@zvelo.com>
Authored: Wed Jan 11 22:08:43 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
traffic_stats/influxdb_tools/sync/sync_test.go | 305 ++++++++++----------
1 file changed, 150 insertions(+), 155 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ab22b385/traffic_stats/influxdb_tools/sync/sync_test.go
----------------------------------------------------------------------
diff --git a/traffic_stats/influxdb_tools/sync/sync_test.go b/traffic_stats/influxdb_tools/sync/sync_test.go
index 943e7a5..06ef4db 100644
--- a/traffic_stats/influxdb_tools/sync/sync_test.go
+++ b/traffic_stats/influxdb_tools/sync/sync_test.go
@@ -24,165 +24,160 @@ import (
"fmt"
"testing"
+ "github.com/apache/incubator-trafficcontrol/traffic_stats/assert"
influx "github.com/influxdata/influxdb/client/v2"
"github.com/influxdata/influxdb/models"
- . "github.com/smartystreets/goconvey/convey"
)
-func TestSync(t *testing.T) {
- Convey("getDailyStats should work as expected", t, func() {
- Convey("getDailyStats should work with no results passed", func() {
- dailyStatsMap := getDailyStats(nil)
- So(dailyStatsMap, ShouldNotBeNil)
- So(dailyStatsMap, ShouldBeEmpty)
- })
- Convey("getDailyStats should work with empty results passed", func() {
- results := []influx.Result{}
- dailyStatsMap := getDailyStats(results)
- So(dailyStatsMap, ShouldNotBeNil)
- So(dailyStatsMap, ShouldBeEmpty)
- })
- Convey("getDailyStats should work as expected on a slice of results", func() {
- results := []influx.Result{
- influx.Result{
- Series: []models.Row{
- models.Row{
- Values: generateDailyValues(0),
- },
- },
- },
- influx.Result{
- Series: []models.Row{
- models.Row{
- Values: generateDailyValues(1),
- },
- models.Row{
- Values: generateDailyValues(2),
- },
- },
- },
- influx.Result{
- Series: []models.Row{
- models.Row{
- Values: generateDailyValues(3),
- },
- models.Row{
- Values: generateDailyValues(4),
- },
- models.Row{
- Values: generateDailyValues(5),
- },
- },
- },
- }
- dailyStatsMap := getDailyStats(results)
- So(dailyStatsMap, ShouldNotBeNil)
- So(dailyStatsMap, ShouldNotBeEmpty)
- So(len(dailyStatsMap), ShouldEqual, 6) // we get one dailyStats object per Values entry
- })
- })
- Convey("getDeliveryServiceStats should work as expected", t, func() {
- Convey("getDeliveryServiceStats should work with no results passed", func() {
- getDeliveryServiceStatsMap := getDeliveryServiceStats(nil)
- So(getDeliveryServiceStatsMap, ShouldNotBeNil)
- So(getDeliveryServiceStatsMap, ShouldBeEmpty)
- })
- Convey("getDeliveryServiceStats should work with empty results passed", func() {
- results := []influx.Result{}
- getDeliveryServiceStatsMap := getDeliveryServiceStats(results)
- So(getDeliveryServiceStatsMap, ShouldNotBeNil)
- So(getDeliveryServiceStatsMap, ShouldBeEmpty)
- })
- Convey("getDeliveryServiceStats should work as expected on a slice of results", func() {
- results := []influx.Result{
- influx.Result{
- Series: []models.Row{
- models.Row{
- Values: generateDeliveryServiceValues(0),
- },
- },
- },
- influx.Result{
- Series: []models.Row{
- models.Row{
- Values: generateDeliveryServiceValues(1),
- },
- models.Row{
- Values: generateDeliveryServiceValues(2),
- },
- },
- },
- influx.Result{
- Series: []models.Row{
- models.Row{
- Values: generateDeliveryServiceValues(3),
- },
- models.Row{
- Values: generateDeliveryServiceValues(4),
- },
- models.Row{
- Values: generateDeliveryServiceValues(5),
- },
- },
- },
- }
- getDeliveryServiceStatsMap := getDeliveryServiceStats(results)
- So(getDeliveryServiceStatsMap, ShouldNotBeNil)
- So(getDeliveryServiceStatsMap, ShouldNotBeEmpty)
- So(len(getDeliveryServiceStatsMap), ShouldEqual, 6) // we get one dailyStats object per Values entry
- })
- })
- Convey("getCacheStats should work as expected", t, func() {
- Convey("getCacheStats should work with no results passed", func() {
- getCacheStatsMap := getCacheStats(nil)
- So(getCacheStatsMap, ShouldNotBeNil)
- So(getCacheStatsMap, ShouldBeEmpty)
- })
- Convey("getCacheStats should work with empty results passed", func() {
- results := []influx.Result{}
- getCacheStatsMap := getCacheStats(results)
- So(getCacheStatsMap, ShouldNotBeNil)
- So(getCacheStatsMap, ShouldBeEmpty)
- })
- Convey("getCacheStats should work as expected on a slice of results", func() {
- results := []influx.Result{
- influx.Result{
- Series: []models.Row{
- models.Row{
- Values: generateCacheValues(0),
- },
- },
- },
- influx.Result{
- Series: []models.Row{
- models.Row{
- Values: generateCacheValues(1),
- },
- models.Row{
- Values: generateCacheValues(2),
- },
- },
- },
- influx.Result{
- Series: []models.Row{
- models.Row{
- Values: generateCacheValues(3),
- },
- models.Row{
- Values: generateCacheValues(4),
- },
- models.Row{
- Values: generateCacheValues(5),
- },
- },
- },
- }
- getCacheStatsMap := getCacheStats(results)
- So(getCacheStatsMap, ShouldNotBeNil)
- So(getCacheStatsMap, ShouldNotBeEmpty)
- So(len(getCacheStatsMap), ShouldEqual, 6) // we get one dailyStats object per Values entry
- })
- })
+func TestGetDailyStats(t *testing.T) {
+ // Passing a nil result slice results in an empty, non-nil map
+ dailyStatsMap := getDailyStats(nil)
+ assert.NotNil(t, dailyStatsMap)
+ assert.Empty(t, dailyStatsMap)
+
+ // Passing an empty result slice results in an empty, non-nil map
+ results := []influx.Result{}
+ dailyStatsMap = getDailyStats(results)
+ assert.NotNil(t, dailyStatsMap)
+ assert.Empty(t, dailyStatsMap)
+
+ // Passing a non-empty result slice should behave as expected
+ results = []influx.Result{
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateDailyValues(0),
+ },
+ },
+ },
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateDailyValues(1),
+ },
+ models.Row{
+ Values: generateDailyValues(2),
+ },
+ },
+ },
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateDailyValues(3),
+ },
+ models.Row{
+ Values: generateDailyValues(4),
+ },
+ models.Row{
+ Values: generateDailyValues(5),
+ },
+ },
+ },
+ }
+ dailyStatsMap = getDailyStats(results)
+ assert.NotNil(t, dailyStatsMap)
+ assert.NotEmpty(t, dailyStatsMap)
+ assert.Equal(t, len(dailyStatsMap), 6) // we get one dailyStats object per Values entry
+}
+
+func TestGetDeliveryServicesStats(t *testing.T) {
+ // Passing a nil result slice results in an empty, non-nil map
+ getDeliveryServiceStatsMap := getDeliveryServiceStats(nil)
+ assert.NotNil(t, getDeliveryServiceStatsMap)
+ assert.Empty(t, getDeliveryServiceStatsMap)
+
+ // Passing an empty result slice results in an empty, non-nil map
+ results := []influx.Result{}
+ getDeliveryServiceStatsMap = getDeliveryServiceStats(results)
+ assert.NotNil(t, getDeliveryServiceStatsMap)
+ assert.Empty(t, getDeliveryServiceStatsMap)
+
+ results = []influx.Result{
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateDeliveryServiceValues(0),
+ },
+ },
+ },
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateDeliveryServiceValues(1),
+ },
+ models.Row{
+ Values: generateDeliveryServiceValues(2),
+ },
+ },
+ },
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateDeliveryServiceValues(3),
+ },
+ models.Row{
+ Values: generateDeliveryServiceValues(4),
+ },
+ models.Row{
+ Values: generateDeliveryServiceValues(5),
+ },
+ },
+ },
+ }
+ getDeliveryServiceStatsMap = getDeliveryServiceStats(results)
+ assert.NotNil(t, getDeliveryServiceStatsMap)
+ assert.NotEmpty(t, getDeliveryServiceStatsMap)
+ assert.Equal(t, len(getDeliveryServiceStatsMap), 6) // we get one deliveryServiceStats object per Values entry
+}
+
+func TestGetCacheStats(t *testing.T) {
+ // Passing a nil result slice results in an empty, non-nil map
+ getCacheStatsMap := getCacheStats(nil)
+ assert.NotNil(t, getCacheStatsMap)
+ assert.Empty(t, getCacheStatsMap)
+
+ // Passing an empty result slice results in an empty, non-nil map
+ results := []influx.Result{}
+ getCacheStatsMap = getCacheStats(results)
+ assert.NotNil(t, getCacheStatsMap)
+ assert.Empty(t, getCacheStatsMap)
+
+ results = []influx.Result{
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateCacheValues(0),
+ },
+ },
+ },
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateCacheValues(1),
+ },
+ models.Row{
+ Values: generateCacheValues(2),
+ },
+ },
+ },
+ influx.Result{
+ Series: []models.Row{
+ models.Row{
+ Values: generateCacheValues(3),
+ },
+ models.Row{
+ Values: generateCacheValues(4),
+ },
+ models.Row{
+ Values: generateCacheValues(5),
+ },
+ },
+ },
+ }
+ getCacheStatsMap = getCacheStats(results)
+ assert.NotNil(t, getCacheStatsMap)
+ assert.NotEmpty(t, getCacheStatsMap)
+ assert.Equal(t, len(getCacheStatsMap), 6) // we get one cacheStats object per Values entry
}
func generateDailyValues(i int) [][]interface{} {
[19/29] incubator-trafficcontrol git commit: Fix build script to
reflect new locations of influxdb_tools go files
Posted by ne...@apache.org.
Fix build script to reflect new locations of influxdb_tools go files
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/f7061c1f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/f7061c1f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/f7061c1f
Branch: refs/heads/master
Commit: f7061c1ffdd8852d6d26a62226c1ea6ebd2598d5
Parents: 2329265
Author: sbogacz <sb...@zvelo.com>
Authored: Fri Jan 6 23:39:07 2017 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Fri Jan 13 23:33:56 2017 +0000
----------------------------------------------------------------------
traffic_stats/build/traffic_stats.spec | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f7061c1f/traffic_stats/build/traffic_stats.spec
----------------------------------------------------------------------
diff --git a/traffic_stats/build/traffic_stats.spec b/traffic_stats/build/traffic_stats.spec
index 30ca284..b23135a 100644
--- a/traffic_stats/build/traffic_stats.spec
+++ b/traffic_stats/build/traffic_stats.spec
@@ -75,8 +75,8 @@ godir=src/github.com/apache/incubator-trafficcontrol/traffic_stats/influxdb_tool
( mkdir -p "$godir" && \
cd "$godir" && \
cp -r "$TC_DIR"/traffic_stats/influxdb_tools/* . && \
- go build sync_ts_databases.go
- go build create_ts_databases.go
+ go build sync/sync_ts_databases.go sync/main.go
+ go build create/create_ts_databases.go create/main.go
) || { echo "Could not build go program at $(pwd): $!"; exit 1; }
%install
@@ -182,4 +182,3 @@ if [ -e /etc/init.d/ts_daily_summary ]; then
/etc/init.d/ts_daily_summary stop
/sbin/chkconfig --del ts_daily_summary
fi
-