ofconfig: add commit and discard_changes operation support
They are necessary for switches that don't support the feature of modifying 'running' configuration directly; instead, needs to modify 'candidate' configuration and then commit (or discard). Also fix do_get method's comment typo. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
This commit is contained in:
parent
f45f534758
commit
4c63a5cf24
@ -142,7 +142,7 @@ class Cmd(cmd.Cmd):
|
||||
|
||||
def do_get(self, line):
|
||||
"""get <peer>
|
||||
eg. get_config sw1
|
||||
eg. get sw1
|
||||
"""
|
||||
|
||||
def f(p, args):
|
||||
@ -150,6 +150,26 @@ class Cmd(cmd.Cmd):
|
||||
|
||||
self._request(line, f)
|
||||
|
||||
def do_commit(self, line):
|
||||
"""commit <peer>
|
||||
eg. commit sw1
|
||||
"""
|
||||
|
||||
def f(p, args):
|
||||
print p.commit()
|
||||
|
||||
self._request(line, f)
|
||||
|
||||
def do_discard(self, line):
|
||||
"""discard <peer>
|
||||
eg. discard sw1
|
||||
"""
|
||||
|
||||
def f(p, args):
|
||||
print p.discard_changes()
|
||||
|
||||
self._request(line, f)
|
||||
|
||||
def do_get_config(self, line):
|
||||
"""get_config <peer> <source>
|
||||
eg. get_config sw1 startup
|
||||
|
@ -123,5 +123,11 @@ class OFCapableSwitch(object):
|
||||
def copy_config(self, source, target):
|
||||
self.netconf.copy_config(source, target)
|
||||
|
||||
def commit(self):
|
||||
self.netconf.commit()
|
||||
|
||||
def discard_changes(self):
|
||||
self.netconf.discard_changes()
|
||||
|
||||
# TODO: more netconf operations
|
||||
# TODO: convinience(higher level) methods
|
||||
|
Loading…
Reference in New Issue
Block a user