Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[config-gen] Also ignore lag members with lag being ignored #117

Draft
wants to merge 2 commits into
base: stable/ussuri-m3
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions networking_ccloud/tools/netbox_config_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ def __init__(self, region, args, verbose=False, verify_ssl=False):
@classmethod
def _ignore_filter(cls, items: Iterable[NbRecord]) -> Generator[NbRecord, None, None]:
for item in items:
if any(x.slug in cls.ignore_tags for x in getattr(item, 'tags', list())):
if hasattr(item, 'lag') and item.lag and \
any(x.slug in cls.ignore_tags for x in getattr(item.lag, 'tags', list())):
print(f'LAG of interface {item.url} has ignore tag set')
elif any(x.slug in cls.ignore_tags for x in getattr(item, 'tags', list())):
print(f'Item {item.url} has ignore tag set')
else:
yield item
Expand Down Expand Up @@ -588,7 +591,8 @@ def get_connected_devices(self, switches: List[NbRecord]) -> Tuple[Set[NbRecord]
print(f"Device {switch.name} port {iface.name} is connected to "
f"device {far_device.name} port {iface.connected_endpoint.name} "
f"role {far_device.device_role.name}")

if far_device.name == "qa-de-1-rt415b":
print
ports_to_device = device_ports_map.get(far_device, [])
# ensure InfraNetworks are symmetric
infra_nets_and_extra_vlans = self.make_infra_networks_and_extra_vlans(iface, svi_vlan_ip_map)
Expand Down Expand Up @@ -831,7 +835,7 @@ def main():
'Format should be: <key1>/<key2>...')
parser.add_argument("-a", "--address-scope-vrf-map", type=Path, nargs="+",
help="Path to file containing a mapping of address scope names to VRFs. If this is omitted, "
"no mapping will be generated.")
"no mapping will be generated.", default=[])
parser.add_argument("-s", "--shell", action="store_true")
parser.add_argument("-o", "--output")

Expand Down