Step 1: Move vm scripts to the right place
[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
13 def getServer():
14     return hostname + ":" + port  # noqa
15
16
17 def getCarsUrl():
18     """Cars resource URL for GET"""
19     return "http://" + getServer() + "/restconf/config/car:cars"
20
21
22 def getPersonsUrl():
23     """People resouce URL for GET"""
24     return "http://" + getServer() + "/restconf/config/people:people"
25
26
27 def getCarPersonUrl():
28     """GET cars persons mapping resource URL"""
29     return "http://" + getServer() + "/restconf/config/car-people:car-people"
30
31
32 def getAddCarUrl():
33     """POST or DELETE URL"""
34     return "http://" + getServer() + "/restconf/config"
35
36
37 def getAddPersonUrl():
38     """POST or DELETE URL"""
39     return "http://" + getServer() + "/restconf/config"
40
41
42 def getAddPersonRpcUrl():
43     """POST URL -using rpc"""
44     return "http://" + getServer() + "/restconf/operations/people:add-person"
45
46
47 def getAddCarPersonUrl():
48     """POST URL for car person mapping"""
49     return "http://" + getServer() + "/restconf/config"
50
51
52 def getBuyCarRpcUrl():
53     """POST URL for buy car rpc"""
54     return "http://" + getServer() + "/restconf/operations/car-purchase:buy-car"
55
56
57 # Template for Car resource payload
58 add_car_payload_template = Template(
59     """
60     {"car:cars":{
61         "car-entry": [
62             {
63                 "id": "$id",
64                 "category": "$category",
65                 "model": "$model",
66                 "manufacturer": "$manufacturer",
67                 "year": "$year"
68             }
69         ]
70     }}
71     """)
72
73 # Template for Person resource payload
74 add_person_payload_template = Template(
75     """
76     {"people:people":{
77         "person": [
78             {
79                 "id": "$personId",
80                 "gender": "$gender",
81                 "age": "$age",
82                 "address": "$address",
83                 "contactNo":"$contactNo"
84             }
85         ]
86     }}
87     """)
88
89 # Template for Car Person mapping  payload
90 add_car_person_template = Template(
91     """
92     {"car-people:car-people":{
93         "car-person": [
94             {
95                 "car-id": "$Id",
96                 "person-id": "$personId"
97             }
98         ]
99     }}
100     """)
101
102 # Template for adding person using RPC
103 add_person_rpc_payload_template = Template(
104     """
105     {
106     "input":
107         {
108             "people:id" : "$personId",
109             "people:gender":"$gender",
110             "people:address" : "$address",
111             "people:contactNo":"$contactNo",
112             "people:age":"$age"
113         }
114     }
115     """)
116
117 # Template for buying car rpc
118 buy_car_rpc_template = Template(
119     """
120     {
121     "input" :
122         {
123             "car-purchase:person" : "/people:people/people:person[people:id='$personId']",
124             "car-purchase:person-id" : "$personId",
125             "car-purchase:car-id" : "$carId"
126         }
127     }
128     """)