use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput in project netvirt by opendaylight.
the class NexthopManager method installGroupOnDpn.
private void installGroupOnDpn(long groupId, BigInteger dpnId, String groupName, List<BucketInfo> bucketsInfo, String nextHopKey, GroupTypes groupType) {
NodeRef nodeRef = FibUtil.buildNodeRef(dpnId);
Buckets buckets = FibUtil.buildBuckets(bucketsInfo);
GroupRef groupRef = new GroupRef(FibUtil.buildGroupInstanceIdentifier(groupId, dpnId));
AddGroupInput input = new AddGroupInputBuilder().setNode(nodeRef).setGroupId(new GroupId(groupId)).setBuckets(buckets).setGroupRef(groupRef).setGroupType(groupType).setGroupName(groupName).build();
Future<RpcResult<AddGroupOutput>> groupStats = salGroupService.addGroup(input);
RpcResult<AddGroupOutput> rpcResult = null;
try {
rpcResult = groupStats.get();
if (rpcResult != null && rpcResult.isSuccessful()) {
LOG.info("Group {} with key {} has been successfully installed directly on dpn {}.", groupId, nextHopKey, dpnId);
} else {
LOG.error("Unable to install group {} with key {} directly on dpn {} due to {}.", groupId, nextHopKey, dpnId, rpcResult != null ? rpcResult.getErrors() : null);
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error while installing group {} directly on dpn {}", groupId, dpnId);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput in project openflowplugin by opendaylight.
the class SalGroupServiceImplTest method addGroup.
private void addGroup() {
final GroupId dummyGroupId = new GroupId(DUMMY_GROUP_ID);
AddGroupInput addGroupInput = new AddGroupInputBuilder().setGroupId(dummyGroupId).build();
this.<AddGroupOutput>mockSuccessfulFuture();
salGroupService.addGroup(addGroupInput);
verify(mockedRequestContextStack).createRequestContext();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput in project openflowplugin by opendaylight.
the class SingleLayerGroupServiceTest method buildRequest.
@Test
public void buildRequest() throws Exception {
final AddGroupInput input = new AddGroupInputBuilder().setGroupId(new GroupId(GROUP_ID)).build();
final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
assertEquals(GroupMessage.class, ofHeader.getImplementedInterface());
final GroupMessage result = GroupMessage.class.cast(ofHeader);
assertEquals(GroupModCommand.OFPGCADD, result.getCommand());
assertEquals(GROUP_ID, result.getGroupId().getValue().longValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput in project openflowplugin by opendaylight.
the class GroupListenerTest method addTwoGroupsTest.
@Test
public void addTwoGroupsTest() throws Exception {
addFlowCapableNode(NODE_KEY);
GroupKey groupKey = new GroupKey(new GroupId((long) 255));
InstanceIdentifier<Group> groupII = InstanceIdentifier.create(Nodes.class).child(Node.class, NODE_KEY).augmentation(FlowCapableNode.class).child(Group.class, groupKey);
Group group = new GroupBuilder().setKey(groupKey).setGroupName("Group1").build();
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
assertCommit(writeTx.submit());
SalGroupServiceMock salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
List<AddGroupInput> addGroupCalls = salGroupService.getAddGroupCalls();
assertEquals(1, addGroupCalls.size());
assertEquals("DOM-0", addGroupCalls.get(0).getTransactionUri().getValue());
groupKey = new GroupKey(new GroupId((long) 256));
groupII = InstanceIdentifier.create(Nodes.class).child(Node.class, NODE_KEY).augmentation(FlowCapableNode.class).child(Group.class, groupKey);
group = new GroupBuilder().setKey(groupKey).setGroupName("Group1").build();
writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
assertCommit(writeTx.submit());
salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
addGroupCalls = salGroupService.getAddGroupCalls();
assertEquals(2, addGroupCalls.size());
assertEquals("DOM-1", addGroupCalls.get(1).getTransactionUri().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput in project openflowplugin by opendaylight.
the class GroupListenerTest method updateGroupTest.
@Test
public void updateGroupTest() throws Exception {
addFlowCapableNode(NODE_KEY);
GroupKey groupKey = new GroupKey(new GroupId((long) 255));
InstanceIdentifier<Group> groupII = InstanceIdentifier.create(Nodes.class).child(Node.class, NODE_KEY).augmentation(FlowCapableNode.class).child(Group.class, groupKey);
Group group = new GroupBuilder().setKey(groupKey).setGroupName("Group1").build();
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
assertCommit(writeTx.submit());
SalGroupServiceMock salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
List<AddGroupInput> addGroupCalls = salGroupService.getAddGroupCalls();
assertEquals(1, addGroupCalls.size());
assertEquals("DOM-0", addGroupCalls.get(0).getTransactionUri().getValue());
group = new GroupBuilder().setKey(groupKey).setGroupName("Group2").build();
writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
assertCommit(writeTx.submit());
salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
List<UpdateGroupInput> updateGroupCalls = salGroupService.getUpdateGroupCalls();
assertEquals(1, updateGroupCalls.size());
assertEquals("DOM-1", updateGroupCalls.get(0).getTransactionUri().getValue());
}
Aggregations