Skip to content

Commit 4905c34

Browse files
abhiramkulkarnidanielhb
authored andcommitted
Listing the information from ifcfg files
This patch adds a new control/model called Cfginterfaces and Cfginterface to handle the configuration files of the network interfaces. It includes changes in control and model files, docs/API.md, i18n and Makefile.am. A new unit test was added to support this new feature. The test uses a python module called 'mock' that wasn't being used before, thus an update in the README file was also made to add this package as an unit test dependency.
1 parent 4ff1320 commit 4905c34

File tree

10 files changed

+521
-6
lines changed

10 files changed

+521
-6
lines changed

README

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,32 @@ from Kimchi, that provides an intuitive web panel with common tools for
66
configuring and operating Linux systems.
77

88
The current features include:
9-
+ retreive system health (sensors) stats
9+
+ retrieve system health (sensors) stats
1010
+ user login account management,
1111
+ network interface configuration,
1212
+ configuration backup,
1313
+ Power (ppc) firmware update,
1414
+ Power policy management.
1515

16-
Kimchi is an HTML5 based management tool for KVM. It is designed to make it as
17-
easy as possible to get started with KVM and create your first guest.
1816

19-
- Note on Ubuntu/Debian:
17+
*** Dependencies for Ubuntu/Debian ***
2018

2119
To run the source code in Ubuntu/Debian an extra package is required:
2220

2321
$ sudo apt-get install python-libuser
2422

25-
- Notes on Power policy management feature:
23+
This step is not required for installation using the .deb package.
24+
25+
26+
*** Dependencies for the unit tests ***
27+
28+
To run the unit tests from the source code the python mock package
29+
is required:
30+
31+
$ sudo pip install mock
32+
33+
34+
*** Notes on Power policy management feature ***
2635

2736
The power policy management feature uses the 'tuned' service to control the
2837
power policies of the host. Problems have been reported with this package,
@@ -49,7 +58,8 @@ $ systemctl restart wokd.service
4958
If these steps do not solve the problem, try to update all 'tuned' related
5059
packages and the packages'selinux-policy' and 'selinux-policy-targeted'.
5160

52-
Copyright notice:
61+
62+
*** Copyright notice ***
5363

5464
All the .gif and .png files in 'ui/css/base/images/' directory are licensed
5565
as follows:

controls/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ controls_PYTHON = \
2121
__init__.py \
2222
backup.py \
2323
capabilities.py \
24+
cfginterfaces.py \
2425
firmware.py \
2526
ibm_sep.py \
2627
interfaces.py \

controls/cfginterfaces.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#
2+
# Project Ginger
3+
#
4+
# Copyright IBM, Corp. 2015
5+
#
6+
# This library is free software; you can redistribute it and/or
7+
# modify it under the terms of the GNU Lesser General Public
8+
# License as published by the Free Software Foundation; either
9+
# version 2.1 of the License, or (at your option) any later version.
10+
#
11+
# This library is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
# Lesser General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU Lesser General Public
17+
# License along with this library; if not, write to the Free Software
18+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19+
20+
from wok.control.base import Collection, Resource
21+
22+
23+
class Cfginterfaces(Collection):
24+
def __init__(self, model):
25+
super(Cfginterfaces, self).__init__(model)
26+
self.resource = Cfginterface
27+
28+
29+
class Cfginterface(Resource):
30+
def __init__(self, model, ident):
31+
super(Cfginterface, self).__init__(model, ident)
32+
self.uri_fmt = '/network/cfginterfaces/%s'
33+
34+
@property
35+
def data(self):
36+
return self.info

controls/network.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# License along with this library; if not, write to the Free Software
1818
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1919

20+
from cfginterfaces import Cfginterfaces
2021
from interfaces import Interfaces
2122
from wok.control.base import Resource
2223

@@ -28,6 +29,7 @@ def __init__(self, model):
2829
self.role_key = "administration"
2930
self.admin_methods = ['PUT']
3031
self.interfaces = Interfaces(model)
32+
self.cfginterfaces = Cfginterfaces(model)
3133
self.uri_fmt = '/network/%s'
3234
self.update_params = ['nameservers', 'gateway']
3335
self.confirm_change = self.generate_action_handler('confirm_change')

