예제 #1
0
    def test_sync_segmentationIdAllocation(self):
        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET, VLAN_MIN - 1))
        self.assertFalse(mlnx_db.get_network_state(PHYS_NET, VLAN_MIN).allocated)
        self.assertFalse(mlnx_db.get_network_state(PHYS_NET, VLAN_MIN + 1).allocated)
        self.assertFalse(mlnx_db.get_network_state(PHYS_NET, VLAN_MAX - 1).allocated)
        self.assertFalse(mlnx_db.get_network_state(PHYS_NET, VLAN_MAX).allocated)
        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET, VLAN_MAX + 1))

        mlnx_db.sync_network_states(UPDATED_VLAN_RANGES)

        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET, VLAN_MIN + 5 - 1))
        self.assertFalse(mlnx_db.get_network_state(PHYS_NET, VLAN_MIN + 5).allocated)
        self.assertFalse(mlnx_db.get_network_state(PHYS_NET, VLAN_MIN + 5 + 1).allocated)
        self.assertFalse(mlnx_db.get_network_state(PHYS_NET, VLAN_MAX + 5 - 1).allocated)
        self.assertFalse(mlnx_db.get_network_state(PHYS_NET, VLAN_MAX + 5).allocated)
        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET, VLAN_MAX + 5 + 1))

        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET_2, VLAN_MIN + 20 - 1))
        self.assertFalse(mlnx_db.get_network_state(PHYS_NET_2, VLAN_MIN + 20).allocated)
        self.assertFalse(mlnx_db.get_network_state(PHYS_NET_2, VLAN_MIN + 20 + 1).allocated)
        self.assertFalse(mlnx_db.get_network_state(PHYS_NET_2, VLAN_MAX + 20 - 1).allocated)
        self.assertFalse(mlnx_db.get_network_state(PHYS_NET_2, VLAN_MAX + 20).allocated)
        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET_2, VLAN_MAX + 20 + 1))

        mlnx_db.sync_network_states(VLAN_RANGES)

        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET, VLAN_MIN - 1))
        self.assertFalse(mlnx_db.get_network_state(PHYS_NET, VLAN_MIN).allocated)
        self.assertFalse(mlnx_db.get_network_state(PHYS_NET, VLAN_MIN + 1).allocated)
        self.assertFalse(mlnx_db.get_network_state(PHYS_NET, VLAN_MAX - 1).allocated)
        self.assertFalse(mlnx_db.get_network_state(PHYS_NET, VLAN_MAX).allocated)
        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET, VLAN_MAX + 1))

        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET_2, VLAN_MIN + 20))
        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET_2, VLAN_MAX + 20))
예제 #2
0
 def __init__(self):
     """Start Mellanox Neutron Plugin."""
     db.initialize()
     self._parse_network_vlan_ranges()
     db.sync_network_states(self.network_vlan_ranges)
     self._set_tenant_network_type()
     self.vnic_type = cfg.CONF.ESWITCH.vnic_type
     self._setup_rpc()
     LOG.debug(_("Mellanox Embedded Switch Plugin initialisation complete"))
 def __init__(self):
     """Start Mellanox Neutron Plugin."""
     db.initialize()
     self._parse_network_vlan_ranges()
     db.sync_network_states(self.network_vlan_ranges)
     self._set_tenant_network_type()
     self.vnic_type = cfg.CONF.ESWITCH.vnic_type
     self._setup_rpc()
     LOG.debug(_("Mellanox Embedded Switch Plugin initialisation complete"))
