Merge "Fix pep8 violations in crud"
[integration/test.git] / test / tools / odl-mdsal-clustering-tests / clustering-functional-test / settings.py
1 __author__ = "Basheeruddin Ahmed"
2 __copyright__ = "Copyright(c) 2014, Cisco Systems, Inc."
3 __license__ = "New-style BSD"
4 __email__ = "syedbahm@cisco.com"
5
6 from string import Template
7
8 # helps in taking the hostname entered by the user
9 global hostname
10 global port
11
12 def getServer():
13     return hostname+":"+port
14
15 #Cars resource URL for GET
16 def getCarsUrl():
17
18     return "http://"+getServer()+"/restconf/config/car:cars"
19
20 #People resouce URL for GET
21 def getPersonsUrl():
22
23     return "http://"+getServer()+"/restconf/config/people:people"
24
25 #GET cars persons mapping resource URL
26 def getCarPersonUrl():
27
28     return "http://"+getServer()+"/restconf/config/car-people:car-people"
29
30 #POST or DELETE URL
31 def getAddCarUrl():
32     return "http://"+getServer()+"/restconf/config"
33 #POST or DELETE URL
34 def getAddPersonUrl():
35     return "http://"+getServer()+"/restconf/config"
36
37 #POST URL -using rpc
38 def getAddPersonRpcUrl():
39     return "http://"+getServer()+"/restconf/operations/people:add-person"
40
41 #POST URL for car person mapping
42 def getAddCarPersonUrl():
43    return "http://"+getServer()+"/restconf/config"
44 #POST URL for buy car rpc
45 def getBuyCarRpcUrl():
46     return "http://"+getServer()+"/restconf/operations/car-purchase:buy-car"
47
48
49 # Template for Car resource payload
50 add_car_payload_template = Template( '{\"car:cars\":{'
51     '\"car-entry\": ['
52         '{'
53             '\"id\": \"$id\",'
54             '\"category\": \"$category\",'
55             '\"model\": \"$model\",'
56             '\"manufacturer\": \"$manufacturer\",'
57             '\"year\": \"$year\"'
58         '}'
59     ']'
60 '}'
61 '}')
62
63 # Template for Person resource payload
64 add_person_payload_template =  Template( '{\"people:people":{'
65     '\"person\": ['
66         '{'
67             '\"id\": \"$personId\",'
68             '\"gender\": \"$gender\",'
69             '\"age\": \"$age\",'
70             '\"address\": \"$address\",'
71             '\"contactNo\":\"$contactNo\"'
72         '}'
73             ']'
74      '}}')
75
76 # Template for Car Person mapping  payload
77 add_car_person_template = Template('{\"car-people:car-people\":{'
78     '\"car-person\": ['
79         '{'
80            ' \"car-id\": \"$Id\",'
81             '\"person-id\": \"$personId\"'
82         '}'
83     ']'
84 '}'
85 '}')
86
87 # Template for adding person using RPC
88 add_person_rpc_payload_template = Template ( '{'
89                                                  '\"input\":'
90                                                      '{'
91                                                          '\"people:id\" : \"$personId\",'
92                                                          '\"people:gender\":\"$gender\",'
93                                                          '\"people:address\" : \"$address\",'
94                                                          '\"people:contactNo\":\"$contactNo\",'
95                                                          '\"people:age\":\"$age\"'
96                                                      '}'
97                                              '}')
98
99 # Template for buing car rpc
100 buy_car_rpc_template = Template ( '{'
101     '\"input\" :'
102         '{'
103             '\"car-purchase:person\" : \"/people:people/people:person[people:id=\'$personId\']\",'
104             '\"car-purchase:person-id\" : \"$personId\",'
105             '\"car-purchase:car-id\" : \"$carId\"'
106         '}'
107 '}')
108
109
110