Search in sources :

Example 31 with DefaultPort

use of org.onosproject.net.DefaultPort in project trellis-control by opennetworkinglab.

the class RoutingRulePopulatorTest method testNoMoreEnabledPortCase3.

// Disable port 1 and 3
@Test
public void testNoMoreEnabledPortCase3() throws Exception {
    Port port1 = new DefaultPort(dev1, p1, false);
    Port port2 = new DefaultPort(dev1, p2, true);
    Port port3 = new DefaultPort(dev1, p3, false);
    Port port4 = new DefaultPort(dev1, p4, true);
    Port port5 = new DefaultPort(dev1, p5, true);
    List<Port> ports = Lists.newArrayList(port1, port2, port3, port4, port5);
    expect(deviceService.getPorts(anyObject(DeviceId.class))).andReturn(ports).anyTimes();
    replay(deviceService);
    assertFalse(rrp.noMoreEnabledPort(devId1, v10));
    assertTrue(rrp.noMoreEnabledPort(devId1, v20));
    assertFalse(rrp.noMoreEnabledPort(devId1, vInt));
}
Also used : DefaultPort(org.onosproject.net.DefaultPort) Port(org.onosproject.net.Port) DefaultPort(org.onosproject.net.DefaultPort) Test(org.junit.Test)

Example 32 with DefaultPort

use of org.onosproject.net.DefaultPort in project trellis-control by opennetworkinglab.

the class RoutingRulePopulatorTest method testNoMoreEnabledPortCase2.

// Disable port 1
@Test
public void testNoMoreEnabledPortCase2() throws Exception {
    Port port1 = new DefaultPort(dev1, p1, false);
    Port port2 = new DefaultPort(dev1, p2, true);
    Port port3 = new DefaultPort(dev1, p3, true);
    Port port4 = new DefaultPort(dev1, p4, true);
    Port port5 = new DefaultPort(dev1, p5, true);
    List<Port> ports = Lists.newArrayList(port1, port2, port3, port4, port5);
    expect(deviceService.getPorts(anyObject(DeviceId.class))).andReturn(ports).anyTimes();
    replay(deviceService);
    assertFalse(rrp.noMoreEnabledPort(devId1, v10));
    assertFalse(rrp.noMoreEnabledPort(devId1, v20));
    assertFalse(rrp.noMoreEnabledPort(devId1, vInt));
}
Also used : DefaultPort(org.onosproject.net.DefaultPort) Port(org.onosproject.net.Port) DefaultPort(org.onosproject.net.DefaultPort) Test(org.junit.Test)

Example 33 with DefaultPort

use of org.onosproject.net.DefaultPort in project trellis-control by opennetworkinglab.

the class RoutingRulePopulatorTest method testNoMoreEnabledPortCase5.

// Disable port 1 to 4
@Test
public void testNoMoreEnabledPortCase5() throws Exception {
    Port port1 = new DefaultPort(dev1, p1, false);
    Port port2 = new DefaultPort(dev1, p2, false);
    Port port3 = new DefaultPort(dev1, p3, false);
    Port port4 = new DefaultPort(dev1, p4, false);
    Port port5 = new DefaultPort(dev1, p5, true);
    List<Port> ports = Lists.newArrayList(port1, port2, port3, port4, port5);
    expect(deviceService.getPorts(anyObject(DeviceId.class))).andReturn(ports).anyTimes();
    replay(deviceService);
    assertTrue(rrp.noMoreEnabledPort(devId1, v10));
    assertTrue(rrp.noMoreEnabledPort(devId1, v20));
    assertFalse(rrp.noMoreEnabledPort(devId1, vInt));
}
Also used : DefaultPort(org.onosproject.net.DefaultPort) Port(org.onosproject.net.Port) DefaultPort(org.onosproject.net.DefaultPort) Test(org.junit.Test)

Aggregations

DefaultPort (org.onosproject.net.DefaultPort)33 Test (org.junit.Test)25 Port (org.onosproject.net.Port)21 Device (org.onosproject.net.Device)12 DefaultAnnotations (org.onosproject.net.DefaultAnnotations)10 DefaultDevice (org.onosproject.net.DefaultDevice)8 DeviceEvent (org.onosproject.net.device.DeviceEvent)8 PortNumber (org.onosproject.net.PortNumber)7 Annotations (org.onosproject.net.Annotations)6 ConnectPoint (org.onosproject.net.ConnectPoint)5 DeviceId (org.onosproject.net.DeviceId)4 ProviderId (org.onosproject.net.provider.ProviderId)4 Iterator (java.util.Iterator)3 Frequency (org.onlab.util.Frequency)3 HostId (org.onosproject.net.HostId)3 PortDescription (org.onosproject.net.device.PortDescription)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)2 Supplier (com.google.common.base.Supplier)2 Sets (com.google.common.collect.Sets)2