Example #1
0
    def test_it_should_get_the_link_layer_address_of_tap2(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)

        self.assertEqual('00:50:56:c0:00:08', c.test_network().tp2.ll_addr)
Example #2
0
    def test_it_should_build_a_test_network(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)
        n = c.build_test_network()

        self.assertTrue(isinstance(n, TestNetwork))
Example #3
0
    def test_it_should_configure_the_prefix_size_of_link_c(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)

        self.assertEqual(64, c.test_network().link3.prefix_size)
Example #4
0
    def test_it_should_give_the_runner_a_pointer_back_to_the_configuration(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options, MockInterface())
        r = c.build_runner()

        self.assertEqual(c, r._Runner__config)
Example #5
0
    def test_it_should_identify_a_subset_of_test_suites_to_run_without_optionals(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg --skip-optional host")

        c = Configuration(args, options)
        s = c.test_plan()

        self.assertEqual(5, len(s))
Example #6
0
    def test_it_should_pass_configuration_into_the_test_network(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)
        n = c.build_test_network()

        self.assertTrue(isinstance(c.test_network(), TestNetworkConfiguration))
Example #7
0
    def test_it_should_get_the_link_local_ip_of_tn4(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)

        self.assertEqual(2, len(c.test_network().tn4.if0_ips))
        self.assertTrue(IPAddress.identify("fe80::7a2b:cbff:feef:0105") in c.test_network().tn4.if0_ips)
Example #8
0
    def test_it_should_get_the_global_ip_of_tn4(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)

        self.assertEqual(2, len(c.test_network().tn4.if0_ips))
        self.assertTrue(IPAddress.identify("2012:6d77:7269::ef:0105") in c.test_network().tn4.if0_ips)
Example #9
0
    def test_it_should_build_a_report(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)
        r = c.build_report()

        self.assertTrue(isinstance(r, Report))
Example #10
0
    def test_it_should_get_the_physical_device_for_tap2(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)

        self.assertEqual('vmnet8', c.test_network().tp2.dev)
Example #11
0
    def test_it_should_build_a_runner(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options, MockInterface())
        r = c.build_runner()

        self.assertTrue(isinstance(r, Runner))
Example #12
0
    def test_it_should_configure_the_prefix_of_link_b(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)

        self.assertEqual("2012:6970:7636:0000:0000:0000:0000:0000",
                         c.test_network().link2.prefix)
Example #13
0
    def test_it_should_pass_configuration_into_the_test_network(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)
        n = c.build_test_network()

        self.assertTrue(isinstance(c.test_network(), TestNetworkConfiguration))
Example #14
0
    def test_it_should_build_a_test_network(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)
        n = c.build_test_network()

        self.assertTrue(isinstance(n, TestNetwork))
Example #15
0
    def test_it_should_build_a_runner(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options, MockInterface())
        r = c.build_runner()

        self.assertTrue(isinstance(r, Runner))
Example #16
0
    def test_it_should_get_the_global_ip_of_tr3if1(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)

        self.assertEqual(2, len(c.test_network().tr1.if0_ips))
        self.assertTrue(IPAddress.identify("2012:6970:7636::fe:104") in c.test_network().tr3.if1_ips)
        self.assertTrue(IPAddress.identify("fe80::7a2b:cbff:fefe:104") in c.test_network().tr3.if1_ips)
Example #17
0
    def test_it_should_build_a_report(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)
        r = c.build_report()

        self.assertTrue(isinstance(r, Report))
Example #18
0
    def test_it_should_not_run_test_suites_that_do_not_match_the_suite_pattern(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg --suite TestSuiteA host")

        c = Configuration(args, options)
        s = c.test_plan()

        self.assertEqual(1, len(s))
        self.assertEqual(ConfigurationTestCase.TestSuiteA, s[0])
        
Example #19
0
    def test_it_should_identify_a_subset_of_test_suites_to_run_without_optionals(
            self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg --skip-optional host")

        c = Configuration(args, options)
        s = c.test_plan()

        self.assertEqual(5, len(s))
Example #20
0
    def test_it_should_give_the_runner_a_pointer_back_to_the_configuration(
            self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options, MockInterface())
        r = c.build_runner()

        self.assertEqual(c, r._Runner__config)
Example #21
0
    def test_it_should_read_configuration_from_the_specified_file(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)
        
        self.assertTrue(isinstance(c, Configuration))
        self.assertTrue(c.has_section('test-section'))
        self.assertEqual(1, len(c.keys('test-section')))
        self.assertTrue(c.has_option('test-section', 'key'))
        self.assertEqual('value', c.get('test-section', 'key'))
Example #22
0
    def test_it_should_identify_a_subset_of_test_suites_to_run_2_of_2(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg switch-enterprise")

        c = Configuration(args, options)
        s = c.test_plan()

        self.assertEqual(3, len(s))
        self.assertEqual(ConfigurationTestCase.TestSuiteA, s[0])
        self.assertEqual(ConfigurationTestCase.TestSuiteB, s[1])
        self.assertEqual(ConfigurationTestCase.TestSuiteC, s[2])
Example #23
0
    def test_it_should_not_run_test_suites_that_do_not_match_the_suite_pattern(
            self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg --suite TestSuiteA host")

        c = Configuration(args, options)
        s = c.test_plan()

        self.assertEqual(1, len(s))
        self.assertEqual(ConfigurationTestCase.TestSuiteA, s[0])
Example #24
0
    def test_it_should_get_the_global_ip_of_tn4(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)

        self.assertEqual(2, len(c.test_network().tn4.if0_ips))
        self.assertTrue(
            IPAddress.identify("2012:6d77:7269::ef:0105") in
            c.test_network().tn4.if0_ips)
Example #25
0
    def test_it_should_get_the_link_local_ip_of_tn4(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)

        self.assertEqual(2, len(c.test_network().tn4.if0_ips))
        self.assertTrue(
            IPAddress.identify("fe80::7a2b:cbff:feef:0105") in
            c.test_network().tn4.if0_ips)
Example #26
0
    def test_it_should_read_an_ordered_list_of_all_known_test_suites(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)
        s = c.test_suites()

        self.assertEqual(6, len(s))
        self.assertEqual('ipv6-basic-specification', s[0])
        self.assertEqual('ipv6-default-address-selection', s[1])
        self.assertEqual('icmpv6', s[2])
        self.assertEqual('neighbour-discovery', s[3])
Example #27
0
    def test_it_should_read_an_ordered_list_of_all_known_devices(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)
        k = c.device_klasses()

        self.assertEqual(10, len(k))
        self.assertEqual('host', k[0])
        self.assertEqual('switch-consumer', k[1])
        self.assertEqual('switch-enterprise', k[2])
        self.assertEqual('router', k[3])
Example #28
0
    def test_it_should_identify_a_subset_of_test_suites_to_run_2_of_2(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg switch-enterprise")

        c = Configuration(args, options)
        s = c.test_plan()

        self.assertEqual(3, len(s))
        self.assertEqual(ConfigurationTestCase.TestSuiteA, s[0])
        self.assertEqual(ConfigurationTestCase.TestSuiteB, s[1])
        self.assertEqual(ConfigurationTestCase.TestSuiteC, s[2])
Example #29
0
    def test_it_should_pass_configuration_into_the_build_report(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg --title Report --vendor veripy --device Desktop --notes Lorem. host")

        c = Configuration(args, options)
        r = c.build_report()

        self.assertEqual("host", r.klass)
        self.assertEqual("Report", r.title)
        self.assertEqual("veripy", r.vendor)
        self.assertEqual("Desktop", r.device)
        self.assertEqual("Lorem.", r.notes)
Example #30
0
    def test_it_should_identify_a_subset_of_test_suites_to_run_with_optional_protocols(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg -p switch-is-a-router switch-enterprise")

        c = Configuration(args, options)
        s = c.test_plan()

        self.assertEqual(4, len(s))
        self.assertEqual(ConfigurationTestCase.TestSuiteA, s[0])
        self.assertEqual(ConfigurationTestCase.TestSuiteB, s[1])
        self.assertEqual(ConfigurationTestCase.TestSuiteC, s[2])
        self.assertEqual(ConfigurationTestCase.TestSuiteF, s[3])
Example #31
0
    def test_it_should_read_an_ordered_list_of_all_known_test_suites(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)
        s = c.test_suites()

        self.assertEqual(6, len(s))
        self.assertEqual('ipv6-basic-specification', s[0])
        self.assertEqual('ipv6-default-address-selection', s[1])
        self.assertEqual('icmpv6', s[2])
        self.assertEqual('neighbour-discovery', s[3])
Example #32
0
    def test_it_should_read_an_ordered_list_of_all_known_devices(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)
        k = c.device_klasses()

        self.assertEqual(10, len(k))
        self.assertEqual('host', k[0])
        self.assertEqual('switch-consumer', k[1])
        self.assertEqual('switch-enterprise', k[2])
        self.assertEqual('router', k[3])
Example #33
0
    def test_it_should_get_the_global_ip_of_tr3if1(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)

        self.assertEqual(2, len(c.test_network().tr1.if0_ips))
        self.assertTrue(
            IPAddress.identify("2012:6970:7636::fe:104") in
            c.test_network().tr3.if1_ips)
        self.assertTrue(
            IPAddress.identify("fe80::7a2b:cbff:fefe:104") in
            c.test_network().tr3.if1_ips)
Example #34
0
    def test_it_should_pass_configuration_into_the_build_report(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg --title Report --vendor veripy --device Desktop --notes Lorem. host"
        )

        c = Configuration(args, options)
        r = c.build_report()

        self.assertEqual("host", r.klass)
        self.assertEqual("Report", r.title)
        self.assertEqual("veripy", r.vendor)
        self.assertEqual("Desktop", r.device)
        self.assertEqual("Lorem.", r.notes)
Example #35
0
    def test_it_should_identify_a_subset_of_test_suites_to_run_with_optional_protocols(
            self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg -p switch-is-a-router switch-enterprise"
        )

        c = Configuration(args, options)
        s = c.test_plan()

        self.assertEqual(4, len(s))
        self.assertEqual(ConfigurationTestCase.TestSuiteA, s[0])
        self.assertEqual(ConfigurationTestCase.TestSuiteB, s[1])
        self.assertEqual(ConfigurationTestCase.TestSuiteC, s[2])
        self.assertEqual(ConfigurationTestCase.TestSuiteF, s[3])
Example #36
0
    def test_it_should_raise_if_no_device_is_specified(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg")

        try:
            Configuration(args, options)

            self.fail("expected an InvalidConfigurationError to be thrown")
        except InvalidConfigurationError, e:
            self.assertEqual("no device class specified", e.message)
Example #37
0
    def test_it_should_identify_an_output_formatter(self):
        options, args = sampleOptions(
            "--configuratio tests/mocks/veripy.cfg -fX out.xml host")

        c = Configuration(args, options)

        self.assertEqual(1, len(c.formatters))
        self.assertTrue("X" in c.formatters.keys())
        self.assertEqual("XMLFormatter", c.formatters['X'][0].__name__)
        self.assertEqual("out.xml", c.formatters['X'][1])
Example #38
0
    def test_it_should_raise_if_an_unknown_protocol_is_specified(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg -p RAID host")

        try:
            Configuration(args, options)

            self.fail("expected an InvalidConfigurationError to be thrown")
        except InvalidConfigurationError, e:
            self.assertEqual("unknown protocol 'RAID' specified", e.message)
Example #39
0
    def test_it_should_raise_if_an_unknown_device_is_specified(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg dog")

        try:
            Configuration(args, options)

            self.fail("expected an InvalidConfigurationError to be thrown")
        except InvalidConfigurationError, e:
            self.assertEqual("'dog' is not a known type of device", e.message)
Example #40
0
    def test_it_should_read_configuration_from_the_specified_file(self):
        options, args = sampleOptions(
            "--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)

        self.assertTrue(isinstance(c, Configuration))
        self.assertTrue(c.has_section('test-section'))
        self.assertEqual(1, len(c.keys('test-section')))
        self.assertTrue(c.has_option('test-section', 'key'))
        self.assertEqual('value', c.get('test-section', 'key'))
Example #41
0
    def test_it_should_build_a_configuration(self):
        options, args = sampleOptions("host")

        self.assertTrue(isinstance(Configuration(args, options),
                                   Configuration))
Example #42
0
    def test_it_should_configure_a_test_case_pattern(self):
        options, args = sampleOptions(["--case", "My Test Case", "host"])

        c = Configuration(args, options)

        self.assertEqual('My Test Case', c.case_rx)
Example #43
0
    def test_it_should_get_the_link_layer_address_of_tap2(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)

        self.assertEqual('00:50:56:c0:00:08', c.test_network().tp2.ll_addr)
Example #44
0
    def test_it_should_get_the_physical_device_for_tap2(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)

        self.assertEqual('vmnet8', c.test_network().tp2.dev)
Example #45
0
    def test_it_should_configure_the_prefix_size_of_link_c(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)

        self.assertEqual(64, c.test_network().link3.prefix_size)
Example #46
0
    def test_it_should_configure_the_prefix_of_link_b(self):
        options, args = sampleOptions("--configuration tests/mocks/veripy.cfg host")

        c = Configuration(args, options)

        self.assertEqual("2012:6970:7636:0000:0000:0000:0000:0000", c.test_network().link2.prefix)