If we're passed a VLAN tag of -1, find and allocate the first unused

Change-Id: Ibabf1c88ec33aa382d3d35b5af468aeb3ee708a8
diff --git a/util.py b/util.py
index 864591e..d1b2a51 100644
--- a/util.py
+++ b/util.py
@@ -203,6 +203,11 @@
         db = state.db
         config = state.config
 
+        # Check for tag == -1, i.e. use the next available tag
+        if tag == -1:
+            tag = db.find_lowest_unused_vlan_tag()
+            logging.debug('create_vlan called with a tag of -1, found first unused tag %d', tag)
+
         # 1. Database record first
         try:
             logging.debug('Adding DB record first: name %s, tag %d, is_base_vlan %d', name, tag, is_base_vlan)
@@ -291,7 +296,7 @@
             s.switch_disconnect()
             del s
 
-        return vlan_id # If we're successful
+        return (vlan_id, tag) # If we're successful
 
     # Complex call
     # 1. Check in the DB if there are any ports on the VLAN. Bail if so