CORD-349 Support VLAN cross-connect traffic
Change related to this topic:
- Support VLAN cross-connect traffic
Utilize ports subjectClass to achieve. For non-xConnect port, set interface VLAN to -1
- Remove VLAN checking since we have multiple VLANs per port
- Hash the L2 interface group key generation to include VLAN as well
- Update the network-cfg.json sample
Other refactoring changes:
- Read next objective stores from srManager directly
- Use constant for flow priority
- CORD-267 Javadoc fix
Change-Id: I4ca8c2d9c8b3633a4a0101c5070d19343f7e5b90
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/PolicyGroupHandler.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/PolicyGroupHandler.java
index 4b0d518..4f32226 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/PolicyGroupHandler.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/PolicyGroupHandler.java
@@ -31,7 +31,6 @@
import org.onosproject.segmentrouting.config.DeviceConfigNotFoundException;
import org.onosproject.segmentrouting.config.DeviceProperties;
import org.onosproject.segmentrouting.grouphandler.GroupBucketIdentifier.BucketOutputType;
-import org.onosproject.store.service.EventuallyConsistentMap;
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
import org.onosproject.net.flow.DefaultTrafficTreatment;
@@ -51,33 +50,31 @@
private HashMap<PolicyGroupIdentifier, PolicyGroupIdentifier> dependentGroups = new HashMap<>();
/**
- * Policy group handler constructor.
+ * Constructs policy group handler.
*
* @param deviceId device identifier
* @param appId application identifier
* @param config interface to retrieve the device properties
* @param linkService link service object
* @param flowObjService flow objective service object
- * @param nsNextObjStore NeighborSet next objective store map
- * @param subnetNextObjStore subnet next objective store map
+ * @param srManager segment routing manager
*/
- // TODO Access stores through srManager
public PolicyGroupHandler(DeviceId deviceId,
ApplicationId appId,
DeviceProperties config,
LinkService linkService,
FlowObjectiveService flowObjService,
- EventuallyConsistentMap<NeighborSetNextObjectiveStoreKey,
- Integer> nsNextObjStore,
- EventuallyConsistentMap<SubnetNextObjectiveStoreKey,
- Integer> subnetNextObjStore,
- EventuallyConsistentMap<PortNextObjectiveStoreKey,
- Integer> portNextObjStore,
SegmentRoutingManager srManager) {
- super(deviceId, appId, config, linkService, flowObjService,
- nsNextObjStore, subnetNextObjStore, portNextObjStore, srManager);
+ super(deviceId, appId, config, linkService, flowObjService, srManager);
}
+ /**
+ * Creates policy group chain.
+ *
+ * @param id unique identifier associated with the policy group
+ * @param params a list of policy group params
+ * @return policy group identifier
+ */
public PolicyGroupIdentifier createPolicyGroupChain(String id,
List<PolicyGroupParams> params) {
List<GroupBucketIdentifier> bucketIds = new ArrayList<>();
@@ -222,69 +219,18 @@
}
//TODO: Use nextObjective APIs to handle the group chains
- /*@Override
- protected void handleGroupEvent(GroupEvent event) {
- if (event.type() == GroupEvent.Type.GROUP_ADDED) {
- if (dependentGroups.get(event.subject().appCookie()) != null) {
- PolicyGroupIdentifier dependentGroupKey = dependentGroups.get(event.subject().appCookie());
- dependentGroups.remove(event.subject().appCookie());
- boolean fullyResolved = true;
- for (GroupBucketIdentifier bucketId:
- dependentGroupKey.bucketIds()) {
- if (bucketId.type() != BucketOutputType.GROUP) {
- continue;
- }
- if (dependentGroups.containsKey(bucketId.outGroup())) {
- fullyResolved = false;
- break;
- }
- }
+ /*
+ @Override
+ protected void handleGroupEvent(GroupEvent event) {}
+ */
- if (fullyResolved) {
- List<GroupBucket> outBuckets = new ArrayList<GroupBucket>();
- for (GroupBucketIdentifier bucketId:
- dependentGroupKey.bucketIds()) {
- TrafficTreatment.Builder tBuilder =
- DefaultTrafficTreatment.builder();
- if (bucketId.label() != NeighborSet.NO_EDGE_LABEL) {
- tBuilder.pushMpls()
- .setMpls(MplsLabel.
- mplsLabel(bucketId.label()));
- }
- //TODO: BoS
- if (bucketId.type() == BucketOutputType.PORT) {
- DeviceId neighbor = portDeviceMap.
- get(bucketId.outPort());
- tBuilder.setOutput(bucketId.outPort())
- .setEthDst(deviceConfig.
- getDeviceMac(neighbor))
- .setEthSrc(nodeMacAddr);
- } else {
- if (groupService.
- getGroup(deviceId,
- getGroupKey(bucketId.
- outGroup())) == null) {
- throw new IllegalStateException();
- }
- GroupId indirectGroupId = groupService.
- getGroup(deviceId,
- getGroupKey(bucketId.
- outGroup())).id();
- tBuilder.group(indirectGroupId);
- }
- outBuckets.add(DefaultGroupBucket.
- createSelectGroupBucket(tBuilder.build()));
- }
- GroupDescription desc = new
- DefaultGroupDescription(deviceId,
- GroupDescription.Type.SELECT,
- new GroupBuckets(outBuckets));
- groupService.addGroup(desc);
- }
- }
- }
- }*/
-
+ /**
+ * Generates policy group key.
+ *
+ * @param id unique identifier associated with the policy group
+ * @param params a list of policy group params
+ * @return policy group identifier
+ */
public PolicyGroupIdentifier generatePolicyGroupKey(String id,
List<PolicyGroupParams> params) {
List<GroupBucketIdentifier> bucketIds = new ArrayList<>();
@@ -354,6 +300,11 @@
return innermostGroupkey;
}
+ /**
+ * Removes policy group chain.
+ *
+ * @param key policy group identifier
+ */
public void removeGroupChain(PolicyGroupIdentifier key) {
checkArgument(key != null);
List<PolicyGroupIdentifier> groupsToBeDeleted = new ArrayList<>();