"""
# 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()