3
# Copyright (C) 2015 Canonical Ltd.
4
# Copyright (C) 2015 VMware Inc.
6
# Author: Sankar Tanguturi <stanguturi@vmware.com>
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License version 3, as
10
# published by the Free Software Foundation.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
class NicBase(object):
23
Define what are expected of each nic.
24
The following properties should be provided in an implementation class.
30
Retrieves the mac address of the nic
31
@return (str) : the MACADDR setting
33
raise NotImplementedError('MACADDR')
38
Retrieves whether the nic is the primary nic
39
Indicates whether NIC will be used to define the default gateway.
40
If none of the NICs is configured to be primary, default gateway won't
42
@return (bool): the PRIMARY setting
44
raise NotImplementedError('PRIMARY')
49
Retrieves whether the nic should be up at the boot time
50
@return (bool) : the ONBOOT setting
52
raise NotImplementedError('ONBOOT')
57
Retrieves the boot protocol of the nic
58
@return (str): the BOOTPROTO setting, valid values: dhcp and static.
60
raise NotImplementedError('BOOTPROTO')
65
Retrieves the IPv4_MODE
66
@return (str): the IPv4_MODE setting, valid values:
67
backwards_compatible, static, dhcp, disabled, as_is
69
raise NotImplementedError('IPv4_MODE')
74
Retrieves the static IPv4 configuration of the nic
75
@return (StaticIpv4Base list): the static ipv4 setting
77
raise NotImplementedError('Static IPv4')
82
Retrieves the IPv6 configuration of the nic
83
@return (StaticIpv6Base list): the static ipv6 setting
85
raise NotImplementedError('Static Ipv6')
90
For example, the staticIpv4 property is required and should not be
91
empty when ipv4Mode is STATIC
93
raise NotImplementedError('Check constraints on properties')
96
class StaticIpv4Base(object):
98
Define what are expected of a static IPv4 setting
99
The following properties should be provided in an implementation class.
105
Retrieves the Ipv4 address
106
@return (str): the IPADDR setting
108
raise NotImplementedError('Ipv4 Address')
113
Retrieves the Ipv4 NETMASK setting
114
@return (str): the NETMASK setting
116
raise NotImplementedError('Ipv4 NETMASK')
121
Retrieves the gateways on this Ipv4 subnet
122
@return (str list): the GATEWAY setting
124
raise NotImplementedError('Ipv4 GATEWAY')
127
class StaticIpv6Base(object):
128
"""Define what are expected of a static IPv6 setting
129
The following properties should be provided in an implementation class.
135
Retrieves the Ipv6 address
136
@return (str): the IPv6ADDR setting
138
raise NotImplementedError('Ipv6 Address')
143
Retrieves the Ipv6 NETMASK setting
144
@return (str): the IPv6NETMASK setting
146
raise NotImplementedError('Ipv6 NETMASK')
151
Retrieves the Ipv6 GATEWAY setting
152
@return (str): the IPv6GATEWAY setting
154
raise NotImplementedError('Ipv6 GATEWAY')