예제 #4
0
    def test_sync_segmentationIdAllocation(self):
        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET, VLAN_MIN - 1))
        self.assertFalse(
            mlnx_db.get_network_state(PHYS_NET, VLAN_MIN).allocated)
        self.assertFalse(
            mlnx_db.get_network_state(PHYS_NET, VLAN_MIN + 1).allocated)
        self.assertFalse(
            mlnx_db.get_network_state(PHYS_NET, VLAN_MAX - 1).allocated)
        self.assertFalse(
            mlnx_db.get_network_state(PHYS_NET, VLAN_MAX).allocated)
        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET, VLAN_MAX + 1))

        mlnx_db.sync_network_states(UPDATED_VLAN_RANGES)

        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET,
                                                    VLAN_MIN + 5 - 1))
        self.assertFalse(
            mlnx_db.get_network_state(PHYS_NET, VLAN_MIN + 5).allocated)
        self.assertFalse(
            mlnx_db.get_network_state(PHYS_NET, VLAN_MIN + 5 + 1).allocated)
        self.assertFalse(
            mlnx_db.get_network_state(PHYS_NET, VLAN_MAX + 5 - 1).allocated)
        self.assertFalse(
            mlnx_db.get_network_state(PHYS_NET, VLAN_MAX + 5).allocated)
        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET,
                                                    VLAN_MAX + 5 + 1))

        self.assertIsNone(
            mlnx_db.get_network_state(PHYS_NET_2, VLAN_MIN + 20 - 1))
        self.assertFalse(
            mlnx_db.get_network_state(PHYS_NET_2, VLAN_MIN + 20).allocated)
        self.assertFalse(
            mlnx_db.get_network_state(PHYS_NET_2, VLAN_MIN + 20 + 1).allocated)
        self.assertFalse(
            mlnx_db.get_network_state(PHYS_NET_2, VLAN_MAX + 20 - 1).allocated)
        self.assertFalse(
            mlnx_db.get_network_state(PHYS_NET_2, VLAN_MAX + 20).allocated)
        self.assertIsNone(
            mlnx_db.get_network_state(PHYS_NET_2, VLAN_MAX + 20 + 1))

        mlnx_db.sync_network_states(VLAN_RANGES)

        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET, VLAN_MIN - 1))
        self.assertFalse(
            mlnx_db.get_network_state(PHYS_NET, VLAN_MIN).allocated)
        self.assertFalse(
            mlnx_db.get_network_state(PHYS_NET, VLAN_MIN + 1).allocated)
        self.assertFalse(
            mlnx_db.get_network_state(PHYS_NET, VLAN_MAX - 1).allocated)
        self.assertFalse(
            mlnx_db.get_network_state(PHYS_NET, VLAN_MAX).allocated)
        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET, VLAN_MAX + 1))

        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET_2, VLAN_MIN + 20))
        self.assertIsNone(mlnx_db.get_network_state(PHYS_NET_2, VLAN_MAX + 20))
예제 #5
0
 def __init__(self):
     """Start Mellanox Neutron Plugin."""
     super(MellanoxEswitchPlugin, self).__init__()
     self._parse_network_vlan_ranges()
     db.sync_network_states(self.network_vlan_ranges)
     self._set_tenant_network_type()
     self.vnic_type = cfg.CONF.ESWITCH.vnic_type
     self.base_binding_dict = {
         portbindings.VIF_TYPE: self.vnic_type,
         portbindings.CAPABILITIES: {
             portbindings.CAP_PORT_FILTER:
             'security-group' in self.supported_extension_aliases}}
     self._setup_rpc()
     self.network_scheduler = importutils.import_object(
         cfg.CONF.network_scheduler_driver
     )
     self.router_scheduler = importutils.import_object(
         cfg.CONF.router_scheduler_driver
     )
     LOG.debug(_("Mellanox Embedded Switch Plugin initialisation complete"))
예제 #6
0
 def setUp(self):
     super(SegmentationIdAllocationTest, self).setUp()
     mlnx_db.initialize()
     mlnx_db.sync_network_states(VLAN_RANGES)
     self.session = db.get_session()
     self.addCleanup(db.clear_db)
예제 #7
0
 def setUp(self):
     super(SegmentationIdAllocationTest, self).setUp()
     db.configure_db()
     mlnx_db.sync_network_states(VLAN_RANGES)
     self.session = db.get_session()
     self.addCleanup(db.clear_db)
예제 #8
0
 def setUp(self):
     super(SegmentationIdAllocationTest, self).setUp()
     mlnx_db.sync_network_states(VLAN_RANGES)
     self.session = db.get_session()
예제 #9
0
 def setUp(self):
     super(SegmentationIdAllocationTest, self).setUp()
     mlnx_db.sync_network_states(VLAN_RANGES)
     self.session = db.get_session()