blob: bab715fc347bc260cbc71ff72fee0923e626cdb6 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2014-present Open Networking Laboratory
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07003 *
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'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.intent;
Brian O'Connorf3d06162014-10-02 15:54:12 -070017
Pier Ventre647138f2016-08-26 17:32:44 -070018import java.util.Map;
Brian O'Connorf3d06162014-10-02 15:54:12 -070019import java.util.Set;
20
Pier Ventre647138f2016-08-26 17:32:44 -070021import com.google.common.collect.Maps;
22import org.onlab.packet.VlanId;
Brian O'Connorabafb502014-12-02 22:26:20 -080023import org.onosproject.core.ApplicationId;
24import org.onosproject.TestApplicationId;
25import org.onosproject.net.ConnectPoint;
26import org.onosproject.net.DeviceId;
Yi Tseng2a81c9d2016-09-14 10:14:24 -070027import org.onosproject.net.FilteredConnectPoint;
Brian O'Connorabafb502014-12-02 22:26:20 -080028import org.onosproject.net.PortNumber;
29import org.onosproject.net.flow.DefaultTrafficSelector;
30import org.onosproject.net.flow.DefaultTrafficTreatment;
31import org.onosproject.net.flow.TrafficSelector;
32import org.onosproject.net.flow.TrafficTreatment;
Brian O'Connorf3d06162014-10-02 15:54:12 -070033
34/**
35 * Base facilities to test various connectivity tests.
36 */
37public abstract class ConnectivityIntentTest extends IntentTest {
38
Thomas Vachuskac96058a2014-10-20 23:00:16 -070039 public static final ApplicationId APPID = new TestApplicationId("foo");
ilhem fajjarib0a06842015-11-02 18:59:02 +010040 public static final Key KEY = Key.of(1L, APPID);
Thomas Vachuskac96058a2014-10-20 23:00:16 -070041
Brian O'Connorf3d06162014-10-02 15:54:12 -070042 public static final IntentId IID = new IntentId(123);
Brian O'Connor6b528132015-03-10 16:39:52 -070043 public static final TrafficSelector MATCH = DefaultTrafficSelector.emptySelector();
44 public static final TrafficTreatment NOP = DefaultTrafficTreatment.emptyTreatment();
Brian O'Connorf3d06162014-10-02 15:54:12 -070045
46 public static final ConnectPoint P1 = new ConnectPoint(DeviceId.deviceId("111"), PortNumber.portNumber(0x1));
47 public static final ConnectPoint P2 = new ConnectPoint(DeviceId.deviceId("222"), PortNumber.portNumber(0x2));
48 public static final ConnectPoint P3 = new ConnectPoint(DeviceId.deviceId("333"), PortNumber.portNumber(0x3));
49
50 public static final Set<ConnectPoint> PS1 = itemSet(new ConnectPoint[]{P1, P3});
51 public static final Set<ConnectPoint> PS2 = itemSet(new ConnectPoint[]{P2, P3});
Pier Ventre647138f2016-08-26 17:32:44 -070052
Yi Tseng2a81c9d2016-09-14 10:14:24 -070053
Pier Ventre647138f2016-08-26 17:32:44 -070054 public static final TrafficSelector VLANMATCH1 = DefaultTrafficSelector.builder()
55 .matchVlanId(VlanId.vlanId("2"))
56 .build();
57 public static final TrafficSelector VLANMATCH2 = DefaultTrafficSelector.builder()
58 .matchVlanId(VlanId.vlanId("3"))
59 .build();
60
Yi Tseng2a81c9d2016-09-14 10:14:24 -070061 public static final FilteredConnectPoint FP1 = new FilteredConnectPoint(P1, VLANMATCH1);
62 public static final FilteredConnectPoint FP2 = new FilteredConnectPoint(P2, VLANMATCH1);
63 public static final FilteredConnectPoint FP3 = new FilteredConnectPoint(P3, VLANMATCH2);
64
65 public static final Set<FilteredConnectPoint> FPS1 = itemSet(new FilteredConnectPoint[]{FP1, FP3});
66 public static final Set<FilteredConnectPoint> FPS2 = itemSet(new FilteredConnectPoint[]{FP2, FP3});
67
Pier Ventre647138f2016-08-26 17:32:44 -070068 public static final Map<ConnectPoint, TrafficSelector> VLANMATCHES = Maps.newHashMap();
69 static {
70 VLANMATCHES.put(P1, VLANMATCH1);
71 VLANMATCHES.put(P2, VLANMATCH2);
72 }
73
Pier Ventre27d42572016-08-29 17:37:08 -070074 public static final TrafficTreatment VLANACTION1 = DefaultTrafficTreatment.builder()
75 .setVlanId(VlanId.vlanId("2"))
76 .build();
77 public static final TrafficTreatment VLANACTION2 = DefaultTrafficTreatment.builder()
78 .setVlanId(VlanId.vlanId("3"))
79 .build();
80
81 public static final Map<ConnectPoint, TrafficTreatment> VLANACTIONS = Maps.newHashMap();
82 static {
83 VLANACTIONS.put(P1, VLANACTION1);
84 VLANACTIONS.put(P2, VLANACTION2);
85 }
86
Brian O'Connorf3d06162014-10-02 15:54:12 -070087}