private static long macToLong(final String macAddress) { final byte[] mac = parseMac(macAddress); return Longs.fromBytes(mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], (byte) 0, (byte) 0); } }
private TapModify getTapModifyRequest(final String tapName, final int swIndex, final PhysAddress mac, final Long deviceInstance) { final TapModify tapConnect = new TapModify(); tapConnect.tapName = tapName.getBytes(); tapConnect.swIfIndex = swIndex; if(mac == null) { tapConnect.useRandomMac = 1; tapConnect.macAddress = new byte[6]; } else { tapConnect.useRandomMac = 0; tapConnect.macAddress = TranslateUtils.parseMac(mac.getValue()); } if(deviceInstance == null) { tapConnect.renumber = 0; } else { tapConnect.renumber = 1; tapConnect.customDevInstance = Math.toIntExact(deviceInstance); } return tapConnect; }
private TapConnect getTapConnectRequest(final String tapName, final PhysAddress mac, final Long deviceInstance) { final TapConnect tapConnect = new TapConnect(); tapConnect.tapName = tapName.getBytes(); if(mac == null) { tapConnect.useRandomMac = 1; tapConnect.macAddress = new byte[6]; } else { tapConnect.useRandomMac = 0; tapConnect.macAddress = TranslateUtils.parseMac(mac.getValue()); } if(deviceInstance == null) { tapConnect.renumber = 0; } else { tapConnect.renumber = 1; tapConnect.customDevInstance = Math.toIntExact(deviceInstance); } return tapConnect; }
private BdIpMacAddDel createRequest(final ArpTerminationTableEntry entry, final int bdId, boolean isAdd) { final BdIpMacAddDel request = new BdIpMacAddDel(); request.bdId = bdId; request.isAdd = booleanToByte(isAdd); request.macAddress = TranslateUtils.parseMac(entry.getPhysAddress().getValue()); final IpAddress ipAddress = entry.getIpAddress(); if (ipAddress.getIpv6Address() != null) { // FIXME: vpp does not support ipv6 in arp-termination table (based on analysis of l2_bd.c) throw new UnsupportedOperationException("IPv6 address for ARP termination table is not supported yet"); } request.ipAddress = TranslateUtils.ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(ipAddress.getIpv4Address())); return request; } }
private void addDelNeighbourAndReply(InstanceIdentifier<Neighbor> id, boolean add, int parentInterfaceIndex, Neighbor data) throws VppBaseCallException, WriteTimeoutException { IpNeighborAddDel request = new IpNeighborAddDel(); request.isAdd = TranslateUtils.booleanToByte(add); request.isIpv6 = 0; request.isStatic = 1; request.dstAddress = TranslateUtils.ipv4AddressNoZoneToArray(data.getIp()); request.macAddress = TranslateUtils.parseMac(data.getLinkLayerAddress().getValue()); request.swIfIndex = parentInterfaceIndex; //TODO if it is necessary for future use ,make adjustments to be able to set vrfid //request.vrfId TranslateUtils.getReplyForWrite(getFutureJVpp().ipNeighborAddDel(request).toCompletableFuture(), id); } }