Subject: [netmod] ietf-ip and DHCP

From: "Lange, Jeffrey K (GE Energy)" <[email-masked]>
Date: Fri, 27 Jul 2012 13:46:13 +0000

I know in the past there was talk of creating a separate DHCP model.  The more I thought about it, the less it seemed to me like it should be a separate model rather than just some minor changes to the existing ip model.  I have taken a stab at what this modified model would look like.  I borrowed the "configuration-source" grouping from the system model, as it already dealt with getting information from DHCP and/or local config.  I added a simple enable-dhcp Boolean to both the ipv4 and ipv6 containers, as well as a configuration-source.  I also thought that a "dhcp-renew" RPC would be useful as well.  I debated a DHCP release RPC, but figured that just setting "enable-dhcp" to false would serve the same purpose.

If people think that is a valid approach, and is useful, it seems like the duplication of the configuration-source between the system model and the ip model could be eliminated by moving that into some common model.

Here is the changes that I made to accomplish this.

diff --git a/data_model/[email-masked] b/data_model/[email-masked]
index 9a42256..1e4ce06 100644
--- a/data_model/[email-masked]
+++ b/data_model/[email-masked]
@@ -51,12 +51,39 @@ module ietf-ip {
        subnet masks.";
   }
+  identity configuration-source {
+     description "Base for all configuration sources.";
+  }
+
+  identity local-config {
+     base configuration-source;
+     description "Local configuration source.";
+  }
+
+  identity dhcp {
+     base configuration-source;
+     description "DHCP configuration source.";
+  }
+
+  grouping configuration-source {
+    leaf-list configuration-source {
+      ordered-by user;
+      type identityref {
+         base configuration-source;
+      }
+      description
+        "Indicates the ordered list of configuration source(s)
+         that should use for address information.";
+    }
+  }
+
   augment "/if:interfaces/if:interface" {
     description
       "Parameters for configuring IP on interfaces.

        If an interface is not capable of running IP, the server
        must not allow the client to configure these parameters.";
+
     container ipv4 {
       description
         "Parameters for the IPv4 address family.";
@@ -67,6 +94,13 @@ module ietf-ip {
           "Controls if IPv4 is enabled or disabled on this
            interface.";
       }
+      leaf enable-dhcp {
+        type boolean;
+        default "false";
+        description
+          "Controls if the DHCPv4 protocol will be used to obtain an
+           IPv4 Address on this interface.";
+      }
       leaf ip-forwarding {
         type boolean;
         default "false";
@@ -74,6 +108,9 @@ module ietf-ip {
           "Controls if IPv4 packet forwarding is enabled or disabled
            on this interface.";
       }
+
+      uses configuration-source;
+
       list address {
         key "ip";
         description
@@ -119,6 +156,13 @@ module ietf-ip {
           "Controls if IPv6 is enabled or disabled on this
            interface.";
       }
+      leaf enable-dhcp {
+        type boolean;
+        default "false";
+        description
+          "Controls if the DHCPv6 protocol will be used to obtain an
+           IPv6 Address on this interface.";
+      }
       leaf ip-forwarding {
         type boolean;
         default "false";
@@ -129,6 +173,9 @@ module ietf-ip {
           "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
                      Section 6.2.1, IsRouter";
       }
+
+      uses configuration-source;
+
       list address {
         key "ip";
         description
@@ -208,4 +255,21 @@ module ietf-ip {
       }
     }
   }
+
+  rpc dhcp-renew {
+    description
+      "Manually renew the DHCP lease on the specified interface.
+
+       If DHCP is not enabled on the specified interface,then this
+       operation will fail with error-tag 'invalid-value',
+       and error-app-tag value of 'dhcp-disabled'";
+    input {
+      leaf interface {
+        type if:interface-ref;
+        mandatory true;
+        description
+          "The interface who's lease is to be renewed.";
+      }
+    }
+  }
}

-Jeff