@Override public Set<Host> getHosts(MacAddress mac) { Set<Host> macset = new HashSet<>(); for (Host h : hosts.values()) { if (h.mac().equals(mac)) { macset.add(h); } } return macset; }
@Override public VirtualPort getPort(MacAddress mac) { checkNotNull(mac, MAC_NOT_NULL); List<VirtualPort> vPorts = new ArrayList<>(); vPortStore.values().forEach(p -> { if (p.macAddress().equals(mac)) { vPorts.add(p); } }); if (vPorts.size() == 0) { return null; } return vPorts.get(0); }
/** * Get the tenant id for the given mac address. * * @param mac mac address * @return tenantId tenant id for the given mac address */ private TenantId getTenantId(MacAddress mac) { Collection<VirtualPort> virtualPorts = virtualPortService.getPorts(); for (VirtualPort virtualPort : virtualPorts) { if (virtualPort.macAddress().equals(mac)) { return virtualPort.tenantId(); } } return null; }
if (!intf.mac().equals(MacAddress.NONE)) { formatStringBuilder.append(MAC_FORMAT); formatStringBuilder.append(intf.mac().toString());
/** * Update the flows comparing previous event and current event. * * @param prevIntf the previous interface event * @param intf the current occured update envent **/ private void updateInterface(Interface prevIntf, Interface intf) { if (!prevIntf.vlan().equals(intf.vlan()) || !prevIntf.mac().equals(intf)) { removeInterface(prevIntf); provisionInterface(intf); } else { List<InterfaceIpAddress> removeIps = prevIntf.ipAddressesList().stream() .filter(pre -> !intf.ipAddressesList().contains(pre)) .collect(Collectors.toList()); List<InterfaceIpAddress> addIps = intf.ipAddressesList().stream() .filter(cur -> !prevIntf.ipAddressesList().contains(cur)) .collect(Collectors.toList()); // removing flows with match parameters present in previous subject modifyBasicInterfaceForwarding(new Interface(prevIntf.name(), prevIntf.connectPoint(), removeIps, prevIntf.mac(), prevIntf.vlan()), false); // adding flows with match parameters present in event subject modifyBasicInterfaceForwarding(new Interface(intf.name(), intf.connectPoint(), addIps, intf.mac(), intf.vlan()), true); } }
/** * Sends an ARP or NDP request for the given IP address. * * @param targetIp IP address to send the request for */ private void sendRequest(IpAddress targetIp) { interfaceService.getMatchingInterfaces(targetIp).forEach(intf -> { if (!edgePortService.isEdgePoint(intf.connectPoint())) { log.warn("Aborting attempt to send probe out non-edge port: {}", intf); return; } intf.ipAddressesList().stream() .filter(ia -> ia.subnetAddress().contains(targetIp)) .forEach(ia -> { MacAddress probeMac = intf.mac(); IpAddress probeIp = !probeMac.equals(MacAddress.ONOS) ? ia.ipAddress() : (ia.ipAddress().isIp4() ? Ip4Address.ZERO : Ip6Address.ZERO); sendProbe(intf.connectPoint(), targetIp, probeIp, probeMac, intf.vlan()); // account for use-cases where tagged-vlan config is used if (!intf.vlanTagged().isEmpty()) { intf.vlanTagged().forEach(tag -> { sendProbe(intf.connectPoint(), targetIp, probeIp, probeMac, tag); }); } }); }); }
if (criterionMap.containsKey(Criterion.Type.ETH_SRC)) { if (((EthCriterion) criterionMap.get((Criterion.Type.ETH_SRC))).mac() .equals(((L2ModificationInstruction.ModEtherInstruction) l2).mac())) { criterionMap.remove(Criterion.Type.ETH_SRC); } else { if (criterionMap.containsKey(Criterion.Type.ETH_DST)) { if (((EthCriterion) criterionMap.get((Criterion.Type.ETH_DST))).mac() .equals(((L2ModificationInstruction.ModEtherInstruction) l2).mac())) { criterionMap.remove(Criterion.Type.ETH_DST); } else {
this.channel = channel; if (isisMessage.sourceMac().equals(interfaceMacAddress)) { log.debug("Received our own message {}...!!!", isisMessage.isisPduType()); return;
this.channel = channel; if (isisMessage.sourceMac().equals(interfaceMacAddress)) { log.debug("Received our own message {}...!!!", isisMessage.isisPduType()); return;
Ip6Address probeIp = !probeMac.equals(MacAddress.ONOS) ? Ip6Address.valueOf(getLinkLocalAddress(probeMac.toBytes())) : Ip6Address.ZERO;
MacAddress srcMac = MacAddress.valueOf(arp.getSenderHardwareAddress()); OpenstackPortInfo portInfo = openstackPortInfoCollection.stream() .filter(p -> p.ip().equals(sourceIp) && p.mac().equals(srcMac)).findFirst().orElse(null); IpAddress targetIp = Ip4Address.valueOf(arp.getTargetProtocolAddress());
DefaultTrafficSelector.builder(); if (!ethCriterion.mac().equals(MacAddress.NONE)) { filteredSelectorBuilder.matchEthDst(ethCriterion.mac()); log.debug("processing L2 forwarding objective:{} -> next:{} in dev:{}",
if (ethCriterion == null || ethCriterion.mac().equals(MacAddress.NONE)) {
DefaultTrafficSelector.builder(); if (!ethCriterion.mac().equals(MacAddress.NONE)) { filteredSelectorBuilder.matchEthDst(ethCriterion.mac()); log.debug("processing L2 forwarding objective:{} -> next:{} in dev:{}",
if (ethCriterion == null || ethCriterion.mac().equals(MacAddress.NONE)) { log.debug("filtering objective missing dstMac, cannot program TMAC table"); } else {
DefaultTrafficSelector.builder(); if (!ethCriterion.mac().equals(MacAddress.NONE)) { filteredSelectorBuilder.matchEthDst(ethCriterion.mac()); log.debug("processing L2 forwarding objective:{} in dev:{}",
if (neighbors != null) { for (MacAddress macAddress : neighbors) { if (interfaceMacAddress.equals(macAddress)) { neighbor.setNeighborState(IsisInterfaceState.UP);
if (neighbors != null) { for (MacAddress macAddress : neighbors) { if (interfaceMacAddress.equals(macAddress)) { neighbor.setNeighborState(IsisInterfaceState.UP);