当前位置: 首页>>代码示例>>Python>>正文


Python n1kv_db_v2.get_network_binding函数代码示例

本文整理汇总了Python中neutron.plugins.cisco.db.n1kv_db_v2.get_network_binding函数的典型用法代码示例。如果您正苦于以下问题:Python get_network_binding函数的具体用法?Python get_network_binding怎么用?Python get_network_binding使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_network_binding函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_add_vxlan_trunk_binding

    def test_add_vxlan_trunk_binding(self):
        with self.network() as network1:
            with self.network() as network2:
                TEST_NETWORK_ID = network1['network']['id']

                self.assertRaises(c_exc.NetworkBindingNotFound,
                                  n1kv_db_v2.get_network_binding,
                                  self.session,
                                  TEST_NETWORK_ID)
                TEST_NETWORK_ID2 = network2['network']['id']
                self.assertRaises(c_exc.NetworkBindingNotFound,
                                  n1kv_db_v2.get_network_binding,
                                  self.session,
                                  TEST_NETWORK_ID2)
                p_v = _create_test_network_profile_if_not_there(
                    self.session, TEST_NETWORK_PROFILE_VXLAN_TRUNK)
                n1kv_db_v2.add_network_binding(
                    self.session, TEST_NETWORK_ID2,
                    c_const.NETWORK_TYPE_OVERLAY,
                    None, 5100, '224.10.10.10', p_v.id, None)
                p = _create_test_network_profile_if_not_there(
                    self.session,
                    TEST_NETWORK_PROFILE_VXLAN_TRUNK)
                n1kv_db_v2.add_network_binding(
                    self.session, TEST_NETWORK_ID, c_const.NETWORK_TYPE_TRUNK,
                    None, 0, '0.0.0.0', p.id,
                    [(TEST_NETWORK_ID2, 5)])
                binding = n1kv_db_v2.get_network_binding(
                    self.session, TEST_NETWORK_ID)
                self.assertIsNotNone(binding)
                self.assertEqual(binding.network_id, TEST_NETWORK_ID)
                self.assertEqual(binding.network_type,
                                 c_const.NETWORK_TYPE_TRUNK)
                self.assertIsNone(binding.physical_network)
                self.assertEqual(binding.segmentation_id, 0)
                t_binding = (n1kv_db_v2.get_trunk_network_binding(
                             self.session, TEST_NETWORK_ID,
                             (TEST_NETWORK_ID2, '5')))
                self.assertIsNotNone(t_binding)
                self.assertEqual(t_binding.trunk_segment_id, TEST_NETWORK_ID)
                self.assertEqual(t_binding.segment_id, TEST_NETWORK_ID2)
                self.assertEqual(t_binding.dot1qtag, '5')
                t_members = (n1kv_db_v2.get_trunk_members(
                    self.session, TEST_NETWORK_ID))
                self.assertEqual(t_members,
                                 [(TEST_NETWORK_ID2, '5')])
                self.assertTrue(n1kv_db_v2.is_trunk_member(
                    self.session, TEST_NETWORK_ID2))
                n1kv_db_v2.del_trunk_segment_binding(
                    self.session, TEST_NETWORK_ID,
                    [(TEST_NETWORK_ID2, '5')])
                t_members = (n1kv_db_v2.get_multi_segment_members(
                    self.session, TEST_NETWORK_ID))
                self.assertEqual(t_members, [])
开发者ID:COSHPC,项目名称:neutron,代码行数:54,代码来源:test_n1kv_db.py

示例2: _get_segmentation_id

    def _get_segmentation_id(self, context, id):
        """
        Retreive segmentation ID for a given network.

        :param context: neutron api request context
        :param id: UUID of the network
        :returns: segmentation ID for the network
        """
        session = context.session
        binding = n1kv_db_v2.get_network_binding(session, id)
        return binding.segmentation_id
