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));
}
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));
}
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));
}
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));
}
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);
}
Aggregations