Search in sources :

Example 16 with Annotations

use of org.onosproject.net.Annotations in project onos by opennetworkinglab.

the class SuppressionRules method isSuppressed.

public boolean isSuppressed(Port port) {
    Element parent = port.element();
    if (parent instanceof Device) {
        if (isSuppressed((Device) parent)) {
            return true;
        }
    }
    final Annotations annotations = port.annotations();
    if (containsSuppressionAnnotation(annotations)) {
        return true;
    }
    return false;
}
Also used : Annotations(org.onosproject.net.Annotations) Device(org.onosproject.net.Device) Element(org.onosproject.net.Element)

Example 17 with Annotations

use of org.onosproject.net.Annotations in project onos by opennetworkinglab.

the class MeteredConstraintTest method setUp.

@Before
public void setUp() {
    resourceContext = createMock(ResourceContext.class);
    Annotations annotations1 = DefaultAnnotations.builder().set(METERED, METERED1).build();
    Annotations annotations2 = DefaultAnnotations.builder().set(METERED, METERED2).build();
    meteredLink = DefaultLink.builder().providerId(PROVIDER_ID).src(cp(DID1, PN1)).dst(cp(DID2, PN2)).type(DIRECT).annotations(annotations1).build();
    nonMeteredLink = DefaultLink.builder().providerId(PROVIDER_ID).src(cp(DID2, PN3)).dst(cp(DID3, PN4)).type(DIRECT).annotations(annotations2).build();
    unAnnotatedLink = DefaultLink.builder().providerId(PROVIDER_ID).src(cp(DID1, PN5)).dst(cp(DID3, PN6)).type(DIRECT).build();
    meteredPath = new DefaultPath(PROVIDER_ID, Arrays.asList(meteredLink, nonMeteredLink), ScalarWeight.toWeight(10));
    nonMeteredPath = new DefaultPath(PROVIDER_ID, Arrays.asList(nonMeteredLink, unAnnotatedLink), ScalarWeight.toWeight(10));
}
Also used : ResourceContext(org.onosproject.net.intent.ResourceContext) DefaultAnnotations(org.onosproject.net.DefaultAnnotations) Annotations(org.onosproject.net.Annotations) DefaultPath(org.onosproject.net.DefaultPath) Before(org.junit.Before)

Example 18 with Annotations

use of org.onosproject.net.Annotations in project onos by opennetworkinglab.

the class TierConstraintTest method setUp.

@Before
public void setUp() {
    resourceContext = createMock(ResourceContext.class);
    Annotations annotations1 = DefaultAnnotations.builder().set(TIER, TIER1).build();
    Annotations annotations2 = DefaultAnnotations.builder().set(TIER, TIER2).build();
    Annotations annotations3 = DefaultAnnotations.builder().set(TIER, TIER3).build();
    link1 = DefaultLink.builder().providerId(PROVIDER_ID).src(cp(DID1, PN1)).dst(cp(DID2, PN2)).type(DIRECT).annotations(annotations1).build();
    link2 = DefaultLink.builder().providerId(PROVIDER_ID).src(cp(DID2, PN3)).dst(cp(DID3, PN4)).type(DIRECT).annotations(annotations2).build();
    link3 = DefaultLink.builder().providerId(PROVIDER_ID).src(cp(DID2, PN5)).dst(cp(DID4, PN6)).type(DIRECT).annotations(annotations3).build();
    path12 = new DefaultPath(PROVIDER_ID, Arrays.asList(link1, link2), ScalarWeight.toWeight(10));
    path13 = new DefaultPath(PROVIDER_ID, Arrays.asList(link1, link3), ScalarWeight.toWeight(10));
    path23 = new DefaultPath(PROVIDER_ID, Arrays.asList(link2, link3), ScalarWeight.toWeight(10));
}
Also used : ResourceContext(org.onosproject.net.intent.ResourceContext) DefaultAnnotations(org.onosproject.net.DefaultAnnotations) Annotations(org.onosproject.net.Annotations) DefaultPath(org.onosproject.net.DefaultPath) Before(org.junit.Before)

Example 19 with Annotations

use of org.onosproject.net.Annotations in project onos by opennetworkinglab.

the class HostServiceAdapter method getHost.

@Override
public Host getHost(HostId hostId) {
    ProviderId providerId = ProviderId.NONE;
    MacAddress mac = MacAddress.valueOf("fa:12:3e:56:ee:a2");
    VlanId vlan = VlanId.NONE;
    HostLocation location = HostLocation.NONE;
    Set<IpAddress> ips = Sets.newHashSet();
    Annotations annotations = null;
    return new DefaultHost(providerId, hostId, mac, vlan, location, ips, annotations);
}
Also used : ProviderId(org.onosproject.net.provider.ProviderId) DefaultHost(org.onosproject.net.DefaultHost) Annotations(org.onosproject.net.Annotations) HostLocation(org.onosproject.net.HostLocation) IpAddress(org.onlab.packet.IpAddress) MacAddress(org.onlab.packet.MacAddress) VlanId(org.onlab.packet.VlanId)

Example 20 with Annotations

use of org.onosproject.net.Annotations in project onos by opennetworkinglab.

the class TopologyViewMessageHandlerBase method deviceDetails.

// Generates a property panel model for device details response
protected PropertyPanel deviceDetails(DeviceId deviceId) {
    log.debug("generate prop panel data for device {}", deviceId);
    Device device = services.device().getDevice(deviceId);
    Annotations annot = device.annotations();
    String proto = annot.value(AnnotationKeys.PROTOCOL);
    String title = friendlyDevice(deviceId);
    LionBundle lion = getLionBundle(LION_TOPO);
    PropertyPanel pp = new PropertyPanel(title, lookupGlyph(device)).navPath(DEVICE_NAV_PATH).id(deviceId.toString());
    addDeviceBasicProps(pp, deviceId, device, proto, lion);
    addLocationProps(pp, annot, lion);
    addDeviceCountStats(pp, deviceId, lion);
    addDeviceCoreButtons(pp);
    return pp;
}
Also used : Annotations(org.onosproject.net.Annotations) Device(org.onosproject.net.Device) TopoUtils.compactLinkString(org.onosproject.ui.topo.TopoUtils.compactLinkString) LionBundle(org.onosproject.ui.lion.LionBundle) PropertyPanel(org.onosproject.ui.topo.PropertyPanel)

Aggregations

Annotations (org.onosproject.net.Annotations)39 DefaultAnnotations (org.onosproject.net.DefaultAnnotations)25 Test (org.junit.Test)9 Device (org.onosproject.net.Device)9 Port (org.onosproject.net.Port)8 ArrayList (java.util.ArrayList)6 DefaultDevice (org.onosproject.net.DefaultDevice)6 DefaultPort (org.onosproject.net.DefaultPort)6 SparseAnnotations (org.onosproject.net.SparseAnnotations)5 IpAddress (org.onlab.packet.IpAddress)4 DefaultPath (org.onosproject.net.DefaultPath)4 PortNumber (org.onosproject.net.PortNumber)4 ProviderId (org.onosproject.net.provider.ProviderId)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 Set (java.util.Set)3 Before (org.junit.Before)3 Frequency (org.onlab.util.Frequency)3 NodeId (org.onosproject.cluster.NodeId)3 ConnectPoint (org.onosproject.net.ConnectPoint)3 DefaultHost (org.onosproject.net.DefaultHost)3