Java Code Examples for org.onosproject.net.Host#annotations()

The following examples show how to use org.onosproject.net.Host#annotations() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpenstackSwitchingHostProviderTest.java    From onos with Apache License 2.0 6 votes vote down vote up
@Override
public void addLocationToHost(HostId hostId, HostLocation location) {
    Host oldHost = hostMap.get(hostId);

    Set<HostLocation> newHostlocations = oldHost.locations();
    newHostlocations.add(location);

    Host newHost = new DefaultHost(oldHost.providerId(),
            oldHost.id(),
            oldHost.mac(),
            oldHost.vlan(),
            newHostlocations,
            oldHost.ipAddresses(),
            oldHost.innerVlan(),
            oldHost.tpid(),
            oldHost.configured(),
            oldHost.annotations());

    hostMap.put(hostId, newHost);
}
 
Example 2
Source File: HostsWebResource.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Creates and adds new host based on given data and returns its host ID.
 *
 * @param node JsonNode containing host information
 * @return host ID of new host created
 */
private HostId parseHost(JsonNode node) {
    Host host = codec(Host.class).decode((ObjectNode) node, HostsWebResource.this);

    HostId hostId = host.id();
    DefaultHostDescription desc = new DefaultHostDescription(
            host.mac(), host.vlan(), host.locations(), host.ipAddresses(), host.innerVlan(),
            host.tpid(), host.configured(), (SparseAnnotations) host.annotations());
    hostProviderService.hostDetected(hostId, desc, false);

    return hostId;
}
 
Example 3
Source File: TopologyViewMessageHandlerBase.java    From onos with Apache License 2.0 5 votes vote down vote up
protected PropertyPanel hostDetails(HostId hostId) {
    log.debug("generate prop panel data for host {}", hostId);
    Host host = services.host().getHost(hostId);
    Annotations annot = host.annotations();
    String glyphId = glyphForHost(annot);
    LionBundle lion = getLionBundle(LION_TOPO);

    PropertyPanel pp = new PropertyPanel(nameForHost(host), glyphId)
            .navPath(HOST_NAV_PATH)
            .id(hostId.toString());
    addHostBasicProps(pp, host, lion);
    addLocationProps(pp, annot, lion);
    return pp;
}
 
Example 4
Source File: BasicHostOperator.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a description of the given host.
 *
 * @param host the host
 * @return a description of the host
 */
public static HostDescription descriptionOf(Host host) {
    checkNotNull(host, "Must supply a non-null Host");
    return new DefaultHostDescription(host.mac(), host.vlan(), host.locations(),
                                      host.ipAddresses(), host.configured(),
                                      (SparseAnnotations) host.annotations());
}