Search in sources :

Example 41 with DeviceDescription

use of org.onosproject.net.device.DeviceDescription in project onos by opennetworkinglab.

the class InternalDeviceEventSerializer method read.

@Override
public InternalDeviceEvent read(Kryo kryo, Input input, Class<InternalDeviceEvent> type) {
    ProviderId providerId = (ProviderId) kryo.readClassAndObject(input);
    DeviceId deviceId = kryo.readObject(input, DeviceId.class, deviceIdSerializer());
    @SuppressWarnings("unchecked") Timestamped<DeviceDescription> deviceDescription = (Timestamped<DeviceDescription>) kryo.readClassAndObject(input);
    return new InternalDeviceEvent(providerId, deviceId, deviceDescription);
}
Also used : ProviderId(org.onosproject.net.provider.ProviderId) DeviceDescription(org.onosproject.net.device.DeviceDescription) DeviceId(org.onosproject.net.DeviceId) Timestamped(org.onosproject.store.impl.Timestamped)

Example 42 with DeviceDescription

use of org.onosproject.net.device.DeviceDescription in project onos by opennetworkinglab.

the class JuniperUtilsTest method testDeviceDescriptionParsedFromJunos15.

@Test
public void testDeviceDescriptionParsedFromJunos15() throws IOException {
    HierarchicalConfiguration getSystemInfoResp = XmlConfigParser.loadXml(getClass().getResourceAsStream("/Junos_get-system-information_response_15.1.xml"));
    String chassisText = CharStreams.toString(new InputStreamReader(getClass().getResourceAsStream("/Junos_get-chassis-mac-addresses_response_15.1.xml")));
    DeviceDescription expected = new DefaultDeviceDescription(URI.create(DEVICE_ID), ROUTER, "JUNIPER", "mx240", "junos 15.1R5.5", "JN11AC665AFC", new ChassisId("8418889983c0"));
    assertEquals(expected, JuniperUtils.parseJuniperDescription(deviceId, getSystemInfoResp, chassisText));
}
Also used : DefaultDeviceDescription(org.onosproject.net.device.DefaultDeviceDescription) DeviceDescription(org.onosproject.net.device.DeviceDescription) ChassisId(org.onlab.packet.ChassisId) InputStreamReader(java.io.InputStreamReader) DefaultDeviceDescription(org.onosproject.net.device.DefaultDeviceDescription) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) HierarchicalConfiguration(org.apache.commons.configuration.HierarchicalConfiguration) Test(org.junit.Test)

Example 43 with DeviceDescription

use of org.onosproject.net.device.DeviceDescription in project onos by opennetworkinglab.

the class JuniperUtilsTest method testDeviceDescriptionParsedFromJunos19.

@Test
public void testDeviceDescriptionParsedFromJunos19() throws IOException {
    HierarchicalConfiguration getSystemInfoResp = XmlConfigParser.loadXml(getClass().getResourceAsStream("/Junos_get-system-information_response_19.2.xml"));
    String chassisText = CharStreams.toString(new InputStreamReader(getClass().getResourceAsStream("/Junos_get-chassis-mac-addresses_response_19.2.xml")));
    DeviceDescription expected = new DefaultDeviceDescription(URI.create(DEVICE_ID), ROUTER, "JUNIPER", "acx6360-or", "junos 19.2I-20190228_dev_common.0.2316", "DX004", new ChassisId("f4b52f1f81c0"));
    assertEquals(expected, JuniperUtils.parseJuniperDescription(deviceId, getSystemInfoResp, chassisText));
}
Also used : DefaultDeviceDescription(org.onosproject.net.device.DefaultDeviceDescription) DeviceDescription(org.onosproject.net.device.DeviceDescription) ChassisId(org.onlab.packet.ChassisId) InputStreamReader(java.io.InputStreamReader) DefaultDeviceDescription(org.onosproject.net.device.DefaultDeviceDescription) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) HierarchicalConfiguration(org.apache.commons.configuration.HierarchicalConfiguration) Test(org.junit.Test)

Example 44 with DeviceDescription

use of org.onosproject.net.device.DeviceDescription in project onos by opennetworkinglab.

the class GossipDeviceStoreTest method putDevice.

private void putDevice(DeviceId deviceId, String swVersion, SparseAnnotations... annotations) {
    DeviceDescription description = new DefaultDeviceDescription(deviceId.uri(), SWITCH, MFR, HW, swVersion, SN, CID, annotations);
    reset(clusterCommunicator);
    clusterCommunicator.<InternalDeviceEvent>broadcast(anyObject(InternalDeviceEvent.class), anyObject(MessageSubject.class), anyObject(Function.class));
    expectLastCall().anyTimes();
    replay(clusterCommunicator);
    deviceStore.createOrUpdateDevice(PID, deviceId, description);
    verify(clusterCommunicator);
}
Also used : DeviceDescription(org.onosproject.net.device.DeviceDescription) DefaultDeviceDescription(org.onosproject.net.device.DefaultDeviceDescription) BiFunction(java.util.function.BiFunction) Function(java.util.function.Function) MessageSubject(org.onosproject.store.cluster.messaging.MessageSubject) DefaultDeviceDescription(org.onosproject.net.device.DefaultDeviceDescription)

Aggregations

DeviceDescription (org.onosproject.net.device.DeviceDescription)44 DefaultDeviceDescription (org.onosproject.net.device.DefaultDeviceDescription)32 ChassisId (org.onlab.packet.ChassisId)14 DeviceId (org.onosproject.net.DeviceId)14 Test (org.junit.Test)11 ProviderId (org.onosproject.net.provider.ProviderId)10 DefaultAnnotations (org.onosproject.net.DefaultAnnotations)9 DeviceEvent (org.onosproject.net.device.DeviceEvent)8 SparseAnnotations (org.onosproject.net.SparseAnnotations)6 DeviceDescriptionDiscovery (org.onosproject.net.device.DeviceDescriptionDiscovery)6 Device (org.onosproject.net.Device)5 PortDescription (org.onosproject.net.device.PortDescription)5 IOException (java.io.IOException)4 ExecutionException (java.util.concurrent.ExecutionException)4 BiFunction (java.util.function.BiFunction)4 Function (java.util.function.Function)4 NodeId (org.onosproject.cluster.NodeId)4 NetconfException (org.onosproject.netconf.NetconfException)4 Arrays (java.util.Arrays)3 HashMap (java.util.HashMap)3