Exemplo n.º 1
0
def test_config_merge(junos_topo):

    netblow = NetBlow(topo=junos_topo, iter_once=True)
    dut = 'junos1'
    commands = [
        'set system domain-name lab.com', 'set system ntp peer 10.10.10.10'
    ]
    netblow.config_rollback(dut, commands=commands)
Exemplo n.º 2
0
def main():
    """Entry function."""
    parser = argparse.ArgumentParser(
        description=
        "netblow. Vendor agnostic network testing framework to stress network failures."  # noqa
    )
    # to add required args.
    optional = parser._action_groups.pop()
    required = parser.add_argument_group('required arguments')

    m_group = optional.add_mutually_exclusive_group()
    m_group.add_argument('-d',
                         '--dryrun',
                         default=False,
                         action='store_true',
                         help="show tests calls, won't connect to any devices")
    m_group.add_argument(
        '-c',
        '--concheck',
        default=False,
        action='store_true',
        help='check connectivity with all devices in the topology')
    m_group.add_argument('-1',
                         '--once',
                         default=False,
                         action='store_true',
                         help="iterates only once and perfom napalm diffs")
    parser.add_argument('-l',
                        '--level',
                        choices=['info', 'debug'],
                        default='info',
                        help='logging verbosity level (default: info)')
    parser.add_argument('-v',
                        '--version',
                        action='version',
                        version='{}'.format(__version__),
                        help='show version')
    required.add_argument('-f', '--topology', help='topology yml file')
    required.add_argument('-t', '--tests', help='tests yml file')
    parser._action_groups.append(optional)
    args = parser.parse_args()

    if not args.topology:
        parser.error('You have to specify the topology yml file with -f')
    if not args.tests:
        if args.once or not args.dryrun and not args.concheck:
            parser.error('You have to specify the tests yml file with -t')
    NetBlow(topo_file=args.topology,
            test_file=args.tests,
            dry_run=args.dryrun,
            enable_salt=False,
            iter_once=args.once,
            auto_open=True,
            auto_test=True,
            con_check=args.concheck,
            level=args.level)
Exemplo n.º 3
0
def test_config_merge(iosxr_topo):

    netblow = NetBlow(topo=iosxr_topo, iter_once=True)
    dut = 'iosxr1'
    commands = ['router bgp 65001']
    netblow.config_rollback(dut, commands=commands)
Exemplo n.º 4
0
def get_netblow(iosxr_topo):
    """netblow fixture

    """
    return NetBlow(topo=iosxr_topo)
Exemplo n.º 5
0
def netblow_salt(topology):
    """Dummy netblow dry run salt-enabled fixture

    """
    return NetBlow(dry_run=True, enable_salt=True, topo=topology)
Exemplo n.º 6
0
def netblow(topology):
    """Dummy netblow dry run fixture

    """
    return NetBlow(dry_run=True, topo=topology)
Exemplo n.º 7
0
def test_load_topology_yml_file():
    """Test load topology from yml file.

    """
    nb = NetBlow(topo_file='eos_topo.yml', dry_run=True)
    assert set(['eos1', 'eos2']) == set(nb.devices.keys())
Exemplo n.º 8
0
def test_load_eos_test_yml_file(topology):
    """Test loading eos tests from yml file.

    """
    nb = NetBlow(test_file='eos_tests.yml', topo=topology, dry_run=True)
    assert len(nb.mock.mock_calls) == 5
Exemplo n.º 9
0
def get_netblow(junos_topo):
    """netblow fixture

    """
    return NetBlow(topo=junos_topo)
Exemplo n.º 10
0
def test_config_merge(eos_topo):

    netblow = NetBlow(topo=eos_topo, iter_once=True)
    dut = 'eos1'
    commands = ['hostname {}'.format(dut * 2)]
    netblow.config_rollback(dut, commands=commands)