def plug_port_to_network(self, context, port_id, segmentation_id):
        with netconf.ConfFile(netconf.INT_BRIDGE) as cfg:
            cfg.ensure_opt_contain_value('bridge-ports', port_id)

        with netconf.ConfFile(port_id) as int_cfg:
            int_cfg.ensure_opt_has_value('bridge-access', str(segmentation_id))
        LOG.info(_LI("Port %(port_id)s was plugged to vlan "
                     "%(segmentation_id)d "),
                 {'segmentation_id': segmentation_id,
                  'port_id': port_id})
    def delete_port_from_network(self, context, port_id, segmentation_id):
        with netconf.ConfFile(netconf.INT_BRIDGE) as cfg:
            cfg.ensure_opt_not_contain_value('bridge-ports', port_id)

        with netconf.ConfFile(port_id) as int_cfg:
            int_cfg.ensure_opt_not_contain_value('bridge-access',
                                                 str(segmentation_id))
        LOG.info(_LI("Port %(port_id)s was removed from vlan "
                     "%(segmentation_id)d "),
                 {'segmentation_id': segmentation_id,
                  'port_id': port_id})
 def delete_network(self, context, current):
     segmentation_id = current[pnet.SEGMENTATION_ID]
     with netconf.ConfFile(netconf.INT_BRIDGE) as cfg:
         cfg.ensure_opt_not_contain_value('bridge-vids',
                                          str(segmentation_id))
     LOG.debug("Network with vlan %(segmentation_id)d was deleted.",
               {'segmentation_id': segmentation_id})
 def create_network(self, context, current):
     segmentation_id = current[pnet.SEGMENTATION_ID]
     LOG.debug("Creating network with vlan %(segmentation_id)d ",
               {'segmentation_id': segmentation_id})
     with netconf.ConfFile(netconf.INT_BRIDGE) as cfg:
         cfg.ensure_opt_contain_value('bridge-vids', str(segmentation_id))
     LOG.info(_LI("Network with vlan %(segmentation_id)d was created."),
              {'segmentation_id': segmentation_id})
Пример #5
0
 def ensure_integration_bridge_exist(self):
     with netconf.ConfFile(netconf.INT_BRIDGE) as cfg:
         cfg.ensure_opt_has_value('bridge-vlan-aware', 'yes')