From 3d6c45c571503122741233a27a9e43c2fb56ecac Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Thu, 22 Jan 2015 12:41:02 +0000 Subject: Refactor ifup/ifdown into base-class Refactor some common code so the base-class handles the ifup/down Change-Id: Id1fee1d2d5c9315717611b7bf18f058c49fe3622 --- os_net_config/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'os_net_config/__init__.py') diff --git a/os_net_config/__init__.py b/os_net_config/__init__.py index 8d241af..5e1d091 100644 --- a/os_net_config/__init__.py +++ b/os_net_config/__init__.py @@ -117,3 +117,11 @@ class NetConfig(object): logger.info('%s%s' % (self.log_prefix, msg)) if not self.noop: os.remove(filename) + + def ifdown(self, interface, iftype='interface'): + msg = 'running ifdown on %s: %s' % (iftype, interface) + self.execute(msg, '/sbin/ifdown', interface, check_exit_code=False) + + def ifup(self, interface, iftype='interface'): + msg = 'running ifup on %s: %s' % (iftype, interface) + self.execute(msg, '/sbin/ifup', interface) -- cgit 1.2.3-korg