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
11 changed files
with
234 additions
and
0 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
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 qeth connections | ||
class Qeth < 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/qeth.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::Qeth object given a | ||
# Sysconfig::InterfaceFile object. | ||
class Qeth < 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
31 changes: 31 additions & 0 deletions
31
src/lib/y2network/sysconfig/connection_config_writers/qeth.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::Qeth | ||
# object to the underlying system. | ||
class Qeth < 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
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,4 @@ | ||
STARTMODE='auto' | ||
BOOTPROTO='static' | ||
IPADDR='192.168.50.1/24' | ||
LLADDR='00:06:29:55:2A:01' |
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/qeth" | ||
require "y2network/interface_type" | ||
|
||
describe Y2Network::ConnectionConfig::Qeth do | ||
describe "#type" do | ||
it "returns 'qeth'" do | ||
expect(subject.type).to eq(Y2Network::InterfaceType::QETH) | ||
end | ||
end | ||
end |
49 changes: 49 additions & 0 deletions
49
test/y2network/sysconfig/connection_config_readers/qeth_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/qeth" | ||
require "y2network/sysconfig/interface_file" | ||
require "y2network/boot_protocol" | ||
|
||
describe Y2Network::Sysconfig::ConnectionConfigReaders::Qeth 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) { "eth5" } | ||
|
||
let(:file) do | ||
Y2Network::Sysconfig::InterfaceFile.find(interface_name).tap(&:load) | ||
end | ||
|
||
describe "#connection_config" do | ||
it "returns a qeth connection config object" do | ||
qeth = handler.connection_config | ||
expect(qeth.type).to eql(Y2Network::InterfaceType::QETH) | ||
expect(qeth.interface).to eq("eth5") | ||
expect(qeth.ip.address).to eq(Y2Network::IPAddress.from_string("192.168.50.1/24")) | ||
expect(qeth.bootproto).to eq(Y2Network::BootProtocol::STATIC) | ||
end | ||
end | ||
end |
53 changes: 53 additions & 0 deletions
53
test/y2network/sysconfig/connection_config_writers/qeth_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,53 @@ | ||
# 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/qeth" | ||
require "y2network/startmode" | ||
require "y2network/boot_protocol" | ||
require "y2network/connection_config/qeth" | ||
require "y2network/connection_config/ip_config" | ||
|
||
describe Y2Network::Sysconfig::ConnectionConfigWriters::Qeth do | ||
subject(:handler) { described_class.new(file) } | ||
|
||
let(:conn) do | ||
Y2Network::ConnectionConfig::Qeth.new.tap do |c| | ||
c.name = "eth6" | ||
c.interface = "eth6" | ||
c.bootproto = Y2Network::BootProtocol::STATIC | ||
c.lladdress = "00:06:29:55:2A:04" | ||
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: "static", | ||
startmode: "auto", | ||
lladdr: "00:06:29:55:2A:04" | ||
) | ||
end | ||
end | ||
end |