Add SONiC YANGs for Management Port, Management Interface, Management VRF and NTP. (#7252)

* SONiC YANG model support for Management Port, Management Interface, Management VRF and NTP.
Co-authored-by: Bing Sun <Bing_Sun@dell.com>
This commit is contained in:
bsun-sudo 2021-06-18 11:47:45 -07:00 committed by GitHub
parent be5fc77c2a
commit 14953e452b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 932 additions and 0 deletions

View File

@ -477,6 +477,8 @@ class SonicYangExtMixin:
vValue = list()
for v in value:
vValue.append(_revYangConvert(v))
elif leafDict[key]['type']['@name'] == 'boolean':
vValue = 'true' if value else 'false'
else:
vValue = _revYangConvert(value)

View File

@ -54,6 +54,10 @@ setup(
'./yang-models/sonic-flex_counter.yang',
'./yang-models/sonic-interface.yang',
'./yang-models/sonic-loopback-interface.yang',
'./yang-models/sonic-mgmt_interface.yang',
'./yang-models/sonic-mgmt_port.yang',
'./yang-models/sonic-mgmt_vrf.yang',
'./yang-models/sonic-ntp.yang',
'./yang-models/sonic-nat.yang',
'./yang-models/sonic-port.yang',
'./yang-models/sonic-portchannel.yang',

View File

@ -252,6 +252,49 @@
"port": "Eth18"
}
},
"MGMT_PORT": {
"eth0": {
"alias": "eth0",
"admin_status": "up",
"speed": "1000",
"autoneg": "off",
"description": "Management port",
"mtu": "3500"
}
},
"MGMT_INTERFACE": {
"eth0|10.11.150.11/16": {
"gwaddr": "10.11.0.1"
},
"eth0|fc00:2::32/64": {
"forced_mgmt_routes": [
"10.3.145.14",
"2001:aa:aa::aa",
"10.0.0.100/31",
"10.255.0.0/28"
],
"gwaddr": "fc00:2::1"
}
},
"MGMT_VRF_CONFIG": {
"vrf_global": {
"mgmtVrfEnabled": "true"
}
},
"NTP": {
"global": {
"vrf": "mgmt",
"src_intf": [
"eth0",
"Loopback0"
]
}
},
"NTP_SERVER": {
"0.debian.pool.ntp.org": {},
"23.92.29.245": {},
"2001:aa:aa::aa": {}
},
"PORT": {
"Ethernet0": {
"alias": "Eth1/1",

View File

@ -0,0 +1,23 @@
{
"MGMT_INTERFACE_TEST": {
"desc": "CONFIGURE MANAGEMENT INTERFACE WITH IP AND GW."
},
"MGMT_INTERFACE_WITH_NON_EXIST_PORT": {
"desc": "CONFIGURE MANAGEMENT INTERFACE WITH NON EXIST MGMT PORT.",
"eStrKey": "LeafRef",
"eStr": ["port", "name"]
},
"MGMT_INTERFACE_WITH_WRONG_PORT": {
"desc": "CONFIGURE MANAGEMENT INTERFACE WITH WRONG MGMT PORT.",
"eStrKey": "LeafRef",
"eStr": ["port", "name"]
},
"MGMT_INTERFACE_IPV4_ADDR_WITH_IPV6_GW": {
"desc": "CONFIGURE MANAGEMENT INTERFACE WITH IPV4 ADDRESS BUT IPV6 GW ADDRESS.",
"eStrKey": "Must"
},
"MGMT_INTERFACE_IPV6_ADDR_WITH_IPV4_GW": {
"desc": "CONFIGURE MANAGEMENT INTERFACE WITH IPV6 ADDRESS BUT IPV4 GW ADDRESS.",
"eStrKey": "Must"
}
}

View File

@ -0,0 +1,39 @@
{
"MGMT_PORT_TEST": {
"desc": "LOAD MGMT PORT WITH ALIAS AND ADMIN_STATUS SUCCESSFULLY. VERIFY ADMIN_STATUS",
"eStrKey": "Verify",
"verify": {
"xpath": "/sonic-mgmt_port:sonic-mgmt_port/MGMT_PORT/MGMT_PORT_LIST[name='eth0']/name",
"key": "sonic-mgmt_port:admin_status",
"value": "up"
}
},
"MGMT_PORT_INVALID_NAME_PATTERN": {
"desc": "INCORRECT MANAGEMENT PORT NAME",
"eStrKey": "Pattern",
"eStr": ["eth"]
},
"MGMT_PORT_INVALID_SPEED": {
"desc": "INVALID SPEED",
"eStrKey": "Range",
"eStr": ["10|100|1000"]
},
"MGMT_PORT_INVALID_MTU": {
"desc": "INVALID MTU",
"eStrKey": "Range",
"eStr": "1500..9216"
},
"MGMT_PORT_DEFAULT_MTU": {
"desc": "VALIDATE DEFAULT MTU",
"eStrKey": "Verify",
"verify": {
"xpath": "/sonic-mgmt_port:sonic-mgmt_port/MGMT_PORT/MGMT_PORT_LIST[name='eth0']/name",
"key": "sonic-mgmt_port:mtu",
"value": 1500
}
},
"MGMT_PORT_INVALID_AUTONEG": {
"desc": "INVALID AUTONEG CONFIGURATION",
"eStrKey": "Pattern"
}
}

View File

@ -0,0 +1,8 @@
{
"MGMT_VRF_TEST": {
"desc": "LOAD MGMT VRF TABLE WITH mgmtVrfEnabled SET TO TRUE SUCCESSFULLY."
},
"MGMT_VRF_TEST_WITH_DEFAULT_VALUE": {
"desc": "LOAD MGMT VRF TABLE WITH DEFAULT mgmtVrfEnabled SUCCESSFULLY."
}
}

View File

@ -0,0 +1,62 @@
{
"NTP_SERVER_TEST": {
"desc": "LOAD NTP SERVER TABLE WITH ADDRESS WITH IPV4, IPV6 AND HOST NAME AS NTP SERVERS."
},
"NTP_SERVER_1_NEG_TEST": {
"desc": "LOAD NTP SERVER TABLE WITH EMPTY ADDRESS AS NTP SERVER.",
"eStrKey": "InvalidValue",
"eStr": ["server_address"]
},
"NTP_SERVER_2_NEG_TEST": {
"desc": "LOAD NTP SERVER TABLE WITH INVALID IP ADDRESS AS NTP SERVER.",
"eStrKey": "InvalidValue",
"eStr": ["server_address"]
},
"NTP_SERVER_3_NEG_TEST": {
"desc": "LOAD NTP SERVER TABLE WITH INVALID HOST NAME AS NTP SERVER.",
"eStrKey": "InvalidValue",
"eStr": ["server_address"]
},
"NTP_DEFAULT_VRF_TEST": {
"desc": "CONFIGURE NTP IN DEFAULT VRF."
},
"NTP_MGMT_VRF_TEST": {
"desc": "CONFIGURE NTP IN MGMT VRF."
},
"NTP_MGMT_VRF_INVALID_MGMT_VRF_STATE_TEST": {
"desc": "CONFIGURE NTP IN MGMT VRF WITH MGMT VRF DISABLED SHOULD BE REJECTED.",
"eStrKey": "Must"
},
"NTP_MGMT_VRF_WITH_NOEXIST_MGMT_VRF_TEST": {
"desc": "CONFIGURE NTP IN MGMT VRF WITHOUT MGMT VRF CONFIGURED SHOULD BE REJECTED.",
"eStrKey": "Must"
},
"NTP_VRF_INVALID_NAME": {
"desc": "CONFIGURE NTP IN INVALID VRF.",
"eStrKey": "Pattern",
"eStr": ["mgmt|default"]
},
"NTP_SRC_INTF": {
"desc": "CONFIGURE MULTIPLE INTERFACES AS NTP SOURCE INTERFACE."
},
"NTP_SRC_INTF_WITH_NONEXIST_ETH_PORT": {
"desc": "CONFIGURE NON-EXISTING ETHERNET INTERFACE AS NTP SOURCE INTERFACE.",
"eStrKey": "InvalidValue",
"eStr": ["src"]
},
"NTP_SRC_INTF_WITH_NONEXIST_LOOPBACK_INTF": {
"desc": "CONFIGURE NON-EXISTING LOOPBACK INTERFACE AS NTP SOURCE INTERFACE.",
"eStrKey": "InvalidValue",
"eStr": ["src"]
},
"NTP_SRC_INTF_WITH_NONEXIST_PORTCHANNEL_INTF": {
"desc": "CONFIGURE NON-EXISTING PORTCHANNEL INTERFACE AS NTP SOURCE INTERFACE.",
"eStrKey": "InvalidValue",
"eStr": ["src"]
},
"NTP_SRC_INTF_WITH_NONEXIST_MGMT_INTF": {
"desc": "CONFIGURE NON-EXISTING MGMT INTERFACE AS NTP SOURCE INTERFACE.",
"eStrKey": "InvalidValue",
"eStr": ["src"]
}
}

View File

@ -0,0 +1,114 @@
{
"MGMT_INTERFACE_TEST": {
"sonic-mgmt_port:sonic-mgmt_port": {
"sonic-mgmt_port:MGMT_PORT": {
"MGMT_PORT_LIST": [
{
"name": "eth0"
}
]
}
},
"sonic-mgmt_interface:sonic-mgmt_interface": {
"sonic-mgmt_interface:MGMT_INTERFACE": {
"MGMT_INTERFACE_LIST": [
{
"name": "eth0",
"ip_prefix": "10.11.12.13/16",
"gwaddr": "10.11.12.254"
},
{
"name": "eth0",
"ip_prefix": "2001:aa:aa::aa/64",
"gwaddr": "2001:aa:aa::fe",
"forced_mgmt_routes": [
"10.3.145.14",
"2001:aa:aa::aa",
"10.0.0.100/31",
"10.250.0.8/24"
]
}
]
}
}
},
"MGMT_INTERFACE_WITH_NON_EXIST_PORT": {
"sonic-mgmt_interface:sonic-mgmt_interface": {
"sonic-mgmt_interface:MGMT_INTERFACE": {
"MGMT_INTERFACE_LIST": [
{
"name": "eth0",
"ip_prefix": "2001:aa:aa::aa/64",
"gwaddr": "2001:aa:aa::fe"
}
]
}
}
},
"MGMT_INTERFACE_WITH_WRONG_PORT": {
"sonic-mgmt_port:sonic-mgmt_port": {
"sonic-mgmt_port:MGMT_PORT": {
"MGMT_PORT_LIST": [
{
"name": "eth1"
}
]
}
},
"sonic-mgmt_interface:sonic-mgmt_interface": {
"sonic-mgmt_interface:MGMT_INTERFACE": {
"MGMT_INTERFACE_LIST": [
{
"name": "eth0",
"ip_prefix": "10.11.12.13/16",
"gwaddr": "10.11.12.254"
}
]
}
}
},
"MGMT_INTERFACE_IPV4_ADDR_WITH_IPV6_GW": {
"sonic-mgmt_port:sonic-mgmt_port": {
"sonic-mgmt_port:MGMT_PORT": {
"MGMT_PORT_LIST": [
{
"name": "eth0"
}
]
}
},
"sonic-mgmt_interface:sonic-mgmt_interface": {
"sonic-mgmt_interface:MGMT_INTERFACE": {
"MGMT_INTERFACE_LIST": [
{
"name": "eth0",
"ip_prefix": "10.11.12.13/24",
"gwaddr": "2001:aa:aa::aa"
}
]
}
}
},
"MGMT_INTERFACE_IPV6_ADDR_WITH_IPV4_GW": {
"sonic-mgmt_port:sonic-mgmt_port": {
"sonic-mgmt_port:MGMT_PORT": {
"MGMT_PORT_LIST": [
{
"name": "eth0"
}
]
}
},
"sonic-mgmt_interface:sonic-mgmt_interface": {
"sonic-mgmt_interface:MGMT_INTERFACE": {
"MGMT_INTERFACE_LIST": [
{
"name": "eth0",
"ip_prefix": "2001:aa:aa::aa/64",
"gwaddr": "10.11.12.13"
}
]
}
}
}
}

View File

@ -0,0 +1,77 @@
{
"MGMT_PORT_TEST": {
"sonic-mgmt_port:sonic-mgmt_port": {
"sonic-mgmt_port:MGMT_PORT": {
"MGMT_PORT_LIST": [
{
"alias": "eth0",
"name": "eth0",
"admin_status": "up",
"speed": 100,
"autoneg": "off",
"description": "management interface",
"mtu": 1500
}
]
}
}
},
"MGMT_PORT_INVALID_NAME_PATTERN": {
"sonic-mgmt_port:sonic-mgmt_port": {
"sonic-mgmt_port:MGMT_PORT": {
"MGMT_PORT_LIST": [
{
"name": "ethernet0"
}
]
}
}
},
"MGMT_PORT_INVALID_SPEED": {
"sonic-mgmt_port:sonic-mgmt_port": {
"sonic-mgmt_port:MGMT_PORT": {
"MGMT_PORT_LIST": [
{
"name": "eth0",
"speed": 222
}
]
}
}
},
"MGMT_PORT_INVALID_MTU": {
"sonic-mgmt_port:sonic-mgmt_port": {
"sonic-mgmt_port:MGMT_PORT": {
"MGMT_PORT_LIST": [
{
"name": "eth0",
"mtu": 500
}
]
}
}
},
"MGMT_PORT_DEFAULT_MTU": {
"sonic-mgmt_port:sonic-mgmt_port": {
"sonic-mgmt_port:MGMT_PORT": {
"MGMT_PORT_LIST": [
{
"name": "eth0"
}
]
}
}
},
"MGMT_PORT_INVALID_AUTONEG": {
"sonic-mgmt_port:sonic-mgmt_port": {
"sonic-mgmt_port:MGMT_PORT": {
"MGMT_PORT_LIST": [
{
"name": "eth0",
"autoneg": "true"
}
]
}
}
}
}

View File

@ -0,0 +1,19 @@
{
"MGMT_VRF_TEST": {
"sonic-mgmt_vrf:sonic-mgmt_vrf": {
"sonic-mgmt_vrf:MGMT_VRF_CONFIG": {
"sonic-mgmt_vrf:vrf_global": {
"mgmtVrfEnabled": true
}
}
}
},
"MGMT_VRF_TEST_WITH_DEFAULT_VALUE": {
"sonic-mgmt_vrf:sonic-mgmt_vrf": {
"sonic-mgmt_vrf:MGMT_VRF_CONFIG": {
"sonic-mgmt_vrf:vrf_global": {
}
}
}
}
}

View File

@ -0,0 +1,241 @@
{
"NTP_SERVER_TEST": {
"sonic-ntp:sonic-ntp": {
"sonic-ntp:NTP_SERVER": {
"NTP_SERVER_LIST": [
{
"server_address": "10.11.12.13"
},
{
"server_address": "2001:aa:aa::aa"
},
{
"server_address": "pool.ntp.org"
}
]
}
}
},
"NTP_SERVER_1_NEG_TEST": {
"sonic-ntp:sonic-ntp": {
"sonic-ntp:NTP_SERVER": {
"NTP_SERVER_LIST": [
{
"server_address": ""
}
]
}
}
},
"NTP_SERVER_2_NEG_TEST": {
"sonic-ntp:sonic-ntp": {
"sonic-ntp:NTP_SERVER": {
"NTP_SERVER_LIST": [
{
"server_address": "2001:aa:aa:aa"
}
]
}
}
},
"NTP_SERVER_3_NEG_TEST": {
"sonic-ntp:sonic-ntp": {
"sonic-ntp:NTP_SERVER": {
"NTP_SERVER_LIST": [
{
"server_address": "pool@.ntp.org"
}
]
}
}
},
"NTP_DEFAULT_VRF_1_TEST": {
"sonic-ntp:sonic-ntp": {
"sonic-ntp:NTP": {
"sonic-ntp:global": {
"vrf": "default"
}
}
}
},
"NTP_DEFAULT_VRF_TEST": {
"sonic-ntp:sonic-ntp": {
"sonic-ntp:NTP": {
"sonic-ntp:global": {
"vrf": "default"
}
}
}
},
"NTP_MGMT_VRF_TEST": {
"sonic-ntp:sonic-ntp": {
"sonic-ntp:NTP": {
"sonic-ntp:global": {
"vrf": "mgmt"
}
}
},
"sonic-mgmt_vrf:sonic-mgmt_vrf": {
"sonic-mgmt_vrf:MGMT_VRF_CONFIG": {
"sonic-mgmt_vrf:vrf_global": {
"mgmtVrfEnabled": "true"
}
}
}
},
"NTP_MGMT_VRF_INVALID_MGMT_VRF_STATE_TEST": {
"sonic-ntp:sonic-ntp": {
"sonic-ntp:NTP": {
"sonic-ntp:global": {
"vrf": "mgmt"
}
}
},
"sonic-mgmt_vrf:sonic-mgmt_vrf": {
"sonic-mgmt_vrf:MGMT_VRF_CONFIG": {
"sonic-mgmt_vrf:vrf_global": {
"mgmtVrfEnabled": "false"
}
}
}
},
"NTP_MGMT_VRF_WITH_NOEXIST_MGMT_VRF_TEST": {
"sonic-ntp:sonic-ntp": {
"sonic-ntp:NTP": {
"sonic-ntp:global": {
"vrf": "mgmt"
}
}
}
},
"NTP_VRF_INVALID_NAME": {
"sonic-ntp:sonic-ntp": {
"sonic-ntp:NTP": {
"sonic-ntp:global": {
"vrf": "Vrf_1"
}
}
}
},
"NTP_SRC_INTF": {
"sonic-ntp:sonic-ntp": {
"sonic-ntp:NTP": {
"sonic-ntp:global": {
"src_intf": [
"Ethernet0",
"Loopback100",
"PortChannel10",
"eth0"
]
}
}
},
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000,
"lanes": "65"
}
]
}
},
"sonic-loopback-interface:sonic-loopback-interface": {
"sonic-loopback-interface:LOOPBACK_INTERFACE": {
"LOOPBACK_INTERFACE_LIST": [
{
"name": "Loopback100"
}
]
}
},
"sonic-portchannel:sonic-portchannel": {
"sonic-portchannel:PORTCHANNEL": {
"PORTCHANNEL_LIST": [
{
"admin_status": "up",
"name": "PortChannel10"
}
]
}
},
"sonic-mgmt_port:sonic-mgmt_port": {
"sonic-mgmt_port:MGMT_PORT": {
"MGMT_PORT_LIST": [
{
"name": "eth0"
}
]
}
}
},
"NTP_SRC_INTF_WITH_NONEXIST_ETH_PORT": {
"sonic-ntp:sonic-ntp": {
"sonic-ntp:NTP": {
"sonic-ntp:global": {
"src_intf": [
"Ethernet0"
]
}
}
}
},
"NTP_SRC_INTF_WITH_NONEXIST_LOOPBACK_INTF": {
"sonic-ntp:sonic-ntp": {
"sonic-ntp:NTP": {
"sonic-ntp:global": {
"src_intf": [
"Loopback100"
]
}
}
}
},
"NTP_SRC_INTF_WITH_NONEXIST_PORTCHANNEL_INTF": {
"sonic-ntp:sonic-ntp": {
"sonic-ntp:NTP": {
"sonic-ntp:global": {
"src_intf": [
"PortChannel10"
]
}
}
},
"sonic-portchannel:sonic-portchannel": {
"sonic-portchannel:PORTCHANNEL": {
"PORTCHANNEL_LIST": [
{
"admin_status": "up",
"name": "PortChannel11"
}
]
}
}
},
"NTP_SRC_INTF_WITH_NONEXIST_MGMT_INTF": {
"sonic-ntp:sonic-ntp": {
"sonic-ntp:NTP": {
"sonic-ntp:global": {
"src_intf": [
"eth1"
]
}
}
},
"sonic-mgmt_port:sonic-mgmt_port": {
"sonic-mgmt_port:MGMT_PORT": {
"MGMT_PORT_LIST": [
{
"name": "eth0"
}
]
}
}
}
}

