[AETHER-537][AETHER-538][AETHER-1032] Several bugfixes for SR (p1)
- Missing treament and meta information in removePortNextObjective
- Missing information in the host NextObjectives
- Wrong VLAN in the meta of the PW NextObjective
- Updates onos-dependencies to the latest beta
It will follow another patch that will complete the work
Change-Id: I412e21a03767130d818031545051e260c9534f05
diff --git a/impl/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java b/impl/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
index 42d77d5..c3ecfb9 100644
--- a/impl/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
+++ b/impl/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
@@ -474,8 +474,8 @@
VlanId nativeVlan = srManager.interfaceService.getNativeVlanId(connectPoint);
// Create route treatment
- TrafficTreatment.Builder tbuilder = DefaultTrafficTreatment.builder();
- tbuilder.deferred()
+ TrafficTreatment.Builder tbuilder = DefaultTrafficTreatment.builder()
+ .deferred()
.setEthDst(hostMac)
.setEthSrc(routerMac)
.setOutput(outPort);
@@ -485,12 +485,15 @@
// Adjust treatment and meta according to VLAN configuration
if (taggedVlans.contains(hostVlanId)) {
+ mbuilder.matchVlanId(hostVlanId);
tbuilder.setVlanId(hostVlanId);
} else if (hostVlanId.equals(VlanId.NONE)) {
if (untaggedVlan != null) {
mbuilder.matchVlanId(untaggedVlan);
+ tbuilder.popVlan();
} else if (nativeVlan != null) {
mbuilder.matchVlanId(nativeVlan);
+ tbuilder.popVlan();
} else {
log.warn("Untagged nexthop {}/{} is not allowed on {} without untagged or native vlan",
hostMac, hostVlanId, connectPoint);
@@ -1724,9 +1727,11 @@
TrafficSelector.Builder mbuilder = DefaultTrafficSelector.builder();
if (!popVlan) {
+ mbuilder.matchVlanId(vlanId);
tbuilder.setVlanId(vlanId);
} else {
mbuilder.matchVlanId(vlanId);
+ tbuilder.popVlan();
}
// if the objective is to revoke an existing rule, and for some reason
diff --git a/impl/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java b/impl/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
index b36bfee..9c3b713 100644
--- a/impl/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
+++ b/impl/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
@@ -887,12 +887,15 @@
// Adjust the meta according to VLAN configuration
if (taggedVlans.contains(vlanId)) {
+ meta.matchVlanId(vlanId);
treatment.setVlanId(vlanId);
} else if (vlanId.equals(VlanId.NONE)) {
if (untaggedVlan != null) {
meta.matchVlanId(untaggedVlan);
+ treatment.popVlan();
} else if (nativeVlan != null) {
meta.matchVlanId(nativeVlan);
+ treatment.popVlan();
} else {
log.warn("Untagged nexthop {}/{} is not allowed on {} without untagged or native vlan",
macAddr, vlanId, connectPoint);
@@ -1035,6 +1038,13 @@
.withType(type)
.fromApp(appId);
if (meta != null) {
+ // Udate the meta VLAN id to match the PW transport label
+ if (!popVlanInHashGroup(ds)) {
+ TrafficSelector newMeta = DefaultTrafficSelector.builder(meta)
+ .matchVlanId(srManager.getPwTransportVlan())
+ .build();
+ meta = newMeta;
+ }
nextObjBuilder.withMeta(meta);
}
@@ -1399,7 +1409,10 @@
if (portNextObjId != -1 && portNextObjStore.containsKey(key)) {
NextObjective.Builder nextObjBuilder = DefaultNextObjective
.builder().withId(portNextObjId)
- .withType(NextObjective.Type.SIMPLE).fromApp(appId);
+ .withType(NextObjective.Type.SIMPLE)
+ .addTreatment(tbuilder.build())
+ .fromApp(appId)
+ .withMeta(mbuilder.build());
ObjectiveContext context = new DefaultObjectiveContext(
(objective) -> log.debug("removePortNextObjective removes NextObj {} on {}",
portNextObjId, deviceId),
@@ -1587,24 +1600,43 @@
return;
}
- TrafficSelector metadata =
- DefaultTrafficSelector.builder().matchVlanId(hostVlanId).build();
+ ConnectPoint connectPoint = new ConnectPoint(deviceId, port);
+ VlanId untaggedVlan = srManager.interfaceService.getUntaggedVlanId(connectPoint);
+ Set<VlanId> taggedVlans = srManager.interfaceService.getTaggedVlanId(connectPoint);
+ VlanId nativeVlan = srManager.interfaceService.getNativeVlanId(connectPoint);
- TrafficTreatment.Builder tbuilder = DefaultTrafficTreatment.builder();
- tbuilder.deferred()
+ TrafficSelector.Builder mbuilder = DefaultTrafficSelector.builder();
+ TrafficTreatment.Builder tbuilder = DefaultTrafficTreatment.builder()
+ .deferred()
.setEthDst(hostMac)
.setEthSrc(deviceMac)
- .setVlanId(hostVlanId)
.setOutput(port);
+ if (taggedVlans.contains(hostVlanId)) {
+ mbuilder.matchVlanId(hostVlanId);
+ tbuilder.setVlanId(hostVlanId);
+ } else if (hostVlanId.equals(VlanId.NONE)) {
+ if (untaggedVlan != null) {
+ mbuilder.matchVlanId(untaggedVlan);
+ tbuilder.popVlan();
+ } else if (nativeVlan != null) {
+ mbuilder.matchVlanId(nativeVlan);
+ tbuilder.popVlan();
+ } else {
+ log.warn("Untagged nexthop {}/{} is not allowed on {} without untagged or native vlan",
+ hostMac, hostVlanId, connectPoint);
+ return;
+ }
+ }
+
log.debug(" update L3Ucast : deviceMac {}, port {}, host {}/{}, nextid {}, Treatment {} Meta {}",
- deviceMac, port, hostMac, hostVlanId, nextId, tbuilder.build(), metadata);
+ deviceMac, port, hostMac, hostVlanId, nextId, tbuilder.build(), mbuilder.build());
NextObjective.Builder nextObjBuilder = DefaultNextObjective
.builder().withId(nextId)
.withType(NextObjective.Type.SIMPLE).fromApp(appId)
.addTreatment(tbuilder.build())
- .withMeta(metadata);
+ .withMeta(mbuilder.build());
ObjectiveContext context = new DefaultObjectiveContext(
(objective) -> log.debug(" NextId {} successfully updated host {} vlan {} with port {}",
diff --git a/pom.xml b/pom.xml
index 27b0dbb..85f9d9a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-dependencies</artifactId>
- <version>2.5.0</version>
+ <version>2.5.1</version>
</parent>
<groupId>org.onosproject</groupId>