use of org.onosproject.segmentrouting.policy.api.TrafficMatchId in project trellis-control by opennetworkinglab.
the class TrafficMatchAddCommand method doExecute.
@Override
protected void doExecute() {
TrafficSelector trafficSelector = parseArguments();
if (trafficSelector.equals(DefaultTrafficSelector.emptySelector())) {
print("Empty traffic selector is not allowed");
return;
}
TrafficMatchPriority trafficMatchPriority;
try {
trafficMatchPriority = new TrafficMatchPriority(priority);
} catch (IllegalArgumentException ex) {
print(ex.getMessage());
return;
}
PolicyService policyService = AbstractShellCommand.get(PolicyService.class);
TrafficMatchId trafficMatchId = policyService.addOrUpdateTrafficMatch(new TrafficMatch(trafficSelector, PolicyId.of(policyId), trafficMatchPriority));
print("Traffic match %s has been submitted", trafficMatchId);
}
use of org.onosproject.segmentrouting.policy.api.TrafficMatchId in project trellis-control by opennetworkinglab.
the class PolicyManager method activate.
@Activate
public void activate() {
appId = coreService.registerApplication(APP_NAME);
codecService.registerCodec(DropPolicy.class, new DropPolicyCodec());
codecService.registerCodec(RedirectPolicy.class, new RedirectPolicyCodec());
codecService.registerCodec(TrafficMatch.class, new TrafficMatchCodec());
cfgService.addListener(cfgListener);
policies = storageService.<PolicyId, PolicyRequest>consistentMapBuilder().withName(POLICY_STORE).withSerializer(serializer).build();
policies.addListener(mapPolListener);
policiesMap = policies.asJavaMap();
trafficMatches = storageService.<TrafficMatchId, TrafficMatchRequest>consistentMapBuilder().withName(TRAFFIC_MATCH_STORE).withSerializer(serializer).build();
trafficMatches.addListener(mapTMatchListener);
trafficMatchesMap = trafficMatches.asJavaMap();
operations = storageService.<String, Operation>consistentMapBuilder().withName(OPS_STORE).withSerializer(serializer).build();
operations.addListener(mapOpsListener);
opsMap = operations.asJavaMap();
policyLeaderCache = Maps.newConcurrentMap();
workers = new PredictableExecutor(DEFAULT_THREADS, groupedThreads("sr-policy", "worker-%d", log));
eventExecutor = Executors.newSingleThreadExecutor();
log.info("Started");
}
Aggregations