Saurav Das
Committed by Ray Milkey

CORD-48 Added support for broadcast next objective in OFDPA driver.

Changed groupid to show in hex for cli command 'groups'

Change-Id: I86474912a9fd775c36d5bc49545eaa58ecc46b47
......@@ -577,6 +577,7 @@ public class DefaultGroupHandler {
ports.forEach(port -> {
TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();
tBuilder.popVlan();
tBuilder.setOutput(port);
nextObjBuilder.addTreatment(tBuilder.build());
});
......
......@@ -121,11 +121,11 @@ public class GroupsListCommand extends AbstractShellCommand {
private void printGroups(DeviceId deviceId, List<Group> groups) {
print("deviceId=%s", deviceId);
for (Group group : groups) {
print(FORMAT, group.id().id(), group.state(), group.type(),
print(FORMAT, Integer.toHexString(group.id().id()), group.state(), group.type(),
group.bytes(), group.packets(), group.appId().name());
int i = 0;
for (GroupBucket bucket:group.buckets().buckets()) {
print(BUCKET_FORMAT, group.id().id(), ++i,
print(BUCKET_FORMAT, Integer.toHexString(group.id().id()), ++i,
bucket.bytes(), bucket.packets(),
bucket.treatment().allInstructions());
}
......
......@@ -630,7 +630,8 @@ public final class Instructions {
@Override
public String toString() {
return toStringHelper(type().toString())
.add("group ID", groupId.id()).toString();
.addValue("group ID=0x" + Integer.toHexString(groupId.id()))
.toString();
}
@Override
......
......@@ -18,7 +18,10 @@ package org.onosproject.driver.pipeline;
import static org.slf4j.LoggerFactory.getLogger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.onlab.packet.VlanId;
import org.onosproject.core.ApplicationId;
......@@ -54,11 +57,16 @@ public class CpqdOFDPA2Pipeline extends OFDPA2Pipeline {
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
selector.matchVlanId(vidCriterion.vlanId());
treatment.transition(TMAC_TABLE);
VlanId storeVlan = null;
if (vidCriterion.vlanId() == VlanId.NONE) {
// untagged packets are assigned vlans
treatment.pushVlan().setVlanId(assignedVlan);
storeVlan = assignedVlan;
} else {
storeVlan = vidCriterion.vlanId();
}
treatment.transition(TMAC_TABLE);
// ofdpa cannot match on ALL portnumber, so we need to use separate
// rules for each port.
......@@ -72,7 +80,20 @@ public class CpqdOFDPA2Pipeline extends OFDPA2Pipeline {
} else {
portnums.add(portCriterion.port());
}
for (PortNumber pnum : portnums) {
// update storage
port2Vlan.put(pnum, storeVlan);
Set<PortNumber> vlanPorts = vlan2Port.get(storeVlan);
if (vlanPorts == null) {
vlanPorts = Collections.newSetFromMap(
new ConcurrentHashMap<PortNumber, Boolean>());
vlanPorts.add(pnum);
vlan2Port.put(storeVlan, vlanPorts);
} else {
vlanPorts.add(pnum);
}
// create rest of flowrule
selector.matchInPort(pnum);
FlowRule rule = DefaultFlowRule.builder()
.forDevice(deviceId)
......