Skip to content

Commit

Permalink
update IPv4 addresses in spec tests arista-eosplus#154
Browse files Browse the repository at this point in the history
  • Loading branch information
Florin Vinti committed Oct 3, 2016
1 parent 01beff9 commit 22870dd
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 40 deletions.
43 changes: 22 additions & 21 deletions spec/system/rbeapi/api/prefixlists_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
describe '#get' do
before do
node.config(['no ip prefix-list test1',
'ip prefix-list test1 seq 10 permit 1.2.3.0/24',
'ip prefix-list test1 seq 20 permit 2.3.4.0/24 le 30',
'ip prefix-list test1 seq 30 deny 3.4.5.0/24 ge 26 le 30',
'ip prefix-list test1 permit 5.6.7.16/28 eq 29'])
'ip prefix-list test1 seq 10 permit 10.10.1.0/24',
'ip prefix-list test1 seq 20 permit 10.20.1.0/24 le 30',
'ip prefix-list test1 seq 30 deny 10.30.1.0/24 ge 26 le 30',
'ip prefix-list test1 permit 10.40.1.16/28 eq 29'])
end

let(:prefixlist) { subject.get('test1') }
Expand All @@ -74,22 +74,22 @@
{
'seq' => '10',
'action' => 'permit',
'prefix' => '1.2.3.0/24'
'prefix' => '10.10.1.0/24'
},
{
'seq' => '20',
'action' => 'permit',
'prefix' => '2.3.4.0/24 le 30'
'prefix' => '10.20.1.0/24 le 30'
},
{
'seq' => '30',
'action' => 'deny',
'prefix' => '3.4.5.0/24 ge 26 le 30'
'prefix' => '10.30.1.0/24 ge 26 le 30'
},
{
'seq' => '40',
'action' => 'permit',
'prefix' => '5.6.7.16/28 eq 29'
'prefix' => '10.40.1.16/28 eq 29'
}
]
end
Expand All @@ -106,10 +106,10 @@

before do
node.config(del_pref_lists +
['ip prefix-list test1 seq 10 permit 1.2.3.0/24',
'ip prefix-list test1 seq 20 permit 2.3.4.0/24 le 30',
'ip prefix-list test1 seq 30 deny 3.4.5.0/24 ge 26 le 30',
'ip prefix-list test1 permit 5.6.7.8/28',
['ip prefix-list test1 seq 10 permit 10.10.1.0/24',
'ip prefix-list test1 seq 20 permit 10.20.1.0/24 le 30',
'ip prefix-list test1 seq 30 deny 10.30.1.0/24 ge 26 le 30',
'ip prefix-list test1 permit 10.40.1.8/28',
'ip prefix-list test2 seq 10 permit 10.11.0.0/16',
'ip prefix-list test2 seq 20 permit 10.12.0.0/16 le 24',
'ip prefix-list test3 permit 10.13.0.0/16'])
Expand Down Expand Up @@ -145,25 +145,26 @@
describe '#add_rule' do
before do
node.config(['no ip prefix-list test5',
'ip prefix-list test5'])
'no ip prefix-list test6',
'ip prefix-list test5'])
end

it 'adds rule to an existing prefix list' do
expect(subject.get('test5')).to eq([])
expect(subject.add_rule('test5', 'permit', '1.1.1.0/24')).to be_truthy
expect(subject.add_rule('test5', 'permit', '10.50.1.0/24')).to be_truthy
expect(subject.get('test5')).to eq([{
"seq" => "10",
"action" => "permit",
"prefix" => "1.1.1.0/24"}])
"prefix" => "10.50.1.0/24"}])
end

it 'adds rule to a non-existent prefix list' do
expect(subject.get('test6')).to eq(nil)
expect(subject.add_rule('test6', 'deny', '2.2.2.0/24')).to be_truthy
expect(subject.add_rule('test6', 'deny', '10.60.1.0/24')).to be_truthy
expect(subject.get('test6')).to eq([{
"seq" => "10",
"action" => "deny",
"prefix" => "2.2.2.0/24"}])
"prefix" => "10.60.1.0/24"}])
end
end

Expand All @@ -172,10 +173,10 @@
node.config(['no ip prefix-list test7',
'no ip prefix-list test8',
'ip prefix-list test7',
'seq 10 permit 7.7.0.0/16',
'seq 10 permit 10.70.0.0/16',
'ip prefix-list test8',
'seq 10 permit 8.8.0.0/16',
'deny 9.9.0.0/16 le 24'])
'seq 10 permit 10.80.0.0/16',
'deny 10.82.0.0/16 le 24'])
end

