1 __author__ = "Basheeruddin Ahmed"
2 __copyright__ = "Copyright(c) 2014, Cisco Systems, Inc."
3 __license__ = "New-style BSD"
4 __email__ = "syedbahm@cisco.com"
6 from string import Template
8 # helps in taking the hostname entered by the user
14 return hostname + ":" + port # noqa
18 """Cars resource URL for GET"""
19 return "http://" + getServer() + "/restconf/config/car:cars"
23 """People resouce URL for GET"""
24 return "http://" + getServer() + "/restconf/config/people:people"
27 def getCarPersonUrl():
28 """GET cars persons mapping resource URL"""
29 return "http://" + getServer() + "/restconf/config/car-people:car-people"
33 """POST or DELETE URL"""
34 return "http://" + getServer() + "/restconf/config"
37 def getAddPersonUrl():
38 """POST or DELETE URL"""
39 return "http://" + getServer() + "/restconf/config"
42 def getAddPersonRpcUrl():
43 """POST URL -using rpc"""
44 return "http://" + getServer() + "/restconf/operations/people:add-person"
47 def getAddCarPersonUrl():
48 """POST URL for car person mapping"""
49 return "http://" + getServer() + "/restconf/config"
52 def getBuyCarRpcUrl():
53 """POST URL for buy car rpc"""
54 return "http://" + getServer() + "/restconf/operations/car-purchase:buy-car"
57 # Template for Car resource payload
58 add_car_payload_template = Template(
64 "category": "$category",
66 "manufacturer": "$manufacturer",
73 # Template for Person resource payload
74 add_person_payload_template = Template(
82 "address": "$address",
83 "contactNo":"$contactNo"
89 # Template for Car Person mapping payload
90 add_car_person_template = Template(
92 {"car-people:car-people":{
96 "person-id": "$personId"
102 # Template for adding person using RPC
103 add_person_rpc_payload_template = Template(
108 "people:id" : "$personId",
109 "people:gender":"$gender",
110 "people:address" : "$address",
111 "people:contactNo":"$contactNo",
117 # Template for buying car rpc
118 buy_car_rpc_template = Template(
123 "car-purchase:person" : "/people:people/people:person[people:id='$personId']",
124 "car-purchase:person-id" : "$personId",
125 "car-purchase:car-id" : "$carId"