use of org.onosproject.net.group.GroupKey in project onos by opennetworkinglab.
the class ScalableGatewayManager method getGatewayGroupId.
@Override
public synchronized GroupId getGatewayGroupId(DeviceId srcDeviceId) {
GroupKey groupKey = selectGroupHandler.getGroupKey(srcDeviceId);
Group group = groupService.getGroup(srcDeviceId, groupKey);
if (group == null) {
log.info("Created gateway group for {}", srcDeviceId);
return selectGroupHandler.createGatewayGroup(srcDeviceId, getGatewayNodes());
} else {
return group.id();
}
}
use of org.onosproject.net.group.GroupKey in project onos by opennetworkinglab.
the class SelectGroupHandler method updateGatewayGroupBuckets.
/**
* Updates groupBuckets in select type group.
*
* @param deviceId target device id to update the group
* @param nodeList updated gateway node list for bucket action
* @param isInsert update type(add or remove)
*/
public void updateGatewayGroupBuckets(DeviceId deviceId, List<GatewayNode> nodeList, boolean isInsert) {
List<GroupBucket> bucketList = generateBucketsForSelectGroup(deviceId, nodeList);
GroupKey groupKey = getGroupKey(deviceId);
if (isInsert) {
groupService.addBucketsToGroup(deviceId, groupKey, new GroupBuckets(bucketList), groupKey, appId);
} else {
groupService.removeBucketsFromGroup(deviceId, groupKey, new GroupBuckets(bucketList), groupKey, appId);
}
}
use of org.onosproject.net.group.GroupKey in project onos by opennetworkinglab.
the class SimpleVirtualGroupStore method storeGroupDescriptionInternal.
private void storeGroupDescriptionInternal(NetworkId networkId, GroupDescription groupDesc) {
// Check if a group is existing with the same key
if (getGroup(networkId, groupDesc.deviceId(), groupDesc.appCookie()) != null) {
return;
}
GroupId id = null;
if (groupDesc.givenGroupId() == null) {
// Get a new group identifier
id = new GroupId(getFreeGroupIdValue(networkId, groupDesc.deviceId()));
} else {
id = new GroupId(groupDesc.givenGroupId());
}
// Create a group entry object
StoredGroupEntry group = new DefaultGroup(id, groupDesc);
// Insert the newly created group entry into concurrent key and id maps
ConcurrentMap<GroupKey, StoredGroupEntry> keyTable = getGroupKeyTable(networkId, groupDesc.deviceId());
keyTable.put(groupDesc.appCookie(), group);
ConcurrentMap<GroupId, StoredGroupEntry> idTable = getGroupIdTable(networkId, groupDesc.deviceId());
idTable.put(id, group);
notifyDelegate(networkId, new GroupEvent(GroupEvent.Type.GROUP_ADD_REQUESTED, group));
}
use of org.onosproject.net.group.GroupKey in project onos by opennetworkinglab.
the class SimpleVirtualGroupStore method storeGroupDescription.
@Override
public void storeGroupDescription(NetworkId networkId, GroupDescription groupDesc) {
// Check if a group is existing with the same key
if (getGroup(networkId, groupDesc.deviceId(), groupDesc.appCookie()) != null) {
return;
}
if (deviceAuditStatus.get(networkId) == null || deviceAuditStatus.get(networkId).get(groupDesc.deviceId()) == null) {
// Device group audit has not completed yet
// Add this group description to pending group key table
// Create a group entry object with Dummy Group ID
StoredGroupEntry group = new DefaultGroup(dummyGroupId, groupDesc);
group.setState(Group.GroupState.WAITING_AUDIT_COMPLETE);
ConcurrentMap<GroupKey, StoredGroupEntry> pendingKeyTable = getPendingGroupKeyTable(networkId, groupDesc.deviceId());
pendingKeyTable.put(groupDesc.appCookie(), group);
return;
}
storeGroupDescriptionInternal(networkId, groupDesc);
}
use of org.onosproject.net.group.GroupKey in project onos by opennetworkinglab.
the class SimpleVirtualGroupStore method removeGroupEntry.
@Override
public void removeGroupEntry(NetworkId networkId, Group group) {
StoredGroupEntry existing = null;
if (groupEntriesById.get(networkId) != null && groupEntriesById.get(networkId).get(group.deviceId()) != null) {
existing = groupEntriesById.get(networkId).get(group.deviceId()).get(group.id());
}
if (existing != null) {
ConcurrentMap<GroupKey, StoredGroupEntry> keyTable = getGroupKeyTable(networkId, existing.deviceId());
ConcurrentMap<GroupId, StoredGroupEntry> idTable = getGroupIdTable(networkId, existing.deviceId());
idTable.remove(existing.id());
keyTable.remove(existing.appCookie());
notifyDelegate(networkId, new GroupEvent(GroupEvent.Type.GROUP_REMOVED, existing));
}
}
Aggregations