Exemplo n.º 1
0
    def test_no_expansion_symetric(self):
        constraints = [{
            "src": "grp1",
            "dst": "grp2",
            "rate": "20mbit",
            "delay": "20ms",
            "symetric": True,
        }]
        network_constraints = {
            "default_rate": "10mbit",
            "default_delay": "10ms",
            "constraints": constraints,
        }
        descs = _generate_actual_grp_constraints(network_constraints)

        self.assertEqual(2, len(descs))

        # bw/rate are applied
        for d in descs:
            self.assertEqual("20mbit", d["rate"])
            self.assertEqual("20ms", d["delay"])

        # descs are symetrics
        self.assertEqual(descs[0]["src"], descs[1]["dst"])
        self.assertEqual(descs[0]["dst"], descs[1]["src"])
Exemplo n.º 2
0
    def test_no_expansion_no_symetric(self):
        constraints = [{
            "src": "grp1",
            "dst": "grp2",
            "rate": "20mbit",
            "delay": "20ms"
        }]
        network_constraints = {
            "default_rate": "10mbit",
            "default_delay": "10ms",
            "constraints": constraints,
        }
        descs = _generate_actual_grp_constraints(network_constraints)

        self.assertEqual(1, len(descs))
        self.assertDictEqual(constraints[0], descs[0])
Exemplo n.º 3
0
    def test_same_src_and_dest_defaults_embedded(self):
        constraints = [{
            "src": "grp1",
            "dst": "grp1",
            "rate": "20mbit",
            "delay": "20ms"
        }]
        network_constraints = {
            "default_rate": "10mbit",
            "default_delay": "10ms",
            "constraints": constraints,
        }
        descs = _generate_actual_grp_constraints(network_constraints)

        self.assertEqual(1, len(descs))
        self.assertDictEqual(constraints[0], descs[0])
        for d in descs:
            self.assertTrue("grp1" == d["src"])
            self.assertTrue("grp1" == d["dst"])
Exemplo n.º 4
0
    def test_expansion_no_symetric(self):
        constraints = [{
            "src": "grp[1-3]",
            "dst": "grp[4-6]",
            "rate": "20mbit",
            "delay": "20ms"
        }]
        network_constraints = {
            "default_rate": "10mbit",
            "default_delay": "10ms",
            "constraints": constraints,
        }
        descs = _generate_actual_grp_constraints(network_constraints)

        self.assertEqual(3 * 3, len(descs))

        # bw/rate are applied
        for d in descs:
            self.assertEqual("20mbit", d["rate"])
            self.assertEqual("20ms", d["delay"])