...
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
{ Collection<TrafficTreatment>List<GroupBucket> groupBucketsbuckets = new ArrayList<TrafficTreatment>ArrayList<GroupBucket>(); List<PortNumber> outPorts = getPortsToDevice(srcDevice, neighborDevice); for (PortNumber portNumber: outPorts) { TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); tBuilder.setOutput(portNumber) .setEthDst(getRouterMacAddress(neighborDevice)) .setEthSrc(getRouterMacAddress(srcDevice)) .pushMpls() .setMpls(getMplsId(finalDstDevice)); groupBucketsbuckets.add(GroupBucket.createSelectGroupBucket(tBuilder.build())); } GroupBuckets groupBuckets = new GroupBuckets(buckets); GroupKey gorupKeygroupKey = SegmentRoutingGroupKey.build(srcDevice, Collection<NeighborDevice>, dstDevice); GroupDescription groupDesc = Future<Group> future = groupService.createGroupnew DefaultGroupDescription(srcDevice, Group.Type.SELECT, groupBuckets, groupKey, getAppId()); Group group = future.get(groupService.addGroup(groupDesc); } public void SetIpRule() { .... GroupKey gorupKey = SegmentRoutingGroupKey.build(srcDevice, Collection<NeighborDevice>, dstDevice); Group group = groupService.getGroup(srcDevice, groupKey); tbuilder.setGroup(group.id()).id()); .... } |
Group Manager
This component implements the Group Service interface by defining Group create/modify/remove/query operations on devices.
...
High level flow of events in the Group subsystem is depicted below when an operation like CreateGroup is submitted by the application to non-Master controller instance in a multi-instance environment.
Multi-instance Support
...
Group Provider
Provides SB APIs towards core
CreateGroup(GroupId, Buckets)
ModifyGroup(GroupId, Buckets)
RemoveGroup(GroupId)
GetGroups()
OF Group Provider
...
Implements Group Providers interface
...
Code Block language java title Group Provider SB API /** * Abstraction of group provider. */ public interface GroupProvider extends Provider { /** * Perform a group operation in the specified device with the * specified parameters. * * @param deviceId device identifier on which the batch of group * operations to be executed * @param groupOps immutable list of group operation */ void performGroupOperation(DeviceId deviceId, GroupOperations groupOps); }
Code Block language java title Group Provider Notifications to Northbound /** * Service through which Group providers can inject information into * the core. */ public interface GroupProviderService extends ProviderService<GroupProvider> { /** * Notifies core if any failure from data plane during group operations. * * @param operation offended group operation */ void groupOperationFailed(GroupOperation operation); /** * Pushes the collection of group detected in the data plane along * with statistics. * * @param deviceId device identifier * @param groupEntries collection of group entries as seen in data plane */ void pushGroupMetrics(DeviceId deviceId, Collection<Group> groupEntries); }
OF Group Provider
Implements Group Providers interface
- Add listeners to OpenFlowController for any events
- On DeviceConnected event, spawn a Group statistics collector per device that retrieves the Group descriptions and Group statistics
- On receiving GROUP_DESC or STATS_REPLY for GROUPS, pass them to GroupStatsCollector module to combine them into a single notification event to be notified to core
Builds Open Flow GROUP_MOD (ADD/MOD/DELETE) Message depending on the group operation invocation and writes the message to switch driver
- On GROUP_MOD failures, notifies the core with the correction Group operation information. To achieve this, OF Group Provider maintain a map of Open flow transaction Id and associated GroupOperation that was submitted from core. On receiving GROUP_DESC with the corresponding GroupId or receiving GROUP_MOD failed with the transaction Id, OF Group Provider should clear the map and notifies the core accordingly.
Class Diagram
...
OF Switch Driver
No changes
...