diff options
Diffstat (limited to 'clover/tools/clover_validate_rr.py')
-rw-r--r-- | clover/tools/clover_validate_rr.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/clover/tools/clover_validate_rr.py b/clover/tools/clover_validate_rr.py new file mode 100644 index 0000000..ff1f8b4 --- /dev/null +++ b/clover/tools/clover_validate_rr.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python + +# Copyright (c) Authors of Clover +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 + +import getopt +import sys + +sys.path.insert(0, '..') + +from orchestration import kube_client +import servicemesh.route_rules as rr +from tracing.tracing import Tracing +from validate_rr import ValidateWRR + +def main(argv): + service_name = None + test_id = None + help_str = 'clover_validate_rr.py -t <test-id> -s <service name>' + try: + opts, args = getopt.getopt(argv,"hs:t:",["service-name", "test-id"]) + except getopt.GetoptError: + print help_str + sys.exit(2) + for opt, arg in opts: + if opt == '-h': + print help_str + sys.exit() + elif opt in ("-t", "--test-id"): + test_id = str(arg) + elif opt in ("-s", "--service-name"): + service_name = str(arg) + + if not service_name or not test_id: + print help_str + sys.exit(3) + + validate_wrr = ValidateWRR(test_id) + + istio_pods = ['istio-ingress', 'istio-mixer', 'istio-pilot'] + jaeger_pods = ['jaeger-deployment'] + + if not validate_wrr.check_pods_up(istio_pods + jaeger_pods, + 'istio-system'): + sys.exit(4) + + ret, errors = validate_wrr.validate(service_name) + for err in errors: + print err + +if __name__ == "__main__": + main(sys.argv[1:]) |