View File

@ -0,0 +1,71 @@
module sonic-mgmt_interface {
yang-version 1.1;
namespace "http://github.com/Azure/sonic-mgmt_interface";
prefix mgmtintf;
import sonic-mgmt_port {
prefix mgmtprt;
}
import ietf-inet-types {
prefix inet;
}
import sonic-types {
prefix stypes;
}
description
"SONiC MANAGEMENT INTERFACE";
revision 2021-04-07 {
description "First revision";
}
container sonic-mgmt_interface {
container MGMT_INTERFACE {
description "MANAGEMENT INTERFACE part of config_db.json";
list MGMT_INTERFACE_LIST {
key "name ip_prefix";
leaf name{
type leafref {
path /mgmtprt:sonic-mgmt_port/mgmtprt:MGMT_PORT/mgmtprt:MGMT_PORT_LIST/mgmtprt:name;
}
}
leaf ip_prefix {
must "(contains(current(), ':') and contains(../gwaddr, ':')) or (contains(current(), '.') and contains(../gwaddr, '.'))";
type stypes:sonic-ip-prefix;
}
leaf gwaddr {
must "(contains(current(), ':') and contains(../ip_prefix, ':')) or (contains(current(), '.') and contains(../ip_prefix, '.'))";
type inet:ip-address;
}
leaf-list forced_mgmt_routes {
type union {
type stypes:sonic-ip-prefix;
type inet:ip-address;
}
description
"This configuration allows addtional routes to be added to default VRF table
or mgmt VRF table, based on if Management VRF is configured.
Details can be found in interfaces.j2.";
}
} /* end of list MGMT_INTERFACE_IPADDR_LIST */
} /* end of container MGMT_INTERFACE */
} /* end of container sonic-mgmt_interface */
} /* end of module sonic-mgmt_interface */

