Committed by
Gerrit Code Review
[ONOS-4502]Fix the bug about the different tenant and the same
subnet.With different tenants and the same subnets, only one of the subnets can ping external network well. Change-Id: I309675136923095a02ca3a2fac1d7bb32396402a
Showing
3 changed files
with
46 additions
and
7 deletions
... | @@ -878,12 +878,12 @@ public class VtnManager implements VtnService { | ... | @@ -878,12 +878,12 @@ public class VtnManager implements VtnService { |
878 | .programL3InPortClassifierRules(h.location().deviceId(), | 878 | .programL3InPortClassifierRules(h.location().deviceId(), |
879 | h.location().port(), h.mac(), | 879 | h.location().port(), h.mac(), |
880 | srcVmGwMac, l3vni, operation); | 880 | srcVmGwMac, l3vni, operation); |
881 | + classifierService.programArpClassifierRules(h.location().deviceId(), | ||
882 | + h.location().port(), srcGwIp, | ||
883 | + network.segmentationId(), | ||
884 | + operation); | ||
881 | // Arp rules | 885 | // Arp rules |
882 | if (operation == Objective.Operation.ADD) { | 886 | if (operation == Objective.Operation.ADD) { |
883 | - classifierService.programArpClassifierRules(h.location().deviceId(), | ||
884 | - srcGwIp, | ||
885 | - network.segmentationId(), | ||
886 | - operation); | ||
887 | DriverHandler handler = driverService.createHandler(h.location().deviceId()); | 887 | DriverHandler handler = driverService.createHandler(h.location().deviceId()); |
888 | arpService.programArpRules(handler, h.location().deviceId(), srcGwIp, | 888 | arpService.programArpRules(handler, h.location().deviceId(), srcGwIp, |
889 | network.segmentationId(), srcVmGwMac, | 889 | network.segmentationId(), srcVmGwMac, |
... | @@ -995,10 +995,10 @@ public class VtnManager implements VtnService { | ... | @@ -995,10 +995,10 @@ public class VtnManager implements VtnService { |
995 | fGwMac, exPortMac, | 995 | fGwMac, exPortMac, |
996 | floatingIp.floatingIp(), | 996 | floatingIp.floatingIp(), |
997 | fipNetwork.segmentationId(), operation); | 997 | fipNetwork.segmentationId(), operation); |
998 | + classifierService.programArpClassifierRules(deviceId, host.location().port(), | ||
999 | + dstVmGwIp, vmNetwork.segmentationId(), | ||
1000 | + operation); | ||
998 | if (operation == Objective.Operation.ADD) { | 1001 | if (operation == Objective.Operation.ADD) { |
999 | - classifierService.programArpClassifierRules(deviceId, dstVmGwIp, | ||
1000 | - vmNetwork.segmentationId(), | ||
1001 | - operation); | ||
1002 | arpService.programArpRules(handler, deviceId, dstVmGwIp, | 1002 | arpService.programArpRules(handler, deviceId, dstVmGwIp, |
1003 | vmNetwork.segmentationId(), dstVmGwMac, | 1003 | vmNetwork.segmentationId(), dstVmGwMac, |
1004 | operation); | 1004 | operation); | ... | ... |
... | @@ -102,4 +102,19 @@ public interface ClassifierService { | ... | @@ -102,4 +102,19 @@ public interface ClassifierService { |
102 | SegmentationId actionVni, | 102 | SegmentationId actionVni, |
103 | Objective.Operation type); | 103 | Objective.Operation type); |
104 | 104 | ||
105 | + /** | ||
106 | + * Assemble the Arp Classifier table rules. | ||
107 | + * Match: arp type and destination ip. | ||
108 | + * Action: set vnid and go to ARP Table(10). | ||
109 | + * | ||
110 | + * @param deviceId Device Id | ||
111 | + * @param inPort the ingress port of the host | ||
112 | + * @param dstIp source gateway ip | ||
113 | + * @param actionVni the vni of the source network (l2vni) | ||
114 | + * @param type the operation type of the flow rules | ||
115 | + */ | ||
116 | + void programArpClassifierRules(DeviceId deviceId, PortNumber inPort, | ||
117 | + IpAddress dstIp, SegmentationId actionVni, | ||
118 | + Objective.Operation type); | ||
119 | + | ||
105 | } | 120 | } | ... | ... |
... | @@ -193,4 +193,28 @@ public class ClassifierServiceImpl implements ClassifierService { | ... | @@ -193,4 +193,28 @@ public class ClassifierServiceImpl implements ClassifierService { |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | + @Override | ||
197 | + public void programArpClassifierRules(DeviceId deviceId, PortNumber inPort, | ||
198 | + IpAddress dstIp, | ||
199 | + SegmentationId actionVni, | ||
200 | + Objective.Operation type) { | ||
201 | + TrafficSelector selector = DefaultTrafficSelector.builder() | ||
202 | + .matchInPort(inPort).matchEthType(ETH_TYPE.ethType().toShort()) | ||
203 | + .matchArpTpa(Ip4Address.valueOf(dstIp.toString())).build(); | ||
204 | + TrafficTreatment treatment = DefaultTrafficTreatment.builder() | ||
205 | + .setTunnelId(Long.parseLong(actionVni.segmentationId())) | ||
206 | + .build(); | ||
207 | + ForwardingObjective.Builder objective = DefaultForwardingObjective | ||
208 | + .builder().withTreatment(treatment).withSelector(selector) | ||
209 | + .fromApp(appId).withFlag(Flag.SPECIFIC) | ||
210 | + .withPriority(ARP_CLASSIFIER_PRIORITY); | ||
211 | + if (type.equals(Objective.Operation.ADD)) { | ||
212 | + log.debug("ArpClassifierRules-->ADD"); | ||
213 | + flowObjectiveService.forward(deviceId, objective.add()); | ||
214 | + } else { | ||
215 | + log.debug("ArpClassifierRules-->REMOVE"); | ||
216 | + flowObjectiveService.forward(deviceId, objective.remove()); | ||
217 | + } | ||
218 | + } | ||
219 | + | ||
196 | } | 220 | } | ... | ... |
-
Please register or login to post a comment