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


Python db.get_segment_by_id函数代码示例

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


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

示例1: test_get_segment_by_id

    def test_get_segment_by_id(self):
        segment = {api.NETWORK_TYPE: "vlan", api.PHYSICAL_NETWORK: "physnet1", api.SEGMENTATION_ID: 1}

        net_segment = self._create_segments([segment])[0]
        segment_uuid = net_segment[api.ID]

        net_segment = ml2_db.get_segment_by_id(self.ctx.session, segment_uuid)
        self.assertEqual(segment, net_segment)
开发者ID:qianqunyi,项目名称:neutron,代码行数:8,代码来源:test_db.py

示例2: test_delete_network_segment

    def test_delete_network_segment(self):
        segment = {api.NETWORK_TYPE: "vlan", api.PHYSICAL_NETWORK: "physnet1", api.SEGMENTATION_ID: 1}

        net_segment = self._create_segments([segment])[0]
        segment_uuid = net_segment[api.ID]

        ml2_db.delete_network_segment(self.ctx.session, segment_uuid)
        # Get segment and verify its empty
        net_segment = ml2_db.get_segment_by_id(self.ctx.session, segment_uuid)
        self.assertIsNone(net_segment)
开发者ID:qianqunyi,项目名称:neutron,代码行数:10,代码来源:test_db.py

示例3: release_dynamic_segment

 def release_dynamic_segment(self, session, segment_id):
     """Delete a dynamic segment."""
     segment = db.get_segment_by_id(session, segment_id)
     if segment:
         driver = self.drivers.get(segment.get(api.NETWORK_TYPE))
         if driver:
             driver.obj.release_segment(session, segment)
             db.delete_network_segment(session, segment_id)
         else:
             LOG.error(_LE("Failed to release segment '%s' because " "network type is not supported."), segment)
     else:
         LOG.debug("No segment found with id %(segment_id)s", segment_id)
开发者ID:bigswitch,项目名称:neutron,代码行数:12,代码来源:managers.py

示例4: test_get_segment_by_id_result_not_found

 def test_get_segment_by_id_result_not_found(self):
     segment_uuid = uuidutils.generate_uuid()
     net_segment = ml2_db.get_segment_by_id(self.ctx.session, segment_uuid)
     self.assertIsNone(net_segment)
开发者ID:Blahhhhh,项目名称:neutron,代码行数:4,代码来源:test_db.py

示例5: _expand_segment

 def _expand_segment(self, segment_id):
     segment = db.get_segment_by_id(self._plugin_context.session,
                                    segment_id)
     if not segment:
         LOG.warning(_LW("Could not expand segment %s"), segment_id)
     return segment
开发者ID:Intellifora,项目名称:neutron,代码行数:6,代码来源:driver_context.py


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