From d5f6c3be0215fe34c68a97c982dbb8acf4d735fc Mon Sep 17 00:00:00 2001 From: Hyunsun Moon Date: Thu, 18 Feb 2016 15:37:22 -0800 Subject: [PATCH] CORD-357 Fixed not to pop or push s-tag And also remove vSG related rules when vSG VM destroyed Change-Id: I3cecd558a0d84f882bea9ce849568a7be8380330 --- .../cordvtn/CordVtnRuleInstaller.java | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/apps/cordvtn/src/main/java/org/onosproject/cordvtn/CordVtnRuleInstaller.java b/apps/cordvtn/src/main/java/org/onosproject/cordvtn/CordVtnRuleInstaller.java index 877ec30a39..afd6b2c2ae 100644 --- a/apps/cordvtn/src/main/java/org/onosproject/cordvtn/CordVtnRuleInstaller.java +++ b/apps/cordvtn/src/main/java/org/onosproject/cordvtn/CordVtnRuleInstaller.java @@ -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 */ @@ -236,6 +236,11 @@ public class CordVtnRuleInstaller { processFlowRule(false, flowRule); continue; } + + PortNumber output = getOutputFromTreatment(flowRule); + if (output != null && output.equals(host.location().port())) { + processFlowRule(false, flowRule); + } } MacAddress dstMac = getDstMacFromTreatment(flowRule); @@ -519,17 +524,7 @@ public class CordVtnRuleInstaller { if (!mastershipService.isLocalMaster(host.location().deviceId())) { return; } - - 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 - } + // TODO remove management network specific rules } /** @@ -549,11 +544,11 @@ public class CordVtnRuleInstaller { // for traffics with s-tag, strip the tag and take through the vSG VM TrafficSelector selector = DefaultTrafficSelector.builder() + .matchInPort(dpPort) .matchVlanId(serviceVlan) .build(); TrafficTreatment treatment = DefaultTrafficTreatment.builder() - .popVlan() .setOutput(vSgHost.location().port()) .build(); @@ -573,11 +568,10 @@ public class CordVtnRuleInstaller { // lower priority to avoid conflict with WAN tag selector = DefaultTrafficSelector.builder() .matchInPort(vSgHost.location().port()) + .matchVlanId(serviceVlan) .build(); treatment = DefaultTrafficTreatment.builder() - .pushVlan() - .setVlanId(serviceVlan) .setOutput(dpPort) .build(); @@ -585,7 +579,7 @@ public class CordVtnRuleInstaller { .fromApp(appId) .withSelector(selector) .withTreatment(treatment) - .withPriority(LOW_PRIORITY) + .withPriority(DEFAULT_PRIORITY) .forDevice(vSgHost.location().deviceId()) .forTable(TABLE_Q_IN_Q) .makePermanent()