Search in sources :

Example 11 with DefaultDevice

use of org.onosproject.net.DefaultDevice in project onos by opennetworkinglab.

the class SuppressionRulesTest method testSuppressedDeviceAnnotation.

@Test
public void testSuppressedDeviceAnnotation() {
    Annotations annotation = DefaultAnnotations.builder().set("no-lldp", "random").build();
    Device device = new DefaultDevice(PID, NON_SUPPRESSED_DID, Device.Type.SWITCH, MFR, HW, SW1, SN, CID, annotation);
    assertTrue(rules.isSuppressed(device));
}
Also used : DefaultAnnotations(org.onosproject.net.DefaultAnnotations) Annotations(org.onosproject.net.Annotations) Device(org.onosproject.net.Device) DefaultDevice(org.onosproject.net.DefaultDevice) DefaultDevice(org.onosproject.net.DefaultDevice) Test(org.junit.Test)

Example 12 with DefaultDevice

use of org.onosproject.net.DefaultDevice in project onos by opennetworkinglab.

the class SuppressionRulesTest method testSuppressedPortAnnotationExact.

@Test
public void testSuppressedPortAnnotationExact() {
    Annotations annotation = DefaultAnnotations.builder().set("sendLLDP", "false").build();
    Device device = new DefaultDevice(PID, NON_SUPPRESSED_DID, Device.Type.SWITCH, MFR, HW, SW1, SN, CID);
    Port port = new DefaultPort(device, P1, true, annotation);
    assertTrue(rules.isSuppressed(port));
}
Also used : DefaultAnnotations(org.onosproject.net.DefaultAnnotations) Annotations(org.onosproject.net.Annotations) Device(org.onosproject.net.Device) DefaultDevice(org.onosproject.net.DefaultDevice) DefaultPort(org.onosproject.net.DefaultPort) Port(org.onosproject.net.Port) DefaultDevice(org.onosproject.net.DefaultDevice) DefaultPort(org.onosproject.net.DefaultPort) Test(org.junit.Test)

Example 13 with DefaultDevice

use of org.onosproject.net.DefaultDevice in project onos by opennetworkinglab.

the class SuppressionRulesTest method testSuppressedPortAnnotation.

@Test
public void testSuppressedPortAnnotation() {
    Annotations annotation = DefaultAnnotations.builder().set("no-lldp", "random").build();
    Device device = new DefaultDevice(PID, NON_SUPPRESSED_DID, Device.Type.SWITCH, MFR, HW, SW1, SN, CID);
    Port port = new DefaultPort(device, P1, true, annotation);
    assertTrue(rules.isSuppressed(port));
}
Also used : DefaultAnnotations(org.onosproject.net.DefaultAnnotations) Annotations(org.onosproject.net.Annotations) Device(org.onosproject.net.Device) DefaultDevice(org.onosproject.net.DefaultDevice) DefaultPort(org.onosproject.net.DefaultPort) Port(org.onosproject.net.Port) DefaultDevice(org.onosproject.net.DefaultDevice) DefaultPort(org.onosproject.net.DefaultPort) Test(org.junit.Test)

Example 14 with DefaultDevice

use of org.onosproject.net.DefaultDevice in project onos by opennetworkinglab.

the class SuppressionRulesTest method testSuppressedDeviceType.

@Test
public void testSuppressedDeviceType() {
    Device device = new DefaultDevice(PID, NON_SUPPRESSED_DID, Device.Type.ROADM, MFR, HW, SW1, SN, CID);
    assertTrue(rules.isSuppressed(device));
}
Also used : Device(org.onosproject.net.Device) DefaultDevice(org.onosproject.net.DefaultDevice) DefaultDevice(org.onosproject.net.DefaultDevice) Test(org.junit.Test)

Example 15 with DefaultDevice

use of org.onosproject.net.DefaultDevice in project onos by opennetworkinglab.

the class DeviceCodec method decode.

/**
 * {@inheritDoc}
 *
 * Note: ProviderId is not part of JSON representation.
 *       Returned object will have random ProviderId set.
 */
@Override
public Device decode(ObjectNode json, CodecContext context) {
    if (json == null || !json.isObject()) {
        return null;
    }
    DeviceId id = deviceId(json.get(ID).asText());
    // TODO: add providerId to JSON if we need to recover them.
    ProviderId pid = new ProviderId(id.uri().getScheme(), "DeviceCodec");
    Type type = Type.valueOf(json.get(TYPE).asText());
    String mfr = json.get(MFR).asText();
    String hw = json.get(HW).asText();
    String sw = json.get(SW).asText();
    String serial = json.get(SERIAL).asText();
    ChassisId chassisId = new ChassisId(json.get(CHASSIS_ID).asText());
    Annotations annotations = extractAnnotations(json, context);
    return new DefaultDevice(pid, id, type, mfr, hw, sw, serial, chassisId, annotations);
}
Also used : ProviderId(org.onosproject.net.provider.ProviderId) Type(org.onosproject.net.Device.Type) ChassisId(org.onlab.packet.ChassisId) DefaultAnnotations(org.onosproject.net.DefaultAnnotations) Annotations(org.onosproject.net.Annotations) DeviceId(org.onosproject.net.DeviceId) DefaultDevice(org.onosproject.net.DefaultDevice)

Aggregations

DefaultDevice (org.onosproject.net.DefaultDevice)22 Device (org.onosproject.net.Device)14 Test (org.junit.Test)13 ChassisId (org.onlab.packet.ChassisId)13 DefaultAnnotations (org.onosproject.net.DefaultAnnotations)10 Annotations (org.onosproject.net.Annotations)5 DefaultPort (org.onosproject.net.DefaultPort)5 DeviceId (org.onosproject.net.DeviceId)5 ProviderId (org.onosproject.net.provider.ProviderId)5 HashMap (java.util.HashMap)4 Type (org.onosproject.net.Device.Type)4 Before (org.junit.Before)3 Port (org.onosproject.net.Port)3 Behaviour (org.onosproject.net.driver.Behaviour)3 DefaultDriver (org.onosproject.net.driver.DefaultDriver)3 InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 TestEventDispatcher (org.onosproject.common.event.impl.TestEventDispatcher)2 MepId (org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId)2 CfmConfigException (org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException)2