Search in sources :

Example 1 with GroupBuilder

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());
}
Also used : Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) UpdateGroupOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput) GroupBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) UpdateGroupOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutputBuilder) UpdateGroupInput(org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput) Test(org.junit.Test)

Example 2 with GroupBuilder

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();
}
Also used : GroupBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder) GroupId(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId)

Example 3 with GroupBuilder

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();
}
Also used : GroupBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder) GroupId(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId)

Example 4 with GroupBuilder

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;
    }
}
Also used : BigInteger(java.math.BigInteger) GroupBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder)

Example 5 with GroupBuilder

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;
    }
}
Also used : BigInteger(java.math.BigInteger) GroupBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder)

Aggregations

GroupBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder)19 GroupId (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId)12 GroupKey (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey)9 Group (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group)6 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)5 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 BucketsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.BucketsBuilder)4 Bucket (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket)4 BucketBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketBuilder)4 StaleGroup (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.StaleGroup)4 StaleGroupKey (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.StaleGroupKey)4 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)4 BigInteger (java.math.BigInteger)3 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)3 AddGroupInput (org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput)3 StaleGroupBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.StaleGroupBuilder)3 FRMTest (test.mock.util.FRMTest)3 SalGroupServiceMock (test.mock.util.SalGroupServiceMock)3 GroupActionCase (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase)2