|
Packit Service |
0535c1 |
#
|
|
Packit Service |
0535c1 |
# Copyright (c) 2020 Red Hat, Inc.
|
|
Packit Service |
0535c1 |
#
|
|
Packit Service |
0535c1 |
# This file is part of nmstate
|
|
Packit Service |
0535c1 |
#
|
|
Packit Service |
0535c1 |
# This program is free software: you can redistribute it and/or modify
|
|
Packit Service |
0535c1 |
# it under the terms of the GNU Lesser General Public License as published by
|
|
Packit Service |
0535c1 |
# the Free Software Foundation, either version 2.1 of the License, or
|
|
Packit Service |
0535c1 |
# (at your option) any later version.
|
|
Packit Service |
0535c1 |
#
|
|
Packit Service |
0535c1 |
# This program is distributed in the hope that it will be useful,
|
|
Packit Service |
0535c1 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
0535c1 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
0535c1 |
# GNU Lesser General Public License for more details.
|
|
Packit Service |
0535c1 |
#
|
|
Packit Service |
0535c1 |
# You should have received a copy of the GNU Lesser General Public License
|
|
Packit Service |
0535c1 |
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
Packit Service |
0535c1 |
#
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
from abc import ABCMeta
|
|
Packit Service |
0535c1 |
from abc import abstractproperty
|
|
Packit Service |
0535c1 |
from abc import abstractmethod
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
from .error import NmstatePluginError
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
class NmstatePlugin(metaclass=ABCMeta):
|
|
Packit Service |
0535c1 |
OVS_CAPABILITY = "openvswitch"
|
|
Packit Service |
0535c1 |
TEAM_CAPABILITY = "team"
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
PLUGIN_CAPABILITY_IFACE = "interface"
|
|
Packit Service |
0535c1 |
PLUGIN_CAPABILITY_ROUTE = "route"
|
|
Packit Service |
0535c1 |
PLUGIN_CAPABILITY_ROUTE_RULE = "route_rule"
|
|
Packit Service |
0535c1 |
PLUGIN_CAPABILITY_DNS = "dns"
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
DEFAULT_PRIORITY = 10
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
def unload(self):
|
|
Packit Service |
0535c1 |
pass
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
@property
|
|
Packit Service |
0535c1 |
def checkpoint(self):
|
|
Packit Service |
0535c1 |
return None
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
def refresh_content(self):
|
|
Packit Service |
0535c1 |
pass
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
@abstractproperty
|
|
Packit Service |
0535c1 |
def name(self):
|
|
Packit Service |
0535c1 |
pass
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
@property
|
|
Packit Service |
0535c1 |
def priority(self):
|
|
Packit Service |
0535c1 |
return NmstatePlugin.DEFAULT_PRIORITY
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
def get_interfaces(self):
|
|
Packit Service |
0535c1 |
raise NmstatePluginError(
|
|
Packit Service |
0535c1 |
f"Plugin {self.name} BUG: get_interfaces() not implemented"
|
|
Packit Service |
0535c1 |
)
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
def apply_changes(self, net_state, save_to_disk):
|
|
Packit Service |
0535c1 |
pass
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
@property
|
|
Packit Service |
0535c1 |
def capabilities(self):
|
|
Packit Service |
0535c1 |
return []
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
@abstractmethod
|
|
Packit Service |
0535c1 |
def plugin_capabilities(self):
|
|
Packit Service |
0535c1 |
pass
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
def create_checkpoint(self, timeout):
|
|
Packit Service |
0535c1 |
return None
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
def rollback_checkpoint(self, checkpoint=None):
|
|
Packit Service |
0535c1 |
pass
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
def destroy_checkpoint(self, checkpoint=None):
|
|
Packit Service |
0535c1 |
pass
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
def get_routes(self):
|
|
Packit Service |
0535c1 |
raise NmstatePluginError(
|
|
Packit Service |
0535c1 |
f"Plugin {self.name} BUG: get_routes() not implemented"
|
|
Packit Service |
0535c1 |
)
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
def get_route_rules(self):
|
|
Packit Service |
0535c1 |
raise NmstatePluginError(
|
|
Packit Service |
0535c1 |
f"Plugin {self.name} BUG: get_route_rules() not implemented"
|
|
Packit Service |
0535c1 |
)
|
|
Packit Service |
0535c1 |
|
|
Packit Service |
0535c1 |
def get_dns_client_config(self):
|
|
Packit Service |
0535c1 |
raise NmstatePluginError(
|
|
Packit Service |
0535c1 |
f"Plugin {self.name} BUG: get_dns_client_config() not implemented"
|
|
Packit Service |
0535c1 |
)
|