it 'delets a prefix list' do
Expand All @@ -191,4 +192,4 @@
expect(subject.get('test8')[1]).to eq(nil)
end
end
end
end
32 changes: 16 additions & 16 deletions spec/unit/rbeapi/api/prefixlists/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ def prefixlists
[{
'seq' => '10',
'action' => 'permit',
'prefix' => '1.2.3.0/24'
'prefix' => '10.10.1.0/24'
},
{
'seq' => '20',
'action' => 'permit',
'prefix' => '2.3.4.0/24 le 30'
'prefix' => '10.20.1.0/24 le 30'
},
{
'seq' => '30',
'action' => 'permit',
'prefix' => '3.4.5.0/24 ge 26 le 30'
'prefix' => '10.30.1.0/24 ge 26 le 30'
}]
end

Expand Down Expand Up @@ -106,17 +106,17 @@ def prefixlists
{
"seq" => "10",
"action" => "permit",
"prefix" => "1.2.3.0/24"
"prefix" => "10.10.1.0/24"
},
{
"seq" => "20",
"action" => "permit",
"prefix" => "2.3.4.0/24 le 30"
"prefix" => "10.20.1.0/24 le 30"
},
{
"seq" => "30",
"action" => "permit",
"prefix" => "3.4.5.0/24 ge 26 le 30"
"prefix" => "10.30.1.0/24 ge 26 le 30"
}
],
"test2" => [
Expand Down Expand Up @@ -169,28 +169,28 @@ def prefixlists

describe '#add_rule' do
it 'adds rule to existing prefix list' do
expect(node).to receive(:config).with('ip prefix-list test1 seq 25 permit 9.8.7.0/24')
expect(subject.add_rule('test1', 'permit','9.8.7.0/24', '25')).to be_truthy
expect(node).to receive(:config).with('ip prefix-list test1 seq 25 permit 10.25.1.0/24')
expect(subject.add_rule('test1', 'permit','10.25.1.0/24', '25')).to be_truthy
end

it 'adds rule to existing prefix list w/o seq' do
expect(node).to receive(:config).with('ip prefix-list test1 permit 8.7.6.0/24')
expect(subject.add_rule('test1', 'permit', '8.7.6.0/24')).to be_truthy
expect(node).to receive(:config).with('ip prefix-list test1 permit 10.25.2.0/24')
expect(subject.add_rule('test1', 'permit', '10.25.2.0/24')).to be_truthy
end

it 'adds rule to non-existing prefix list' do
expect(node).to receive(:config).with('ip prefix-list plist2 seq 10 permit 6.5.4.128/25')
expect(subject.add_rule('plist2', 'permit', '6.5.4.128/25', '10')).to be_truthy
expect(node).to receive(:config).with('ip prefix-list plist2 seq 10 permit 10.25.3.128/25')
expect(subject.add_rule('plist2', 'permit', '10.25.3.128/25', '10')).to be_truthy
end

it 'adds rule to non-existing prefix list w/o seq' do
expect(node).to receive(:config).with('ip prefix-list plist2 deny 5.4.3.0/25')
expect(subject.add_rule('plist2', 'deny', '5.4.3.0/25')).to be_truthy
expect(node).to receive(:config).with('ip prefix-list plist2 deny 10.25.10.0/25')
expect(subject.add_rule('plist2', 'deny', '10.25.10.0/25')).to be_truthy
end

it 'overwrites existing rule' do
expect(node).to receive(:config).with('ip prefix-list test1 seq 20 permit 2.3.5.0/24 le 28')
expect(subject.add_rule('test1', 'permit', '2.3.5.0/24 le 28', '20')).to be_truthy
expect(node).to receive(:config).with('ip prefix-list test1 seq 20 permit 10.25.20.0/24 le 28')
expect(subject.add_rule('test1', 'permit', '10.25.20.0/24 le 28', '20')).to be_truthy
end
end

Expand Down
6 changes: 3 additions & 3 deletions spec/unit/rbeapi/api/prefixlists/fixture_prefixlists.text
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ip prefix-list test1
seq 10 permit 1.2.3.0/24
seq 20 permit 2.3.4.0/24 le 30
seq 30 permit 3.4.5.0/24 ge 26 le 30
seq 10 permit 10.10.1.0/24
seq 20 permit 10.20.1.0/24 le 30
seq 30 permit 10.30.1.0/24 ge 26 le 30
!
ip prefix-list test2
seq 10 permit 10.11.0.0/16
Expand Down

0 comments on commit 22870dd

Please sign in to comment.