mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 22:30:22 -07:00
initial add of shared modules for supporting Nokia SROS devices
This adds a cli transport, netcfg, and netcli implementations for working with devices running Nokia SROS. There is also an update to netcfg to support the sros config file format.
This commit is contained in:
parent
178292d2cd
commit
24e8e3b03f
4 changed files with 202 additions and 5 deletions
|
@ -75,8 +75,7 @@ class ConfigLine(object):
|
|||
|
||||
@property
|
||||
def line(self):
|
||||
line = ['set']
|
||||
line.extend([p.text for p in self.parents])
|
||||
line = [p.text for p in self.parents]
|
||||
line.append(self.text)
|
||||
return ' '.join(line)
|
||||
|
||||
|
@ -84,8 +83,7 @@ class ConfigLine(object):
|
|||
return self.raw
|
||||
|
||||
def __eq__(self, other):
|
||||
if self.text == other.text:
|
||||
return self.parents == other.parents
|
||||
return self.line == other.line
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
|
@ -183,7 +181,13 @@ class NetworkConfig(object):
|
|||
return dumps(self.expand_line(self.items))
|
||||
|
||||
def load(self, contents):
|
||||
self._config = parse(contents, indent=self.indent)
|
||||
# Going to start adding device profiles post 2.2
|
||||
tokens = list(DEFAULT_COMMENT_TOKENS)
|
||||
if self._device_os == 'sros':
|
||||
tokens.append('echo')
|
||||
self._config = parse(contents, indent=4, comment_tokens=tokens)
|
||||
else:
|
||||
self._config = parse(contents, indent=self.indent)
|
||||
|
||||
def load_from_file(self, filename):
|
||||
self.load(open(filename).read())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue