blob: 4e82524c7ff152ab00b7efc70a3ee7ed9f56a396 [file] [log] [blame]
Charles Chan8d316332018-06-19 20:31:57 -07001/*
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 */
16package org.onosproject.segmentrouting.xconnect.api;
17
Charles Chan0b1dd7e2018-08-19 19:21:46 -070018import com.google.common.collect.ImmutableMap;
Charles Chan8d316332018-06-19 20:31:57 -070019import org.apache.felix.scr.annotations.Service;
20import org.onlab.packet.VlanId;
21import org.onosproject.net.ConnectPoint;
22import org.onosproject.net.DeviceId;
23import org.onosproject.net.PortNumber;
24
jayakumarthazhath66c9ec12018-10-01 00:51:54 +053025import java.util.List;
Charles Chan8d316332018-06-19 20:31:57 -070026import java.util.Set;
27
28/**
29 * VLAN cross connect between exactly two ports.
30 */
31@Service
32public interface XconnectService {
33
34 /**
35 * VLAN cross-connect ACL priority.
36 */
37 int XCONNECT_ACL_PRIORITY = 60000;
38
39 /**
40 * VLAN cross-connect Bridging priority.
41 */
42 int XCONNECT_PRIORITY = 1000;
43
44 /**
45 * Creates or updates Xconnect.
46 *
47 * @param deviceId device ID
48 * @param vlanId VLAN ID
49 * @param ports set of ports
50 */
51 void addOrUpdateXconnect(DeviceId deviceId, VlanId vlanId, Set<PortNumber> ports);
52
53 /**
54 * Deletes Xconnect.
55 *
56 * @param deviceId device ID
57 * @param vlanId VLAN ID
58 */
59 void removeXonnect(DeviceId deviceId, VlanId vlanId);
60
61 /**
62 * Gets Xconnects.
63 *
64 * @return set of Xconnect descriptions
65 */
66 Set<XconnectDesc> getXconnects();
67
68 /**
69 * Check if there is Xconnect configured on given connect point.
70 *
71 * @param cp connect point
72 * @return true if there is Xconnect configured on the connect point
73 */
74 boolean hasXconnect(ConnectPoint cp);
75
Charles Chan0b1dd7e2018-08-19 19:21:46 -070076 /**
jayakumarthazhath66c9ec12018-10-01 00:51:54 +053077 * Gives xconnect VLAN of given port of a device.
78 *
79 * @param deviceId Device ID
80 * @param port Port number
81 * @return true if given VLAN vlanId is XConnect VLAN on device deviceId.
82 */
83 List<VlanId> getXconnectVlans(DeviceId deviceId, PortNumber port);
84
85 /**
86 * Checks given VLAN is XConnect VLAN in given device.
87 *
88 * @param deviceId Device ID
89 * @param vlanId VLAN ID
90 * @return true if given VLAN vlanId is XConnect VLAN on device deviceId.
91 */
92 boolean isXconnectVlan(DeviceId deviceId, VlanId vlanId);
93
94 /**
Charles Chan0b1dd7e2018-08-19 19:21:46 -070095 * Returns the Xconnect next objective store.
96 *
97 * @return current contents of the xconnectNextObjStore
98 */
Charles Chan1fb65132018-09-21 11:29:12 -070099 ImmutableMap<XconnectKey, Integer> getNext();
Charles Chan0b1dd7e2018-08-19 19:21:46 -0700100
101 /**
102 * Removes given next ID from Xconnect next objective store.
103 *
104 * @param nextId next ID
105 */
106 void removeNextId(int nextId);
107
jayakumarthazhath66c9ec12018-10-01 00:51:54 +0530108 /**
109 * Returns Xconnect next objective ID associated with group device + vlan.
110 *
111 * @param deviceId - Device ID
112 * @param vlanId - VLAN ID
113 * @return Current associated group ID
114 */
115 int getNextId(DeviceId deviceId, VlanId vlanId);
Charles Chan8d316332018-06-19 20:31:57 -0700116}