Loading lncc.py +12 −11 Original line number Original line Diff line number Diff line Loading @@ -69,12 +69,12 @@ class NetworkElement: name: str name: str params: Dict[str, str] = field(compare=False) params: Dict[str, str] = field(compare=False) conn: Optional[manager.Manager] = field(default=None, compare=False) conn: Optional[manager.Manager] = field(default=None, compare=False) replies: Optional[Dict[str, replies: Dict[str, ncclient.operations.retrieve.GetReply]] = field( ncclient.operations.retrieve.GetReply] = field( default_factory=dict, compare=False) default_factory=dict, compare=False) tables: Optional[Dict[str, pandas.DataFrame]] = field(default_factory=dict, tables: Dict[str, pandas.DataFrame] = field(default_factory=dict, compare=False) compare=False) configs: Optional[Dict[str, str]] = field(default_factory=dict, configs: Dict[str, str] = field(default_factory=dict, compare=False) compare=False) mappings: Dict[str, Dict[str, str]] = field(default_factory=dict, mappings: Dict[str, Dict[str, str]] = field(default_factory=dict, compare=False) compare=False) Loading Loading @@ -179,8 +179,8 @@ class NetworkElement: class NetworkElementGroup(collections.UserDict): class NetworkElementGroup(collections.UserDict): """Represent a Group of Network Element""" """Represent a Group of Network Element""" tables: Dict[str, pandas.DataFrame] = dict() tables: Dict[str, pandas.DataFrame] = {} mappings: Dict[str, Dict[str, str]] = dict() mappings: Dict[str, Dict[str, str]] = {} @staticmethod @staticmethod def from_dict(dic: dict) -> "NetworkElementGroup": def from_dict(dic: dict) -> "NetworkElementGroup": Loading Loading @@ -248,7 +248,7 @@ class NetworkElementGroup(collections.UserDict): def table_concat(self, table: str = "get") -> pandas.DataFrame: def table_concat(self, table: str = "get") -> pandas.DataFrame: # TODO(Jean): Refactoring needed? # TODO(Jean): Refactoring needed? tables = list() tables = [] for name, state in self.items(): for name, state in self.items(): # print(state) # print(state) tmp_tb = state.tables[table].copy() tmp_tb = state.tables[table].copy() Loading Loading @@ -607,10 +607,11 @@ class LnccCli(cmd2.Cmd): self.do_help("netconf") self.do_help("netconf") return return items = vars(args).items() items1 = vars(args).items() items = filter(lambda item: not item[0].startswith("cmd2_"), items) items2 = filter(lambda item: not item[0].startswith("cmd2_"), items1) items = filter(lambda item: item[1] is not None, items) items3 = filter(lambda item: item[1] is not None, items2) kwargs = dict(items) kwargs = dict(items3) if "reply" not in kwargs: if "reply" not in kwargs: kwargs["reply"] = kwargs["operation"] kwargs["reply"] = kwargs["operation"] Loading Loading
lncc.py +12 −11 Original line number Original line Diff line number Diff line Loading @@ -69,12 +69,12 @@ class NetworkElement: name: str name: str params: Dict[str, str] = field(compare=False) params: Dict[str, str] = field(compare=False) conn: Optional[manager.Manager] = field(default=None, compare=False) conn: Optional[manager.Manager] = field(default=None, compare=False) replies: Optional[Dict[str, replies: Dict[str, ncclient.operations.retrieve.GetReply]] = field( ncclient.operations.retrieve.GetReply] = field( default_factory=dict, compare=False) default_factory=dict, compare=False) tables: Optional[Dict[str, pandas.DataFrame]] = field(default_factory=dict, tables: Dict[str, pandas.DataFrame] = field(default_factory=dict, compare=False) compare=False) configs: Optional[Dict[str, str]] = field(default_factory=dict, configs: Dict[str, str] = field(default_factory=dict, compare=False) compare=False) mappings: Dict[str, Dict[str, str]] = field(default_factory=dict, mappings: Dict[str, Dict[str, str]] = field(default_factory=dict, compare=False) compare=False) Loading Loading @@ -179,8 +179,8 @@ class NetworkElement: class NetworkElementGroup(collections.UserDict): class NetworkElementGroup(collections.UserDict): """Represent a Group of Network Element""" """Represent a Group of Network Element""" tables: Dict[str, pandas.DataFrame] = dict() tables: Dict[str, pandas.DataFrame] = {} mappings: Dict[str, Dict[str, str]] = dict() mappings: Dict[str, Dict[str, str]] = {} @staticmethod @staticmethod def from_dict(dic: dict) -> "NetworkElementGroup": def from_dict(dic: dict) -> "NetworkElementGroup": Loading Loading @@ -248,7 +248,7 @@ class NetworkElementGroup(collections.UserDict): def table_concat(self, table: str = "get") -> pandas.DataFrame: def table_concat(self, table: str = "get") -> pandas.DataFrame: # TODO(Jean): Refactoring needed? # TODO(Jean): Refactoring needed? tables = list() tables = [] for name, state in self.items(): for name, state in self.items(): # print(state) # print(state) tmp_tb = state.tables[table].copy() tmp_tb = state.tables[table].copy() Loading Loading @@ -607,10 +607,11 @@ class LnccCli(cmd2.Cmd): self.do_help("netconf") self.do_help("netconf") return return items = vars(args).items() items1 = vars(args).items() items = filter(lambda item: not item[0].startswith("cmd2_"), items) items2 = filter(lambda item: not item[0].startswith("cmd2_"), items1) items = filter(lambda item: item[1] is not None, items) items3 = filter(lambda item: item[1] is not None, items2) kwargs = dict(items) kwargs = dict(items3) if "reply" not in kwargs: if "reply" not in kwargs: kwargs["reply"] = kwargs["operation"] kwargs["reply"] = kwargs["operation"] Loading