开发者ID:abhirajbutala,项目名称:neutron,代码行数:11,代码来源:n1kv_neutron_plugin.py

示例3: _extend_network_dict_provider

 def _extend_network_dict_provider(self, context, network):
     """Add extended network parameters."""
     binding = n1kv_db_v2.get_network_binding(context.session,
                                              network['id'])
     network[providernet.NETWORK_TYPE] = binding.network_type
     if binding.network_type == c_const.NETWORK_TYPE_VXLAN:
         network[providernet.PHYSICAL_NETWORK] = None
         network[providernet.SEGMENTATION_ID] = binding.segmentation_id
         network[n1kv_profile.MULTICAST_IP] = binding.multicast_ip
     elif binding.network_type == c_const.NETWORK_TYPE_VLAN:
         network[providernet.PHYSICAL_NETWORK] = binding.physical_network
         network[providernet.SEGMENTATION_ID] = binding.segmentation_id
开发者ID:abhirajbutala,项目名称:neutron,代码行数:12,代码来源:n1kv_neutron_plugin.py

示例4: test_add_vlan_trunk_binding

    def test_add_vlan_trunk_binding(self):
        with self.network() as network1:
            with self.network() as network2:
                TEST_NETWORK_ID = network1['network']['id']

                self.assertRaises(c_exc.NetworkBindingNotFound,
                                  n1kv_db_v2.get_network_binding,
                                  self.session,
                                  TEST_NETWORK_ID)
                TEST_NETWORK_ID2 = network2['network']['id']
                self.assertRaises(c_exc.NetworkBindingNotFound,
                                  n1kv_db_v2.get_network_binding,
                                  self.session,
                                  TEST_NETWORK_ID2)
                p_v = _create_test_network_profile_if_not_there(self.session)
                n1kv_db_v2.add_network_binding(
                    self.session, TEST_NETWORK_ID2, 'vlan',
                    PHYS_NET, 1234, '0.0.0.0', p_v.id, None)
                p = _create_test_network_profile_if_not_there(
                    self.session,
                    TEST_NETWORK_PROFILE_VLAN_TRUNK)
                n1kv_db_v2.add_network_binding(
                    self.session, TEST_NETWORK_ID, 'trunk',
                    None, 0, '0.0.0.0', p.id, [(TEST_NETWORK_ID2, 0)])
                binding = n1kv_db_v2.get_network_binding(
                    self.session, TEST_NETWORK_ID)
                self.assertIsNotNone(binding)
                self.assertEqual(binding.network_id, TEST_NETWORK_ID)
                self.assertEqual(binding.network_type, 'trunk')
                self.assertEqual(binding.physical_network, PHYS_NET)
                self.assertEqual(binding.segmentation_id, 0)
                t_binding = (n1kv_db_v2.get_trunk_network_binding(
                             self.session, TEST_NETWORK_ID,
                             (TEST_NETWORK_ID2, 0)))
                self.assertIsNotNone(t_binding)
                self.assertEqual(t_binding.trunk_segment_id, TEST_NETWORK_ID)
                self.assertEqual(t_binding.segment_id, TEST_NETWORK_ID2)
                self.assertEqual(t_binding.dot1qtag, '0')
                t_members = (n1kv_db_v2.get_trunk_members(
                    self.session, TEST_NETWORK_ID))
                self.assertEqual(t_members,
                                 [(TEST_NETWORK_ID2, '0')])
                self.assertTrue(n1kv_db_v2.is_trunk_member(
                                self.session, TEST_NETWORK_ID2))
                n1kv_db_v2.del_trunk_segment_binding(
                    self.session, TEST_NETWORK_ID,
                    [(TEST_NETWORK_ID2, '0')])
                t_members = (n1kv_db_v2.get_multi_segment_members(
                    self.session, TEST_NETWORK_ID))
                self.assertEqual(t_members, [])
开发者ID:PFZheng,项目名称:neutron,代码行数:50,代码来源:test_n1kv_db.py

