Example #1
0
    def test_create_subnet_precommit_default(self, init_vsd_client):
        self.set_config_fixture()
        nmd = NuageMechanismDriver()
        nmd.initialize()

        network = {
            'id': '1',
            'provider:network_type': 'vxlan',
            'router:external': False
        }
        subnet = {'id': '10', 'network_id': '1', 'ip_version': 4}

        nmd.create_subnet_precommit(Context(network, subnet))
Example #2
0
    def test_create_v6_subnet_precommit(self, init_vsd_client):
        self.set_config_fixture()
        nmd = NuageMechanismDriver()
        nmd.initialize()

        network = {
            'id': '1',
            'provider:network_type': 'vxlan',
            'router:external': False
        }
        subnet = {'id': '10', 'network_id': '1', 'ip_version': 6}

        try:
            nmd.create_subnet_precommit(Context(network, subnet))
            self.fail()  # should not get here
        except NuageBadRequest as e:
            self.assertEqual(
                'Bad request: Subnet with ip_version 6 is '
                'currently not supported '
                'for OpenStack managed subnets.', str(e))
Example #3
0
    def test_multi_init_nmd_invalid_server(self, raise_rest, get_cms):

        # init nmd 3 times, mock out the failures
        nmd1 = NuageMechanismDriver()
        nmd2 = NuageMechanismDriver()
        nmd3 = NuageMechanismDriver()

        self.set_invalid_config_fixture()

        nmd1.initialize()
        nmd2.initialize()
        nmd3.initialize()

        # validate there is actually only 1 vsdclient (memoize)
        self.assertEqual(nmd2.vsdclient, nmd1.vsdclient)
        self.assertEqual(nmd3.vsdclient, nmd1.vsdclient)

        # validate only 1 api call is made
        self.assertEqual(1, nmd1.vsdclient.restproxy.api_count)
 def _get_mech_driver():
     mech_driver = NuageMechanismDriver()
     mech_driver.initialize()
     mech_driver.core_plugin._create_port_db = MagicMock()
     return mech_driver
 def get_me_a_nmd(self):
     self.set_config_fixture()
     nmd = NuageMechanismDriver()
     nmd._l2_plugin = nmd
     nmd.initialize()
     return nmd