Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from mchf/master
Ported and refactored patch from Code-11-SP2
- Loading branch information
Showing
11 changed files
with
118 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.0.7 | ||
3.0.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
# Makefile.am for yast2/library/network | ||
# | ||
|
||
SUBDIRS = doc src testsuite | ||
SUBDIRS = doc src testsuite test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
TESTS = load_ipv6_cfg_test.rb | ||
TEST_EXTENSIONS = .rb | ||
RB_LOG_COMPILER = ruby | ||
VERBOSE = 1 | ||
EXTRA_DIST = $(TESTS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#! /usr/bin/env ruby | ||
|
||
require "minitest/spec" | ||
require "minitest/autorun" | ||
|
||
require "yast" | ||
|
||
Yast.import "NetworkInterfaces" | ||
|
||
# mocked IPv6 relevant part of loaded ifcfg | ||
IPV6_IFCFG = [ | ||
{ | ||
:data => { "IPADDR" => "2001:15c0:668e::5", "PREFIXLEN" => "48" }, | ||
:expected => { "IPADDR" => "2001:15c0:668e::5", "PREFIXLEN" => "48", "NETMASK" => "" } | ||
}, | ||
{ | ||
:data => { "IPADDR" => "2001:15c0:668e::5/48", "PREFIXLEN" => "" }, | ||
:expected => { "IPADDR" => "2001:15c0:668e::5", "PREFIXLEN" => "48", "NETMASK" => "" } | ||
}, | ||
{ | ||
:data => { "IPADDR" => "2a00:8a00:6000:40::451", "PREFIXLEN" => "119" }, | ||
:expected => { "IPADDR" => "2a00:8a00:6000:40::451", "PREFIXLEN" => "119", "NETMASK" => "" } | ||
} | ||
] | ||
|
||
describe "When reading devices configuration with IPv6 setup" do | ||
it "Sets ipaddr, prefix and empty mask" do | ||
IPV6_IFCFG.each do |ipv6_ifcfg| | ||
canonical_ifcfg = Yast::NetworkInterfaces.CanonicalizeIP( ipv6_ifcfg[ :data]) | ||
canonical_ifcfg.must_equal( ipv6_ifcfg[ :expected]) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#! /usr/bin/env ruby | ||
|
||
require "minitest/spec" | ||
require "minitest/autorun" | ||
|
||
require "yast" | ||
|
||
Yast.import "Netmask" | ||
|
||
describe "When creating netmask from prefixlen" do | ||
it "returns valid netmask for prefix shorter than 32 bits" do | ||
0.upto 32 do |prefix_len| | ||
Yast::Netmask.FromBits( prefix_len).wont_be_empty | ||
end | ||
end | ||
|
||
it "returns empty netmask for prefix longer than 32 bits" do | ||
33.upto 128 do |prefix_len| | ||
Yast::Netmask.FromBits( prefix_len).must_be_empty | ||
end | ||
end | ||
|
||
it "returns empty netmask for incorrect prefix length" do | ||
Yast::Netmask.FromBits( -1).must_be_empty | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters