use of org.onosproject.segmentrouting.policy.api.PolicyService in project trellis-control by opennetworkinglab.
the class TrafficMatchRemoveCommand method doExecute.
@Override
protected void doExecute() {
PolicyService policyService = AbstractShellCommand.get(PolicyService.class);
trafficMatchId = trafficMatchId.replace("\\", "");
if (policyService.removeTrafficMatch(TrafficMatchId.of(trafficMatchId))) {
print("Removing traffic match %s", trafficMatchId);
} else {
print("Unable to remove traffic match %s", trafficMatchId);
}
}
use of org.onosproject.segmentrouting.policy.api.PolicyService in project trellis-control by opennetworkinglab.
the class PolicyDropAddCommand method doExecute.
@Override
protected void doExecute() {
PolicyService policyService = AbstractShellCommand.get(PolicyService.class);
PolicyId policyId = policyService.addOrUpdatePolicy(new DropPolicy());
print("Policy %s has been submitted", policyId);
}
use of org.onosproject.segmentrouting.policy.api.PolicyService in project trellis-control by opennetworkinglab.
the class PolicyListCommand method doExecute.
@Override
protected void doExecute() {
PolicyService policyService = AbstractShellCommand.get(PolicyService.class);
policyService.policies(policyTypes()).forEach(this::printPolicy);
}
use of org.onosproject.segmentrouting.policy.api.PolicyService in project trellis-control by opennetworkinglab.
the class PolicyRedirectAddCommand method doExecute.
@Override
protected void doExecute() {
Set<DeviceId> spinesToEnforce = spinesToEnforce();
if (spinesToEnforce.isEmpty()) {
print("Unable to submit redirect policy");
return;
}
PolicyService policyService = AbstractShellCommand.get(PolicyService.class);
PolicyId policyId = policyService.addOrUpdatePolicy(new RedirectPolicy(spinesToEnforce));
print("Policy %s has been submitted", policyId);
}
use of org.onosproject.segmentrouting.policy.api.PolicyService 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