Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Laboratory |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.intent; |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 17 | |
Pier Ventre | 647138f | 2016-08-26 17:32:44 -0700 | [diff] [blame] | 18 | import java.util.Map; |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 19 | import java.util.Set; |
| 20 | |
Pier Ventre | 647138f | 2016-08-26 17:32:44 -0700 | [diff] [blame] | 21 | import com.google.common.collect.Maps; |
| 22 | import org.onlab.packet.VlanId; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 23 | import org.onosproject.core.ApplicationId; |
| 24 | import org.onosproject.TestApplicationId; |
| 25 | import org.onosproject.net.ConnectPoint; |
| 26 | import org.onosproject.net.DeviceId; |
Yi Tseng | 2a81c9d | 2016-09-14 10:14:24 -0700 | [diff] [blame] | 27 | import org.onosproject.net.FilteredConnectPoint; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 28 | import org.onosproject.net.PortNumber; |
Luca Prete | 670ac5d | 2017-02-03 15:55:43 -0800 | [diff] [blame] | 29 | import org.onosproject.net.ResourceGroup; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 30 | import org.onosproject.net.flow.DefaultTrafficSelector; |
| 31 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
| 32 | import org.onosproject.net.flow.TrafficSelector; |
| 33 | import org.onosproject.net.flow.TrafficTreatment; |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 34 | |
| 35 | /** |
| 36 | * Base facilities to test various connectivity tests. |
| 37 | */ |
| 38 | public abstract class ConnectivityIntentTest extends IntentTest { |
| 39 | |
Thomas Vachuska | c96058a | 2014-10-20 23:00:16 -0700 | [diff] [blame] | 40 | public static final ApplicationId APPID = new TestApplicationId("foo"); |
ilhem fajjari | b0a0684 | 2015-11-02 18:59:02 +0100 | [diff] [blame] | 41 | public static final Key KEY = Key.of(1L, APPID); |
Thomas Vachuska | c96058a | 2014-10-20 23:00:16 -0700 | [diff] [blame] | 42 | |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 43 | public static final IntentId IID = new IntentId(123); |
Brian O'Connor | 6b52813 | 2015-03-10 16:39:52 -0700 | [diff] [blame] | 44 | public static final TrafficSelector MATCH = DefaultTrafficSelector.emptySelector(); |
| 45 | public static final TrafficTreatment NOP = DefaultTrafficTreatment.emptyTreatment(); |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 46 | |
| 47 | public static final ConnectPoint P1 = new ConnectPoint(DeviceId.deviceId("111"), PortNumber.portNumber(0x1)); |
| 48 | public static final ConnectPoint P2 = new ConnectPoint(DeviceId.deviceId("222"), PortNumber.portNumber(0x2)); |
| 49 | public static final ConnectPoint P3 = new ConnectPoint(DeviceId.deviceId("333"), PortNumber.portNumber(0x3)); |
| 50 | |
| 51 | public static final Set<ConnectPoint> PS1 = itemSet(new ConnectPoint[]{P1, P3}); |
| 52 | public static final Set<ConnectPoint> PS2 = itemSet(new ConnectPoint[]{P2, P3}); |
Pier Ventre | 647138f | 2016-08-26 17:32:44 -0700 | [diff] [blame] | 53 | |
Yi Tseng | 2a81c9d | 2016-09-14 10:14:24 -0700 | [diff] [blame] | 54 | |
Pier Ventre | 647138f | 2016-08-26 17:32:44 -0700 | [diff] [blame] | 55 | public static final TrafficSelector VLANMATCH1 = DefaultTrafficSelector.builder() |
| 56 | .matchVlanId(VlanId.vlanId("2")) |
| 57 | .build(); |
| 58 | public static final TrafficSelector VLANMATCH2 = DefaultTrafficSelector.builder() |
| 59 | .matchVlanId(VlanId.vlanId("3")) |
| 60 | .build(); |
| 61 | |
Yi Tseng | 2a81c9d | 2016-09-14 10:14:24 -0700 | [diff] [blame] | 62 | public static final FilteredConnectPoint FP1 = new FilteredConnectPoint(P1, VLANMATCH1); |
| 63 | public static final FilteredConnectPoint FP2 = new FilteredConnectPoint(P2, VLANMATCH1); |
| 64 | public static final FilteredConnectPoint FP3 = new FilteredConnectPoint(P3, VLANMATCH2); |
| 65 | |
| 66 | public static final Set<FilteredConnectPoint> FPS1 = itemSet(new FilteredConnectPoint[]{FP1, FP3}); |
| 67 | public static final Set<FilteredConnectPoint> FPS2 = itemSet(new FilteredConnectPoint[]{FP2, FP3}); |
| 68 | |
Luca Prete | 670ac5d | 2017-02-03 15:55:43 -0800 | [diff] [blame] | 69 | public static final ResourceGroup RESOURCE_GROUP = ResourceGroup.of(0L); |
| 70 | |
Pier Ventre | 647138f | 2016-08-26 17:32:44 -0700 | [diff] [blame] | 71 | public static final Map<ConnectPoint, TrafficSelector> VLANMATCHES = Maps.newHashMap(); |
| 72 | static { |
| 73 | VLANMATCHES.put(P1, VLANMATCH1); |
| 74 | VLANMATCHES.put(P2, VLANMATCH2); |
| 75 | } |
| 76 | |
Pier Ventre | 27d4257 | 2016-08-29 17:37:08 -0700 | [diff] [blame] | 77 | public static final TrafficTreatment VLANACTION1 = DefaultTrafficTreatment.builder() |
| 78 | .setVlanId(VlanId.vlanId("2")) |
| 79 | .build(); |
| 80 | public static final TrafficTreatment VLANACTION2 = DefaultTrafficTreatment.builder() |
| 81 | .setVlanId(VlanId.vlanId("3")) |
| 82 | .build(); |
| 83 | |
| 84 | public static final Map<ConnectPoint, TrafficTreatment> VLANACTIONS = Maps.newHashMap(); |
| 85 | static { |
| 86 | VLANACTIONS.put(P1, VLANACTION1); |
| 87 | VLANACTIONS.put(P2, VLANACTION2); |
| 88 | } |
| 89 | |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 90 | } |