public static ConnectionInfo suppressLocalIpPort(ConnectionInfo connectionInfo) { ConnectionInfoBuilder connectionInfoBuilder = new ConnectionInfoBuilder(); connectionInfoBuilder.setRemoteIp(connectionInfo.getRemoteIp()); connectionInfoBuilder.setRemotePort(connectionInfo.getRemotePort()); return connectionInfoBuilder.build(); }
private ConnectionInfoImpl(ConnectionInfoBuilder base) { this._localIp = base.getLocalIp(); this._localPort = base.getLocalPort(); this._remoteIp = base.getRemoteIp(); this._remotePort = base.getRemotePort(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
public ConnectionInfoBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo> augmentation) { if (augmentation == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentation); return this; }
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(); }
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(); }
/** * 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; }