for port in range(1,6): task.name = 'Ethernet1/{}'.format(port) task.description = '{} Vlan{} hosts'.format(task.name, port + 220) task.mtu = 9216 task.mode = 'layer2' task.speed = 100000 task.duplex = 'auto' task.append_to_task_name(task.name) task.add_interface() def add_svi_interfaces(task): for vlan in range(221,226): task.name = 'Vlan{}'.format(vlan) task.mtu = 1500 task.fabric_forwarding_anycast_gateway = True task.mode = 'layer3' task.append_to_task_name(task.name) task.add_interface() pb = playbook() task = NxosInterfaces(log) task.append_to_task_name('v{}, {}'.format(our_version, ansible_host)) add_ethernet_interfaces(task) add_svi_interfaces(task) task.state = 'merged' task.commit() pb.add_task(task) pb.append_playbook() pb.write_playbook() log.info('wrote playbook {}'.format(pb.file))
task = NxosGir(log) task.state = 'present' task.system_mode_maintenance_shutdown = True task.system_mode_maintenance_dont_generate_profile = True task.task_name = 'test_mutual_exclusion_1' try: task.commit() except: log.info('PASS {}'.format(description)) return log.error('FAIL {}'.format(description)) ansible_module = 'nxos_gir' ansible_host = 'dc-101' # must be in ansible inventory log_level_console = 'INFO' log_level_file = 'DEBUG' log = Log('unit_test_{}'.format(ansible_module), log_level_console, log_level_file) pb = playbook() example(pb) # test_invalid_range(pb) # test_mutual_exclusion_1(pb) # test_mutual_exclusion_2(pb) # test_mutual_exclusion_3(pb) pb.append_playbook() pb.write_playbook() log.info('wrote {}'.format(pb.file))