use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder in project openflowplugin by opendaylight.
the class GroupForwarderTest method testUpdate.
@Test
public void testUpdate() throws Exception {
Mockito.when(salGroupService.updateGroup(updateGroupInputCpt.capture())).thenReturn(RpcResultBuilder.success(new UpdateGroupOutputBuilder().setTransactionId(txId).build()).buildFuture());
Group groupOriginal = new GroupBuilder(group).build();
Group groupUpdate = new GroupBuilder(group).setGroupName("another-test").build();
final Future<RpcResult<UpdateGroupOutput>> addResult = groupForwarder.update(groupPath, groupOriginal, groupUpdate, flowCapableNodePath);
Mockito.verify(salGroupService).updateGroup(Matchers.<UpdateGroupInput>any());
Assert.assertTrue(addResult.isDone());
final RpcResult<UpdateGroupOutput> result = addResult.get(2, TimeUnit.SECONDS);
Assert.assertTrue(result.isSuccessful());
Assert.assertEquals(1, result.getResult().getTransactionId().getValue().intValue());
final UpdateGroupInput updateGroupInput = updateGroupInputCpt.getValue();
Assert.assertEquals(groupPath, updateGroupInput.getGroupRef().getValue());
Assert.assertEquals(nodePath, updateGroupInput.getNode().getValue());
Assert.assertNotNull(updateGroupInput.getOriginalGroup().getBuckets());
Assert.assertNotNull(updateGroupInput.getUpdatedGroup().getBuckets());
Assert.assertEquals("test-group", updateGroupInput.getOriginalGroup().getGroupName());
Assert.assertEquals("another-test", updateGroupInput.getUpdatedGroup().getGroupName());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder in project openflowplugin by opendaylight.
the class GroupNotificationSupplierImplTest method createTestGroup.
private static Group createTestGroup() {
final GroupBuilder builder = new GroupBuilder();
builder.setGroupId(new GroupId(GROUP_ID));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder in project openflowplugin by opendaylight.
the class GroupNotificationSupplierImplTest method createUpdatedTestGroup.
private static Group createUpdatedTestGroup() {
final GroupBuilder builder = new GroupBuilder();
builder.setGroupId(new GroupId(UPDATED_GROUP_ID));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder in project openflowplugin by opendaylight.
the class OpenflowPluginBulkGroupTransactionProvider method _modifyGroups.
public void _modifyGroups(CommandInterpreter ci) {
String nref = ci.nextArgument();
if (nref == null) {
ci.println("test node added");
createTestNode();
} else {
ci.println("User node added" + nref);
createUserNode(nref);
}
Integer count = Integer.parseInt(ci.nextArgument());
switch(count) {
case 1:
GroupBuilder group = createTestGroup("a4", "g1", "modify", "1");
GroupBuilder group1 = createTestGroup("a5", "g1", "modify", "2");
writeGroup(ci, group.build(), group1.build());
break;
case 2:
GroupBuilder group2 = createTestGroup("a1", "g1", "modify", "4");
GroupBuilder group3 = createTestGroup("a2", "g1", "modify", "5");
writeGroup(ci, group2.build(), group3.build());
break;
case 3:
GroupBuilder group4 = createTestGroup("a9", "g1", "modify", "6");
GroupBuilder group5 = createTestGroup("a10", "g1", "modify", "7");
writeGroup(ci, group4.build(), group5.build());
break;
case 4:
GroupBuilder group6 = createTestGroup("a6", "g1", "modify", "5");
GroupBuilder group7 = createTestGroup("a29", "g1", "modify", "6");
writeGroup(ci, group6.build(), group7.build());
break;
default:
break;
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder in project openflowplugin by opendaylight.
the class OpenflowPluginBulkGroupTransactionProvider method _addGroups.
public void _addGroups(CommandInterpreter ci) {
String nref = ci.nextArgument();
if (nref == null) {
ci.println("test node added");
createTestNode();
} else {
ci.println("User node added" + nref);
createUserNode(nref);
}
Integer count = Integer.parseInt(ci.nextArgument());
switch(count) {
case 1:
GroupBuilder group = createTestGroup("a7", "g1", "add", "1");
GroupBuilder group1 = createTestGroup("a3", "g1", "add", "2");
writeGroup(ci, group.build(), group1.build());
break;
case 2:
GroupBuilder group2 = createTestGroup("a4", "g1", "add", "4");
GroupBuilder group3 = createTestGroup("a5", "g1", "add", "5");
writeGroup(ci, group2.build(), group3.build());
break;
case 3:
GroupBuilder group4 = createTestGroup("a6", "g1", "add", "6");
GroupBuilder group5 = createTestGroup("a7", "g1", "add", "7");
writeGroup(ci, group4.build(), group5.build());
break;
case 4:
// -ve
GroupBuilder group6 = createTestGroup("a14", "g1", "add", "5");
GroupBuilder group7 = createTestGroup("a3", "g1", "add", "6");
writeGroup(ci, group6.build(), group7.build());
break;
default:
break;
}
}
Aggregations