简体   繁体   English

Cisco NSO Yang 包成功加载,但它的运行状态仍然下降

[英]Cisco NSO Yang packages succeed to load but it's oper-status remains down

Does anybody ever played with Cisco NSO (it is basically a YANG/XML model issue, no need to be NSO expert)?有没有人玩过 Cisco NSO(基本上是 YANG/XML model 问题,无需成为 NSO 专家)? If yes, thanks for any help about this issue:如果是,感谢您对此问题的任何帮助:

I am developping a new Yang model using Cisco NSO tools.我正在使用 Cisco NSO 工具开发新的 Yang model。 Find here the Yang model:在这里找到杨 model:

  module snmpTemp1 {
  namespace "http://com/example/snmpTemp1";
  prefix snmpTemp1;

  import ietf-inet-types {
    prefix inet;
  }

  import tailf-ncs {
    prefix ncs;
  }

  import tailf-common {
    prefix tailf;
  }

  list snmpTemp1 {
    key comm-str;

    uses ncs:service-data;
    ncs:servicepoint "snmpTemp1";

    leaf comm-str {
    tailf:info "snmp-server community-string";
      type string;
    }

    // may replace this with other ways of refering to the devices.
    leaf device {
    tailf:info "Pick any one of the IOS device";
      type leafref {
        path "/ncs:devices/ncs:device/ncs:name";
      }
    }

    // replace with your own stuff here
    leaf access {
    tailf:info "Specify RO or RW";
      type enumeration {
        enum ro;
        enum rw;
      }
    }
  }
}

When I try to load this package, I get an error:当我尝试加载此 package 时,出现错误:

admin@ncs# show packages package snmpTemp1
packages package snmpTemp1
 package-version 1.0
 description     "Template-based snmpTemp1 resource facing service"
 ncs-min-version [ 5.3 ]
 directory       ./state/packages-in-use/1/snmpTemp1
 oper-status file-load-error
 oper-status error-info "snmpTemp1-template.xml:2 Unknown servicepoint: snmpTemp1"
admin@ncs#

It seems there is an issue between Yang and XML model: Find here an extract of the XML:杨和 XML model 之间似乎存在问题:在这里找到 XML 的摘录:

<config-template xmlns="http://tail-f.com/ns/config/1.0"
                 servicepoint="snmpTemp1">
  <devices xmlns="http://tail-f.com/ns/ncs">
    <device>
      <!--
          Select the devices from some data structure in the service
          model. In this skeleton the devices are specified in a leaf-list.
          Select all devices in that leaf-list:
      -->
      <name>{/device}</name>
      <config>
        <!--
            Add device-specific parameters here.
            In this skeleton the service has a leaf "dummy"; use that
            to set something on the device e.g.:
            <ip-address-on-device>{/dummy}</ip-address-on-device>
        -->
        <snmp-server xmlns="urn:ios">
          <community>
            <name>{/comm-str}</name>
            <RO when="{starts-with(access, 'ro')}"/>
            <RW when="{starts-with(access, 'rw')}"/>
          </community>
        </snmp-server>
      </config>
    </device>
  </devices>
</config-template>

Does anybody ever played with Cisco NSO (it is basically a YANG/XML model issue, no need to be NSO expert)?有没有人玩过 Cisco NSO(基本上是 YANG/XML model 问题,无需成为 NSO 专家)? If yes, thanks for any help.如果是,感谢您的帮助。

Regards.问候。

Generally this kind of error happen if you does not run the make of package before reload NSO.如果您在重新加载 NSO 之前没有运行 package 的品牌,通常会发生这种错误。

Note that you must compile your package even if is a pure yang+template without any service java/python logic.请注意,您必须编译您的 package,即使是没有任何服务 java/python 逻辑的纯 yang+模板。

In addition this kind of error happens if you modify the service point after package creation, because this breaks the consistency of C-DB另外如果在package创建修改服务点会出现这种错误,因为这破坏了C-DB的一致性

In your XML template, there is service point also mentioned,just try to remove that service point from XML.在您的 XML 模板中,还提到了服务点,只需尝试从 XML 中删除该服务点。 We no need to add service point in XML Templates.我们无需在 XML 模板中添加服务点。

<config-template xmlns="http://tail-f.com/ns/config/1.0">
  <devices xmlns="http://tail-f.com/ns/ncs">
    <device>
      <!--
          Select the devices from some data structure in the service
          model. In this skeleton the devices are specified in a leaf-list.
          Select all devices in that leaf-list:
      -->
      <name>{device-name}</name>
        <config>
            <interface xmlns="http://tail-f.com/ned/cisco-ios-xr">
              <HundredGigE>
                <id>{interface}</id>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM