No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

S600-E V200R011C10 NETCONF YANG API Reference

This document describes the NETCONF API functions supported by the switch, including the data model and samples.
Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
NTP Management

NTP Management

This section describes the configuration model of the NTP server and provides examples of XML packets.

Data Model

The configuration model file matching NTP is ietf-system.yang and huawei-ntp.yang.

Table 2-68  NTP server configuration

Object

Description

Value Remarks

/ietf-system:system/ntp/enabled

Enables or disables IPv4 NTP and IPv6 NTP.

The value is of the Boolean type:
  • true: enable
  • false: disable

The default value is true.

N/A

/ietf-system:system/ntp/server/transport/udp/address

Indicates the IP address of the NTP server.

The value is a character string:
  • ipv4-address: specifies an IPv4 address in dotted decimal notation.
  • ipv6-address: specifies an IPv6 address, which is a 32-digit hexadecimal number.

N/A

/ietf-system:system/ntp/server/transport/udp/port

Indicates the number of the port that sends NTP unicast packets.

The value is an integer that ranges from 1025 to 65535. The default value is 123.

N/A

/ietf-system:system/ntp/server/transport/association-type

Specifies the switch as an NTP peer or NTP server.

The value is of the enumerated type:
  • server: NTP server
  • peer: NTP peer

Determine whether an IPv4 or IPv6 NTP peer or NTP server is configured based on the configured NTP server address.

/ietf-system:system/ntp/server/transport/iburst

Indicates that the device sends a burst of packets when receiving a response of an unreachable server.

The value is of the Boolean type:
  • true: enable
  • false: disable

The default value is false.

N/A

/ietf-system:system/ntp/server/transport/prefer

Indicates that the remote server is the preferentially selected server.

The value is of the Boolean type:
  • true: indicates that the remote server is specified as the preferentially selected server.
  • false: indicates that the remote server is not specified as the preferentially selected server.

The default value is false.

N/A

/ietf-system:system/huawei-ntp:ntp-server:ipv4-enable

Indicates whether the IPv4 NTP function is enabled.

The value is of the Boolean type:
  • true: enable
  • false: disable

The default value is true.

N/A

/ietf-system:system/huawei-ntp:ntp-server:ipv6-enable

Indicates whether the IPv6 NTP function is enabled.

The value is of the Boolean type:
  • true: enable
  • false: disable

The default value is true.

N/A

/ietf-system:system/ntp/huawei-ntp:source-interface-ipv6

Indicates the source interface through which the switch sends IPv6 NTP packets.

The value is a character string in the format of interface-type interface-number.

N/A

Enabling the NTP Server Function

This section provides a sample of enabling the NTP server function using the edit-config method.

Table 2-69  Enabling the NTP server function

Operation

XPATH

edit-config

/ietf-system:system/huawei-ntp:ntp-server

Data requirement

Table 2-70  Enabling the NTP server function

Item

Data

Description

IPv4 NTP server function

true

Enables the IPv4 NTP server function.

IPv6 NTP server function

false

Disable the IPv6 NTP server function.

Request example

<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>
    <config>
      <sys:system xmlns:sys="urn:ietf:params:xml:ns:yang:ietf-system">
        <huawei-ntp:ntp-server xmlns:huawei-ntp="urn:huawei:params:xml:ns:yang:huawei-ntp">
          <huawei-ntp:ipv4-enable>true</huawei-ntp:ipv4-enable>
          <huawei-ntp:ipv6-enable>false</huawei-ntp:ipv6-enable>
        </huawei-ntp:ntp-server>
      </sys:system>
    </config>
  </edit-config>
</rpc>

Response example

Sample of successful response

<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <ok/>
</rpc-reply>

Sample of failed response

<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-message>parse rpc config error.</error-message>
  </rpc-error>
</rpc-reply>

Configuring NTP

This section provides a sample of configuring NTP using the edit-config method.

Table 2-71  Configuring NTP

Operation

XPATH

edit-config:create

/ietf-system:system/ntp

Data Requirements

Table 2-72  Configuring NTP

Item

Data

Description

NTP status

true

Configure the NTP server.

NTP server name

t1

NTP server address

10.1.1.1

NTP server port number

1025

Specifying the type as NTP server

server

Indicating that the device sends a burst of packets when receiving a response of an unreachable server

true

Specifying the remote server as the preferentially selected server

true

Request Example

<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>
    <config>
      <sys:system xmlns:sys="urn:ietf:params:xml:ns:yang:ietf-system" xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="replace">
        <sys:ntp>
          <sys:enabled>true</sys:enabled>
          <sys:server>
            <sys:name>t1</sys:name>
            <sys:udp>
              <sys:address>10.1.1.1</sys:address>
              <sys:port>1025</sys:port>
            </sys:udp>
            <sys:association-type>server</sys:association-type>
            <sys:iburst>true</sys:iburst>
            <sys:prefer>true</sys:prefer>
          </sys:server>
        </sys:ntp>
      </sys:system>
    </config>
  </edit-config>
</rpc>

Response Example

Sample of successful response

<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="35">
  <ok/>
</rpc-reply>

Sample of failed response

<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="36">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-message>parse rpc config error.</error-message>
  </rpc-error>
</rpc-reply>

Configuring an IPv6 NTP Source Interface

This section provides a sample of configuring an IPv6 NTP source interface using the edit-config method.

Table 2-73  Configuring an IPv6 NTP source interface

Operation

XPATH

edit-config

/ietf-system:system/ntp/huawei-ntp:source-interface-ipv6

Data requirement

Table 2-74  Configuring an IPv6 NTP source interface

Item

Data

Description

Set an IPv6 NTP source interface

Vlanif1

Ensure that this interface exists and has been configured on the device. For details about the configuration, see Configuring Basic Attributes of an Interface.

Request example

<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="6" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>
    <config>
      <sys:system xmlns:sys="urn:ietf:params:xml:ns:yang:ietf-system">
        <sys:ntp>
          <huawei-ntp:source-interface-ipv6 xmlns:huawei-ntp="urn:huawei:params:xml:ns:yang:huawei-ntp">Vlanif1</huawei-ntp:source-interface-ipv6>
        </sys:ntp>
      </sys:system>
    </config>
  </edit-config>
</rpc>

Response example

Sample of successful response

<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <ok/>
</rpc-reply>

Sample of failed response

<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-message>parse rpc config error.</error-message>
  </rpc-error>
</rpc-reply>
Translation
Download
Updated: 2019-10-18

Document ID: EDOC1000178028

Views: 4996

Downloads: 0

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next