aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve McIntyre <steve.mcintyre@linaro.org>2014-12-17 16:29:01 +0000
committerSteve McIntyre <steve.mcintyre@linaro.org>2014-12-17 16:29:01 +0000
commit5076715a68eec83f23dd7f68b0317954206e1968 (patch)
treeb7d8b779177eb0230123a3af102433fed642deb2
parentc3b659b9a864b610a85c9872df6fdfda5cf13da6 (diff)
Add vlan_update and vland_api calls
Change-Id: I4152360fe84b7d5746ef1e7a3f31b0b1e5f0f62e
-rw-r--r--vland.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/vland.py b/vland.py
index 87f86dc..9fab8d5 100644
--- a/vland.py
+++ b/vland.py
@@ -150,6 +150,30 @@ while True:
print 'FOO?'
pass
+ # Next, calls that may manipulate switch state *as well* as state
+ # in the database - changes to VLAN setup.
+ #
+ # As/when/if we add authentication, use of this function will need
+ # it.
+ if json_data['type'] == 'vlan_update':
+ response['type'] = 'response'
+ try:
+ response['data'] = util.perform_vlan_update(state, json_data['command'], json_data['data'])
+ response['response'] = 'ACK'
+ except InputError as e:
+ print e
+ response['response'] = 'ERROR'
+ response['error'] = e.__str__()
+ print 'FOO?'
+ pass
+
+ # Finally, IPC interface for more complex API calls.
+ # NOT IMPLEMENTED YET
+ if json_data['type'] == 'vland_api':
+ response['type'] = 'response'
+ response['response'] = 'ERROR'
+ response['error'] = 'VLANd API not yet implemented...'
+
print "sending reply:"
print response