Implement lookup_switch_by_name
Change-Id: I76cae8665431837b158a30bb26224963c59e448a
diff --git a/admin.py b/admin.py
index 52f6922..3806f49 100644
--- a/admin.py
+++ b/admin.py
@@ -302,6 +302,15 @@
print 'Deleted vlan_id %d' % vlan_id
except InputError as inst:
print 'Failed: %s' % inst
+elif opts.lookup_switch_by_name is not None:
+ try:
+ switch_id = db.get_switch_id_by_name(opts.lookup_switch_by_name)
+ if switch_id is not None:
+ print 'Switch %s has switch_id %d' % (opts.lookup_switch_by_name, switch_id)
+ else:
+ print 'No switch found for name %s' % opts.lookup_switch_by_name
+ except InputError as inst:
+ print 'Failed: %s' % inst
else:
print 'No recognised command given. Try -h for help'