-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathSwitchManagerAPI.py
More file actions
66 lines (56 loc) · 3.18 KB
/
Copy pathSwitchManagerAPI.py
File metadata and controls
66 lines (56 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"""
"""
from BasicAPI import *
from RequestData import *
class SwitchManagerAPI(BasicAPI):
def __init__(self, format):
BasicAPI.__init__(self, format, app='switchmanager')
def retrieve_all_nodes(self, container):
self.uri = '/' + self.app + '/' + container + '/nodes'
self.method = 'GET'
self.data = None
self.headers = {'Accept': 'application/' + self.format}
return RequestData(uri=self.uri, method=self.method, data=self.data, headers=self.headers)
def save_nodes_config(self, container):
self.uri = '/' + self.app + '/' + container + '/save'
self.method = 'POST'
self.data = None
self.headers = {'Accept': 'application/' + self.format}
return RequestData(uri=self.uri, method=self.method, data=self.data, headers=self.headers)
def retrieve_node_connectors_by_node(self, nodeId, nodeType, container):
self.uri = '/' + self.app + '/' + container + \
'/node/' + nodeType + '/' + nodeId
self.method = 'GET'
self.data = None
self.headers = {'Accept': 'application/' + self.format}
return RequestData(uri=self.uri, method=self.method, data=self.data, headers=self.headers)
def del_node_property(self, nodeId, propertyName, nodeType, container):
self.uri = '/' + self.app + '/' + container + '/node/' + \
nodeType + '/' + nodeId + '/property/' + propertyName
self.method = 'DELETE'
self.data = None
self.headers = {'Accept': 'application/' + self.format}
return RequestData(uri=self.uri, method=self.method, data=self.data, headers=self.headers)
def add_node_property(self, nodeId, propertyName, propertyValue, nodeType, container):
self.uri = '/' + self.app + '/' + container + '/node/' + nodeType + \
'/' + nodeId + '/property/' + propertyName + '/' + propertyValue
self.method = 'PUT'
self.data = None
self.headers = {'Accept': 'application/' + self.format}
return RequestData(uri=self.uri, method=self.method, data=self.data, headers=self.headers)
def del_node_connector_property(self, nodeId, propertyName, nodeConnectorId, nodeType, nodeConnectorType, container):
self.uri = '/' + self.app + '/' + container + '/nodeconnector/' + nodeType + '/' + \
nodeId + '/' + nodeConnectorType + '/' + \
nodeConnectorId + '/property/' + propertyName
self.method = 'DELETE'
self.data = None
self.headers = {'Accept': 'application/' + self.format}
return RequestData(uri=self.uri, method=self.method, data=self.data, headers=self.headers)
def add_node_connector_property(self, nodeId, nodeConnectorId, nodeType, nodeConnectorType, propertyName, propertyValue, container):
self.uri = '/' + self.app + '/' + container + '/nodeconnector/' + nodeType + '/' + nodeId + '/' + \
nodeConnectorType + '/' + nodeConnectorId + \
'/property/' + propertyName + '/' + propertyValue
self.method = 'PUT'
self.data = None
self.headers = {'Accept': 'application/' + self.format}
return RequestData(uri=self.uri, method=self.method, data=self.data, headers=self.headers)