More database fixes for the RealDict database changes

Change-Id: Iae93c819a5b1874ac8ff7fdcec6f08d391c588d6
diff --git a/db/db.py b/db/db.py
index 82cd633..c258a5e 100644
--- a/db/db.py
+++ b/db/db.py
@@ -242,12 +242,12 @@
             port = self.get_port_by_id(int(port_id))
             if port is None:
                 raise NotFoundError("Port ID %d does not exist" % int(port_id))
-            if not port.is_trunk:
+            if not port['is_trunk']:
                 raise InputError("Port ID %d is not in trunk mode" % int(port_id))
-            if port.is_locked:
+            if port['is_locked']:
                 raise InputError("Port ID %d is locked" % int(port_id))
-            if port.trunk_id != TRUNK_ID_NONE:
-                raise InputError("Port ID %d is already on trunk ID %d" % (int(port_id), int(port.trunk_id)))
+            if port['trunk_id'] != TRUNK_ID_NONE:
+                raise InputError("Port ID %d is already on trunk ID %d" % (int(port_id), int(port['trunk_id'])))
 
         try:
             # Add the trunk itself
@@ -305,7 +305,7 @@
         port = self.get_port_by_id(port_id)
         if port is None:
             raise NotFoundError("Port ID %d does not exist" % int(port_id))
-        if port.is_locked:
+        if port['is_locked']:
             raise InputError("Cannot delete port ID %d as it is locked" % int(port_id))
         self._delete_row("port", "port_id", port_id)
         return port_id
@@ -702,7 +702,7 @@
         if port is None:
             raise NotFoundError("Port ID %d does not exist" % int(port_id))
 
-        if port.is_trunk or port.is_locked:
+        if port['is_trunk'] or port['is_locked']:
             raise CriticalError("The port is locked")
 
         vlan = self.get_vlan_by_id(vlan_id)
@@ -734,13 +734,13 @@
         if port is None:
             raise NotFoundError("Port ID %d does not exist" % int(port_id))
 
-        if port.is_trunk or port.is_locked:
+        if port['is_trunk'] or port['is_locked']:
             raise CriticalError("The port is locked")
 
         vlan = self.get_vlan_by_id(vlan_id)
         if vlan is None:
             raise NotFoundError("VLAN ID %d does not exist" % int(vlan_id))
-        if not vlan.is_base_vlan:
+        if not vlan['is_base_vlan']:
             raise InputError("VLAN ID %d is not a base VLAN" % int(vlan_id))
 
         try:
@@ -764,7 +764,7 @@
         port = self.get_port_by_id(port_id)
         if port is None:
             raise NotFoundError("Port ID %d does not exist" % int(port_id))
-        if port.is_locked:
+        if port['is_locked']:
             raise CriticalError("The port is locked")
         try:
             sql = "UPDATE port SET trunk_id=%s WHERE port_id=%s RETURNING port_id"