/** * Create an Intent for a bidirectional path with constraints. * * @param key optional intent key * @param src the path source (DPID or hostID) * @param dst the path destination (DPID or hostID) * @param srcPort the source port (-1 if src/dest is a host) * @param dstPort the destination port (-1 if src/dest is a host) * @param bandwidth the bandwidth (mbps) requirement for the path * @param latency the latency (micro sec) requirement for the path * @return the appropriate intent */ private Intent createIntent(Key key, String src, String dst, String srcPort, String dstPort, Long bandwidth, Long latency){
final Constraint constraintBandwidth = new BandwidthConstraint(Bandwidth.mbps(bandwidth)); final Constraint constraintLatency = new LatencyConstraint(Duration.of(latency, ChronoUnit.MICROS)); final List<Constraint> constraints = new LinkedList<>();
一个CORD的实现应用,CORD(Central Office Re-architected as a DataCenter),意为在家庭、公司等网络边界的基础网络设备,实现一个数据中心的服务功能。CORD目前有三种类型:ECORD、RCORD和MCORD,具体的详情可以查看CORD。这个应用给出了一个ECORD的实现方案。这个应用比较全面地展示了ONOS的抽象子系统概念,我们可以从项目的结构看出来。
@Modified publicvoidmodified(ComponentContext context){ log.info("Reloading config..."); // Needs re-registration to DeviceProvider if (loadRpcConfig(context)) { // unregister from Device and Link Providers with old parameters unregisterFromLinkServices(); unregisterFromDeviceProvider(); // register to Device and Link Providers with new parameters try { remoteServiceContext = rpcService.get(URI.create(remoteUri)); providerId = new ProviderId(schemeProp, idProp); registerToDeviceProvider(); registerToLinkServices(); } catch (UnsupportedOperationException e) { log.warn("Unsupported URI: {}", remoteUri); } log.info("Re-registered with Device and Link Providers"); }
// Needs to advertise cross-connect links if (loadRestConfig(context)) { advertiseCrossConnectLinksOnAllPorts(); } }