ONOS-7887 Rename action profile-related entities
Members can exist outside of a group. Previous naming was ambiguous
about this.
Action group -> action profile group
Action group member -> action profile member
Change-Id: I5097e92253353d355b864e689f9653df2d318230
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/ActionProfileGroupEncoder.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/ActionProfileGroupEncoder.java
index cb0735d..414a0e6 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/ActionProfileGroupEncoder.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/ActionProfileGroupEncoder.java
@@ -19,8 +19,8 @@
import com.google.common.collect.Maps;
import org.onosproject.net.pi.model.PiActionProfileId;
import org.onosproject.net.pi.model.PiPipeconf;
-import org.onosproject.net.pi.runtime.PiActionGroup;
-import org.onosproject.net.pi.runtime.PiActionGroupId;
+import org.onosproject.net.pi.runtime.PiActionProfileGroup;
+import org.onosproject.net.pi.runtime.PiActionProfileGroupId;
import p4.config.v1.P4InfoOuterClass;
import p4.v1.P4RuntimeOuterClass.ActionProfileGroup;
import p4.v1.P4RuntimeOuterClass.ActionProfileGroup.Member;
@@ -41,18 +41,18 @@
}
/**
- * Encode a PI action group to a action profile group.
+ * Encode a PI action profile group to a action profile group.
*
* @param piActionGroup the action profile group
* @param pipeconf the pipeconf
* @param maxMemberSize the max member size of action group
- * @return a action profile group encoded from PI action group
+ * @return a action profile group encoded from PI action profile group
* @throws P4InfoBrowser.NotFoundException if can't find action profile from
* P4Info browser
* @throws EncodeException if can't find P4Info from
* pipeconf
*/
- static ActionProfileGroup encode(PiActionGroup piActionGroup, PiPipeconf pipeconf, int maxMemberSize)
+ static ActionProfileGroup encode(PiActionProfileGroup piActionGroup, PiPipeconf pipeconf, int maxMemberSize)
throws P4InfoBrowser.NotFoundException, EncodeException {
P4InfoBrowser browser = PipeconfHelper.getP4InfoBrowser(pipeconf);
@@ -86,26 +86,26 @@
/**
* Decode an action profile group with members information to a PI action
- * group.
+ * profile group.
*
* @param actionProfileGroup the action profile group
* @param members members of the action profile group
* @param pipeconf the pipeconf
- * @return decoded PI action group
+ * @return decoded PI action profile group
* @throws P4InfoBrowser.NotFoundException if can't find action profile from
* P4Info browser
* @throws EncodeException if can't find P4Info from
* pipeconf
*/
- static PiActionGroup decode(ActionProfileGroup actionProfileGroup,
- Collection<ActionProfileMember> members,
- PiPipeconf pipeconf)
+ static PiActionProfileGroup decode(ActionProfileGroup actionProfileGroup,
+ Collection<ActionProfileMember> members,
+ PiPipeconf pipeconf)
throws P4InfoBrowser.NotFoundException, EncodeException {
P4InfoBrowser browser = PipeconfHelper.getP4InfoBrowser(pipeconf);
if (browser == null) {
throw new EncodeException(format("Can't get P4 info browser from pipeconf %s", pipeconf));
}
- PiActionGroup.Builder piActionGroupBuilder = PiActionGroup.builder();
+ PiActionProfileGroup.Builder piActionGroupBuilder = PiActionProfileGroup.builder();
P4InfoOuterClass.ActionProfile actionProfile = browser.actionProfiles()
.getById(actionProfileGroup.getActionProfileId());
@@ -113,14 +113,14 @@
piActionGroupBuilder
.withActionProfileId(piActionProfileId)
- .withId(PiActionGroupId.of(actionProfileGroup.getGroupId()));
+ .withId(PiActionProfileGroupId.of(actionProfileGroup.getGroupId()));
Map<Integer, Integer> memberWeights = Maps.newHashMap();
actionProfileGroup.getMembersList().forEach(member -> {
int weight = member.getWeight();
if (weight < 1) {
// FIXME: currently PI has a bug which will always return weight 0
- // ONOS won't accept group member with weight 0
+ // ONOS won't accept group buckets with weight 0
weight = 1;
}
memberWeights.put(member.getMemberId(), weight);
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/ActionProfileMemberEncoder.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/ActionProfileMemberEncoder.java
index e78aa97..30dd43c 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/ActionProfileMemberEncoder.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/ActionProfileMemberEncoder.java
@@ -18,8 +18,8 @@
import org.onosproject.net.pi.model.PiActionProfileId;
import org.onosproject.net.pi.model.PiPipeconf;
-import org.onosproject.net.pi.runtime.PiActionGroupMember;
-import org.onosproject.net.pi.runtime.PiActionGroupMemberId;
+import org.onosproject.net.pi.runtime.PiActionProfileMember;
+import org.onosproject.net.pi.runtime.PiActionProfileMemberId;
import p4.config.v1.P4InfoOuterClass;
import p4.v1.P4RuntimeOuterClass;
import p4.v1.P4RuntimeOuterClass.ActionProfileMember;
@@ -37,16 +37,16 @@
}
/**
- * Encode a PiActionGroupMember to a ActionProfileMember.
+ * Encode a PiActionProfileMember to a ActionProfileMember.
*
- * @param member the member to encode
- * @param pipeconf the pipeconf, as encode spec
+ * @param member the member to encode
+ * @param pipeconf the pipeconf, as encode spec
* @return encoded member
* @throws P4InfoBrowser.NotFoundException can't find action profile from
* P4Info browser
* @throws EncodeException can't find P4Info from pipeconf
*/
- static ActionProfileMember encode(PiActionGroupMember member,
+ static ActionProfileMember encode(PiActionProfileMember member,
PiPipeconf pipeconf)
throws P4InfoBrowser.NotFoundException, EncodeException {
@@ -77,20 +77,20 @@
}
/**
- * Decode an action profile member to PI action group member.
+ * Decode an action profile member to PI action profile member.
*
* @param member the action profile member
* @param weight the weight of the member
* @param pipeconf the pipeconf, as decode spec
- * @return decoded PI action group member
+ * @return decoded PI action profile member
* @throws P4InfoBrowser.NotFoundException can't find definition of action
* from P4 info
* @throws EncodeException can't get P4 info browser from
* pipeconf
*/
- static PiActionGroupMember decode(ActionProfileMember member,
- int weight,
- PiPipeconf pipeconf)
+ static PiActionProfileMember decode(ActionProfileMember member,
+ int weight,
+ PiPipeconf pipeconf)
throws P4InfoBrowser.NotFoundException, EncodeException {
P4InfoBrowser browser = PipeconfHelper.getP4InfoBrowser(pipeconf);
if (browser == null) {
@@ -103,9 +103,9 @@
.getPreamble()
.getName());
- return PiActionGroupMember.builder()
+ return PiActionProfileMember.builder()
.forActionProfile(actionProfileId)
- .withId(PiActionGroupMemberId.of(member.getMemberId()))
+ .withId(PiActionProfileMemberId.of(member.getMemberId()))
.withWeight(weight)
.withAction(decodeActionMsg(member.getAction(), browser))
.build();
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeClientImpl.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeClientImpl.java
index d5080ae..78ea9d9 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeClientImpl.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeClientImpl.java
@@ -38,9 +38,9 @@
import org.onosproject.net.pi.model.PiMeterId;
import org.onosproject.net.pi.model.PiPipeconf;
import org.onosproject.net.pi.model.PiTableId;
-import org.onosproject.net.pi.runtime.PiActionGroup;
-import org.onosproject.net.pi.runtime.PiActionGroupMember;
-import org.onosproject.net.pi.runtime.PiActionGroupMemberId;
+import org.onosproject.net.pi.runtime.PiActionProfileGroup;
+import org.onosproject.net.pi.runtime.PiActionProfileMember;
+import org.onosproject.net.pi.runtime.PiActionProfileMemberId;
import org.onosproject.net.pi.runtime.PiCounterCell;
import org.onosproject.net.pi.runtime.PiCounterCellId;
import org.onosproject.net.pi.runtime.PiMeterCellConfig;
@@ -218,41 +218,41 @@
}
@Override
- public CompletableFuture<Boolean> writeActionGroupMembers(List<PiActionGroupMember> members,
+ public CompletableFuture<Boolean> writeActionProfileMembers(List<PiActionProfileMember> members,
+ WriteOperationType opType,
+ PiPipeconf pipeconf) {
+ return supplyInContext(() -> doWriteActionProfileMembers(members, opType, pipeconf),
+ "writeActionProfileMembers-" + opType.name());
+ }
+
+
+ @Override
+ public CompletableFuture<Boolean> writeActionProfileGroup(PiActionProfileGroup group,
WriteOperationType opType,
- PiPipeconf pipeconf) {
- return supplyInContext(() -> doWriteActionGroupMembers(members, opType, pipeconf),
- "writeActionGroupMembers-" + opType.name());
- }
-
-
- @Override
- public CompletableFuture<Boolean> writeActionGroup(PiActionGroup group,
- WriteOperationType opType,
- PiPipeconf pipeconf,
+ PiPipeconf pipeconf,
int maxMemberSize) {
- return supplyInContext(() -> doWriteActionGroup(group, opType, pipeconf, maxMemberSize),
- "writeActionGroup-" + opType.name());
+ return supplyInContext(() -> doWriteActionProfileGroup(group, opType, pipeconf, maxMemberSize),
+ "writeActionProfileGroup-" + opType.name());
}
@Override
- public CompletableFuture<List<PiActionGroup>> dumpGroups(PiActionProfileId actionProfileId,
- PiPipeconf pipeconf) {
+ public CompletableFuture<List<PiActionProfileGroup>> dumpActionProfileGroups(
+ PiActionProfileId actionProfileId, PiPipeconf pipeconf) {
return supplyInContext(() -> doDumpGroups(actionProfileId, pipeconf),
- "dumpGroups-" + actionProfileId.id());
+ "dumpActionProfileGroups-" + actionProfileId.id());
}
@Override
- public CompletableFuture<List<PiActionGroupMemberId>> dumpActionProfileMemberIds(
+ public CompletableFuture<List<PiActionProfileMemberId>> dumpActionProfileMemberIds(
PiActionProfileId actionProfileId, PiPipeconf pipeconf) {
return supplyInContext(() -> doDumpActionProfileMemberIds(actionProfileId, pipeconf),
"dumpActionProfileMemberIds-" + actionProfileId.id());
}
@Override
- public CompletableFuture<List<PiActionGroupMemberId>> removeActionProfileMembers(
+ public CompletableFuture<List<PiActionProfileMemberId>> removeActionProfileMembers(
PiActionProfileId actionProfileId,
- List<PiActionGroupMemberId> memberIds,
+ List<PiActionProfileMemberId> memberIds,
PiPipeconf pipeconf) {
return supplyInContext(
() -> doRemoveActionProfileMembers(actionProfileId, memberIds, pipeconf),
@@ -667,15 +667,15 @@
return CounterEntryCodec.decodeCounterEntities(entities, pipeconf);
}
- private boolean doWriteActionGroupMembers(List<PiActionGroupMember> members,
- WriteOperationType opType, PiPipeconf pipeconf) {
+ private boolean doWriteActionProfileMembers(List<PiActionProfileMember> members,
+ WriteOperationType opType, PiPipeconf pipeconf) {
final List<ActionProfileMember> actionProfileMembers = Lists.newArrayList();
- for (PiActionGroupMember member : members) {
+ for (PiActionProfileMember member : members) {
try {
actionProfileMembers.add(ActionProfileMemberEncoder.encode(member, pipeconf));
} catch (EncodeException | P4InfoBrowser.NotFoundException e) {
- log.warn("Unable to encode group member, aborting {} operation: {} [{}]",
+ log.warn("Unable to encode action profile member, aborting {} operation: {} [{}]",
opType.name(), e.getMessage(), member.toString());
return false;
}
@@ -696,10 +696,10 @@
return true;
}
- return write(updateMsgs, members, opType, "group member");
+ return write(updateMsgs, members, opType, "action profile member");
}
- private List<PiActionGroup> doDumpGroups(PiActionProfileId piActionProfileId, PiPipeconf pipeconf) {
+ private List<PiActionProfileGroup> doDumpGroups(PiActionProfileId piActionProfileId, PiPipeconf pipeconf) {
log.debug("Dumping groups from action profile {} from {} (pipeconf {})...",
piActionProfileId.id(), deviceId, pipeconf.id());
@@ -806,7 +806,7 @@
.map(Map.Entry::getKey)
.forEach(gid -> groupIdToMembersMap.put(gid, member)));
- log.debug("Retrieved {} group members from action profile {} on {}...",
+ log.debug("Retrieved {} members from action profile {} on {}...",
groupIdToMembersMap.size(), piActionProfileId.id(), deviceId);
return groupMsgs.stream()
@@ -824,7 +824,7 @@
.collect(Collectors.toList());
}
- private List<PiActionGroupMemberId> doDumpActionProfileMemberIds(
+ private List<PiActionProfileMemberId> doDumpActionProfileMemberIds(
PiActionProfileId actionProfileId, PiPipeconf pipeconf) {
final P4InfoBrowser browser = PipeconfHelper.getP4InfoBrowser(pipeconf);
@@ -875,13 +875,13 @@
// removing members of other groups.
.filter(m -> m.getActionProfileId() == p4ActProfId)
.map(ActionProfileMember::getMemberId)
- .map(PiActionGroupMemberId::of)
+ .map(PiActionProfileMemberId::of)
.collect(Collectors.toList());
}
- private List<PiActionGroupMemberId> doRemoveActionProfileMembers(
+ private List<PiActionProfileMemberId> doRemoveActionProfileMembers(
PiActionProfileId actionProfileId,
- List<PiActionGroupMemberId> memberIds,
+ List<PiActionProfileMemberId> memberIds,
PiPipeconf pipeconf) {
if (memberIds.isEmpty()) {
@@ -922,7 +922,8 @@
"action profile members");
}
- private boolean doWriteActionGroup(PiActionGroup group, WriteOperationType opType, PiPipeconf pipeconf,
+ private boolean doWriteActionProfileGroup(
+ PiActionProfileGroup group, WriteOperationType opType, PiPipeconf pipeconf,
int maxMemberSize) {
final ActionProfileGroup actionProfileGroup;
if (opType == P4RuntimeClient.WriteOperationType.INSERT && maxMemberSize < group.members().size()) {
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/TableEntryEncoder.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/TableEntryEncoder.java
index 7e2df98..3294a6d 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/TableEntryEncoder.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/TableEntryEncoder.java
@@ -26,9 +26,9 @@
import org.onosproject.net.pi.model.PiPipeconf;
import org.onosproject.net.pi.model.PiTableId;
import org.onosproject.net.pi.runtime.PiAction;
-import org.onosproject.net.pi.runtime.PiActionGroupId;
-import org.onosproject.net.pi.runtime.PiActionGroupMemberId;
import org.onosproject.net.pi.runtime.PiActionParam;
+import org.onosproject.net.pi.runtime.PiActionProfileGroupId;
+import org.onosproject.net.pi.runtime.PiActionProfileMemberId;
import org.onosproject.net.pi.runtime.PiCounterCellData;
import org.onosproject.net.pi.runtime.PiExactFieldMatch;
import org.onosproject.net.pi.runtime.PiFieldMatch;
@@ -46,7 +46,6 @@
import p4.v1.P4RuntimeOuterClass.TableAction;
import p4.v1.P4RuntimeOuterClass.TableEntry;
-import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -109,7 +108,7 @@
}
/**
- * Same as {@link #encode(Collection, PiPipeconf)} but encodes only one entry.
+ * Same as {@link #encode(List, PiPipeconf)} but encodes only one entry.
*
* @param piTableEntry table entry
* @param pipeconf pipeconf
@@ -162,7 +161,7 @@
}
/**
- * Same as {@link #decode(Collection, PiPipeconf)} but decodes only one entry.
+ * Same as {@link #decode(List, PiPipeconf)} but decodes only one entry.
*
* @param tableEntryMsg table entry message
* @param pipeconf pipeconf
@@ -443,13 +442,13 @@
Action theAction = encodePiAction(piAction, browser);
tableActionMsgBuilder.setAction(theAction);
break;
- case ACTION_GROUP_ID:
- PiActionGroupId actionGroupId = (PiActionGroupId) piTableAction;
+ case ACTION_PROFILE_GROUP_ID:
+ PiActionProfileGroupId actionGroupId = (PiActionProfileGroupId) piTableAction;
tableActionMsgBuilder.setActionProfileGroupId(actionGroupId.id());
break;
- case GROUP_MEMBER_ID:
- PiActionGroupMemberId actionGroupMemberId = (PiActionGroupMemberId) piTableAction;
- tableActionMsgBuilder.setActionProfileMemberId(actionGroupMemberId.id());
+ case ACTION_PROFILE_MEMBER_ID:
+ PiActionProfileMemberId actionProfileMemberId = (PiActionProfileMemberId) piTableAction;
+ tableActionMsgBuilder.setActionProfileMemberId(actionProfileMemberId.id());
break;
default:
throw new EncodeException(
@@ -467,9 +466,9 @@
Action actionMsg = tableActionMsg.getAction();
return decodeActionMsg(actionMsg, browser);
case ACTION_PROFILE_GROUP_ID:
- return PiActionGroupId.of(tableActionMsg.getActionProfileGroupId());
+ return PiActionProfileGroupId.of(tableActionMsg.getActionProfileGroupId());
case ACTION_PROFILE_MEMBER_ID:
- return PiActionGroupMemberId.of(tableActionMsg.getActionProfileMemberId());
+ return PiActionProfileMemberId.of(tableActionMsg.getActionProfileMemberId());
default:
throw new EncodeException(
format("Decoding of table action type %s not implemented", typeCase.name()));
@@ -524,4 +523,4 @@
static PiCounterCellData decodeCounter(CounterData counterData) {
return new PiCounterCellData(counterData.getPacketCount(), counterData.getByteCount());
}
-}
\ No newline at end of file
+}