Tomáš Pecka | dac27d4 | 2021-02-22 13:20:05 +0100 | [diff] [blame] | 1 | module czechlight-network { |
| 2 | yang-version 1.1; |
| 3 | namespace "http://czechlight.cesnet.cz/yang/czechlight-network"; |
| 4 | prefix cla-network; |
| 5 | |
| 6 | import ietf-interfaces { |
| 7 | prefix if; |
| 8 | } |
| 9 | |
Tomáš Pecka | 2a4ea7b | 2021-03-30 17:01:37 +0200 | [diff] [blame] | 10 | import ietf-routing { |
| 11 | prefix rt; |
| 12 | } |
| 13 | |
Tomáš Pecka | dac27d4 | 2021-02-22 13:20:05 +0100 | [diff] [blame] | 14 | import ietf-ip { |
| 15 | prefix ip; |
| 16 | } |
| 17 | |
| 18 | import iana-if-type { |
| 19 | prefix ianaift; |
| 20 | } |
| 21 | |
Tomáš Pecka | 2d87fd1 | 2021-05-30 14:20:28 +0200 | [diff] [blame] | 22 | import ietf-ipv6-unicast-routing { |
| 23 | prefix v6ur; |
| 24 | } |
| 25 | |
Tomáš Pecka | dac27d4 | 2021-02-22 13:20:05 +0100 | [diff] [blame] | 26 | revision 2021-02-22 { |
| 27 | description |
| 28 | "Initial version. Removes interface statistics in ietf-interfaces model, removes deprecated container |
| 29 | ietf-interfaces:interface-state and makes the nodes in ietf-interfaces model config false."; |
| 30 | } |
| 31 | |
Tomáš Pecka | 4413129 | 2021-03-10 12:30:43 +0100 | [diff] [blame] | 32 | // We don't support discontinuity time (yet) |
| 33 | deviation /if:interfaces/if:interface/if:statistics/if:discontinuity-time { deviate not-supported; } |
Tomáš Pecka | dac27d4 | 2021-02-22 13:20:05 +0100 | [diff] [blame] | 34 | |
Tomáš Pecka | 2d87fd1 | 2021-05-30 14:20:28 +0200 | [diff] [blame] | 35 | // IPv6 router advertisements is not supported |
| 36 | deviation /if:interfaces/if:interface/ip:ipv6/v6ur:ipv6-router-advertisements { deviate not-supported; } |
| 37 | |
Tomáš Pecka | 2a4ea7b | 2021-03-30 17:01:37 +0200 | [diff] [blame] | 38 | // Remove deprecated ietf-interfaces-state and ietf-routing containers. Beware, rt:routing-state references if:interfaces-state. |
| 39 | deviation /rt:routing-state { deviate not-supported; } |
Tomáš Pecka | dac27d4 | 2021-02-22 13:20:05 +0100 | [diff] [blame] | 40 | deviation /if:interfaces-state { deviate not-supported; } |
| 41 | |
Tomáš Pecka | 71a98b0 | 2021-05-17 15:59:40 +0200 | [diff] [blame] | 42 | // As of now we implement the ietf-routing model to contain operational data only |
Tomáš Pecka | 2a4ea7b | 2021-03-30 17:01:37 +0200 | [diff] [blame] | 43 | deviation /rt:routing { deviate add { config false; } } |
Tomáš Pecka | 14e663e | 2021-03-08 13:35:33 +0100 | [diff] [blame] | 44 | |
Tomáš Pecka | 71a98b0 | 2021-05-17 15:59:40 +0200 | [diff] [blame] | 45 | // We do not support configuring some parts of if:interfaces tree |
Tomáš Pecka | de0ef2f | 2021-07-08 13:23:50 +0200 | [diff] [blame] | 46 | deviation /if:interfaces/if:interface/ip:ipv4/ip:forwarding { deviate add { config false; } } |
| 47 | deviation /if:interfaces/if:interface/ip:ipv4/ip:mtu { deviate add { config false; } } |
| 48 | deviation /if:interfaces/if:interface/ip:ipv4/ip:neighbor { deviate add { config false; } } |
| 49 | deviation /if:interfaces/if:interface/ip:ipv6/ip:forwarding { deviate add { config false; } } |
| 50 | deviation /if:interfaces/if:interface/ip:ipv6/ip:mtu { deviate add { config false; } } |
| 51 | deviation /if:interfaces/if:interface/ip:ipv6/ip:neighbor { deviate add { config false; } } |
| 52 | deviation /if:interfaces/if:interface/ip:ipv6/ip:dup-addr-detect-transmits { deviate add { config false; } } |
Tomáš Pecka | 71a98b0 | 2021-05-17 15:59:40 +0200 | [diff] [blame] | 53 | |
| 54 | // User should not create new links or reconfigure link types |
| 55 | deviation /if:interfaces/if:interface/if:name { |
| 56 | deviate add { |
| 57 | must '. = "br0" or . = "eth0" or . = "eth1" or . = "osc" or . = "oscW" or . = "oscE"' { |
| 58 | error-message "Link name must be chosen from the following options: {br0, eth0, eth1, osc, oscW, oscE}."; |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | deviation /if:interfaces/if:interface/if:type { |
| 64 | deviate add { |
| 65 | must '(../if:name = "br0" and . = "ianaift:bridge") or |
| 66 | (../if:name = "eth0" and . = "ianaift:ethernetCsmacd") or |
| 67 | (../if:name = "eth1" and . = "ianaift:ethernetCsmacd") or |
| 68 | (../if:name = "osc" and . = "ianaift:ethernetCsmacd") or |
| 69 | (../if:name = "oscW" and . = "ianaift:ethernetCsmacd") or |
| 70 | (../if:name = "oscE" and . = "ianaift:ethernetCsmacd")' { |
| 71 | error-message "Link type can't be reconfigured."; |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | |
Tomáš Pecka | c2929a6 | 2021-06-05 17:21:03 +0200 | [diff] [blame] | 76 | augment /if:interfaces/if:interface { |
| 77 | description "Add the option to add this link to a bridge."; |
| 78 | |
| 79 | leaf bridge { |
| 80 | must '. = "br0"' { |
| 81 | error-message "br0 is the only available bridge interface."; |
| 82 | } |
| 83 | |
| 84 | when '(not(../ip:ipv4) or ../ip:ipv4/ip:enabled[.="false"]) and |
| 85 | (not(../ip:ipv6) or ../ip:ipv6/ip:enabled[.="false"])' { |
| 86 | description "IP protocols must be disabled for enslaved link."; |
| 87 | } |
| 88 | |
| 89 | type if:interface-ref; |
| 90 | mandatory false; |
| 91 | description "The name of the bridge to add the link to."; |
| 92 | } |
| 93 | } |
| 94 | |
Tomáš Pecka | de0ef2f | 2021-07-08 13:23:50 +0200 | [diff] [blame] | 95 | // Make it hard to accidentally lose connection by removing ipv4/ipv6 presence containers or all IP addresses |
| 96 | deviation /if:interfaces/if:interface { |
| 97 | deviate add { |
| 98 | must 'if:enabled = "false" or |
| 99 | ip:ipv4/ip:enabled = "true" or |
Tomáš Pecka | c2929a6 | 2021-06-05 17:21:03 +0200 | [diff] [blame] | 100 | ip:ipv6/ip:enabled = "true" or |
| 101 | cla-network:bridge' { |
Tomáš Pecka | de0ef2f | 2021-07-08 13:23:50 +0200 | [diff] [blame] | 102 | error-message "There must always be at least one protocol active unless the interface is disabled."; |
| 103 | } |
Tomáš Pecka | c2929a6 | 2021-06-05 17:21:03 +0200 | [diff] [blame] | 104 | } |
| 105 | } |
Tomáš Pecka | de0ef2f | 2021-07-08 13:23:50 +0200 | [diff] [blame] | 106 | |
Tomáš Pecka | bd43a94 | 2021-08-04 10:12:49 +0200 | [diff] [blame] | 107 | augment /if:interfaces/if:interface/ip:ipv4 { |
| 108 | description "Add the IPv4 autoconfiguration option (DHCP client)."; |
| 109 | |
| 110 | leaf dhcp-client { |
| 111 | type boolean; |
| 112 | default true; |
| 113 | description "Enable DHCP client."; |
| 114 | } |
| 115 | } |
| 116 | |
Tomáš Pecka | de0ef2f | 2021-07-08 13:23:50 +0200 | [diff] [blame] | 117 | deviation /if:interfaces/if:interface/ip:ipv4 { |
| 118 | deviate add { |
Tomáš Pecka | bd43a94 | 2021-08-04 10:12:49 +0200 | [diff] [blame] | 119 | must 'ip:enabled = "false" or count(ip:address) > 0 or cla-network:dhcp-client = "true"' { |
| 120 | error-message "There must always be at least one IPv4 address or the autoconfiguration must be turned on unless the protocol is disabled."; |
Tomáš Pecka | de0ef2f | 2021-07-08 13:23:50 +0200 | [diff] [blame] | 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | deviation /if:interfaces/if:interface/ip:ipv6 { |
| 126 | deviate add { |
Tomáš Pecka | bd43a94 | 2021-08-04 10:12:49 +0200 | [diff] [blame] | 127 | must 'ip:enabled = "false" or count(ip:address) > 0 or ip:autoconf/ip:create-global-addresses = "true"' { |
| 128 | error-message "There must always be at least one IPv6 address or the autoconfiguration must be turned on unless the protocol is disabled."; |
Tomáš Pecka | de0ef2f | 2021-07-08 13:23:50 +0200 | [diff] [blame] | 129 | } |
| 130 | } |
| 131 | } |
| 132 | |
Tomáš Pecka | 91d5fe7 | 2021-03-31 18:42:39 +0200 | [diff] [blame] | 133 | identity dhcp { |
| 134 | base rt:routing-protocol; |
| 135 | description "Identity for route installed by DHCP."; |
| 136 | } |
| 137 | identity ra { |
| 138 | base rt:routing-protocol; |
| 139 | description "Identity for route installed by router advertisement."; |
| 140 | } |
Tomáš Pecka | dac27d4 | 2021-02-22 13:20:05 +0100 | [diff] [blame] | 141 | } |