View File

@ -0,0 +1,75 @@
module sonic-mgmt_port {
yang-version 1.1;
namespace "http://github.com/Azure/sonic-mgmt_port";
prefix mgmtprt;
import sonic-types {
prefix stypes;
}
description "MANAGEMENT PORT yang Module for SONiC OS";
revision 2021-04-07 {
description "First Revision";
}
container sonic-mgmt_port {
container MGMT_PORT {
description "MANAGEMENT PORT part of config_db.json";
list MGMT_PORT_LIST {
key "name";
leaf name {
type string {
pattern 'eth([1-3][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[0-9])';
}
}
leaf speed {
type uint16 {
range "10|100|1000";
}
description
"Management port speed in megabytes.";
}
leaf autoneg {
type string {
pattern "on|off";
}
}
leaf alias {
type string;
}
leaf description {
type string;
}
leaf mtu{
type uint16 {
range "1500..9216";
}
default 1500;
}
leaf admin_status {
type stypes:admin_status;
default up;
}
} /* end of list MGMT_PORT_LIST */
} /* end of container MGMT_PORT */
} /* end of container sonic-mgmt_port */
} /* end of module sonic-mgmt_port */

View File

@ -0,0 +1,33 @@
module sonic-mgmt_vrf {
yang-version 1.1;
namespace "http://github.com/Azure/sonic-mgmt_vrf";
prefix mvrf;
description
"SONiC MGMT VRF";
revision 2021-04-07 {
description
"First revision";
}
container sonic-mgmt_vrf {
container MGMT_VRF_CONFIG {
container vrf_global {
leaf mgmtVrfEnabled {
type boolean;
default false;
}
} /* end of container vrf_global */
} /* end of container MGMT_VRF_CONFIG */
} /* end of container sonic-mgmt_vrf */
} /* end of module sonic-mgmt_vrf */

