Committed by
Gerrit Code Review
CORD-546 Push L3 unicast rules for bgp peers when they are learned
- Change L3 unicast group id/key generation to include src MAC - Note: Only flows are removed when a peer is gone since the group may still be referenced by routes announced by peer. It does no harm even if the group is not referenced. - Note: We assume that peer does not move or update IP Also fix several SR/VR integration issues, including - Do not push broadcast group for /32 Change-Id: Ifb03601f5341f8b7717ea1fbccbc569b07f66476
Showing
4 changed files
with
19 additions
and
10 deletions
This diff is collapsed. Click to expand it.
... | @@ -558,12 +558,16 @@ public class RoutingRulePopulator { | ... | @@ -558,12 +558,16 @@ public class RoutingRulePopulator { |
558 | */ | 558 | */ |
559 | public void populateSubnetBroadcastRule(DeviceId deviceId) { | 559 | public void populateSubnetBroadcastRule(DeviceId deviceId) { |
560 | config.getSubnets(deviceId).forEach(subnet -> { | 560 | config.getSubnets(deviceId).forEach(subnet -> { |
561 | + if (subnet.prefixLength() == 0 || | ||
562 | + subnet.prefixLength() == IpPrefix.MAX_INET_MASK_LENGTH) { | ||
563 | + return; | ||
564 | + } | ||
561 | int nextId = srManager.getSubnetNextObjectiveId(deviceId, subnet); | 565 | int nextId = srManager.getSubnetNextObjectiveId(deviceId, subnet); |
562 | VlanId vlanId = srManager.getSubnetAssignedVlanId(deviceId, subnet); | 566 | VlanId vlanId = srManager.getSubnetAssignedVlanId(deviceId, subnet); |
563 | 567 | ||
564 | if (nextId < 0 || vlanId == null) { | 568 | if (nextId < 0 || vlanId == null) { |
565 | - log.error("Cannot install subnet broadcast rule in dev:{} due" | 569 | + log.error("Cannot install subnet {} broadcast rule in dev:{} due" |
566 | - + "to vlanId:{} or nextId:{}", vlanId, nextId); | 570 | + + "to vlanId:{} or nextId:{}", subnet, deviceId, vlanId, nextId); |
567 | return; | 571 | return; |
568 | } | 572 | } |
569 | 573 | ... | ... |
... | @@ -278,6 +278,10 @@ public class DeviceConfiguration implements DeviceProperties { | ... | @@ -278,6 +278,10 @@ public class DeviceConfiguration implements DeviceProperties { |
278 | PortNumber port = entry.getKey(); | 278 | PortNumber port = entry.getKey(); |
279 | Ip4Prefix subnet = entry.getValue(); | 279 | Ip4Prefix subnet = entry.getValue(); |
280 | 280 | ||
281 | + if (subnet.prefixLength() == IpPrefix.MAX_INET_MASK_LENGTH) { | ||
282 | + return; | ||
283 | + } | ||
284 | + | ||
281 | if (subnetPortMap.containsKey(subnet)) { | 285 | if (subnetPortMap.containsKey(subnet)) { |
282 | subnetPortMap.get(subnet).add(port); | 286 | subnetPortMap.get(subnet).add(port); |
283 | } else { | 287 | } else { | ... | ... |
1 | package org.onosproject.driver.pipeline; | 1 | package org.onosproject.driver.pipeline; |
2 | 2 | ||
3 | -import com.google.common.base.Objects; | ||
4 | import com.google.common.cache.Cache; | 3 | import com.google.common.cache.Cache; |
5 | import com.google.common.cache.CacheBuilder; | 4 | import com.google.common.cache.CacheBuilder; |
6 | import com.google.common.cache.RemovalCause; | 5 | import com.google.common.cache.RemovalCause; |
... | @@ -46,6 +45,7 @@ import java.util.Collections; | ... | @@ -46,6 +45,7 @@ import java.util.Collections; |
46 | import java.util.Deque; | 45 | import java.util.Deque; |
47 | import java.util.List; | 46 | import java.util.List; |
48 | import java.util.Map; | 47 | import java.util.Map; |
48 | +import java.util.Objects; | ||
49 | import java.util.Set; | 49 | import java.util.Set; |
50 | import java.util.concurrent.ConcurrentHashMap; | 50 | import java.util.concurrent.ConcurrentHashMap; |
51 | import java.util.concurrent.CopyOnWriteArrayList; | 51 | import java.util.concurrent.CopyOnWriteArrayList; |
... | @@ -333,6 +333,7 @@ public class OFDPA2GroupHandler { | ... | @@ -333,6 +333,7 @@ public class OFDPA2GroupHandler { |
333 | VlanId vlanid = null; | 333 | VlanId vlanid = null; |
334 | long portNum = 0; | 334 | long portNum = 0; |
335 | boolean setVlan = false, popVlan = false; | 335 | boolean setVlan = false, popVlan = false; |
336 | + MacAddress srcMac = MacAddress.ZERO; | ||
336 | MacAddress dstMac = MacAddress.ZERO; | 337 | MacAddress dstMac = MacAddress.ZERO; |
337 | for (Instruction ins : treatment.allInstructions()) { | 338 | for (Instruction ins : treatment.allInstructions()) { |
338 | if (ins.type() == Instruction.Type.L2MODIFICATION) { | 339 | if (ins.type() == Instruction.Type.L2MODIFICATION) { |
... | @@ -343,7 +344,8 @@ public class OFDPA2GroupHandler { | ... | @@ -343,7 +344,8 @@ public class OFDPA2GroupHandler { |
343 | outerTtb.setEthDst(dstMac); | 344 | outerTtb.setEthDst(dstMac); |
344 | break; | 345 | break; |
345 | case ETH_SRC: | 346 | case ETH_SRC: |
346 | - outerTtb.setEthSrc(((L2ModificationInstruction.ModEtherInstruction) l2ins).mac()); | 347 | + srcMac = ((L2ModificationInstruction.ModEtherInstruction) l2ins).mac(); |
348 | + outerTtb.setEthSrc(srcMac); | ||
347 | break; | 349 | break; |
348 | case VLAN_ID: | 350 | case VLAN_ID: |
349 | vlanid = ((L2ModificationInstruction.ModVlanIdInstruction) l2ins).vlanId(); | 351 | vlanid = ((L2ModificationInstruction.ModVlanIdInstruction) l2ins).vlanId(); |
... | @@ -433,11 +435,10 @@ public class OFDPA2GroupHandler { | ... | @@ -433,11 +435,10 @@ public class OFDPA2GroupHandler { |
433 | mplsgroupkey, nextId); | 435 | mplsgroupkey, nextId); |
434 | } else { | 436 | } else { |
435 | // outer group is L3Unicast | 437 | // outer group is L3Unicast |
436 | - int l3groupId = L3_UNICAST_TYPE | | 438 | + int l3GroupIdHash = Objects.hash(srcMac, dstMac, portNum); |
437 | - (TYPE_MASK & (int) (dstMac.toLong() & 0xffff) << 6 | (int) portNum); | 439 | + int l3groupId = L3_UNICAST_TYPE | (TYPE_MASK & l3GroupIdHash); |
438 | - int l3gk = L3_UNICAST_TYPE | | 440 | + int l3GroupKeyHash = Objects.hash(deviceId, srcMac, dstMac, portNum); |
439 | - (TYPE_MASK & (deviceId.hashCode() << 22 | | 441 | + int l3gk = L3_UNICAST_TYPE | (TYPE_MASK & l3GroupKeyHash); |
440 | - (int) (dstMac.toLong() & 0xffff) << 6 | (int) portNum)); | ||
441 | final GroupKey l3groupkey = new DefaultGroupKey(OFDPA2Pipeline.appKryo.serialize(l3gk)); | 442 | final GroupKey l3groupkey = new DefaultGroupKey(OFDPA2Pipeline.appKryo.serialize(l3gk)); |
442 | outerTtb.group(new DefaultGroupId(l2groupId)); | 443 | outerTtb.group(new DefaultGroupId(l2groupId)); |
443 | // create the l3unicast group description to wait for the | 444 | // create the l3unicast group description to wait for the |
... | @@ -1059,7 +1060,7 @@ public class OFDPA2GroupHandler { | ... | @@ -1059,7 +1060,7 @@ public class OFDPA2GroupHandler { |
1059 | DeviceId deviceId, VlanId vlanId, long portNumber) { | 1060 | DeviceId deviceId, VlanId vlanId, long portNumber) { |
1060 | int portLowerBits = (int) portNumber & PORT_LOWER_BITS_MASK; | 1061 | int portLowerBits = (int) portNumber & PORT_LOWER_BITS_MASK; |
1061 | long portHigherBits = portNumber & PORT_HIGHER_BITS_MASK; | 1062 | long portHigherBits = portNumber & PORT_HIGHER_BITS_MASK; |
1062 | - int hash = Objects.hashCode(deviceId, vlanId, portHigherBits); | 1063 | + int hash = Objects.hash(deviceId, vlanId, portHigherBits); |
1063 | return L2_INTERFACE_TYPE | (TYPE_MASK & hash << 6) | portLowerBits; | 1064 | return L2_INTERFACE_TYPE | (TYPE_MASK & hash << 6) | portLowerBits; |
1064 | } | 1065 | } |
1065 | 1066 | ... | ... |
-
Please register or login to post a comment