use of org.onosproject.net.DefaultAnnotations in project onos by opennetworkinglab.
the class LinkDiscoveryAristaImpl method buildLinkPair.
private static Set<LinkDescription> buildLinkPair(DeviceId localDevId, Port localPort, DeviceId remoteDevId, Port remotePort) {
Set<LinkDescription> linkDescriptions = Sets.newHashSet();
ConnectPoint local = new ConnectPoint(localDevId, localPort.number());
ConnectPoint remote = new ConnectPoint(remoteDevId, remotePort.number());
DefaultAnnotations annotations = DefaultAnnotations.builder().set(AnnotationKeys.LAYER, "ETHERNET").build();
linkDescriptions.add(new DefaultLinkDescription(remote, local, Link.Type.DIRECT, true, annotations));
return linkDescriptions;
}
use of org.onosproject.net.DefaultAnnotations in project onos by opennetworkinglab.
the class LinkDiscoveryCiscoImpl method buildLinkPair.
private static Set<LinkDescription> buildLinkPair(DeviceId localDevId, Port localPort, DeviceId remoteDevId, Port remotePort) {
Set<LinkDescription> linkDescriptions = Sets.newHashSet();
ConnectPoint local = new ConnectPoint(localDevId, localPort.number());
ConnectPoint remote = new ConnectPoint(remoteDevId, remotePort.number());
DefaultAnnotations annotations = DefaultAnnotations.builder().set("layer", "ETHERNET").build();
linkDescriptions.add(new DefaultLinkDescription(remote, local, Link.Type.DIRECT, true, annotations));
return linkDescriptions;
}
use of org.onosproject.net.DefaultAnnotations in project onos by opennetworkinglab.
the class CienaWaveserverAiDeviceDescriptionTest method getExpectedPorts.
private List getExpectedPorts() {
List<PortDescription> result = new ArrayList<>();
DefaultAnnotations port101 = DefaultAnnotations.builder().set(AnnotationKeys.PORT_NAME, "1-1").set(AnnotationKeys.PROTOCOL, "otn").build();
DefaultAnnotations port102 = DefaultAnnotations.builder().set(AnnotationKeys.PORT_NAME, "1-2").set(AnnotationKeys.PROTOCOL, "otn").build();
DefaultAnnotations port103 = DefaultAnnotations.builder().set(AnnotationKeys.PORT_NAME, "1-3").set(AnnotationKeys.PROTOCOL, "ethernet").build();
DefaultAnnotations port107 = DefaultAnnotations.builder().set(AnnotationKeys.PORT_NAME, "1-7").set(AnnotationKeys.PROTOCOL, "ethernet").build();
result.add(DefaultPortDescription.builder().withPortNumber(PortNumber.portNumber(10101)).isEnabled(false).portSpeed(421033).type(Port.Type.PACKET).annotations(port101).build());
result.add(DefaultPortDescription.builder().withPortNumber(PortNumber.portNumber(10102)).isEnabled(true).portSpeed(421033).type(Port.Type.PACKET).annotations(port102).build());
result.add(DefaultPortDescription.builder().withPortNumber(PortNumber.portNumber(10103)).isEnabled(true).portSpeed(103125).type(Port.Type.PACKET).annotations(port103).build());
result.add(DefaultPortDescription.builder().withPortNumber(PortNumber.portNumber(10107)).isEnabled(true).portSpeed(103125).type(Port.Type.PACKET).annotations(port107).build());
return result;
}
use of org.onosproject.net.DefaultAnnotations in project onos by opennetworkinglab.
the class SimpleHostStore method updateHost.
// checks for type of update to host, sends appropriate event
private HostEvent updateHost(ProviderId providerId, StoredHost host, HostDescription descr, boolean replaceIps) {
HostEvent event;
if (!host.location().equals(descr.location())) {
host.setLocation(descr.location());
return new HostEvent(HOST_MOVED, host);
}
if (host.ipAddresses().containsAll(descr.ipAddress()) && descr.annotations().keys().isEmpty()) {
return null;
}
final Set<IpAddress> addresses;
if (replaceIps) {
addresses = ImmutableSet.copyOf(descr.ipAddress());
} else {
addresses = new HashSet<>(host.ipAddresses());
addresses.addAll(descr.ipAddress());
}
Annotations annotations = merge((DefaultAnnotations) host.annotations(), descr.annotations());
StoredHost updated = new StoredHost(providerId, host.id(), host.mac(), host.vlan(), descr.location(), addresses, descr.configured(), annotations);
event = new HostEvent(HOST_UPDATED, updated);
synchronized (this) {
hosts.put(host.id(), updated);
locations.remove(host.location(), host);
locations.put(updated.location(), updated);
}
return event;
}
use of org.onosproject.net.DefaultAnnotations in project onos by opennetworkinglab.
the class SimpleLinkStore method composeLink.
// Guarded by linkDescs value (=locking each Link)
private Link composeLink(Map<ProviderId, LinkDescription> descs) {
ProviderId primary = getBaseProviderId(descs);
LinkDescription base = descs.get(verifyNotNull(primary));
ConnectPoint src = base.src();
ConnectPoint dst = base.dst();
Type type = base.type();
DefaultAnnotations annotations = DefaultAnnotations.builder().build();
annotations = merge(annotations, base.annotations());
for (Entry<ProviderId, LinkDescription> e : descs.entrySet()) {
if (primary.equals(e.getKey())) {
continue;
}
// TODO: should keep track of Description timestamp
// and only merge conflicting keys when timestamp is newer
// Currently assuming there will never be a key conflict between
// providers
// annotation merging. not so efficient, should revisit later
annotations = merge(annotations, e.getValue().annotations());
}
boolean isDurable = Objects.equals(annotations.value(AnnotationKeys.DURABLE), "true");
return DefaultLink.builder().providerId(primary).src(src).dst(dst).type(type).state(ACTIVE).isExpected(isDurable).annotations(annotations).build();
}
Aggregations