From 32db04accd187b54804e2084c549509a9652d22e Mon Sep 17 00:00:00 2001 From: Rachid Tak Tak Date: Wed, 25 Sep 2024 14:15:35 +0000 Subject: [PATCH 1/2] update to support configuring an option source (intf or address), and configure server by hostname. This also adds network-instance. --- .../relay-agent/openconfig-relay-agent.yang | 146 +++++++++++++++++- 1 file changed, 145 insertions(+), 1 deletion(-) diff --git a/release/models/relay-agent/openconfig-relay-agent.yang b/release/models/relay-agent/openconfig-relay-agent.yang index 22889af66..b3446b2ee 100644 --- a/release/models/relay-agent/openconfig-relay-agent.yang +++ b/release/models/relay-agent/openconfig-relay-agent.yang @@ -10,8 +10,10 @@ module openconfig-relay-agent { // import some basic types import ietf-inet-types { prefix inet; } import ietf-yang-types { prefix yang; } + import openconfig-network-instance { prefix oc-ni; } import openconfig-interfaces { prefix oc-if; } import openconfig-extensions { prefix oc-ext; } + import openconfig-inet-types { prefix oc-inet; } // meta @@ -27,7 +29,14 @@ module openconfig-relay-agent { packets. The supports both DHCP and DHCPv6 and device-wide and per-interface settings."; - oc-ext:openconfig-version "0.1.2"; + oc-ext:openconfig-version "0.2.0"; + + revision "2024-09-18" { + description + "Turn helper-address into a keyed list and add attributes for + source and hostname configuration"; + reference "0.2.0"; + } revision "2023-02-06" { description @@ -624,6 +633,62 @@ module openconfig-relay-agent { } + grouping relay-agent-ipv4-helper-address-config { + description + "Configuration options for an IP helper-address"; + + leaf address { + type oc-inet:host; + description + "IP address to relay DHCP requests to"; + } + + leaf local-address { + type union { + type inet:ipv4-address; + type oc-if:interface-id; + } + description + "IP address or interface whose IP address is to be used as source in + relayed DHCP requests"; + } + + leaf network-instance { + type oc-ni:network-instance-ref; + description + "The network instance that this DHCP Server + is associated with"; + } + } + + grouping relay-agent-ipv6-helper-address-config { + description + "Configuration options for an IPv6 helper-address"; + + leaf address { + type oc-inet:host; + description + "IPv6 address to relay DHCPv6 requests to"; + } + + leaf local-address { + type union { + type inet:ipv6-address; + type oc-if:interface-id; + } + description + "IPv6 address or interface whose IPv6 address is to be used as source in + relayed DHCPv6 requests"; + } + + leaf network-instance { + type oc-ni:network-instance-ref; + description + "The network instance that this DHCP Server + is associated with"; + } + } + grouping relay-agent-ipv4-interfaces-config { description "Configuration data for interfaces enabled for relaying"; @@ -644,6 +709,7 @@ module openconfig-relay-agent { leaf-list helper-address { type inet:ip-address; + status deprecated; description "List of IPv4 or IPv6 addresses of DHCP servers to which the relay agent should forward DHCPv4 requests. The relay agent is @@ -651,6 +717,45 @@ module openconfig-relay-agent { server addresses when DHCPv4 relaying is enabled globally, or on the interface."; } + + container helper-addresses { + description + "Enclosing container for helper addresses"; + list helper-address { + key "address"; + description + "List of IPv4 addresses of DHCP servers to which the + relay agent should forward DHCPv4 requests. The relay agent is + expected to forward DHCPv4/BOOTP requests to all listed + server addresses when DHCPv4 relaying is enabled globally, or + on the interface."; + + leaf address { + type leafref { + path "../config/address"; + } + description + "Reference to list key representing IP helper address"; + } + + + container config { + description + "Configuration data for IP helper address"; + + uses relay-agent-ipv4-helper-address-config; + } + + container state { + config false; + + description + "Operational state for IP helper address"; + + uses relay-agent-ipv4-helper-address-config; + } + } + } } grouping relay-agent-ipv4-interfaces-state { @@ -736,6 +841,7 @@ module openconfig-relay-agent { leaf-list helper-address { type inet:ipv6-address; + status deprecated; description "List of IPv6 addresses of DHCP servers to which the relay agent should forward DHCPv6 requests. The relay agent @@ -743,6 +849,44 @@ module openconfig-relay-agent { server addresses when DHCPv6 relaying is enabled globally, or on the interface."; } + + container helper-addresses { + description + "Enclosing container for IPv6 helper addresses"; + list helper-address { + key "address"; + description + "List of IPv6 addresses of DHCP servers to which the + relay agent should forward DHCPv6 requests. The relay agent + is expected to forward DHCPv4/BOOTP requests to all listed + server addresses when DHCPv6 relaying is enabled globally, or + on the interface."; + + leaf address { + type leafref { + path "../config/address"; + } + description + "Reference to list key representing IP helper address"; + } + + container config { + description + "Configuration data for IP helper address"; + + uses relay-agent-ipv6-helper-address-config; + } + + container state { + config false; + + description + "Operational state for IP helper address"; + + uses relay-agent-ipv6-helper-address-config; + } + } + } } grouping relay-agent-ipv6-interfaces-state { From 74733310019828fb3e7309ed7496d6e7df33b761 Mon Sep 17 00:00:00 2001 From: Rachid Tak Tak Date: Tue, 26 Nov 2024 14:11:59 -0800 Subject: [PATCH 2/2] update leaf name and fix lint --- .../relay-agent/openconfig-relay-agent.yang | 169 ++++++++++-------- 1 file changed, 90 insertions(+), 79 deletions(-) diff --git a/release/models/relay-agent/openconfig-relay-agent.yang b/release/models/relay-agent/openconfig-relay-agent.yang index b3446b2ee..221627946 100644 --- a/release/models/relay-agent/openconfig-relay-agent.yang +++ b/release/models/relay-agent/openconfig-relay-agent.yang @@ -643,7 +643,7 @@ module openconfig-relay-agent { "IP address to relay DHCP requests to"; } - leaf local-address { + leaf source-address { type union { type inet:ipv4-address; type oc-if:interface-id; @@ -671,7 +671,7 @@ module openconfig-relay-agent { "IPv6 address to relay DHCPv6 requests to"; } - leaf local-address { + leaf source-address { type union { type inet:ipv6-address; type oc-if:interface-id; @@ -689,6 +689,92 @@ module openconfig-relay-agent { } } + grouping helper-addresses-ipv4-top { + description + "Top-level grouping for DHCPv4 helper-addresses on interfaces"; + + container helper-addresses { + description + "Enclosing container for helper addresses"; + list helper-address { + key "address"; + description + "List of IPv4 addresses of DHCP servers to which the + relay agent should forward DHCPv4 requests. The relay agent is + expected to forward DHCPv4/BOOTP requests to all listed + server addresses when DHCPv4 relaying is enabled globally, or + on the interface."; + + leaf address { + type leafref { + path "../config/address"; + } + description + "Reference to list key representing IP helper address"; + } + + container config { + description + "Configuration data for IP helper address"; + + uses relay-agent-ipv4-helper-address-config; + } + + container state { + config false; + + description + "Operational state for IP helper address"; + + uses relay-agent-ipv4-helper-address-config; + } + } + } + } + + grouping helper-addresses-ipv6-top{ + description + "Top-level grouping for DHCPv4 helper-addresses on interfaces"; + + container helper-addresses { + description + "Enclosing container for IPv6 helper addresses"; + list helper-address { + key "address"; + description + "List of IPv6 addresses of DHCP servers to which the + relay agent should forward DHCPv6 requests. The relay agent + is expected to forward DHCPv4/BOOTP requests to all listed + server addresses when DHCPv6 relaying is enabled globally, or + on the interface."; + + leaf address { + type leafref { + path "../config/address"; + } + description + "Reference to list key representing IP helper address"; + } + + container config { + description + "Configuration data for IP helper address"; + + uses relay-agent-ipv6-helper-address-config; + } + + container state { + config false; + + description + "Operational state for IP helper address"; + + uses relay-agent-ipv6-helper-address-config; + } + } + } + } + grouping relay-agent-ipv4-interfaces-config { description "Configuration data for interfaces enabled for relaying"; @@ -717,45 +803,6 @@ module openconfig-relay-agent { server addresses when DHCPv4 relaying is enabled globally, or on the interface."; } - - container helper-addresses { - description - "Enclosing container for helper addresses"; - list helper-address { - key "address"; - description - "List of IPv4 addresses of DHCP servers to which the - relay agent should forward DHCPv4 requests. The relay agent is - expected to forward DHCPv4/BOOTP requests to all listed - server addresses when DHCPv4 relaying is enabled globally, or - on the interface."; - - leaf address { - type leafref { - path "../config/address"; - } - description - "Reference to list key representing IP helper address"; - } - - - container config { - description - "Configuration data for IP helper address"; - - uses relay-agent-ipv4-helper-address-config; - } - - container state { - config false; - - description - "Operational state for IP helper address"; - - uses relay-agent-ipv4-helper-address-config; - } - } - } } grouping relay-agent-ipv4-interfaces-state { @@ -817,6 +864,7 @@ module openconfig-relay-agent { uses oc-if:interface-ref; uses agent-information-ipv4-interface-top; + uses helper-addresses-ipv4-top; } } } @@ -849,44 +897,6 @@ module openconfig-relay-agent { server addresses when DHCPv6 relaying is enabled globally, or on the interface."; } - - container helper-addresses { - description - "Enclosing container for IPv6 helper addresses"; - list helper-address { - key "address"; - description - "List of IPv6 addresses of DHCP servers to which the - relay agent should forward DHCPv6 requests. The relay agent - is expected to forward DHCPv4/BOOTP requests to all listed - server addresses when DHCPv6 relaying is enabled globally, or - on the interface."; - - leaf address { - type leafref { - path "../config/address"; - } - description - "Reference to list key representing IP helper address"; - } - - container config { - description - "Configuration data for IP helper address"; - - uses relay-agent-ipv6-helper-address-config; - } - - container state { - config false; - - description - "Operational state for IP helper address"; - - uses relay-agent-ipv6-helper-address-config; - } - } - } } grouping relay-agent-ipv6-interfaces-state { @@ -948,6 +958,7 @@ module openconfig-relay-agent { uses oc-if:interface-ref; uses agent-options-ipv6-interface-top; + uses helper-addresses-ipv6-top; } } }