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