Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
223 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright (c) [2019] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of version 2 of the GNU General Public License as published | ||
# by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, contact SUSE LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require "y2network/connection_config/base" | ||
|
||
module Y2Network | ||
module ConnectionConfig | ||
# Configuration for hsi connections | ||
class Hsi < Base | ||
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
31 changes: 31 additions & 0 deletions
31
src/lib/y2network/sysconfig/connection_config_readers/hsi.rb
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,31 @@ | ||
# Copyright (c) [2019] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of version 2 of the GNU General Public License as published | ||
# by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, contact SUSE LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require "y2network/sysconfig/connection_config_readers/ethernet" | ||
|
||
module Y2Network | ||
module Sysconfig | ||
module ConnectionConfigReaders | ||
# This class is able to build a ConnectionConfig::Hsi object given a | ||
# Sysconfig::InterfaceFile object. | ||
class Hsi < Ethernet | ||
end | ||
end | ||
end | ||
end |
31 changes: 31 additions & 0 deletions
31
src/lib/y2network/sysconfig/connection_config_writers/hsi.rb
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,31 @@ | ||
# Copyright (c) [2019] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of version 2 of the GNU General Public License as published | ||
# by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, contact SUSE LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require "y2network/sysconfig/connection_config_writers/ethernet" | ||
|
||
module Y2Network | ||
module Sysconfig | ||
module ConnectionConfigWriters | ||
# This class is responsible for writing the information from a | ||
# ConnectionConfig::Hsi object to the underlying system. | ||
class Hsi < Ethernet | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
STARTMODE='auto' | ||
BOOTPROTO='static' | ||
IPADDR='192.168.100.10/24' |
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,30 @@ | ||
# Copyright (c) [2019] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of version 2 of the GNU General Public License as published | ||
# by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, contact SUSE LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require_relative "../../test_helper" | ||
require "y2network/connection_config/hsi" | ||
require "y2network/interface_type" | ||
|
||
describe Y2Network::ConnectionConfig::Hsi do | ||
describe "#type" do | ||
it "returns 'hsi'" do | ||
expect(subject.type).to eq(Y2Network::InterfaceType::HSI) | ||
end | ||
end | ||
end |
49 changes: 49 additions & 0 deletions
49
test/y2network/sysconfig/connection_config_readers/hsi_test.rb
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,49 @@ | ||
# Copyright (c) [2019] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of version 2 of the GNU General Public License as published | ||
# by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, contact SUSE LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require_relative "../../../test_helper" | ||
require "y2network/sysconfig/connection_config_readers/hsi" | ||
require "y2network/sysconfig/interface_file" | ||
require "y2network/boot_protocol" | ||
|
||
describe Y2Network::Sysconfig::ConnectionConfigReaders::Hsi do | ||
subject(:handler) { described_class.new(file) } | ||
|
||
let(:scr_root) { File.join(DATA_PATH, "scr_read") } | ||
|
||
around do |example| | ||
change_scr_root(scr_root, &example) | ||
end | ||
|
||
let(:interface_name) { "hsi0" } | ||
|
||
let(:file) do | ||
Y2Network::Sysconfig::InterfaceFile.find(interface_name).tap(&:load) | ||
end | ||
|
||
describe "#connection_config" do | ||
it "returns a hsi connection config object" do | ||
hsi = handler.connection_config | ||
expect(hsi.type).to eql(Y2Network::InterfaceType::HSI) | ||
expect(hsi.interface).to eq("hsi0") | ||
expect(hsi.ip.address).to eq(Y2Network::IPAddress.from_string("192.168.100.10/24")) | ||
expect(hsi.bootproto).to eq(Y2Network::BootProtocol::STATIC) | ||
end | ||
end | ||
end |
50 changes: 50 additions & 0 deletions
50
test/y2network/sysconfig/connection_config_writers/hsi_test.rb
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,50 @@ | ||
# Copyright (c) [2019] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of version 2 of the GNU General Public License as published | ||
# by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, contact SUSE LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require_relative "../../../test_helper" | ||
|
||
require "y2network/sysconfig/connection_config_writers/hsi" | ||
require "y2network/startmode" | ||
require "y2network/boot_protocol" | ||
require "y2network/connection_config/hsi" | ||
|
||
describe Y2Network::Sysconfig::ConnectionConfigWriters::Hsi do | ||
subject(:handler) { described_class.new(file) } | ||
|
||
let(:conn) do | ||
Y2Network::ConnectionConfig::Hsi.new.tap do |c| | ||
c.name = "hsi1" | ||
c.interface = "hsi1" | ||
c.bootproto = Y2Network::BootProtocol::DHCP | ||
c.startmode = Y2Network::Startmode.create("auto") | ||
end | ||
end | ||
|
||
let(:file) { Y2Network::Sysconfig::InterfaceFile.new(conn.name) } | ||
|
||
describe "#write" do | ||
it "writes common properties" do | ||
handler.write(conn) | ||
expect(file).to have_attributes( | ||
bootproto: "dhcp", | ||
startmode: "auto" | ||
) | ||
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