Search in sources :

Example 1 with HostProto

use of org.onosproject.grpc.net.models.HostProtoOuterClass.HostProto in project onos by opennetworkinglab.

the class HostEventConverter method buildHostProtoMessage.

private HostNotificationProto buildHostProtoMessage(HostEvent hostEvent) {
    HostNotificationProto.Builder notificationBuilder = HostNotificationProto.newBuilder();
    HostProto hostCore = HostProto.newBuilder().setHostId(HostIdProtoTranslator.translate(hostEvent.subject().id())).setConfigured(hostEvent.subject().configured()).addAllIpAddresses(hostEvent.subject().ipAddresses().stream().map(IpAddress::toString).collect(Collectors.toList())).setLocation(HostLocationProtoTranslator.translate(hostEvent.subject().location())).setVlan(hostEvent.subject().vlan().toShort()).putAllAnnotations(AnnotationsTranslator.asMap(hostEvent.subject().annotations())).build();
    notificationBuilder.setHostEventType(getProtoType(hostEvent)).setHost(hostCore);
    return notificationBuilder.build();
}
Also used : HostNotificationProto(org.onosproject.grpc.net.host.models.HostEventProto.HostNotificationProto) IpAddress(org.onlab.packet.IpAddress) HostProto(org.onosproject.grpc.net.models.HostProtoOuterClass.HostProto)

Aggregations

IpAddress (org.onlab.packet.IpAddress)1 HostNotificationProto (org.onosproject.grpc.net.host.models.HostEventProto.HostNotificationProto)1 HostProto (org.onosproject.grpc.net.models.HostProtoOuterClass.HostProto)1