当前位置: 首页>>代码示例>>Java>>正文


Java EdgePortEvent类代码示例

本文整理汇总了Java中org.onosproject.net.edge.EdgePortEvent的典型用法代码示例。如果您正苦于以下问题:Java EdgePortEvent类的具体用法?Java EdgePortEvent怎么用?Java EdgePortEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EdgePortEvent类属于org.onosproject.net.edge包,在下文中一共展示了EdgePortEvent类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processDeviceEvent

import org.onosproject.net.edge.EdgePortEvent; //导入依赖的package包/类
private void processDeviceEvent(DeviceEvent event) {
    //FIXME handle the case where a device is suspended, this may or may not come up
    DeviceEvent.Type type = event.type();
    DeviceId id = event.subject().id();

    if (type == DEVICE_ADDED ||
            type == DEVICE_AVAILABILITY_CHANGED && deviceService.isAvailable(id)) {
        // When device is added or becomes available, add all its ports
        deviceService.getPorts(event.subject().id())
                .forEach(p -> addEdgePort(new ConnectPoint(id, p.number())));
    } else if (type == DEVICE_REMOVED ||
            type == DEVICE_AVAILABILITY_CHANGED && !deviceService.isAvailable(id)) {
        // When device is removed or becomes unavailable, remove all its ports.
        // Note: cannot rely on Device subsystem, ports may be gone.
        Optional.ofNullable(connectionPoints.remove(id))
            .orElse(ImmutableSet.of())
            .forEach(point -> post(new EdgePortEvent(EDGE_PORT_REMOVED, point)));

    } else if (type == DeviceEvent.Type.PORT_ADDED ||
            type == PORT_UPDATED && event.port().isEnabled()) {
        addEdgePort(new ConnectPoint(id, event.port().number()));
    } else if (type == DeviceEvent.Type.PORT_REMOVED ||
            type == PORT_UPDATED && !event.port().isEnabled()) {
        removeEdgePort(new ConnectPoint(id, event.port().number()));
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:27,代码来源:EdgeManager.java

示例2: removeEdgePort

import org.onosproject.net.edge.EdgePortEvent; //导入依赖的package包/类
private void removeEdgePort(ConnectPoint point) {
    // trying to remove edge ports, so we shouldn't check if it's EdgePoint
    if (!point.port().isLogical()) {
        Set<ConnectPoint> set = connectionPoints.get(point.deviceId());
        if (set == null) {
            return;
        }
        if (set.remove(point)) {
            post(new EdgePortEvent(EDGE_PORT_REMOVED, point));
        }
        if (set.isEmpty()) {
            connectionPoints.computeIfPresent(point.deviceId(), (k, v) -> {
                if (v.isEmpty()) {
                    return null;
                } else {
                    return v;
                }
            });
        }
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:22,代码来源:EdgeManager.java

示例3: activate

import org.onosproject.net.edge.EdgePortEvent; //导入依赖的package包/类
@Activate
public void activate() {
    eventDispatcher.addSink(EdgePortEvent.class, listenerRegistry);
    deviceService.addListener(deviceListener);
    linkService.addListener(linkListener);
    loadAllEdgePorts();
    log.info("Started");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:EdgeManager.java

示例4: deactivate

import org.onosproject.net.edge.EdgePortEvent; //导入依赖的package包/类
@Deactivate
public void deactivate() {
    eventDispatcher.removeSink(EdgePortEvent.class);
    deviceService.removeListener(deviceListener);
    linkService.removeListener(linkListener);
    log.info("Stopped");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:EdgeManager.java

示例5: addEdgePort

import org.onosproject.net.edge.EdgePortEvent; //导入依赖的package包/类
private void addEdgePort(ConnectPoint point) {
    if (!topologyService.isInfrastructure(topology, point) && !point.port().isLogical()) {
        Set<ConnectPoint> set = connectionPoints.get(point.deviceId());
        if (set == null) {
            set = Sets.newConcurrentHashSet();
            connectionPoints.put(point.deviceId(), set);
        }
        if (set.add(point)) {
            post(new EdgePortEvent(EDGE_PORT_ADDED, point));
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:EdgeManager.java

示例6: removeEdgePort

import org.onosproject.net.edge.EdgePortEvent; //导入依赖的package包/类
private void removeEdgePort(ConnectPoint point) {
    if (!point.port().isLogical()) {
        Set<ConnectPoint> set = connectionPoints.get(point.deviceId());
        if (set == null) {
            return;
        }
        if (set.remove(point)) {
            post(new EdgePortEvent(EDGE_PORT_REMOVED, point));
        }
        if (set.isEmpty()) {
            connectionPoints.remove(point.deviceId());
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:15,代码来源:EdgeManager.java

示例7: deactivate

import org.onosproject.net.edge.EdgePortEvent; //导入依赖的package包/类
@Deactivate
public void deactivate() {
    deviceService.removeListener(deviceListener);
    linkService.removeListener(linkListener);
    eventDispatcher.removeSink(EdgePortEvent.class);
    log.info("Stopped");
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:8,代码来源:EdgeManager.java

示例8: addEdgePort

import org.onosproject.net.edge.EdgePortEvent; //导入依赖的package包/类
private void addEdgePort(ConnectPoint point) {
    if (isEdgePort(point)) {
        Set<ConnectPoint> set = connectionPoints.computeIfAbsent(point.deviceId(),
                                                                 (k) -> Sets.newConcurrentHashSet());
        if (set.add(point)) {
            post(new EdgePortEvent(EDGE_PORT_ADDED, point));
        }
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:10,代码来源:EdgeManager.java

示例9: TestListener

import org.onosproject.net.edge.EdgePortEvent; //导入依赖的package包/类
public TestListener(List<EdgePortEvent> events) {
    this.events = events;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:4,代码来源:EdgeManagerTest.java


注:本文中的org.onosproject.net.edge.EdgePortEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。