use of p4.v1.P4RuntimeOuterClass.ActionProfileGroup in project onos by opennetworkinglab.
the class P4RuntimeGroupTest method testInsertPiActionProfileGroup.
@Test
public void testInsertPiActionProfileGroup() throws Exception {
CompletableFuture<Void> complete = p4RuntimeServerImpl.expectRequests(1);
client.write(P4_DEVICE_ID, PIPECONF).insert(GROUP).submitSync();
assertTrue(client.write(P4_DEVICE_ID, PIPECONF).insert(GROUP).submitSync().isSuccess());
complete.get(DEFAULT_TIMEOUT_TIME, TimeUnit.SECONDS);
WriteRequest result = p4RuntimeServerImpl.getWriteReqs().get(0);
assertEquals(1, result.getDeviceId());
assertEquals(1, result.getUpdatesCount());
assertEquals(DEFAULT_ELECTION_ID, result.getElectionId());
Update update = result.getUpdatesList().get(0);
assertEquals(Update.Type.INSERT, update.getType());
Entity entity = update.getEntity();
ActionProfileGroup actionProfileGroup = entity.getActionProfileGroup();
assertNotNull(actionProfileGroup);
assertEquals(P4_INFO_ACT_PROF_ID, actionProfileGroup.getActionProfileId());
assertEquals(3, actionProfileGroup.getMembersCount());
List<ActionProfileGroup.Member> members = actionProfileGroup.getMembersList();
for (ActionProfileGroup.Member member : members) {
// XXX: We can't guarantee the order of member, just make sure we
// have these member ids
assertTrue(MEMBER_IDS.contains(member.getMemberId()));
assertEquals(DEFAULT_MEMBER_WEIGHT, member.getWeight());
}
}
Aggregations