@@ -10,33 +10,19 @@ class ConfigMgr(object):
1010 """ The class represents frr configuration """
1111 def __init__ (self ):
1212 self .current_config = None
13- self .current_config_raw = None
1413
1514 def reset (self ):
1615 """ Reset stored config """
1716 self .current_config = None
18- self .current_config_raw = None
1917
2018 def update (self ):
2119 """ Read current config from FRR """
2220 self .current_config = None
23- self .current_config_raw = None
2421 ret_code , out , err = run_command (["vtysh" , "-c" , "show running-config" ])
2522 if ret_code != 0 :
26- # FIXME: should we throw exception here?
2723 log_crit ("can't update running config: rc=%d out='%s' err='%s'" % (ret_code , out , err ))
2824 return
29- text = []
30- for line in out .split ('\n ' ):
31- if line .lstrip ().startswith ('!' ):
32- continue
33- text .append (line )
34- text += [" " ] # Add empty line to have something to work on, if there is no text
35- self .current_config_raw = text
36- self .current_config = self .to_canonical (out ) # FIXME: use test as an input
37-
38- def push_list (self , cmdlist ):
39- return self .push ("\n " .join (cmdlist ))
25+ self .current_config = self .to_canonical (out )
4026
4127 def push (self , cmd ):
4228 """
@@ -65,12 +51,8 @@ def write(self, cmd):
6551 log_err ("ConfigMgr::push(): can't push configuration '%s', rc='%d', stdout='%s', stderr='%s'" % err_tuple )
6652 if ret_code == 0 :
6753 self .current_config = None # invalidate config
68- self .current_config_raw = None
6954 return ret_code == 0
7055
71- def get_text (self ):
72- return self .current_config_raw
73-
7456 @staticmethod
7557 def to_canonical (raw_config ):
7658 """
0 commit comments