當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。