use of p4.v1.P4RuntimeOuterClass.Entity in project onos by opennetworkinglab.
the class P4RuntimeGroupTest method testInsertPiActionMembers.
@Test
public void testInsertPiActionMembers() throws Exception {
CompletableFuture<Void> complete = p4RuntimeServerImpl.expectRequests(1);
assertTrue(client.write(P4_DEVICE_ID, PIPECONF).insert(GROUP_MEMBER_INSTANCES).submitSync().isSuccess());
complete.get(DEFAULT_TIMEOUT_TIME, TimeUnit.SECONDS);
WriteRequest result = p4RuntimeServerImpl.getWriteReqs().get(0);
assertEquals(1, result.getDeviceId());
assertEquals(3, result.getUpdatesCount());
assertEquals(DEFAULT_ELECTION_ID, result.getElectionId());
List<Update> updates = result.getUpdatesList();
for (Update update : updates) {
assertEquals(Update.Type.INSERT, update.getType());
Entity entity = update.getEntity();
ActionProfileMember member = entity.getActionProfileMember();
assertNotNull(member);
assertEquals(P4_INFO_ACT_PROF_ID, member.getActionProfileId());
assertTrue(MEMBER_IDS.contains(member.getMemberId()));
Action action = member.getAction();
assertEquals(SET_EGRESS_PORT_ID, action.getActionId());
assertEquals(1, action.getParamsCount());
Action.Param param = action.getParamsList().get(0);
assertEquals(1, param.getParamId());
byte outPort = (byte) (member.getMemberId() - BASE_MEM_ID);
ByteString bs = ByteString.copyFrom(new byte[] { 0, outPort });
assertEquals(bs, param.getValue());
}
}
Aggregations