@Override public void onSuccess(Optional<ServiceFunctionForwarders> optionalSffs) { if (optionalSffs.isPresent()) { ServiceFunctionForwarder sff = findSffByIp(optionalSffs.get(), connectionInfo.getRemoteIp()); if(sff != null) { SfcOvsSffEntryDataListener.addOvsdbAugmentations(sff, opendaylightSfc.getExecutor()); } } }
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 connectionInfoToString(final ConnectionInfo connectionInfo) { return String.valueOf( connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue(); }
public static InstanceIdentifier<Node> createInstanceIdentifier(ConnectionInfo key) { return createInstanceIdentifier(key.getRemoteIp(), key.getRemotePort()); }
public static NodeId createManagedNodeId(ConnectionInfo key, OvsdbBridgeName bridgeName) { return createManagedNodeId(key.getRemoteIp(), key.getRemotePort(), bridgeName); }
public static String connectionInfoToString(final ConnectionInfo connectionInfo) { return String.valueOf( connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue(); }
return false; if (!Objects.equals(_remoteIp, other.getRemoteIp())) { return false;
public static String getNodeIpAddress(OvsdbNodeAugmentation ovsdbNode) { //Currently we support only ipv4 return ovsdbNode.getConnectionInfo().getRemoteIp().getIpv4Address().getValue(); }
private String getRemoteIp(Node ovsdbNode) { Preconditions.checkNotNull(ovsdbNode, "The ovsdbNode was null"); String ip = null; OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode.getAugmentation(OvsdbNodeAugmentation.class); if (ovsdbNodeAugmentation != null && ovsdbNodeAugmentation.getConnectionInfo() != null) { ip = ovsdbNodeAugmentation.getConnectionInfo().getRemoteIp().getIpv4Address().getValue(); } if (ip == null) { LOG.warn("remote_ip was not found for node: {}", ovsdbNode); ip = ""; } return ip; }
/** * Search the Operational Datastore for a specific OvsdbNode. * @param dataBroker The dataBroker instance to create transactions * @param uni The UNI's data * @return The Optional OvsdbNode */ public static Optional<Node> findOvsdbNode(DataBroker dataBroker, UniAugmentation uni) { final List<Node> ovsdbNodes = getOvsdbNodes(dataBroker); Optional<Node> optionalOvsdb; if (!ovsdbNodes.isEmpty()) { for (final Node ovsdbNode : ovsdbNodes) { final OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode .getAugmentation(OvsdbNodeAugmentation.class); if (ovsdbNodeAugmentation.getConnectionInfo() .getRemoteIp() .getIpv4Address() .equals(uni.getIpAddress().getIpv4Address())) { LOG.info("Found ovsdb node"); optionalOvsdb = Optional.of(ovsdbNode); return optionalOvsdb; } } } return Optional.absent(); }
public static ConnectionInfo suppressLocalIpPort(ConnectionInfo connectionInfo) { ConnectionInfoBuilder connectionInfoBuilder = new ConnectionInfoBuilder(); connectionInfoBuilder.setRemoteIp(connectionInfo.getRemoteIp()); connectionInfoBuilder.setRemotePort(connectionInfo.getRemotePort()); return connectionInfoBuilder.build(); }
public static Node createNode(ConnectionInfo key) { NodeBuilder nodeBuilder = new NodeBuilder(); nodeBuilder.setNodeId(createNodeId(key.getRemoteIp(), key.getRemotePort())); nodeBuilder.addAugmentation(OvsdbNodeAugmentation.class, createOvsdbAugmentation(key)); return nodeBuilder.build(); }
private Node readOvsdbNodeByIp(String ipAddress) { Preconditions.checkNotNull(ipAddress, "Cannot READ Node for given ipAddress from OVS operational store, ipAddress is null."); Topology topology = SfcDataStoreAPI.readTransactionAPI(SfcOvsUtil.buildOvsdbTopologyIID(), LogicalDatastoreType.OPERATIONAL); if (topology.getNode() != null) { for (Node node : topology.getNode()) { OvsdbNodeAugmentation ovsdbNodeAug = node.getAugmentation(OvsdbNodeAugmentation.class); if (ovsdbNodeAug != null && ovsdbNodeAug.getConnectionInfo() != null) { IpAddress connectionIp = ovsdbNodeAug.getConnectionInfo().getRemoteIp(); if (connectionIp == null) { return null; } if (connectionIp.getIpv4Address() != null && connectionIp.getIpv4Address().getValue().equals(ipAddress)) { return node; } else if (connectionIp.getIpv6Address() != null && connectionIp.getIpv6Address().getValue().equals(ipAddress)) { return node; } } } } else { LOG.warn( "Cannot READ Node for given ipAddress from OVS operational store, Topology does not contain any Node."); } return null; }
public OvsdbClient connect(InstanceIdentifier<Node> iid, OvsdbNodeAugmentation ovsdbNode) throws UnknownHostException, ConnectException { LOG.info("Connecting to {}", SouthboundUtil.connectionInfoToString(ovsdbNode.getConnectionInfo())); // TODO handle case where we already have a connection // TODO use transaction chains to handle ordering issues between disconnected // TODO and connected when writing to the operational store InetAddress ip = SouthboundMapper.createInetAddress(ovsdbNode.getConnectionInfo().getRemoteIp()); OvsdbClient client = ovsdbConnection.connect(ip, ovsdbNode.getConnectionInfo().getRemotePort().getValue()); // For connections from the controller to the ovs instance, the library doesn't call // this method for us if (client != null) { putInstanceIdentifier(ovsdbNode.getConnectionInfo(), iid.firstIdentifierOf(Node.class)); OvsdbConnectionInstance ovsdbConnectionInstance = connectedButCallBacksNotRegistered(client); ovsdbConnectionInstance.setOvsdbNodeAugmentation(ovsdbNode); // Register Cluster Ownership for ConnectionInfo registerEntityForOwnership(ovsdbConnectionInstance); } else { LOG.warn("Failed to connect to OVSDB Node {}", ovsdbNode.getConnectionInfo()); } return client; }
if (ovsdbNode.getConnectionInfo() != null) { LOG.debug("Received request to update ovsdb node ip: {} port: {}", ovsdbNode.getConnectionInfo().getRemoteIp(), ovsdbNode.getConnectionInfo().getRemotePort()); } else {
LOG.info("Received an OVSDB node create {}", ovsdbNodeAugmentation.getConnectionInfo() .getRemoteIp() .getIpv4Address() .getValue()); .getRemoteIp() .equals(uniAugmentation.getIpAddress())) { final InstanceIdentifier<Node> uniIid = UnimgrMapper.getUniIid(dataBroker, LOG.info("Received a new OVSDB node connection from {}" + ovsdbNodeAugmentation.getConnectionInfo() .getRemoteIp().getIpv4Address());
private void updateConnectionAttributes() { LOG.debug("Update attributes of ovsdb node ip: {} port: {}", this.initialCreateData.getConnectionInfo().getRemoteIp(), this.initialCreateData.getConnectionInfo().getRemotePort()); for ( Map.Entry<DatabaseSchema,TransactInvoker> entry: transactInvokers.entrySet()) {
sffLocator.setIp(ovsdbNodeAug.getConnectionInfo().getRemoteIp()); sffLocator.setPort(ovsdbNodeAug.getConnectionInfo().getRemotePort());