use of org.onosproject.segmentrouting.policy.api.TrafficMatchData in project trellis-control by opennetworkinglab.
the class PolicyManager method trafficMatches.
@Override
public Set<TrafficMatchData> trafficMatches() {
Set<TrafficMatchData> trafficMatchData = Sets.newHashSet();
List<DeviceId> edgeDeviceIds = getEdgeDeviceIds();
Set<TrafficMatchRequest> trafficMatchRequests = ImmutableSet.copyOf(trafficMatchesMap.values());
TrafficMatchKey trafficMatchKey;
List<String> ops;
for (TrafficMatchRequest trafficMatchRequest : trafficMatchRequests) {
ops = Lists.newArrayList();
for (DeviceId deviceId : edgeDeviceIds) {
trafficMatchKey = new TrafficMatchKey(deviceId, trafficMatchRequest.trafficMatch().trafficMatchId());
Operation operation = Versioned.valueOrNull(operations.get(trafficMatchKey.toString()));
if (operation != null) {
ops.add(deviceId + " -> " + operation.toStringMinimal());
}
}
trafficMatchData.add(new TrafficMatchData(trafficMatchRequest.trafficMatchState(), trafficMatchRequest.trafficMatch(), ops));
}
return trafficMatchData;
}
use of org.onosproject.segmentrouting.policy.api.TrafficMatchData in project trellis-control by opennetworkinglab.
the class PolicyWebResource method getTrafficMatches.
/**
* Get all Traffic Matches.
*
* @return 200 OK will a collection of Traffic Matches
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("trafficmatch")
public Response getTrafficMatches() {
PolicyService policyService = get(PolicyService.class);
ObjectNode root = mapper().createObjectNode();
ArrayNode trafficMatchArr = root.putArray(TRAFFIC_MATCH);
for (TrafficMatchData trafficMatchData : policyService.trafficMatches()) {
TrafficMatch trafficMatch = trafficMatchData.trafficMatch();
trafficMatchArr.add(codec(TrafficMatch.class).encode(trafficMatch, this));
}
return Response.ok(root).build();
}
Aggregations