示例5: test_create_vxlan_trunk_network

    def test_create_vxlan_trunk_network(self):
        with self.network() as network:
            TEST_NETWORK_ID = network["network"]["id"]

            self.assertRaises(
                c_exc.NetworkBindingNotFound, n1kv_db_v2.get_network_binding, self.session, TEST_NETWORK_ID
            )

            p = _create_test_network_profile_if_not_there(self.session, TEST_NETWORK_PROFILE_VXLAN_TRUNK)
            n1kv_db_v2.add_network_binding(self.session, TEST_NETWORK_ID, "trunk", None, 0, "0.0.0.0", p.id, None)
            binding = n1kv_db_v2.get_network_binding(self.session, TEST_NETWORK_ID)
            self.assertIsNotNone(binding)
            self.assertEqual(binding.network_id, TEST_NETWORK_ID)
            self.assertEqual(binding.network_type, "trunk")
            self.assertIsNone(binding.physical_network)
            self.assertEqual(binding.segmentation_id, 0)
开发者ID:gjholler,项目名称:neutron,代码行数:16,代码来源:test_n1kv_db.py

示例6: test_add_network_binding

    def test_add_network_binding(self):
        with self.network() as network:
            TEST_NETWORK_ID = network["network"]["id"]

            self.assertRaises(
                c_exc.NetworkBindingNotFound, n1kv_db_v2.get_network_binding, self.session, TEST_NETWORK_ID
            )

            p = _create_test_network_profile_if_not_there(self.session)
            n1kv_db_v2.add_network_binding(self.session, TEST_NETWORK_ID, "vlan", PHYS_NET, 1234, "0.0.0.0", p.id, None)
            binding = n1kv_db_v2.get_network_binding(self.session, TEST_NETWORK_ID)
            self.assertIsNotNone(binding)
            self.assertEqual(binding.network_id, TEST_NETWORK_ID)
            self.assertEqual(binding.network_type, "vlan")
            self.assertEqual(binding.physical_network, PHYS_NET)
            self.assertEqual(binding.segmentation_id, 1234)
开发者ID:gjholler,项目名称:neutron,代码行数:16,代码来源:test_n1kv_db.py

示例7: test_add_multi_segment_binding

    def test_add_multi_segment_binding(self):
        with self.network() as network:
            TEST_NETWORK_ID = network['network']['id']

            self.assertRaises(c_exc.NetworkBindingNotFound,
                              n1kv_db_v2.get_network_binding,
                              self.session,
                              TEST_NETWORK_ID)

            p = _create_test_network_profile_if_not_there(
                self.session,
                TEST_NETWORK_PROFILE_MULTI_SEGMENT)
            n1kv_db_v2.add_network_binding(
                self.session, TEST_NETWORK_ID,
                c_const.NETWORK_TYPE_MULTI_SEGMENT,
                None, 0, '0.0.0.0', p.id,
                [(TEST_NETWORK_ID2, TEST_NETWORK_ID3)])
            binding = n1kv_db_v2.get_network_binding(
                self.session, TEST_NETWORK_ID)
            self.assertIsNotNone(binding)
            self.assertEqual(binding.network_id, TEST_NETWORK_ID)
            self.assertEqual(binding.network_type,
                             c_const.NETWORK_TYPE_MULTI_SEGMENT)
            self.assertIsNone(binding.physical_network)
            self.assertEqual(binding.segmentation_id, 0)
            ms_binding = (n1kv_db_v2.get_multi_segment_network_binding(
                          self.session, TEST_NETWORK_ID,
                          (TEST_NETWORK_ID2, TEST_NETWORK_ID3)))
            self.assertIsNotNone(ms_binding)
            self.assertEqual(ms_binding.multi_segment_id, TEST_NETWORK_ID)
            self.assertEqual(ms_binding.segment1_id, TEST_NETWORK_ID2)
            self.assertEqual(ms_binding.segment2_id, TEST_NETWORK_ID3)
            ms_members = (n1kv_db_v2.get_multi_segment_members(
                          self.session, TEST_NETWORK_ID))
            self.assertEqual(ms_members,
                             [(TEST_NETWORK_ID2, TEST_NETWORK_ID3)])
            self.assertTrue(n1kv_db_v2.is_multi_segment_member(
                            self.session, TEST_NETWORK_ID2))
            self.assertTrue(n1kv_db_v2.is_multi_segment_member(
                            self.session, TEST_NETWORK_ID3))
            n1kv_db_v2.del_multi_segment_binding(
                self.session, TEST_NETWORK_ID,
                [(TEST_NETWORK_ID2, TEST_NETWORK_ID3)])
            ms_members = (n1kv_db_v2.get_multi_segment_members(
                          self.session, TEST_NETWORK_ID))
            self.assertEqual(ms_members, [])
