Srikanth Vavilapalli | fb38ed6 | 2014-10-20 13:34:01 -0700 | [diff] [blame] | 1 | package net.onrc.onos.apps.segmentrouting; |
| 2 | |
Fahad Naeem Khan | a40f9b6 | 2014-10-20 18:33:45 -0700 | [diff] [blame] | 3 | import java.util.Collection; |
Fahad Naeem Khan | d1ac370 | 2014-10-22 15:59:31 -0700 | [diff] [blame] | 4 | import java.util.HashMap; |
Srikanth Vavilapalli | fb38ed6 | 2014-10-20 13:34:01 -0700 | [diff] [blame] | 5 | import java.util.List; |
| 6 | |
| 7 | import net.floodlightcontroller.core.module.IFloodlightService; |
| 8 | import net.floodlightcontroller.util.MACAddress; |
Fahad Naeem Khan | 12fa63a | 2014-10-21 17:01:27 -0700 | [diff] [blame] | 9 | import net.onrc.onos.apps.segmentrouting.SegmentRoutingManager.PolicyInfo; |
Fahad Naeem Khan | a40f9b6 | 2014-10-20 18:33:45 -0700 | [diff] [blame] | 10 | import net.onrc.onos.apps.segmentrouting.SegmentRoutingManager.TunnelInfo; |
Srikanth Vavilapalli | fb38ed6 | 2014-10-20 13:34:01 -0700 | [diff] [blame] | 11 | import net.onrc.onos.core.util.IPv4Net; |
| 12 | |
| 13 | /** |
| 14 | * The API exported by the main SDN-IP class. This is the interface between the |
| 15 | * REST handlers and the SDN-IP module. |
| 16 | */ |
| 17 | public interface ISegmentRoutingService extends IFloodlightService { |
| 18 | |
| 19 | /** |
| 20 | * Create a tunnel for policy routing. |
| 21 | * |
| 22 | * @param tunnelId ID for the tunnel |
Srikanth Vavilapalli | 1f6a574 | 2014-10-21 13:45:11 -0700 | [diff] [blame] | 23 | * @param labelIds Node label IDs for the tunnel |
Srikanth Vavilapalli | fb38ed6 | 2014-10-20 13:34:01 -0700 | [diff] [blame] | 24 | * |
| 25 | * @return "true/false" depending tunnel creation status |
| 26 | */ |
Srikanth Vavilapalli | 1f6a574 | 2014-10-21 13:45:11 -0700 | [diff] [blame] | 27 | public boolean createTunnel(String tunnelId, List<Integer> labelIds); |
Srikanth Vavilapalli | fb38ed6 | 2014-10-20 13:34:01 -0700 | [diff] [blame] | 28 | |
| 29 | /** |
| 30 | * Remove a Segment Routing tunnel given a tunnel Id. |
| 31 | * |
| 32 | * @param tunnelId ID for the tunnel |
| 33 | * |
| 34 | * @return "true/false" depending tunnel deletion status |
| 35 | */ |
| 36 | public boolean removeTunnel(String tunnelId); |
| 37 | |
| 38 | /** |
| 39 | * Create a policy for policy based segment routing |
Srikanth Vavilapalli | 1f6a574 | 2014-10-21 13:45:11 -0700 | [diff] [blame] | 40 | * |
Srikanth Vavilapalli | fb38ed6 | 2014-10-20 13:34:01 -0700 | [diff] [blame] | 41 | * @param pid Unique Policy Identifier |
| 42 | * @param srcIP Source IP address in CIDR format |
| 43 | * @param dstIP Destination IP address in CIDR format |
| 44 | * @param ipProto IP protocol type |
| 45 | * @param srcPort Source L4 port |
| 46 | * @param dstPort Destination L4 port |
| 47 | * @param priority Priority of the policy |
| 48 | * @param tid SR Tunnel Id to be associated with this policy |
| 49 | * |
| 50 | * @return "true/false" depending tunnel creation status |
| 51 | */ |
| 52 | public boolean createPolicy(String pid, MACAddress srcMac, MACAddress dstMac, |
| 53 | Short etherType, IPv4Net srcIp, IPv4Net dstIp, Byte ipProto, |
| 54 | Short srcPort, Short dstPort, int priority, String tid); |
| 55 | |
| 56 | /** |
| 57 | * Remove a policy given policy Id |
| 58 | * |
| 59 | * @param pid Unique Policy Identifier |
| 60 | * |
| 61 | * @return "true/false" depending tunnel deletion status |
| 62 | */ |
| 63 | public boolean removePolicy(String pid); |
Fahad Naeem Khan | a40f9b6 | 2014-10-20 18:33:45 -0700 | [diff] [blame] | 64 | /** |
| 65 | * Return the collection of TunnelInfo which contains |
| 66 | * info about tunnels |
| 67 | * @return Collection<TunnelInfo> |
| 68 | */ |
Srikanth Vavilapalli | 1f6a574 | 2014-10-21 13:45:11 -0700 | [diff] [blame] | 69 | |
Fahad Naeem Khan | a40f9b6 | 2014-10-20 18:33:45 -0700 | [diff] [blame] | 70 | public Collection<TunnelInfo> getTunnelTable(); |
Fahad Naeem Khan | 95aa401 | 2014-10-21 14:07:00 -0700 | [diff] [blame] | 71 | /** |
| 72 | * Get the first group ID for the tunnel for specific source router |
| 73 | * If Segment Stitching was required to create the tunnel, there are |
| 74 | * mutiple source routers. |
| 75 | * |
| 76 | * @param tunnelId ID for the tunnel |
| 77 | * @param dpid source router DPID |
| 78 | * @return the first group ID of the tunnel and -1 if sw with specifed |
| 79 | * dpid is not found |
| 80 | */ |
| 81 | public int getTunnelGroupId(String tunnelId, String dpid); |
Fahad Naeem Khan | 12fa63a | 2014-10-21 17:01:27 -0700 | [diff] [blame] | 82 | /** |
| 83 | * return list of all the policies currently there in Segment Router |
| 84 | * @return Collection<PolicyInfo> |
| 85 | */ |
| 86 | public Collection<PolicyInfo> getPoclicyTable(); |
Fahad Naeem Khan | d1ac370 | 2014-10-22 15:59:31 -0700 | [diff] [blame] | 87 | /** |
| 88 | * Returns the Adjacency Info for the node |
| 89 | * |
| 90 | * @param nodeSid Node SID |
| 91 | * @return HashMap of <AdjacencyID, list of ports> |
| 92 | */ |
| 93 | public HashMap<Integer, List<Integer>> getAdjacencyInfo(int nodeSid); |
| 94 | /** |
| 95 | * Returns the Adjacency IDs for the node |
| 96 | * |
| 97 | * @param nodeSid Node SID |
| 98 | * @return Collection of Adjacency ID |
| 99 | */ |
| 100 | public Collection<Integer> getAdjacencyIds(int nodeSid); |
Srikanth Vavilapalli | fb38ed6 | 2014-10-20 13:34:01 -0700 | [diff] [blame] | 101 | } |