module Cisco-IOS-XE-acl { namespace "http://cisco.com/ns/yang/Cisco-IOS-XE-acl"; prefix ios-acl; import Cisco-IOS-XE-types { prefix ios-types; } import Cisco-IOS-XE-native { prefix ios; } import ietf-inet-types { prefix inet; } organization "Cisco Systems, Inc."; contact "Cisco Systems, Inc. Customer Service Postal: 170 W Tasman Drive San Jose, CA 95134 Tel: +1 1800 553-NETS E-mail: cs-yang@cisco.com"; description "Cisco XE Native Access Control List (ACL) Yang model. Copyright (c) 2016 by Cisco Systems, Inc. All rights reserved."; // ========================================================================= // REVISION // ========================================================================= revision 2017-03-22 { description "Initial revision"; } typedef acl-port-type { type union { type uint16; type enumeration { enum "biff"; enum "bootpc"; enum "bootps"; enum "discard"; enum "dnsix"; enum "domain"; enum "echo"; enum "isakmp"; enum "mobile-ip"; enum "nameserver"; enum "netbios-dgm"; enum "netbios-ns"; enum "netbios-ss"; enum "non500-isakmp"; enum "ntp"; enum "pim-auto-rp"; enum "rip"; enum "ripv6"; enum "snmp"; enum "snmptrap"; enum "sunrpc"; enum "syslog"; enum "tacacs"; enum "talk"; enum "tftp"; enum "time"; enum "who"; enum "xdmcp"; enum "bgp"; enum "chargen"; enum "cmd"; enum "connectedapps-plain"; enum "connectedapps-tls"; enum "daytime"; enum "exec"; enum "finger"; enum "ftp"; enum "ftp-data"; enum "gopher"; enum "hostname"; enum "ident"; enum "irc"; enum "klogin"; enum "kshell"; enum "login"; enum "lpd"; enum "msrpc"; enum "nntp"; enum "pop2"; enum "pop3"; enum "smtp"; enum "telnet"; enum "uucp"; enum "whois"; enum "www"; } } } grouping access-list-ip-grouping { container ip { description "Any Internet Protocol"; container host { description "A single source host"; list ipv4-or-hostname { key "ipv4-or-hostname"; leaf ipv4-or-hostname { description "Source address"; type inet:host; } container host { description "A single destination host"; list ipv4-or-hostname { key "ipv4-or-hostname"; leaf ipv4-or-hostname { description "Destination address"; type inet:host; } container dscp { description "Match packets with given dscp value"; leaf dscp-val { type ios-types:dscp-type; } } leaf time-range { description "Time-range entry name"; type string; } container tos { description "Match packets with given TOS value"; leaf range { description "Type of service value"; type uint8 { range "0..15"; } } leaf max-reliability { description "Match packets with max reliable TOS (2)"; type empty; } leaf max-throughput { description "Match packets with max throughput TOS (4)"; type empty; } leaf min-delay { description "Match packets with min delay TOS (8)"; type empty; } leaf min-monetary-cost { description "Match packets with min monetary cost TOS (1)"; type empty; } leaf normal { description "Match packets with normal TOS (0)"; type empty; } } } } } } } } grouping ipv4-acl-icmp-match { choice icmp-msg-choice { case icmp-msg-type-code { leaf msg-type { type uint8; } leaf msg-code { type uint8; } } case named-msg-type-case { leaf named-msg-type { type enumeration { enum "administratively-prohibited"; enum "alternate-address"; enum "conversion-error"; enum "dod-host-prohibited"; enum "dod-net-prohibited"; enum "echo"; enum "echo-reply"; enum "general-parameter-problem"; enum "host-isolated"; enum "host-precedence-unreachable"; enum "host-redirect"; enum "host-tos-redirect"; enum "host-tos-unreachable"; enum "host-unknown"; enum "host-unreachable"; enum "information-reply"; enum "information-request"; enum "mask-reply"; enum "mask-request"; enum "mobile-redirect"; enum "net-redirect"; enum "net-tos-redirect"; enum "net-tos-unreachable"; enum "net-unreachable"; enum "network-unknown"; enum "no-room-for-option"; enum "option-missing"; enum "packet-too-big"; enum "parameter-problem"; enum "port-unreachable"; enum "precedence-unreachable"; enum "protocol-unreachable"; enum "reassembly-timeout"; enum "redirect"; enum "router-advertisement"; enum "router-solicitation"; enum "source-quench"; enum "source-route-failed"; enum "time-exceeded"; enum "timestamp-reply"; enum "timestamp-request"; enum "traceroute"; enum "ttl-exceeded"; enum "unreachable"; } } } } } grouping ipv6-acl-icmp-match { choice icmp_choice { case msg-type-code { leaf msg-type-case { type uint8; } leaf msg-code { type uint8; } } case named-msg-type-case { leaf named-msg-type { type enumeration { enum "beyond-scope"; enum "destination-unreachable"; enum "dhaad-reply"; enum "dhaad-request"; enum "echo-reply"; enum "echo-request"; enum "header"; enum "hop-limit"; enum "mld-query"; enum "mld-reduction"; enum "mld-report"; enum "mpd-advertisement"; enum "mpd-solicitation"; enum "nd-na"; enum "nd-ns"; enum "next-header"; enum "no-admin"; enum "no-route"; enum "packet-too-big"; enum "parameter-option"; enum "parameter-problem"; enum "port-unreachable"; enum "reassembly-timeout"; enum "redirect"; enum "reject-route"; enum "renum-command"; enum "renum-result"; enum "renum-seq-number"; enum "router-advertisement"; enum "router-renumbering"; enum "router-solicitation"; enum "source-policy"; enum "time-exceeded"; enum "unreachable"; } } } } } grouping ipv4-acl-tcp-bit-match { leaf plusack { description "Match on ACK set"; type empty; } leaf plusfin { description "Match on FIN set"; type empty; } leaf pluspsh { description "Match on PSH set"; type empty; } leaf plusrst { description "Match on RST set"; type empty; } leaf plussyn { description "Match on SYN set"; type empty; } leaf plusurg { description "Match on URG set"; type empty; } leaf minusack { description "Match on ACK not set"; type empty; } leaf minusfin { description "Match on FIN not set"; type empty; } leaf minuspsh { description "Match on PSH not set"; type empty; } leaf minusrst { description "Match on RST not set"; type empty; } leaf minussyn { description "Match on SYN not set"; type empty; } leaf minusurg { description "Match on URG not set"; type empty; } } grouping ipv4-acl-tcp-match { container match-all { description "Match if all specified flags are present"; uses ipv4-acl-tcp-bit-match; } container match-any { description "Match if any specified flags is present"; uses ipv4-acl-tcp-bit-match; } } grouping acl-tcp-common-match { leaf ack { description "Match on the ACK bit"; type empty; } leaf fin { description "Match on the FIN bit"; type empty; } leaf psh { description "Match on the PSH bit"; type empty; } leaf rst { description "Match on the RST bit"; type empty; } leaf syn { description "Match on the SYN bit"; type empty; } leaf urg { description "Match on the URG bit"; type empty; } leaf established { description "Match established connections"; type empty; } } grouping ipv4-acl-match-common-attribute { leaf dscp { description "Match packets with given dscp value"; type ios-types:dscp-type; } leaf fragments { description "Check non-initial fragments"; type empty; } leaf log { description "Log matches against this entry"; type empty; } leaf log-input { description "Log matches against this entry, including input interface"; type empty; } leaf option { description "Match packets with given IP Options value"; type union { type uint8; type enumeration { enum "add-ext"; enum "any-options"; enum "com-security"; enum "dps"; enum "encode"; enum "eool"; enum "ext-ip"; enum "ext-security"; enum "finn"; enum "imitd"; enum "lsr"; enum "mtup"; enum "mtur"; enum "no-op"; enum "nsapa"; enum "record-route"; enum "router-alert"; enum "sdb"; enum "security"; enum "ssr"; enum "stream-id"; enum "timestamp"; enum "traceroute"; enum "ump"; enum "visa"; enum "zsu"; } } } leaf precedence { description "Match packets with given precedence value"; type union { type uint8 { range "0..7"; } type enumeration { enum "critical"; enum "flash"; enum "flash-override"; enum "immediate"; enum "internet"; enum "network"; enum "priority"; enum "routine"; } } } leaf time-range { description "Specify a time-range"; type string; } leaf tos { description "Match packets with given TOS value"; type union { type uint8 { range "0..15"; } type enumeration { enum "max-reliability"; enum "max-throughput"; enum "min-delay"; enum "min-monetary-cost"; enum "normal"; } } } container ttl { description "Match packets with given TTL value"; choice ttl-choice { case eq-case { leaf eq { description "Match only packets on a given TTL number"; type uint8; } } case gt-case { leaf gt { description "Match only packets on a given TTL number"; type uint8; } } case lt-case { leaf lt { description "Match only packets on a given TTL number"; type uint8; } } case neq-case { leaf neq { description "Match only packets on a given TTL number"; type uint8; } } case range-case { container range { description "Match only packets in the range of TTLs"; leaf value1 { type uint8; } leaf value2 { type uint8; } } } } } } grouping ipv6-acl-match-common-attribute { leaf auth { description "Match on authentication header"; type empty; } leaf dest-option { description "Destination Option header (all types)"; type empty; } leaf dscp { description "Match packets with given dscp value"; type ios-types:dscp-type; } leaf flow-label { description "Flow label"; type uint32 { range "0..1048575"; } } leaf fragments { description "Check non-initial fragments"; type empty; } leaf hbh { description "Match on hop-by-hop option"; type empty; } leaf log { description "Log matches against this entry"; type empty; } leaf log-input { description "Log matches against this entry, including input"; type empty; } leaf mobility { description "Mobility header (all types)"; type empty; } leaf mobility-type { description "Mobility header with type"; type ios-types:mobility-type; } leaf routing { description "Routing header (all types)"; type empty; } leaf routing-type { description "Routing header with type"; type uint8; } leaf time-range { description "Specify a time-range"; type string; } } grouping ace-log-grouping { leaf log { description "Log matches against this entry"; type empty; } } grouping ipv4-std-ace-grouping { container std-ace { choice source-choice { case ipv4-prefix-case { leaf ipv4-prefix { type ios-types:ipv4-host; } leaf mask { type inet:ipv4-address; } } case any-case { leaf any { description "Any source prefix"; type empty; } } case host-case { leaf host { description "A single source host"; type ios-types:ipv4-host; } } } uses ace-log-grouping; } } grouping ipv4-acl-src-dst-addr-port-grouping { choice source-choice { case ipv4-prefix-case { leaf ipv4-address { mandatory true; type inet:ipv4-address; } leaf mask { mandatory true; type inet:ipv4-address; } } case any-case { leaf any { description "Any source host"; type empty; } } case host-case { leaf host { description "A single source host"; type ios-types:ipv4-host; } } case object-group-case { leaf object-group { description "Source network object group"; type string; } } } choice src-port-choice { case src-eq-case { leaf src-eq { description "Match only packets on a given port number"; type acl-port-type; } } case src-gt-case { leaf src-gt { description "Match only packets with a greater port number"; type acl-port-type; } } case src-lt-case { leaf src-lt { description "Match only packets with a lower port number"; type acl-port-type; } } case src-neq-case { leaf src-neq { description "Match only packets not on a given port number"; type acl-port-type; } } case src-range-case { leaf src-range1 { description "Match only packets in the range of port numbers"; type acl-port-type; } leaf src-range2 { description "Match only packets in the range of port numbers"; type acl-port-type; } } } choice destination-choice { case ipv4-prefix-case { leaf dest-ipv4-address { mandatory true; type inet:ipv4-address; } leaf dest-mask { mandatory true; type inet:ipv4-address; } } case any-case { leaf dst-any { description "Any destination host"; type empty; } } case host-case { leaf dst-host { description "A single destination host"; type ios-types:ipv4-host; } } case object-group-case { leaf dst-object-group { description "Destination network object group"; type string; } } } choice dst-port-choice { case dst-eq-case { leaf dst-eq { description "Match only packets on a given port number"; type acl-port-type; } } case dst-gt-case { leaf dst-gt { description "Match only packets with a greater port number"; type acl-port-type; } } case dst-lt-case { leaf dst-lt { description "Match only packets with a lower port number"; type acl-port-type; } } case dst-neq-case { leaf dst-neq { description "Match only packets not on a given port number"; type acl-port-type; } } case dst-range-case { leaf dst-range1 { description "Match only packets in the range of port numbers"; type acl-port-type; } leaf dst-range2 { description "Match only packets in the range of port numbers"; type acl-port-type; } } } } grouping ipv6-acl-src-dst-addr-port-grouping { choice source-choice { case host-case { leaf source-host { type ios-types:ip-host; } } case address-case { leaf source-address { type inet:ipv6-address; } leaf source-wildcard-bits { type inet:ipv6-address; } } case prefix-case { leaf source-prefix { type inet:ipv6-prefix; } } case any-case { leaf any { type empty; } } } choice src-port-choice { case src-eq-case { leaf src-eq { description "Match only packets on a given port number"; type acl-port-type; } } case src-gt-case { leaf src-gt { description "Match only packets with a greater port number"; type acl-port-type; } } case src-lt-case { leaf src-lt { description "Match only packets with a lower port number"; type acl-port-type; } } case src-neq-case { leaf src-neq { description "Match only packets not on a given port number"; type acl-port-type; } } case src-range-case { leaf src-range1 { description "Match only packets in the range of port numbers"; type acl-port-type; } leaf src-range2 { description "Match only packets in the range of port numbers"; type acl-port-type; } } } choice destination-choice { case host-case { leaf destination-host { type ios-types:ip-host; } } case address-case { leaf destination-address { type inet:ipv6-address; } leaf destination-wildcard-bits { type inet:ipv6-address; } } case prefix-case { leaf destination-prefix { type inet:ipv6-prefix; } } case any-case { leaf destination-any { type empty; } } } choice dst-port-choice { case dst-eq-case { leaf dst-eq { description "Match only packets on a given port number"; type acl-port-type; } } case dst-gt-case { leaf dst-gt { description "Match only packets with a greater port number"; type acl-port-type; } } case dst-lt-case { leaf dst-lt { description "Match only packets with a lower port number"; type acl-port-type; } } case dst-neq-case { leaf dst-neq { description "Match only packets not on a given port number"; type acl-port-type; } } case dst-range-case { leaf dst-range1 { description "Match only packets in the range of port numbers"; type acl-port-type; } leaf dst-range2 { description "Match only packets in the range of port numbers"; type acl-port-type; } } } } grouping acl-remark-grouping { leaf remark { description "Access list entry comment"; type string { length "1..100"; } } } grouping ipv6-acl-grouping { list access-list-seq-rule { ordered-by user; key "sequence"; leaf sequence { description "Sequence number for this entry"; type uint64 { range "1..4294967294"; } } container ace-rule { leaf action { type enumeration { enum deny; enum permit; } } leaf protocol { type union { type uint8 { range "0..255"; } type enumeration { enum ahp; enum esp; enum hbh; enum icmp; enum ipv6; enum pcp; enum sctp; enum tcp; enum udp; } } } uses ipv6-acl-src-dst-addr-port-grouping; uses ipv6-acl-match-common-attribute; uses acl-tcp-common-match; uses ipv6-acl-icmp-match; } uses acl-remark-grouping; } } grouping ipv4-std-acl-grouping { list access-list-seq-rule { key "sequence"; leaf sequence { type uint64 { range "1..2147483647"; } } choice deny-permit { container deny { description "Specify packets to reject"; uses ipv4-std-ace-grouping; } container permit { description "Specify packets to forward"; uses ipv4-std-ace-grouping; } } uses acl-remark-grouping; } } grouping ipv4-ext-acl-grouping { list access-list-seq-rule { key "sequence"; leaf sequence { type uint64 { range "1..2147483647"; } } container ace-rule { leaf action { type enumeration { enum deny; enum permit; } } leaf protocol { type union { type uint8 { range "0..255"; } type enumeration { enum ahp; enum eigrp; enum esp; enum gre; enum icmp; enum igmp; enum ip; enum ipinip; enum nos; enum object-group; enum ospf; enum pcp; enum pim; enum tcp; enum udp; } } } leaf object-group-str { description "Service object group name"; type string; } uses ipv4-acl-src-dst-addr-port-grouping; uses ipv4-acl-match-common-attribute; uses ipv4-acl-tcp-match; uses acl-tcp-common-match; uses ipv4-acl-icmp-match; } uses acl-remark-grouping; } } grouping ipv4-role-acl-grouping { list access-list-seq-rule { key "sequence"; leaf sequence { type uint64 { range "1..2147483647"; } } container ace-rule { leaf action { type enumeration { enum deny; enum permit; } } leaf protocol { type union { type uint8 { range "0..255"; } type enumeration { enum ahp; enum eigrp; enum esp; enum gre; enum icmp; enum igmp; enum ip; enum ipinip; enum nos; enum object-group; enum ospf; enum pcp; enum pim; enum tcp; enum udp; } } } leaf object-group-str { description "Service object group name"; type string; } uses ipv4-acl-match-common-attribute; uses ipv4-acl-tcp-match; uses acl-tcp-common-match; uses ipv4-acl-icmp-match; } uses acl-remark-grouping; } } grouping config-ipv4-acl-grouping { // ip access-list standard * list standard { description "Standard Access List"; key "name"; leaf name { type ios-types:std-acl-type; } uses ipv4-std-acl-grouping; container default { description "Set a command to its defaults"; uses ipv4-std-acl-grouping; } } // ipv4 access-list role-based list role-based { description "Role-based Access List"; key "name"; leaf name { type string; } uses ipv4-role-acl-grouping; container default { description "Set a command to its defaults"; uses ipv4-role-acl-grouping; } } // ip access-list extended * list extended { description "Extended Access List"; key "name"; leaf name { type ios-types:ext-acl-type; } uses ipv4-ext-acl-grouping; container default { description "Set a command to its defaults"; uses ipv4-ext-acl-grouping; } } // ip access-list helper container helper { description "Access List acts on helper-address"; leaf egress { description "Outbound"; type empty; } leaf check { description "Enable filtering on helper-address destined"; type empty; } } //ip access-list log-update container log-update { description "Control access list log updates"; leaf threshold { description "Set access-list logging threshold"; type uint64 { range "0..2147483647"; } } } //ip access-list logging container logging { description "Control access list logging"; leaf hash-generation { description "Enable syslog hash code generation"; type empty; } leaf interval { description "Set access list logging interval"; type uint64 { range "0..2147483647"; } } } //ip access-list match-local-traffic leaf match-local-traffic { description "Enable ACL matching for locally generated traffic"; type empty; } //ip access-list persistent leaf persistent { description "enable persistency across reload"; type empty; } //ip access-list resequence container resequence { description "Resequence Access List"; leaf numbers { type union { type ios-types:std-acl-type; type ios-types:ext-acl-type; } } leaf start-seq-no { type uint64 { range "1..2147483647"; } } leaf step-seq-no { type uint64 { range "1..2147483647"; } } } } grouping config-ipv6-acl-grouping { list named-acl { key "name"; leaf name { type string; } uses ipv6-acl-grouping; container default { description "Set a command to its defaults"; uses ipv6-acl-grouping; } } // ipv6 role-based access-list list named-rb-acl { key "name"; leaf name { type string; } leaf role-based { description "Role-based Access List"; type empty; } uses ipv6-acl-grouping; container default { description "Set a command to its defaults"; uses ipv6-acl-grouping; } } container log-update { description "Control access list log updates"; leaf threshold { description "Set access-list logging threshold"; type uint64 { range "0..2147483647"; } } } leaf match-local-traffic { description "Match locally-generated traffic"; type empty; } } //access-list grouping config-access-list-grouping { list access-list-standard-range { key "listnumber"; leaf listnumber { type uint16 { range "1..99"; } } list std-access-list-rule { ordered-by user; key "rule"; leaf rule { type string; } } container permit { description "Specify packets to forward"; list ipv4-or-hostname { key "ipv4-or-hostname"; leaf ipv4-or-hostname { description "Address to match"; type inet:host; } leaf wildcard { description "Wildcard bits"; type inet:ipv4-address; } leaf log { description "Log matches against this entry"; type empty; } } } } // acess-list * list access-list-extended-range { key "listnumber"; leaf listnumber { type uint16 { range "100..199"; } } list ext-access-list-rule { ordered-by user; key "rule"; leaf rule { type string; } } } container hardware { container capture { leaf mode { type enumeration { enum "vlan"; } } } } list access-list-expanded-range { key "IP-extended-range"; leaf IP-extended-range { description "IP extended access list (expanded range)"; type uint16 { range "2000..2699"; } } container permit { description "Specify packets to forward"; uses access-list-ip-grouping; } container deny { description "Specify packets to reject"; uses access-list-ip-grouping; } } } grouping config-mac-access-list-grouping { container access-list { description "Named access-list"; list extended { description "Extended Access List"; key "id"; leaf id { type string; } container deny { description "Specify packets to reject"; container source { choice target-choice { leaf any { description "any source MAC address"; type empty; } leaf host { description "A single source host"; type string; } leaf mac-address { description "48-bit source MAC address"; type string; } } } container dest { choice target-choice { leaf any { description "any destination MAC address"; type empty; } leaf host { description "A single destination host"; type string; } leaf mac-address { description "48-bit destination MAC address"; type string; } } } leaf ethertype { type string; } } container permit { description "Specify packets to forward"; container source { choice target-choice { leaf any { description "any source MAC address"; type empty; } leaf host { description "A single source host"; type string; } leaf mac-address { description "48-bit source MAC address"; type string; } } } container dest { choice target-choice { leaf any { description "any destination MAC address"; type empty; } leaf host { description "A single destination host"; type string; } leaf mac-address { description "48-bit destination MAC address"; type string; } } } leaf ethertype { type string; } } } } } ///////////////////////////////////////////////////////// // native / mac ///////////////////////////////////////////////////////// augment "/ios:native/ios:mac" { uses config-mac-access-list-grouping; } ///////////////////////////////////////////////////////// // native / access-list ///////////////////////////////////////////////////////// augment "/ios:native/ios:access-list" { uses config-access-list-grouping; } ///////////////////////////////////////////////////////// // native / ip / access-list ///////////////////////////////////////////////////////// augment "/ios:native/ios:ip/ios:access-list" { uses config-ipv4-acl-grouping; } ///////////////////////////////////////////////////////// // native / ipv6 / access-list ///////////////////////////////////////////////////////// augment "/ios:native/ios:ipv6/ios:access-list" { uses config-ipv6-acl-grouping; } //augment } //module