Improve/fix RFC3442 entries and add tests

- Generate the rfc3442 words using a filter plugin, instead of Jinja
- basic sanity test when running plugin standalone
- Improve testing by creating/binding to a bridge0 interface in
  molecule docker container, then verifying that it's running
- Add ntp option
- multiplatform support

Change-Id: I7c2c3081e8919174dd29b3ab2fdd27b4f6eb843a
diff --git a/templates/dhcpd.conf.j2 b/templates/dhcpd.conf.j2
index bda9bec..3951fe5 100644
--- a/templates/dhcpd.conf.j2
+++ b/templates/dhcpd.conf.j2
@@ -9,7 +9,9 @@
 max-lease-time {{ subnet.max_lease_time | default("480") }};
 
 # option definitions
+{% if ansible_system == "Linux" %}
 option rfc3442-classless-static-routes code 121 = array of integer 8;
+{% endif %}
 
 {% for subnet in dhcpd_subnets %}
 subnet {{ subnet.subnet | ipaddr('network') }} netmask {{ subnet.subnet | ipaddr('netmask') }} {
@@ -18,13 +20,15 @@
 {% if subnet.routers is defined %}
   # custom router IP set
   option routers {{ subnet.routers | map(attribute="ip") | join (",") }};
+{% set r3442ns = namespace(r3442list = []) %}
 {% for rtr in subnet.routers %}
 {% if "rfc3442routes" in rtr %}
-{% for r3442r in rtr.rfc3442routes %}
-  option rfc3442-classless-static-routes {{ r3442r | ipaddr('prefix') }}, {{ r3442r | ipaddr('network') | regex_replace('\.', ', ')}}, {{ rtr.ip | ipaddr('network') | regex_replace('\.', ', ')}};
-{% endfor %}
+{% set r3442ns.r3442list = r3442ns.r3442list + (rtr | rfc3442_words() ) %}
 {% endif %}
 {% endfor %}
+{% if r3442ns.r3442list %}
+  option rfc3442-classless-static-routes {{ r3442ns.r3442list | join(', ') }};
+{% endif %}
 {% else %}
   # first IP address in range used as router
   option routers {{ subnet.subnet | ipaddr('next_usable') }};
@@ -41,7 +45,13 @@
   next-server {{ subnet.tftpd_server }};
 
 {% endif %}
+{% if subnet.ntp_servers is defined %}
+  # ntp options
+  option ntp-servers {{ subnet.ntp_servers | join('", "') }};
+
+{% endif %}
 {% if subnet.range is defined %}
+  # dynamically assignable range
   range {{ subnet.range | ipaddr('next_usable') }} {{ subnet.range | ipaddr('last_usable') }};
 {% endif %}
 }