docs/API.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,65 @@ to use the API effectively, please consider the following general conventions
147147
* start: Start the SEP daemon on host server.
148148
* stop: Stop the SEP daemon on host server.
149149

150+
### Resource: IBM Serviceable Event Provider (SEP)
151+
152+
**URI:** /plugins/ginger/ibm_sep
153+
154+
**Methods:**
155+
156+
* **GET**: Retrieve a dictionary with the SEP status and subscription information:
157+
* status: Status of the SEP agent. Can be 'running' or 'not running'.
158+
* subscription: Dictionaries with the SEP subscription information:
159+
* hostname: Hostname of the host server.
160+
* port: Number of the network port used by the SEP agent.
161+
* community: SNMP community name which host server is member.
162+
* **PUT**: Create and/or update a subscription
163+
164+
*Actions (POST):**
165+
166+
* start: Start the SEP daemon on host server.
167+
* stop: Stop the SEP daemon on host server.
168+
169+
### Resource: Netork Inferface Configuration
170+
171+
**URI:** /plugins/ginger/network/cfginterfaces/*:name*
172+
173+
**Methods:**
174+
175+
* **GET**: Retrieve the information available in network interface
176+
file /etc/sysconfig/network-scripts/ifcfg-<name>
177+
* BASIC_INFO: Basic information of network interface:
178+
* NAME: Name of the interface.
179+
* DEVICE: Device name of the interface.
180+
* ONBOOT: 'Yes' if interface is to be brought up during boot,
181+
'No' if interface should not be brought up during boot.
182+
* TYPE: Interface type (Ethernet,Bond,Vlan)
183+
* MACADDR: Mac address of ethernet device.
184+
* VLAN: 'Yes' If its vlan device.
185+
* VLAN_ID: Vland of the vlan device.
186+
* PHYSDEV: physical device associated with the vlan device.
187+
* BONDING_OPTS: Bonding parameters of the Bond device.
188+
* BONDING_MASTER: 'yes' if its bond device.
189+
* SLAVES: Returns slaves associated with the bond.
190+
* IPV4_INFO:IPV4 information of network interface:
191+
* BOOTPROTO: Boot protocol for ipv4(dhcp,none,autoip)
192+
* DEFROUTE: 'yes' Use default route
193+
* DNS: 'DNS' ip
194+
* PEERROUTES: 'yes' use PEERROUTES
195+
* IPV4_FAILURE_FATAL: 'yes' ipv4 connections fails then
196+
interface is considered inactive
197+
* PEERDNS: 'yes' use the peerdns configured
198+
* IPADDR: ipv4 address of the interface
199+
* NETMASK: netmask of the ipv4 address
200+
* GATEWAY: Gateway assigned to the ipv4 address
201+
* IPV6_INFO:IPV6 information of network interface:
202+
* IPV6INIT: 'yes' to initalize ipv6 for the interface
203+
* IPV6_AUTOCONF: 'yes' automatic mode for ipv6
204+
* DHCPV6C: 'yes' dhcp automatic mode for ipv6
205+
* IPV6_DEFROUTE: 'yes' Use default route
206+
* IPV6_PEERROUTES: 'yes' use PEERROUTES
207+
* IPV6_FAILURE_FATAL: 'yes' ipv6 connections fails then
208+
interface is considered inactive
209+
* IPV6_PEERDNS: 'yes' use the peerdns configured
210+
* IPV6ADDR: ipv6 address of the interface
211+
* IPV6_DEFAULTGW: Gateway assigned to the ipv6 address

i18n.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
"the current IP/netmask)."),
4242
"GINNET0013E": _("Interface %(name)s is not editable because it belongs "
4343
"to a vlan or bridge"),
44+
"GINNET0014E": _("%(name)s is not valid network interface"),
45+
"GINNET0015E": _("Error getting information from ifcfg file: '%(error)s'."),
4446

4547
"GINUSER0001E": _("Specify name, password, group and profile for the new "
4648
"user."),

models/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ models_PYTHON = \
2121
__init__.py \
2222
backup.py \
2323
capabilities.py \
24+
cfginterfaces.py \
2425
firmware.py \
2526
ibm_sep.py \
2627
interfaces.py \

0 commit comments

Comments
 (0)