blob: 02ca0f5d1062492b9d2f3398d167d8a9473fc2ec [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 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 */
Brian O'Connorf3d06162014-10-02 15:54:12 -070016package org.onlab.onos.net.intent;
17
Brian O'Connorf3d06162014-10-02 15:54:12 -070018import org.junit.Test;
19import org.onlab.onos.net.NetTestTools;
20import org.onlab.onos.net.Path;
Ray Milkeycaa450b2014-10-29 15:54:24 -070021import org.onlab.onos.net.resource.LinkResourceRequest;
22
23import static org.junit.Assert.assertEquals;
Brian O'Connorf3d06162014-10-02 15:54:12 -070024
25public class PathIntentTest extends ConnectivityIntentTest {
26 // 111:11 --> 222:22
27 private static final Path PATH1 = NetTestTools.createPath("111", "222");
28
29 // 111:11 --> 333:33
30 private static final Path PATH2 = NetTestTools.createPath("222", "333");
31
32 @Test
33 public void basics() {
34 PathIntent intent = createOne();
Thomas Vachuskac96058a2014-10-20 23:00:16 -070035 assertEquals("incorrect id", APPID, intent.appId());
tom85258ee2014-10-07 00:10:02 -070036 assertEquals("incorrect match", MATCH, intent.selector());
37 assertEquals("incorrect action", NOP, intent.treatment());
tom85258ee2014-10-07 00:10:02 -070038 assertEquals("incorrect path", PATH1, intent.path());
Brian O'Connorf3d06162014-10-02 15:54:12 -070039 }
40
41 @Override
42 protected PathIntent createOne() {
Ray Milkeycaa450b2014-10-29 15:54:24 -070043 return new PathIntent(APPID, MATCH, NOP, PATH1, new LinkResourceRequest[0]);
Brian O'Connorf3d06162014-10-02 15:54:12 -070044 }
45
46 @Override
47 protected PathIntent createAnother() {
Ray Milkeycaa450b2014-10-29 15:54:24 -070048 return new PathIntent(APPID, MATCH, NOP, PATH2, new LinkResourceRequest[0]);
Brian O'Connorf3d06162014-10-02 15:54:12 -070049 }
50}