Implement get_port_by_switch_and_name
Change-Id: Ie8702c915b6aa26b2daeaea5cdddd04c023e896f
diff --git a/admin.py b/admin.py
index 91c2697..d4b3a92 100644
--- a/admin.py
+++ b/admin.py
@@ -345,6 +345,15 @@
print 'No port found for port_id %d' % opts.show_port
except InputError as inst:
print 'Failed: %s' % inst
+elif opts.lookup_port_by_switch_and_name is not None:
+ try:
+ port = db.get_port_by_switch_and_name(opts.lookup_port_by_switch_and_name[0], opts.lookup_port_by_switch_and_name[1])
+ if port is not None:
+ print port
+ else:
+ print 'No port found for switch_id %d, name %s' % (int(opts.lookup_port_by_switch_and_name[0]), opts.lookup_port_by_switch_and_name[1])
+ except InputError as inst:
+ print 'Failed: %s' % inst
else:
print 'No recognised command given. Try -h for help'