public static PhysAddress getDefaultInstance(String defaultValue) { return new PhysAddress(defaultValue); }
@Override protected String getPhysValue(final PhysAddress physAddress) { return physAddress.getValue(); } }
@ConstructorProperties("value") public PhysAddress(java.lang.String _value) { if (_value != null) { check_valueLength(_value); } Preconditions.checkNotNull(_value, "Supplied value may not be null"); for (Pattern p : patterns) { Preconditions.checkArgument(p.matcher(_value).matches(), "Supplied value \"%s\" does not match required pattern \"%s\"", _value, p); } this._value = _value; }
LOG.trace("ArpNotification Request Received from interface {} and IP {} having MAC {} target destination {}", notification.getInterface(), notification.getSrcIpaddress().getIpv4Address().getValue(), notification.getSrcMac().getValue(),notification.getDstIpaddress().getIpv4Address().getValue()); String srcInterface = notification.getInterface(); IpAddress srcIP = notification.getSrcIpaddress(); String oldPortName = vpnPortipToPort.getPortName(); String oldMac = vpnPortipToPort.getMacAddress(); if (!oldMac.equalsIgnoreCase(srcMac.getValue())) { oldPortName, oldMac, ipToQuery, srcMac.getValue()); return; VpnUtil.createVpnPortFixedIpToPort(dataBroker, vpnName, ipToQuery, srcInterface, srcMac.getValue(), false, false, true); addMipAdjacency(vpnName, srcInterface, srcIP); if (vpnTargetIpToPort.isSubnetIp()) { String macAddress = vpnTargetIpToPort.getMacAddress(); PhysAddress targetMac = new PhysAddress(macAddress); processArpRequest(srcIP, srcMac, targetIP, targetMac, srcInterface);
@Override public void readCurrentAttributes(@Nonnull final InstanceIdentifier<L2FibEntry> id, @Nonnull final L2FibEntryBuilder builder, @Nonnull final ReadContext ctx) throws ReadFailedException { final L2FibEntryKey key = id.firstKeyOf(id.getTargetType()); final BridgeDomainKey bridgeDomainKey = id.firstKeyOf(BridgeDomain.class); final int bdId = bdContext.getIndex(bridgeDomainKey.getName(), ctx.getMappingContext()); LOG.debug("Reading L2 FIB entry: key={}. bridgeDomainKey={}, bdId={}", key, bridgeDomainKey, bdId); try { // TODO HONEYCOMB-186 use cached l2FibTable final L2FibTableDetails entry = dumpL2Fibs(id, bdId).stream().filter(e -> key.getPhysAddress() .equals(new PhysAddress(vppPhysAddrToYang((e.mac))))) .collect(SINGLE_ITEM_COLLECTOR); builder.setAction(byteToBoolean(entry.filterMac) ? L2FibFilter.class : L2FibForward.class); builder.setBridgedVirtualInterface(byteToBoolean(entry.bviMac)); if (entry.swIfIndex != -1) { builder.setOutgoingInterface(interfaceContext.getName(entry.swIfIndex, ctx.getMappingContext())); } builder.setStaticConfig(byteToBoolean(entry.staticMac)); builder.setPhysAddress(key.getPhysAddress()); builder.withKey(key); } catch (Exception e) { throw new ReadFailedException(id, e); } }
return false; } else if(!_physAddress.equals(other.getPhysAddress())) { return false;
@Override public void readCurrentAttributes(@Nonnull final InstanceIdentifier<L2FibEntry> id, @Nonnull final L2FibEntryBuilder builder, @Nonnull final ReadContext ctx) throws ReadFailedException { final L2FibEntryKey key = id.firstKeyOf(id.getTargetType()); final BridgeDomainKey bridgeDomainKey = id.firstKeyOf(BridgeDomain.class); final int bdId = bdContext.getIndex(bridgeDomainKey.getName(), ctx.getMappingContext()); LOG.debug("Reading L2 FIB entry: key={}. bridgeDomainKey={}, bdId={}", key, bridgeDomainKey, bdId); try { // TODO use cached l2FibTable final L2FibTableEntry entry = dumpL2Fibs(id, bdId).stream().filter(e -> key.getPhysAddress() .equals(new PhysAddress(vppPhysAddrToYang(Longs.toByteArray(e.mac), 2)))) .collect(SINGLE_ITEM_COLLECTOR); builder.setAction(byteToBoolean(entry.filterMac) ? L2FibFilter.class : L2FibForward.class); builder.setBridgedVirtualInterface(byteToBoolean(entry.bviMac)); if (entry.swIfIndex != -1) { builder.setOutgoingInterface(interfaceContext.getName(entry.swIfIndex, ctx.getMappingContext())); } builder.setStaticConfig(byteToBoolean(entry.staticMac)); builder.setPhysAddress(key.getPhysAddress()); builder.setKey(key); } catch (Exception e) { throw new ReadFailedException(id, e); } }
public static PhysAddress getDefaultInstance(String defaultValue) { return new PhysAddress(defaultValue); }
public void deleteMacFlows(ElanInstance elanInfo, InterfaceInfo interfaceInfo, MacEntry macEntry, WriteTransaction deleteFlowGroupTx) { if (elanInfo == null || interfaceInfo == null) { return; } String macAddress = macEntry.getMacAddress().getValue(); synchronized (macAddress) { LOG.debug("Acquired lock for mac : " + macAddress + ". Proceeding with remove operation."); deleteMacFlows(elanInfo, interfaceInfo, macAddress, /* alsoDeleteSMAC */ true, deleteFlowGroupTx); } }
@ConstructorProperties("value") public PhysAddress(String _value) { if (_value != null) { check_valueLength(_value); } Objects.requireNonNull(_value, "Supplied value may not be null"); CodeHelpers.checkPattern(_value, patterns, regexes); this._value = _value; }
public static PhysAddress getDefaultInstance(String defaultValue) { return new PhysAddress(defaultValue); }
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; }
public static PhysAddress getDefaultInstance(String defaultValue) { return new PhysAddress(defaultValue); }
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; }
public static List<PhysAddress> getPhysAddress(List<String> macAddress) { List<PhysAddress> physAddresses = new ArrayList<>(); for (String mac : macAddress) { physAddresses.add(new PhysAddress(mac)); } return physAddresses; }
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 = parseMac(mac.getValue()); } if (deviceInstance == null) { tapConnect.renumber = 0; } else { tapConnect.renumber = 1; tapConnect.customDevInstance = Math.toIntExact(deviceInstance); } return tapConnect; }
@Nonnull @Override public List<L2FibEntryKey> getAllIds(@Nonnull final InstanceIdentifier<L2FibEntry> id, @Nonnull final ReadContext ctx) throws ReadFailedException { final BridgeDomainKey bridgeDomainKey = id.firstKeyOf(BridgeDomain.class); final int bdId = bdContext.getIndex(bridgeDomainKey.getName(), ctx.getMappingContext()); LOG.debug("Reading L2 FIB for bridge domain {} (bdId={})", bridgeDomainKey, bdId); return dumpL2Fibs(id, bdId).stream() .map(entry -> new L2FibEntryKey(new PhysAddress(vppPhysAddrToYang(entry.mac)))) .collect(Collectors.toList()); }
/** * Removes the given MAC Addresses from the specified External Device. * * @param deviceNodeId * the device node id * @param macAddresses * the mac addresses * @return the listenable future */ private ListenableFuture<Void> removeRemoteUcastMacsFromExternalDevice(String deviceNodeId, String logicalSwitchName, List<PhysAddress> macAddresses) { NodeId nodeId = new NodeId(deviceNodeId); // TODO (eperefr) List<MacAddress> lstMac = Lists.transform(macAddresses, physAddress -> physAddress != null ? new MacAddress(physAddress.getValue()) : null); return HwvtepUtils.deleteRemoteUcastMacs(broker, nodeId, logicalSwitchName, lstMac); }
@Nonnull @Override public List<L2FibEntryKey> getAllIds(@Nonnull final InstanceIdentifier<L2FibEntry> id, @Nonnull final ReadContext ctx) throws ReadFailedException { final BridgeDomainKey bridgeDomainKey = id.firstKeyOf(BridgeDomain.class); final int bdId = bdContext.getIndex(bridgeDomainKey.getName(), ctx.getMappingContext()); LOG.debug("Reading L2 FIB for bridge domain {} (bdId={})", bridgeDomainKey, bdId); try { return dumpL2Fibs(id, bdId).stream() .map(entry -> new L2FibEntryKey( new PhysAddress(vppPhysAddrToYang(Longs.toByteArray(entry.mac), 2)))) .collect(Collectors.toList()); } catch (VppBaseCallException e) { throw new ReadFailedException(id, e); } }
@Override protected Object doExecute() throws Exception { LOG.debug("Executing updating ElanInterface command" + "\t"); Collection<MacEntry> macTables = elanProvider.getElanMacTable(elanName); if (!macTables.isEmpty()) { SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yy:HH:mm:ss"); session.getConsole().println(getMacTableHeaderOutput()); session.getConsole().println(elanName); for (MacEntry mac : macTables) { boolean isStatic = mac.isIsStaticAddress(); session.getConsole().println(String.format(ElanCLIUtils.MAC_TABLE_CLI_FORMAT, "", mac.getInterface(), mac.getMacAddress().getValue(), "")); session.getConsole().println(String.format(ElanCLIUtils.MAC_TABLE_CLI_FORMAT, "", isStatic, "", isStatic ? "-" : formatter.format(new Date(mac.getControllerLearnedForwardingEntryTimestamp().longValue())))); } } return null; }