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


Java NetconfDeviceOutputEvent类代码示例

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


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

示例1: notify

import org.onosproject.netconf.NetconfDeviceOutputEvent; //导入依赖的package包/类
@Override
public void notify(NetconfDeviceOutputEvent event) {
    Optional<Integer> messageId = event.getMessageID();
    log.debug("messageID {}, waiting replies messageIDs {}", messageId,
            replies.keySet());
    if (!messageId.isPresent()) {
        errorReplies.add(event.getMessagePayload());
        log.error("Device {} sent error reply {}",
                event.getDeviceInfo(), event.getMessagePayload());
        return;
    }
    CompletableFuture<String> completedReply =
            replies.get(messageId.get()); // remove(..)?
    if (completedReply != null) {
        completedReply.complete(event.getMessagePayload());
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:18,代码来源:NetconfSessionMinaImpl.java

示例2: notify

import org.onosproject.netconf.NetconfDeviceOutputEvent; //导入依赖的package包/类
@Override
public void notify(NetconfDeviceOutputEvent event) {
    Optional<Integer> messageId = event.getMessageID();
    log.debug("messageID {}, waiting replies messageIDs {}", messageId,
            replies.keySet());
    if (!messageId.isPresent()) {
        errorReplies.add(event.getMessagePayload());
        log.error("Device {} sent error reply {}",
                event.getDeviceInfo(), event.getMessagePayload());
        return;
    }
    CompletableFuture<String> completedReply =
            replies.get(messageId.get());
    if (completedReply != null) {
        completedReply.complete(event.getMessagePayload());
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:18,代码来源:NetconfSessionImpl.java

示例3: notify

import org.onosproject.netconf.NetconfDeviceOutputEvent; //导入依赖的package包/类
@Override
public void notify(NetconfDeviceOutputEvent event)  {
    Optional<Integer> messageId = event.getMessageID();
    if (!messageId.isPresent()) {
        errorReplies.add(event.getMessagePayload());
        log.error("Device {} sent error reply {}",
                  event.getDeviceInfo(), event.getMessagePayload());
        return;
    }
    CompletableFuture<String> completedReply =
            replies.get(messageId.get());
    completedReply.complete(event.getMessagePayload());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:NetconfSessionImpl.java

示例4: setUp

import org.onosproject.netconf.NetconfDeviceOutputEvent; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    ctrl = new NetconfControllerImpl();
    ctrl.deviceFactory = new TestNetconfDeviceFactory();
    ctrl.cfgService = cfgService;
    ctrl.deviceService = deviceService;
    ctrl.deviceKeyService = deviceKeyService;

    //Creating mock devices
    deviceInfo1 = new NetconfDeviceInfo("device1", "001", IpAddress.valueOf(DEVICE_1_IP), DEVICE_1_PORT);
    deviceInfo2 = new NetconfDeviceInfo("device2", "002", IpAddress.valueOf(DEVICE_2_IP), DEVICE_2_PORT);
    badDeviceInfo3 = new NetconfDeviceInfo("device3", "003", IpAddress.valueOf(BAD_DEVICE_IP), BAD_DEVICE_PORT);
    deviceInfoIpV6 = new NetconfDeviceInfo("deviceIpv6", "004", IpAddress.valueOf(DEVICE_IPV6), IPV6_DEVICE_PORT);

    device1 = new TestNetconfDevice(deviceInfo1);
    deviceId1 = deviceInfo1.getDeviceId();
    device2 = new TestNetconfDevice(deviceInfo2);
    deviceId2 = deviceInfo2.getDeviceId();

    //Adding to the map for testing get device calls.
    Field field1 = ctrl.getClass().getDeclaredField("netconfDeviceMap");
    field1.setAccessible(true);
    reflectedDeviceMap = (Map<DeviceId, NetconfDevice>) field1.get(ctrl);
    reflectedDeviceMap.put(deviceId1, device1);
    reflectedDeviceMap.put(deviceId2, device2);

    //Creating mock events for testing NetconfDeviceOutputEventListener
    Field field2 = ctrl.getClass().getDeclaredField("downListener");
    field2.setAccessible(true);
    reflectedDownListener = (NetconfDeviceOutputEventListener) field2.get(ctrl);

    eventForDeviceInfo1 = new NetconfDeviceOutputEvent(NetconfDeviceOutputEvent.Type.DEVICE_NOTIFICATION, null,
                                                       null, Optional.of(1), deviceInfo1);
    eventForDeviceInfo2 = new NetconfDeviceOutputEvent(NetconfDeviceOutputEvent.Type.DEVICE_UNREGISTERED, null,
                                                       null, Optional.of(2), deviceInfo2);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:37,代码来源:NetconfControllerImplTest.java

示例5: publishEvent

import org.onosproject.netconf.NetconfDeviceOutputEvent; //导入依赖的package包/类
protected void publishEvent(NetconfDeviceOutputEvent event) {
    primaryListeners.forEach(lsnr -> {
        if (lsnr.isRelevant(event)) {
            lsnr.event(event);
        }
    });
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:8,代码来源:NetconfSessionMinaImpl.java

示例6: close

import org.onosproject.netconf.NetconfDeviceOutputEvent; //导入依赖的package包/类
private void close(String deviceReply) {
    log.debug("Netconf device {} socketClosed = true DEVICE_UNREGISTERED {}",
            netconfDeviceInfo, deviceReply);
    NetconfDeviceOutputEvent event = new NetconfDeviceOutputEvent(
            NetconfDeviceOutputEvent.Type.DEVICE_UNREGISTERED,
            null, null, Optional.of(-1), netconfDeviceInfo);
    netconfDeviceEventListeners.forEach(
            listener -> listener.event(event));
    this.interrupt();
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:11,代码来源:NetconfStreamThread.java

示例7: dealWithReply

import org.onosproject.netconf.NetconfDeviceOutputEvent; //导入依赖的package包/类
private void dealWithReply(String deviceReply) {
    if (deviceReply.contains(RPC_REPLY) ||
            deviceReply.contains(RPC_ERROR) ||
            deviceReply.contains(HELLO)) {
        log.debug("Netconf device {} sessionDelegate.notify() DEVICE_REPLY {} {}",
                netconfDeviceInfo, getMsgId(deviceReply), deviceReply);
        NetconfDeviceOutputEvent event = new NetconfDeviceOutputEvent(
                NetconfDeviceOutputEvent.Type.DEVICE_REPLY,
                null, deviceReply, getMsgId(deviceReply), netconfDeviceInfo);
        sessionDelegate.notify(event);
        netconfDeviceEventListeners.forEach(
                listener -> listener.event(event));
    } else if (deviceReply.contains(NOTIFICATION_LABEL)) {
        log.debug("Netconf device {} DEVICE_NOTIFICATION {} {} {}",
                netconfDeviceInfo, enableNotifications,
                getMsgId(deviceReply), deviceReply);
        if (enableNotifications) {
            log.debug("dispatching to {} listeners", netconfDeviceEventListeners.size());
            final String finalDeviceReply = deviceReply;
            netconfDeviceEventListeners.forEach(
                    listener -> listener.event(new NetconfDeviceOutputEvent(
                            NetconfDeviceOutputEvent.Type.DEVICE_NOTIFICATION,
                            null, finalDeviceReply, getMsgId(finalDeviceReply),
                            netconfDeviceInfo)));
        }
    } else {
        log.debug("Error on reply from device {} {}", netconfDeviceInfo, deviceReply);
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:30,代码来源:NetconfStreamThread.java

示例8: isRelevant

import org.onosproject.netconf.NetconfDeviceOutputEvent; //导入依赖的package包/类
@Override
public boolean isRelevant(NetconfDeviceOutputEvent event) {
    return getDevicesMap().containsKey(event.getDeviceInfo().getDeviceId());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:NetconfControllerImpl.java

示例9: isRelevant

import org.onosproject.netconf.NetconfDeviceOutputEvent; //导入依赖的package包/类
@Override
public boolean isRelevant(NetconfDeviceOutputEvent event) {
    return deviceInfo.equals(event.getDeviceInfo());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:NetconfDeviceOutputEventListenerImpl.java

示例10: isRelevant

import org.onosproject.netconf.NetconfDeviceOutputEvent; //导入依赖的package包/类
@Override
public boolean isRelevant(NetconfDeviceOutputEvent event) {
    return event.type() == Type.DEVICE_NOTIFICATION;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:5,代码来源:NetconfSessionMinaImpl.java

示例11: setUp

import org.onosproject.netconf.NetconfDeviceOutputEvent; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    ctrl = new NetconfControllerImpl();
    ctrl.deviceFactory = new TestNetconfDeviceFactory();
    ctrl.cfgService = cfgService;
    ctrl.deviceService = deviceService;
    ctrl.deviceKeyService = deviceKeyService;
    ctrl.netCfgService = netCfgService;
    NetconfControllerImpl.netconfConnectTimeout = NetconfControllerImpl.DEFAULT_CONNECT_TIMEOUT_SECONDS;
    NetconfControllerImpl.netconfIdleTimeout = NetconfControllerImpl.DEFAULT_IDLE_TIMEOUT_SECONDS;
    NetconfControllerImpl.netconfReplyTimeout = NetconfControllerImpl.DEFAULT_REPLY_TIMEOUT_SECONDS;

    //Creating mock devices
    deviceInfo1 = new NetconfDeviceInfo("device1", "001", IpAddress.valueOf(DEVICE_1_IP), DEVICE_1_PORT);
    deviceInfo2 = new NetconfDeviceInfo("device2", "002", IpAddress.valueOf(DEVICE_2_IP), DEVICE_2_PORT);
    deviceInfo2.setSshClientLib(Optional.of(NetconfSshClientLib.ETHZ_SSH2));
    badDeviceInfo3 = new NetconfDeviceInfo("device3", "003", IpAddress.valueOf(BAD_DEVICE_IP), BAD_DEVICE_PORT);
    deviceInfoIpV6 = new NetconfDeviceInfo("deviceIpv6", "004", IpAddress.valueOf(DEVICE_IPV6), IPV6_DEVICE_PORT);

    deviceConfig10Id = DeviceId.deviceId("netconf:" + DEVICE_10_IP + ":" + DEVICE_10_PORT);
    //Create a JSON entry just like Network Config accepts
    ObjectMapper mapper = new ObjectMapper();
    String jsonMessage = "{\n" +
            "  \"ip\":\"" + DEVICE_10_IP + "\",\n" +
            "  \"port\":" + DEVICE_10_PORT + ",\n" +
            "  \"username\":\"" + DEVICE_10_USERNAME + "\",\n" +
            "  \"password\":\"" + DEVICE_10_PASSWORD + "\",\n" +
            "  \"" + NetconfDeviceConfig.CONNECT_TIMEOUT + "\":" + DEVICE_10_CONNECT_TIMEOUT + ",\n" +
            "  \"" + NetconfDeviceConfig.REPLY_TIMEOUT + "\":" + DEVICE_10_REPLY_TIMEOUT + ",\n" +
            "  \"" + NetconfDeviceConfig.IDLE_TIMEOUT + "\":" + DEVICE_10_IDLE_TIMEOUT + ",\n" +
            "  \"" + NetconfDeviceConfig.SSHCLIENT + "\":\"" + NetconfSshClientLib.ETHZ_SSH2.toString() + "\"\n" +
            "}";
    InputStream jsonStream = new ByteArrayInputStream(jsonMessage.getBytes());
    JsonNode jsonNode = mapper.readTree(jsonStream);
    jsonStream.close();
    ConfigApplyDelegate delegate = new MockDelegate();
    deviceConfig10 = new NetconfDeviceConfig();
    deviceConfig10.init(deviceConfig10Id, "netconf", jsonNode, mapper, delegate);

    device1 = new TestNetconfDevice(deviceInfo1);
    deviceId1 = deviceInfo1.getDeviceId();
    device2 = new TestNetconfDevice(deviceInfo2);
    deviceId2 = deviceInfo2.getDeviceId();

    //Adding to the map for testing get device calls.
    Field field1 = ctrl.getClass().getDeclaredField("netconfDeviceMap");
    field1.setAccessible(true);
    reflectedDeviceMap = (Map<DeviceId, NetconfDevice>) field1.get(ctrl);
    reflectedDeviceMap.put(deviceId1, device1);
    reflectedDeviceMap.put(deviceId2, device2);

    //Creating mock events for testing NetconfDeviceOutputEventListener
    Field field2 = ctrl.getClass().getDeclaredField("downListener");
    field2.setAccessible(true);
    reflectedDownListener = (NetconfDeviceOutputEventListener) field2.get(ctrl);

    eventForDeviceInfo1 = new NetconfDeviceOutputEvent(NetconfDeviceOutputEvent.Type.DEVICE_NOTIFICATION, null,
                                                       null, Optional.of(1), deviceInfo1);
    eventForDeviceInfo2 = new NetconfDeviceOutputEvent(NetconfDeviceOutputEvent.Type.DEVICE_UNREGISTERED, null,
                                                       null, Optional.of(2), deviceInfo2);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:62,代码来源:NetconfControllerImplTest.java

示例12: notify

import org.onosproject.netconf.NetconfDeviceOutputEvent; //导入依赖的package包/类
/**
 * Notifies the delegate via the specified event.
 *
 * @param event store generated event
 */
void notify(NetconfDeviceOutputEvent event);
 
开发者ID:shlee89,项目名称:athena,代码行数:7,代码来源:NetconfSessionDelegate.java


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