def delete_network_postcommit(self, context): """ Delete network information from database.""" LOG.info(_("Delete network begin.")) network = context.current network_id = network['id'] tenant_id = network['tenant_id'] if db.is_network_created(tenant_id, network_id): LOG.info(_("Delete network %s from database."), network_id) db.delete_network(tenant_id, network_id) LOG.info(_("Delete network end."))
def create_network_postcommit(self, context): """ Just insert network information into database. When the port is created, we do real operations in our physical device. """ LOG.info(_("Create network postcommit begin.")) network = context.current network_id = network['id'] tenant_id = network['tenant_id'] segments = context.network_segments if not db.is_network_created(tenant_id, network_id): LOG.info(_("Create network with id %s."), network_id) # [{'segmentation_id': id, 'physical_network': value, # 'id': id, 'network_type': gre | vlan | vxlan }] segment_type = segments[0]['network_type'] segment_id = segments[0]['segmentation_id'] db.create_network(tenant_id, network_id, segment_id, segment_type) LOG.info(_("Create network postcommit end."))