Fix 'Row cannot be cast to Interface' exceptions
[ovsdb.git] / openstack / net-virt / src / main / java / org / opendaylight / ovsdb / openstack / netvirt / NetworkHandler.java
index 9a06f944789661a7dbb28134eb5b23dfc6aa4f94..4259441aab1cc80b07874ca36ec5b6f99a09f4cd 100644 (file)
@@ -175,23 +175,23 @@ public class NetworkHandler extends AbstractHandler
                             for (Row portRow : ports.values()) {
                                 Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
                                 for (UUID interfaceUuid : port.getInterfacesColumn().getData()) {
-                                    Interface interfaceRow = (Interface) ovsdbConfigurationService
+                                    Row ifaceRow = ovsdbConfigurationService
                                             .getRow(node,
                                                     ovsdbConfigurationService.getTableName(node, Interface.class),
                                                     interfaceUuid.toString());
-
-                                    String interfaceType = interfaceRow.getTypeColumn().getData();
+                                    Interface iface = ovsdbConfigurationService.getTypedRow(node, Interface.class, ifaceRow);
+                                    String interfaceType = iface.getTypeColumn().getData();
                                     if (interfaceType.equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VXLAN)
                                         || interfaceType.equalsIgnoreCase(
                                             NetworkHandler.NETWORK_TYPE_GRE)) {
                                         /* delete tunnel ports on this node */
-                                        logger.trace("Delete tunnel interface {}", interfaceRow);
+                                        logger.trace("Delete tunnel interface {}", iface.getName());
                                         ovsdbConfigurationService.deleteRow(node,
                                                                      ovsdbConfigurationService.getTableName(node, Port.class),
                                                                      port.getUuid().toString());
                                         break;
-                                    } else if (!phyIfName.isEmpty() && phyIfName.contains(interfaceRow.getName())) {
-                                        logger.trace("Delete physical interface {}", interfaceRow);
+                                    } else if (!phyIfName.isEmpty() && phyIfName.contains(iface.getName())) {
+                                        logger.trace("Delete physical interface {}", iface.getName());
                                         ovsdbConfigurationService.deleteRow(node,
                                                                      ovsdbConfigurationService.getTableName(node, Port.class),
                                                                      port.getUuid().toString());