Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 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 | */ |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 16 | |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 17 | package org.onosproject.vpls; |
| 18 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 19 | import com.fasterxml.jackson.databind.JsonNode; |
| 20 | import com.fasterxml.jackson.databind.ObjectMapper; |
Luca Prete | 1346564 | 2017-01-04 10:31:48 -0800 | [diff] [blame] | 21 | import com.google.common.collect.ImmutableSet; |
Luca Prete | 1346564 | 2017-01-04 10:31:48 -0800 | [diff] [blame] | 22 | import com.google.common.collect.Lists; |
| 23 | import com.google.common.collect.Maps; |
Luca Prete | 1346564 | 2017-01-04 10:31:48 -0800 | [diff] [blame] | 24 | import com.google.common.collect.Sets; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 25 | import org.onlab.packet.Ip4Address; |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 26 | import org.onlab.packet.IpAddress; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 27 | import org.onlab.packet.MacAddress; |
| 28 | import org.onlab.packet.VlanId; |
| 29 | import org.onosproject.TestApplicationId; |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 30 | import org.onosproject.cluster.LeadershipEvent; |
| 31 | import org.onosproject.cluster.LeadershipEventListener; |
| 32 | import org.onosproject.cluster.LeadershipServiceAdapter; |
| 33 | import org.onosproject.cluster.NodeId; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 34 | import org.onosproject.core.ApplicationId; |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 35 | import org.onosproject.core.CoreServiceAdapter; |
Ray Milkey | facf286 | 2017-08-03 11:58:29 -0700 | [diff] [blame] | 36 | import org.onosproject.net.intf.Interface; |
| 37 | import org.onosproject.net.intf.InterfaceListener; |
| 38 | import org.onosproject.net.intf.InterfaceService; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 39 | import org.onosproject.net.ConnectPoint; |
| 40 | import org.onosproject.net.DefaultHost; |
| 41 | import org.onosproject.net.DeviceId; |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 42 | import org.onosproject.net.EncapsulationType; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 43 | import org.onosproject.net.Host; |
| 44 | import org.onosproject.net.HostId; |
| 45 | import org.onosproject.net.HostLocation; |
| 46 | import org.onosproject.net.PortNumber; |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 47 | import org.onosproject.net.config.Config; |
| 48 | import org.onosproject.net.config.ConfigApplyDelegate; |
| 49 | import org.onosproject.net.config.NetworkConfigEvent; |
| 50 | import org.onosproject.net.config.NetworkConfigListener; |
| 51 | import org.onosproject.net.config.NetworkConfigServiceAdapter; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 52 | import org.onosproject.net.host.HostEvent; |
| 53 | import org.onosproject.net.host.HostListener; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 54 | import org.onosproject.net.host.HostServiceAdapter; |
| 55 | import org.onosproject.net.intent.Intent; |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 56 | import org.onosproject.net.intent.IntentData; |
| 57 | import org.onosproject.net.intent.IntentEvent; |
| 58 | import org.onosproject.net.intent.IntentListener; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 59 | import org.onosproject.net.intent.IntentServiceAdapter; |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 60 | import org.onosproject.net.intent.IntentState; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 61 | import org.onosproject.net.provider.ProviderId; |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 62 | import org.onosproject.store.StoreDelegate; |
| 63 | import org.onosproject.store.service.WallClockTimestamp; |
| 64 | import org.onosproject.vpls.api.Vpls; |
| 65 | import org.onosproject.vpls.api.VplsData; |
| 66 | import org.onosproject.vpls.config.VplsAppConfig; |
| 67 | import org.onosproject.vpls.config.VplsAppConfigTest; |
| 68 | import org.onosproject.vpls.config.VplsConfig; |
| 69 | import org.onosproject.vpls.store.VplsStoreAdapter; |
| 70 | import org.onosproject.vpls.store.VplsStoreEvent; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 71 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 72 | import java.io.IOException; |
Luca Prete | 1346564 | 2017-01-04 10:31:48 -0800 | [diff] [blame] | 73 | import java.util.Collection; |
| 74 | import java.util.Collections; |
Luca Prete | 1346564 | 2017-01-04 10:31:48 -0800 | [diff] [blame] | 75 | import java.util.List; |
| 76 | import java.util.Map; |
| 77 | import java.util.Set; |
Luca Prete | 1346564 | 2017-01-04 10:31:48 -0800 | [diff] [blame] | 78 | import java.util.stream.Collectors; |
| 79 | |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 80 | /** |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 81 | * Class provides data for VPLS testing. |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 82 | */ |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 83 | public abstract class VplsTest { |
| 84 | protected static final String APP_NAME = "org.onosproject.vpls"; |
| 85 | protected static final ApplicationId APPID = TestApplicationId.create(APP_NAME); |
| 86 | protected static final String DASH = "-"; |
| 87 | protected static final int PRIORITY_OFFSET = 1000; |
| 88 | protected static final String VPLS1 = "vpls1"; |
| 89 | protected static final String VPLS2 = "vpls2"; |
| 90 | protected static final String VPLS3 = "vpls3"; |
| 91 | protected static final String VPLS4 = "vpls4"; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 92 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 93 | protected static final PortNumber P1 = PortNumber.portNumber(1); |
| 94 | protected static final PortNumber P2 = PortNumber.portNumber(2); |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 95 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 96 | protected static final DeviceId DID1 = getDeviceId(1); |
| 97 | protected static final DeviceId DID2 = getDeviceId(2); |
| 98 | protected static final DeviceId DID3 = getDeviceId(3); |
| 99 | protected static final DeviceId DID4 = getDeviceId(4); |
| 100 | protected static final DeviceId DID5 = getDeviceId(5); |
| 101 | protected static final DeviceId DID6 = getDeviceId(6); |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 102 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 103 | protected static final ConnectPoint CP1 = new ConnectPoint(DID1, P1); |
| 104 | protected static final ConnectPoint CP2 = new ConnectPoint(DID2, P1); |
| 105 | protected static final ConnectPoint CP3 = new ConnectPoint(DID3, P1); |
| 106 | protected static final ConnectPoint CP4 = new ConnectPoint(DID4, P1); |
| 107 | protected static final ConnectPoint CP5 = new ConnectPoint(DID5, P1); |
| 108 | protected static final ConnectPoint CP6 = new ConnectPoint(DID6, P1); |
| 109 | protected static final ConnectPoint CP7 = new ConnectPoint(DID4, P2); |
| 110 | protected static final ConnectPoint CP8 = new ConnectPoint(DID3, P2); |
| 111 | protected static final ConnectPoint CP9 = new ConnectPoint(DID5, P1); |
| 112 | protected static final ConnectPoint CP10 = new ConnectPoint(DID5, P2); |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 113 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 114 | protected static final VlanId VLAN100 = VlanId.vlanId((short) 100); |
| 115 | protected static final VlanId VLAN200 = VlanId.vlanId((short) 200); |
| 116 | protected static final VlanId VLAN300 = VlanId.vlanId((short) 300); |
| 117 | protected static final VlanId VLAN400 = VlanId.vlanId((short) 400); |
| 118 | protected static final VlanId VLAN_NONE = VlanId.NONE; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 119 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 120 | protected static final MacAddress MAC1 = getMac(1); |
| 121 | protected static final MacAddress MAC2 = getMac(2); |
| 122 | protected static final MacAddress MAC3 = getMac(3); |
| 123 | protected static final MacAddress MAC4 = getMac(4); |
| 124 | protected static final MacAddress MAC5 = getMac(5); |
| 125 | protected static final MacAddress MAC6 = getMac(6); |
| 126 | protected static final MacAddress MAC7 = getMac(7); |
| 127 | protected static final MacAddress MAC8 = getMac(8); |
| 128 | protected static final MacAddress MAC9 = getMac(9); |
| 129 | protected static final MacAddress MAC10 = getMac(10); |
| 130 | protected static final MacAddress MAC11 = getMac(11); |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 131 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 132 | protected static final Ip4Address IP1 = Ip4Address.valueOf("192.168.1.1"); |
| 133 | protected static final Ip4Address IP2 = Ip4Address.valueOf("192.168.1.2"); |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 134 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 135 | protected static final HostId HID1 = HostId.hostId(MAC1, VLAN100); |
| 136 | protected static final HostId HID2 = HostId.hostId(MAC2, VLAN100); |
| 137 | protected static final HostId HID3 = HostId.hostId(MAC3, VLAN200); |
| 138 | protected static final HostId HID4 = HostId.hostId(MAC4, VLAN200); |
| 139 | protected static final HostId HID5 = HostId.hostId(MAC5, VLAN300); |
| 140 | protected static final HostId HID6 = HostId.hostId(MAC6, VLAN300); |
| 141 | protected static final HostId HID7 = HostId.hostId(MAC7, VLAN300); |
| 142 | protected static final HostId HID8 = HostId.hostId(MAC8, VLAN400); |
| 143 | protected static final HostId HID9 = HostId.hostId(MAC9); |
| 144 | protected static final HostId HID10 = HostId.hostId(MAC10); |
| 145 | protected static final HostId HID11 = HostId.hostId(MAC11); |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 146 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 147 | protected static final ProviderId PID = new ProviderId("of", "foo"); |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 148 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 149 | protected static final NodeId NODE_ID_1 = new NodeId("Node1"); |
| 150 | protected static final NodeId NODE_ID_2 = new NodeId("Node2"); |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 151 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 152 | protected static final Interface V100H1 = |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 153 | new Interface("v100h1", CP1, null, null, VLAN100); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 154 | protected static final Interface V100H2 = |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 155 | new Interface("v100h2", CP2, null, null, VLAN100); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 156 | protected static final Interface V200H1 = |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 157 | new Interface("v200h1", CP3, null, null, VLAN200); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 158 | protected static final Interface V200H2 = |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 159 | new Interface("v200h2", CP4, null, null, VLAN200); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 160 | protected static final Interface V300H1 = |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 161 | new Interface("v300h1", CP5, null, null, VLAN300); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 162 | protected static final Interface V300H2 = |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 163 | new Interface("v300h2", CP6, null, null, VLAN300); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 164 | protected static final Interface V400H1 = |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 165 | new Interface("v400h1", CP7, null, null, VLAN400); |
| 166 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 167 | protected static final Interface VNONEH1 = |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 168 | new Interface("vNoneh1", CP8, null, null, VLAN_NONE); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 169 | protected static final Interface VNONEH2 = |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 170 | new Interface("vNoneh2", CP9, null, null, VLAN_NONE); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 171 | protected static final Interface VNONEH3 = |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 172 | new Interface("vNoneh3", CP10, null, null, VLAN_NONE); |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 173 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 174 | protected static final Host V100HOST1 = |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 175 | new DefaultHost(PID, HID1, MAC1, VLAN100, |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 176 | getLocation(1), Collections.singleton(IP1)); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 177 | protected static final Host V100HOST2 = |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 178 | new DefaultHost(PID, HID2, MAC2, VLAN100, |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 179 | getLocation(2), Sets.newHashSet()); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 180 | protected static final Host V200HOST1 = |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 181 | new DefaultHost(PID, HID3, MAC3, VLAN200, |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 182 | getLocation(3), Collections.singleton(IP2)); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 183 | protected static final Host V200HOST2 = |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 184 | new DefaultHost(PID, HID4, MAC4, VLAN200, |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 185 | getLocation(4), Sets.newHashSet()); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 186 | protected static final Host V300HOST1 = |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 187 | new DefaultHost(PID, HID5, MAC5, VLAN300, |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 188 | getLocation(5), Sets.newHashSet()); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 189 | protected static final Host V300HOST2 = |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 190 | new DefaultHost(PID, HID6, MAC6, VLAN300, |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 191 | getLocation(6), Sets.newHashSet()); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 192 | protected static final Host V300HOST3 = |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 193 | new DefaultHost(PID, HID7, MAC7, VLAN300, |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 194 | getLocation(7), Sets.newHashSet()); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 195 | protected static final Host V400HOST1 = |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 196 | new DefaultHost(PID, HID8, MAC8, VLAN400, |
| 197 | getLocation(4, 2), Sets.newHashSet()); |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 198 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 199 | protected static final Host VNONEHOST1 = |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 200 | new DefaultHost(PID, HID9, MAC9, VlanId.NONE, |
| 201 | getLocation(3, 2), Sets.newHashSet()); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 202 | protected static final Host VNONEHOST2 = |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 203 | new DefaultHost(PID, HID10, MAC10, VlanId.NONE, |
| 204 | getLocation(5, 1), Sets.newHashSet()); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 205 | protected static final Host VNONEHOST3 = |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 206 | new DefaultHost(PID, HID11, MAC11, VlanId.NONE, |
| 207 | getLocation(5, 2), Sets.newHashSet()); |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 208 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 209 | protected static final Set<Interface> AVAILABLE_INTERFACES = |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 210 | ImmutableSet.of(V100H1, V100H2, V200H1, V200H2, V300H1, V300H2, |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 211 | V400H1, VNONEH1, VNONEH2, VNONEH3); |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 212 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 213 | protected static final Set<Host> AVAILABLE_HOSTS = |
Luca Prete | 092e895 | 2016-10-26 16:25:56 +0200 | [diff] [blame] | 214 | ImmutableSet.of(V100HOST1, V100HOST2, V200HOST1, |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 215 | V200HOST2, V300HOST1, V300HOST2, V300HOST3, |
| 216 | VNONEHOST1, VNONEHOST2, |
| 217 | V400HOST1, VNONEHOST3); |
| 218 | |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 219 | |
| 220 | /** |
| 221 | * Returns the device Id of the ith device. |
| 222 | * |
| 223 | * @param i the device to get the Id of |
| 224 | * @return the device Id |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 225 | */ |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 226 | protected static DeviceId getDeviceId(int i) { |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 227 | return DeviceId.deviceId("" + i); |
| 228 | } |
| 229 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 230 | /** |
| 231 | * Generates a mac address by given number. |
| 232 | * |
| 233 | * @param n the number to generate mac address |
| 234 | * @return the mac address |
| 235 | */ |
| 236 | protected static MacAddress getMac(int n) { |
Dominika Molenda | 52cc3a9 | 2017-06-19 17:08:35 +0200 | [diff] [blame] | 237 | return MacAddress.valueOf(String.format("00:00:00:00:00:%02x", n)); |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 238 | } |
| 239 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 240 | /** |
| 241 | * Generates a host location by given device number. |
| 242 | * |
| 243 | * @param i the given number |
| 244 | * @return the host location |
| 245 | */ |
| 246 | protected static HostLocation getLocation(int i) { |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 247 | return new HostLocation(new ConnectPoint(getDeviceId(i), P1), 123L); |
| 248 | } |
| 249 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 250 | /** |
| 251 | * Generates host location by given device number and port number. |
| 252 | * |
| 253 | * @param d the device number |
| 254 | * @param p the port number |
| 255 | * @return the host location |
| 256 | */ |
| 257 | protected static HostLocation getLocation(int d, int p) { |
Carolina Fernandez | b1cef5c | 2016-11-22 19:18:40 +0100 | [diff] [blame] | 258 | return new HostLocation(new ConnectPoint(getDeviceId(d), |
| 259 | PortNumber.portNumber(p)), 123L); |
| 260 | } |
| 261 | |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 262 | /** |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 263 | * Test core service; For generate test application ID. |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 264 | */ |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 265 | public class TestCoreService extends CoreServiceAdapter { |
| 266 | @Override |
| 267 | public ApplicationId registerApplication(String name) { |
| 268 | return TestApplicationId.create(name); |
| 269 | } |
| 270 | } |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 271 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 272 | /** |
| 273 | * Test intent service. |
| 274 | * Always install or withdraw success for any Intents. |
| 275 | */ |
| 276 | public class TestIntentService extends IntentServiceAdapter { |
| 277 | IntentListener listener; |
| 278 | List<IntentData> intents; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 279 | |
| 280 | public TestIntentService() { |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 281 | intents = Lists.newArrayList(); |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 282 | } |
| 283 | |
| 284 | @Override |
| 285 | public void submit(Intent intent) { |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 286 | intents.add(new IntentData(intent, IntentState.INSTALLED, new WallClockTimestamp())); |
| 287 | if (listener != null) { |
| 288 | IntentEvent.getEvent(IntentState.INSTALLED, intent).ifPresent(listener::event); |
| 289 | |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | @Override |
| 294 | public void withdraw(Intent intent) { |
| 295 | intents.forEach(intentData -> { |
| 296 | if (intentData.intent().key().equals(intent.key())) { |
| 297 | intentData.setState(IntentState.WITHDRAWN); |
| 298 | |
| 299 | if (listener != null) { |
| 300 | IntentEvent.getEvent(IntentState.WITHDRAWN, intent).ifPresent(listener::event); |
| 301 | } |
| 302 | } |
| 303 | }); |
| 304 | } |
| 305 | |
| 306 | @Override |
| 307 | public Iterable<Intent> getIntents() { |
| 308 | return intents.stream() |
| 309 | .map(IntentData::intent) |
| 310 | .collect(Collectors.toList()); |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | @Override |
| 314 | public long getIntentCount() { |
| 315 | return intents.size(); |
| 316 | } |
| 317 | |
| 318 | @Override |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 319 | public void addListener(IntentListener listener) { |
| 320 | this.listener = listener; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | @Override |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 324 | public void removeListener(IntentListener listener) { |
| 325 | this.listener = null; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 326 | } |
| 327 | } |
| 328 | |
| 329 | /** |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 330 | * Test leadership service. |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 331 | */ |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 332 | public class TestLeadershipService extends LeadershipServiceAdapter { |
| 333 | LeadershipEventListener listener; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 334 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 335 | @Override |
| 336 | public void addListener(LeadershipEventListener listener) { |
| 337 | this.listener = listener; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 338 | } |
| 339 | |
| 340 | @Override |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 341 | public void removeListener(LeadershipEventListener listener) { |
| 342 | this.listener = null; |
| 343 | } |
| 344 | |
| 345 | /** |
| 346 | * Sends the leadership event to the listener. |
| 347 | * |
| 348 | * @param event the Intent event |
| 349 | */ |
| 350 | public void sendEvent(LeadershipEvent event) { |
| 351 | if (listener != null && listener.isRelevant(event)) { |
| 352 | listener.event(event); |
| 353 | } |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 354 | } |
| 355 | |
| 356 | @Override |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 357 | public NodeId getLeader(String path) { |
| 358 | return NODE_ID_1; |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | /** |
| 363 | * Test interface service; contains all interfaces which already generated. |
| 364 | */ |
| 365 | public class TestInterfaceService implements InterfaceService { |
| 366 | |
| 367 | @Override |
| 368 | public void addListener(InterfaceListener listener) { |
| 369 | } |
| 370 | |
| 371 | @Override |
| 372 | public void removeListener(InterfaceListener listener) { |
| 373 | } |
| 374 | |
| 375 | @Override |
| 376 | public Set<Interface> getInterfaces() { |
| 377 | return AVAILABLE_INTERFACES; |
| 378 | } |
| 379 | |
| 380 | @Override |
| 381 | public Interface getInterfaceByName(ConnectPoint connectPoint, |
| 382 | String name) { |
| 383 | return AVAILABLE_INTERFACES.stream() |
| 384 | .filter(intf -> intf.name().equals(name)) |
| 385 | .findFirst() |
| 386 | .orElse(null); |
| 387 | } |
| 388 | |
| 389 | @Override |
| 390 | public Set<Interface> getInterfacesByPort(ConnectPoint port) { |
| 391 | return AVAILABLE_INTERFACES.stream() |
| 392 | .filter(intf -> intf.connectPoint().equals(port)) |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 393 | .collect(Collectors.toSet()); |
| 394 | } |
| 395 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 396 | @Override |
| 397 | public Set<Interface> getInterfacesByIp(IpAddress ip) { |
| 398 | return AVAILABLE_INTERFACES.stream() |
| 399 | .filter(intf -> intf.ipAddressesList().contains(ip)) |
| 400 | .collect(Collectors.toSet()); |
| 401 | } |
| 402 | |
| 403 | @Override |
| 404 | public Set<Interface> getInterfacesByVlan(VlanId vlan) { |
| 405 | return AVAILABLE_INTERFACES.stream() |
| 406 | .filter(intf -> intf.vlan().equals(vlan)) |
| 407 | .collect(Collectors.toSet()); |
| 408 | } |
| 409 | |
| 410 | @Override |
| 411 | public Interface getMatchingInterface(IpAddress ip) { |
| 412 | return AVAILABLE_INTERFACES.stream() |
| 413 | .filter(intf -> intf.ipAddressesList().contains(ip)) |
| 414 | .findFirst() |
| 415 | .orElse(null); |
| 416 | } |
| 417 | |
| 418 | @Override |
| 419 | public Set<Interface> getMatchingInterfaces(IpAddress ip) { |
| 420 | return AVAILABLE_INTERFACES.stream() |
| 421 | .filter(intf -> intf.ipAddressesList().contains(ip)) |
| 422 | .collect(Collectors.toSet()); |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | /** |
| 427 | * Test VPLS store. |
| 428 | */ |
| 429 | public class TestVplsStore extends VplsStoreAdapter { |
| 430 | /** |
| 431 | * Clears the store. |
| 432 | */ |
| 433 | public void clear() { |
| 434 | vplsDataMap.clear(); |
| 435 | } |
| 436 | |
| 437 | /** |
| 438 | * Gets the store delegate. |
| 439 | * |
| 440 | * @return the store delegate |
| 441 | */ |
| 442 | public StoreDelegate<VplsStoreEvent> delegate() { |
| 443 | return this.delegate; |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | /** |
| 448 | * Test VPLS. |
| 449 | * Provides basic VPLS functionality and stores VPLS information. |
| 450 | */ |
| 451 | public class TestVpls implements Vpls { |
| 452 | public Map<String, VplsData> testData; |
| 453 | |
| 454 | public TestVpls() { |
| 455 | testData = Maps.newHashMap(); |
| 456 | } |
| 457 | |
| 458 | public void initSampleData() { |
| 459 | testData.clear(); |
| 460 | VplsData vplsData = VplsData.of(VPLS1); |
| 461 | vplsData.addInterfaces(ImmutableSet.of(V100H1, V100H2)); |
| 462 | vplsData.state(VplsData.VplsState.ADDED); |
| 463 | testData.put(VPLS1, vplsData); |
| 464 | |
| 465 | vplsData = VplsData.of(VPLS2); |
| 466 | vplsData.addInterfaces(ImmutableSet.of(V200H1, V200H2)); |
| 467 | vplsData.state(VplsData.VplsState.ADDED); |
| 468 | testData.put(VPLS2, vplsData); |
| 469 | } |
| 470 | |
| 471 | @Override |
| 472 | public VplsData createVpls(String vplsName, EncapsulationType encapsulationType) { |
| 473 | VplsData vplsData = VplsData.of(vplsName, encapsulationType); |
Yi Tseng | 3069c61 | 2017-05-26 17:09:43 -0700 | [diff] [blame] | 474 | vplsData.state(VplsData.VplsState.ADDED); |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 475 | testData.put(vplsName, vplsData); |
| 476 | return vplsData; |
| 477 | } |
| 478 | |
| 479 | @Override |
| 480 | public VplsData removeVpls(VplsData vplsData) { |
| 481 | if (!testData.containsKey(vplsData.name())) { |
| 482 | return null; |
| 483 | } |
| 484 | |
| 485 | testData.remove(vplsData.name()); |
| 486 | return vplsData; |
| 487 | } |
| 488 | |
| 489 | @Override |
| 490 | public void addInterfaces(VplsData vplsData, Collection<Interface> interfaces) { |
| 491 | vplsData.addInterfaces(interfaces); |
| 492 | testData.put(vplsData.name(), vplsData); |
| 493 | } |
| 494 | |
| 495 | @Override |
| 496 | public void addInterface(VplsData vplsData, Interface iface) { |
| 497 | vplsData.addInterface(iface); |
| 498 | testData.put(vplsData.name(), vplsData); |
| 499 | } |
| 500 | |
| 501 | @Override |
| 502 | public void setEncapsulationType(VplsData vplsData, EncapsulationType encapsulationType) { |
| 503 | vplsData.encapsulationType(encapsulationType); |
| 504 | testData.put(vplsData.name(), vplsData); |
| 505 | } |
| 506 | |
| 507 | @Override |
| 508 | public VplsData getVpls(String vplsName) { |
| 509 | return testData.get(vplsName); |
| 510 | } |
| 511 | |
| 512 | @Override |
| 513 | public Collection<VplsData> getAllVpls() { |
| 514 | return testData.values(); |
| 515 | } |
| 516 | |
| 517 | @Override |
| 518 | public Collection<Interface> removeInterfaces(VplsData vplsData, Collection<Interface> interfaces) { |
| 519 | vplsData.removeInterfaces(interfaces); |
| 520 | testData.put(vplsData.name(), vplsData); |
| 521 | return interfaces; |
| 522 | } |
| 523 | |
| 524 | @Override |
| 525 | public Interface removeInterface(VplsData vplsData, Interface iface) { |
| 526 | vplsData.removeInterface(iface); |
| 527 | testData.put(vplsData.name(), vplsData); |
| 528 | return iface; |
| 529 | } |
| 530 | |
| 531 | @Override |
| 532 | public void removeAllVpls() { |
| 533 | testData.clear(); |
| 534 | } |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 535 | } |
| 536 | |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 537 | /** |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 538 | * Test host service; contains all hosts which already generated. |
| 539 | * |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 540 | */ |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 541 | public class TestHostService extends HostServiceAdapter { |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 542 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 543 | private HostListener listener; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 544 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 545 | @Override |
| 546 | public Set<Host> getConnectedHosts(ConnectPoint connectPoint) { |
| 547 | return AVAILABLE_HOSTS.stream() |
| 548 | .filter(host -> host.location().equals(connectPoint)) |
| 549 | .collect(Collectors.toSet()); |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 550 | } |
| 551 | |
| 552 | @Override |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 553 | public Set<Host> getHostsByMac(MacAddress mac) { |
| 554 | return AVAILABLE_HOSTS.stream() |
| 555 | .filter(host -> host.mac().equals(mac)) |
| 556 | .collect(Collectors.toSet()); |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 557 | } |
| 558 | |
| 559 | @Override |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 560 | public Iterable<Host> getHosts() { |
| 561 | return AVAILABLE_HOSTS; |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 562 | } |
| 563 | |
| 564 | @Override |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 565 | public Set<Host> getHostsByVlan(VlanId vlanId) { |
| 566 | return AVAILABLE_HOSTS.stream() |
| 567 | .filter(host -> host.vlan().equals(vlanId)) |
| 568 | .collect(Collectors.toSet()); |
| 569 | } |
| 570 | |
| 571 | @Override |
| 572 | public int getHostCount() { |
| 573 | return AVAILABLE_HOSTS.size(); |
| 574 | } |
| 575 | |
| 576 | @Override |
| 577 | public Host getHost(HostId hostId) { |
| 578 | return AVAILABLE_HOSTS.stream() |
| 579 | .filter(host -> host.id().equals(hostId)) |
| 580 | .findFirst() |
| 581 | .orElse(null); |
| 582 | } |
| 583 | |
| 584 | @Override |
| 585 | public void addListener(HostListener listener) { |
| 586 | this.listener = listener; |
| 587 | } |
| 588 | |
| 589 | public void postHostEvent(HostEvent hostEvent) { |
| 590 | this.listener.event(hostEvent); |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 591 | } |
| 592 | } |
| 593 | |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 594 | /** |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 595 | * Test network configuration service. |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 596 | */ |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 597 | public class TestConfigService extends NetworkConfigServiceAdapter { |
| 598 | public static final String EMPTY_JSON_TREE = "{}"; |
| 599 | NetworkConfigListener listener; |
| 600 | VplsAppConfig vplsAppConfig; |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 601 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 602 | @Override |
| 603 | public void addListener(NetworkConfigListener listener) { |
| 604 | this.listener = listener; |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 605 | } |
| 606 | |
| 607 | @Override |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 608 | public void removeListener(NetworkConfigListener listener) { |
| 609 | this.listener = null; |
| 610 | } |
| 611 | |
| 612 | /** |
| 613 | * Sends network config event to listener. |
| 614 | * |
| 615 | * @param event the network config event |
| 616 | */ |
| 617 | public void sendEvent(NetworkConfigEvent event) { |
| 618 | if (listener != null) { |
| 619 | listener.event(event); |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 620 | } |
| 621 | } |
| 622 | |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 623 | /** |
| 624 | * Constructs test config service. |
| 625 | * Generates an VPLS configuration with sample VPLS configs. |
| 626 | */ |
| 627 | public TestConfigService() { |
| 628 | vplsAppConfig = new VplsAppConfig(); |
| 629 | final ObjectMapper mapper = new ObjectMapper(); |
| 630 | final ConfigApplyDelegate delegate = new VplsAppConfigTest.MockCfgDelegate(); |
| 631 | JsonNode tree = null; |
| 632 | try { |
| 633 | tree = new ObjectMapper().readTree(EMPTY_JSON_TREE); |
| 634 | } catch (IOException e) { |
| 635 | e.printStackTrace(); |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 636 | } |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 637 | vplsAppConfig.init(APPID, APP_NAME, tree, mapper, delegate); |
| 638 | VplsConfig vplsConfig = new VplsConfig(VPLS1, |
| 639 | ImmutableSet.of(V100H1.name(), V100H2.name()), |
| 640 | EncapsulationType.NONE); |
| 641 | vplsAppConfig.addVpls(vplsConfig); |
| 642 | vplsConfig = new VplsConfig(VPLS2, |
| 643 | ImmutableSet.of(V200H1.name(), V200H2.name()), |
| 644 | EncapsulationType.VLAN); |
| 645 | vplsAppConfig.addVpls(vplsConfig); |
| 646 | |
| 647 | } |
| 648 | |
| 649 | /** |
| 650 | * Overrides VPLS config to the config service. |
| 651 | * |
| 652 | * @param vplsAppConfig the new VPLS config |
| 653 | */ |
| 654 | public void setConfig(VplsAppConfig vplsAppConfig) { |
| 655 | this.vplsAppConfig = vplsAppConfig; |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 656 | } |
| 657 | |
| 658 | @Override |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 659 | public <S, C extends Config<S>> C getConfig(S subject, Class<C> configClass) { |
| 660 | return (C) vplsAppConfig; |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 661 | } |
| 662 | |
| 663 | @Override |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 664 | public <S, C extends Config<S>> C addConfig(S subject, Class<C> configClass) { |
| 665 | return (C) vplsAppConfig; |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 666 | } |
nosignal | 5fd282e | 2016-09-16 16:11:40 -0700 | [diff] [blame] | 667 | } |
Yi Tseng | f4e13e3 | 2017-03-30 15:38:39 -0700 | [diff] [blame] | 668 | |
Luca Prete | 9c2ee07 | 2016-02-16 11:00:44 -0800 | [diff] [blame] | 669 | } |