X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=test%2Ftools%2Fodl-mdsal-clustering-tests%2Fclustering-functional-test%2Fsettings.py;fp=test%2Ftools%2Fodl-mdsal-clustering-tests%2Fclustering-functional-test%2Fsettings.py;h=704b67155a590516b92515ee26fe18c63ab52395;hb=3c59e1dffcab68e4259c51059f0c660e544d6b1a;hp=0000000000000000000000000000000000000000;hpb=cc000f4fc8f01b61e3effabff95395b2ed1b0b3e;p=integration%2Ftest.git diff --git a/test/tools/odl-mdsal-clustering-tests/clustering-functional-test/settings.py b/test/tools/odl-mdsal-clustering-tests/clustering-functional-test/settings.py new file mode 100644 index 0000000000..704b67155a --- /dev/null +++ b/test/tools/odl-mdsal-clustering-tests/clustering-functional-test/settings.py @@ -0,0 +1,110 @@ +__author__ = "Basheeruddin Ahmed" +__copyright__ = "Copyright(c) 2014, Cisco Systems, Inc." +__license__ = "New-style BSD" +__email__ = "syedbahm@cisco.com" + +from string import Template + +# helps in taking the hostname entered by the user +global hostname +global port + +def getServer(): + return hostname+":"+port + +#Cars resource URL for GET +def getCarsUrl(): + + return "http://"+getServer()+"/restconf/config/car:cars" + +#People resouce URL for GET +def getPersonsUrl(): + + return "http://"+getServer()+"/restconf/config/people:people" + +#GET cars persons mapping resource URL +def getCarPersonUrl(): + + return "http://"+getServer()+"/restconf/config/car-people:car-people" + +#POST or DELETE URL +def getAddCarUrl(): + return "http://"+getServer()+"/restconf/config" +#POST or DELETE URL +def getAddPersonUrl(): + return "http://"+getServer()+"/restconf/config" + +#POST URL -using rpc +def getAddPersonRpcUrl(): + return "http://"+getServer()+"/restconf/operations/people:add-person" + +#POST URL for car person mapping +def getAddCarPersonUrl(): + return "http://"+getServer()+"/restconf/config" +#POST URL for buy car rpc +def getBuyCarRpcUrl(): + return "http://"+getServer()+"/restconf/operations/car-purchase:buy-car" + + +# Template for Car resource payload +add_car_payload_template = Template( '{\"car:cars\":{' + '\"car-entry\": [' + '{' + '\"id\": \"$id\",' + '\"category\": \"$category\",' + '\"model\": \"$model\",' + '\"manufacturer\": \"$manufacturer\",' + '\"year\": \"$year\"' + '}' + ']' +'}' +'}') + +# Template for Person resource payload +add_person_payload_template = Template( '{\"people:people":{' + '\"person\": [' + '{' + '\"id\": \"$personId\",' + '\"gender\": \"$gender\",' + '\"age\": \"$age\",' + '\"address\": \"$address\",' + '\"contactNo\":\"$contactNo\"' + '}' + ']' + '}}') + +# Template for Car Person mapping payload +add_car_person_template = Template('{\"car-people:car-people\":{' + '\"car-person\": [' + '{' + ' \"car-id\": \"$Id\",' + '\"person-id\": \"$personId\"' + '}' + ']' +'}' +'}') + +# Template for adding person using RPC +add_person_rpc_payload_template = Template ( '{' + '\"input\":' + '{' + '\"people:id\" : \"$personId\",' + '\"people:gender\":\"$gender\",' + '\"people:address\" : \"$address\",' + '\"people:contactNo\":\"$contactNo\",' + '\"people:age\":\"$age\"' + '}' + '}') + +# Template for buing car rpc +buy_car_rpc_template = Template ( '{' + '\"input\" :' + '{' + '\"car-purchase:person\" : \"/people:people/people:person[people:id=\'$personId\']\",' + '\"car-purchase:person-id\" : \"$personId\",' + '\"car-purchase:car-id\" : \"$carId\"' + '}' +'}') + + +