/** * Returns controller details of the Node. * * @param ovnode OVSDB node augmentation. * @return Controller information. */ private String getControllerTarget(@Nonnull OvsdbNodeAugmentation ovnode) { String setControllerStr = null; String controllerIpStr = null; short openflowPort = OPENFLOW_PORT; // Check if ovsdb node has connection info ConnectionInfo connectionInfo = ovnode.getConnectionInfo(); if (connectionInfo != null && connectionInfo.getLocalIp() != null) { controllerIpStr = new String(connectionInfo.getLocalIp().getValue()); } else { LOG.warn("Ovsdb Node does not contains connection info : {}", ovnode); } if (controllerIpStr != null) { LOG.trace("Target OpenFlow Controller found : {}", controllerIpStr); setControllerStr = OPENFLOW_CONNECTION_PROTOCOL + ":" + controllerIpStr + ":" + openflowPort; } else { LOG.warn("Failed to determine OpenFlow controller ip address"); } return setControllerStr; }
public ConnectionInfoBuilder(ConnectionInfo base) { this._localIp = base.getLocalIp(); this._localPort = base.getLocalPort(); this._remoteIp = base.getRemoteIp(); this._remotePort = base.getRemotePort(); if (base instanceof ConnectionInfoImpl) { ConnectionInfoImpl impl = (ConnectionInfoImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
public static String getControllerTarget(Node ovsdbNode) { String target = null; String ipAddr = null; OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode.getAugmentation(OvsdbNodeAugmentation.class); ConnectionInfo connectionInfo = ovsdbNodeAugmentation.getConnectionInfo(); LOG.info("connectionInfo: {}", connectionInfo); if (connectionInfo != null && connectionInfo.getLocalIp() != null) { ipAddr = String.valueOf(connectionInfo.getLocalIp().getValue()); } if (ipAddr == null) { ipAddr = getLocalControllerHostIpAddress(); } if (ipAddr != null) { target = SouthboundConstants.OPENFLOW_CONNECTION_PROTOCOL + ":" + ipAddr + ":" + SouthboundConstants.DEFAULT_OPENFLOW_PORT; } return target; }
private static List<ControllerEntry> getControllerEntries(OvsdbNodeAugmentation connection) { ControllerEntryBuilder controllerBuilder = new ControllerEntryBuilder(); List<ControllerEntry> result = new ArrayList<>(); if (connection.getConnectionInfo().getLocalIp() != null) { String localIp = String.valueOf(connection.getConnectionInfo().getLocalIp().getValue()); String targetString = "tcp:" + localIp + ":" + OF_PORT; controllerBuilder.setTarget(new Uri(targetString)); result.add(controllerBuilder.build()); } return result; }
if (!Objects.equals(_localIp, other.getLocalIp())) { return false;
} else if (tokens[0].equalsIgnoreCase("ptcp")) { ConnectionInfo connectionInfo = ovsdbNodeAugmentation.getConnectionInfo(); if (connectionInfo != null && connectionInfo.getLocalIp() != null) { controllerIpStr = String.valueOf(connectionInfo.getLocalIp().getValue()); controllersStr.add(Constants.OPENFLOW_CONNECTION_PROTOCOL + ":" + controllerIpStr + ":" + Constants.OPENFLOW_PORT);
} else if (tokens[0].equalsIgnoreCase("ptcp")) { ConnectionInfo connectionInfo = ovsdbNodeAugmentation.getConnectionInfo(); if (connectionInfo != null && connectionInfo.getLocalIp() != null) { controllerIpStr = String.valueOf(connectionInfo.getLocalIp().getValue()); controllersStr.add(OPENFLOW_CONNECTION_PROTOCOL + ":" + controllerIpStr + ":" + OPENFLOW_PORT);
} else if (tokens[0].equalsIgnoreCase("ptcp")) { ConnectionInfo connectionInfo = ovsdbNodeAugmentation.getConnectionInfo(); if (connectionInfo != null && connectionInfo.getLocalIp() != null) { controllerIpStr = String.valueOf(connectionInfo.getLocalIp().getValue()); controllersStr.add(Constants.OPENFLOW_CONNECTION_PROTOCOL + ":" + controllerIpStr + ":" + Constants.OPENFLOW_PORT);