diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-02-15 20:48:23 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-02-17 22:39:54 +0900 |
commit | 4c63a5cf24e10f20595f093f481a69a607887991 (patch) | |
tree | c4982675e0ddd7b0a3bb978d1db8585ce8d4f046 | |
parent | f45f534758c2fcf1afac95c4b87f9cfa34cfb2e6 (diff) |
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>
-rwxr-xr-x | ryu/cmd/of_config_cli.py | 22 | ||||
-rw-r--r-- | ryu/lib/of_config/capable_switch.py | 6 |
2 files changed, 27 insertions, 1 deletions
diff --git a/ryu/cmd/of_config_cli.py b/ryu/cmd/of_config_cli.py index 15f10c7b..6973b80f 100755 --- a/ryu/cmd/of_config_cli.py +++ b/ryu/cmd/of_config_cli.py @@ -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 diff --git a/ryu/lib/of_config/capable_switch.py b/ryu/lib/of_config/capable_switch.py index 7be3159f..91f40134 100644 --- a/ryu/lib/of_config/capable_switch.py +++ b/ryu/lib/of_config/capable_switch.py @@ -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 |