开发者ID:COSHPC,项目名称:neutron,代码行数:46,代码来源:test_n1kv_db.py

示例8: test_add_network_binding

    def test_add_network_binding(self):
        with self.network() as network:
            TEST_NETWORK_ID = network['network']['id']

            self.assertRaises(c_exc.NetworkBindingNotFound,
                              n1kv_db_v2.get_network_binding,
                              self.session,
                              TEST_NETWORK_ID)

            p = _create_test_network_profile_if_not_there(self.session)
            n1kv_db_v2.add_network_binding(
                self.session, TEST_NETWORK_ID, c_const.NETWORK_TYPE_VLAN,
                PHYS_NET, 1234, '0.0.0.0', p.id, None)
            binding = n1kv_db_v2.get_network_binding(
                self.session, TEST_NETWORK_ID)
            self.assertIsNotNone(binding)
            self.assertEqual(binding.network_id, TEST_NETWORK_ID)
            self.assertEqual(binding.network_type, c_const.NETWORK_TYPE_VLAN)
            self.assertEqual(binding.physical_network, PHYS_NET)
            self.assertEqual(binding.segmentation_id, 1234)
开发者ID:COSHPC,项目名称:neutron,代码行数:20,代码来源:test_n1kv_db.py

示例9: test_create_multi_segment_network

    def test_create_multi_segment_network(self):
        with self.network() as network:
            TEST_NETWORK_ID = network['network']['id']

            self.assertRaises(c_exc.NetworkBindingNotFound,
                              n1kv_db_v2.get_network_binding,
                              self.session,
                              TEST_NETWORK_ID)

            p = _create_test_network_profile_if_not_there(
                self.session,
                TEST_NETWORK_PROFILE_MULTI_SEGMENT)
            n1kv_db_v2.add_network_binding(
                self.session, TEST_NETWORK_ID, 'multi-segment',
                None, 0, '0.0.0.0', p.id, None)
            binding = n1kv_db_v2.get_network_binding(
                self.session, TEST_NETWORK_ID)
            self.assertIsNotNone(binding)
            self.assertEqual(binding.network_id, TEST_NETWORK_ID)
            self.assertEqual(binding.network_type, 'multi-segment')
            self.assertIsNone(binding.physical_network)
            self.assertEqual(binding.segmentation_id, 0)
开发者ID:PFZheng,项目名称:neutron,代码行数:22,代码来源:test_n1kv_db.py

