public Host(IpAddress _ipAddress) { super(); this._ipAddress = _ipAddress; this._domainName = null; this._value = _ipAddress.getValue(); }
public BgpNextHopType(IpAddress _ipAddress) { super(); this._ipAddress = _ipAddress; this._enumeration = null; this._value = _ipAddress.getValue(); }
private static String ipv4PrefixOf(IpAddress ipAddress) { return new String(ipAddress.getValue()) + "/32"; }
private static String ipv6PrefixOf(IpAddress ipAddress) { return new String(ipAddress.getValue()) + "/128"; }
/** * Handle gateway ip. * * @param gatewayIp * the gateway ip * @return the string */ private String handleGatewayIp(IpAddress gatewayIp) { String strGatewayIp = (gatewayIp == null) ? null : String.valueOf(gatewayIp.getValue()); if (StringUtils.isBlank(strGatewayIp) || StringUtils.equals(ITMConstants.DUMMY_IP_ADDRESS, strGatewayIp)) { // To avoid a validation exception in TepCommandHelper strGatewayIp = null; } return strGatewayIp; }
public char[] getValue() { if (_value == null) { if (_ipAddress != null) { _value = _ipAddress.getValue(); } else if (_domainName != null) { _value = _domainName.getValue().toString().toCharArray(); } } return _value == null ? null : _value.clone(); }
@Override public String toString() { List<String> lstTunnelIps = new ArrayList<>(); if (this.tunnelIps != null) { for (IpAddress ip : this.tunnelIps) { lstTunnelIps.add(String.valueOf(ip.getValue())); } } List<String> lstMacs = Lists.transform(this.ucastLocalMacs, new Function<LocalUcastMacs, String>() { @Override public String apply(LocalUcastMacs localUcastMac) { return localUcastMac.getMacEntryKey().getValue(); } }); StringBuilder builder = new StringBuilder(); builder.append("L2GatewayDevice [deviceName=").append(deviceName).append(", hwvtepNodeId=").append(hwvtepNodeId) .append(", tunnelIps=").append(lstTunnelIps).append(", l2GatewayIds=").append(l2GatewayIds) .append(", ucastLocalMacs=").append(lstMacs).append("]"); return builder.toString(); }
public static IpPrefix createGwPrefix(IpAddress ipAddress, IpPrefix network) { StringBuilder buf = new StringBuilder(); buf.append(ipAddress.getValue()); String str = network.getIpv4Prefix().getValue(); buf.append(str.substring(str.indexOf("/"))); return new IpPrefix(new Ipv4Prefix(buf.toString())); }
public char[] getValue() { if (_value == null) { if (_ipPrefix != null) { _value = _ipPrefix.getValue(); } else if (_ipAddress != null) { _value = _ipAddress.getValue(); } } return _value == null ? null : _value.clone(); }
private boolean isSffOnBridge(Node bridgeNode, ServiceFunctionForwarder serviceFunctionForwarder) { String localIp = ""; Ip ip = sfcUtils.getSffIp(serviceFunctionForwarder); Node ovsdbNode = southbound.readOvsdbNode(bridgeNode); if (ovsdbNode != null) { localIp = getRemoteIp(ovsdbNode); } LOG.info("isSffOnBridge: {}: {}, localIp/remoteIp: {}, sff ip: {}", bridgeNode.getNodeId().getValue(), localIp.equals(String.valueOf(ip.getIp().getValue())), localIp, ip.getIp().getValue()); return localIp.equals(String.valueOf(ip.getIp().getValue())); }
public static NodeId createNodeId(IpAddress ip, PortNumber port) { String uriString = OVSDB_URI_PREFIX + "://" + String.valueOf(ip.getValue()) + ":" + port.getValue(); Uri uri = new Uri(uriString); return new NodeId(uri); }
public static String connectionInfoToString(final ConnectionInfo connectionInfo) { return String.valueOf( connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue(); }
/** * Gets the allowed address pairs for acl service. * * @param macAddress the mac address * @param fixedIps the fixed ips * @return the allowed address pairs for acl service */ protected static List<AllowedAddressPairs> getAllowedAddressPairsForAclService(MacAddress macAddress, List<FixedIps> fixedIps) { List<AllowedAddressPairs> aclAllowedAddressPairs = new ArrayList<>(); for (FixedIps fixedIp : fixedIps) { aclAllowedAddressPairs.add(getAclAllowedAddressPairs(macAddress, new org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddress( fixedIp.getIpAddress().getValue()))); } return aclAllowedAddressPairs; }
public static String connectionInfoToString(final ConnectionInfo connectionInfo) { return String.valueOf( connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue(); }
/** * Gets the IPv6 Link Local Address corresponding to the MAC Address. * * @param macAddress the mac address * @return the allowed address pairs for acl service which includes the MAC + IPv6LLA */ protected static AllowedAddressPairs updateIPv6LinkLocalAddressForAclService(MacAddress macAddress) { IpAddress ipv6LinkLocalAddress = getIpv6LinkLocalAddressFromMac(macAddress); return getAclAllowedAddressPairs(macAddress, new org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddress( ipv6LinkLocalAddress.getValue())); }
public static List<Neutron_IPs> convertMDSalIpToNeutronIp(List<FixedIps> fixedIps) { List<Neutron_IPs> ips = null; if (fixedIps != null) { ips = new ArrayList<>(); for (FixedIps mdIP : fixedIps) { Neutron_IPs ip = new Neutron_IPs(); ip.setIpAddress(String.valueOf(mdIP.getIpAddress().getValue())); ip.setSubnetUUID(mdIP.getSubnetId().getValue()); ips.add(ip); } } return ips; }
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; }
public static VtepConfigSchema validateVtepConfigSchema(VtepConfigSchema schema) { Preconditions.checkNotNull(schema); Preconditions.checkArgument(StringUtils.isNotBlank(schema.getSchemaName())); Preconditions.checkArgument(StringUtils.isNotBlank(schema.getPortName())); Preconditions.checkArgument((schema.getVlanId() >= 0 && schema.getVlanId() < 4095), "Invalid VLAN ID, range (0-4094)"); Preconditions.checkArgument(StringUtils.isNotBlank(schema.getTransportZoneName())); Preconditions.checkNotNull(schema.getSubnet()); String subnetCidr = getSubnetCidrAsString(schema.getSubnet()); SubnetUtils subnetUtils = new SubnetUtils(subnetCidr); IpAddress gatewayIp = schema.getGatewayIp(); if (gatewayIp != null) { String strGatewayIp = String.valueOf(gatewayIp.getValue()); if (!strGatewayIp.equals(ITMConstants.DUMMY_IP_ADDRESS) && !subnetUtils.getInfo().isInRange(strGatewayIp)) { Preconditions.checkArgument(false, new StringBuilder("Gateway IP address ").append(strGatewayIp) .append(" is not in subnet range ").append(subnetCidr).toString()); } } ItmUtils.getExcludeIpAddresses(schema.getExcludeIpFilter(), subnetUtils.getInfo()); return new VtepConfigSchemaBuilder(schema).setTunnelType(schema.getTunnelType()).build(); } public static String validateTunnelType(String tunnelType) {
protected NeutronFloatingIP fromMd(Floatingip fip) { NeutronFloatingIP result = new NeutronFloatingIP(); result.setID(String.valueOf(fip.getUuid().getValue())); if (fip.getFloatingNetworkId() != null) { result.setFloatingNetworkUUID(String.valueOf(fip.getFloatingNetworkId().getValue())); } if (fip.getPortId() != null) { result.setPortUUID(String.valueOf(fip.getPortId().getValue())); } if (fip.getFixedIpAddress() != null ) { result.setFixedIPAddress(String.valueOf(fip.getFixedIpAddress().getValue())); } if (fip.getFloatingIpAddress() != null) { result.setFloatingIPAddress(String.valueOf(fip.getFloatingIpAddress().getValue())); } if (fip.getTenantId() != null) { result.setTenantUUID(String.valueOf(fip.getTenantId().getValue())); } if (fip.getRouterId() != null) { result.setRouterUUID(String.valueOf(fip.getRouterId().getValue())); } result.setStatus(fip.getStatus()); return result; }