X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tools%2Fodl-mdsal-clustering-tests%2Freplace_cars.py;fp=tools%2Fodl-mdsal-clustering-tests%2Freplace_cars.py;h=6845ff8a25fa076498bad9e3ee1050a088dbf121;hb=1c106006ffb33c1c60e2f8abe61e88a7bd95a7bd;hp=5f4973ba79329f68e3d6df9b0040da7da00bd277;hpb=e235045c2ad12d41416e2583609a0178c8bd9287;p=integration%2Ftest.git diff --git a/tools/odl-mdsal-clustering-tests/replace_cars.py b/tools/odl-mdsal-clustering-tests/replace_cars.py index 5f4973ba79..6845ff8a25 100644 --- a/tools/odl-mdsal-clustering-tests/replace_cars.py +++ b/tools/odl-mdsal-clustering-tests/replace_cars.py @@ -21,42 +21,65 @@ def main(): """ # Constants - car_entry_template = string.Template(''' { + car_entry_template = string.Template( + """ { "id": "car-$NUM" - }''') + }""" + ) - patch_data_template = string.Template('''{ + patch_data_template = string.Template( + """{ "cars": { "car-entry": [ $ENTRIES ] } -}''') +}""" + ) # Arguments - parser = argparse.ArgumentParser(description="Config datastore" - "scale test script") - parser.add_argument("--host", default="127.0.0.1", - help="Host where odl controller is running." - "(default: 127.0.0.1)") - parser.add_argument("--port", default="8181", - help="Port on which odl's RESTCONF is listening" - "(default: 8181)") - parser.add_argument("--start-id", type=int, default=1, - help="ID number of the first car. (default:1)") - parser.add_argument("--segment-size", type=int, default=1, - help="Number of cars in segment. (default:1)") - parser.add_argument("--iterations", type=int, default=1, - help="How many times the segment sent. (default:1)") - parser.add_argument("--move-per-iter", type=int, default=1, - help="Each segment has IDs moved by this. (default:1)") + parser = argparse.ArgumentParser(description="Config datastore" "scale test script") + parser.add_argument( + "--host", + default="127.0.0.1", + help="Host where odl controller is running." "(default: 127.0.0.1)", + ) + parser.add_argument( + "--port", + default="8181", + help="Port on which odl's RESTCONF is listening" "(default: 8181)", + ) + parser.add_argument( + "--start-id", + type=int, + default=1, + help="ID number of the first car. (default:1)", + ) + parser.add_argument( + "--segment-size", + type=int, + default=1, + help="Number of cars in segment. (default:1)", + ) + parser.add_argument( + "--iterations", + type=int, + default=1, + help="How many times the segment sent. (default:1)", + ) + parser.add_argument( + "--move-per-iter", + type=int, + default=1, + help="Each segment has IDs moved by this. (default:1)", + ) parser.add_argument("--user", help="Restconf user name", default="admin") parser.add_argument("--password", help="Restconf password", default="admin") args = parser.parse_args() # Logic - url = "http://" + args.host + ':' + args.port + "/restconf/config/car:cars" + url = "http://" + args.host + ":" + args.port + "/restconf/config/car:cars" auth = (args.user, args.password) headers = {"Content-Type": "application/json"} session = requests.Session()