blob: 2fe6488377388509e328edd575b00cca8f8773ed [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.onlab.packet.VlanId;
20import org.onosproject.net.ConnectPoint;
21import org.onosproject.net.DeviceId;
22import org.onosproject.net.PortNumber;
23
jayakumarthazhath66c9ec12018-10-01 00:51:54 +053024import java.util.List;
Charles Chan8d316332018-06-19 20:31:57 -070025import java.util.Set;
26
27/**
28 * VLAN cross connect between exactly two ports.
29 */
Charles Chan8d316332018-06-19 20:31:57 -070030public 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 Chan445659f2019-01-02 13:46:16 -080047 * @param endpoints set of endpoints
Charles Chan8d316332018-06-19 20:31:57 -070048 */
Charles Chan445659f2019-01-02 13:46:16 -080049 void addOrUpdateXconnect(DeviceId deviceId, VlanId vlanId, Set<XconnectEndpoint> endpoints);
Charles Chan8d316332018-06-19 20:31:57 -070050
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 Chan0b1dd7e2018-08-19 19:21:46 -070074 /**
jayakumarthazhath66c9ec12018-10-01 00:51:54 +053075 * 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 Chan0b1dd7e2018-08-19 19:21:46 -070093 * Returns the Xconnect next objective store.
94 *
95 * @return current contents of the xconnectNextObjStore
96 */
Charles Chan1fb65132018-09-21 11:29:12 -070097 ImmutableMap<XconnectKey, Integer> getNext();
Charles Chan0b1dd7e2018-08-19 19:21:46 -070098
99 /**
100 * Removes given next ID from Xconnect next objective store.
101 *
102 * @param nextId next ID
103 */
104 void removeNextId(int nextId);
105
jayakumarthazhath66c9ec12018-10-01 00:51:54 +0530106 /**
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 Chan8d316332018-06-19 20:31:57 -0700114}