[netcf-devel] Adding netcf support to FreeBSD
Daniel P. Berrange
berrange at redhat.com
Mon Feb 6 19:30:41 UTC 2012
On Mon, Feb 06, 2012 at 10:47:09AM -0800, hiren panchasara wrote:
> Hi Folks,
>
> I am trying to make netcf work with FreeBSD.
> I am looking for more documentation on xml part of it. (I think augeas is
> used for xml/xslt?)
>
> I can "list" the interfaces but "dumpxml" does not work as I need to
> prepare xml/xsl scaffolding.
>
> Any pointers would be appreciated.
The existing drivers are obviously worth a look, but aside from that
the general architecture is as follows
- Mostly a 3 step transformation
1. NETCF XML -> Augeas tree XML
2. Augeas tree XML -> Augeas object
3. Augest object -> platform config files
- src/drv_{platform}.c the implementation for $platform.
The two most important APIs to be implemented here are:
drv_define - accepts netcf XML and writes out the platform specific
config
drv_xml_desc - reads platform specific config & outputs netcf XML
With the Debian/RedHat/Suse drivers, these two methods use an XSL
transform for doing the hard work in step 1 of the transformation.
data/debian-get.xsl - Converts NetCF XML into Augeas tree XML
used by drv_define
data/debian-put.xsl - Converts Augeas tree XML to NetCF XML
used by drv_xml_desc
Step 2 is done by code in src/drv_debian.c aug_get_xml and
aug_put_xml
Step 3 is done by the Augeas lens.
The tests/interface directory contains many NetCF XML documents
for varying configs.
The tests/debian/schema directory contains corresponding Augeas
XML tree documents.
NB, the debian & Red Hat drivers actually use a slightly different
XML structure for the Augeas XML tree, but the concept is the same.
So for FreeBSD, you would need to
- Make sure Augeas has lens definitions which can parse and write
the FreeBSD config files for networking - this is code that
lives in Augeas
- Create a drv_freebsd.c driver for netcf - best to just copy
the code from either the Red Hat, Debian or Suse driver,
depending on which distro has config files that work most
like FreeBSD (Debian uses a single big file, while Red Hat
uses one file per interface)
- Write data/freebsd-{get,put}.xsl transforms for going between
the NetCF & Augeas XML formats.
- Create test data files in tests/freebsd/schema and then hack
your driver until the tests pass.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the netcf-devel
mailing list