- private void processRowUpdate(Node node, String tableName, String uuid, Row row,
- Object context, Action action) {
- if (action == Action.DELETE) {
- if (tableName.equalsIgnoreCase(ovsdbConfigurationService.getTableName(node, Interface.class))) {
- logger.debug("Processing update of {}. Deleted node: {}, uuid: {}, row: {}", tableName, node, uuid, row);
- Interface deletedIntf = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
- NeutronNetwork network = null;
- if (context == null) {
- network = tenantNetworkManager.getTenantNetwork(deletedIntf);
- } else {
- network = (NeutronNetwork)context;
- }
- List<String> phyIfName = bridgeConfigurationManager.getAllPhysicalInterfaceNames(node);
- logger.info("Delete interface " + deletedIntf.getName());
-
- if (deletedIntf.getTypeColumn().getData().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VXLAN) ||
- deletedIntf.getTypeColumn().getData().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_GRE) ||
- phyIfName.contains(deletedIntf.getName())) {
- /* delete tunnel interfaces or physical interfaces */
- this.handleInterfaceDelete(node, uuid, deletedIntf, false, null);
- } else if (network != null && !network.getRouterExternal()) {
- logger.debug("Processing update of {}:{} node {} intf {} network {}",
- tableName, action, node, uuid, network.getNetworkUUID());
- try {
- ConcurrentMap<String, Row> interfaces = this.ovsdbConfigurationService
- .getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
- if (interfaces != null) {
- boolean isLastInstanceOnNode = true;
- for (String intfUUID : interfaces.keySet()) {
- if (intfUUID.equals(uuid)) continue;
- Interface intf = this.ovsdbConfigurationService.getTypedRow(node, Interface.class, interfaces.get(intfUUID));
- NeutronNetwork neutronNetwork = tenantNetworkManager.getTenantNetwork(intf);
- if (neutronNetwork != null && neutronNetwork.equals(network)) isLastInstanceOnNode = false;
- }
- this.handleInterfaceDelete(node, uuid, deletedIntf, isLastInstanceOnNode, network);
- }
- } catch (Exception e) {
- logger.error("Error fetching Interface Rows for node " + node, e);
- }
- }
- }
- }
- else if (tableName.equalsIgnoreCase(ovsdbConfigurationService.getTableName(node, Interface.class))) {
- logger.debug("Processing update of {}:{} node: {}, interface uuid: {}, row: {}",
- tableName, action, node, uuid, row);
- Interface intf = this.ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
- NeutronNetwork network = tenantNetworkManager.getTenantNetwork(intf);
- if (network != null && !network.getRouterExternal()) {
- if (networkingProviderManager.getProvider(node).hasPerTenantTunneling()) {
- int vlan = tenantNetworkManager.networkCreated(node, network.getID());
- String portUUID = this.getPortIdForInterface(node, uuid, intf);
- if (portUUID != null) {
- logger.debug("Neutron Network {}:{} Created with Internal vlan {} port {}",
- network.getNetworkUUID(), network.getNetworkName(), vlan, portUUID);
- tenantNetworkManager.programInternalVlan(node, portUUID, network);
- } else {
- logger.trace("Neutron Network {}:{} Created with Internal vlan {} but have no portUUID",
- network.getNetworkUUID(), network.getNetworkName(), vlan);
- }
- }
- this.handleInterfaceUpdate(node, uuid, intf);
- }
-
- } else if (tableName.equalsIgnoreCase(ovsdbConfigurationService.getTableName(node, Port.class))) {
- logger.debug("Processing update of {}:{} node: {}, port uuid: {}, row: {}", tableName, action, node, uuid, row);
- Port port = this.ovsdbConfigurationService.getTypedRow(node, Port.class, row);
- Set<UUID> interfaceUUIDs = port.getInterfacesColumn().getData();
- for (UUID intfUUID : interfaceUUIDs) {
- logger.trace("Scanning interface "+intfUUID);
- try {
- Row intfRow = this.ovsdbConfigurationService
- .getRow(node, ovsdbConfigurationService.getTableName(node, Interface.class),
- intfUUID.toString());
- Interface intf = this.ovsdbConfigurationService.getTypedRow(node, Interface.class, intfRow);
- NeutronNetwork network = tenantNetworkManager.getTenantNetwork(intf);
- if (network != null && !network.getRouterExternal()) {
- logger.debug("Processing update of {}:{} node {} intf {} network {}",
- tableName, action, node, intfUUID, network.getNetworkUUID());
- tenantNetworkManager.programInternalVlan(node, uuid, network);
- this.handleInterfaceUpdate(node, intfUUID.toString(), intf);
- } else {
- logger.trace("Ignoring update because there is not a neutron network {} for port {}, interface {}",
- network, uuid, intfUUID);
- }
- } catch (Exception e) {
- logger.error("Failed to process row update", e);
- }