Hyunsun Moon
Committed by Gerrit Code Review

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

And also remove vSG related rules when vSG VM destroyed

Change-Id: I3cecd558a0d84f882bea9ce849568a7be8380330
...@@ -213,7 +213,7 @@ public class CordVtnRuleInstaller { ...@@ -213,7 +213,7 @@ public class CordVtnRuleInstaller {
213 } 213 }
214 214
215 /** 215 /**
216 - * Removes basic rules related to a given flow information. 216 + * Removes all rules related to a given service VM host.
217 * 217 *
218 * @param host host to be removed 218 * @param host host to be removed
219 */ 219 */
...@@ -236,6 +236,11 @@ public class CordVtnRuleInstaller { ...@@ -236,6 +236,11 @@ public class CordVtnRuleInstaller {
236 processFlowRule(false, flowRule); 236 processFlowRule(false, flowRule);
237 continue; 237 continue;
238 } 238 }
239 +
240 + PortNumber output = getOutputFromTreatment(flowRule);
241 + if (output != null && output.equals(host.location().port())) {
242 + processFlowRule(false, flowRule);
243 + }
239 } 244 }
240 245
241 MacAddress dstMac = getDstMacFromTreatment(flowRule); 246 MacAddress dstMac = getDstMacFromTreatment(flowRule);
...@@ -519,17 +524,7 @@ public class CordVtnRuleInstaller { ...@@ -519,17 +524,7 @@ public class CordVtnRuleInstaller {
519 if (!mastershipService.isLocalMaster(host.location().deviceId())) { 524 if (!mastershipService.isLocalMaster(host.location().deviceId())) {
520 return; 525 return;
521 } 526 }
522 - 527 + // TODO remove management network specific rules
523 - for (FlowRule flowRule : flowRuleService.getFlowRulesById(appId)) {
524 - if (flowRule.deviceId().equals(host.location().deviceId())) {
525 - PortNumber port = getOutputFromTreatment(flowRule);
526 - if (port != null && port.equals(host.location().port())) {
527 - processFlowRule(false, flowRule);
528 - }
529 - }
530 -
531 - // TODO remove the other rules if mgmt network is not in use
532 - }
533 } 528 }
534 529
535 /** 530 /**
...@@ -549,11 +544,11 @@ public class CordVtnRuleInstaller { ...@@ -549,11 +544,11 @@ public class CordVtnRuleInstaller {
549 544
550 // for traffics with s-tag, strip the tag and take through the vSG VM 545 // for traffics with s-tag, strip the tag and take through the vSG VM
551 TrafficSelector selector = DefaultTrafficSelector.builder() 546 TrafficSelector selector = DefaultTrafficSelector.builder()
547 + .matchInPort(dpPort)
552 .matchVlanId(serviceVlan) 548 .matchVlanId(serviceVlan)
553 .build(); 549 .build();
554 550
555 TrafficTreatment treatment = DefaultTrafficTreatment.builder() 551 TrafficTreatment treatment = DefaultTrafficTreatment.builder()
556 - .popVlan()
557 .setOutput(vSgHost.location().port()) 552 .setOutput(vSgHost.location().port())
558 .build(); 553 .build();
559 554
...@@ -573,11 +568,10 @@ public class CordVtnRuleInstaller { ...@@ -573,11 +568,10 @@ public class CordVtnRuleInstaller {
573 // lower priority to avoid conflict with WAN tag 568 // lower priority to avoid conflict with WAN tag
574 selector = DefaultTrafficSelector.builder() 569 selector = DefaultTrafficSelector.builder()
575 .matchInPort(vSgHost.location().port()) 570 .matchInPort(vSgHost.location().port())
571 + .matchVlanId(serviceVlan)
576 .build(); 572 .build();
577 573
578 treatment = DefaultTrafficTreatment.builder() 574 treatment = DefaultTrafficTreatment.builder()
579 - .pushVlan()
580 - .setVlanId(serviceVlan)
581 .setOutput(dpPort) 575 .setOutput(dpPort)
582 .build(); 576 .build();
583 577
...@@ -585,7 +579,7 @@ public class CordVtnRuleInstaller { ...@@ -585,7 +579,7 @@ public class CordVtnRuleInstaller {
585 .fromApp(appId) 579 .fromApp(appId)
586 .withSelector(selector) 580 .withSelector(selector)
587 .withTreatment(treatment) 581 .withTreatment(treatment)
588 - .withPriority(LOW_PRIORITY) 582 + .withPriority(DEFAULT_PRIORITY)
589 .forDevice(vSgHost.location().deviceId()) 583 .forDevice(vSgHost.location().deviceId())
590 .forTable(TABLE_Q_IN_Q) 584 .forTable(TABLE_Q_IN_Q)
591 .makePermanent() 585 .makePermanent()
......