OpenDayLight TSDR Yang 通知收集器问题

问题描述

我们正在尝试在 Magnesium 版本下的 TSDR 项目中使用 yang 通知收集器功能。 几个问题:

  1. TSDR“Yang Notification Collector”是 TSDR 中的一个完整功能吗?它仅在 TSDR 的 master 分支上。我们确实为 ODL Magnesium (Java11) 编译了主版本。

  2. 此功能的构造函数订阅要监听的通知。 我们设置了构造函数来监听来自“NetConf testtool”模拟器的 NETCONF 通知,该模拟器使用适当的 YANG 作为通知。

例如 - 我们试图强制它监听这样的通知:

// Code Change - add specific QNAME for notification to listen on
private static final QName TEST_QNAME = QName.create("urn:ietf:params:xml:ns:netconf:notification:1.0","2008-07-14","onu-presence-state-change").intern();

@Inject
public YangNotificationCollectorLogger(final TsdrCollectorSpiService collectorSPIService,final SchedulerService schedulerService,final DOMSchemaService domSchemaService,final DOMNotificationService notificationService,final NotificationSubscription configuration) {
    super(collectorSPIService,schedulerService,"TSDRYangCollector");
    this.codecFactory = CODEC.getShared(domSchemaService.getGlobalContext());

    // Code Change Force to look for specific notification
    NotificationSubscription newConfiguration = new NotificationSubscriptionBuilder().setNotifications(
        Arrays.asList(new NotificationsBuilder().setNotification(
        TEST_QNAME.toString()).build())).build();

    List<SchemaPath> notificationsToListen = new ArrayList<>();
    // Code Change Force code to look for specific notification.. 
    //Optional.ofNullable(configuration.getNotifications()).orElse(Collections.emptyList()).stream().forEach(
    Optional.ofNullable(newConfiguration.getNotifications()).orElse(Collections.emptyList()).stream().forEach(
        notification -> {
            final SchemaPath notificationToListen =
                    SchemaPath.create(true,QName.create(notification.getNotification()));
            notificationsToListen.add(notificationToListen);
            LOG.info("Registered for notification {}",notificationToListen);
        });

注册完成,ODL karaf.log 显示:

注册通知 AbsoluteSchemaPath{path=[(urn:ietf:params:xml:ns:netconf:notification:1.0?revision=2008-07-14)onu-presence-state-change]}

当模拟器触发通知时,ODL 在 karaf.log 上报告(启用调试)。 这是通知:

<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
    <eventTime>2021-05-21T16:47:00.123Z</eventTime>
    <interfaces-state xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
            <interface>
                    <name>channeltermination.1</name>
                    <channel-termination xmlns="urn:bbf:yang:bbf-xpon">
                       <onu-presence-state-change xmlns="urn:bbf:yang:bbf-xpon-onu-state"/>
                    </channel-termination>
            </interface>
    </interfaces-state>
</notification>

但是,yang 通知管理器无法识别此通知,因此从不调用“onNotification”方法 - 它从不看到通知。上面有什么明显的错误吗?

我们也尝试为“urn:ietf:params:xml:ns:yang:ietf-interfaces”设置通知,但仍然没有运气。 示例 ODL 日志: 2021-05-26T18:32:26,871 |信息 |蓝图扩展器:1 | YangNotificationCollectorLogger | 386 - org.opendaylight.tsdr.yang-notification-collector - 1.11.3 |注册通知 AbsoluteSchemaPath{path=[(urn:ietf:params:xml:ns:yang:ietf-interfaces?revision=2018-02-20)interfaces-state]}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)