Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-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 | */ |
| 16 | package org.onosproject.segmentrouting.xconnect.api; |
| 17 | |
Charles Chan | 0b1dd7e | 2018-08-19 19:21:46 -0700 | [diff] [blame] | 18 | import com.google.common.collect.ImmutableMap; |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 19 | import org.onlab.packet.VlanId; |
| 20 | import org.onosproject.net.ConnectPoint; |
| 21 | import org.onosproject.net.DeviceId; |
| 22 | import org.onosproject.net.PortNumber; |
| 23 | |
jayakumarthazhath | 66c9ec1 | 2018-10-01 00:51:54 +0530 | [diff] [blame] | 24 | import java.util.List; |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 25 | import java.util.Set; |
| 26 | |
| 27 | /** |
| 28 | * VLAN cross connect between exactly two ports. |
| 29 | */ |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 30 | public interface XconnectService { |
| 31 | |
| 32 | /** |
| 33 | * VLAN cross-connect ACL priority. |
| 34 | */ |
| 35 | int XCONNECT_ACL_PRIORITY = 60000; |
| 36 | |
| 37 | /** |
| 38 | * VLAN cross-connect Bridging priority. |
| 39 | */ |
| 40 | int XCONNECT_PRIORITY = 1000; |
| 41 | |
| 42 | /** |
| 43 | * Creates or updates Xconnect. |
| 44 | * |
| 45 | * @param deviceId device ID |
| 46 | * @param vlanId VLAN ID |
Charles Chan | 445659f | 2019-01-02 13:46:16 -0800 | [diff] [blame] | 47 | * @param endpoints set of endpoints |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 48 | */ |
Charles Chan | 445659f | 2019-01-02 13:46:16 -0800 | [diff] [blame] | 49 | void addOrUpdateXconnect(DeviceId deviceId, VlanId vlanId, Set<XconnectEndpoint> endpoints); |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 50 | |
| 51 | /** |
| 52 | * Deletes Xconnect. |
| 53 | * |
| 54 | * @param deviceId device ID |
| 55 | * @param vlanId VLAN ID |
| 56 | */ |
| 57 | void removeXonnect(DeviceId deviceId, VlanId vlanId); |
| 58 | |
| 59 | /** |
| 60 | * Gets Xconnects. |
| 61 | * |
| 62 | * @return set of Xconnect descriptions |
| 63 | */ |
| 64 | Set<XconnectDesc> getXconnects(); |
| 65 | |
| 66 | /** |
| 67 | * Check if there is Xconnect configured on given connect point. |
| 68 | * |
| 69 | * @param cp connect point |
| 70 | * @return true if there is Xconnect configured on the connect point |
| 71 | */ |
| 72 | boolean hasXconnect(ConnectPoint cp); |
| 73 | |
Charles Chan | 0b1dd7e | 2018-08-19 19:21:46 -0700 | [diff] [blame] | 74 | /** |
jayakumarthazhath | 66c9ec1 | 2018-10-01 00:51:54 +0530 | [diff] [blame] | 75 | * Gives xconnect VLAN of given port of a device. |
| 76 | * |
| 77 | * @param deviceId Device ID |
| 78 | * @param port Port number |
| 79 | * @return true if given VLAN vlanId is XConnect VLAN on device deviceId. |
| 80 | */ |
| 81 | List<VlanId> getXconnectVlans(DeviceId deviceId, PortNumber port); |
| 82 | |
| 83 | /** |
| 84 | * Checks given VLAN is XConnect VLAN in given device. |
| 85 | * |
| 86 | * @param deviceId Device ID |
| 87 | * @param vlanId VLAN ID |
| 88 | * @return true if given VLAN vlanId is XConnect VLAN on device deviceId. |
| 89 | */ |
| 90 | boolean isXconnectVlan(DeviceId deviceId, VlanId vlanId); |
| 91 | |
| 92 | /** |
Charles Chan | 0b1dd7e | 2018-08-19 19:21:46 -0700 | [diff] [blame] | 93 | * Returns the Xconnect next objective store. |
| 94 | * |
| 95 | * @return current contents of the xconnectNextObjStore |
| 96 | */ |
Charles Chan | 1fb6513 | 2018-09-21 11:29:12 -0700 | [diff] [blame] | 97 | ImmutableMap<XconnectKey, Integer> getNext(); |
Charles Chan | 0b1dd7e | 2018-08-19 19:21:46 -0700 | [diff] [blame] | 98 | |
| 99 | /** |
| 100 | * Removes given next ID from Xconnect next objective store. |
| 101 | * |
| 102 | * @param nextId next ID |
| 103 | */ |
| 104 | void removeNextId(int nextId); |
| 105 | |
jayakumarthazhath | 66c9ec1 | 2018-10-01 00:51:54 +0530 | [diff] [blame] | 106 | /** |
| 107 | * Returns Xconnect next objective ID associated with group device + vlan. |
| 108 | * |
| 109 | * @param deviceId - Device ID |
| 110 | * @param vlanId - VLAN ID |
| 111 | * @return Current associated group ID |
| 112 | */ |
| 113 | int getNextId(DeviceId deviceId, VlanId vlanId); |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 114 | } |