Search in sources :

Example 6 with OmsPort

use of org.onosproject.net.optical.OmsPort in project onos by opennetworkinglab.

the class DefaultOmsPortTest method testEquality.

@Test
public void testEquality() {
    PortNumber pn = PortNumber.portNumber(4900);
    Annotations an = DefaultAnnotations.builder().set("Base", "value").build();
    Annotations an2 = DefaultAnnotations.builder().set("Base", "value2").build();
    Port base = new DefaultPort(DEV, pn, true, Port.Type.VIRTUAL, 2, an);
    Frequency minF = Frequency.ofGHz(3);
    Frequency maxF = Frequency.ofGHz(33);
    Frequency grid = Frequency.ofGHz(2);
    // reference OMS port
    OmsPort oms = new DefaultOmsPort(base, minF, maxF, grid);
    new EqualsTester().addEqualityGroup(oms, // different base port type or portspeed is ignored
    new DefaultOmsPort(new DefaultPort(DEV, pn, true, an), minF, maxF, grid)).addEqualityGroup(new DefaultOmsPort(new DefaultPort(DEV, portNumber(1), true, an), minF, maxF, grid)).addEqualityGroup(new DefaultOmsPort(new DefaultPort(DEV, pn, false, an), minF, maxF, grid)).addEqualityGroup(new DefaultOmsPort(new DefaultPort(DEV, pn, true, an2), minF, maxF, grid)).addEqualityGroup(new DefaultOmsPort(base, Frequency.ofKHz(3), maxF, grid)).addEqualityGroup(new DefaultOmsPort(base, minF, Frequency.ofKHz(33), grid)).addEqualityGroup(new DefaultOmsPort(base, minF, maxF, Frequency.ofKHz(2))).testEquals();
}
Also used : OmsPort(org.onosproject.net.optical.OmsPort) DefaultAnnotations(org.onosproject.net.DefaultAnnotations) Annotations(org.onosproject.net.Annotations) EqualsTester(com.google.common.testing.EqualsTester) DefaultPort(org.onosproject.net.DefaultPort) OmsPort(org.onosproject.net.optical.OmsPort) Port(org.onosproject.net.Port) Frequency(org.onlab.util.Frequency) PortNumber(org.onosproject.net.PortNumber) DefaultPort(org.onosproject.net.DefaultPort) Test(org.junit.Test)

Aggregations

OmsPort (org.onosproject.net.optical.OmsPort)6 Port (org.onosproject.net.Port)5 Frequency (org.onlab.util.Frequency)4 PortNumber (org.onosproject.net.PortNumber)4 Test (org.junit.Test)3 Annotations (org.onosproject.net.Annotations)3 DefaultAnnotations (org.onosproject.net.DefaultAnnotations)3 DefaultPort (org.onosproject.net.DefaultPort)3 SparseAnnotations (org.onosproject.net.SparseAnnotations)2 EqualsTester (com.google.common.testing.EqualsTester)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 Set (java.util.Set)1 IntStream (java.util.stream.IntStream)1 GuavaCollectors (org.onlab.util.GuavaCollectors)1 ChannelSpacing (org.onosproject.net.ChannelSpacing)1 OchSignal (org.onosproject.net.OchSignal)1 LambdaQuery (org.onosproject.net.behaviour.LambdaQuery)1 DeviceService (org.onosproject.net.device.DeviceService)1 PortDescription (org.onosproject.net.device.PortDescription)1