- Map<String, String> externalIds = intf.getExternalIdsColumn().getData();
- if (externalIds == null) {
- logger.error("No external_ids seen in {}", intf);
- return;
- }
-
- String attachedMac = externalIds.get(Constants.EXTERNAL_ID_VM_MAC);
- if (attachedMac == null) {
- logger.error("No AttachedMac seen in {}", intf);
- return;
- }
-
- Map<String, Row> intfs = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
- if (intfs != null) {
- for (Row row : intfs.values()) {
- Interface ethIntf = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
- if (ethIntf.getName().equalsIgnoreCase(bridgeConfigurationManager.getPhysicalInterfaceName(node, network.getProviderPhysicalNetwork()))) {
- of_ports = ethIntf.getOpenFlowPortColumn().getData();
- timeout = 6;
- while ((of_ports == null) && (timeout > 0)) {
- of_ports = ethIntf.getOpenFlowPortColumn().getData();
- if (of_ports == null || of_ports.size() <= 0) {
- // Wait for the OVSDB update to sync up the Local cache.
- Thread.sleep(500);
- timeout--;
- }
- }
-
- if (of_ports == null || of_ports.size() <= 0) {
- logger.error("Could NOT Identify eth port {} on {}", ethIntf.getName(), node);
- continue;
- }
- long ethOFPort = (Long)of_ports.toArray()[0];
-
- if (ethOFPort == -1) {
- logger.error("Could NOT Identify eth port {} -> OF ({}) on {}", ethIntf.getName(), ethOFPort, node);
- throw new Exception("port number < 0");
- }
- logger.debug("Identified eth port {} -> OF ({}) on {}", ethIntf.getName(), ethOFPort, node);
- // TODO: add logic to only add rule on remote nodes
- programRemoteEgressVlanRules(node, dpid, network.getProviderSegmentationID(), attachedMac, ethOFPort);
- programLocalIngressVlanRules(node, dpid, network.getProviderSegmentationID(), attachedMac, localPort, ethOFPort);
- return;