Java Code Examples for org.onosproject.net.Host#location()
The following examples show how to use
org.onosproject.net.Host#location() .
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: ModelCache.java From onos with Apache License 2.0 | 6 votes |
private void updateHost(UiHost uiHost, Host h) { UiEdgeLink existing = uiTopology.findEdgeLink(uiHost.edgeLinkId()); // TODO: review - do we need EdgeLink now that we are creating from id only? EdgeLink currentElink = synthesizeLink(h); UiLinkId currentElinkId = uiLinkId(currentElink); if (existing != null) { if (!currentElinkId.equals(existing.id())) { // edge link has changed insertNewUiEdgeLink(currentElinkId); uiHost.setEdgeLinkId(currentElinkId); uiTopology.remove(existing); } } else { // no previously existing edge link insertNewUiEdgeLink(currentElinkId); uiHost.setEdgeLinkId(currentElinkId); } HostLocation hloc = h.location(); uiHost.setLocation(hloc.deviceId(), hloc.port()); }
Example 2
Source File: TopologyViewMessageHandlerBase.java From onos with Apache License 2.0 | 5 votes |
protected ObjectNode hostMessage(HostEvent event) { Host host = event.subject(); Host prevHost = event.prevSubject(); String hostType = host.annotations().value(AnnotationKeys.UI_TYPE); String ip = ip(host.ipAddresses()); ObjectNode payload = objectNode() .put("id", host.id().toString()) .put("type", isNullOrEmpty(hostType) ? "endstation" : hostType); // set most recent connect point (and previous if we know it) payload.set("cp", hostConnect(host.location())); if (prevHost != null && prevHost.location() != null) { payload.set("prevCp", hostConnect(prevHost.location())); } // set ALL connect points addAllCps(host.locations(), payload); payload.set("labels", labels(nameForHost(host), ip, host.mac().toString(), "")); payload.set("props", props(host.annotations())); BasicHostConfig cfg = get(NetworkConfigService.class) .getConfig(host.id(), BasicHostConfig.class); if (!addLocation(cfg, payload)) { addMetaUi(host.id().toString(), payload); } String type = HOST_EVENT.get(event.type()); return JsonUtils.envelope(type, payload); }
Example 3
Source File: SimpleFabricForwarding.java From onos with Apache License 2.0 | 5 votes |
protected FilteredConnectPoint buildFilteredConnectedPoint(Host host) { Objects.requireNonNull(host); TrafficSelector.Builder trafficSelector = DefaultTrafficSelector.builder(); if (host.vlan() != null && !host.vlan().equals(VlanId.NONE)) { trafficSelector.matchVlanId(host.vlan()); } return new FilteredConnectPoint(host.location(), trafficSelector.build()); }
Example 4
Source File: VplsIntentUtility.java From onos with Apache License 2.0 | 5 votes |
/** * Builds filtered connected point by a given host. * * @param host the host * @return the filtered connected point of the given host */ static FilteredConnectPoint buildFilteredConnectedPoint(Host host) { requireNonNull(host); TrafficSelector.Builder trafficSelector = DefaultTrafficSelector.builder(); if (host.vlan() != null && !host.vlan().equals(VlanId.NONE)) { trafficSelector.matchVlanId(host.vlan()); } return new FilteredConnectPoint(host.location(), trafficSelector.build()); }
Example 5
Source File: VplsNeighbourHandlerTest.java From onos with Apache License 2.0 | 5 votes |
/** * Generates broadcast request message context by given source host. * * @param host the source host * @return the request message context */ private TestMessageContext makeBroadcastRequestContext(Host host) { return new TestMessageContext(host.location(), host.mac(), MacAddress.BROADCAST, host.vlan(), NeighbourMessageType.REQUEST); }
Example 6
Source File: VplsNeighbourHandlerTest.java From onos with Apache License 2.0 | 5 votes |
/** * Generates reply message context by given source and destination host. * * @param src the source host * @param dst the destination host * @return the reply message context */ private TestMessageContext makeReplyContext(Host src, Host dst) { return new TestMessageContext(src.location(), src.mac(), dst.mac(), src.vlan(), NeighbourMessageType.REPLY); }
Example 7
Source File: AbstractPathService.java From onos with Apache License 2.0 | 5 votes |
private EdgeLink getEdgeLink(ElementId elementId, boolean isIngress) { if (elementId instanceof HostId) { // Resolve the host, return null. Host host = hostService.getHost((HostId) elementId); if (host == null) { return null; } return new DefaultEdgeLink(PID, new ConnectPoint(elementId, P0), host.location(), isIngress); } return NOT_HOST; }
Example 8
Source File: TopologyViewMessageHandlerBase.java From onos with Apache License 2.0 | 4 votes |
private EdgeLink edgeLink(Host host, boolean ingress) { return new DefaultEdgeLink(PID, new ConnectPoint(host.id(), portNumber(0)), host.location(), ingress); }
Example 9
Source File: ReactiveRoutingFib.java From onos with Apache License 2.0 | 4 votes |
@Override public void setUpConnectivityHostToHost(IpAddress dstIpAddress, IpAddress srcIpAddress, MacAddress srcMacAddress, ConnectPoint srcConnectPoint) { checkNotNull(dstIpAddress); checkNotNull(srcIpAddress); checkNotNull(srcMacAddress); checkNotNull(srcConnectPoint); IpPrefix srcIpPrefix = srcIpAddress.toIpPrefix(); IpPrefix dstIpPrefix = dstIpAddress.toIpPrefix(); ConnectPoint dstConnectPoint = null; MacAddress dstMacAddress = null; for (Host host : hostService.getHostsByIp(dstIpAddress)) { if (host.mac() != null) { dstMacAddress = host.mac(); dstConnectPoint = host.location(); break; } } if (dstMacAddress == null) { hostService.startMonitoringIp(dstIpAddress); return; } // // Handle intent from source host to destination host // MultiPointToSinglePointIntent srcToDstIntent = hostToHostIntentGenerator(dstIpAddress, dstConnectPoint, dstMacAddress, srcConnectPoint); submitReactiveIntent(dstIpPrefix, srcToDstIntent); // // Handle intent from destination host to source host // // Since we proactively handle the intent from destination host to // source host, we should check whether there is an exiting intent // first. if (mp2pIntentExists(srcIpPrefix)) { updateExistingMp2pIntent(srcIpPrefix, dstConnectPoint); return; } else { // There is no existing intent, create a new one. MultiPointToSinglePointIntent dstToSrcIntent = hostToHostIntentGenerator(srcIpAddress, srcConnectPoint, srcMacAddress, dstConnectPoint); submitReactiveIntent(srcIpPrefix, dstToSrcIntent); } }
Example 10
Source File: MaoRoutingManager.java From ONOS_LoadBalance_Routing_Forward with Apache License 2.0 | 2 votes |
/** * Generate EdgeLink which is between Host and Device. * Tool for getLoadBalancePaths(). * * @param host * @param isIngress whether it is Ingress to Device or not. * @return */ private EdgeLink getEdgeLink(Host host, boolean isIngress) { return new DefaultEdgeLink(routeProviderId, new ConnectPoint(host.id(), PortNumber.portNumber(0)), host.location(), isIngress); }
Example 11
Source File: TopologySimulator.java From onos with Apache License 2.0 | 2 votes |
/** * Produces a host description from the given host. * * @param host host to copy * @return host description */ static DefaultHostDescription description(Host host) { return new DefaultHostDescription(host.mac(), host.vlan(), host.location(), host.ipAddresses()); }
Example 12
Source File: NextHopData.java From onos with Apache License 2.0 | 2 votes |
/** * Creates a new instance from a host. * * @param host Host information * @return NextHopData instance */ public static NextHopData fromHost(Host host) { return new NextHopData(host.mac(), host.location()); }