Bug fix: generate different next objectives for port with multiple vlans
Cleaning up some logs.
Change-Id: I0db119fdbc36ccbd25a382d54d3f9f731f8be1ec
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/HostHandler.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/HostHandler.java
index 12d6d78..441597e 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/HostHandler.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/HostHandler.java
@@ -90,8 +90,8 @@
if (accepted(host)) {
// Populate bridging table entry
- log.debug("Populate L2 table entry for host {} at {}:{}",
- mac, deviceId, port);
+ log.debug("Populating bridging entry for host {}/{} at {}:{}",
+ mac, vlanId, deviceId, port);
ForwardingObjective.Builder fob =
bridgingFwdObjBuilder(deviceId, mac, vlanId, port);
if (fob == null) {
@@ -99,9 +99,11 @@
return;
}
ObjectiveContext context = new DefaultObjectiveContext(
- (objective) -> log.debug("Host rule for {}/{} populated", mac, vlanId),
+ (objective) -> log.debug("Brigding rule for {}/{} populated",
+ mac, vlanId),
(objective, error) ->
- log.warn("Failed to populate host rule for {}/{}: {}", mac, vlanId, error));
+ log.warn("Failed to populate bridging rule for {}/{}: {}",
+ mac, vlanId, error));
flowObjectiveService.forward(deviceId, fob.add(context));
ips.forEach(ip -> {
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
index 6b5aba7..8d757aa 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
@@ -118,7 +118,7 @@
*/
public void populateRoute(DeviceId deviceId, IpPrefix prefix,
MacAddress hostMac, VlanId hostVlanId, PortNumber outPort) {
- log.debug("Populate IP table entry for route {} at {}:{}",
+ log.debug("Populate routing entry for route {} at {}:{}",
prefix, deviceId, outPort);
ForwardingObjective.Builder fwdBuilder;
try {
@@ -128,14 +128,15 @@
return;
}
if (fwdBuilder == null) {
- log.warn("Aborting host routing table entries due "
+ log.warn("Aborting host routing table entry due "
+ "to error for dev:{} route:{}", deviceId, prefix);
return;
}
ObjectiveContext context = new DefaultObjectiveContext(
- (objective) -> log.debug("IP rule for route {} populated", prefix),
+ (objective) -> log.debug("Routing rule for route {} populated", prefix),
(objective, error) ->
- log.warn("Failed to populate IP rule for route {}: {}", prefix, error));
+ log.warn("Failed to populate routing rule for route {}: {}",
+ prefix, error));
srManager.flowObjectiveService.forward(deviceId, fwdBuilder.add(context));
rulePopulationCounter.incrementAndGet();
}
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
index 0a3eb92..3bdde77 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
@@ -702,8 +702,8 @@
log.trace("Rcvd pktin: {}", ethernet);
if (ethernet.getEtherType() == TYPE_ARP) {
- log.warn("Receive unexpected ARP packet on {}", context.inPacket().receivedFrom());
- log.debug("{}", ethernet);
+ log.warn("Received unexpected ARP packet on {}", context.inPacket().receivedFrom());
+ log.trace("{}", ethernet);
return;
} else if (ethernet.getEtherType() == Ethernet.TYPE_IPV4) {
IPv4 ipv4Packet = (IPv4) ethernet.getPayload();
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingNeighbourDispatcher.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingNeighbourDispatcher.java
index 4eaac4e..28b2d73 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingNeighbourDispatcher.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingNeighbourDispatcher.java
@@ -42,7 +42,7 @@
@Override
public void handleMessage(NeighbourMessageContext context, HostService hostService) {
- log.debug("Received a {} packet {}", context.protocol(), context.packet());
+ log.trace("Received a {} packet {}", context.protocol(), context.packet());
switch (context.protocol()) {
case ARP:
if (this.manager.arpHandler != null) {
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
index 93dfd0c..aba822b 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
@@ -499,13 +499,13 @@
public int getPortNextObjectiveId(PortNumber portNum, TrafficTreatment treatment,
TrafficSelector meta) {
Integer nextId = portNextObjStore
- .get(new PortNextObjectiveStoreKey(deviceId, portNum, treatment));
+ .get(new PortNextObjectiveStoreKey(deviceId, portNum, treatment, meta));
if (nextId == null) {
- log.trace("getPortNextObjectiveId in device{}: Next objective id "
+ log.debug("getPortNextObjectiveId in device{}: Next objective id "
+ "not found for {} and {} creating", deviceId, portNum);
createGroupFromPort(portNum, treatment, meta);
nextId = portNextObjStore.get(
- new PortNextObjectiveStoreKey(deviceId, portNum, treatment));
+ new PortNextObjectiveStoreKey(deviceId, portNum, treatment, meta));
if (nextId == null) {
log.warn("getPortNextObjectiveId: unable to create next obj"
+ "for dev:{} port:{}", deviceId, portNum);
@@ -812,7 +812,7 @@
TrafficSelector meta) {
int nextId = flowObjectiveService.allocateNextId();
PortNextObjectiveStoreKey key = new PortNextObjectiveStoreKey(
- deviceId, portNum, treatment);
+ deviceId, portNum, treatment, meta);
NextObjective.Builder nextObjBuilder = DefaultNextObjective
.builder().withId(nextId)
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/storekey/PortNextObjectiveStoreKey.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/storekey/PortNextObjectiveStoreKey.java
index fdf28df..d76c9c6 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/storekey/PortNextObjectiveStoreKey.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/storekey/PortNextObjectiveStoreKey.java
@@ -17,6 +17,7 @@
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
+import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
import java.util.Objects;
@@ -31,6 +32,7 @@
private final DeviceId deviceId;
private final PortNumber portNum;
private final TrafficTreatment treatment;
+ private final TrafficSelector meta;
/**
* Constructs the key of port next objective store.
@@ -38,12 +40,15 @@
* @param deviceId device ID
* @param portNum port number
* @param treatment treatment that will be applied to the interface
+ * @param meta optional data to pass to the driver
*/
public PortNextObjectiveStoreKey(DeviceId deviceId, PortNumber portNum,
- TrafficTreatment treatment) {
+ TrafficTreatment treatment,
+ TrafficSelector meta) {
this.deviceId = deviceId;
this.portNum = portNum;
this.treatment = treatment;
+ this.meta = meta;
}
/**
@@ -73,6 +78,16 @@
return treatment;
}
+ /**
+ * Gets metadata information in this PortNextObjectiveStoreKey.
+ *
+ * @return meta information
+ */
+ public TrafficSelector meta() {
+ return meta;
+ }
+
+
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -85,16 +100,19 @@
(PortNextObjectiveStoreKey) o;
return (Objects.equals(this.deviceId, that.deviceId) &&
Objects.equals(this.portNum, that.portNum) &&
- Objects.equals(this.treatment, that.treatment));
+ Objects.equals(this.treatment, that.treatment) &&
+ Objects.equals(this.meta, that.meta));
}
@Override
public int hashCode() {
- return Objects.hash(deviceId, portNum, treatment);
+ return Objects.hash(deviceId, portNum, treatment, meta);
}
@Override
public String toString() {
- return "Device: " + deviceId + " Port: " + portNum + " Treatment: " + treatment;
+ return "Device: " + deviceId + " Port: " + portNum +
+ " Treatment: " + treatment +
+ " Meta: " + meta;
}
}