private void SendFlowMod(Topology.Switch sw, Link link, PhysicalAddress src, PhysicalAddress dst, ushort priority = _flowPriority) { OfpMatch match = new OfpMatch { //Wildcards = new OfpWildcards() { Wildcards = 0 }, Wildcards = new OfpWildcards() { Wildcards = ~(OfpFlowWildcards.OFPFW_DL_DST | OfpFlowWildcards.OFPFW_DL_SRC), NwDstMask = 63, NwSrcMask = 63 }, DlSrc = src.GetAddressBytes(), DlDst = dst.GetAddressBytes(), DlType = (ushort)EthernetPacketType.IpV4, }; OfpFlowMod flow = new OfpFlowMod { Priority = priority, Match = match, }; flow.Actions[OfpActionType.OFPAT_OUTPUT] = new OfpActionOutput() { Port = link.SrcPort }; _controller.LogDebug($"[{sw.MacAddress}]FlowMod from [{src}] to [{dst}]"); sw.Connection.Write(flow.ToByteArray()); }
private void SendFlowMod(Topology.Switch sw, Link link, IPAddress src, IPAddress dst, ushort priority = _flowPriority) { OfpMatch match = new OfpMatch { Wildcards = new OfpWildcards() { NwDstMask = 0, NwSrcMask = 0 }, NwSrc = (uint)src.Address, NwDst = (uint)dst.Address, }; OfpFlowMod flow = new OfpFlowMod { Priority = priority, Match = match }; flow.Actions[OfpActionType.OFPAT_OUTPUT] = new OfpActionOutput() { Port = link.SrcPort }; _controller.LogDebug($"[{sw.MacAddress}]FlowMod from [{src}] to [{dst}]"); sw.Connection.Write(flow.ToByteArray()); }