/** * Returns PccId created from the given client URI. * * @param uri device URI * @return pccid */ public static PccId pccid(URI uri) { checkArgument(uri.getScheme().equals(SCHEME), "Unsupported URI scheme"); return new PccId(IpAddress.valueOf(uri.getSchemeSpecificPart())); }
/** * Returns BGPId created from the given device URI. * * @param uri device URI * @return object of BGPId */ public static BgpId bgpId(URI uri) { checkArgument(uri.getScheme().equals(SCHEME), "Unsupported URI scheme"); return new BgpId(IpAddress.valueOf(uri.getSchemeSpecificPart())); }
@Override public ControllerInfo localController() { IpAddress ipAddress = IpAddress.valueOf(((InetSocketAddress) channel.localAddress()).getAddress()); return new ControllerInfo(ipAddress, OFPORT, "tcp"); }
/** * Converts an integer and a prefix length into an IPv4 prefix. * * @param address an integer representing the IPv4 address * @param prefixLength the prefix length * @return an IP prefix * @throws IllegalArgumentException if the prefix length value is invalid */ public static IpPrefix valueOf(int address, int prefixLength) { return new IpPrefix(IpAddress.valueOf(address), prefixLength); }
/** * Converts a byte array and a prefix length into an IP prefix. * * @param version the IP address version * @param address the IP address value stored in network byte order * @param prefixLength the prefix length * @return an IP prefix * @throws IllegalArgumentException if the prefix length value is invalid */ public static IpPrefix valueOf(IpAddress.Version version, byte[] address, int prefixLength) { return new IpPrefix(IpAddress.valueOf(version, address), prefixLength); }
/** * Creates OSPF router id instance from the URI. * * @param uri device URI * @return OSPF router id instance */ public static OspfRouterId ospfRouterId(URI uri) { checkArgument(uri.getScheme().equals(SCHEME), "Unsupported URI scheme"); return new OspfRouterId(IpAddress.valueOf(uri.getSchemeSpecificPart())); }
/** * Returns BGPId created from the given device URI. * * @param uri device URI * @return object of BGPId */ public static BgpId bgpId(URI uri) { checkArgument(uri.getScheme().equals(SCHEME), "Unsupported URI scheme"); return new BgpId(IpAddress.valueOf(uri.getSchemeSpecificPart())); }
@Override public LispIpv6Address readFrom(ByteBuf byteBuf) throws LispParseError { byte[] ipByte = new byte[SIZE_OF_IPV6_ADDRESS]; byteBuf.readBytes(ipByte); IpAddress ipAddress = IpAddress.valueOf(IpAddress.Version.INET6, ipByte); return new LispIpv6Address(ipAddress); } }
/** * Creates OSPF router id instance from the URI. * * @param uri device URI * @return OSPF router id instance */ public static OspfRouterId ospfRouterId(URI uri) { checkArgument(uri.getScheme().equals(SCHEME), "Unsupported URI scheme"); return new OspfRouterId(IpAddress.valueOf(uri.getSchemeSpecificPart())); }
/** * Returns PccId created from the given client URI. * * @param uri device URI * @return pccid */ public static PccId pccid(URI uri) { checkArgument(uri.getScheme().equals(SCHEME), "Unsupported URI scheme"); return new PccId(IpAddress.valueOf(uri.getSchemeSpecificPart())); }
@Override public LispIpv4Address readFrom(ByteBuf byteBuf) throws LispParseError { byte[] ipByte = new byte[SIZE_OF_IPV4_ADDRESS]; byteBuf.readBytes(ipByte); IpAddress ipAddress = IpAddress.valueOf(IpAddress.Version.INET, ipByte); return new LispIpv4Address(ipAddress); } }
private OvsdbNodeId changeDeviceIdToNodeId(DeviceId deviceId) { String[] strings = deviceId.toString().split(":"); if (strings.length < 1) { return null; } return new OvsdbNodeId(IpAddress.valueOf(strings[1]), 0); }
private void programTunnelConfig(DeviceId localDeviceId, IpAddress localIp, DriverHandler localHandler) { if (mastershipService.isLocalMaster(localDeviceId)) { VtnConfig.applyTunnelConfig(localHandler, localIp, IpAddress.valueOf(DEFAULT_IP)); log.info("Add tunnel on {}", localIp); } }
@Override public McastRoute decode(ObjectNode json, CodecContext context) { if (json == null || !json.isObject()) { return null; } IpAddress source = IpAddress.valueOf(json.path(SOURCE).asText()); IpAddress group = IpAddress.valueOf(json.path(GROUP).asText()); McastRoute route = new McastRoute(source, group, McastRoute.Type.STATIC); return route; } }
/** * Gets the Ip of the SNMP device. * * @return ip */ public IpAddress ip() { return IpAddress.valueOf(get(IP, extractIpPort().getKey())); }
@Activate public void activate() { String localIp = getSiteLocalAddress(); ControllerNode localNode = new DefaultControllerNode(new NodeId(localIp), IpAddress.valueOf(localIp), DEFAULT_ONOS_PORT); ClusterMetadata metadata = new ClusterMetadata( PROVIDER_ID, "default", localNode, ImmutableSet.of(), ImmutableSet.of(), UUID.randomUUID().toString()); long version = System.currentTimeMillis(); cachedMetadata.set(new Versioned<>(metadata, version)); providerRegistry.register(this); log.info("Started"); }
@Override public ControllerNode decode(ObjectNode json, CodecContext context) { checkNotNull(json, "JSON cannot be null"); String ip = json.path("ip").asText(); return new DefaultControllerNode(new NodeId(json.path("id").asText(ip)), IpAddress.valueOf(ip), json.path("tcpPort").asInt(DEFAULT_PORT)); }
@Override protected void doExecute() { ClusterAdminService service = get(ClusterAdminService.class); service.addNode(new NodeId(nodeId), IpAddress.valueOf(ip), tcpPort); }
/** * Returns PCEP client. * * @return PCEP client */ private PcepClient getPcepClient(DeviceId deviceId) { Device device = deviceService.getDevice(deviceId); // In future projections instead of annotations will be used to fetch LSR ID. String lsrId = device.annotations().value(LSRID); PcepClient pcc = clientController.getClient(PccId.pccId(IpAddress.valueOf(lsrId))); return pcc; } }
/** * Returns PCEP client. * * @return PCEP client */ private PcepClient getPcepClient(DeviceId deviceId) { Device device = deviceService.getDevice(deviceId); // In future projections instead of annotations will be used to fetch LSR ID. String lsrId = device.annotations().value(LSR_ID); PcepClient pcc = clientController.getClient(PccId.pccId(IpAddress.valueOf(lsrId))); return pcc; } }