nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present Open Networking Laboratory |
| 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.vpls.config; |
| 17 | |
| 18 | import com.google.common.collect.SetMultimap; |
| 19 | import org.onlab.packet.VlanId; |
| 20 | import org.onosproject.incubator.net.intf.Interface; |
| 21 | import org.onosproject.net.ConnectPoint; |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 22 | import org.onosproject.net.EncapsulationType; |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 23 | |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 24 | import java.util.Map; |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 25 | import java.util.Set; |
| 26 | |
| 27 | /** |
| 28 | * Provides information about the VPLS configuration. |
| 29 | */ |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 30 | public interface VplsConfigService { |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 31 | Class<VplsAppConfig> CONFIG_CLASS = VplsAppConfig.class; |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 32 | |
| 33 | /** |
| 34 | * Adds a VPLS to the configuration. |
| 35 | * |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 36 | * @param vplsName the name of the VPLS |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 37 | * @param ifaces the interfaces associated with the VPLS |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 38 | * @param encap the encapsulation type |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 39 | */ |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 40 | void addVpls(String vplsName, Set<String> ifaces, String encap); |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 41 | |
| 42 | /** |
| 43 | * Removes a VPLS from the configuration. |
| 44 | * |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 45 | * @param vplsName the name of the VPLS to be removed |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 46 | */ |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 47 | void removeVpls(String vplsName); |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 48 | |
| 49 | /** |
| 50 | * Adds a network interface to a VPLS. |
| 51 | * |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 52 | * @param vplsName the name of the VPLS |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 53 | * @param iface the network interface to be added to the VPLS |
| 54 | */ |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 55 | void addIface(String vplsName, String iface); |
| 56 | |
| 57 | /** |
| 58 | * Sets an encapsulation parameter for a VPLS. |
| 59 | * |
| 60 | * @param vplsName the name of the VPLS |
| 61 | * @param encap the encapsulation used (i.e. MPLS or VLAN) or |
| 62 | */ |
| 63 | void setEncap(String vplsName, String encap); |
| 64 | |
| 65 | /** |
| 66 | * Returns the encapsulation type in use for a given VPLS. |
| 67 | * |
| 68 | * @param vplsName the name of the VPLS |
| 69 | * @return the encapsulation type in use, if any |
| 70 | */ |
| 71 | EncapsulationType encap(String vplsName); |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 72 | |
| 73 | /** |
| 74 | * Removes a network interface from a VPLS. |
| 75 | * |
| 76 | * @param iface the network interface to be removed from the VPLS |
| 77 | */ |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 78 | void removeIface(String iface); |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 79 | |
| 80 | /** |
| 81 | * Cleans up the VPLS configuration. Removes all VPLSs. |
| 82 | */ |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 83 | void cleanVplsConfig(); |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 84 | |
| 85 | /** |
| 86 | * Retrieves the VPLS names modified from CLI. |
| 87 | * |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 88 | * @return the VPLS names modified from CLI |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 89 | */ |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 90 | Set<String> vplsAffectedByApi(); |
| 91 | // TODO Remove this function after the intent framework race condition has been fixed |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 92 | |
| 93 | /** |
Luca Prete | dce16f8 | 2016-11-22 13:11:56 -0800 | [diff] [blame^] | 94 | * Retrieves the interfaces without IP configured, so compatible with VPLS, |
| 95 | * from the interface service. |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 96 | * |
Luca Prete | dce16f8 | 2016-11-22 13:11:56 -0800 | [diff] [blame^] | 97 | * @return the set of interfaces configured, compatible with VPLS |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 98 | */ |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 99 | Set<Interface> allIfaces(); |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 100 | |
| 101 | /** |
Luca Prete | dce16f8 | 2016-11-22 13:11:56 -0800 | [diff] [blame^] | 102 | * Retrieves the interfaces associated to a VPLS. |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 103 | * |
Luca Prete | dce16f8 | 2016-11-22 13:11:56 -0800 | [diff] [blame^] | 104 | * @return the set of interfaces associated to a VPLS |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 105 | */ |
| 106 | Set<Interface> ifaces(); |
| 107 | |
| 108 | /** |
Luca Prete | dce16f8 | 2016-11-22 13:11:56 -0800 | [diff] [blame^] | 109 | * Retrieves the interfaces associated to the VPLS specified. |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 110 | * |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 111 | * @param vplsName the name of the VPLS |
Luca Prete | dce16f8 | 2016-11-22 13:11:56 -0800 | [diff] [blame^] | 112 | * @return the set of interfaces associated to the VPLS specified |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 113 | */ |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 114 | Set<Interface> ifaces(String vplsName); |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 115 | |
| 116 | /** |
| 117 | * Retrieves all VPLS names. |
| 118 | * |
| 119 | * @return a set of VPLS names |
| 120 | */ |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 121 | Set<String> vplsNames(); |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 122 | |
| 123 | /** |
| 124 | * Retrieves all VPLS names from the old config. |
| 125 | * |
| 126 | * @return a set of VPLS names |
| 127 | */ |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 128 | Set<String> vplsNamesOld(); |
Luca Prete | dce16f8 | 2016-11-22 13:11:56 -0800 | [diff] [blame^] | 129 | // TODO Removes this function after the race condition gets fixed in IF |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 130 | |
| 131 | /** |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 132 | * Returns the VPLS names and associated interfaces from the configuration. |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 133 | * |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 134 | * @return a map of VPLS names and associated interfaces |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 135 | */ |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 136 | SetMultimap<String, Interface> ifacesByVplsName(); |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 137 | |
| 138 | /** |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 139 | * Returns the list of interfaces grouped by VPLS name, given a VLAN Id and |
| 140 | * a connect point. |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 141 | * |
| 142 | * @param vlan the VLAN Id |
| 143 | * @param connectPoint the connect point |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 144 | * @return a map of VPLS names and associated interfaces; null otherwise |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 145 | */ |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 146 | SetMultimap<String, Interface> ifacesByVplsName(VlanId vlan, |
| 147 | ConnectPoint connectPoint); |
| 148 | |
| 149 | /** |
| 150 | * Returns the VPLS names and associated encapsulation type. |
| 151 | * |
| 152 | * @return a map of VPLS names and associated encapsulation type |
| 153 | */ |
| 154 | Map<String, EncapsulationType> encapByVplsName(); |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 155 | } |