示例10: test_add_vxlan_trunk_binding

    def test_add_vxlan_trunk_binding(self):
        with self.network() as network1:
            with self.network() as network2:
                TEST_NETWORK_ID = network1["network"]["id"]

                self.assertRaises(
                    c_exc.NetworkBindingNotFound, n1kv_db_v2.get_network_binding, self.session, TEST_NETWORK_ID
                )
                TEST_NETWORK_ID2 = network2["network"]["id"]
                self.assertRaises(
                    c_exc.NetworkBindingNotFound, n1kv_db_v2.get_network_binding, self.session, TEST_NETWORK_ID2
                )
                p_v = _create_test_network_profile_if_not_there(self.session, TEST_NETWORK_PROFILE_VXLAN_TRUNK)
                n1kv_db_v2.add_network_binding(
                    self.session, TEST_NETWORK_ID2, "overlay", None, 5100, "224.10.10.10", p_v.id, None
                )
                p = _create_test_network_profile_if_not_there(self.session, TEST_NETWORK_PROFILE_VXLAN_TRUNK)
                n1kv_db_v2.add_network_binding(
                    self.session, TEST_NETWORK_ID, "trunk", None, 0, "0.0.0.0", p.id, [(TEST_NETWORK_ID2, 5)]
                )
                binding = n1kv_db_v2.get_network_binding(self.session, TEST_NETWORK_ID)
                self.assertIsNotNone(binding)
                self.assertEqual(binding.network_id, TEST_NETWORK_ID)
                self.assertEqual(binding.network_type, "trunk")
                self.assertIsNone(binding.physical_network)
                self.assertEqual(binding.segmentation_id, 0)
                t_binding = n1kv_db_v2.get_trunk_network_binding(self.session, TEST_NETWORK_ID, (TEST_NETWORK_ID2, "5"))
                self.assertIsNotNone(t_binding)
                self.assertEqual(t_binding.trunk_segment_id, TEST_NETWORK_ID)
                self.assertEqual(t_binding.segment_id, TEST_NETWORK_ID2)
                self.assertEqual(t_binding.dot1qtag, "5")
                t_members = n1kv_db_v2.get_trunk_members(self.session, TEST_NETWORK_ID)
                self.assertEqual(t_members, [(TEST_NETWORK_ID2, "5")])
                self.assertTrue(n1kv_db_v2.is_trunk_member(self.session, TEST_NETWORK_ID2))
                n1kv_db_v2.del_trunk_segment_binding(self.session, TEST_NETWORK_ID, [(TEST_NETWORK_ID2, "5")])
                t_members = n1kv_db_v2.get_multi_segment_members(self.session, TEST_NETWORK_ID)
                self.assertEqual(t_members, [])
开发者ID:gjholler,项目名称:neutron,代码行数:37,代码来源:test_n1kv_db.py

示例11: delete_network

    def delete_network(self, context, id):
        """
        Delete a network.

        :param context: neutron api request context
        :param id: UUID representing the network to delete
        """
        session = context.session
        with session.begin(subtransactions=True):
            binding = n1kv_db_v2.get_network_binding(session, id)
            network = self.get_network(context, id)
            super(N1kvNeutronPluginV2, self).delete_network(context, id)
            if binding.network_type == c_const.NETWORK_TYPE_VXLAN:
                n1kv_db_v2.release_vxlan(session, binding.segmentation_id,
                                         self.vxlan_id_ranges)
            elif binding.network_type == c_const.NETWORK_TYPE_VLAN:
                n1kv_db_v2.release_vlan(session, binding.physical_network,
                                        binding.segmentation_id,
                                        self.network_vlan_ranges)
                # the network_binding record is deleted via cascade from
                # the network record, so explicit removal is not necessary
        if self.agent_vsm:
            self._send_delete_network_request(network)
        LOG.debug(_("Deleted network: %s"), id)
开发者ID:abhirajbutala,项目名称:neutron,代码行数:24,代码来源:n1kv_neutron_plugin.py

示例12: _extend_network_dict_profile

 def _extend_network_dict_profile(self, context, network):
     """Add the extended parameter network profile to the network."""
     binding = n1kv_db_v2.get_network_binding(context.session,
                                              network['id'])
     network[n1kv_profile.PROFILE_ID] = binding.profile_id
开发者ID:abhirajbutala,项目名称:neutron,代码行数:5,代码来源:n1kv_neutron_plugin.py


注:本文中的neutron.plugins.cisco.db.n1kv_db_v2.get_network_binding函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。