예제 #1
0
    def test__get_default_route(self):
        v4_expected = [{
            'network': '0.0.0.0',
            'netmask': '0.0.0.0',
            'gateway': '10.10.0.1',
        }]
        v6_expected = [{
            'network': '::',
            'netmask': '::',
            'gateway': 'fd00::1'
        }]
        v4 = netutils._get_default_route(
            4, self.netinfo[0]['network']['subnets'][0])
        self.assertEqual(v4_expected, v4)

        v6 = netutils._get_default_route(
            6, self.netinfo[0]['network']['subnets'][1])
        self.assertEqual(v6_expected, v6)

        # Test for no gateway
        self.netinfo[0]['network']['subnets'][0]['gateway'] = None
        no_route = netutils._get_default_route(
            4, self.netinfo[0]['network']['subnets'][0])
        self.assertEqual([], no_route)
예제 #2
0
    def test__get_default_route(self):
        v4_expected = [{
            'network': '0.0.0.0',
            'netmask': '0.0.0.0',
            'gateway': '10.10.0.1',
        }]
        v6_expected = [{
            'network': '::',
            'netmask': '::',
            'gateway': 'fd00::1'
        }]
        v4 = netutils._get_default_route(
            4, self.netinfo[0]['network']['subnets'][0])
        self.assertEqual(v4_expected, v4)

        v6 = netutils._get_default_route(
            6, self.netinfo[0]['network']['subnets'][1])
        self.assertEqual(v6_expected, v6)

        # Test for no gateway
        self.netinfo[0]['network']['subnets'][0]['gateway'] = None
        no_route = netutils._get_default_route(
            4, self.netinfo[0]['network']['subnets'][0])
        self.assertEqual([], no_route)