blob: 0b8a71c7ad37adc4dda4ad5bbea0817c9b9dca18 [file] [log] [blame]
Yi Tseng0b809722017-11-03 10:23:26 -07001/*
2 * Copyright 2017-present Open Networking Foundation
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 */
16
17package org.onosproject.pipelines.fabric.pipeliner;
18
Carmelo Cascone41644362018-08-09 16:56:43 -070019import org.junit.Test;
Yi Tseng0b809722017-11-03 10:23:26 -070020import org.onlab.packet.IpPrefix;
21import org.onlab.packet.MacAddress;
22import org.onlab.packet.MplsLabel;
23import org.onlab.packet.VlanId;
24import org.onosproject.TestApplicationId;
25import org.onosproject.core.ApplicationId;
26import org.onosproject.net.DeviceId;
27import org.onosproject.net.PortNumber;
Yi Tseng20f9e7b2018-05-24 23:27:39 +080028import org.onosproject.net.flow.DefaultTrafficSelector;
29import org.onosproject.net.flow.TrafficSelector;
Yi Tseng0b809722017-11-03 10:23:26 -070030import org.onosproject.net.flow.criteria.PiCriterion;
Carmelo Casconeb5324e72018-11-25 02:26:32 -080031import org.onosproject.pipelines.fabric.FabricCapabilities;
Yi Tseng0b809722017-11-03 10:23:26 -070032import org.onosproject.pipelines.fabric.FabricConstants;
33
34import static org.easymock.EasyMock.createNiceMock;
35import static org.easymock.EasyMock.expect;
36import static org.easymock.EasyMock.replay;
37
Carmelo Cascone41644362018-08-09 16:56:43 -070038public class FabricPipelinerTest {
Yi Tseng0b809722017-11-03 10:23:26 -070039 static final ApplicationId APP_ID = TestApplicationId.create("FabricPipelinerTest");
Carmelo Cascone45cc0862018-11-26 11:50:41 -080040 static final ApplicationId XCONNECT_APP_ID = TestApplicationId.create("FabricPipelinerTest.xconnect");
Yi Tseng0b809722017-11-03 10:23:26 -070041 static final DeviceId DEVICE_ID = DeviceId.deviceId("device:bmv2:11");
42 static final int PRIORITY = 100;
43 static final PortNumber PORT_1 = PortNumber.portNumber(1);
Yi Tseng1b154bd2017-11-20 17:48:19 -080044 static final PortNumber PORT_2 = PortNumber.portNumber(2);
Yi Tseng0b809722017-11-03 10:23:26 -070045 static final VlanId VLAN_100 = VlanId.vlanId("100");
46 static final MacAddress HOST_MAC = MacAddress.valueOf("00:00:00:00:00:01");
47 static final MacAddress ROUTER_MAC = MacAddress.valueOf("00:00:00:00:02:01");
48 static final IpPrefix IPV4_UNICAST_ADDR = IpPrefix.valueOf("10.0.0.1/32");
49 static final IpPrefix IPV4_MCAST_ADDR = IpPrefix.valueOf("224.0.0.1/32");
50 static final IpPrefix IPV6_UNICAST_ADDR = IpPrefix.valueOf("2000::1/32");
51 static final IpPrefix IPV6_MCAST_ADDR = IpPrefix.valueOf("ff00::1/32");
52 static final MplsLabel MPLS_10 = MplsLabel.mplsLabel(10);
53 static final Integer NEXT_ID_1 = 1;
Yi Tseng20f9e7b2018-05-24 23:27:39 +080054 static final TrafficSelector VLAN_META = DefaultTrafficSelector.builder()
55 .matchVlanId(VLAN_100)
56 .build();
Yi Tseng0b809722017-11-03 10:23:26 -070057 static final PiCriterion VLAN_VALID = PiCriterion.builder()
Carmelo Casconeb5324e72018-11-25 02:26:32 -080058 .matchExact(FabricConstants.HDR_VLAN_IS_VALID, new byte[]{1})
Yi Tseng0b809722017-11-03 10:23:26 -070059 .build();
60 static final PiCriterion VLAN_INVALID = PiCriterion.builder()
Carmelo Casconeb5324e72018-11-25 02:26:32 -080061 .matchExact(FabricConstants.HDR_VLAN_IS_VALID, new byte[]{0})
Yi Tseng0b809722017-11-03 10:23:26 -070062 .build();
63
Carmelo Casconeb5324e72018-11-25 02:26:32 -080064 FabricCapabilities capabilitiesHashed;
65 FabricCapabilities capabilitiesSimple;
Yi Tseng0b809722017-11-03 10:23:26 -070066
Carmelo Casconeb5324e72018-11-25 02:26:32 -080067 void doSetup() {
68 this.capabilitiesHashed = createNiceMock(FabricCapabilities.class);
69 this.capabilitiesSimple = createNiceMock(FabricCapabilities.class);
70 expect(capabilitiesHashed.hasHashedTable()).andReturn(true).anyTimes();
71 expect(capabilitiesSimple.hasHashedTable()).andReturn(false).anyTimes();
72 replay(capabilitiesHashed);
73 replay(capabilitiesSimple);
Yi Tseng0b809722017-11-03 10:23:26 -070074 }
Carmelo Cascone41644362018-08-09 16:56:43 -070075
76 @Test
77 public void fakeTest() {
78 // Needed otherwise Bazel complains about a test class without test cases.
79 assert true;
80 }
Yi Tseng0b809722017-11-03 10:23:26 -070081}