Nxos vxlan vtep vni netcfg fix (#23620)

* Code cleanup
Removed 'add' method from CustomNetworkConfig.  It is identical
to the one inherited from NetworkConfig

* Removed unused CustomNetworkConfig import

* Replaced
```
def get_existing(module, args):
    existing = {}
    netcfg = get_config(module)
    config = netcfg.get_section(parents)
```
with
```
netcfg = CustomNetworkConfig(indent=2, contents=get_config(module))
```
get_config returns a string, not an object in 2.3.

* Removed non-functioning get_object method in CustomNetworkConfig in favor of the
inherited method.

Added child_objs property so that expand_selection would work.  The original
verion never worked correctly as it compared NetworkConfig obj's and str's.

* Removed ShellError method in favor or new load_config method.

* Removed ShellError method in favor or new load_config method.
fixes #20260

* nxos requires a "no" statement to change mcase group.  Corrected.
Corrected changed logic.

* Corrected deleted CustomNetworkConfig import
This commit is contained in:
Daniel 2017-04-17 11:39:21 -05:00 committed by Nathaniel Case
parent e518b6f5b4
commit bbb9f3164c
44 changed files with 35 additions and 112 deletions

View file

@ -136,7 +136,7 @@ def state_present(module, candidate, prefix):
def state_absent(module, candidate, prefix):
netcfg = get_config(module)
netcfg = CustomNetworkConfig(indent=2, contents=get_config(module))
commands = list()
parents = 'vrf context {0}'.format(module.params['vrf'])
invoke('set_route', module, commands, prefix)
@ -161,7 +161,7 @@ def fix_prefix_to_regex(prefix):
def get_existing(module, prefix, warnings):
key_map = ['tag', 'pref', 'route_name', 'next_hop']
netcfg = get_config(module)
netcfg = CustomNetworkConfig(indent=2, contents=get_config(module))
parents = 'vrf context {0}'.format(module.params['vrf'])
prefix_to_regex = fix_prefix_to_regex(prefix)