Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
| 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'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 16 | package org.onlab.onos.net.intent; |
| 17 | |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 18 | import org.junit.Test; |
| 19 | import org.onlab.onos.net.NetTestTools; |
| 20 | import org.onlab.onos.net.Path; |
Ray Milkey | caa450b | 2014-10-29 15:54:24 -0700 | [diff] [blame] | 21 | |
| 22 | import static org.junit.Assert.assertEquals; |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 23 | |
| 24 | public class PathIntentTest extends ConnectivityIntentTest { |
| 25 | // 111:11 --> 222:22 |
| 26 | private static final Path PATH1 = NetTestTools.createPath("111", "222"); |
| 27 | |
| 28 | // 111:11 --> 333:33 |
| 29 | private static final Path PATH2 = NetTestTools.createPath("222", "333"); |
| 30 | |
| 31 | @Test |
| 32 | public void basics() { |
| 33 | PathIntent intent = createOne(); |
Thomas Vachuska | c96058a | 2014-10-20 23:00:16 -0700 | [diff] [blame] | 34 | assertEquals("incorrect id", APPID, intent.appId()); |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 35 | assertEquals("incorrect match", MATCH, intent.selector()); |
| 36 | assertEquals("incorrect action", NOP, intent.treatment()); |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 37 | assertEquals("incorrect path", PATH1, intent.path()); |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | @Override |
| 41 | protected PathIntent createOne() { |
Thomas Vachuska | edc944c | 2014-11-04 15:42:25 -0800 | [diff] [blame] | 42 | return new PathIntent(APPID, MATCH, NOP, PATH1); |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | @Override |
| 46 | protected PathIntent createAnother() { |
Thomas Vachuska | edc944c | 2014-11-04 15:42:25 -0800 | [diff] [blame] | 47 | return new PathIntent(APPID, MATCH, NOP, PATH2); |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 48 | } |
| 49 | } |