Commit Graph

45 Commits

Author SHA1 Message Date
R. Tyler Croy 4c32788d45
Use $::osfamily to be consistent with other code, and avoid failing
In rspec-puppet, setting facts isn't doing what I would like it to be doing, so
switching this from a compile error to an info
2017-09-22 21:20:04 -07:00
R. Tyler Croy 55eef69592
Use a more modern fact reference 2017-09-22 20:59:32 -07:00
Zach Leslie d7bf068648 Update examples 2017-09-09 17:36:34 -07:00
Zach Leslie 70653b23c7 Update data types for VLAN id and tidy up README
Here we specify that VLAN id parameters must be integer values and clean
up the tests to reflect this change.
2016-10-03 10:21:33 -07:00
Zach Leslie d10ee590ce Improve core network testing and validation 2016-09-03 13:19:43 -07:00
Zach Leslie 32808178cc Use better namespace
This work updates the library code to utilize the namespace that was
recently put in place.  This helps unify the configuration validation
for all the library code, and ensure consistent data types for options.
  Updates to tests as necessary to accommodate these changes.
2016-08-31 15:59:53 -07:00
Zach Leslie 0b58a4b5a9 Reconfigure the Puppet interface
Here a some updates to move the configuration and validation into a
common PuppetInterface class that will allow easier extensibility, yet
stil put the authority for which config values are optional, required,
exclusive, etc.  Shifts tests for this work, and updates the parameter
names and value type checking on params as well as library code.  Native
Puppet4 defaults, though only type checking at this point.  Drop support
for casing the IPv6 rtsol autoconf on older OpenBSD.  Improves
  readability and testability of code generally.  Renames 'values' to
  'raw_values' everywhere.  The use of 'raw_values' still turns out to
  be useful for cases where network configuration requirements are not
  exposed through the module where users still wish to take advantage of
  the addresses param on the relevant classes.
2016-08-12 22:23:09 -07:00
Zach Leslie 71cbefff08 Directly interface the mtu of an interface
Fixes MTU detection on FreeBSD and surfaces the MTU of an interface to
be managed using the bsd_interface type.  Begin interfacing with
ifconfig to handle the live mtu.
2016-08-12 22:16:31 -07:00
Zach Leslie d2bf7c6ed6 Improve test coverage and update matrix 2016-06-26 18:35:41 -07:00
David Jeffers fc2708f6b1 Borked a value for net.inet6.ip6.forwarding case, fixed 2016-06-16 18:48:54 -04:00
David Jeffers e756d83898 Corrected markdown in README for lagg interface section, updated sysctl values to be set by Puppet Forge Approved (and more recently commited-to) module from hercules-team that also utilizes Augeas, added defaults for case statements missing them 2016-06-16 18:43:03 -04:00
Zach Leslie 6f3b896137 Update module dependencies
This module now has three extra module dependencies, and drops
shell_config as a requirement.  The augeas providers are under active
development, and the providers are growing for a number of other types.
As such, to avoid needing two different modules that fundamentally do
the same thing, this change is my preference.

To update, simply have a look at the new dependencies and install the
needed modules.  If you are currently using shell_config elsewhere in
your environment, there will be no conflict, so you may go about your
day.  If you are not using shell_config elsewhere in your environment,
updating to this module would prove a reasonable time to remove stop
including it on your module list.
2016-05-18 21:53:21 -07:00
Zach Leslie 607217c259 Updates for testability 2016-02-27 11:41:39 -08:00
Sebastian Reitenbach 96f035afc5 Add special defined type for pfsync interfaces
bsd::network::interface::pfsync

This new type makes use of the parent interface of
bsd::network::interface, setting the value of the syncdev
parameter to the parent.

README.md updated, and spec tests added for the new defined
type and the corresponding hostname_if function.

This defined type is a bit special compared to the others,
since, when no parameters given, it explicitly sets the defaults

i.e. just create a pfsync0 interface, without parameters will end
up with a /etc/hostname.pfsync0 with:

-syncdev -syncpeer maxupd 128 -defer
up

What is default anyways is taken from the pfsync manual page.

This has the advantage that interfaces are easier to reconfigure.
Instead of ensuring its absense, and re-creating it, a parameter
can just be removed, and it will be reset to the default value.
2015-10-01 18:36:44 +02:00
Sebastian Reitenbach 94eff578a6 Add a parents parameter to bsd::network::interface. This
can be a string or an array. The value of that parameter
is passed to Bsd_interface.rb when the interface is started.

Add a parents parameter to bsd_interface.rb, and autorequire
the parents. A bit of validation etc. of the interface name
done.

