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.
This commit is contained in:
parent
5b558abbf1
commit
70653b23c7
|
@ -1,5 +1,6 @@
|
|||
## Unreleased
|
||||
-
|
||||
- VLAN ids are now integers
|
||||
- Address specifications are now arrays
|
||||
|
||||
## 2016-06-29 1.2.0
|
||||
### Summary
|
||||
|
|
34
README.md
34
README.md
|
@ -1,6 +1,6 @@
|
|||
# Puppet BSD
|
||||
|
||||
[![Puppet Forge](https://img.shields.io/puppetforge/v/zleslie/bsd.svg)]() [![Build Status](https://travis-ci.org/xaque208/puppet-bsd.svg?branch=master)](https://travis-ci.org/xaque208/puppet-bsd)
|
||||
[![Puppet Forge](https://img.shields.io/puppetforge/v/zleslie/bsd.svg)](https://forge.puppet.com/zleslie/bsd) [![Build Status](https://travis-ci.org/xaque208/puppet-bsd.svg?branch=master)](https://travis-ci.org/xaque208/puppet-bsd)
|
||||
|
||||
A Puppet module for managing aspects of BSD. Currently supported are FreeBSD
|
||||
and OpenBSD. In here will be various facts, functions and classes for tuning
|
||||
|
@ -115,7 +115,7 @@ like the following.
|
|||
|
||||
```Puppet
|
||||
bsd::network::interface::vlan { 'vlan100':
|
||||
id => '100',
|
||||
id => 100,
|
||||
device => 'em0',
|
||||
address => ['10.0.0.1/24'],
|
||||
raw_values => ['!/sbin/route add -net 10.10.10.0/24 10.10.0.254',],
|
||||
|
@ -128,7 +128,7 @@ specify the VLAN ID and the device to attach the VLAN to.
|
|||
|
||||
```Puppet
|
||||
bsd::network::interface::vlan { 'vlan100':
|
||||
id => '100',
|
||||
id => 100,
|
||||
device => 'em0',
|
||||
}
|
||||
```
|
||||
|
@ -146,11 +146,11 @@ class { 'bsd::network::carp':
|
|||
}
|
||||
|
||||
bsd::network::interface::carp { "carp0":
|
||||
id => '1',
|
||||
address => ['10.0.0.1/24'],
|
||||
carpdev => 'em0',
|
||||
pass => 'TopSecret',
|
||||
values => ['!/sbin/route add -net 10.10.10.0/24 10.0.0.254',],
|
||||
id => 1,
|
||||
address => ['10.0.0.1/24'],
|
||||
carpdev => 'em0',
|
||||
pass => 'TopSecret',
|
||||
raw_values => ['!/sbin/route add -net 10.10.10.0/24 10.0.0.254',],
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -188,16 +188,16 @@ bsd::network::interface::trunk { "trunk0":
|
|||
}
|
||||
|
||||
bsd::network::interface::vlan { "vlan10":
|
||||
id => '10',
|
||||
id => 10,
|
||||
address => ['10.0.10.1/24'],
|
||||
device => 'trunk0',
|
||||
}
|
||||
|
||||
bsd::network::interface::vlan { "vlan11":
|
||||
id => '11',
|
||||
address => ['10.0.11.1/24'],
|
||||
device => 'trunk0',
|
||||
values => ['!/sbin/route add -net 10.10.10.0/24 10.0.11.254',],
|
||||
id => 11,
|
||||
address => ['10.0.11.1/24'],
|
||||
device => 'trunk0',
|
||||
raw_values => ['!/sbin/route add -net 10.10.10.0/24 10.0.11.254',],
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -208,7 +208,7 @@ defined type.
|
|||
|
||||
```Puppet
|
||||
bsd::network::interface { 'tun0':
|
||||
values => [
|
||||
raw_values => [
|
||||
'up',
|
||||
'!/usr/local/bin/openvpn --daemon'
|
||||
]
|
||||
|
@ -224,7 +224,7 @@ defined type. I.e. an IPv6 via IPv4 tunnel could look like:
|
|||
bsd::network::interface { 'gif0':
|
||||
description => 'IPv6 in IPv4 tunnel',
|
||||
parents => 'em0',
|
||||
values => [
|
||||
raw_values => [
|
||||
'tunnel 1.2.3.4 5.6.7.8',
|
||||
'inet6 alias 2001:470:6c:bbb::2 2001:470:6c:bbb::1 prefixlen 128',
|
||||
'!/sbin/route -n add -inet6 default 2001:470:6c:bbb::1',
|
||||
|
@ -251,7 +251,7 @@ class { 'bsd::network::gre':
|
|||
bsd::network::interface { 'gre0':
|
||||
description => 'Tunnel interface',
|
||||
parents => 'em0',
|
||||
values => [
|
||||
raw_values => [
|
||||
'172.16.0.1 172.16.0.2 netmask 0xffffffff link0 up',
|
||||
'tunnel 1.2.3.4 5.6.7.8',
|
||||
],
|
||||
|
@ -266,7 +266,7 @@ defined type.
|
|||
bsd::network::interface { 'pflow0':
|
||||
description => 'Pflow to collector',
|
||||
parents => 'em0',
|
||||
values => [
|
||||
raw_values => [
|
||||
'flowsrc 1.2.3.4 flowdst 5.6.7.8:1234',
|
||||
'pflowproto 10',
|
||||
],
|
||||
|
|
|
@ -17,6 +17,7 @@ class Hostname_if::Vlan < PuppetX::BSD::PuppetInterface
|
|||
|
||||
options :address
|
||||
multiopts :address
|
||||
integers :id
|
||||
|
||||
configure(config)
|
||||
end
|
||||
|
|
|
@ -7,9 +7,12 @@ require_relative '../../../puppet_x/bsd/rc_conf'
|
|||
class Vlan < Rc_conf
|
||||
|
||||
def initialize(config)
|
||||
validation :device,
|
||||
:id
|
||||
|
||||
options :address
|
||||
multiopts :address
|
||||
validation :device, :id
|
||||
integers :id
|
||||
|
||||
configure(config)
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# Handle the creation and configuration of vlan(4) interfaces.
|
||||
#
|
||||
define bsd::network::interface::vlan (
|
||||
$id,
|
||||
Integer $id,
|
||||
$device,
|
||||
$ensure = 'present',
|
||||
Array $address = [],
|
||||
|
|
|
@ -7,7 +7,7 @@ describe "bsd::network::interface::vlan" do
|
|||
context " a minimal example" do
|
||||
let(:params) {
|
||||
{
|
||||
:id => '1',
|
||||
:id => 1,
|
||||
:device => 'em0',
|
||||
:address => ['10.0.0.1/24'],
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ describe "bsd::network::interface::vlan" do
|
|||
context " a minimal example with multiple addresses" do
|
||||
let(:params) {
|
||||
{
|
||||
:id => '1',
|
||||
:id => 1,
|
||||
:device => 'em0',
|
||||
:address => [ '10.0.0.1/24', '10.0.0.2/32', ],
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ describe "bsd::network::interface::vlan" do
|
|||
context " a bit more extensive example with values set" do
|
||||
let(:params) {
|
||||
{
|
||||
:id => '1',
|
||||
:id => 1,
|
||||
:device => 'em0',
|
||||
:address => ['10.0.0.1/24'],
|
||||
:raw_values => ['!route add -net 10.10.10.0/24 10.0.0.254'],
|
||||
|
@ -59,7 +59,7 @@ describe "bsd::network::interface::vlan" do
|
|||
let(:title) { 'notcorrect0' }
|
||||
let(:params) {
|
||||
{
|
||||
:id => '1',
|
||||
:id => 1,
|
||||
:device => 'em0',
|
||||
:address => ['10.0.0.1/24'],
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ describe "bsd::network::interface::vlan" do
|
|||
context " a minimal example" do
|
||||
let(:params) {
|
||||
{
|
||||
:id => '1',
|
||||
:id => 1,
|
||||
:device => 'em0',
|
||||
:address => ['10.0.0.1/24'],
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ describe 'get_rc_conf_vlan' do
|
|||
"name" => 'vlan1',
|
||||
"description" => "Trees",
|
||||
"device" => 'em0',
|
||||
"id" => '1',
|
||||
"id" => 1,
|
||||
"address" => [
|
||||
'10.0.1.12/24',
|
||||
],
|
||||
|
|
|
@ -6,7 +6,7 @@ describe 'Vlan' do
|
|||
describe 'content' do
|
||||
it 'should support a full example' do
|
||||
c = {
|
||||
:id => '1',
|
||||
:id => 1,
|
||||
:device => 'em0',
|
||||
:address => ['10.0.0.1/24'],
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ describe 'Vlan' do
|
|||
|
||||
it 'should support a partial example' do
|
||||
c = {
|
||||
:id => '1',
|
||||
:id => 1,
|
||||
:device => 'em0',
|
||||
:address => ['10.0.0.1/24'],
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ describe 'Vlan' do
|
|||
|
||||
it 'should support a allow an array of addresses' do
|
||||
c = {
|
||||
:id => '1',
|
||||
:id => 1,
|
||||
:device => 'em0',
|
||||
:address => [
|
||||
'10.0.0.1/24',
|
||||
|
@ -57,7 +57,7 @@ describe 'Vlan' do
|
|||
describe '#values' do
|
||||
it 'should return a list of values for a full example' do
|
||||
c = {
|
||||
:id => '1',
|
||||
:id => 1,
|
||||
:device => 'em0',
|
||||
:address => [
|
||||
'10.0.0.1/24',
|
||||
|
|
|
@ -15,7 +15,7 @@ describe 'Vlan' do
|
|||
|
||||
it "should raise an error if device is missing" do
|
||||
c = {
|
||||
:id => '1',
|
||||
:id => 1,
|
||||
}
|
||||
expect {
|
||||
vlan.new(c).content
|
||||
|
@ -24,7 +24,7 @@ describe 'Vlan' do
|
|||
|
||||
it "should not raise an error if address is missing" do
|
||||
c = {
|
||||
:id => '1',
|
||||
:id => 1,
|
||||
:device => 'em0',
|
||||
}
|
||||
expect {
|
||||
|
@ -34,7 +34,7 @@ describe 'Vlan' do
|
|||
|
||||
it "should not raise an error if address is an empty array" do
|
||||
c = {
|
||||
:id => '1',
|
||||
:id => 1,
|
||||
:device => 'em0',
|
||||
:address => [],
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ describe 'Vlan' do
|
|||
|
||||
it "should not raise an error if address is present" do
|
||||
c = {
|
||||
:id => '1',
|
||||
:id => 1,
|
||||
:device => 'em0',
|
||||
:address => ['10.0.0.0/24'],
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ describe 'Vlan' do
|
|||
|
||||
it "should raise an error when an invalid option is received" do
|
||||
c = {
|
||||
:id => '1',
|
||||
:id => 1,
|
||||
:device => 'em0',
|
||||
:address => ['10.0.0.0/24'],
|
||||
:random => '1',
|
||||
|
@ -72,7 +72,7 @@ describe 'Vlan' do
|
|||
context 'when only a device and a vlan are supplied' do
|
||||
it 'should return the ifconfig string' do
|
||||
c = {
|
||||
:id => '1',
|
||||
:id => 1,
|
||||
:device => 'em0',
|
||||
}
|
||||
wanted = [
|
||||
|
@ -85,7 +85,7 @@ describe 'Vlan' do
|
|||
context 'when a single address is passed' do
|
||||
it 'should return only the vlan string' do
|
||||
c = {
|
||||
:id => '1',
|
||||
:id => 1,
|
||||
:device => 'em0',
|
||||
:address => ['10.0.0.1/24'],
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue