Search in sources :

Example 16 with ProviderId

use of org.onosproject.net.provider.ProviderId in project onos by opennetworkinglab.

the class InternalPortStatusEventSerializer method read.

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

Example 17 with ProviderId

use of org.onosproject.net.provider.ProviderId in project onos by opennetworkinglab.

the class LinkProtoTranslator method translate.

/**
 * Translates gRPC LinkCore message to {@link Link}.
 *
 * @param link gRPC message
 * @return {@link Link} null if link is a default instance
 */
public static Link translate(LinkProtoOuterClass.LinkProto link) {
    if (link.equals(LinkProtoOuterClass.LinkProto.getDefaultInstance())) {
        return null;
    }
    ProviderId providerId = ProviderIdProtoTranslator.translate(link.getProviderId());
    Link.State state = LinkEnumsProtoTranslator.translate(link.getState()).get();
    ConnectPoint src = ConnectPointProtoTranslator.translate(link.getSrc()).get();
    ConnectPoint dst = ConnectPointProtoTranslator.translate(link.getDst()).get();
    Link.Type type = LinkEnumsProtoTranslator.translate(link.getType()).get();
    Annotations annots = asAnnotations(link.getAnnotations());
    Boolean isExpected = link.getIsExpected();
    return DefaultLink.builder().state(state).annotations(annots).providerId(providerId).src(src).dst(dst).type(type).isExpected(isExpected).build();
}
Also used : ProviderId(org.onosproject.net.provider.ProviderId) DefaultAnnotations(org.onosproject.net.DefaultAnnotations) Annotations(org.onosproject.net.Annotations) SparseAnnotations(org.onosproject.net.SparseAnnotations) ConnectPoint(org.onosproject.net.ConnectPoint) DefaultLink(org.onosproject.net.DefaultLink) Link(org.onosproject.net.Link)

Example 18 with ProviderId

use of org.onosproject.net.provider.ProviderId in project onos by opennetworkinglab.

the class ECLinkStore method removeLink.

@Override
public LinkEvent removeLink(ConnectPoint src, ConnectPoint dst) {
    final LinkKey linkKey = LinkKey.linkKey(src, dst);
    ProviderId primaryProviderId = getBaseProviderId(linkKey);
    // Stop if there is no base provider.
    if (primaryProviderId == null) {
        return null;
    }
    LinkDescription removedLinkDescription = linkDescriptions.remove(new Provided<>(linkKey, primaryProviderId));
    if (removedLinkDescription != null) {
        return purgeLinkCache(linkKey);
    }
    return null;
}
Also used : ProviderId(org.onosproject.net.provider.ProviderId) LinkKey(org.onosproject.net.LinkKey) DefaultLinkDescription(org.onosproject.net.link.DefaultLinkDescription) LinkDescription(org.onosproject.net.link.LinkDescription)

Example 19 with ProviderId

use of org.onosproject.net.provider.ProviderId in project onos by opennetworkinglab.

the class DefaultLinkSerializer method read.

@Override
public DefaultLink read(Kryo kryo, Input input, Class<DefaultLink> type) {
    ProviderId providerId = (ProviderId) kryo.readClassAndObject(input);
    ConnectPoint src = (ConnectPoint) kryo.readClassAndObject(input);
    ConnectPoint dst = (ConnectPoint) kryo.readClassAndObject(input);
    Type linkType = (Type) kryo.readClassAndObject(input);
    State state = (State) kryo.readClassAndObject(input);
    boolean isDurable = input.readBoolean();
    return DefaultLink.builder().providerId(providerId).src(src).dst(dst).type(linkType).state(state).isExpected(isDurable).build();
}
Also used : ProviderId(org.onosproject.net.provider.ProviderId) Type(org.onosproject.net.Link.Type) State(org.onosproject.net.Link.State) ConnectPoint(org.onosproject.net.ConnectPoint)

Example 20 with ProviderId

use of org.onosproject.net.provider.ProviderId in project onos by opennetworkinglab.

the class HostMonitorTest method testMonitorHostExists.

private void testMonitorHostExists(IpAddress hostIp) throws Exception {
    ProviderId id = new ProviderId("fake://", "id");
    Host host = createMock(Host.class);
    expect(host.providerId()).andReturn(id).anyTimes();
    replay(host);
    HostManager hostManager = createMock(HostManager.class);
    expect(hostManager.getHostsByIp(hostIp)).andReturn(Collections.singleton(host)).anyTimes();
    replay(hostManager);
    HostProvider hostProvider = createMock(HostProvider.class);
    expect(hostProvider.id()).andReturn(id).anyTimes();
    hostProvider.triggerProbe(host);
    expectLastCall().times(2);
    replay(hostProvider);
    hostMonitor = new HostMonitor(null, hostManager, null, edgePortService, null);
    hostMonitor.registerHostProvider(hostProvider);
    hostMonitor.addMonitoringFor(hostIp);
    hostMonitor.run();
    verify(hostProvider);
}
Also used : ProviderId(org.onosproject.net.provider.ProviderId) HostProvider(org.onosproject.net.host.HostProvider) Host(org.onosproject.net.Host)

Aggregations

ProviderId (org.onosproject.net.provider.ProviderId)62 DefaultDevice (org.onosproject.net.DefaultDevice)15 DeviceId (org.onosproject.net.DeviceId)13 Tunnel (org.onosproject.incubator.net.tunnel.Tunnel)12 DefaultAnnotations (org.onosproject.net.DefaultAnnotations)12 Device (org.onosproject.net.Device)12 PortDescription (org.onosproject.net.device.PortDescription)12 TunnelProvider (org.onosproject.incubator.net.tunnel.TunnelProvider)10 DefaultPort (org.onosproject.net.DefaultPort)10 Port (org.onosproject.net.Port)10 DeviceEvent (org.onosproject.net.device.DeviceEvent)10 MastershipBasedTimestamp (org.onosproject.store.impl.MastershipBasedTimestamp)10 PortNumber (org.onosproject.net.PortNumber)9 DeviceDescription (org.onosproject.net.device.DeviceDescription)9 Timestamp (org.onosproject.store.Timestamp)9 MultiValuedTimestamp (org.onosproject.store.service.MultiValuedTimestamp)9 WallClockTimestamp (org.onosproject.store.service.WallClockTimestamp)9 DefaultTunnel (org.onosproject.incubator.net.tunnel.DefaultTunnel)7 TunnelId (org.onosproject.incubator.net.tunnel.TunnelId)7 DefaultLinkDescription (org.onosproject.net.link.DefaultLinkDescription)7