In bsd::network::interface, require the creation of hostname.if
for OpenBSD or the shell_config for FreeBSD to be done before
the Bsd_interface is created.

The subclasses in bsd::network::interface::* where parent interfaces
make sense to set, i.e. bridge, carp, trunk and vlan, deduct the
parent interface based on the interface or device parameter, and
hand that over to the parents parameter of bsd::network::interface.

Specs added for bsd::network::interface::* defined types, and
the parents defined types.

Further added some flesh to the README.md mentioning the interface
ordering and the parents parameter of the bsd::network::interface
defined type.
2015-09-28 09:15:32 +02:00
Sebastian Reitenbach 0d37f5beca Make the hostname_if.rb aware of a new parameter addresses in the config
hash, and process those given IP address information via
PuppetX::BSD::Hostname_if::Inet

Add addresses parameter to manifests::network::interface, and pass it
to get_openbsd_hostname_if_content function

Add a spec test using the addresses parameter in the bsd_network_interface_spec.rb
and update README.md

Add addresses parameter handling for FreeBSD too
Merge values into addresses in FreeBSD case in rc_conf.rb, since
it doesn't seem that other values than IP addresses are evaluated at
all on FreeBSD.

Add deprecation warning to hostname_if.rb if IP address info is set
via values parameter, but no addresses parameter is given.
Bail out, when trying to set IP info via values parameter and an
addresses parameter is given too.
2015-09-17 11:59:10 +02:00
Sebastian Reitenbach c383c2608f Add values parameter to manifests/network/interface/*.pp
in order to allow setting multiple IP addresses and i.e. routes.
Add some examples to README.md and to the spec tests.
2015-09-15 16:51:32 +02:00
Zach Leslie cc8992625a Merge pull request #71 from xaque208/vlanclean
Update variable names and remove needless parens
2015-08-06 22:49:26 -07:00
Zach Leslie 5582abd9c8 Update variable names and remove needless parens 2015-08-06 22:47:50 -07:00
Zach Leslie 4965172e6c Support addresses on trunk interfaces
Without this change, addresses do not get configured correctly on trunk
interfaces.
2015-08-06 22:45:04 -07:00
Zach Leslie 17f4f34a0b Fix bug in vlan addressing on FreeBSD 2015-06-27 13:21:56 -07:00
Zach Leslie 461a2d8950 Implement platform providers for bsd_interface
This enables refresh for the bsd_interface in a platform specific way.
Resources may now use the notify/subscribe meta-params.  If a resource is
notified, the provider will execute the platform specific method for
restarting an interface.
2015-06-27 13:08:02 -07:00
Zach Leslie 0da4cdd5fe Address and test for wifi newline correctness
Updates tests and code to fix issue where newlines were far too few.
2015-02-26 21:40:07 -08:00
Zach Leslie bc4a29833f Update manifests to use ensure param
Ensure on each of the network::interface manifests now manages the state
of the interface.
2015-02-17 07:23:24 -08:00
Sebastian Reitenbach 3b339225b0 Allow wifi interfaces configuration without requiring a network_key,
i.e. allow unencrypted wifi network configuration.

Update specs to reflect that change, add a few more wifi interfaces
I own and reorder them alphabetically. Add a little test.
2015-02-14 08:39:19 +01:00
Zach Leslie 53431118c1 Ensure bridges are bridges and trunks are trunks
Without this, the name of the requested interface is ignored.  It makes
for a better user experience as a user to avoid situations where a user
  tries to manage /etc/hostname.trunk0 as a, say, bridge interface.
  Implement the same logic for vlan and carp interfaces.
2015-02-13 22:00:50 -08:00
Zach Leslie ed4f17d9e1 Add doc for bsd::network::interface define 2015-02-13 20:59:30 -08:00
Zach Leslie 042786ca14 Add initial bridge(4) support
Inclued tests and docs to support a simple bridge interface.
2015-02-13 10:14:43 -08:00
Zach Leslie 857aa4942a Clean up for testability
Simplify some some of the content code for maintainability and
testability.  Add notes for clarity about what is happening and why.
Should result in more consistent files on disk.
2015-02-13 09:04:23 -08:00
Zach Leslie 19b6433318 Merge pull request #33 from buzzdeee/pflow_and_gif
Make gif and pflow interfaces configurable with this module.
2014-12-23 10:13:47 -08:00
Sebastian Reitenbach fa9f10a6a5 Make gif and pflow interfaces configurable with this module.
Enhance gre to allow sysctl configuration of WCCP and MobileIP
related sysctls.

Update README.md, add examples for the new devices, and also
for gre.
2014-12-19 00:26:07 +01:00
Sebastian Reitenbach 0d706871e3 Make the carp interfaces able to handle passwords, update the
spec to test for password option too, and update README.md
and other minor related nits.
2014-12-18 23:48:25 +01:00
Zach Leslie efe1140857 Merge pull request #29 from buzzdeee/master
make the module future parser compatible.
2014-12-18 12:20:26 -08:00
Sebastian Reitenbach 514861c22d make the module future parser compatible, and
make a note into the README, about the ipaddress gem
as a requirement.
2014-12-16 19:50:29 +01:00
Zach Leslie 987a740806 Add fully functional wireless networking support
Add necessary code to create and join wireless networks using wpa.
Edge cases are sure to exist here, though this has been tested on my
home network to create and join a wireless access point on OpenBSD.
2014-12-15 08:28:57 -08:00
Zach Leslie 424bdc12af Include useful things from puppet-module-skeleton
Thanks Gareth!
2014-10-18 15:45:52 -07:00
Zach Leslie 3a5bf8448f Make addressing optional for vlan(4) interfaces
Before this, to create a vlan interface, the user had to specify at
least one IP address.  This is not actually a hard requirement.  As
such, the updates here reflect the fact that addresses on vlan(4)
interfaces are optional.

Here also adds support for FreeBSD vlan(4) interfaces, which has lagged
behind the OpenBSD support.

In here are also some improvements on the tests, and syntax deprecation
cleaning.
2014-09-28 13:36:02 -07:00
Zach Leslie cdff20db11 Implement state management for vlan interfaces 2014-03-29 12:17:08 -07:00
Zach Leslie 008edcc124 Begin to handle interface state
Previously, we relied on the specific implementation of an interface to
append either 'up' or 'down' to the interface configuration.  This
became hard to work with because all of the logic for the interface
configuration was no longer in one place.  This was a problem because we
would set the interface state before we were finished working with the
content of the file.

This code begins to support setting an interface state on the main
bsd::interface type and appends the values after the file text is built.

This is only supported on a selection of interface drivers, so we
default to undef here and expect that if the value is set, it will only
be either a string of 'up' or 'down'.
2014-03-29 12:12:57 -07:00
Zach Leslie ce34fc9b6a Begin importing FreeBSD interface management
This work converts the implementation for FreeBSD network interface
management in the puppet-freebsd module into ruby and imported into this
module.

Now the bsd::network::interface has a mostly consistent interface
between freebsd and openbsd.  There are small items that may need
adjusting, so still not ready for primetime until the api interface
solidifies, but its getting there.
2014-02-06 20:46:05 -08:00
Zach Leslie b846ebefa9 Ensure a newline exists for each interface config
For some reason it seems that a newline is required for some of the
interfaces to come up when executed by /etc/netstart.  This code ensures
that the implementation of bsd::network::interface for openbsd will
append a newline to the config files.
2014-01-30 12:53:06 -08:00
Zach Leslie 916da63b51 Implement carp, trunk and vlan virtual interfaces
This code adds the ability to create the following virtual interfaces:

* trunk
* carp
* vlan
2014-01-25 16:53:35 -08:00
Zach Leslie a2d69c618a (feat) Begin virtual interface management
The following begins the work needed to flush out the virtual interfaces
that OpenBSD supports.

The first is, CARP.  We beign with a a wrapper class
bsd::network::interface::carp that has the needed paramaters.  We chew
on the inputs, before we spit out the ifconfig lines that we can pass to
the bsd::network::interface define to create the carp interface.  Works
like a charm.

Next up is the GRE interface managemnt.  We just piggy back on the
bsd::network::interface type here, and enable GRE when its needed.  I
expec that this interface will change in the future.  Ideally, pass in
the needed values similar to how the carp interface is done.  For now
this works, and is worth commiting.  Example has been inclued in the
tests/ directory.

Sysctl classes for enablement of each of the above has been included.

Add some basic testing for the above as well.
2014-01-07 16:03:46 -08:00
Zach Leslie 3f65a962b2 (feat) Add basic network management
Add initial bsd::network configuration, importing logic from the
freebsd::network.  Manages the forwarding and gateway functionality.
2014-01-02 10:35:40 -08:00
Zach Leslie 4b7e4d7451 (feature) Initial code for hostname_if(5) mgmt
This code begins the management of the OpenBSD /etc/hostname.if
configuration files.
2013-12-21 11:08:37 -08:00