public static ConnectionInfo getConnectionInfo(final String addressStr, final String portStr) { InetAddress inetAddress = null; try { inetAddress = InetAddress.getByName(addressStr); } catch (UnknownHostException e) { LOG.warn("Could not allocate InetAddress", e); } IpAddress address = createIpAddress(inetAddress); PortNumber port = new PortNumber(Integer.parseInt(portStr)); LOG.info("connectionInfo: {}", new ConnectionInfoBuilder() .setRemoteIp(address) .setRemotePort(port) .build()); return new ConnectionInfoBuilder() .setRemoteIp(address) .setRemotePort(port) .build(); }
public static ConnectionInfo suppressLocalIpPort(ConnectionInfo connectionInfo) { ConnectionInfoBuilder connectionInfoBuilder = new ConnectionInfoBuilder(); connectionInfoBuilder.setRemoteIp(connectionInfo.getRemoteIp()); connectionInfoBuilder.setRemotePort(connectionInfo.getRemotePort()); return connectionInfoBuilder.build(); }
/** * Creates and Build the data for an OvsdbNodeAugmentation. * @param uni The UNI"s data * @return The built OsvdbNodeAugmentation */ public static OvsdbNodeAugmentation createOvsdbNodeAugmentation(Uni uni) { final ConnectionInfo connectionInfos = new ConnectionInfoBuilder() .setRemoteIp(uni.getIpAddress()) .setRemotePort(new PortNumber(UnimgrConstants.OVSDB_PORT)) .build(); final OvsdbNodeAugmentation ovsdbNode = new OvsdbNodeAugmentationBuilder() .setConnectionInfo(connectionInfos).build(); return ovsdbNode; }
/** * Create and build an OvsdbNodeAugmentation. * @param uni the UNI data * @param remotePort port number * @return OvsdbNodeAugmentation */ public static OvsdbNodeAugmentation createOvsdbNodeAugmentation(UniAugmentation uni, PortNumber remotePort) { final ConnectionInfo connectionInfos = new ConnectionInfoBuilder() .setRemoteIp(uni.getIpAddress()) .setRemotePort(remotePort) .build(); final OvsdbNodeAugmentation ovsdbNode = new OvsdbNodeAugmentationBuilder() .setConnectionInfo(connectionInfos) .setQosEntries(createQosEntries(uni)) .setQueues(createQueues(uni)) .build(); return ovsdbNode; }
public static ConnectionInfo createConnectionInfo(OvsdbClient client) { ConnectionInfoBuilder connectionInfoBuilder = new ConnectionInfoBuilder(); connectionInfoBuilder.setRemoteIp(createIpAddress(client.getConnectionInfo().getRemoteAddress())); connectionInfoBuilder.setRemotePort(new PortNumber(client.getConnectionInfo().getRemotePort())); connectionInfoBuilder.setLocalIp(createIpAddress(client.getConnectionInfo().getLocalAddress())); connectionInfoBuilder.setLocalPort(new PortNumber(client.getConnectionInfo().getLocalPort())); return connectionInfoBuilder.build(); }