blob: 9906d741ca97c1f685be92b9a169ef32a09e145a [file] [log] [blame]
Sangho Shin177e64f2014-10-28 17:49:23 -07001package net.onrc.onos.apps.segmentrouting;
2
3import net.onrc.onos.core.matchaction.match.PacketMatch;
4
5public class SegmentRoutingPolicy {
6
7 /**
8 * Enums for policy type
9 *
10 */
11 public enum PolicyType{
12 TUNNEL_FLOW,
13 LOADBALANCE,
14 AVOID,
15 DENY
16 }
17
18 protected SegmentRoutingManager srManager;
19 protected String policyId;
20 protected PacketMatch match;
21 protected int priority;
22 protected PolicyType type;
23
Sangho Shinbe3c3612014-10-30 14:20:36 -070024 /**
25 * Constructor
26 *
27 * @param srm Segment Routing Manager object
28 * @param pid Policy ID
29 * @param type Policy type
30 * @param match PacketMatch for the policy
31 * @param priority Priority
32 */
Sangho Shin177e64f2014-10-28 17:49:23 -070033 public SegmentRoutingPolicy(SegmentRoutingManager srm, String pid,
34 PolicyType type, PacketMatch match, int priority) {
35 this.srManager = srm;
36 this.policyId = pid;
37 this.match = match;
38 this.priority = priority;
39 this.type = type;
40 }
41
Sangho Shinbe3c3612014-10-30 14:20:36 -070042 /**
43 * Get the policy ID
44 *
45 * @return policy ID
46 */
Sangho Shin177e64f2014-10-28 17:49:23 -070047 public String getPolicyId(){
48 return this.policyId;
49 }
50
Sangho Shinbe3c3612014-10-30 14:20:36 -070051 /**
52 * Get Match
53 *
54 * @return PacketMatch object
55 */
Sangho Shin177e64f2014-10-28 17:49:23 -070056 public PacketMatch getMatch(){
57 return this.match;
58 }
59
Sangho Shinbe3c3612014-10-30 14:20:36 -070060 /**
61 * Get the priority of the policy
62 *
63 * @return priority
64 */
Sangho Shin177e64f2014-10-28 17:49:23 -070065 public int getPriority(){
66 return this.priority;
67 }
68
Sangho Shinbe3c3612014-10-30 14:20:36 -070069 /**
70 * Get the policy type
71 *
72 * @return policy type
73 */
Sangho Shin177e64f2014-10-28 17:49:23 -070074 public PolicyType getType(){
75 return this.type;
76 }
77
Sangho Shinbe3c3612014-10-30 14:20:36 -070078 /**
79 * Create a policy
80 *
81 * @return true if succeeds, false otherwise
82 */
Sangho Shin177e64f2014-10-28 17:49:23 -070083 public boolean createPolicy() {
84 return false;
85 }
86
Sangho Shinbe3c3612014-10-30 14:20:36 -070087 /**
88 * Remove the policy
89 *
90 * @return true if succeeds, false otherwise
91 */
Sangho Shin177e64f2014-10-28 17:49:23 -070092 public boolean removePolicy() {
93 return false;
94 }
95
96}