[ONOS-4502]Fix the bug about the different tenant and the same subnet.With diffe…
…rent tenants and the same subnets, only one of the subnets can ping external network well. Change-Id: I2ad2c100e933e6c22a7e728f8991967d17ede4c9
Showing
3 changed files
with
46 additions
and
7 deletions
... | @@ -910,12 +910,12 @@ public class VtnManager implements VtnService { | ... | @@ -910,12 +910,12 @@ public class VtnManager implements VtnService { |
910 | .programL3InPortClassifierRules(h.location().deviceId(), | 910 | .programL3InPortClassifierRules(h.location().deviceId(), |
911 | h.location().port(), h.mac(), | 911 | h.location().port(), h.mac(), |
912 | srcVmGwMac, l3vni, operation); | 912 | srcVmGwMac, l3vni, operation); |
913 | + classifierService.programArpClassifierRules(h.location().deviceId(), | ||
914 | + h.location().port(), srcGwIp, | ||
915 | + network.segmentationId(), | ||
916 | + operation); | ||
913 | // Arp rules | 917 | // Arp rules |
914 | if (operation == Objective.Operation.ADD) { | 918 | if (operation == Objective.Operation.ADD) { |
915 | - classifierService.programArpClassifierRules(h.location().deviceId(), | ||
916 | - srcGwIp, | ||
917 | - network.segmentationId(), | ||
918 | - operation); | ||
919 | DriverHandler handler = driverService.createHandler(h.location().deviceId()); | 919 | DriverHandler handler = driverService.createHandler(h.location().deviceId()); |
920 | arpService.programArpRules(handler, h.location().deviceId(), srcGwIp, | 920 | arpService.programArpRules(handler, h.location().deviceId(), srcGwIp, |
921 | network.segmentationId(), srcVmGwMac, | 921 | network.segmentationId(), srcVmGwMac, |
... | @@ -1028,10 +1028,10 @@ public class VtnManager implements VtnService { | ... | @@ -1028,10 +1028,10 @@ public class VtnManager implements VtnService { |
1028 | fGwMac, exPortMac, | 1028 | fGwMac, exPortMac, |
1029 | floatingIp.floatingIp(), | 1029 | floatingIp.floatingIp(), |
1030 | fipNetwork.segmentationId(), operation); | 1030 | fipNetwork.segmentationId(), operation); |
1031 | + classifierService.programArpClassifierRules(deviceId, host.location().port(), | ||
1032 | + dstVmGwIp, vmNetwork.segmentationId(), | ||
1033 | + operation); | ||
1031 | if (operation == Objective.Operation.ADD) { | 1034 | if (operation == Objective.Operation.ADD) { |
1032 | - classifierService.programArpClassifierRules(deviceId, dstVmGwIp, | ||
1033 | - vmNetwork.segmentationId(), | ||
1034 | - operation); | ||
1035 | arpService.programArpRules(handler, deviceId, dstVmGwIp, | 1035 | arpService.programArpRules(handler, deviceId, dstVmGwIp, |
1036 | vmNetwork.segmentationId(), dstVmGwMac, | 1036 | vmNetwork.segmentationId(), dstVmGwMac, |
1037 | operation); | 1037 | operation); | ... | ... |
... | @@ -104,6 +104,21 @@ public interface ClassifierService { | ... | @@ -104,6 +104,21 @@ public interface ClassifierService { |
104 | Objective.Operation type); | 104 | Objective.Operation type); |
105 | 105 | ||
106 | /** | 106 | /** |
107 | + * Assemble the Arp Classifier table rules. | ||
108 | + * Match: arp type and destination ip. | ||
109 | + * Action: set vnid and go to ARP Table(10). | ||
110 | + * | ||
111 | + * @param deviceId Device Id | ||
112 | + * @param inPort the ingress port of the host | ||
113 | + * @param dstIp source gateway ip | ||
114 | + * @param actionVni the vni of the source network (l2vni) | ||
115 | + * @param type the operation type of the flow rules | ||
116 | + */ | ||
117 | + void programArpClassifierRules(DeviceId deviceId, PortNumber inPort, | ||
118 | + IpAddress dstIp, SegmentationId actionVni, | ||
119 | + Objective.Operation type); | ||
120 | + | ||
121 | + /** | ||
107 | * Assemble the Userdata Classifier table rules. | 122 | * Assemble the Userdata Classifier table rules. |
108 | * Match: subnet ip prefix and destination ip. | 123 | * Match: subnet ip prefix and destination ip. |
109 | * Action: add flow rule to specific ip for userdata. | 124 | * Action: add flow rule to specific ip for userdata. | ... | ... |
... | @@ -194,6 +194,30 @@ public class ClassifierServiceImpl implements ClassifierService { | ... | @@ -194,6 +194,30 @@ public class ClassifierServiceImpl implements ClassifierService { |
194 | } | 194 | } |
195 | 195 | ||
196 | @Override | 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 | + | ||
220 | + @Override | ||
197 | public void programUserdataClassifierRules(DeviceId deviceId, | 221 | public void programUserdataClassifierRules(DeviceId deviceId, |
198 | IpPrefix ipPrefix, | 222 | IpPrefix ipPrefix, |
199 | IpAddress dstIp, | 223 | IpAddress dstIp, | ... | ... |
-
Please register or login to post a comment