-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from aristanetworks/feature-cvp-deployment
Feature cvp deployment
- Loading branch information
Showing
35 changed files
with
887 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+58.9 KB
ansible_collections/arista/avd/media/figure-1-example-playbook-evpn-deploy-cvp.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+51.7 KB
...ble_collections/arista/avd/media/figure-2-example-playbook-evpn-deploy-eapi.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 13 additions & 12 deletions
25
ansible_collections/arista/avd/plugins/filter/list_compress.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
# | ||
# list_compress filter | ||
# | ||
from __future__ import (absolute_import, division, print_function) | ||
__metaclass__ = type | ||
|
||
from jinja2 import TemplateError | ||
from itertools import count, groupby | ||
from ansible.errors import AnsibleFilterError | ||
|
||
import re | ||
|
||
class FilterModule(object): | ||
|
||
def list_compress(self,list_to_compress): | ||
if not isinstance(list_to_compress, list): | ||
raise AnsibleFilterError('value must be of type list, got %s' % type(list_to_compress)) | ||
|
||
G=(list(x) for _,x in groupby(sorted(list_to_compress), lambda x,c=count(): next(c)-x)) | ||
return (",".join("-".join(map(str,(g[0],g[-1])[:len(g)])) for g in G)) | ||
class FilterModule(object): | ||
|
||
def list_compress(self, list_to_compress): | ||
if not isinstance(list_to_compress, list): | ||
raise AnsibleFilterError('value must be of type list, got %s' % type(list_to_compress)) | ||
G = (list(x) for y, x in groupby(sorted(list_to_compress), lambda x, c=count(): next(c) - x)) | ||
return (",".join("-".join(map(str, (g[0], g[-1])[:len(g)])) for g in G)) | ||
|
||
def filters(self): | ||
return { | ||
'list_compress' : self.list_compress, | ||
} | ||
def filters(self): | ||
return { | ||
'list_compress': self.list_compress, | ||
} |
27 changes: 18 additions & 9 deletions
27
ansible_collections/arista/avd/plugins/filter/natural_sort.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
# | ||
# natural_sort filter | ||
# | ||
from jinja2 import TemplateError | ||
from __future__ import (absolute_import, division, print_function) | ||
__metaclass__ = type | ||
|
||
from jinja2 import TemplateError | ||
import re | ||
|
||
|
||
def convert(text): | ||
return int(text) if text.isdigit() else text.lower() | ||
|
||
|
||
def alphanum_key(key): | ||
return [convert(c) for c in re.split('([0-9]+)', str(key))] | ||
|
||
|
||
class FilterModule(object): | ||
|
||
def natural_sort(self,iterable): | ||
convert = lambda text: int(text) if text.isdigit() else text.lower() | ||
alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', str(key)) ] | ||
return sorted(iterable, key = alphanum_key) | ||
def natural_sort(self, iterable): | ||
return sorted(iterable, key=alphanum_key) | ||
|
||
def filters(self): | ||
return { | ||
'natural_sort' : self.natural_sort, | ||
} | ||
def filters(self): | ||
return { | ||
'natural_sort': self.natural_sort, | ||
} |
Oops, something went wrong.