View File

@ -0,0 +1,121 @@
module sonic-ntp {
yang-version 1.1;
namespace "http://github.com/Azure/sonic-system-ntp";
prefix ntp;
import ietf-inet-types {
prefix inet;
}
import sonic-port {
prefix port;
}
import sonic-mgmt_vrf {
prefix mvrf;
}
import sonic-portchannel {
prefix lag;
}
/* comment out sonic-vlan until related build issue is fixed
import sonic-vlan {
prefix vlan;
}
*/
import sonic-loopback-interface {
prefix lo;
}
import sonic-mgmt_port {
prefix mprt;
}
description
"NTP yang Module for SONiC OS";
revision 2021-04-07 {
description
"First revision";
}
container sonic-ntp {
container NTP {
container global {
description "Global NTP part of config_db.json";
leaf-list src_intf {
type union {
type leafref {
path /port:sonic-port/port:PORT/port:PORT_LIST/port:name;
}
type leafref {
path /lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name;
}
/*
type leafref {
path /vlan:sonic-vlan/vlan:VLAN/vlan:VLAN_LIST/vlan:name;
}
*/
type leafref {
path /lo:sonic-loopback-interface/lo:LOOPBACK_INTERFACE/lo:LOOPBACK_INTERFACE_LIST/lo:name;
}
type leafref {
path /mprt:sonic-mgmt_port/mprt:MGMT_PORT/mprt:MGMT_PORT_LIST/mprt:name;
}
}
description
"This is the interface whose IP address is used as the source IP address for
generating NTP traffic. User is required to make sure that the NTP server
is reachable via this IP address and the same IP address is reachable
from the NTP server. The source interface should be in the same VRF as the
VRF NTP is enabled in.";
}
leaf vrf {
must "(current() != 'mgmt') or (/mvrf:sonic-mgmt_vrf/mvrf:MGMT_VRF_CONFIG/mvrf:vrf_global/mvrf:mgmtVrfEnabled = 'true')" {
error-message "Must condition not satisfied. Try enable Management VRF.";
}
type string {
pattern "mgmt|default";
}
description
"NTP can be enabled only in one VRF at a time. In this revision, it is either
default VRF or Management VRF.";
}
} /* end of container global */
} /* end of container NTP */
container NTP_SERVER {
description "NTP SERVER part of config_db.json";
list NTP_SERVER_LIST {
max-elements 10;
description
"Number of upstream NTP servers is discussed at
https://support.ntp.org/bin/view/Support/SelectingOffsiteNTPServers
(5.3.4. Excessive Number of Upstream Time Servers).";
key "server_address";
leaf server_address {
type inet:host;
}
} /* end of list NTP_SERVER_LIST */
} /* end of container NTP_SERVER */
} /* end of container sonic-ntp */
} /* end of module sonic-ntp */