CORD-357 Fixed not to pop or push s-tag

And also remove vSG related rules when vSG VM destroyed

Change-Id: I3cecd558a0d84f882bea9ce849568a7be8380330
This commit is contained in:
Hyunsun Moon 2016-02-18 15:37:22 -08:00 committed by Gerrit Code Review
parent dd7e3d5fc8
commit d5f6c3be02

View File

@ -213,7 +213,7 @@ public class CordVtnRuleInstaller {
} }
/** /**
* Removes basic rules related to a given flow information. * Removes all rules related to a given service VM host.
* *
* @param host host to be removed * @param host host to be removed
*/ */
@ -236,6 +236,11 @@ public class CordVtnRuleInstaller {
processFlowRule(false, flowRule); processFlowRule(false, flowRule);
continue; continue;
} }
PortNumber output = getOutputFromTreatment(flowRule);
if (output != null && output.equals(host.location().port())) {
processFlowRule(false, flowRule);
}
} }
MacAddress dstMac = getDstMacFromTreatment(flowRule); MacAddress dstMac = getDstMacFromTreatment(flowRule);
@ -519,17 +524,7 @@ public class CordVtnRuleInstaller {
if (!mastershipService.isLocalMaster(host.location().deviceId())) { if (!mastershipService.isLocalMaster(host.location().deviceId())) {
return; return;
} }
// TODO remove management network specific rules
for (FlowRule flowRule : flowRuleService.getFlowRulesById(appId)) {
if (flowRule.deviceId().equals(host.location().deviceId())) {
PortNumber port = getOutputFromTreatment(flowRule);
if (port != null && port.equals(host.location().port())) {
processFlowRule(false, flowRule);
}
}
// TODO remove the other rules if mgmt network is not in use
}
} }
/** /**
@ -549,11 +544,11 @@ public class CordVtnRuleInstaller {
// for traffics with s-tag, strip the tag and take through the vSG VM // for traffics with s-tag, strip the tag and take through the vSG VM
TrafficSelector selector = DefaultTrafficSelector.builder() TrafficSelector selector = DefaultTrafficSelector.builder()
.matchInPort(dpPort)
.matchVlanId(serviceVlan) .matchVlanId(serviceVlan)
.build(); .build();
TrafficTreatment treatment = DefaultTrafficTreatment.builder() TrafficTreatment treatment = DefaultTrafficTreatment.builder()
.popVlan()
.setOutput(vSgHost.location().port()) .setOutput(vSgHost.location().port())
.build(); .build();
@ -573,11 +568,10 @@ public class CordVtnRuleInstaller {
// lower priority to avoid conflict with WAN tag // lower priority to avoid conflict with WAN tag
selector = DefaultTrafficSelector.builder() selector = DefaultTrafficSelector.builder()
.matchInPort(vSgHost.location().port()) .matchInPort(vSgHost.location().port())
.matchVlanId(serviceVlan)
.build(); .build();
treatment = DefaultTrafficTreatment.builder() treatment = DefaultTrafficTreatment.builder()
.pushVlan()
.setVlanId(serviceVlan)
.setOutput(dpPort) .setOutput(dpPort)
.build(); .build();
@ -585,7 +579,7 @@ public class CordVtnRuleInstaller {
.fromApp(appId) .fromApp(appId)
.withSelector(selector) .withSelector(selector)
.withTreatment(treatment) .withTreatment(treatment)
.withPriority(LOW_PRIORITY) .withPriority(DEFAULT_PRIORITY)
.forDevice(vSgHost.location().deviceId()) .forDevice(vSgHost.location().deviceId())
.forTable(TABLE_Q_IN_Q) .forTable(TABLE_Q_IN_Q)
.makePermanent() .makePermanent()