# Path: apic_ml2/neutron/plugins/ml2/drivers/cisco/apic/network_constraints.py
# LOG = logging.getLogger(__name__)
# SCOPE_PUBLIC = 'public'
# SCOPE_PRIVATE = 'private'
# SCOPE_DENY = 'deny'
# class NetworkConstraintsSource(object):
# class NetworkConstraints(object):
# class ConfigFileSource(NetworkConstraintsSource):
#     def __init__(self):
#     def get_subnet_constraints(self, tenant, network):
#     def __init__(self, constraints_source):
#     def get_subnet_scope(self, tenant, network, cidr):
#     def __init__(self, config_file):
#     def get_subnet_constraints(self, tenant, network):
#     def _refresh(self):
#     def _parse_file(self):
#         def sanitize_scope(scope):
#         def parse_cidr_list(cidrs):


import netaddr
import tempfile
import time
from apic_ml2.neutron.plugins.ml2.drivers.cisco.apic import (
    network_constraints as anc)
from neutron.tests import base
            anc.SCOPE_DENY,
            self.net_cons.get_subnet_scope('t1', 'net1', '30.10.10.1/16'))
        self.assertEqual(
            anc.SCOPE_DENY,
            self.net_cons.get_subnet_scope('t1', 'net1', '30.10.20.1/16'))

    def test_tenant_subnet_scope(self):
        self.assertEqual(
            anc.SCOPE_PUBLIC,
            self.net_cons.get_subnet_scope('t1', 'net3', '10.20.0.0/28'))
        self.assertEqual(
            anc.SCOPE_PUBLIC,
            self.net_cons.get_subnet_scope('t1', 'net4', '10.20.0.0/26'))
        self.assertEqual(
            anc.SCOPE_PRIVATE,
            self.net_cons.get_subnet_scope('t1', 'net3', '20.10.10.0/28'))
        self.assertEqual(
            anc.SCOPE_PRIVATE,
            self.net_cons.get_subnet_scope('t1', 'net4', '20.10.10.0/28'))

    def test_network_default_subnet_scope(self):
        # supersets of public/private
        self.assertEqual(
            anc.SCOPE_PRIVATE,
            self.net_cons.get_subnet_scope('t1', 'net1', '10.10.10.0/20'))
        self.assertEqual(
            anc.SCOPE_PRIVATE,
            self.net_cons.get_subnet_scope('t1', 'net1', '20.10.10.1/20'))

        self.assertEqual(

# Path: apic_ml2/neutron/plugins/ml2/drivers/cisco/apic/network_constraints.py
# LOG = logging.getLogger(__name__)
# SCOPE_PUBLIC = 'public'
# SCOPE_PRIVATE = 'private'
# SCOPE_DENY = 'deny'
# class NetworkConstraintsSource(object):
# class NetworkConstraints(object):
# class ConfigFileSource(NetworkConstraintsSource):
#     def __init__(self):
#     def get_subnet_constraints(self, tenant, network):
#     def __init__(self, constraints_source):
#     def get_subnet_scope(self, tenant, network, cidr):
#     def __init__(self, config_file):
#     def get_subnet_constraints(self, tenant, network):
#     def _refresh(self):
#     def _parse_file(self):
#         def sanitize_scope(scope):
#         def parse_cidr_list(cidrs):


# Path: apic_ml2/neutron/tests/unit/ml2/drivers/cisco/apic/test_network_constraints.py
import netaddr
import tempfile
import time
from apic_ml2.neutron.plugins.ml2.drivers.cisco.apic import (
    network_constraints as anc)
from neutron.tests import base

            anc.SCOPE_DENY,
            self.net_cons.get_subnet_scope('t1', 'net1', '30.10.10.1/16'))
        self.assertEqual(
            anc.SCOPE_DENY,
            self.net_cons.get_subnet_scope('t1', 'net1', '30.10.20.1/16'))

    def test_tenant_subnet_scope(self):
        self.assertEqual(
            anc.SCOPE_PUBLIC,
            self.net_cons.get_subnet_scope('t1', 'net3', '10.20.0.0/28'))
        self.assertEqual(
            anc.SCOPE_PUBLIC,
            self.net_cons.get_subnet_scope('t1', 'net4', '10.20.0.0/26'))
        self.assertEqual(
            anc.SCOPE_PRIVATE,
            self.net_cons.get_subnet_scope('t1', 'net3', '20.10.10.0/28'))
        self.assertEqual(
            anc.SCOPE_PRIVATE,
            self.net_cons.get_subnet_scope('t1', 'net4', '20.10.10.0/28'))

    def test_network_default_subnet_scope(self):
        # supersets of public/private
        self.assertEqual(
            anc.SCOPE_PRIVATE,
            self.net_cons.get_subnet_scope('t1', 'net1', '10.10.10.0/20'))
        self.assertEqual(
            anc.SCOPE_PRIVATE,
            self.net_cons.get_subnet_scope('t1', 'net1', '20.10.10.1/20'))

        self.assertEqual(

            anc.SCOPE_PRIVATE,