use of org.onlab.packet.MacAddress in project onos by opennetworkinglab.
the class DefaultFabricNetworkTest method createInterface.
private static Interface createInterface(int index) {
String name = "INTF_NAME_" + index;
ConnectPoint cp = ConnectPoint.fromString("of:0011223344556677/" + index);
InterfaceIpAddress intfIp1 = InterfaceIpAddress.valueOf("10.10.10." + index + "/32");
InterfaceIpAddress intfIp2 = InterfaceIpAddress.valueOf("20.20.20." + index + "/32");
List<InterfaceIpAddress> intfIps = ImmutableList.of(intfIp1, intfIp2);
MacAddress mac = MacAddress.valueOf("00:00:00:00:00:00");
VlanId vlanId = VlanId.NONE;
return new Interface(name, cp, intfIps, mac, vlanId);
}
use of org.onlab.packet.MacAddress in project onos by opennetworkinglab.
the class SimpleFabricNeighbour method handleReply.
/**
* Handles reply messages between VLAN tagged interfaces.
*
* @param context the message context
* @param hostService the host service
*/
protected void handleReply(NeighbourMessageContext context, HostService hostService) {
// Find target L2 Network, then reply to the host
FabricNetwork fabricNetwork = simpleFabric.fabricNetwork(context.inPort(), context.vlan());
if (fabricNetwork != null) {
// TODO: need to check and update simpleFabric.DefaultFabricNetwork
MacAddress mac = simpleFabric.vMacForIp(context.target());
if (mac != null) {
log.trace("simple fabric neightbour response message to virtual gateway; drop: {} {} target={}", context.inPort(), context.vlan(), context.target());
context.drop();
} else {
// forward reply to the hosts of the dstMac
Set<Host> hosts = hostService.getHostsByMac(context.dstMac());
log.trace("simple fabric neightbour response message forward: {} {} target={} -> {}", context.inPort(), context.vlan(), context.target(), hosts);
hosts.stream().map(host -> simpleFabric.hostInterface(host)).filter(Objects::nonNull).forEach(context::forward);
}
} else {
// this might be happened when we remove an interface from L2 Network
// just ignore this message
log.warn("simple fabric neightbour response message drop for unknown fabricNetwork: {} {}", context.inPort(), context.vlan());
context.drop();
}
}
use of org.onlab.packet.MacAddress in project onos by opennetworkinglab.
the class HostServiceAdapter method getHost.
@Override
public Host getHost(HostId hostId) {
ProviderId providerId = ProviderId.NONE;
MacAddress mac = MacAddress.valueOf("fa:12:3e:56:ee:a2");
VlanId vlan = VlanId.NONE;
HostLocation location = HostLocation.NONE;
Set<IpAddress> ips = Sets.newHashSet();
Annotations annotations = null;
return new DefaultHost(providerId, hostId, mac, vlan, location, ips, annotations);
}
use of org.onlab.packet.MacAddress in project onos by opennetworkinglab.
the class HostEventTest method createHost.
private Host createHost() {
MacAddress mac = MacAddress.valueOf("00:00:11:00:00:01");
VlanId vlan = VlanId.vlanId((short) 10);
HostLocation loc = new HostLocation(DeviceId.deviceId("of:foo"), PortNumber.portNumber(100), 123L);
Set<IpAddress> ipset = Sets.newHashSet(IpAddress.valueOf("10.0.0.1"), IpAddress.valueOf("10.0.0.2"));
HostId hid = HostId.hostId(mac, vlan);
return new DefaultHost(new ProviderId("of", "foo"), hid, mac, vlan, loc, ipset);
}
use of org.onlab.packet.MacAddress in project onos by opennetworkinglab.
the class K8sSwitchingArpHandler method processArpReply.
private void processArpReply(PacketContext context, Ethernet ethPacket) {
ARP arpPacket = (ARP) ethPacket.getPayload();
IpAddress srcIp = IpAddress.valueOf(INET, arpPacket.getSenderProtocolAddress());
MacAddress srcMac = MacAddress.valueOf(arpPacket.getSenderHardwareAddress());
IpAddress dstIp = IpAddress.valueOf(INET, arpPacket.getTargetProtocolAddress());
if (dstIp.equals(IpAddress.valueOf(NODE_FAKE_IP_STR))) {
// mutable MAP scenario is not considered for now
if (!extHostMacStore.containsKey(srcIp)) {
extHostMacStore.put(srcIp, srcMac);
}
K8sNode k8sNode = k8sNodeService.nodes().stream().filter(n -> n.nodeIp().equals(srcIp)).findAny().orElse(null);
if (k8sNode == null) {
return;
} else {
if (k8sNode.nodeInfo().nodeMac() != null) {
return;
}
}
// we update node MAC address which will be referred in node port scenario
K8sNodeInfo nodeInfo = new K8sNodeInfo(k8sNode.nodeIp(), srcMac);
K8sNode updatedNode = k8sNode.updateNodeInfo(nodeInfo);
k8sNodeService.updateNode(updatedNode);
}
}
Aggregations