9b59ee0e79
- Why I did it To implement Syslog Source IP feature based on HLD: https://github.com/sonic-net/SONiC/pull/1002 - How I did it Added the relevant yang model - How to verify it Added unit test Signed-off-by: Nazarii Hnydyn <nazariig@nvidia.com>
81 lines
2.1 KiB
YANG
81 lines
2.1 KiB
YANG
module sonic-syslog {
|
|
|
|
yang-version 1.1;
|
|
|
|
namespace "http://github.com/Azure/sonic-system-syslog";
|
|
prefix syslog;
|
|
|
|
import ietf-inet-types {
|
|
prefix inet;
|
|
}
|
|
|
|
import sonic-mgmt_vrf {
|
|
prefix mvrf;
|
|
}
|
|
|
|
import sonic-vrf {
|
|
prefix vrf;
|
|
}
|
|
|
|
description "Syslog YANG Module for SONiC OS: remote syslog logging";
|
|
|
|
revision 2022-04-18 {
|
|
description "Initial revision.";
|
|
}
|
|
|
|
typedef vrf-device {
|
|
description "Represents syslog VRF device";
|
|
type enumeration {
|
|
enum default;
|
|
enum mgmt;
|
|
}
|
|
}
|
|
|
|
container sonic-syslog {
|
|
|
|
container SYSLOG_SERVER {
|
|
|
|
description "SYSLOG_SERVER part of config_db.json";
|
|
|
|
list SYSLOG_SERVER_LIST {
|
|
|
|
key "server_address";
|
|
|
|
leaf server_address {
|
|
description "Syslog server IP address";
|
|
type inet:ip-address;
|
|
}
|
|
|
|
leaf source {
|
|
description "Syslog source IP address";
|
|
type inet:ip-address;
|
|
must "(contains(current(), '.') and contains(../server_address, '.'))
|
|
or (contains(current(), ':') and contains(../server_address, ':'))";
|
|
}
|
|
|
|
leaf port {
|
|
description "Syslog server UDP port";
|
|
type inet:port-number;
|
|
}
|
|
|
|
leaf vrf {
|
|
description "Syslog VRF device";
|
|
type union {
|
|
type leafref {
|
|
path "/vrf:sonic-vrf/vrf:VRF/vrf:VRF_LIST/vrf:name";
|
|
}
|
|
type vrf-device;
|
|
}
|
|
must "(current() != 'mgmt')
|
|
or (/mvrf:sonic-mgmt_vrf/mvrf:MGMT_VRF_CONFIG/mvrf:vrf_global/mvrf:mgmtVrfEnabled = 'true')";
|
|
}
|
|
|
|
}
|
|
/* end of list SYSLOG_SERVER_LIST */
|
|
}
|
|
/* end of container SYSLOG_SERVER */
|
|
}
|
|
/* end of container sonic-syslog */
|
|
}
|
|
/* end of module sonic-syslog */
|