blob: 2e188ab9a1f9ebcf2b24c81c12983aa2a4e7bad4 [file] [log] [blame]
pierventre30368ab2021-02-24 23:23:22 +01001/*
2 * Copyright 2021-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.segmentrouting.policy.api;
17
18import java.util.Set;
19
20/**
21 * Policies to drop, reroute, apply QoS and overlay the traffic.
22 */
23public interface PolicyService {
24 /**
25 * Traffic match priority.
26 */
27 int TRAFFIC_MATCH_PRIORITY = 60000;
28
29 /**
30 * Creates or updates a policy.
31 *
32 * @param policy the policy to create
33 * @return the id of the policy being created. Otherwise null.
34 */
35 PolicyId addOrUpdatePolicy(Policy policy);
36
37 /**
38 * Issues a policy removal.
39 *
40 * @param policyId the id of the policy to remove
41 * @return whether or not the operation was successful
42 */
43 boolean removePolicy(PolicyId policyId);
44
45 /**
46 * Returns a set of policies. The policy types can be used
47 * as filter.
48 *
49 * @param filter the policy types
50 * @return the policies stored in the system observing
51 * the filtering rule
52 */
53 Set<PolicyData> policies(Set<Policy.PolicyType> filter);
54
55 /**
56 * Attaches a traffic match to a policy.
57 *
58 * @param trafficMatch the traffic match
59 * @return the traffic match id or null if not successful
60 */
61 TrafficMatchId addOrUpdateTrafficMatch(TrafficMatch trafficMatch);
62
63 /**
64 * Issues a traffic match removal.
65 *
66 * @param trafficMatchId the id of the traffic match to remove
67 * @return whether or not the operation was successful
68 */
69 boolean removeTrafficMatch(TrafficMatchId trafficMatchId);
70
71 /**
72 * Returns a set of traffic matches.
73 *
74 * @return the traffic matches stored in the system
75 */
76 Set<TrafficMatchData> trafficMatches();
77}